From patchwork Wed Jan 31 14:57:26 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Caleb Connolly X-Patchwork-Id: 768496 Delivered-To: patch@linaro.org Received: by 2002:adf:ee41:0:b0:33a:e5bd:fedd with SMTP id w1csp1899287wro; Wed, 31 Jan 2024 06:58:02 -0800 (PST) X-Google-Smtp-Source: AGHT+IHUCxoc53GwR5L2cVyQIu64kCI8mUFDIBaLK9oVN9qrFpWxSytITaVHt4amBZZH7g7yAycS X-Received: by 2002:a5d:598b:0:b0:33a:ff6f:608e with SMTP id n11-20020a5d598b000000b0033aff6f608emr1597549wri.39.1706713082571; Wed, 31 Jan 2024 06:58:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1706713082; cv=none; d=google.com; s=arc-20160816; b=KaDUPmWUKxv89jpoX3rBiXaGTOTVgDSmpo7bFFghWLw5JNW7DXTbGUGPazpow3crvW xLmd/cYId4+y0hHy3cZkiHVUo1WEFFoouDDkl0FBTQAKQ56vcvHNoZ66+83T9+2K/w+E 4syfEci8cKKHWD5Ta8yRjUOI0r7TvwMMIcRyjctuOJ9OatUH8iiYaHesGFnJWsjzo+4/ uAO1qTgklyjTk5i5vLXop7rbO82ZAhaPcDJQB0xXXBRli277i4egV3lk90cEMcfSOo9A ZShKTEPUMow0UhVAXDGrE6rSmYkGkR/b3YKIbppCEJ6mNA2jU5nHMoyA5pkJkEHwNzG3 cPSA== 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=aUbJkWjjrXidoORCmcFz2lZmCRklHKpbctt9GKSboY8=; fh=UJLfQHigVNNxRTyupVH3iuVYJLWMjRXGBkTXuIfaL+0=; b=QRlLjGwUmL07nStm+///VAm/zm48nuShGM8qmK3pEXeM1XEgTOBwi0XOj5f4WGFRcN Qxjhmu4/YepuSjSBbhcoXf8ITjiz0njp+E6TKbqRgnMMICYmsEJ7bOoJ3WfFow5FalTG NajziKHG+Dd4JfaY1SicWfaugaABlnDEXOm7+tQYPsuXGJtZv0PEaYg2TZx1NNv9OVn8 Fdpzy7ot7H3OS14mVaz59yC9Xfdi4V7kU9qeZf2CWKUG8jf9we+QU5ydhUnjF6HQAMEc Ef0cKSqAaM83SYH3KYzzWfegsMxErMKFoUErIzH8SZe9o8CFt0brlBqQzDAr6Pi7apz9 IpCw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=B9dqLfDw; 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 q7-20020adfcd87000000b0033afa93c2b0si2163899wrj.246.2024.01.31.06.58.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 31 Jan 2024 06:58:02 -0800 (PST) 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=B9dqLfDw; 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 80DB387D47; Wed, 31 Jan 2024 15:57: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="B9dqLfDw"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id DC55587D1A; Wed, 31 Jan 2024 15:57: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=unavailable autolearn_force=no version=3.4.2 Received: from mail-wr1-x436.google.com (mail-wr1-x436.google.com [IPv6:2a00:1450:4864:20::436]) (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 ABE6087C68 for ; Wed, 31 Jan 2024 15:57:32 +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-x436.google.com with SMTP id ffacd0b85a97d-3394ca0c874so4218388f8f.2 for ; Wed, 31 Jan 2024 06:57:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1706713052; x=1707317852; 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=aUbJkWjjrXidoORCmcFz2lZmCRklHKpbctt9GKSboY8=; b=B9dqLfDwLauJvRuh+0fMcOPMoOLw/yHfZ+kYVOpoGG+r3l1ARccNiYqpS/aGTjgcAh f0jYC2d3ZgbJtrMJdNpSKavz2EX+tT9b8OMRtGEUJYeEiMqavJHqsXwjQGDRO6L8VftG I8gzoceQjYmV8tDUpKHzUZgfEMXNm2Oww9bc8KEwvYPUVJkK4Pepvo7M5DCWbv0Whug1 5sYZ+kH1fONC25sy4PWD+eBZomI6tK2w68B05EdtX6tTO7B1JZu0vtZ/y4t6ku8rVWII l7TYLz4CkwtTiREY4spJL9TLi2XeUzw1AruKbXt45grGp4j2uEmGN7huJmYmigy/kHDn ourQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706713052; x=1707317852; 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=aUbJkWjjrXidoORCmcFz2lZmCRklHKpbctt9GKSboY8=; b=qjzPUz6vkSioe2YsgdM0rAIhI+2Sn2DKNy7oH4vAQMub4dRTlvsStQm+nzMJ5EiOf+ taKalnUWbFTLmqu7vo81jjP/huUjeAtgddytzjukJ3Lr0DBAtLdAzp71jeXvSUiekxtF KxQKtKkN4K0IqkMcE14pUgY/wQ7Zl4bMN0uc3DPAa4VvTOzyrva0MnZh3xKPHDrDbRv3 TpjFojJlg47jL6d457jgIMg2+Gzxx7MAGrOyrLbwsYb2p+0inoVGqX+D4mUdFIRjdnMk OYIuIs+W5lNA2VVy+sbiVaLkNlas4VQuhZKgusOkqYxFYq+c/KO8NJD1f7jt+15WcmGL 3YKg== X-Gm-Message-State: AOJu0YzdOxtvrW5Oqgfiz4PO2aNOiQCTnCmCm4BgUJmiOFXX9i9pR2Tk joSL95tL35Bq47G6aGttUw1xN3nT7tOs4R8cO7zE8D5ot8oFpFh3CWRDBRw/hwc= X-Received: by 2002:adf:a188:0:b0:33a:e9d5:3fe4 with SMTP id u8-20020adfa188000000b0033ae9d53fe4mr1324928wru.27.1706713052095; Wed, 31 Jan 2024 06:57:32 -0800 (PST) Received: from lion.localdomain (host-92-17-96-232.as13285.net. [92.17.96.232]) by smtp.gmail.com with ESMTPSA id a15-20020a056000100f00b0033aee3bfac5sm7841912wrx.16.2024.01.31.06.57.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 31 Jan 2024 06:57:31 -0800 (PST) From: Caleb Connolly Date: Wed, 31 Jan 2024 14:57:26 +0000 Subject: [PATCH 1/5] usb: dwc3-generic: implement Qualcomm wrapper MIME-Version: 1.0 Message-Id: <20240131-b4-qcom-usb-v1-1-6438b2a2285e@linaro.org> References: <20240131-b4-qcom-usb-v1-0-6438b2a2285e@linaro.org> In-Reply-To: <20240131-b4-qcom-usb-v1-0-6438b2a2285e@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.13-dev-4bd13 X-Developer-Signature: v=1; a=openpgp-sha256; l=4217; i=caleb.connolly@linaro.org; h=from:subject:message-id; bh=l94OSpm9RVtjfYpzydIJkTgKut5ruGNpkKZzx9Ugd3M=; b=owGbwMvMwCFYaeA6f6eBkTjjabUkhtRd8be27u0JNJq8vL2vo+hSWXm0816zw9cKtU3t325Zs SSuR7ezo5SFQZCDQVZMkUX8xDLLprWX7TW2L7gAM4eVCWQIAxenAEzENZ/hD6/kpZnTDDLT31uv NpjMb1Gu/+ML73vNigqnZjaDeTJ/0hn++7zey7V/3qPOaw1qi1r/bWtQ8OT31y343vSMV6aC5XR gGwA= 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. Signed-off-by: Caleb Connolly Reviewed-by: Mattijs Korpershoek --- drivers/usb/dwc3/dwc3-generic.c | 99 ++++++++++++++++++++++++++++++++++++++++- 1 file changed, 98 insertions(+), 1 deletion(-) diff --git a/drivers/usb/dwc3/dwc3-generic.c b/drivers/usb/dwc3/dwc3-generic.c index 48da621ba966..1119cdecd26d 100644 --- a/drivers/usb/dwc3/dwc3-generic.c +++ b/drivers/usb/dwc3/dwc3-generic.c @@ -419,6 +419,99 @@ 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 inline void dwc3_qcom_setbits(void __iomem *base, u32 offset, u32 val) +{ + u32 reg; + + reg = readl(base + offset); + reg |= val; + writel(reg, base + offset); + + /* ensure that above write is through */ + readl(base + offset); +} + +static inline void dwc3_qcom_clrbits(void __iomem *base, u32 offset, u32 val) +{ + u32 reg; + + reg = readl(base + offset); + reg &= ~val; + writel(reg, base + offset); + + /* ensure that above write is through */ + readl(base + offset); +} + +static void dwc3_qcom_vbus_override_enable(void __iomem *qscratch_base, bool enable) +{ + if (enable) { + dwc3_qcom_setbits(qscratch_base, QSCRATCH_SS_PHY_CTRL, + LANE0_PWR_PRESENT); + dwc3_qcom_setbits(qscratch_base, QSCRATCH_HS_PHY_CTRL, + UTMI_OTG_VBUS_VALID | SW_SESSVLD_SEL); + } else { + dwc3_qcom_clrbits(qscratch_base, QSCRATCH_SS_PHY_CTRL, + LANE0_PWR_PRESENT); + dwc3_qcom_clrbits(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 */ + dwc3_qcom_setbits(qscratch_base, QSCRATCH_GENERAL_CFG, + PIPE_UTMI_CLK_DIS); + + udelay(500); + + dwc3_qcom_setbits(qscratch_base, QSCRATCH_GENERAL_CFG, + PIPE_UTMI_CLK_SEL | PIPE3_PHYSTATUS_SW); + + udelay(500); + + dwc3_qcom_clrbits(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) +{ + void __iomem *qscratch_base = (void __iomem *)dev_read_addr(dev); + + 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); @@ -506,6 +599,10 @@ static int dwc3_glue_reset_init(struct udevice *dev, else if (ret) return ret; + if (device_is_compatible(dev, "qcom,dwc3")) { + reset_assert_bulk(&glue->resets); + udelay(500); + } ret = reset_deassert_bulk(&glue->resets); if (ret) { reset_release_bulk(&glue->resets); @@ -623,7 +720,7 @@ static const struct udevice_id dwc3_glue_ids[] = { { .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 Jan 31 14:57:27 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Caleb Connolly X-Patchwork-Id: 768495 Delivered-To: patch@linaro.org Received: by 2002:adf:ee41:0:b0:33a:e5bd:fedd with SMTP id w1csp1899206wro; Wed, 31 Jan 2024 06:57:50 -0800 (PST) X-Google-Smtp-Source: AGHT+IEsSMMgsnJsOD/JsrE0nXTys58b/5nu8yPEVpWzhUSFBIhs41uxPKiYoQACf2NjxADmMC07 X-Received: by 2002:a5d:47c5:0:b0:33b:599:dcf5 with SMTP id o5-20020a5d47c5000000b0033b0599dcf5mr1666481wrc.60.1706713070397; Wed, 31 Jan 2024 06:57:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1706713070; cv=none; d=google.com; s=arc-20160816; b=YVZ0qaVyrQVBadcYb7reNX/HkbrOFPMkG+XEyI9KH1zfnjdf3BsoCXW2oJZY5b1kXJ sUA/6L+2pfx9/nvE5vh9iMMsCJS38scaRutMEFjmDsiCt8nuAJlribWXyw709SfJ/5xI ZW0gEHFye3LNZtZfaZGtWaBVx9+2u0n0V0U/JZpa6GzUTkJ026thTKIpdwga1p+81WqH PXTcAxPokTj6iQ9+zYsPanD+AQz8hXUoYTsjIoaXEd+hPm8OHtH4MaKbfY6WF0KMg84j 03HYQI0OY7hU2yf4JswlBtl1AWHcZ7SNsXiyFQ6Bsf8OBduWS9cdc1A+x25NyCzfamHj bEvw== 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=bGNsezs2u9n1en3GSHy8xckGQLvUavYo9GOoiPo/ivg=; fh=UJLfQHigVNNxRTyupVH3iuVYJLWMjRXGBkTXuIfaL+0=; b=mYvdeR/vd+pBLU/jrzWxId5HMLybjso/0+fozQYS58cddh44xcoWIZ0SjWnwb5pq22 HtiBpOoSPomgPdF7qDlCtK6G1P5Se+G8N2KfXDMockhn5ZAzaqfKlJfUNHHhZOSC1Z0/ Z90gPF+W/eiC33uUzKcqID8zcbs6lGpXO0ljLP09pV8XSgFHJ4Iii1DjWiVjpykds6jL GJsYGQm7HVEhgfVk2I9+85wyVgPgytuUkNq3i2//1eDr4lh6ef8bkjGZpYz8kgSIf6kT VG7ChN9hBjjHxiU1DX+u11xc/gb+Ac6n5+SXGx4qeGoorb050wNOISKI2MPaKeighcvh 7ynA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=cwJVwG3M; 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 i15-20020a5d630f000000b0033aeb35f2fdsi4188887wru.514.2024.01.31.06.57.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 31 Jan 2024 06:57:50 -0800 (PST) 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=cwJVwG3M; 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 81B5287D07; Wed, 31 Jan 2024 15:57: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="cwJVwG3M"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id D651087C09; Wed, 31 Jan 2024 15:57: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 61F1087D1A for ; Wed, 31 Jan 2024 15:57:33 +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-33ae51f8111so2748080f8f.2 for ; Wed, 31 Jan 2024 06:57:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1706713053; x=1707317853; 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=bGNsezs2u9n1en3GSHy8xckGQLvUavYo9GOoiPo/ivg=; b=cwJVwG3M/kyOXcl9i4M4rPBjmUHGleEIGtKZOGnlgZ51yeUnKz+FmCWMaXe/rAnh3Q XZ0BvyWnIbE2Z3eCdCgWX5u3/jXu158Gs7M1thTgTaJdyQ4f1gW6HsRMjbcrawni+ikK 3k+BpxARR+QjB9WkIPSipMXtC/BUIhC7kCeg1cMeQjxhN7HoDvX+0oDkP+bCrL34ZnHz YCLiAF6nE1O8CNxJpHkAO0xYQK8kjkIVnrs3QdHgAB+76ZLByjJW/bZBFwLT9Sobu6Kc mPjEeH1Ch1T2FsEKwzztkK5+80olMZnZW1Zd9jjTikNZy90yzz2dgQiWagVbDYZwouYh 1MSg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706713053; x=1707317853; 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=bGNsezs2u9n1en3GSHy8xckGQLvUavYo9GOoiPo/ivg=; b=pywoummurss+Y163OrjNexzEsrqigy/wdN+9GnHSvr1w7F2zTNRgZSOGXZTbPaQFff 0DfDQZUnI146LgbRQbaAKBaC2rMQ2enHrQKKmP7brhqaAGvmI/WdP6lE0nxT1OYYlNfp InTbieB3wgogvX+V8+5XfKnqk8tnFl8/sI8UVlWaNBCDKTfx+WJnvlEJ7xWTCrOPmGcS Buzrwg6YT5WGtg3pPn3owkIxBfxL75Yjki/PDFq8Vaou7h8QJP2iyVpvSm6nsC/qS4nG EtGyWk3p6KH2VpaLQ0uCqdPDC93hvm9E1jCBYf1SpA617KdJvmUd22cePNZBvSOC4E1a 986A== X-Gm-Message-State: AOJu0YynGb56rJxqoGhUN04JG3asWvbwCZF7ROBYlXkJPdbLQlAUfEM+ zWzgmbzsBuAbt0KG8HtUW0qEDk4IRjg0isNXVms/g5J1XUHIzahC9dAwbB8vEO4= X-Received: by 2002:a5d:534e:0:b0:33a:e639:2da1 with SMTP id t14-20020a5d534e000000b0033ae6392da1mr1121144wrv.65.1706713052904; Wed, 31 Jan 2024 06:57:32 -0800 (PST) Received: from lion.localdomain (host-92-17-96-232.as13285.net. [92.17.96.232]) by smtp.gmail.com with ESMTPSA id a15-20020a056000100f00b0033aee3bfac5sm7841912wrx.16.2024.01.31.06.57.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 31 Jan 2024 06:57:32 -0800 (PST) From: Caleb Connolly Date: Wed, 31 Jan 2024 14:57:27 +0000 Subject: [PATCH 2/5] usb: dwc3: select DM_USB_GADGET MIME-Version: 1.0 Message-Id: <20240131-b4-qcom-usb-v1-2-6438b2a2285e@linaro.org> References: <20240131-b4-qcom-usb-v1-0-6438b2a2285e@linaro.org> In-Reply-To: <20240131-b4-qcom-usb-v1-0-6438b2a2285e@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.13-dev-4bd13 X-Developer-Signature: v=1; a=openpgp-sha256; l=698; i=caleb.connolly@linaro.org; h=from:subject:message-id; bh=4Pp9MVWKCvGq8lILqjyqGwGLOpWOP7ls67K71LEQ3r8=; b=owGbwMvMwCFYaeA6f6eBkTjjabUkhtRd8bc8/JkkJdZaui+XeFWlxCopV7tUi8nD2uGb6saXv xTb7Dd1lLIwCHIwyIopsoifWGbZtPayvcb2BRdg5rAygQxh4OIUgIk4BTL8j12odH+69XM1AZX9 f8pN7vFPeLrlUdv3wm8TPvTMnPBnGjvD//ScCR03/5jWLODWLqs+VqT+8XjHkvasu29VX834LmM SdxAA 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(). Signed-off-by: Caleb Connolly Reviewed-by: Mattijs Korpershoek --- 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 @@ -11,6 +11,7 @@ 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 Jan 31 14:57:28 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Caleb Connolly X-Patchwork-Id: 768497 Delivered-To: patch@linaro.org Received: by 2002:adf:ee41:0:b0:33a:e5bd:fedd with SMTP id w1csp1899387wro; Wed, 31 Jan 2024 06:58:13 -0800 (PST) X-Google-Smtp-Source: AGHT+IElGG0HVDibaKAOwNpuKUv04w2l/1haAo94mJTdwu6FGL5URO/kyzjK7O2mZ++sCc7/ZPRe X-Received: by 2002:a5d:4579:0:b0:33b:3b3:f486 with SMTP id a25-20020a5d4579000000b0033b03b3f486mr1400608wrc.35.1706713093767; Wed, 31 Jan 2024 06:58:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1706713093; cv=none; d=google.com; s=arc-20160816; b=v6j/+INOLeOpHSnNBsjuNuicd327FBUpDLeNiE7NzVLn6EYlE72J9uLQk5s/h21FDz kvssOfj7Pd6khLx5wDft0HDtFwvTgP3i8bL0ruNVM19fPDqGHGyfKQSFnL9pBPxbIDOK YnbeFOkR9Pfn+zNwEP3oj7CA5JbhNwt5RQP/qx34Tz4gwWYgUWCJuEhrq8SCK+WKOX5Q rsIkNmSn5QEsvbTNBTLBacEHhsInS7skmVnry7sJHEHgaa+Zlbs2nft6IoWPL4a4uD2H roTAoRVI6IoSKLZtSimGwBau11TDqPK25WVu4gtrm1psELwNuK3qWsN93jdWBj+CBxFj Tg4g== 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=2XYp8YcM236D77cbSXRzdYqrbYkWijOkcl9vz2AuRC0=; fh=UJLfQHigVNNxRTyupVH3iuVYJLWMjRXGBkTXuIfaL+0=; b=gVej67UFp8ynrL0VGoW9R9Riq/F8Ui4SuLnLhbCS5CBDVH7kzdOHnmuRciQrDvmTmd Cbtcl8nyIyn2kNK84lpKR6c5WurE/DhUH9m9ImbAQ9BBRhGRYuLSzhPsjEUhWsHQMOGf DesGt9frS4dyMQ4stftZ6TvrMXmWSmmNptV3PsCziMywMAhJmcdfwsfldjkNsxbvNeg/ nxayzPV9nC02PZ1XPueoKii7nOGNnStxjT1kcbReZ+4GQ93dNSV2tdfRmTTz4uYntkba OS7jh6/QYM4HT6R+O8okSr9DsukCWv/SjlFZnrrbln4Ef47SM2jclJPyq0+MN2HDEprg wt7Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=KNRBeLpk; 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 s3-20020adfdb03000000b003392e402244si6572827wri.731.2024.01.31.06.58.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 31 Jan 2024 06:58:13 -0800 (PST) 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=KNRBeLpk; 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 26CF187D6B; Wed, 31 Jan 2024 15:57:42 +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="KNRBeLpk"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id BDA3387BE8; Wed, 31 Jan 2024 15:57: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=unavailable autolearn_force=no version=3.4.2 Received: from mail-wr1-x434.google.com (mail-wr1-x434.google.com [IPv6:2a00:1450:4864:20::434]) (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 58C6D87D5A for ; Wed, 31 Jan 2024 15:57:34 +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-x434.google.com with SMTP id ffacd0b85a97d-33b0e5d1e89so81776f8f.0 for ; Wed, 31 Jan 2024 06:57:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1706713054; x=1707317854; 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=2XYp8YcM236D77cbSXRzdYqrbYkWijOkcl9vz2AuRC0=; b=KNRBeLpkZ+5NjIxHm64/FD5omNCeC6icYrcAhxpQw6byDblzJiBXVNmpZS2zCRKIYo /Dj92puXwcLj66N52paXNfFMtrFk9TsrrMTCLLw9SdqII+sK02Owj6CptzGXy5NGgcVu Znqxbkpvf4PhBVMmopRAFLkW6CQfaF0iRdx3pZDDxW3QlxhqKv3C5boAme6aRsT/EmX3 0i24j2k2WEOwXbhCv4/cowz7WUm+8jkktgxmfwAjQKHsnup8iq6S4LKwabkJk4p0yAOJ 5jBuRF3quIIHnK3owYvTKoHGx7/38KEFoHFgixWBrilY6VMubcom4MTuW/kYEAdHKGv1 BHXw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706713054; x=1707317854; 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=2XYp8YcM236D77cbSXRzdYqrbYkWijOkcl9vz2AuRC0=; b=Z1h1uuhQH60kJHfmaw0x2Pv1b/MKgVb9DTxlSp9lq7m6ETmtl/ed7bzbMasE2o4juC o+JSH1RXTtfh7RYj6tP4oHlLhLLRLdL9/8E3SOKWynaCDsonfwMAnKajyPLcwe6lwlPN j5CpE3XBzhYDXQbrTud7rT46jpyF/xKycNl9JwFMjCaMi5Ycw4OnYTpHPDlPRXUFwv51 r5jPV/o/ZgY2xL6TPecjdZIA0bYc91q4OSWN+0qh0MYW0q0hyvgf8NZN0NqyXGyt994t TZv4Fl0+HNs5wqHygwuBMiMP91qOrvsOcwDxR2Pt8i7zvRwLHbRguhXwFPZvTujafdDS IqGw== X-Gm-Message-State: AOJu0YzHJgbbR4buXeO399NqkxfRHYPUsDmlMHy0AkaZa7uBKW5javPo eKcWAa2YBBKrlLYCsNLooYgwJw+K27Q8oOpJVAlZA2DJtEfTXkKK14csfwsaItU= X-Received: by 2002:adf:ef0f:0:b0:33a:ff6f:738b with SMTP id e15-20020adfef0f000000b0033aff6f738bmr1549739wro.0.1706713053691; Wed, 31 Jan 2024 06:57:33 -0800 (PST) Received: from lion.localdomain (host-92-17-96-232.as13285.net. [92.17.96.232]) by smtp.gmail.com with ESMTPSA id a15-20020a056000100f00b0033aee3bfac5sm7841912wrx.16.2024.01.31.06.57.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 31 Jan 2024 06:57:33 -0800 (PST) From: Caleb Connolly Date: Wed, 31 Jan 2024 14:57:28 +0000 Subject: [PATCH 3/5] usb: gadget: CDC ACM: call usb_gadget_initialize MIME-Version: 1.0 Message-Id: <20240131-b4-qcom-usb-v1-3-6438b2a2285e@linaro.org> References: <20240131-b4-qcom-usb-v1-0-6438b2a2285e@linaro.org> In-Reply-To: <20240131-b4-qcom-usb-v1-0-6438b2a2285e@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.13-dev-4bd13 X-Developer-Signature: v=1; a=openpgp-sha256; l=1002; i=caleb.connolly@linaro.org; h=from:subject:message-id; bh=lS+Go8qhhghurSb2Tis7/B7zPWyIt5NhDkSRFTEidn0=; b=owGbwMvMwCFYaeA6f6eBkTjjabUkhtRd8bduLpGdsJWTyfJk7rF1a+1rf58IUY0PtfURE5Rfu sdiccyZjlIWBkEOBlkxRRbxE8ssm9ZettfYvuACzBxWJpAhDFycAjCRnFkMfwWn5FgVH2zl3yK2 9L7z4sOfI4NqlAuUChRq3kzh7mHRyWJkaJie5x+pGSujueqA2cVFShcvLjOf6LJJgv/wVSHOtIZ eZQA= 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. Signed-off-by: Caleb Connolly Reviewed-by: Mattijs Korpershoek --- 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 @@ -623,12 +623,21 @@ 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 Jan 31 14:57:29 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Caleb Connolly X-Patchwork-Id: 768498 Delivered-To: patch@linaro.org Received: by 2002:adf:ee41:0:b0:33a:e5bd:fedd with SMTP id w1csp1899445wro; Wed, 31 Jan 2024 06:58:24 -0800 (PST) X-Google-Smtp-Source: AGHT+IGlmhocpkRwLR2vHJYRmRaeu8o9u42q0KEaj9131MTnoHiWVOvQl3xiRMdb7M1CIxWT7SJ6 X-Received: by 2002:a5d:634e:0:b0:339:2c1a:5d79 with SMTP id b14-20020a5d634e000000b003392c1a5d79mr1283631wrw.6.1706713103998; Wed, 31 Jan 2024 06:58:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1706713103; cv=none; d=google.com; s=arc-20160816; b=JX2vYuHdbNPgOBRxBYufVkJb4KA8w/rc+GtlKsTxlCWMtlsRz9f/lxiGEvGkTqbBxs mDuYcXemvp8dM9bvL/nmYUsSKqzmrbZkrR9xQbhN4YE5QtogkwWLHLfB5S0dzhp4LK7o RY1hHUll/Y1OJXBX9L+KYPItdNHjFzDTjdZSCOFo0Tus3B6PNDzNv9kstqHpS7ssWtRZ 5CKHsU3gl8x0N/Gana622zbh1gt+9+THPVWB/b2Wq2W+Znidc1R8jJxHGMtSMWAXpEC/ KP7gujoLOcKeEnZap6MpUtvax9uSecNZNAiKOivWByAAjdvcfSl+vI11cWtvxqXj2HG4 cILQ== 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=8TzL8X+5lR4qOCyPIyd5S6kwTUPgbwe5NPeMDbpXs1o=; fh=UJLfQHigVNNxRTyupVH3iuVYJLWMjRXGBkTXuIfaL+0=; b=fsfRzLSbk7jISiihrFtDvgZiK0AzaCl59wiNaNijM3PN7IbBsXBjfkZ+YHQwCCuTNE 0zup7acqJ2RessVGhhZE00eGxv1/U2yMJvr+jA7HzLbM5dTCZ9k5CAOVU2u/29h8cbA6 r9+ZPpyIMvEnYw6JaoPYmoqcSiEyqzOlPF9Vn1xGf4jaeyrava0Lrr3cbi6DruRdoPbA V7ZjqTghVfcA0+o2QY8qdGdDDPbX6w7F8KM6t+sPiRUA9/tv2ggFKBkN8IyiVHFxSM3S xOVvAc+QljaJBLoHqCsqUXfSlC8iG+aUpGa0nQWaLjHcj1qBOhs+RXrphqkLSevmQvgZ dxsg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ww9U7DS9; 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 x2-20020a5d4902000000b0033ae369c54csi5440548wrq.1081.2024.01.31.06.58.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 31 Jan 2024 06:58:23 -0800 (PST) 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=ww9U7DS9; 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 AECA987C26; Wed, 31 Jan 2024 15:57:42 +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="ww9U7DS9"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 7937787D82; Wed, 31 Jan 2024 15:57:41 +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-x132.google.com (mail-lf1-x132.google.com [IPv6:2a00:1450:4864:20::132]) (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 5B63F87D58 for ; Wed, 31 Jan 2024 15:57:35 +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-x132.google.com with SMTP id 2adb3069b0e04-5111c7d40deso2867231e87.1 for ; Wed, 31 Jan 2024 06:57:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1706713054; x=1707317854; 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=8TzL8X+5lR4qOCyPIyd5S6kwTUPgbwe5NPeMDbpXs1o=; b=ww9U7DS97NTCzShA4I62O6swdf9sumw39ChS5SX2Pda4MErxVJ2f7z8CsZ4UWTp4xW fqURr7kI1ImSF9cPReuaeVyiu5X3XRYAN7OBi5kxljQEXge4RuYtzhSyNEPkPRnXVxti RwwZ/YV7MPrihSlXulmZ/tC073hFXC/yrGnpZkoY257qHTbyejRNzOQxkr01/6mTy/bY 3G+U/ZsRIv21KaOJkRTTLfJ0ruUQS1lQ4HjcjAz22/AGM4/nZG2rkslaDPVx6LlyRPpc shu1kUxG8T+Jcj45U2bU+wjEGtzVjlV2PqvP74J2qozUucKkapC103BVistP2+Lp4Hpd OFOA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706713054; x=1707317854; 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=8TzL8X+5lR4qOCyPIyd5S6kwTUPgbwe5NPeMDbpXs1o=; b=OFnc0IVZ+jev7qzDFDTUbz4uhpTlZt9bwrt3vIZqQuHwDjVoPD/Es+Ka0K95R5hArz yMm8TrYA+6AV1v1+BGR4g48cFVR0HpIoEc+2DmWkVHgOG/CAwjT+5YsjVWEMzNLh7mWu 8YZIPL0T9R2MHaJvx5zVnVnmPpmp67AVsQusqszmOa/5wHd8TwNSLDEDIkYX7mvc5WAc T34hgzaDjRQF+GdKZMttjeIMpQB/WuEuh290EjyXgQr31vzgmI5DWlbBx69eNwLTlpKM zMlgt7LVNoKmsq/2+rzSkzTcq8RSSioYQtNXaOc6hekAs49UGzyklMHyOwoL2wkey/p8 X1bA== X-Gm-Message-State: AOJu0Yyt3JkNbNl4HMgmqEqJJU6XtXCUw5S7H7HhYexDFDbkyhvTEYgo EUAFh3DoNBok+Zs3d2Q8sh45xJczeWeZUE0X0IdIXBfrfaXEkfytCh8d0Lvi5V48JWsUGmpfFGr O X-Received: by 2002:a05:6512:1285:b0:511:1b89:1a38 with SMTP id u5-20020a056512128500b005111b891a38mr1709407lfs.50.1706713054545; Wed, 31 Jan 2024 06:57:34 -0800 (PST) Received: from lion.localdomain (host-92-17-96-232.as13285.net. [92.17.96.232]) by smtp.gmail.com with ESMTPSA id a15-20020a056000100f00b0033aee3bfac5sm7841912wrx.16.2024.01.31.06.57.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 31 Jan 2024 06:57:34 -0800 (PST) From: Caleb Connolly Date: Wed, 31 Jan 2024 14:57:29 +0000 Subject: [PATCH 4/5] usb: gadget: UMS: support multiple sector sizes MIME-Version: 1.0 Message-Id: <20240131-b4-qcom-usb-v1-4-6438b2a2285e@linaro.org> References: <20240131-b4-qcom-usb-v1-0-6438b2a2285e@linaro.org> In-Reply-To: <20240131-b4-qcom-usb-v1-0-6438b2a2285e@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.13-dev-4bd13 X-Developer-Signature: v=1; a=openpgp-sha256; l=11967; i=caleb.connolly@linaro.org; h=from:subject:message-id; bh=/WujLPYmE5UWbFS3pviSy8+44u4i4kWE7cEoSc+s+0w=; b=owGbwMvMwCFYaeA6f6eBkTjjabUkhtRd8bcmfcsT+vT7wP9nEneLjgven9Vnaplh/IHh70fHm uDTVSrOHaUsDIIcDLJiiiziJ5ZZNq29bK+xfcEFmDmsTCBDGLg4BWAiZ60Z/mkaHm1Z83FG/IYl Fou/KsStPuGzdOf1St73/OWpdz6sUu9lZFgw+82ThkdMB7IYLih/TBKXm2kooMXqsOlL8KpT8lO 3P1wEAA== 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. Signed-off-by: Caleb Connolly Reviewed-by: Mattijs Korpershoek --- 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 @@ -88,10 +88,6 @@ 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; 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 @@ -724,12 +724,13 @@ static int do_read(struct fsg_common *common) 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 (;;) { @@ -768,13 +769,13 @@ 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, @@ -787,7 +788,7 @@ static int do_read(struct fsg_common *common) } 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; @@ -861,7 +862,7 @@ 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; @@ -893,7 +894,7 @@ static int do_write(struct fsg_common *common) curlun->info_valid = 1; continue; } - amount -= (amount & 511); + amount -= (amount & (curlun->blksize - 1)); if (amount == 0) { /* Why were we were asked to transfer a @@ -942,12 +943,12 @@ static int do_write(struct fsg_common *common) /* 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, @@ -960,7 +961,7 @@ static int do_write(struct fsg_common *common) } 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; @@ -1034,8 +1035,8 @@ static int do_verify(struct fsg_common *common) 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 */ @@ -1058,12 +1059,12 @@ 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, @@ -1075,7 +1076,7 @@ static int do_verify(struct fsg_common *common) } 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; @@ -1183,7 +1184,7 @@ 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; } @@ -1370,7 +1371,7 @@ static int do_read_format_capacities(struct fsg_common *common, 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; } @@ -1781,6 +1782,16 @@ 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) { @@ -1865,30 +1876,30 @@ static int do_scsi_command(struct fsg_common *common) 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; @@ -1983,30 +1994,30 @@ static int do_scsi_command(struct fsg_common *common) 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; @@ -2497,7 +2508,7 @@ 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; } 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 @@ -269,6 +269,7 @@ struct device_attribute { int i; }; #define ETOOSMALL 525 #include +#include #include #include @@ -290,6 +291,8 @@ 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; }; @@ -566,7 +569,7 @@ static struct usb_gadget_strings fsg_stringtab = { */ 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; @@ -574,9 +577,12 @@ static int fsg_lun_open(struct fsg_lun *curlun, unsigned int num_sectors, 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 @@ -7,7 +7,6 @@ #ifndef __USB_MASS_STORAGE_H__ #define __USB_MASS_STORAGE_H__ -#define SECTOR_SIZE 0x200 #include #include From patchwork Wed Jan 31 14:57:30 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Caleb Connolly X-Patchwork-Id: 768499 Delivered-To: patch@linaro.org Received: by 2002:adf:ee41:0:b0:33a:e5bd:fedd with SMTP id w1csp1899524wro; Wed, 31 Jan 2024 06:58:35 -0800 (PST) X-Google-Smtp-Source: AGHT+IG4nyoPHYSHTfcS/n+Q96iPXn0OBtziEYKlc4p9MR6LGj1vdmDE7OzbnMmUuA9AwMWqiYCZ X-Received: by 2002:adf:e2c5:0:b0:33a:fe3b:b2ae with SMTP id d5-20020adfe2c5000000b0033afe3bb2aemr1217935wrj.66.1706713115572; Wed, 31 Jan 2024 06:58:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1706713115; cv=none; d=google.com; s=arc-20160816; b=GQQKCFDlpp+gIkhYdXEH4rq8167B4WmxaRFPuzNPkxGX26utioYokYS1UitsXxaA63 m0muu74P4kBUCgVzeIqVR+3gOQzEQnYMWdoeaHvmmncewazCr40wAhFg3FcBsDUT8dVq WhjL8sZN108RgyIt0TtKM+6BPRhTReUgfh4XrhdPOxCw0BscgcG9kGO9CmAc/kJmTvqp VLGsyKPXaeI3umnLhfh5T0H47YHHbTMXbcFrGaMBlL5dWdTklqyzeUi6K1BzBvAp3rMv TQ6uBOgfSB7G3TQJq+pthA99WchU7zmXn/fzPHl2wDI37fICCxienLkm01UT1rSSLEQ9 DEwQ== 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=ocX4wCRr/xKYsymt+/N2xCve0tHPW0XjSRi3+zxaAuI=; fh=UJLfQHigVNNxRTyupVH3iuVYJLWMjRXGBkTXuIfaL+0=; b=jEXQNJsprTJG4i04x58boKEV+J+zAo6ta1aHxLWO1XJYmZK0D1WibFdyFsEwfv6L2L weAD3pj59OuYHYXynsjExKifgfX/RnFPV/Cdw78byWofa7HUKZc93dzg0Vhm2LZ+BTIe B21QF0UxjnJFVPGZwtDx/mTkyKLy7YZU4lwhBOkDAHohAl4awq7nyOmbJdVLpc6eIZ1f UUTP+evtye84RjaxFQJPdSm8Nm1nC39fm2Ra4IAnENSfRmriIuUutwY/wDpyv1WHGktD 01TCoFsUSF1qdUQpcgRdsKYJTIOwsoO5yg3gB/LN7BZQZMdSm0haxJ/JL8Q0bfof3BfT xbMg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=nVokPC+y; 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 o1-20020a05600002c100b0033ae0ae2456si6230813wry.381.2024.01.31.06.58.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 31 Jan 2024 06:58:35 -0800 (PST) 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=nVokPC+y; 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 2E88887C38; Wed, 31 Jan 2024 15:57:46 +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="nVokPC+y"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 6560987D7E; Wed, 31 Jan 2024 15:57:42 +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-x32f.google.com (mail-wm1-x32f.google.com [IPv6:2a00:1450:4864:20::32f]) (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 E500C87D7A for ; Wed, 31 Jan 2024 15:57:35 +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-x32f.google.com with SMTP id 5b1f17b1804b1-40e913e3f03so55255605e9.3 for ; Wed, 31 Jan 2024 06:57:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1706713055; x=1707317855; 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=ocX4wCRr/xKYsymt+/N2xCve0tHPW0XjSRi3+zxaAuI=; b=nVokPC+ywQCO16nbSrgOl3rqCCrlFNz2h9pGbPx29IyKs9T/ATIoNczCwBO8/eeTP9 VjAqKi2oQZZsa8ahyuMDIL2vwiyefLUTZPB5hRxpI581QpnoVmL2ehps5aNkiKVtsUb9 PGxtTSoUPbrbjiHKU9JQG2EhZcssu0HeyC91mKoT8Z51G0P9rIk18CJBviETDjIZWxq2 WBrJTpihz/cfxy4fBOH/MRRZa5uMRDcScL26YsvHyXsEPh6BUDDuXORWW0NYNbyalLuz 1/cN4EsG5gkA44/m03BMyz1FedJgDd0PkOIMXGu47Z16PLVQPokTv88CcoczLoTMgn2P 8R9A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706713055; x=1707317855; 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=ocX4wCRr/xKYsymt+/N2xCve0tHPW0XjSRi3+zxaAuI=; b=XawCa2fCRvQWIZ2XLrxJzcsZqwU2MuRdvpuPayrassrrcXVDTc39w55pPYhmInszF8 gAv0py5aHorYuQik7IvxtJ0SGfUIAz/HM9uUvGVzYdLZCG5hM9PJ8A8RTZ+W8yhjzsZT 2VnNUqPvDj3nktLhLGzRuSMCenIRYQ/W5V6w2u+/VZ9DecWpzGsR/Zlvgd+JMT+nfy1e A1Invam9kaD3okqCLBUqH1N/2sFGy/VQRwAMMrfSsYjw7s1P6nL2Sy7dg3kwWOAYkr3j cSPY3pe6o6nGntetstMZQCquVU9DRIkLYuG11to1qny1+KgvlgQ+RRzILR171MVQIMEr 4XUw== X-Gm-Message-State: AOJu0YwEC5YjQAlF22P4Jsm3AfCuxydR724uBA6dcG4z9d9NaCaKWYwE 9h3uLfLG2Gf2qrmlQLXVw5/Fur7zZXUAvvmUdmNpRvgmGd/7u1TDksWDhS9uCSw= X-Received: by 2002:a05:600c:241:b0:40e:a7cf:10e0 with SMTP id 1-20020a05600c024100b0040ea7cf10e0mr1696622wmj.20.1706713055472; Wed, 31 Jan 2024 06:57:35 -0800 (PST) Received: from lion.localdomain (host-92-17-96-232.as13285.net. [92.17.96.232]) by smtp.gmail.com with ESMTPSA id a15-20020a056000100f00b0033aee3bfac5sm7841912wrx.16.2024.01.31.06.57.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 31 Jan 2024 06:57:34 -0800 (PST) From: Caleb Connolly Date: Wed, 31 Jan 2024 14:57:30 +0000 Subject: [PATCH 5/5] iommu: qcom-smmu: fix debugging MIME-Version: 1.0 Message-Id: <20240131-b4-qcom-usb-v1-5-6438b2a2285e@linaro.org> References: <20240131-b4-qcom-usb-v1-0-6438b2a2285e@linaro.org> In-Reply-To: <20240131-b4-qcom-usb-v1-0-6438b2a2285e@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.13-dev-4bd13 X-Developer-Signature: v=1; a=openpgp-sha256; l=724; i=caleb.connolly@linaro.org; h=from:subject:message-id; bh=Mq4dbCoqOMRKge7c77AI6tE+8zvp4+6gdSSpmZvsAPY=; b=owGbwMvMwCFYaeA6f6eBkTjjabUkhtRd8bfOruUuWrN/+r+IzE9P1p1JC7Z1lY3xOpdiNmnW9 XUWQj4pHaUsDIIcDLJiiiziJ5ZZNq29bK+xfcEFmDmsTCBDGLg4BWAiv6cy/GTUEl/dtrIvR53n 4Iy7j9N1uwRahdb9nzh9C/929l8yJ/4z/I/f5XbsX9P5gk7xzo/f97CdNvAUtpje/TfZfglP6K1 NsoEA 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. Signed-off-by: Caleb Connolly Reviewed-by: Mattijs Korpershoek --- 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 @@ -319,7 +319,7 @@ static int qcom_smmu_connect(struct udevice *dev) } #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;