From patchwork Fri Mar 15 15:06:00 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Caleb Connolly X-Patchwork-Id: 780505 Delivered-To: patch@linaro.org Received: by 2002:a5d:46c1:0:b0:33e:7753:30bd with SMTP id g1csp250077wrs; Fri, 15 Mar 2024 08:06:27 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUIzTpGT2tM00z96LJ38ragr53z61XArndZQCWgB2wmQsJt6fX6zPiUx9P3FttMRnqnOB5D/Lmpo2oiJrjl8mpI X-Google-Smtp-Source: AGHT+IFVcCTlAlRPKTgWJbO6DkhhxrpI1h8EWDvohlelYpoN+hLzJcCqI71lkQOSKe3dXRCv3cHQ X-Received: by 2002:a5d:674e:0:b0:33e:cbec:e98 with SMTP id l14-20020a5d674e000000b0033ecbec0e98mr3533438wrw.13.1710515187738; Fri, 15 Mar 2024 08:06:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1710515187; cv=none; d=google.com; s=arc-20160816; b=o+1MK+n+d661MAsia53MSwBIWMbIOjPCJ5J3Q3cybffcZhXKehrVfiVnUMLNu4dFhX DRW+QD5YUvH/uQ9f6oPW/+rV7ehVgnnL2zlqhUEfbkuecTNOjXTJOeqggRya+sFZEby6 GA+yAH85dSLkAzIIsLf5+iimZ1YVYuc7bhgRu8g/nCIaesYGzAAIq+TjkUY0O87WUMhk sJvTAiTdTcLRjGqGlJFVAwLxCa78F3EIxrHUGIvvzyDjpdqIuqRqpyvc5obXU3slc9V9 twwVBHkSvyBLewGJ0QT57TZwal3CG6dlzCPzUKA9dYncA6Tv1p1+aH4vliJ2fz9OGkFu Y6vQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:cc:to:in-reply-to:references :message-id:content-transfer-encoding:mime-version:subject:date:from :dkim-signature; bh=PL6Z/zkvsAR1KzxwMv1rJzM4fB2Czula3XSPqEJDCS8=; fh=UJLfQHigVNNxRTyupVH3iuVYJLWMjRXGBkTXuIfaL+0=; b=cV/SgI9hGZxvMVc1W/TEafdNqTjYjJgiKSqJuMHdtjuJLmol3zHW0+YCqUnWavLYrS ZhYDZ2PwIQ3AVyI+acCTiYolvKUy1E8inaJ48tHXWbLe6W4VfouIaDDGu9kPWDIp/m7L O/ciJSeyO9aCXGjKuRmuM08Oy5jkskEv6mUr7qBEf/w94RWbGVqWPn62sdMiL0ni55cz crAdpdv5xf+6RdA9RZPjLUJAvO32jNMtTXYlpn9T+GfnO6xLXs4185bU3pTBBU7reYQY DZRTlrxdMxwZOhzrN58RAHKQ0iWkzYl5sNdzzmM/XeDff1CDEN9lcG/8o8dqs64UsyaX Kz6w==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=N14MTh64; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from phobos.denx.de (phobos.denx.de. [85.214.62.61]) by mx.google.com with ESMTPS id f17-20020adfe911000000b0033e777c7cd3si1716120wrm.532.2024.03.15.08.06.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Mar 2024 08:06:27 -0700 (PDT) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) client-ip=85.214.62.61; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=N14MTh64; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 9914688004; Fri, 15 Mar 2024 16:06:16 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="N14MTh64"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 7C21688011; Fri, 15 Mar 2024 16:06:13 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.2 Received: from mail-wr1-x42d.google.com (mail-wr1-x42d.google.com [IPv6:2a00:1450:4864:20::42d]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 0329A87FF2 for ; Fri, 15 Mar 2024 16:06:08 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=caleb.connolly@linaro.org Received: by mail-wr1-x42d.google.com with SMTP id ffacd0b85a97d-33ddd1624beso1410453f8f.1 for ; Fri, 15 Mar 2024 08:06:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1710515167; x=1711119967; darn=lists.denx.de; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=PL6Z/zkvsAR1KzxwMv1rJzM4fB2Czula3XSPqEJDCS8=; b=N14MTh642jeNU8WAEsvNxSgpwwpgXp3/X4zLt9QGP+Kfr2nYga+ckSlNhLQgjnoCgb 65UzaxKioVzUdTK6CygeIBQBwL1E25ZHJyIOj/+e2hMH1RWgStJgA618QhKLCo06lTRi v/Byg/kOya8AERp0zInkJ3E79ATwGqsZ55rBmVOvz9g5Qg4cu3xmoc3zbeFhmAYOgJkd iS4E6UFKlb7f6PTtlfW4oErPiG1r0/js6fLnrpFa3CIpNqy3whwPf+5lDNOemBBWIvhV Rf8ezo7cx3Ds/3CZQw6xqTRgi2aYDdBRyBU5xiyJgAqwG7fasE++9FX83fLU+QzPPOCE 2G7A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710515167; x=1711119967; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=PL6Z/zkvsAR1KzxwMv1rJzM4fB2Czula3XSPqEJDCS8=; b=KUoocNg8VLOayXg4QmZPidIcpMlZbeqPg9VOyfhTvAq2ANjo2EgBI2Bjsmvi9mY4Zt /U79fnJJylPWG+rB4kjHrG44aEURtoj4XhAYbhKttVFVLOlFNWXeZyP6tsyvDGkKM3RV MJLuL6BbDJZvrYjCDeUL90Xm7Q1F3xT8FQvk50ik4Ju2+OmecFJOA+x7e3Q/zxboQcXO WastsQTksUEDaPPLgUUOZ0LprqLcNlidqW4Xj4HCWl31lZF4bnXyyKEnLC85XUUuEGbp wu6sb2QsXUPbqmB8Z2h9H0jaAi9NgsC5B7KGCyPrh/j4WZEES0BRgamJbnMEyEqTPLv4 nOwQ== X-Gm-Message-State: AOJu0YwuXWxE831pWq0H6c0KiO4eOu8HCibU1oIvYjk13bePLeb15p7O cxbGw2vLP2uD5eckdwEESUEMCglK5OatONEGQPvYgNyn63JDpWgn/8uuItnksjI= X-Received: by 2002:adf:cb92:0:b0:33d:61c7:9b2c with SMTP id q18-20020adfcb92000000b0033d61c79b2cmr7745786wrh.34.1710515167313; Fri, 15 Mar 2024 08:06:07 -0700 (PDT) Received: from lion.localdomain (host-92-17-96-232.as13285.net. [92.17.96.232]) by smtp.gmail.com with ESMTPSA id jg28-20020a05600ca01c00b0041401fbe446sm1939502wmb.11.2024.03.15.08.06.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Mar 2024 08:06:06 -0700 (PDT) From: Caleb Connolly Date: Fri, 15 Mar 2024 15:06:00 +0000 Subject: [PATCH v2 1/5] usb: dwc3-generic: implement Qualcomm wrapper MIME-Version: 1.0 Message-Id: <20240315-b4-qcom-usb-v2-1-5467ec27cb26@linaro.org> References: <20240315-b4-qcom-usb-v2-0-5467ec27cb26@linaro.org> In-Reply-To: <20240315-b4-qcom-usb-v2-0-5467ec27cb26@linaro.org> To: Marek Vasut , Tom Rini , Lukasz Majewski , Mattijs Korpershoek , Caleb Connolly , Neil Armstrong , Sumit Garg Cc: u-boot@lists.denx.de X-Mailer: b4 0.14-dev X-Developer-Signature: v=1; a=openpgp-sha256; l=4214; i=caleb.connolly@linaro.org; h=from:subject:message-id; bh=wyOgocaLbH2BVsPAtMVCO6/ZFsvVRUnte7CZsWHnPsE=; b=owGbwMvMwCFYaeA6f6eBkTjjabUkhtQvyXca71mev/ZyQc7791Kz32q/XuIvynlM3MFxwQXWc 2pHi8yrO0pZGAQ5GGTFFFnETyyzbFp72V5j+4ILMHNYmUCGMHBxCsBEPtgy/C9rM3mzUn2+0oqH tRm3VSa+E+AKO3OGZZfpRIFvjOxm3yMYGTYqe2iH6DU/iDvmWbKj997ynYuXJm7dZ3zVRZhf8Om vv9wA X-Developer-Key: i=caleb.connolly@linaro.org; a=openpgp; fpr=83B24DA7FE145076BC38BB250CD904EB673A7C47 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean The Qualcomm specific dwc3 wrapper isn't hugely complicated, implemented the missing initialisation for host and gadget mode. Reviewed-by: Mattijs Korpershoek Signed-off-by: Caleb Connolly Reviewed-by: Marek Vasut --- drivers/usb/dwc3/dwc3-generic.c | 81 ++++++++++++++++++++++++++++++++++++++++- 1 file changed, 80 insertions(+), 1 deletion(-) diff --git a/drivers/usb/dwc3/dwc3-generic.c b/drivers/usb/dwc3/dwc3-generic.c index a379a0002e77..5a355dd86c60 100644 --- a/drivers/usb/dwc3/dwc3-generic.c +++ b/drivers/usb/dwc3/dwc3-generic.c @@ -424,8 +424,79 @@ enum dwc3_omap_utmi_mode { struct dwc3_glue_ops ti_ops = { .glue_configure = dwc3_ti_glue_configure, }; +/* USB QSCRATCH Hardware registers */ +#define QSCRATCH_HS_PHY_CTRL 0x10 +#define UTMI_OTG_VBUS_VALID BIT(20) +#define SW_SESSVLD_SEL BIT(28) + +#define QSCRATCH_SS_PHY_CTRL 0x30 +#define LANE0_PWR_PRESENT BIT(24) + +#define QSCRATCH_GENERAL_CFG 0x08 +#define PIPE_UTMI_CLK_SEL BIT(0) +#define PIPE3_PHYSTATUS_SW BIT(3) +#define PIPE_UTMI_CLK_DIS BIT(8) + +#define PWR_EVNT_IRQ_STAT_REG 0x58 +#define PWR_EVNT_LPM_IN_L2_MASK BIT(4) +#define PWR_EVNT_LPM_OUT_L2_MASK BIT(5) + +#define SDM845_QSCRATCH_BASE_OFFSET 0xf8800 +#define SDM845_QSCRATCH_SIZE 0x400 +#define SDM845_DWC3_CORE_SIZE 0xcd00 + +static void dwc3_qcom_vbus_override_enable(void __iomem *qscratch_base, bool enable) +{ + if (enable) { + setbits_le32(qscratch_base + QSCRATCH_SS_PHY_CTRL, + LANE0_PWR_PRESENT); + setbits_le32(qscratch_base + QSCRATCH_HS_PHY_CTRL, + UTMI_OTG_VBUS_VALID | SW_SESSVLD_SEL); + } else { + clrbits_le32(qscratch_base + QSCRATCH_SS_PHY_CTRL, + LANE0_PWR_PRESENT); + clrbits_le32(qscratch_base + QSCRATCH_HS_PHY_CTRL, + UTMI_OTG_VBUS_VALID | SW_SESSVLD_SEL); + } +} + +/* For controllers running without superspeed PHYs */ +static void dwc3_qcom_select_utmi_clk(void __iomem *qscratch_base) +{ + /* Configure dwc3 to use UTMI clock as PIPE clock not present */ + setbits_le32(qscratch_base + QSCRATCH_GENERAL_CFG, + PIPE_UTMI_CLK_DIS); + + setbits_le32(qscratch_base + QSCRATCH_GENERAL_CFG, + PIPE_UTMI_CLK_SEL | PIPE3_PHYSTATUS_SW); + + clrbits_le32(qscratch_base + QSCRATCH_GENERAL_CFG, + PIPE_UTMI_CLK_DIS); +} + +static void dwc3_qcom_glue_configure(struct udevice *dev, int index, + enum usb_dr_mode mode) +{ + struct dwc3_glue_data *glue = dev_get_plat(dev); + void __iomem *qscratch_base = (void __iomem *)glue->regs; + if (IS_ERR_OR_NULL(qscratch_base)) { + log_err("%s: Invalid qscratch base address\n", dev->name); + return; + } + + if (dev_read_bool(dev, "qcom,select-utmi-as-pipe-clk")) + dwc3_qcom_select_utmi_clk(qscratch_base); + + if (mode != USB_DR_MODE_HOST) + dwc3_qcom_vbus_override_enable(qscratch_base, true); +} + +struct dwc3_glue_ops qcom_ops = { + .glue_configure = dwc3_qcom_glue_configure, +}; + static int dwc3_rk_glue_get_ctrl_dev(struct udevice *dev, ofnode *node) { *node = dev_ofnode(dev); if (!ofnode_valid(*node)) @@ -511,8 +582,16 @@ static int dwc3_glue_reset_init(struct udevice *dev, return 0; else if (ret) return ret; + if (device_is_compatible(dev, "qcom,dwc3")) { + reset_assert_bulk(&glue->resets); + /* We should wait at least 6 sleep clock cycles, that's + * (6 / 32764) * 1000000 ~= 200us. But some platforms + * have slower sleep clocks so we'll play it safe. + */ + udelay(500); + } ret = reset_deassert_bulk(&glue->resets); if (ret) { reset_release_bulk(&glue->resets); return ret; @@ -628,9 +707,9 @@ static const struct udevice_id dwc3_glue_ids[] = { { .compatible = "rockchip,rk3328-dwc3", .data = (ulong)&rk_ops }, { .compatible = "rockchip,rk3399-dwc3" }, { .compatible = "rockchip,rk3568-dwc3", .data = (ulong)&rk_ops }, { .compatible = "rockchip,rk3588-dwc3", .data = (ulong)&rk_ops }, - { .compatible = "qcom,dwc3" }, + { .compatible = "qcom,dwc3", .data = (ulong)&qcom_ops }, { .compatible = "fsl,imx8mp-dwc3", .data = (ulong)&imx8mp_ops }, { .compatible = "fsl,imx8mq-dwc3" }, { .compatible = "intel,tangier-dwc3" }, { } From patchwork Fri Mar 15 15:06:01 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Caleb Connolly X-Patchwork-Id: 780506 Delivered-To: patch@linaro.org Received: by 2002:a5d:46c1:0:b0:33e:7753:30bd with SMTP id g1csp250216wrs; Fri, 15 Mar 2024 08:06:39 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXcf09hU+tyqhLr0htjWARea1J7MGWpYbXYqjiVfSfL0Up+TVJ0dwOUhe45GZNU377OTw17rKsCDUjuwrXMkWHC X-Google-Smtp-Source: AGHT+IEv898q0FaHZSdk8EqO3oBCt5Et8jpVT3WX8Beewki7p/2Zf6G/XuldY/tenIzN+efUUtjh X-Received: by 2002:a5d:46c3:0:b0:33e:7054:5b2b with SMTP id g3-20020a5d46c3000000b0033e70545b2bmr4035944wrs.4.1710515199110; Fri, 15 Mar 2024 08:06:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1710515199; cv=none; d=google.com; s=arc-20160816; b=o4oCHiTnJV7dQAdwsktbmdQG5hLjGqaSBk1FasuVVvpv5WCd8IhpmWmGrQ3OuPpED0 BqqJwF/oP6ZGrwKyhcRLVTfaXpqv6qyMdchkqechVBzsjES3v26pvIpj03YIBQVsOgqJ hpUwxmPDMCOUr6Ovs8xMv0R2MzlUAtkgVY+I7ckPJ3y+J5k5oLiKwIdqcbNfU7ntRun7 UV1Y3oiPMeJu9NMqxRBLS/M3QIUgB6BnhbwDzqvbHyFHeCu7KAEPAxkMYyGpPMzQ1gi8 DhCyOExSMAf88SoKSimrzrfODOaVfV0jSE7pZr8CkWggG2kVJS292XH8FwpDyWO2g+b5 VlHw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:cc:to:in-reply-to:references :message-id:content-transfer-encoding:mime-version:subject:date:from :dkim-signature; bh=cnrSRMGhccGbRZbFvxipCAyufaiPSD/lfhCstPEB5Ls=; fh=UJLfQHigVNNxRTyupVH3iuVYJLWMjRXGBkTXuIfaL+0=; b=FTSwpfPeyzDpdXWQOrchV3/NHwSo0odfiw6n+gabg0Y+H3a+fAZyXTsRqlpFr4TfNL COJB74lVN+BIi7kyq/CQrwXGTxehfPWqDPmPfHxU17pHA2cFNsvXPaVJ8fKPJqNntqLM ct4+B4nwHJWyOvGeNM6XzWZtjrB+qznfdMJnox3PGOZSe3AIz49Gkh6jqS4dGSyzQuZw E1j1sNpYE1ipIJxPb54kZtUt4UKz8KOVNfcx7zPTLbLmxdB1AB6tSgKSju7wh7hg4sfA h3QzK9uCywoD3UiCifQMrxhSHvAWXTe3rTsNIr3x+w+/qANtlfmxJ+9Ug9uLJqTV+tL/ CVOA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=we+cU4Lh; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from phobos.denx.de (phobos.denx.de. [2a01:238:438b:c500:173d:9f52:ddab:ee01]) by mx.google.com with ESMTPS id f4-20020a5d4dc4000000b0033e78e97729si1710039wru.478.2024.03.15.08.06.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Mar 2024 08:06:39 -0700 (PDT) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=we+cU4Lh; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 45F0087FF1; Fri, 15 Mar 2024 16:06:17 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="we+cU4Lh"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 559FF88003; Fri, 15 Mar 2024 16:06:14 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-wm1-x32d.google.com (mail-wm1-x32d.google.com [IPv6:2a00:1450:4864:20::32d]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id D164888004 for ; Fri, 15 Mar 2024 16:06:08 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=caleb.connolly@linaro.org Received: by mail-wm1-x32d.google.com with SMTP id 5b1f17b1804b1-414008713beso4908955e9.1 for ; Fri, 15 Mar 2024 08:06:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1710515168; x=1711119968; darn=lists.denx.de; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=cnrSRMGhccGbRZbFvxipCAyufaiPSD/lfhCstPEB5Ls=; b=we+cU4LhTuFGEClJ75KlzxgsRFDA0RzEzjQQysSWu1hCijBEKaJcVRVgr38MvjoHZC 9L/tDoNXeO2jr5EL6/cK2KqJDYtuiduHcmFeTzg8NweEF+n3p2sgDzvoQoNL7IZAjyuc zBmpgqaFRItbfc8hA+0L8YFwCxvAtvQ4virnTYPD+JlATd+wwtB+XvctU9fROgzPx3Kt kzP3zfi16+Jn6cOSE6bDd9hGj/SO5zof08O4yy26otiozl3F3kouAOCnV6R32Cokxtzh iSJt69fW2KPT/7BorG8TFNd0Ens4HVUKIAaSzO98QtujX3avrcVX47ljRGMQtqTEWmN9 50cQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710515168; x=1711119968; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=cnrSRMGhccGbRZbFvxipCAyufaiPSD/lfhCstPEB5Ls=; b=UjQdLM9CeCuyJCfblQl0AVROCZ4TRprF1/PwdMkX/UX45LPV0KBZNdCczYCxR6hNzb 1vQ6bLZiBBB80fE4bWtoWlK6003RKgD5GwupF+HbQKrclRQP1HQc3mSBcgX6+3qRhmb+ 0K28DvytY12/jJCwf3oCDRtKzQstRsB5rbGH5Um/Bymb1t6kvAe2FEhgRjWbmEEuagHw Ep1MCSeKKUJcVilxjPsAmLw2h0K+Gk1DzqA+aBp1xbiJAweIfCrN0WRkHrRDMeLUKpx7 eiV4pkhfPdaOsey4SEixR5z+6AW0f4+DcbIlRbuHGFXVTJR4fr8bd8Zusg1oZQp1IJTj FUKg== X-Gm-Message-State: AOJu0Yx7Bl2djTbudsPSn1HZ7O7xH0EKYRXv3WtYjp2nfidBf0/ZSVGc 4qWNIAGDVoOcFGkWePBlukyJMxaBy1KNruV2LfEuYRyhvsu2N9t1fzuR3ZB1Snc= X-Received: by 2002:a05:600c:444b:b0:413:f276:1123 with SMTP id v11-20020a05600c444b00b00413f2761123mr3523966wmn.35.1710515168357; Fri, 15 Mar 2024 08:06:08 -0700 (PDT) Received: from lion.localdomain (host-92-17-96-232.as13285.net. [92.17.96.232]) by smtp.gmail.com with ESMTPSA id jg28-20020a05600ca01c00b0041401fbe446sm1939502wmb.11.2024.03.15.08.06.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Mar 2024 08:06:07 -0700 (PDT) From: Caleb Connolly Date: Fri, 15 Mar 2024 15:06:01 +0000 Subject: [PATCH v2 2/5] usb: dwc3: select DM_USB_GADGET MIME-Version: 1.0 Message-Id: <20240315-b4-qcom-usb-v2-2-5467ec27cb26@linaro.org> References: <20240315-b4-qcom-usb-v2-0-5467ec27cb26@linaro.org> In-Reply-To: <20240315-b4-qcom-usb-v2-0-5467ec27cb26@linaro.org> To: Marek Vasut , Tom Rini , Lukasz Majewski , Mattijs Korpershoek , Caleb Connolly , Neil Armstrong , Sumit Garg Cc: u-boot@lists.denx.de X-Mailer: b4 0.14-dev X-Developer-Signature: v=1; a=openpgp-sha256; l=777; i=caleb.connolly@linaro.org; h=from:subject:message-id; bh=FFtOCdyc7kFWeNXYCi6LiWr/yQ+G2PLU3dzzfBLIqOM=; b=owGbwMvMwCFYaeA6f6eBkTjjabUkhtQvyXd9p0ka/L+UoDzvwtnwB28ihE9lFZ0pTM68/FBp1 uMvB3MWd5SyMAhyMMiKKbKIn1hm2bT2sr3G9gUXYOawMoEMYeDiFICJHD3J8IcnsmlBYdh6lV9C yVXcD6Y/ffLmRG75FZPfFx7LNnpWs3ky/BX/skymuYTzw/EXP8yYjjRs7NVedsjtxqXC21cS7mb 88xMHAA== X-Developer-Key: i=caleb.connolly@linaro.org; a=openpgp; fpr=83B24DA7FE145076BC38BB250CD904EB673A7C47 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean DWC3 platforms depend on DM_USB_GADGET for gadget drivers to work, otherwise compilation fails due to no implementation of dm_usb_gadget_handle_interrupts(). Reviewed-by: Mattijs Korpershoek Signed-off-by: Caleb Connolly --- drivers/usb/dwc3/Kconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/usb/dwc3/Kconfig b/drivers/usb/dwc3/Kconfig index c0c8c16fd9c2..8a70bc682322 100644 --- a/drivers/usb/dwc3/Kconfig +++ b/drivers/usb/dwc3/Kconfig @@ -10,8 +10,9 @@ if USB_DWC3 config USB_DWC3_GADGET bool "USB Gadget support for DWC3" default y depends on USB_GADGET + select DM_USB_GADGET select USB_GADGET_DUALSPEED comment "Platform Glue Driver Support" From patchwork Fri Mar 15 15:06:02 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Caleb Connolly X-Patchwork-Id: 780507 Delivered-To: patch@linaro.org Received: by 2002:a5d:46c1:0:b0:33e:7753:30bd with SMTP id g1csp250342wrs; Fri, 15 Mar 2024 08:06:50 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCV2WmAUl038odCRNedFdvDmXxbgS0Fc4J9bChMvZRZvfrti/w/mR4u4eGDOfRtYzMEhF4PNzIccVpfIB7sVXrXo X-Google-Smtp-Source: AGHT+IF6US/xfqvCfNuXVdKRBmBuuS82POFdAiM6TJ5a0A7Es3f7HFPIYXNwLzq4xpWlq+98Y4gs X-Received: by 2002:a05:600c:3ca8:b0:414:273:67d4 with SMTP id bg40-20020a05600c3ca800b00414027367d4mr1252374wmb.30.1710515210351; Fri, 15 Mar 2024 08:06:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1710515210; cv=none; d=google.com; s=arc-20160816; b=IR5oQUoBOm+jmBdVltUrqnjubqlGFwWVk0bbhQW/nCidvXf2d9w/low4Aw+hHs0FkR WcmtNm1r6yMwzM+Ap/ZYn4mmkoTCIQrcgF9SNS598kUN2V3aQhl/urhkVqYFBSEfdmf/ MQ+im0WMmgrjLk/N7BjSWN62d6U6euYc8Nwy9tnm+hLNSLAm2QOogdOKrEUTX/eqpiKf Hp08sme1D1PZy8eY6+nZyWGHGUQFo4DuaBel25odx7+ZphUxvJ/8WkdUqt81P7voOAlG 2enGHAdrdo+w2fwRIJGSCbcq+wlk6/JECOkHNa7/og0wRN3ZZf0bnH4UEYllOGWZoUcz hl8g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:cc:to:in-reply-to:references :message-id:content-transfer-encoding:mime-version:subject:date:from :dkim-signature; bh=e9PNn3A0M8j5XRDzvbl1vLHxbY2HeF4JRZJRcDlmjgE=; fh=UJLfQHigVNNxRTyupVH3iuVYJLWMjRXGBkTXuIfaL+0=; b=QL9M54di+XLCp1p49wUhXyUQQwN/T2YpasA2BSxIrhoMYzJFCCXI1gqYDj09TlnDoL a6VKEqHD0l8+LGCt/Yjg5kSq/Z10kFtKQrPC/SGExQ878LIp/b79eAR4i/aWZ75MFuXv tZmDc3bEOO3AsY8ZBGP3StL8PVSUZsSJcNZRb4kZQ0i0gY9kj0m11AyqeEUNxhc+2fY3 4Ndqs5rBSPbBY+D4EdzCgbsj+J5/IJxpNaH3l7aQGSizcWn/vNi9o7j96nl3RUlv8fIT XClXjYXAGVlgDA+ZfdCVppAYSGl5VP55n2nsABFduZg9qnN1ZFJz1eXQg6ke43Dkbo6I OkDA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=XHHQ8Y2X; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from phobos.denx.de (phobos.denx.de. [85.214.62.61]) by mx.google.com with ESMTPS id l15-20020adfe58f000000b0033ec2ea5e1asi1683232wrm.889.2024.03.15.08.06.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Mar 2024 08:06:50 -0700 (PDT) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) client-ip=85.214.62.61; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=XHHQ8Y2X; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id B025E87FFF; Fri, 15 Mar 2024 16:06:17 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="XHHQ8Y2X"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 8FCE887FDD; Fri, 15 Mar 2024 16:06:15 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-lf1-x136.google.com (mail-lf1-x136.google.com [IPv6:2a00:1450:4864:20::136]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 069508800B for ; Fri, 15 Mar 2024 16:06:10 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=caleb.connolly@linaro.org Received: by mail-lf1-x136.google.com with SMTP id 2adb3069b0e04-5131a9b3d5bso2634441e87.0 for ; Fri, 15 Mar 2024 08:06:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1710515169; x=1711119969; darn=lists.denx.de; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=e9PNn3A0M8j5XRDzvbl1vLHxbY2HeF4JRZJRcDlmjgE=; b=XHHQ8Y2XpHeG7uMhfEfLxw1mq4xoKJIFydTi0oYZ2Lk6ENr8DD1WwDVjOFoNrnQibd B7fdWzOZz7Pnop6BhawGz/+xKxEoT6+gRi60oiOihMjUucodbDzzjiNRgvesp8WtvRVw o7h19FhYrKyen1w3hoOTafV2yZagWzPm8SXh1Cp1eAInQAsFqSzPHiDMZcS5dKgO5aq0 d1XsGOC1vHi4cSweSLGgn8X3aF46rvsPDY/IAIYmhW6KAPICmm+AYn9NT1X/g4op94g7 Sm9Akj3buiRSvlQ7ESiY4cidEM0C1+DIQ/qjHloA/FtR7OuLCq0w9Wo6iFbqxcu2WUvz UIKA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710515169; x=1711119969; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=e9PNn3A0M8j5XRDzvbl1vLHxbY2HeF4JRZJRcDlmjgE=; b=jnIPbV3tlQvZi/bvb2d2M5lK7alKLvSX/8nuXODkLDb1aMC1RICKleQjoYf+l/ofwG wHS2NpcrBq0LpnLjxEjaXXzC9V5cuA8/cuYOY3SSmU3rbJibwilF0wIirMQ3vZLrKc62 RLCRXc8Wf1E6Z7whWu7fzKruhf2iNLY7L0EO22Mj+QkECYDmwsnQB1UOK1fG0x5QJJj5 /MUuHDueVopFsfPErY13Nf8e5zo1yJRZR0Iw+PzrFvehI4eqaw8Vr9ifjvcsHfW2ixPR g4wIYrPEfy5jKRzc5pNtKwKBh/b91ICk6FXsav6jANhAdiNsy7/v1muW0+CvPmdNsSzO Zu8g== X-Gm-Message-State: AOJu0YxADFl17vwm79kX6Hjw+5egAmVMmsHTEf6lx1MGdYf7et8kgksI lxxN5QStNjhWy7WYjR7K22ZqcNs6g9vZTdY68dW0S60pf0TbcyG39USnVynRHIw= X-Received: by 2002:a19:5f04:0:b0:513:cd2e:ceae with SMTP id t4-20020a195f04000000b00513cd2eceaemr3541890lfb.20.1710515169373; Fri, 15 Mar 2024 08:06:09 -0700 (PDT) Received: from lion.localdomain (host-92-17-96-232.as13285.net. [92.17.96.232]) by smtp.gmail.com with ESMTPSA id jg28-20020a05600ca01c00b0041401fbe446sm1939502wmb.11.2024.03.15.08.06.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Mar 2024 08:06:08 -0700 (PDT) From: Caleb Connolly Date: Fri, 15 Mar 2024 15:06:02 +0000 Subject: [PATCH v2 3/5] usb: gadget: CDC ACM: call usb_gadget_initialize MIME-Version: 1.0 Message-Id: <20240315-b4-qcom-usb-v2-3-5467ec27cb26@linaro.org> References: <20240315-b4-qcom-usb-v2-0-5467ec27cb26@linaro.org> In-Reply-To: <20240315-b4-qcom-usb-v2-0-5467ec27cb26@linaro.org> To: Marek Vasut , Tom Rini , Lukasz Majewski , Mattijs Korpershoek , Caleb Connolly , Neil Armstrong , Sumit Garg Cc: u-boot@lists.denx.de X-Mailer: b4 0.14-dev X-Developer-Signature: v=1; a=openpgp-sha256; l=1071; i=caleb.connolly@linaro.org; h=from:subject:message-id; bh=iF44ey0WhRVVVgOg2Xo34JBjuNlV4OImTlpeBMxGr20=; b=owGbwMvMwCFYaeA6f6eBkTjjabUkhtQvyXc1Fuc4y10SOP4idWL8zd8PuFdWNW8OF1S8GFk74 51mpgxjRykLgyAHg6yYIov4iWWWTWsv22tsX3ABZg4rE8gQBi5OAZhI+29GhtbSpud+Jpc/58RK fK28s+3ZA8cQtffP/livL7nU2eccupqRYUptx/nwmxJ/Z3sxyPgwNTu4Wt24PdV59u2+lyH1NjF nLwIA X-Developer-Key: i=caleb.connolly@linaro.org; a=openpgp; fpr=83B24DA7FE145076BC38BB250CD904EB673A7C47 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean To actually use the gadget the peripheral driver must be probed and we must call g_dnl_clear_detach(). Otherwise acm_stdio_start() will always fail to find a UDC on DT platforms. Reviewed-by: Mattijs Korpershoek Signed-off-by: Caleb Connolly --- drivers/usb/gadget/f_acm.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/drivers/usb/gadget/f_acm.c b/drivers/usb/gadget/f_acm.c index de42e0189e8d..ba216128ab27 100644 --- a/drivers/usb/gadget/f_acm.c +++ b/drivers/usb/gadget/f_acm.c @@ -622,14 +622,23 @@ static void acm_stdio_puts(struct stdio_dev *dev, const char *str) } static int acm_stdio_start(struct stdio_dev *dev) { + struct udevice *udc; int ret; if (dev->priv) { /* function already exist */ return 0; } + ret = udc_device_get_by_index(0, &udc); + if (ret) { + pr_err("USB init failed: %d\n", ret); + return ret; + } + + g_dnl_clear_detach(); + ret = g_dnl_register("usb_serial_acm"); if (ret) return ret; From patchwork Fri Mar 15 15:06:03 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Caleb Connolly X-Patchwork-Id: 780508 Delivered-To: patch@linaro.org Received: by 2002:a5d:46c1:0:b0:33e:7753:30bd with SMTP id g1csp250452wrs; Fri, 15 Mar 2024 08:07:01 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUcmEdSoeT5FR5LZOGFkaEdT6XAw4mDhMSMK7QCzZTQS1SZkoRiqlAduwTaRUf+w0K4UcLcgpxgwA90imC6TSsg X-Google-Smtp-Source: AGHT+IFl7XZHBuHse+etWn/WRP/XETymT8byEAMhXYIqXY15A3t0jWuYy922ugaooFk8q9OOd/B/ X-Received: by 2002:a05:6000:1865:b0:33e:1a96:2be7 with SMTP id d5-20020a056000186500b0033e1a962be7mr3703984wri.11.1710515221742; Fri, 15 Mar 2024 08:07:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1710515221; cv=none; d=google.com; s=arc-20160816; b=yZuSCM8an8Dd7mVpf8w9CYjOTdSSIKNxsQt6iIxFawvEy/soIRdCJCTp4ZdATmyygT 1KSTPgNxCrKXtzNVg8+O+zbr6ABbKHUOEBgvU6eiXA7FVGJOpOlH7RCvLIn/e3BtNvOa Ra2ZhLJpH84Z+ztE3a1/l5GmMOUm9LAEBAOdX8v3Y+md0cqzLJWCtvFBdy1g+/kJCT66 7B9WGMl7xA5ftivtHqqencLV3567ahP9DJ8iyGiMsWUnxwl6ZtGHDMEPCqAoe18Yu3jH sRYRwHEZxpH8dRkpIFZ7VLTG4rAWy2Pb0s6eM/Xb8OouWgar00VrJ6N5sfz6yln2+j0C D87g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:cc:to:in-reply-to:references :message-id:content-transfer-encoding:mime-version:subject:date:from :dkim-signature; bh=A3DkjF1TR/8nRXVHAMS8QpF7WwBh/qeL566sftZQEnw=; fh=UJLfQHigVNNxRTyupVH3iuVYJLWMjRXGBkTXuIfaL+0=; b=Vu0f6czmG2SlRhEG+A/i9z19ItuAEbLW6ig8kqLDcHKlndIfL+rpB16eIM7npQ792Q 7wHdtQfkrj3WpIx1WuS6hRENPPFKugRxWfRrWp3I5hFDy+h04FP6CvRZLywpLZd8hk3M nJnonSK5MRkJksXspxsXpmbCWL3tMlDZX3H1l7G3iJ+DB0MNPluHNXouxrIC1AvT2KGG bUDJpC7sS+ZfkFBg4c0v3Fx24pQRn8Dw+KUtV/r17TTPx/2PLU0++pWikj3xW6nFnPrg 3wnqK/6HPTjgJxZjTA8h8DCcF6bikomxYDBqkpbXHlZXR/HucZlM9OSINkvcuEQAdtMy fbSg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ICYuDSkS; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from phobos.denx.de (phobos.denx.de. [2a01:238:438b:c500:173d:9f52:ddab:ee01]) by mx.google.com with ESMTPS id l8-20020adfe9c8000000b0033eca1f21besi1751601wrn.546.2024.03.15.08.07.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Mar 2024 08:07:01 -0700 (PDT) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ICYuDSkS; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 2E5A987FF2; Fri, 15 Mar 2024 16:06:19 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="ICYuDSkS"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 9FD7A87FD2; Fri, 15 Mar 2024 16:06:16 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-lf1-x12a.google.com (mail-lf1-x12a.google.com [IPv6:2a00:1450:4864:20::12a]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 3125B88010 for ; Fri, 15 Mar 2024 16:06:11 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=caleb.connolly@linaro.org Received: by mail-lf1-x12a.google.com with SMTP id 2adb3069b0e04-512f892500cso2565377e87.3 for ; Fri, 15 Mar 2024 08:06:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1710515170; x=1711119970; darn=lists.denx.de; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=A3DkjF1TR/8nRXVHAMS8QpF7WwBh/qeL566sftZQEnw=; b=ICYuDSkStrdZGt4IrZFkHUkIPw708A41QNNAZqEdZPkNhLdMP/mxjLqFQoBkmrrIW1 YK4of5VwyZkXYNatoLATTd2zMf12vZ6bPZcaXwO41ot1K7HQVPrPZXtQ26X4e9CaVKyi D9bVfP25Vh0FLf7bAb1U6QIxXYxptz6NLbvPgWxFCAnVNWriHa5/8Hq9l/xrzlwvjAp2 QLoWaXEH6lvSmmoYXVCE6SIOViuHVSksf6vbWqXfD4+zpBshSEwGdIOJcft2a7DzH/B9 GW1M7RVpNWQ3xul9ufkkP+FNE1O0rCdAewGMzHY/6pq9kVXftSZsNMRScyJhWLb6kVCL +V5g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710515170; x=1711119970; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=A3DkjF1TR/8nRXVHAMS8QpF7WwBh/qeL566sftZQEnw=; b=uWJKRjfMFBEMBjer13R/S6xBIPjZ9ORlKXVHH4Oixjfje9/sddgRM0wcHYw2amwrms Kc5645cmq/RWTD8eIVipf4pK/Qs4Cuh0X5AsRqHiNPOVj8bcnlSY5GOjSi5ubgLLUB7s a/Aa6MlquRu6YC7o2Q1iLY7oq50FAs2cfdJP2SwVZzUYtQBWnD/BbpS37svOoxXi81ZN 6gRvd3d5dd2SO2KF/GG2jzzEQUHn1I1d8DXjtPu9Rifn0sYpKfosDD3zw1SIRauva7zH kG64l8XP2lRhorHJgbR5+Mq9K/S26N0v8TwuWzKN4ZasyyKtlfFQ6uk/Yy0rHdFuHzvq iyPg== X-Gm-Message-State: AOJu0Yy27lDenARG0ZJm087w75s2SPMJ90QIZft2t/VsrE2McWwldjN3 ykLJ5xCLZEueocj+vD+UyTzlpZZ0g2WFAB7dBWooHzZjQOK4s2dqRuMo05o/hhs= X-Received: by 2002:ac2:5185:0:b0:513:cf77:48c5 with SMTP id u5-20020ac25185000000b00513cf7748c5mr2939106lfi.38.1710515170248; Fri, 15 Mar 2024 08:06:10 -0700 (PDT) Received: from lion.localdomain (host-92-17-96-232.as13285.net. [92.17.96.232]) by smtp.gmail.com with ESMTPSA id jg28-20020a05600ca01c00b0041401fbe446sm1939502wmb.11.2024.03.15.08.06.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Mar 2024 08:06:09 -0700 (PDT) From: Caleb Connolly Date: Fri, 15 Mar 2024 15:06:03 +0000 Subject: [PATCH v2 4/5] usb: gadget: UMS: support multiple sector sizes MIME-Version: 1.0 Message-Id: <20240315-b4-qcom-usb-v2-4-5467ec27cb26@linaro.org> References: <20240315-b4-qcom-usb-v2-0-5467ec27cb26@linaro.org> In-Reply-To: <20240315-b4-qcom-usb-v2-0-5467ec27cb26@linaro.org> To: Marek Vasut , Tom Rini , Lukasz Majewski , Mattijs Korpershoek , Caleb Connolly , Neil Armstrong , Sumit Garg Cc: u-boot@lists.denx.de X-Mailer: b4 0.14-dev X-Developer-Signature: v=1; a=openpgp-sha256; l=12955; i=caleb.connolly@linaro.org; h=from:subject:message-id; bh=pZeFdHwOydCXfHRFprpcAo1xgzNFwT7FwdbRs3US3LE=; b=owGbwMvMwCFYaeA6f6eBkTjjabUkhtQvyXdLetOa/h9cv/Pep/SJh33UJnzeUq3r9OBAu8nZO 8rt2114OkpZGAQ5GGTFFFnETyyzbFp72V5j+4ILMHNYmUCGMHBxCsBE1LgZ/lnX/ymsfPrm3n9n jv0WGx5VfnZ837fz1bdfh97XGNeZuHxl+F8gefeolthbmQWJr7MyuF6cq5FbX/d5d7mLaC/HYbb GXXcB X-Developer-Key: i=caleb.connolly@linaro.org; a=openpgp; fpr=83B24DA7FE145076BC38BB250CD904EB673A7C47 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean UFS storage often uses a 4096-byte sector size, add support for dynamic sector sizes based loosely on the Linux implementation. Reviewed-by: Mattijs Korpershoek Signed-off-by: Caleb Connolly --- cmd/usb_mass_storage.c | 4 -- drivers/usb/gadget/f_mass_storage.c | 101 ++++++++++++++++++++---------------- drivers/usb/gadget/storage_common.c | 12 +++-- include/usb_mass_storage.h | 1 - 4 files changed, 65 insertions(+), 53 deletions(-) diff --git a/cmd/usb_mass_storage.c b/cmd/usb_mass_storage.c index a8ddeb494628..751701fe73af 100644 --- a/cmd/usb_mass_storage.c +++ b/cmd/usb_mass_storage.c @@ -87,12 +87,8 @@ static int ums_init(const char *devtype, const char *devnums_part_str) */ if (!strchr(devnum_part_str, ':')) partnum = 0; - /* f_mass_storage.c assumes SECTOR_SIZE sectors */ - if (block_dev->blksz != SECTOR_SIZE) - goto cleanup; - ums_new = realloc(ums, (ums_count + 1) * sizeof(*ums)); if (!ums_new) goto cleanup; ums = ums_new; diff --git a/drivers/usb/gadget/f_mass_storage.c b/drivers/usb/gadget/f_mass_storage.c index c725aed3f626..d880928044f4 100644 --- a/drivers/usb/gadget/f_mass_storage.c +++ b/drivers/usb/gadget/f_mass_storage.c @@ -723,14 +723,15 @@ static int do_read(struct fsg_common *common) if (lba >= curlun->num_sectors) { curlun->sense_data = SS_LOGICAL_BLOCK_ADDRESS_OUT_OF_RANGE; return -EINVAL; } - file_offset = ((loff_t) lba) << 9; + file_offset = ((loff_t)lba) << curlun->blkbits; /* Carry out the file reads */ amount_left = common->data_size_from_cmnd; - if (unlikely(amount_left == 0)) + if (unlikely(amount_left == 0)) { return -EIO; /* No default reply */ + } for (;;) { /* Figure out how much we need to read: @@ -767,15 +768,15 @@ static int do_read(struct fsg_common *common) } /* Perform the read */ rc = ums[common->lun].read_sector(&ums[common->lun], - file_offset / SECTOR_SIZE, - amount / SECTOR_SIZE, + file_offset / curlun->blksize, + amount / curlun->blksize, (char __user *)bh->buf); if (!rc) return -EIO; - nread = rc * SECTOR_SIZE; + nread = rc * curlun->blksize; VLDBG(curlun, "file read %u @ %llu -> %d\n", amount, (unsigned long long) file_offset, (int) nread); @@ -786,9 +787,9 @@ static int do_read(struct fsg_common *common) nread = 0; } else if (nread < amount) { LDBG(curlun, "partial file read: %d/%u\n", (int) nread, amount); - nread -= (nread & 511); /* Round down to a block */ + nread -= (nread & (curlun->blksize - 1)); /* Round down to a block */ } file_offset += nread; amount_left -= nread; common->residue -= nread; @@ -860,9 +861,9 @@ static int do_write(struct fsg_common *common) } /* Carry out the file writes */ get_some_more = 1; - file_offset = usb_offset = ((loff_t) lba) << 9; + file_offset = usb_offset = ((loff_t)lba) << curlun->blkbits; amount_left_to_req = common->data_size_from_cmnd; amount_left_to_write = common->data_size_from_cmnd; while (amount_left_to_write > 0) { @@ -892,9 +893,9 @@ static int do_write(struct fsg_common *common) SS_LOGICAL_BLOCK_ADDRESS_OUT_OF_RANGE; curlun->info_valid = 1; continue; } - amount -= (amount & 511); + amount -= (amount & (curlun->blksize - 1)); if (amount == 0) { /* Why were we were asked to transfer a * partial block? */ @@ -941,14 +942,14 @@ static int do_write(struct fsg_common *common) amount = bh->outreq->actual; /* Perform the write */ rc = ums[common->lun].write_sector(&ums[common->lun], - file_offset / SECTOR_SIZE, - amount / SECTOR_SIZE, + file_offset / curlun->blksize, + amount / curlun->blksize, (char __user *)bh->buf); if (!rc) return -EIO; - nwritten = rc * SECTOR_SIZE; + nwritten = rc * curlun->blksize; VLDBG(curlun, "file write %u @ %llu -> %d\n", amount, (unsigned long long) file_offset, (int) nwritten); @@ -959,9 +960,9 @@ static int do_write(struct fsg_common *common) nwritten = 0; } else if (nwritten < amount) { LDBG(curlun, "partial file write: %d/%u\n", (int) nwritten, amount); - nwritten -= (nwritten & 511); + nwritten -= (nwritten & (curlun->blksize - 1)); /* Round down to a block */ } file_offset += nwritten; amount_left_to_write -= nwritten; @@ -1033,10 +1034,10 @@ static int do_verify(struct fsg_common *common) if (unlikely(verification_length == 0)) return -EIO; /* No default reply */ /* Prepare to carry out the file verify */ - amount_left = verification_length << 9; - file_offset = ((loff_t) lba) << 9; + amount_left = verification_length << curlun->blkbits; + file_offset = ((loff_t) lba) << curlun->blkbits; /* Write out all the dirty buffers before invalidating them */ /* Just try to read the requested blocks */ @@ -1057,14 +1058,14 @@ static int do_verify(struct fsg_common *common) } /* Perform the read */ rc = ums[common->lun].read_sector(&ums[common->lun], - file_offset / SECTOR_SIZE, - amount / SECTOR_SIZE, + file_offset / curlun->blksize, + amount / curlun->blksize, (char __user *)bh->buf); if (!rc) return -EIO; - nread = rc * SECTOR_SIZE; + nread = rc * curlun->blksize; VLDBG(curlun, "file read %u @ %llu -> %d\n", amount, (unsigned long long) file_offset, (int) nread); @@ -1074,9 +1075,9 @@ static int do_verify(struct fsg_common *common) nread = 0; } else if (nread < amount) { LDBG(curlun, "partial file verify: %d/%u\n", (int) nread, amount); - nread -= (nread & 511); /* Round down to a sector */ + nread -= (nread & (curlun->blksize - 1)); /* Round down to a sector */ } if (nread == 0) { curlun->sense_data = SS_UNRECOVERED_READ_ERROR; curlun->info_valid = 1; @@ -1182,9 +1183,9 @@ static int do_read_capacity(struct fsg_common *common, struct fsg_buffhd *bh) } put_unaligned_be32(curlun->num_sectors - 1, &buf[0]); /* Max logical block */ - put_unaligned_be32(512, &buf[4]); /* Block length */ + put_unaligned_be32(curlun->blksize, &buf[4]); /* Block length */ return 8; } static int do_read_header(struct fsg_common *common, struct fsg_buffhd *bh) @@ -1369,9 +1370,9 @@ static int do_read_format_capacities(struct fsg_common *common, buf += 4; put_unaligned_be32(curlun->num_sectors, &buf[0]); /* Number of blocks */ - put_unaligned_be32(512, &buf[4]); /* Block length */ + put_unaligned_be32(curlun->blksize, &buf[4]); /* Block length */ buf[4] = 0x02; /* Current capacity */ return 12; } @@ -1780,8 +1781,18 @@ static int check_command(struct fsg_common *common, int cmnd_size, return 0; } +/* wrapper of check_command for data size in blocks handling */ +static int check_command_size_in_blocks(struct fsg_common *common, + int cmnd_size, enum data_direction data_dir, + unsigned int mask, int needs_medium, const char *name) +{ + common->data_size_from_cmnd <<= common->luns[common->lun].blkbits; + return check_command(common, cmnd_size, data_dir, + mask, needs_medium, name); +} + static int do_scsi_command(struct fsg_common *common) { struct fsg_buffhd *bh; @@ -1864,32 +1875,32 @@ static int do_scsi_command(struct fsg_common *common) break; case SC_READ_6: i = common->cmnd[4]; - common->data_size_from_cmnd = (i == 0 ? 256 : i) << 9; - reply = check_command(common, 6, DATA_DIR_TO_HOST, - (7<<1) | (1<<4), 1, - "READ(6)"); + common->data_size_from_cmnd = (i == 0 ? 256 : i); + reply = check_command_size_in_blocks(common, 6, DATA_DIR_TO_HOST, + (7<<1) | (1<<4), 1, + "READ(6)"); if (reply == 0) reply = do_read(common); break; case SC_READ_10: common->data_size_from_cmnd = - get_unaligned_be16(&common->cmnd[7]) << 9; - reply = check_command(common, 10, DATA_DIR_TO_HOST, - (1<<1) | (0xf<<2) | (3<<7), 1, - "READ(10)"); + get_unaligned_be16(&common->cmnd[7]); + reply = check_command_size_in_blocks(common, 10, DATA_DIR_TO_HOST, + (1<<1) | (0xf<<2) | (3<<7), 1, + "READ(10)"); if (reply == 0) reply = do_read(common); break; case SC_READ_12: common->data_size_from_cmnd = - get_unaligned_be32(&common->cmnd[6]) << 9; - reply = check_command(common, 12, DATA_DIR_TO_HOST, - (1<<1) | (0xf<<2) | (0xf<<6), 1, - "READ(12)"); + get_unaligned_be32(&common->cmnd[6]); + reply = check_command_size_in_blocks(common, 12, DATA_DIR_TO_HOST, + (1<<1) | (0xf<<2) | (0xf<<6), 1, + "READ(12)"); if (reply == 0) reply = do_read(common); break; @@ -1982,32 +1993,32 @@ static int do_scsi_command(struct fsg_common *common) break; case SC_WRITE_6: i = common->cmnd[4]; - common->data_size_from_cmnd = (i == 0 ? 256 : i) << 9; - reply = check_command(common, 6, DATA_DIR_FROM_HOST, - (7<<1) | (1<<4), 1, - "WRITE(6)"); + common->data_size_from_cmnd = (i == 0 ? 256 : i); + reply = check_command_size_in_blocks(common, 6, DATA_DIR_FROM_HOST, + (7<<1) | (1<<4), 1, + "WRITE(6)"); if (reply == 0) reply = do_write(common); break; case SC_WRITE_10: common->data_size_from_cmnd = - get_unaligned_be16(&common->cmnd[7]) << 9; - reply = check_command(common, 10, DATA_DIR_FROM_HOST, - (1<<1) | (0xf<<2) | (3<<7), 1, - "WRITE(10)"); + get_unaligned_be16(&common->cmnd[7]); + reply = check_command_size_in_blocks(common, 10, DATA_DIR_FROM_HOST, + (1<<1) | (0xf<<2) | (3<<7), 1, + "WRITE(10)"); if (reply == 0) reply = do_write(common); break; case SC_WRITE_12: common->data_size_from_cmnd = - get_unaligned_be32(&common->cmnd[6]) << 9; - reply = check_command(common, 12, DATA_DIR_FROM_HOST, - (1<<1) | (0xf<<2) | (0xf<<6), 1, - "WRITE(12)"); + get_unaligned_be32(&common->cmnd[6]); + reply = check_command_size_in_blocks(common, 12, DATA_DIR_FROM_HOST, + (1<<1) | (0xf<<2) | (0xf<<6), 1, + "WRITE(12)"); if (reply == 0) reply = do_write(common); break; @@ -2496,9 +2507,9 @@ static struct fsg_common *fsg_common_init(struct fsg_common *common, for (i = 0; i < nluns; i++) { common->luns[i].removable = 1; - rc = fsg_lun_open(&common->luns[i], ums[i].num_sectors, ""); + rc = fsg_lun_open(&common->luns[i], ums[i].num_sectors, ums->block_dev.blksz, ""); if (rc) goto error_luns; } common->lun = 0; diff --git a/drivers/usb/gadget/storage_common.c b/drivers/usb/gadget/storage_common.c index 5674e8fe4940..97dc6b6f729c 100644 --- a/drivers/usb/gadget/storage_common.c +++ b/drivers/usb/gadget/storage_common.c @@ -268,8 +268,9 @@ struct interrupt_data { struct device_attribute { int i; }; #define ETOOSMALL 525 #include +#include #include #include /*-------------------------------------------------------------------------*/ @@ -289,8 +290,10 @@ struct fsg_lun { u32 sense_data; u32 sense_data_info; u32 unit_attention_data; + unsigned int blkbits; + unsigned int blksize; /* logical block size of bound block device */ struct device dev; }; @@ -565,19 +568,22 @@ static struct usb_gadget_strings fsg_stringtab = { * the caller must own fsg->filesem for writing. */ static int fsg_lun_open(struct fsg_lun *curlun, unsigned int num_sectors, - const char *filename) + unsigned int sector_size, const char *filename) { int ro; /* R/W if we can, R/O if we must */ ro = curlun->initially_ro; curlun->ro = ro; - curlun->file_length = num_sectors << 9; + curlun->file_length = num_sectors * sector_size; curlun->num_sectors = num_sectors; - debug("open backing file: %s\n", filename); + curlun->blksize = sector_size; + curlun->blkbits = order_base_2(sector_size >> 9) + 9; + debug("blksize: %u\n", sector_size); + debug("open backing file: '%s'\n", filename); return 0; } diff --git a/include/usb_mass_storage.h b/include/usb_mass_storage.h index 83ab93b530d7..6d83d93cad7f 100644 --- a/include/usb_mass_storage.h +++ b/include/usb_mass_storage.h @@ -6,9 +6,8 @@ #ifndef __USB_MASS_STORAGE_H__ #define __USB_MASS_STORAGE_H__ -#define SECTOR_SIZE 0x200 #include #include /* Wait at maximum 60 seconds for cable connection */ From patchwork Fri Mar 15 15:06:04 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Caleb Connolly X-Patchwork-Id: 780509 Delivered-To: patch@linaro.org Received: by 2002:a5d:46c1:0:b0:33e:7753:30bd with SMTP id g1csp250596wrs; Fri, 15 Mar 2024 08:07:14 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUt7UZ+ROC9MCrmbQIwx1dS1raOf+HlaVAD2k9unS1HdEFfPuzrPzjDUOnYFhcy00P93e37L+9qsVKEs3yOFNTc X-Google-Smtp-Source: AGHT+IE6w8/IUM/Fqw9S3CsIp0T0Ng4Sj+8kO7IEYbSU3fQYAGncXgLoe7hVn5Qm9+yS0aQrSTJg X-Received: by 2002:a05:600c:19c7:b0:412:f243:3699 with SMTP id u7-20020a05600c19c700b00412f2433699mr5203057wmq.18.1710515233986; Fri, 15 Mar 2024 08:07:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1710515233; cv=none; d=google.com; s=arc-20160816; b=xcG5wblr0EbR/j40erFOXikNbGlZgGqISFsd14VB7ecSTZwDhR0tUmes4kbh72LtxU 0O7UQgFGl+ASqSakZMyqY8nfsluWxIre23mXD18fM9Ucxxr8bb9SD9diKrAW/7+UQmGA 7QVWr2XhEGce5KyhDLgvvHC2kD/Nl9kj4S46Ft4i5rk3BvVSmoOlgNPc7UpiVTNMaV8M qRBSu9Mbg6p7KcNnQvRk5XDm8sZzvzd2sDKhh7JJrkp597MC5lk9yEjFwVx93PwpSuDU v6Fwg11ONusTP27Sbg7cxxKimnf4ih1M2cbFDtiyA/gkE14lhvC/fvKKD6y6Df64X8hq k4sA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:cc:to:in-reply-to:references :message-id:content-transfer-encoding:mime-version:subject:date:from :dkim-signature; bh=Zbk4r4UyBzKuozH08fyGqwtHnRd654EBpMK0f9wmWRc=; fh=UJLfQHigVNNxRTyupVH3iuVYJLWMjRXGBkTXuIfaL+0=; b=eh6z2YxTwxIRIns6yWOFKtaFtO+1bLsLMW7LpByXcAeIccf2600G/BguiIwdPBeiC9 Ylbr5lhZXnQa4LP3WMGtg0mf9AQjAUkMnOKxCXjpTe/vpumVDPJjQvSmKIPDq46TkrKl WwyzTZ20QGo/MKdCHB2KSOiRVUQWEYRJxZII6G1U8GmclNgHx5R7t3Vyq7StoVsRK7os 6TSnbFkiXQdJJwawEOJ94Y2gJy4d13Kbp4XuKHQ2P2u25S0lszrolPHwKimoTDcLP4Ph QS02cY61QX0WenFV8LqxvEuLDwGxwjNUVVHf0CZr0ZvDshjmmhju9mbW+n2JBhT503CA Ug/Q==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=yY5MAZau; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from phobos.denx.de (phobos.denx.de. [85.214.62.61]) by mx.google.com with ESMTPS id r21-20020adfb1d5000000b0033e8280be38si1698067wra.258.2024.03.15.08.07.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Mar 2024 08:07:13 -0700 (PDT) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) client-ip=85.214.62.61; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=yY5MAZau; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id A7B4188023; Fri, 15 Mar 2024 16:06:19 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="yY5MAZau"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 42DD288008; Fri, 15 Mar 2024 16:06:17 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-wr1-x431.google.com (mail-wr1-x431.google.com [IPv6:2a00:1450:4864:20::431]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 70EFA88019 for ; Fri, 15 Mar 2024 16:06:12 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=caleb.connolly@linaro.org Received: by mail-wr1-x431.google.com with SMTP id ffacd0b85a97d-33ed6078884so255589f8f.1 for ; Fri, 15 Mar 2024 08:06:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1710515172; x=1711119972; darn=lists.denx.de; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=Zbk4r4UyBzKuozH08fyGqwtHnRd654EBpMK0f9wmWRc=; b=yY5MAZauBCgd5QwuzTK3jztJryPWMGC74BpCQDaXg/dNJGq44KzjS4WIpeJAEVZqD5 fNdxUhIvEt+DlAyDcsorH+tvcg9eE04LM8miTWMJraK66rQCnX5FDCbeoX2AzpHVi1O4 aVNBeH2wmdzq5P+S0Un4plOox40OWChTxXGYGTvBzSb0CGKgEgWxpBPgxJSTlTo20OkY Yo4g8HcCqGt/wM8hkHYTzzzHv2R0H/08L62a4oy4CFLgGFxUyz47UnM6OA5Hu4FT3SAK DPLgWggJaE5efSj+7P9AHXnO7sPSlJHZDsnJ2/YY+vLjZwM4bqaWmqV/G/QDeueoRcMP WnIQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710515172; x=1711119972; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Zbk4r4UyBzKuozH08fyGqwtHnRd654EBpMK0f9wmWRc=; b=HiNNvnN+k4htyF9fTTxvh+u25ab6uQ54rLtslnZT1gDHkOtC0bO3wBSqMoDSF1bAfw g2WwDL4bPTeJP+5d9BnoxAio8Uy5qhkkvZ8Usu2cn4axu0ZNr8Uk9HjleIR4wr4K3Aye bFN6eY0RCJYdK4IpA/s0Celgxvh8Zn7P0ujBPhVf8NdgnRmIX1xmDGo76JGAAHAqvoi+ WD2sNgL/nm7rAAzV3+c0y08B8f+lQ3BTntBjDyk+zSKRX9FukdV/XXr4I02xU7LKqOcV ld/cCOp7uMSqFnfzuotAn7mjzKyroBhN3+dwD7ABfpOIjiSUe0RuimlKhF/RutlypqvX Yr7w== X-Gm-Message-State: AOJu0Yx5/y+u7cVI2VK8eztBISXBovtW8b/KvqdmrRUmp3o4kcN1NJLn YBT1L9ym0XelkkDa6mrpWBsEbqmAjwICa0nXtUYvSk1hVt+Wwtd2yRBrwntTHW/vPbz5hHw5PBd K X-Received: by 2002:adf:f5c6:0:b0:33e:2d7b:c5a8 with SMTP id k6-20020adff5c6000000b0033e2d7bc5a8mr6838335wrp.17.1710515171690; Fri, 15 Mar 2024 08:06:11 -0700 (PDT) Received: from lion.localdomain (host-92-17-96-232.as13285.net. [92.17.96.232]) by smtp.gmail.com with ESMTPSA id jg28-20020a05600ca01c00b0041401fbe446sm1939502wmb.11.2024.03.15.08.06.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Mar 2024 08:06:10 -0700 (PDT) From: Caleb Connolly Date: Fri, 15 Mar 2024 15:06:04 +0000 Subject: [PATCH v2 5/5] iommu: qcom-smmu: fix debugging MIME-Version: 1.0 Message-Id: <20240315-b4-qcom-usb-v2-5-5467ec27cb26@linaro.org> References: <20240315-b4-qcom-usb-v2-0-5467ec27cb26@linaro.org> In-Reply-To: <20240315-b4-qcom-usb-v2-0-5467ec27cb26@linaro.org> To: Marek Vasut , Tom Rini , Lukasz Majewski , Mattijs Korpershoek , Caleb Connolly , Neil Armstrong , Sumit Garg Cc: u-boot@lists.denx.de X-Mailer: b4 0.14-dev X-Developer-Signature: v=1; a=openpgp-sha256; l=802; i=caleb.connolly@linaro.org; h=from:subject:message-id; bh=Vh7wChQ7oSn3qK3m6JbZXYrVDFhwkmOI9fGRczQh+FQ=; b=owGbwMvMwCFYaeA6f6eBkTjjabUkhtQvyXfvKa6T8VW6sWjfifvbtQLWtc2UPs3w8P/mr3zNR q+urSlx7yhlYRDkYJAVU2QRP7HMsmntZXuN7QsuwMxhZQIZwsDFKQAT6V/O8L9ye/cD7colsS+N 5kxKPJnIccd+iinXo3d24feD83+fV5rB8Ff4D4tpWETV/pOlMSEFd14Lxnx+c2nd8TnzTgf+WJx y2zUAAA== X-Developer-Key: i=caleb.connolly@linaro.org; a=openpgp; fpr=83B24DA7FE145076BC38BB250CD904EB673A7C47 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean The priv struct was wrong in dump_boot_mappings(). Causing errors when compiling with -DDEBUG. Fix this. Reviewed-by: Mattijs Korpershoek Signed-off-by: Caleb Connolly --- drivers/iommu/qcom-hyp-smmu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/iommu/qcom-hyp-smmu.c b/drivers/iommu/qcom-hyp-smmu.c index 8e5cdb581550..f2b39de56f4a 100644 --- a/drivers/iommu/qcom-hyp-smmu.c +++ b/drivers/iommu/qcom-hyp-smmu.c @@ -318,9 +318,9 @@ static int qcom_smmu_connect(struct udevice *dev) return 0; } #ifdef DEBUG -static inline void dump_boot_mappings(struct arm_smmu_priv *priv) +static inline void dump_boot_mappings(struct qcom_smmu_priv *priv) { u32 val; int i;