From patchwork Wed Mar 20 14:30:47 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Caleb Connolly X-Patchwork-Id: 781355 Delivered-To: patch@linaro.org Received: by 2002:adf:cf01:0:b0:33e:7753:30bd with SMTP id o1csp335063wrj; Wed, 20 Mar 2024 07:31:45 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCW7aAvuZETFs15V1Ne4/XWpMZdZOdM7qn6KjZh0MoovlIKt/PO9/TCRXZKEkY4qgPu2kj9roHsLmNKE4DCBQgMy X-Google-Smtp-Source: AGHT+IE82zJDV08hjgpZlCTNLXy2EopyaqJZaR+hDQ3NqFMIHYInyNaLWqlcWp2BG57OxKugcAmc X-Received: by 2002:adf:fcc9:0:b0:33e:c0eb:f227 with SMTP id f9-20020adffcc9000000b0033ec0ebf227mr4862839wrs.45.1710945105658; Wed, 20 Mar 2024 07:31:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1710945105; cv=none; d=google.com; s=arc-20160816; b=mCXUUnajD2c2ry3rYTNpWAPX7u9HCw1Vtz0f+2gopGNQ7aApA/KqstGD3syplg0Tvs XuA/nn/Hb9UQGmFmnMyMhrVqu29+4W22d+mGWcaL+5zhMZG6/a3Pwjifmu62LPHkr4+U NnKhor4jxgckas21FbQvdUkuHOQ6DFriAzSBPd+QVkbgp0sn6JfuF9Ouafs7bQ/R+abI k3MykSVdxKHQFiVR94ou2T8HbpXHp/g61r/Yo3PhGr4MIylkkzXe1/HboG3g5Am9qdtk 4szhfieORAGFZ/UL+wGq9StGZ6aplyiLn6GyTxEYBlJ9yq4thmXFanoXtd9znZVUbIrf g/vQ== 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=SjDlW+8IpzNZXJdwydlKPO6ti4rxZpAG+p026aQtpJ4=; fh=UJLfQHigVNNxRTyupVH3iuVYJLWMjRXGBkTXuIfaL+0=; b=juuQul2DEaLJBFmg4e+OuTxd1oz6fb+IRxgbB+fdgokcskkt1kudfwffMLN5vrcolK F9a0Q1p3UboKYykfDfaJs+6542s4D0Rj/08ro/hc4MfHQpliWN/n2+tx9KA6eLtJaJYG JUuqsl4pXlyxARRnWwJWxAtPVoA3FaZMzc/n8pDxBH8VS5Ocw+oVpHUqFdzS5mV5Ygwy BHdRueOWrMjYVDD4aVUGIh6P8uYC8oUaWnnGoeigKzzosrID9abQRuJSkiVaIOJdqLQx ZCDCvoVcfDYJ2MYvt5rNCRCUFy9MQU+2Gj3amwv/5ZNlK0y00IxWD4d+iLXNgfrZNLiO PUEA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="V1/4Oife"; 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 e34-20020a5d5962000000b0033ce0a460d7si7461751wri.829.2024.03.20.07.31.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Mar 2024 07:31:45 -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="V1/4Oife"; 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 4098A880AA; Wed, 20 Mar 2024 15:31:36 +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="V1/4Oife"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 233D0880AB; Wed, 20 Mar 2024 15:31:34 +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-x331.google.com (mail-wm1-x331.google.com [IPv6:2a00:1450:4864:20::331]) (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 1A3C78809C for ; Wed, 20 Mar 2024 15:31:28 +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-x331.google.com with SMTP id 5b1f17b1804b1-4146fe16a1aso491485e9.1 for ; Wed, 20 Mar 2024 07:31:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1710945087; x=1711549887; 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=SjDlW+8IpzNZXJdwydlKPO6ti4rxZpAG+p026aQtpJ4=; b=V1/4OifeJ+lDP5clNIQlXPY2qYHC6V95ORnQ7mbzaQFcoceirauQPsV3h1G4ct6T2x T5e2X3qWefD5LPN4VMRU02nhoarIigN7D45fg40/Nb2KXImr+DVkaJvnvSNeb9Nnl7WK oSmDT93tbZRml5JV5n5uGdIUck+NC9zvaP/TygG2qNlz6PL9JTRZHiTBxzQS5ka+EhAA 9fEzYz4TEFbNJwh1zZnxeaqSOHP/ZIYaZl9XLp9tPBQqLvPOpOE8CO6H7YbtwfkzmRPu i88TL1WO5iyRp6gIIh2ncpdWA4nJWH/p/BqBjS+9zm55rtlk1ruVB/z4AuECXsiaRpzn iWQw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710945087; x=1711549887; 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=SjDlW+8IpzNZXJdwydlKPO6ti4rxZpAG+p026aQtpJ4=; b=wuiDGxPwhuA1eGNJy//wX4CqOlHxlW42+RAH+ZqbZ55Gm7y3+zSnyWjRBilU0XQ/6b 2/ZIbw8vQZ/w6OrxKU5UkMDhe25LBMw2LEZDSnjKI8+Sv2j6UKssrybq4fvy8P4YdXPk E47qcwD8r35EBeQJ8yuMpnHeY4tqI8IJSo++auTCCyc2OpiAMQEaJN4/QTD/3ExlcTsM 7foR7slpB7/ZPMDEme+blNwA0LVo+zKivdByU+giq45dD6wMangPYfej5jLGqD6o8FUF Tv/P6EeeQpzvkadH0MXhdpDjWWftTkuPHgj6ZrpoKmwAFxbIboDRt04IYE8htAzVF+au s3mw== X-Gm-Message-State: AOJu0YyONli+bQcH04dw1ManItnk/R9HFtO9QlC/FqkYRUduSMHRrsCb 4PnljdwzaVz5YvJ7Js9sxDXyDDLzadZ+XXGn3ThesAIn7khKDHyhgsy4xmoUO68= X-Received: by 2002:adf:eac4:0:b0:33d:c5c7:459e with SMTP id o4-20020adfeac4000000b0033dc5c7459emr5371450wrn.12.1710945087533; Wed, 20 Mar 2024 07:31:27 -0700 (PDT) Received: from lion.localdomain (host-92-17-96-232.as13285.net. [92.17.96.232]) by smtp.gmail.com with ESMTPSA id az1-20020adfe181000000b0033ed7181fd1sm12036571wrb.62.2024.03.20.07.31.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Mar 2024 07:31:26 -0700 (PDT) From: Caleb Connolly Date: Wed, 20 Mar 2024 14:30:47 +0000 Subject: [PATCH v4 1/5] usb: dwc3-generic: implement Qualcomm wrapper MIME-Version: 1.0 Message-Id: <20240320-b4-qcom-usb-v4-1-41be480172e1@linaro.org> References: <20240320-b4-qcom-usb-v4-0-41be480172e1@linaro.org> In-Reply-To: <20240320-b4-qcom-usb-v4-0-41be480172e1@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=4330; i=caleb.connolly@linaro.org; h=from:subject:message-id; bh=TBFUFpekV+qFZ6RAviZs0auRQQMd6dN3dIBlHgbqX7E=; b=owGbwMvMwCFYaeA6f6eBkTjjabUkhtRfn23DWz08bH7m+Hc4ntqx2Pb/MZenDfuOpNx/oL3r2 u3USnOhjlIWBkEOBlkxRRbxE8ssm9ZettfYvuACzBxWJpAhDFycAjCRiQ8Z/vulCE2W2x6sdlPW YhZHbJbNE9MvO+P+zTd5e/Y4j8iHixcZ/vBXtN2tf1I5bd/+6z6rnn6SmnD63OxdbnneB09s7TV RkGECAA== 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 Reviewed-by: Marek Vasut Reviewed-by: Neil Armstrong Signed-off-by: Caleb Connolly --- 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..7a00529a2a8e 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_GENERAL_CFG 0x08 +#define PIPE_UTMI_CLK_SEL BIT(0) +#define PIPE3_PHYSTATUS_SW BIT(3) +#define PIPE_UTMI_CLK_DIS BIT(8) + +#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 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 = map_physmem(glue->regs, 0x400, MAP_NOCACHE); + 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 Wed Mar 20 14:30:48 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Caleb Connolly X-Patchwork-Id: 781356 Delivered-To: patch@linaro.org Received: by 2002:adf:cf01:0:b0:33e:7753:30bd with SMTP id o1csp335168wrj; Wed, 20 Mar 2024 07:31:55 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCV+cd7c/Fq2olHdx3ZPQNtksvxbwD66jOItsN5A4404kkJiupGIBqMeLDKOygmEOf1fvg6FGFOtILT/WkvDvSYb X-Google-Smtp-Source: AGHT+IH1jy6LQQrR5YhBsTiZ2d59sJuiHKR+nHLRFHK+RPvCFDizG51zn3De9YIZ4GEe59VNbDcj X-Received: by 2002:a5d:6d49:0:b0:341:843d:dd5b with SMTP id k9-20020a5d6d49000000b00341843ddd5bmr4961159wri.4.1710945115421; Wed, 20 Mar 2024 07:31:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1710945115; cv=none; d=google.com; s=arc-20160816; b=inSm5yi/FFM28wSUi9xL6eXLG0T5IVPCRBU/59+rlHQ9iWUdz9zHFhuyo9aVo0hmV0 DlCVs1y9PUqGnwuFfVChF1B5JwzcddSDWlD/NeTJ+QBJeKHU/GYueZsZFXfi/X35zZrz Y71feuX68M9mWkxcnrdAeJbVP4Kqeyp5ZkmZmTBGVI51dEl6+tlhjrphYvkUfSacKRD1 VurjMDgqR4s5SFK33Q7xlbm/TN2ejc+Y2ea83G9kqTEjE/Ymt7VHHWdZ1rzjnppmFKJ/ wTK7ghnRX5WAtcJxtxaf3K9gdP52Ffyjc3vL0AF9eNgczXCU4ru+678xETHzPWmu91TE tJPQ== 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=mpjeMUA64QiM2xumTj2IcLENnwtxaUaoBTt/9i25/yw=; fh=UJLfQHigVNNxRTyupVH3iuVYJLWMjRXGBkTXuIfaL+0=; b=hTLAP/UrLOA3DhonGgy4Qnycxb0izKmVlZMM14ML0oe5tDvBkxGPzmwDLi8pJ52inZ f/HK6o6vaumDOF8jUcqlYE1G0v4kSwZet+s3e0SmjU9wIwuv7BYA6GwwQiwVh/L0GUgW 1BNn6ASzrVNQ8moZt7N30tCxvVd2Z9wcjMgCMT/FPTGornqtCYYxIllyXqDCrfzfdguh PIFnT4IkXBX/3UITN1myoDTsD1CXEsy17qjJQsOlxTxeKeJ2w7pxVfF63UvUCrrXyXhj S5iO7St1ElPbqqD4MA68XT1ncBGWk2TvdEYxHz1cnY6q5j0ZyJhLdpb17dOsO8z9j3Q4 z0LA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Hlf7rzbn; 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 t7-20020a05600001c700b0033df43ec0besi7325698wrx.553.2024.03.20.07.31.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Mar 2024 07:31:55 -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=Hlf7rzbn; 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 B12B688094; Wed, 20 Mar 2024 15:31:38 +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="Hlf7rzbn"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id EF086880A8; Wed, 20 Mar 2024 15:31:35 +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-wm1-x32e.google.com (mail-wm1-x32e.google.com [IPv6:2a00:1450:4864:20::32e]) (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 BAA8C880A6 for ; Wed, 20 Mar 2024 15:31:28 +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-x32e.google.com with SMTP id 5b1f17b1804b1-4146af3ebc8so5951115e9.2 for ; Wed, 20 Mar 2024 07:31:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1710945088; x=1711549888; 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=mpjeMUA64QiM2xumTj2IcLENnwtxaUaoBTt/9i25/yw=; b=Hlf7rzbnNz/HM8UITXGd2zeH23UXbVKfgsz8+PbFeJp1PonRvSIOCi2XI4zh7+V4cc xr05GXao9epwPN0EWcc/ecql3N2EX3NgeSFqH3hA8HpEpvBP+Vt4SP7RT22tl8CEqogA L0yUeIEjuuk1oGg80RGrwo+UIn1ycUP4OcsnEG5wvPPgrdUf1C2/TLBWlY/3AM0YyihZ YpRSZNiyJSfGXqnPx3UCz8su7EQDzykFF3GvfKN1Pq8XbuV8cJcE9XBQV4OkmH5tpfQM 1HAbqF2fDZ+xCMTFo9ISr1anJyuyuu9SJ3t5h0h1LUjVCKLQD8M5VHTwgdrb3brwPYvo vVww== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710945088; x=1711549888; 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=mpjeMUA64QiM2xumTj2IcLENnwtxaUaoBTt/9i25/yw=; b=pctavNV+kUvGpjg3xRrOX+/M4paG2ooyBHhxlw61Ifcpz42at33aEFjH0tfaEjzWV7 1Z1zgv7sGNV7pUSKVSl5RtermedPxw1F+De2LWGGqqR2140ym1MvpFF+/R5f26VNnOFG l48cFil/o0to3aON2MaYGNi3QgcjdmquiIkVOMa/HzfZqjBhYtgPIYzvPnoH7OxBiUgM 7HT/WnGAkax6GFDSKS2Ig0Seacg8JUFrF+VAdnon3CwHqbNHLEbwY6GTw88hOFQAFF8Q PhVQMGrIkBqMEQsrz2MPmTJrrdnLnDdO/IgwEm0wUe0qNga+fObMJezDQcSQ0WwPW+8o 4gUw== X-Gm-Message-State: AOJu0YwbcFBDnLFjqasBG8cN1Iwh1WDhNZPReqCg0bcSd+C/3NgQqXJ0 iv3SR9q4wi/ymov0i2tyuT2TOCVK0EUWlBEw+a9f4MT73bO+2qv+O1UO3Y/tuKAJffY7VMInlgm y X-Received: by 2002:a05:600c:2242:b0:414:a49:131a with SMTP id a2-20020a05600c224200b004140a49131amr9366483wmm.23.1710945088338; Wed, 20 Mar 2024 07:31:28 -0700 (PDT) Received: from lion.localdomain (host-92-17-96-232.as13285.net. [92.17.96.232]) by smtp.gmail.com with ESMTPSA id az1-20020adfe181000000b0033ed7181fd1sm12036571wrb.62.2024.03.20.07.31.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Mar 2024 07:31:27 -0700 (PDT) From: Caleb Connolly Date: Wed, 20 Mar 2024 14:30:48 +0000 Subject: [PATCH v4 2/5] usb: dwc3: select DM_USB_GADGET MIME-Version: 1.0 Message-Id: <20240320-b4-qcom-usb-v4-2-41be480172e1@linaro.org> References: <20240320-b4-qcom-usb-v4-0-41be480172e1@linaro.org> In-Reply-To: <20240320-b4-qcom-usb-v4-0-41be480172e1@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=834; i=caleb.connolly@linaro.org; h=from:subject:message-id; bh=zgAPVW9qDed342mDNE8anMwCvoGIxZpCW8smqhdbBBw=; b=owGbwMvMwCFYaeA6f6eBkTjjabUkhtRfn23tlEwOHNK7pTNB4+F09Ul+G4zmFSmLTJjL9fSRJ sPqkJMlHaUsDIIcDLJiiiziJ5ZZNq29bK+xfcEFmDmsTCBDGLg4BWAixycy/LO6P79xidqS+UY1 M+b43FngeyLjvFS77LOJ76tPnj7LcUiH4X/ISa7OfOaTK/iE5h10vrh69vJ35r5TDB7Wp9ndfMb 5o3UHAA== 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 Reviewed-by: Neil Armstrong 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 Wed Mar 20 14:30:49 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Caleb Connolly X-Patchwork-Id: 781357 Delivered-To: patch@linaro.org Received: by 2002:adf:cf01:0:b0:33e:7753:30bd with SMTP id o1csp335281wrj; Wed, 20 Mar 2024 07:32:05 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXQZ3gDt+tTl5o6iyRtsk2OVZdYsEQqMMszh26t5hnjKe9ss/8ZG1DiCMusKlBOupwbBB57A1PKG6srWMyeZA26 X-Google-Smtp-Source: AGHT+IH4gLPyTi8+W1g3vetK7zyJNZkxRtGlM6/DhY/iXvxQ4Z1VcVXbMAJ9UCaQijbMu6PfXSzl X-Received: by 2002:a5d:5488:0:b0:33e:b7f8:7c66 with SMTP id h8-20020a5d5488000000b0033eb7f87c66mr4033261wrv.41.1710945125458; Wed, 20 Mar 2024 07:32:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1710945125; cv=none; d=google.com; s=arc-20160816; b=sNM8uas3d28aFKPhNKKeazAX3T/4QUVvHmD+PJByPhIKzRw53vNOI7VWA8BXuc/xjg K89nb72H9UdNB4sPDv2x/WsTDzTtOF3X/ZV2npF7q1P7ArETRVZx5bhksKeUOqN5Eq9W 46WMh5PC0zg8RkGeB3RDhP5y2axRLK+l+A5HG5OutTOSSSDxXFXqF0x8l4yezs2RbXXA YwRnA6r7qk0k/DRB0+jVPKY21CPxJrzt4WfJypC+hFp3pZDC9q09HipbFIZnRNms07Yf GaVtcfJpMm6ovjMjzulTwrheiXl4NodyGgrVU+E+meWKzhqTMVNCh1LXmFQVTUlR8m2h seTQ== 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=U6Ao/BrHGxpD1C9cPv4fRTuqD3AMDzioaQtxFwiQPrk=; fh=UJLfQHigVNNxRTyupVH3iuVYJLWMjRXGBkTXuIfaL+0=; b=wY51Wu12m0QuI+103HjEtSl4AKYa6Mp/1xdsgQCgV34RkkLsZit68zeqxXSVpFldZg DM40j1SwIWniRv8lqwXLuBbaTyp7WQ+2EdZVZ/LD9MyLZjOg8TQHuZL0919+hg2lXfs2 8dNT8vBRjB+9JFsmmN9zHWuimUP5Z2jQm68D+zJWoKc7yEeRZVZqXiisOWrfCdHid9fg ARmekcrwiw7a249yGaYnF4V/j6ZxdkwYtf+gFV0r/vHvormMhTDPrCtwBUnpniOo663a GdyipRa1ZLZwA3FS+TMw8uJvEjplgRYZjTLOz6dUYzEGr5wxIYBqVhzoMCTSJXzVm35d fLLw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=KoG2tk1S; 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 f4-20020a5d4dc4000000b0033b47cec5f0si7109947wru.570.2024.03.20.07.32.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Mar 2024 07:32:05 -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=KoG2tk1S; 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 239ED8808B; Wed, 20 Mar 2024 15:31:39 +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="KoG2tk1S"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 09B8E880A6; Wed, 20 Mar 2024 15:31:36 +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-x42c.google.com (mail-wr1-x42c.google.com [IPv6:2a00:1450:4864:20::42c]) (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 C5872880B5 for ; Wed, 20 Mar 2024 15:31:29 +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-x42c.google.com with SMTP id ffacd0b85a97d-33ed7ef0ae8so2563881f8f.0 for ; Wed, 20 Mar 2024 07:31:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1710945089; x=1711549889; 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=U6Ao/BrHGxpD1C9cPv4fRTuqD3AMDzioaQtxFwiQPrk=; b=KoG2tk1SuIy9fOX9bgjYO7GLDAwa4slov/fCbaoNv49513WllbLLHy1y7+pzHF3Vau s2A/KbEPPdA/U9fhy5LNvPVeexlnDgVbbnGT7Dr6kT6Yvp5OMx7JxGKc5PWgv8iPFbeq BHOsZrod2Ub/SJUKufRR/FWsO7Pv6O27SqXPp5BohWCIUT4pjIRC1AP7mdRyditPIskg wVFgx2J2jMemX1QgXUy39z63Cwt4045LJ/53uh1kgob7wd6TCANZKAMtiE+w/2j8X2jb Ikk2WXhu7vPNgx+vCKqYg7ep/kyug9gsDA8/9lT1+XPAjkIV9U1Kt5IZA3ZxyXPlKdw+ HStQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710945089; x=1711549889; 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=U6Ao/BrHGxpD1C9cPv4fRTuqD3AMDzioaQtxFwiQPrk=; b=mVlxCPKs6yXJUdT+ton0lzV+HaLOwH+TTWIhGlB2WyQOfJPtBYDuPEogPZiYwO5Wax I0cD+gliGPwNqWuufEP+l8yfxwO61pOIgYl0DbGQEq+lsLzToe0mQsOo3Wn8qRbzIS7P iPWp/qGrUUVR8I4R7BK3ZPc+6fY/3Xm7pxM2yhQgrrpWmKsU6OQxtLo0zrfXlL25qaUU 9Ihq17ezJXnX+RGZQleeHHdk6M1dd0VA5/uBNA2XdHmE54sFCf1LOYuMZYdRRUj9YrFg IpKBx8cJsCUvak5PHX8kSxEYYqjqodxtZeAFBUlGV3K4mw/DHxFaSvMXbjjvydgw9N5G cJKw== X-Gm-Message-State: AOJu0YzsGtXnRshAb9XM01Xp8nrtv+rMIB1muoM0NjLc2rn7oJPhkUPh woxgTCLQaoIyWKUCaYGvdURkScmT4R3A7LSqcBQ1DwKCueicPS38bHbLYqyhmeAdqrRtD9Z5UFG q X-Received: by 2002:a5d:5404:0:b0:33d:d7be:3bec with SMTP id g4-20020a5d5404000000b0033dd7be3becmr4131703wrv.58.1710945089298; Wed, 20 Mar 2024 07:31:29 -0700 (PDT) Received: from lion.localdomain (host-92-17-96-232.as13285.net. [92.17.96.232]) by smtp.gmail.com with ESMTPSA id az1-20020adfe181000000b0033ed7181fd1sm12036571wrb.62.2024.03.20.07.31.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Mar 2024 07:31:28 -0700 (PDT) From: Caleb Connolly Date: Wed, 20 Mar 2024 14:30:49 +0000 Subject: [PATCH v4 3/5] usb: gadget: CDC ACM: call usb_gadget_initialize MIME-Version: 1.0 Message-Id: <20240320-b4-qcom-usb-v4-3-41be480172e1@linaro.org> References: <20240320-b4-qcom-usb-v4-0-41be480172e1@linaro.org> In-Reply-To: <20240320-b4-qcom-usb-v4-0-41be480172e1@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=1128; i=caleb.connolly@linaro.org; h=from:subject:message-id; bh=zOzCrBy5uJTh6xPbLEJbYeWWpo5eW586HYEeAes6w7A=; b=owGbwMvMwCFYaeA6f6eBkTjjabUkhtRfn21/HJ0jlfl5y2uL++uN///vKe2df6OzpX9m5PMH7 O/XcVuzdJSyMAhyMMiKKbKIn1hm2bT2sr3G9gUXYOawMoEMYeDiFICJrLvOyNDs+vjA1zv9nz+w vO0svTH3n5Zy7b0bMcyM670XXWj73BvD8N+hbteGbZPedr6/Ll3xy3OF7IoH5zlul4bu/ys5I/y bZVIbAA== 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 Reviewed-by: Neil Armstrong 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 Wed Mar 20 14:30:50 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Caleb Connolly X-Patchwork-Id: 781358 Delivered-To: patch@linaro.org Received: by 2002:adf:cf01:0:b0:33e:7753:30bd with SMTP id o1csp335385wrj; Wed, 20 Mar 2024 07:32:16 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCV53pgtGz/LScfk9SomznGzRx5PCeGjt0UK5RRIpH4uHljpeBuS9wwMvR1tZExjQrv0Pm/6xhxq/RRlp4DTxXba X-Google-Smtp-Source: AGHT+IG75Abn/DRrYlNTPwJ1uqczuEGzxuShcmhTsVXjbSUuDbJyL5+IoFdWf2LmnfJDBI+cdNVR X-Received: by 2002:a05:6512:285:b0:513:ee1:2bd3 with SMTP id j5-20020a056512028500b005130ee12bd3mr4153004lfp.37.1710945136237; Wed, 20 Mar 2024 07:32:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1710945136; cv=none; d=google.com; s=arc-20160816; b=wPM9aWgsQNEaxwHLeCVXtyEi4Wvi4NYEvZwQBnJ+uiCACcus4/vdEhLunrWCmFAn9N ew1bkeAj0cNrxsYO+UpgRGF3upBsWpvxKd/STfY7QMxMsEjhdpXYQJGKJFIDWDlpJigJ 881X/6t2WT+rpHNdaCy/RTV5na5clp0IeroliA5B2AJIOVc9XtzN54c5iiZRsX1Pv+2H 7ZNjQJPgZWabKRHGTAcEF24Y3VTLbi8xlQ3GGpZyZ5VDxFDiVs1K/GoSb1DFVkaEdyOO Bu3zPy70cAzs46GDDJ4/AkRjtgGbSZpxbj+3cYbOXYjEs6UaJQj0X6Bixp2RMPYWnACb 0XZA== 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=xuAod5oKulT4ri3qSNk0l+V6KszpmJJYg/GTS2WSqrc=; fh=UJLfQHigVNNxRTyupVH3iuVYJLWMjRXGBkTXuIfaL+0=; b=f+SLrNHGgjvPHgScY10u8ZZwD0LZfKQqg1UEo/eQCHwOp47FVfw2b/AXLMAwaAHAWK E0uGrOXnTZMcYzXdQmnU8/CChKuUtNiU6ChkpKuw4SdWnQHTE4SxYnWJp9ek1b51Huti rifhq/qBsDsBULnZzcu1KUExjGN2PUlDUV+NywH3nGWP4JJ37151B/WIrKD23TypHCo0 VP2l5Kn5pjijIHWAMD6mbqUjrJUGabswhulsG39vlGJ98Hhtf6ZMTXFM9fd7HOOM/M/s UtwzlW2l1FxVLEMe4xtzoCBk+p9ZOeRw9sEsCK4JoIZpQJUD95MbvcF/PL4tBN0YoOQZ +uMw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ioRRmtxG; 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 o4-20020a5d4084000000b0033e7a214218si7054087wrp.888.2024.03.20.07.32.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Mar 2024 07:32:16 -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=ioRRmtxG; 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 8A0A1880BF; Wed, 20 Mar 2024 15:31:39 +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="ioRRmtxG"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 48DBA880AB; Wed, 20 Mar 2024 15:31:36 +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 B23CA880C5 for ; Wed, 20 Mar 2024 15:31:30 +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-33fd8a2a3e6so2348189f8f.0 for ; Wed, 20 Mar 2024 07:31:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1710945090; x=1711549890; 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=xuAod5oKulT4ri3qSNk0l+V6KszpmJJYg/GTS2WSqrc=; b=ioRRmtxGWY7JzxilDM2YlH+HOP0QpHDL1JaFBQXKsJWz6taYvt0tGxenn3wS/39cQq UM+JGBMXyX5Arhw4jz989bt2HibNE14syJa30uLGlLRqOSoSI763Kt9F8Gj3lr74Dz8B k7eQbaeZkjY2x+wJU28atfmq5PAsG2IpJs87zvI/6o1rLnf1+V6m9GbDd8O1u/b7j2ee 72kGZN9wXXAknJ+wyUSEGJ5isyEsRfX0TuUULQHiP2OfRGEIY0Ia3n79cwgirMdnX+6u yL2JMU8sH+w5cy649EugF5AGumkEbyAZJFxoVaRWPjSaHG3Q6TefwZvhdwFB9H3rkt2Z 8bug== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710945090; x=1711549890; 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=xuAod5oKulT4ri3qSNk0l+V6KszpmJJYg/GTS2WSqrc=; b=dU24vn8cm57JL3yUonpFM7Ty51zZ0kmKrVsOx+UPw6vL4KInYpqNLjBi2NgBv55PpC WO5TVufbK1blVVyqk3x8q5HPaqjCH1o6zh9hCiGUlkBjMjcobOdk0uL4AhBLRC5Lj7/b UbrJ4ThtJKs4kvVl9GG2/S7DeuOF+sLaMwbSbXJNTvEY8nnmanDKzqa+AnEgYePXCqsg ytYZExsEG/z4FTyycUAuKazGRtKBgW8pWUQlYMsvzwpptHMCkBk6R/cK4GcoIe6MMYHa 8P0pfj+Y86O4sz1oiYRUs+MJQj9WYNgNRyt6KXsShhp6CQtT/noMf7hREdLDcCRr8c3E k3og== X-Gm-Message-State: AOJu0Yy5h/JE2DXwI8DPmZa+8YrTUozesBttuuczuyf+faY1FCELfsWT uYuN/HHR0RuEQJYSPf8/SvoSjZqU75EKSEMhGEivM+t30ob8yHDfvh3AU4c+1qs= X-Received: by 2002:a5d:4e0f:0:b0:33e:cbec:b2bd with SMTP id p15-20020a5d4e0f000000b0033ecbecb2bdmr3598285wrt.9.1710945090184; Wed, 20 Mar 2024 07:31:30 -0700 (PDT) Received: from lion.localdomain (host-92-17-96-232.as13285.net. [92.17.96.232]) by smtp.gmail.com with ESMTPSA id az1-20020adfe181000000b0033ed7181fd1sm12036571wrb.62.2024.03.20.07.31.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Mar 2024 07:31:29 -0700 (PDT) From: Caleb Connolly Date: Wed, 20 Mar 2024 14:30:50 +0000 Subject: [PATCH v4 4/5] usb: gadget: UMS: support multiple sector sizes MIME-Version: 1.0 Message-Id: <20240320-b4-qcom-usb-v4-4-41be480172e1@linaro.org> References: <20240320-b4-qcom-usb-v4-0-41be480172e1@linaro.org> In-Reply-To: <20240320-b4-qcom-usb-v4-0-41be480172e1@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=13012; i=caleb.connolly@linaro.org; h=from:subject:message-id; bh=ohYgFS9Eq6pC+NVNcS+t4STsablSVa63T0Q9OSlPpvo=; b=owGbwMvMwCFYaeA6f6eBkTjjabUkhtRfn23lf8sucTNLnqP9e8p5+/UbWeRe1Z/R1TeQ/ZzeV TypYc2tjlIWBkEOBlkxRRbxE8ssm9ZettfYvuACzBxWJpAhDFycAjCRw5qMDNMsX3qaSguothpH zvx5b/7aemk/nU3KLzhehSwoWLmIZxbD/yw/x+nzHJa/+3LNJrzvkkSf8uWSu0GLhK1S2lX6+o8 kKwEA 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 Reviewed-by: Neil Armstrong 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 Wed Mar 20 14:30:51 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Caleb Connolly X-Patchwork-Id: 781359 Delivered-To: patch@linaro.org Received: by 2002:adf:cf01:0:b0:33e:7753:30bd with SMTP id o1csp335463wrj; Wed, 20 Mar 2024 07:32:26 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVBniBjyHiXDF353UNiIYuZyIDXhk7IaeQVIh9aijwjlLHzhOqS9xtbl1Ks112wAwF6p8/+XmJMy3XAFXTy9e7S X-Google-Smtp-Source: AGHT+IEDpJ1Hgm79xh3til6nvwOt2dFpuw09iUlQZDReO9Vd6yZQjjuPi4eYTCJ2sVA5aIe9B4XQ X-Received: by 2002:a05:6512:1c5:b0:513:dc12:95f6 with SMTP id f5-20020a05651201c500b00513dc1295f6mr9832925lfp.28.1710945146494; Wed, 20 Mar 2024 07:32:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1710945146; cv=none; d=google.com; s=arc-20160816; b=igH5PnwdRy+1Cbv+ZH/Km19BhNiqTIXPgyOFJIsj4bZFvSXJ42OO0PUcZ9/PuM5j/f tawVoyQQvHowV32nXNOpeyKjyhrRupshbDiWr+O6ES6ZDfxeP6bn4JcyObD8M1K2yaEd pVzH4ojZFVCObJ7qb3slcO2E/PO0Z5Z38IFEfKO8kuvMf+Atucb9whZII5+MLTPaJ4CA +2vYFvrvRKn7njV5PCvRB9cts9bWtmw+TmGBym1zrpxtclrNgQqD0dr1TbzEhy98AdL8 GymJdJGqG9Qjuwl1C8Wl90ak/qll3vGZtQMyFaA9XG8aD8LPFEcLJlWvQj+VD6u54BOg gnig== 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=PaOzLG56DkFB6GBvEZTyeRoaiYCJeFBFuCa0mEQreF4=; fh=UJLfQHigVNNxRTyupVH3iuVYJLWMjRXGBkTXuIfaL+0=; b=SLkeA3Xb/5/cSDMPCoUtH4E8II7qbPT0DsDuquMkGUz4FbozfnP1sMP3loIGoPsefB RAZPxYrMvJmz3/IIxrMFKzBwVLT5R8TyRtcCgsMga/5hiNcv3SYsAzsgfmP/0t9WAUlo v1KymZbqo4/7F27k9H8r1gl8VKyAIocjAERaFpV23IW+i4ixB6TW1h3uWHUzB4e2HcLV pi1RF3kRKUeuOSeADEXGY2xgEi9jdb76cq7SQUH40yvOZ2ORaYO3t9z6w0u7sH+WVx2v SIFuohi6AvQ4sM0px6XjGEfjo0gmlvc6aTe3Z6450yhzS4t16ujQSDNCYPpZIjMbbN1F 1IDQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=iFpZicEt; 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 i18-20020a5d4392000000b0033e6966e777si7274413wrq.789.2024.03.20.07.32.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Mar 2024 07:32:26 -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=iFpZicEt; 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 0ABD7880E9; Wed, 20 Mar 2024 15:31:40 +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="iFpZicEt"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 4F37588085; Wed, 20 Mar 2024 15:31:38 +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-x42c.google.com (mail-wr1-x42c.google.com [IPv6:2a00:1450:4864:20::42c]) (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 9B9AB880D8 for ; Wed, 20 Mar 2024 15:31:31 +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-x42c.google.com with SMTP id ffacd0b85a97d-33ff53528ceso2691135f8f.0 for ; Wed, 20 Mar 2024 07:31:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1710945091; x=1711549891; 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=PaOzLG56DkFB6GBvEZTyeRoaiYCJeFBFuCa0mEQreF4=; b=iFpZicEtJNtF5jFq8pVKopvpYfjvHSQA/m7o4/RKdrbjFtkSvACfX5GLvM9rhrppXZ 2f/sNsXhd/75SAzE3xDybmlMsRO6FPzSKL2pLuVgzSRU4MKAN5VpbyWcry2XMaQMcBGo V6o4mN2ZNplJX8a0dpdAMmwssonKcmEYcSpPKBnbHV+UNwVmLQ9Hai0oVRwHcPB59ull ucJuiVumqsr6n30hVEo6ce7zYXXw/EIh29klT5xWAqF9wlSdIBZpZXQD6toiet91qIhg u50sJzPqfEz3Y9s+5yYunxwmPsiQHf5VccYt9Jo8smi1C3p4e0ZLbnMSdPMuBWk+VWRL zbig== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710945091; x=1711549891; 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=PaOzLG56DkFB6GBvEZTyeRoaiYCJeFBFuCa0mEQreF4=; b=SPkE6r2xPxE/XiiS+3hVOGQSZYYW5EIJO6O/q99d878HiaqHLFkn0kbVjvrgvLL980 QerBF+ziWtS0Vh07RNtN/TAjAB0vQbscRQWql00zrjxiqvrQK9baq9QxZ5XMhY8O8q1c glDPg1qv/b8OCJMYawjblpq4kbXslAll6rvMfS1KOeYVEWI5lKcgRYct5EO18Ip32o37 UD61JT6A2JpaHO2WLtWKQinJGALvdWO8mGHR4LSXdZNXua/63BnNcNOwlZEx+BAB8KKh fvO5fWCTpsTEyUTtm+fS4Tbdr7pZTJYZIjk9L8JtbLb/Y/1h3bDfF/n497hahDRUgcqi C1Qw== X-Gm-Message-State: AOJu0YxXZLlX9bYJYnTacbzIeeP6WlYKL/8di1bd2vhJJbuhgcniYimS qF/sZVcZrSzlTE3Y6hS7+qPyIDx2CuF98kw0vJm5S6g7m70MpvSP8Wai5Vhfo5g= X-Received: by 2002:a05:6000:188b:b0:341:715e:36d4 with SMTP id a11-20020a056000188b00b00341715e36d4mr7891641wri.29.1710945091253; Wed, 20 Mar 2024 07:31:31 -0700 (PDT) Received: from lion.localdomain (host-92-17-96-232.as13285.net. [92.17.96.232]) by smtp.gmail.com with ESMTPSA id az1-20020adfe181000000b0033ed7181fd1sm12036571wrb.62.2024.03.20.07.31.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Mar 2024 07:31:30 -0700 (PDT) From: Caleb Connolly Date: Wed, 20 Mar 2024 14:30:51 +0000 Subject: [PATCH v4 5/5] iommu: qcom-smmu: fix debugging MIME-Version: 1.0 Message-Id: <20240320-b4-qcom-usb-v4-5-41be480172e1@linaro.org> References: <20240320-b4-qcom-usb-v4-0-41be480172e1@linaro.org> In-Reply-To: <20240320-b4-qcom-usb-v4-0-41be480172e1@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=859; i=caleb.connolly@linaro.org; h=from:subject:message-id; bh=JSWCwSd/ls5fMK87FWiDEcIio+ZebyBVKrf19XCSuLQ=; b=owGbwMvMwCFYaeA6f6eBkTjjabUkhtRfn23v2f46Hvs2xennRf2dMiqrNxV0B/C4p71dsmN+8 9SvkhKaHaUsDIIcDLJiiiziJ5ZZNq29bK+xfcEFmDmsTCBDGLg4BWAiVwUZ/ko5eu9qKwvMTdTw kdcrYb34QHfPwv96f7v+fXj8JenBnH8M/+u3/EkUWVPfn1uz8+mcvYe/XW6brGT3fpP8peJHEhf z+Q4BAA== 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 Reviewed-by: Neil Armstrong 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;