From patchwork Tue Mar 19 12:14:24 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Caleb Connolly X-Patchwork-Id: 781077 Delivered-To: patch@linaro.org Received: by 2002:a5d:46c1:0:b0:33e:7753:30bd with SMTP id g1csp1892201wrs; Tue, 19 Mar 2024 05:14:56 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUYL6XhdVby7CznaMwLZpo3HUEVw0QSAHo/K7Oijsp8nBnAGf9LaN/MBcIvi6H32J6Qk206UeXIwQNyCWIcA3FH X-Google-Smtp-Source: AGHT+IE2TLEHNNsnU56valmCGbs4CHc1BNyZsV4DQgf7IW+UY6q00syBLHT6hiweikgkVJgVMhmP X-Received: by 2002:a05:600c:46d0:b0:413:feb4:d76c with SMTP id q16-20020a05600c46d000b00413feb4d76cmr10640104wmo.20.1710850496148; Tue, 19 Mar 2024 05:14:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1710850496; cv=none; d=google.com; s=arc-20160816; b=fSTND0BN8HjzWz/OP2cyiiulagL/U3nxp/6HRqqdjIP+1D1z8OJdiQfc2nfk5Ge9HO kMKjIbIYyWxzhSB+ARTw+vJ++Xrem3pZek0DL9CpGU0ucF4B3YCovUsKpiYd8b3VXnMO lt8SJ/xKstYfqpVlhMNRvPRGQWGGS7sVf0qLXmMwM3eJoMnMgYPJdS3NZ9P7FSMtvWb9 MNsW7C4fsihTAmCySOpIs6Y8lKME185ygIXaCC5IlBlZBxG4M9o9yQh7MWBqY+ShblxJ hWvJkRj3Of1tO2TDk3V6fE9mzSu4TELcWpHWAt72HpOCqKsqp+rRCJHCxdvozfKiaGXx 2+yw== 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=IfzPwLOX3gt0THn+CH2zX4p2cqGEx8YFAQy2omwRDQY=; fh=UJLfQHigVNNxRTyupVH3iuVYJLWMjRXGBkTXuIfaL+0=; b=Cq3exuND/IuN8oGKX+8k9UKZvYS3wW9NIkFfIYHaLcWuiuzLrI7g7qI2qrJIHUCRXi yYO0KxxuZVKObnUrAjjMVTXE3DwYJKH+5tArVa5EAnwF5fK3GBXVoi55+2Uka3pthfUe UtNPoBZVBwGT57uogqQ7FPE6okNoO+Z0VdOHVxxhnd/Dkb63z49cWoPJ0AGJotnlTrRo 7mUyADdBRc46Ca77H2qEbfXawij1fP7y/3OvKyqgK6XfzTyw5X8TrKf7pjvFjugEm4ND xls/WtsjaD0Cj1UxDjIG0y1sPuZKyM/xNRu0RxU1AjfxEccic+8hwmNwUdt7rmbApXEg SYtw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=TWgpa72j; 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 18-20020a05600c22d200b00414092b2172si3644063wmg.118.2024.03.19.05.14.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Mar 2024 05:14:56 -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=TWgpa72j; 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 4361288044; Tue, 19 Mar 2024 13:14:47 +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="TWgpa72j"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 0F1E487F88; Tue, 19 Mar 2024 13:14:46 +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-lf1-x12a.google.com (mail-lf1-x12a.google.com [IPv6:2a00:1450:4864:20::12a]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 25DD187F8C for ; Tue, 19 Mar 2024 13:14: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=caleb.connolly@linaro.org Received: by mail-lf1-x12a.google.com with SMTP id 2adb3069b0e04-513e25afabaso2875007e87.2 for ; Tue, 19 Mar 2024 05:14:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1710850481; x=1711455281; 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=IfzPwLOX3gt0THn+CH2zX4p2cqGEx8YFAQy2omwRDQY=; b=TWgpa72jSDN+Yk+JoK40kKIsnEOVAsMIUNC40I2dwdSTo5m3Ngmd+huyvpyaFDwogi Yx5dB3IjQrbDpIZ3aNxjwjEQapakQ2snJcS//Vu1sQsriBgXYEC5Yy+L1L4/igcFasUf UBYL7HuGujwhkGjwL0N5+33zrQF0yfhuug/aVAu/du6dJL3MdkSnHrwTvE4MOpJFEtMh oktMALJOVZPt0aL9eUgtDXiQdL3BtgXjIiUekAEGnoNPWfbjwi+qYBKqMJSHADkzDzrb fwLzo21Nhxsc7INdc8Jr7cAQLPa5T2F7VViUA2/JIBwicDSoCLuiNSeHj65+iu35tbvK WlwQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710850481; x=1711455281; 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=IfzPwLOX3gt0THn+CH2zX4p2cqGEx8YFAQy2omwRDQY=; b=Xsa8osaAnpOa0Oll4Qz1WUQKWsY8q8CdvUiEfeYpyOfb/lUi+pe+bgfhqzGjA9Ufln XLjUDmapEtcJfeIC2yWejgaf/eVOG6kqtYJnFug7++njMr2Or7gz2z5E0cNCI3Xwy9rj nCmFdxb4GmiBckoRoGot1PaIZu6aeNAamMJe1D3Eux/SVPnzN4Wjru7+zUKxttl5a6Cr 4K99bmnNp9kt2nJaWyUM/aQ037zs2KYbUme8JYnztWtfKDU95JopS/OjaFt4QbS3SBd7 rx/Cqi09KmC6pe5H0rFERBKeluLHnWlLmiLmq4867CcSl0LgrbvUxRyLqDtTtsEKBbXE iNMw== X-Gm-Message-State: AOJu0Yx6Fra10Ule7msuNAo0mDe002ORk7esADi/MnydN4ajtDmIBBDp cMjefq9hjAK2lKxU6Wp4Emr7+DsobRmGJlVlzBBlpI8OG3YKnabisLlHugBwoVOOSAgnRyPwUwV e X-Received: by 2002:a2e:3c18:0:b0:2d4:5321:9daf with SMTP id j24-20020a2e3c18000000b002d453219dafmr8692281lja.44.1710850481335; Tue, 19 Mar 2024 05:14:41 -0700 (PDT) Received: from lion.localdomain (host-92-17-96-232.as13285.net. [92.17.96.232]) by smtp.gmail.com with ESMTPSA id u8-20020a5d4688000000b0033e3c4e600asm12345792wrq.7.2024.03.19.05.14.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Mar 2024 05:14:40 -0700 (PDT) From: Caleb Connolly Date: Tue, 19 Mar 2024 12:14:24 +0000 Subject: [PATCH v3 1/5] usb: dwc3-generic: implement Qualcomm wrapper MIME-Version: 1.0 Message-Id: <20240319-b4-qcom-usb-v3-1-09ba1f86d259@linaro.org> References: <20240319-b4-qcom-usb-v3-0-09ba1f86d259@linaro.org> In-Reply-To: <20240319-b4-qcom-usb-v3-0-09ba1f86d259@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=4313; i=caleb.connolly@linaro.org; h=from:subject:message-id; bh=Zb3uEMmWe4RzGwHrxJVrzpQg4bHURtPcRw4NigykBUc=; b=owGbwMvMwCFYaeA6f6eBkTjjabUkhtSfjev+vQ9csMxvVurc2Z9q33+8eTL1wqontTU+f9LZF yz54Mowr6OUhUGQg0FWTJFF/MQyy6a1l+01ti+4ADOHlQlkCAMXpwBMpKma4Z+uvNSuv7yxH5zN klx2+h64yc3PyDZ5muG52VW6P+4prlvPyLDt047as/13hfmjxC9lC5v2XjHcHqnesPXOtNkByff nbFsMAA== 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..36b6c5306d64 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 = (void __iomem *)glue->regs; + if (IS_ERR_OR_NULL(qscratch_base)) { + log_err("%s: Invalid qscratch base address\n", dev->name); + return; + } + + if (dev_read_bool(dev, "qcom,select-utmi-as-pipe-clk")) + dwc3_qcom_select_utmi_clk(qscratch_base); + + if (mode != USB_DR_MODE_HOST) + dwc3_qcom_vbus_override_enable(qscratch_base, true); +} + +struct dwc3_glue_ops qcom_ops = { + .glue_configure = dwc3_qcom_glue_configure, +}; + static int dwc3_rk_glue_get_ctrl_dev(struct udevice *dev, ofnode *node) { *node = dev_ofnode(dev); if (!ofnode_valid(*node)) @@ -511,8 +582,16 @@ static int dwc3_glue_reset_init(struct udevice *dev, return 0; else if (ret) return ret; + if (device_is_compatible(dev, "qcom,dwc3")) { + reset_assert_bulk(&glue->resets); + /* We should wait at least 6 sleep clock cycles, that's + * (6 / 32764) * 1000000 ~= 200us. But some platforms + * have slower sleep clocks so we'll play it safe. + */ + udelay(500); + } ret = reset_deassert_bulk(&glue->resets); if (ret) { reset_release_bulk(&glue->resets); return ret; @@ -628,9 +707,9 @@ static const struct udevice_id dwc3_glue_ids[] = { { .compatible = "rockchip,rk3328-dwc3", .data = (ulong)&rk_ops }, { .compatible = "rockchip,rk3399-dwc3" }, { .compatible = "rockchip,rk3568-dwc3", .data = (ulong)&rk_ops }, { .compatible = "rockchip,rk3588-dwc3", .data = (ulong)&rk_ops }, - { .compatible = "qcom,dwc3" }, + { .compatible = "qcom,dwc3", .data = (ulong)&qcom_ops }, { .compatible = "fsl,imx8mp-dwc3", .data = (ulong)&imx8mp_ops }, { .compatible = "fsl,imx8mq-dwc3" }, { .compatible = "intel,tangier-dwc3" }, { } From patchwork Tue Mar 19 12:14:25 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Caleb Connolly X-Patchwork-Id: 781076 Delivered-To: patch@linaro.org Received: by 2002:a5d:46c1:0:b0:33e:7753:30bd with SMTP id g1csp1892154wrs; Tue, 19 Mar 2024 05:14:49 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWqTa1IJ6ZKh8CkpDSHV6J6oyYGsXFPKisCqF3U61SZdth5N8eHE3fsw+NXlpRfsdZO7q5p6BYX8qjxpMnj60yw X-Google-Smtp-Source: AGHT+IH3jR+X4dgYU5uKAUoVOJvDM/ZZnKAIKP3cQfUzsMMHkXvYPpqCmAp40WcY4dJfqcs8c/4u X-Received: by 2002:a05:600c:4999:b0:413:ef5b:e4f3 with SMTP id h25-20020a05600c499900b00413ef5be4f3mr1812633wmp.13.1710850488805; Tue, 19 Mar 2024 05:14:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1710850488; cv=none; d=google.com; s=arc-20160816; b=FidLi/sUtaup5iyIfyrFgXmlCr4YEQ4TgNAg2do/etWHrKcZoERstCaCMTJQgJYNNP Geyn1uCVCSLq39J2ahOmRlegW96g3TmHdDLLwexoMDhONkQF6vBBtoWla1KLQ9K+5SNm CLnkRNgheYODua/BSgVXcaEZvAM5eoG4DPsNP89Lw3lXFDZmpU0NlEqqzUZ2B8acjyJK KG0x+P8sCn2brh/X178ufcPV4EK+AMAtTIzLHw9sp/7dXjPbsBaE05jBlmrs5Qms93CU cRYQb+dUXZQswQbMPLIFcxGPi9QzzWXtYqBSNyoW4zJ/E0zERGNusXVbe49XkLFZzsvJ WQ6Q== 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=S0Ea37R4n7fhERQy1yK5BNaAgaebTEOJUQoPj9IXZyy68yuq9WcnQkwO+/J0+os0Pg 94PC6yTSzBaZFxRqFYQEaSwukdK6eU/eTwNBh9Zlfr/WU7QFAHi/BURTFdtP0fQ1HknC sEUje7z42rPeduMIHRxW+XZd9UjIeQ2bxb/U14dagHjjczpCIb5QJcpOpa04ilIuuzQ8 IQyG87nwVgwQqo6cSKFXrSYwn/KugDLZTqkIYyA5T/s+rafIEi4vRbAHpM3CIIzTsKi0 QfXmL7xfFvCBh1TPNpJPzCapXpvQTvcRop2ubtNCWq0sOrv+8qXXy22+AdgcvP7MnDZb qLEg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="W2/XgfLl"; 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 f10-20020a05600c4e8a00b00412b2710fd3si7901694wmq.103.2024.03.19.05.14.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Mar 2024 05:14:48 -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="W2/XgfLl"; 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 CB15C87FF1; Tue, 19 Mar 2024 13:14: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="W2/XgfLl"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id EFF8F8802B; Tue, 19 Mar 2024 13:14:45 +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-x42b.google.com (mail-wr1-x42b.google.com [IPv6:2a00:1450:4864:20::42b]) (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 54FFD87FF1 for ; Tue, 19 Mar 2024 13:14:43 +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-x42b.google.com with SMTP id ffacd0b85a97d-33ec7e1d542so2988458f8f.1 for ; Tue, 19 Mar 2024 05:14:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1710850482; x=1711455282; 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=W2/XgfLl7jQ9ZJJYpAOg+StAtyqDuKrk6+1HMIZW43xvaTmZcdVJi2m/m/SDuV7ZuV PmkBNR9F5yDS1EnFfSl6V1a81ad1ZZDG2g9UZAdO/2ElxJbvk7R5VrkC0oo5obT91wnP HZfB3cIrHbtYdT7C20OupLCmSeGo1h/1Z1EB6HgRfdVb/Q6sSJfS7BSuhndqrhZSDgQ4 uzxV9NHJf4HDOglDLnreQHHzLw4Nlu2fsOUCwQdyjljy9RHSPGEzqMzi7WJ8gEBx4bfq sPWdfLaTCyhiizdnf8+cnIXdJCZdKU7wJjguYPWyHlPdQAn+c9wwLUUF06ra5IoIAfE+ R+2A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710850482; x=1711455282; 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=BWmyQ2lczoTg2qnOLNpxey++Xe0xKpnARTCqC9XKN91fU0whwBqeq0hmt3jFQiC2CP LB2u3bMlUVN94AOqbjHNkS0dNnNAgEWH7PklkpZb/jLDGnW6s+Afg9RSBiLazuVLVBfE yHD1hjFgWFM5UYR8hHcyfEcMrf0RQL9g94hwvdev4txcV7NmlBnFrHV65ph5GVTWuA1Z 4iX4ZFBYorc8R+wLzf0R8iHIGvxfqqhH2PontUFqqLDAaXtiJyC4pB9yHO2fohMQpCqD ZwP64Gto/xDnwdV1D4amkrpUx99+V37IVQNlLJgwQ3ZE8Hopug2E7+t306Mp7LCdLOX7 0Egg== X-Gm-Message-State: AOJu0YxvR1JrTtB8lfSS6hc6eQCfdv2qD/sG4Ll0hZA4HNh/UWdHMjxz kauFCGxt96RMM9jDSrqAK8DXD6/4wm8qyu6f4PkPEHPUc6+RIIN92Xz+fQPhEEA= X-Received: by 2002:a5d:5f94:0:b0:33e:6760:6def with SMTP id dr20-20020a5d5f94000000b0033e67606defmr2177774wrb.56.1710850482573; Tue, 19 Mar 2024 05:14:42 -0700 (PDT) Received: from lion.localdomain (host-92-17-96-232.as13285.net. [92.17.96.232]) by smtp.gmail.com with ESMTPSA id u8-20020a5d4688000000b0033e3c4e600asm12345792wrq.7.2024.03.19.05.14.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Mar 2024 05:14:41 -0700 (PDT) From: Caleb Connolly Date: Tue, 19 Mar 2024 12:14:25 +0000 Subject: [PATCH v3 2/5] usb: dwc3: select DM_USB_GADGET MIME-Version: 1.0 Message-Id: <20240319-b4-qcom-usb-v3-2-09ba1f86d259@linaro.org> References: <20240319-b4-qcom-usb-v3-0-09ba1f86d259@linaro.org> In-Reply-To: <20240319-b4-qcom-usb-v3-0-09ba1f86d259@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=owGbwMvMwCFYaeA6f6eBkTjjabUkhtSfjes/fG4s8+lW3hjNX9S3e6HTk4p8+86psbyxORvWb mfd8uhyRykLgyAHg6yYIov4iWWWTWsv22tsX3ABZg4rE8gQBi5OAZhI6UyG/3FiwoaSDn5zdEI/ sn6Y6H7kyV9W4yMuIQsEL8YYVTrty2H4Z/H3q/zlupTLjJtt/68zY+3r8a7U+zrffnPvqeTfbNl TcgA= 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 Tue Mar 19 12:14: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: 781079 Delivered-To: patch@linaro.org Received: by 2002:a5d:46c1:0:b0:33e:7753:30bd with SMTP id g1csp1892411wrs; Tue, 19 Mar 2024 05:15:18 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCX9PsIdvf0pDhlL/c5zEXRZtfe3/x7un6ns9lx8absaY27FjZfBspt3R7ajppnWLw1GTi6TzilHVck9llwdF1a3 X-Google-Smtp-Source: AGHT+IFEUi5IbLsJdD71VFl/RAQLEMLfIkHvIp5cMIHNMPg2mxcoReDZFTU2aI5483AjV7BVrn1Y X-Received: by 2002:adf:ca83:0:b0:33e:c4c0:4784 with SMTP id r3-20020adfca83000000b0033ec4c04784mr10807831wrh.25.1710850517899; Tue, 19 Mar 2024 05:15:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1710850517; cv=none; d=google.com; s=arc-20160816; b=LykqT5yH8+4GPTTSrqeGaNOsMIKcFJbTCTJXk76BGrjgyUR1mu3lKeafgZM8Y+C4op voryH3ldtSgJWgH81dxMfIQd0HLkSgvJur0tzhFENa+Hyar3JQAnuDa5+aVjmUYwyHG6 MZg0e/SHOUCJbVD5BCQBA7ZFALRD+yE10KdD5xBp8Hbe6TMt2X7E7Vw4hx509UMWbQGr VsDHWvb3KOTI+FcbNOmlxFSh6hrMiIvRk5PmeRw67D539kHXMYNsDrOoJR8R25X1hzU0 I9MiBPBxe3ZyHtwywwnIVhfAMlIJUSibmP4p0h2cGxmOkBL30ohjLA+SDSqJK72DImvJ b1Gg== 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=FY9QGXIHUjUwqJuzkbssdsDDOPXqlzrU5tjnQGdINEMbA1kUtOvJrewaRbMfBtTba/ KFGgb1PSa8YSVAx8ccURo4rYCBateH+w/I4vuVPGYZnQwf3W4GMjse6zzSLeH/H0R327 0hsyRaaXBRXiMZ9g06aL8s54CSkBkSZHkbizwZdubQYDMGokQrkmoAC7wdvqBmPqqtW4 CFE+UJGYZ3Xn250oltRYcuAwkkijolXCJYOSbI0Dml9JErK+RqKNIF9F6gP3W1+y2lC0 VX52wqxwglcuLt5srtYFxy/LMINJBOUmJJMLUK+BYw8rYdXfvgVR1kYk6Ygn0iqUcvIe xqig==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="zHf2M/Qa"; 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 g5-20020adff405000000b0033e73297addsi5721998wro.758.2024.03.19.05.15.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Mar 2024 05:15:17 -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="zHf2M/Qa"; 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 37F3D8800F; Tue, 19 Mar 2024 13:14:49 +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="zHf2M/Qa"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id E91C287FFA; Tue, 19 Mar 2024 13:14:47 +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 288BE87F6F for ; Tue, 19 Mar 2024 13:14:44 +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-33ff53528ceso1791121f8f.0 for ; Tue, 19 Mar 2024 05:14:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1710850483; x=1711455283; 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=zHf2M/QaINfBAmxJHqdrJXbgAuXxplFARvQZSiGk70sZSCHpokFtdghTo0dWaxaWuB qkNgpAYYGIXkIitVBSvXKLMDHqSJyE7d+lEjDJQ/GCDyRJ+ZQK+m3OOPEFUcHs0YlXfT sIXK5xLBbDrtPDpFeUJkMLtsTnbFuhvCgco5zUeqdQFyUdt9kyOFjdEE/sYhkzF24Pmg xqbyLt+IYLOPQw3ovwtupFG7iMJ1c6uZAzMqLcn5SRxC9mU3PlraXjgwn50hMZz5HvaG 5+dmQL5YxnDw8d+ukkiKgcLs+wfGt0mYd2KMN8Dxu/4PDZrAoZ6TwbqkeWPwGAN5Koze Ujyw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710850483; x=1711455283; 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=X/5SCE+YKJOirNwA3/f09fx9quZW+d6lYGU9TacXX5f8FwqAQT7VQF729Y8CULa+iv +k2VOMt6XbKvIJI1Br6UCPoDfs/GRzahk4UPSd7hbzCFyVnn5WSQMvfXcU75gvzjxs+c 4QqYVKAVzOgRjmCHrpf9nCpCLIZvRiNBV9vYhp+/40sF2Cmv0PyDkOTLrgFbucu0d2FV CVr1bwqfSjt3Vx9ecTidOsTNLkK9k6toPKhI+k/I1zvSJJdc0SMpjoxqXrL5EfZFGQPJ K5r9oDIxlPUDGmTju8LRp0Ch7KkxhaupRVGE4+ueudWTVCt9Tdp4tWs3nnJrsDvGHh7S +MTA== X-Gm-Message-State: AOJu0Yyt+GUNWA+RqjiEQ0WfFSiEOM2jdmXcofPpWJ8OvjoSDH3MLtTn 70UMCp6D62QocwAuhll1O6qVX5dcuxUiMjt4i/GQi1GVS6GZ+rT8RuAer1Ovh0E= X-Received: by 2002:a5d:6582:0:b0:33e:7c9a:9368 with SMTP id q2-20020a5d6582000000b0033e7c9a9368mr9591324wru.63.1710850483658; Tue, 19 Mar 2024 05:14:43 -0700 (PDT) Received: from lion.localdomain (host-92-17-96-232.as13285.net. [92.17.96.232]) by smtp.gmail.com with ESMTPSA id u8-20020a5d4688000000b0033e3c4e600asm12345792wrq.7.2024.03.19.05.14.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Mar 2024 05:14:42 -0700 (PDT) From: Caleb Connolly Date: Tue, 19 Mar 2024 12:14:26 +0000 Subject: [PATCH v3 3/5] usb: gadget: CDC ACM: call usb_gadget_initialize MIME-Version: 1.0 Message-Id: <20240319-b4-qcom-usb-v3-3-09ba1f86d259@linaro.org> References: <20240319-b4-qcom-usb-v3-0-09ba1f86d259@linaro.org> In-Reply-To: <20240319-b4-qcom-usb-v3-0-09ba1f86d259@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=owGbwMvMwCFYaeA6f6eBkTjjabUkhtSfjevPVn+P4tgmbj/nndu20tmxdQmz7wivffJtrjarx /xtDSEyHaUsDIIcDLJiiiziJ5ZZNq29bK+xfcEFmDmsTCBDGLg4BWAi6Z8Y/kf8O3Dwxdr4bbUd kl4HBM72v0+dlak0Z8sjniVW6b1LeYIZ/orp/SnjtZh8Q9xlxa2zi1UYl25dXOnw8iD357ktJ2o /NqwDAA== 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 Tue Mar 19 12:14: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: 781080 Delivered-To: patch@linaro.org Received: by 2002:a5d:46c1:0:b0:33e:7753:30bd with SMTP id g1csp1892537wrs; Tue, 19 Mar 2024 05:15:34 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWqNeXVp7kzm8kGdcav+ng6wKYJiQAv04ZxPancMQZlNVnxFHPUOwxIHooUowcKjH+SHeI70iF1SIPUJYvtfIQv X-Google-Smtp-Source: AGHT+IEdo6aGRPL55V9GRAeZxkqTn8jOg9iVZNCb30kUwJPBXYIMtuixXM4QhErGGJhrALOcw/Lh X-Received: by 2002:a05:6000:188b:b0:341:715e:36d4 with SMTP id a11-20020a056000188b00b00341715e36d4mr4904665wri.29.1710850534511; Tue, 19 Mar 2024 05:15:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1710850534; cv=none; d=google.com; s=arc-20160816; b=f6DISrW3YBptAt9yF3XeW7aKO67g8fGp5tTWsg/umUKtiG5TXTVCkcJN6b80O87ttD Om+ol7SRG485kn2nwq3GhhkQNsFrDEx2f1WuE8lQFEUjPObQyOly5jhbI1ewYIaDJpuF N2p8EuwZbtapJUZfjpWOGHEe1a6YUshJshxnb1RthFAY+ZXEKi0MwCM93CGVmuDn7XmI IQcdG3j7O71l0CrcjZKUz56/Re6bzJCECRMia8AVOq18WQZMpSwM9eshZ6zipC3OHJe1 EivnuHE8G7KM+6zMmAK3Qf8jzh3B4UjcUKPvdvxvkhsOP28WkxkH2K6JjotdQLSWzkBl n13g== 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=V0fftbPXwKjf/+aKyIFnRbFGPl2CzSRUIQIGSfCBEemjpCGJrxC9F1vze/bNVKCrar jzYg//Qd/q1f6EO9hw8ZkTzspbLu10lWWye43jCMNompLBcuLDJ1+ghhi/Hj9yeYAOmI E0XAlJQRm61J3aB0yt2s4DFfU8JBGfpLCxCABeQlX/qNVCozbrsvgdzV65Bt94gX8vdT LtLt60Cu9yn6rQD98Bm4U0ObYSkUr0vr/B5ttmwifm0moL1KCRyUGNKSAr8shWVj/kcV H6QpkkObX+ohkyxEnEKMX9wx+CorqxtknckElHTuwNKSGqi17rg50e5S9pFGHLiGbVpG 1Fkg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=c+RfnrSK; 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 p3-20020adfce03000000b0033ec0e555c6si5743488wrn.518.2024.03.19.05.15.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Mar 2024 05:15:34 -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=c+RfnrSK; 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 A2ED38803E; Tue, 19 Mar 2024 13:14:51 +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="c+RfnrSK"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 1E4A187F30; Tue, 19 Mar 2024 13:14:50 +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-x32d.google.com (mail-wm1-x32d.google.com [IPv6:2a00:1450:4864:20::32d]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 8C01288018 for ; Tue, 19 Mar 2024 13:14:45 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=caleb.connolly@linaro.org Received: by mail-wm1-x32d.google.com with SMTP id 5b1f17b1804b1-413f4cb646dso35822445e9.1 for ; Tue, 19 Mar 2024 05:14:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1710850485; x=1711455285; 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=c+RfnrSK9q6IsCKLXMskyEmD6cslV8xEnvjrqPPY2ufgQPtZJMsHvk849K2865mfyI 0hA8EbqC+gNGHQFhH/bznT3N0yBO/94HC46baKx5LhRT8isRJM3E8zxukw/XH13ULeGV OEVm87sbbrm6BwdlrI3GGUCEIL/qTyUMVGK0CHcdjzhKy1mwRHAiSDW2pora0DoawFA0 cAqzHLtTYYuRVPSaqxWATdaJfRoqaRNuKKDpzyj8KSaF8shPg+AinF8FgdwDK5bU/ygz 597ur2IVrL0HBkm016XtgPklEm5Tzl2J2hqKkcE7JaROip1KtbQ+dTqC4xVUQYOPzl+3 gTMg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710850485; x=1711455285; 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=JpBnokPNx+d7W5MVREmgHzDhtIcojmRD4Jkx0cviIYp4ymY3Eavon9NCbOJkuSoKts Bd/N2AgZOhGhzmrsfiwYVKC+QFv1uYfJMa42iaq5RH5+iTAPePNC8n+n3bzQaZukpu/V p86BpjsiIa2qf8t7A2vvmfT56qhi6P1ffcYkq7fEACEevMS7rq2VBG8xWvjGlW7h4Fwb 1yoaiSFyNRxNk7uBrtTTImAqLs9cpZ91ncsh2KAuhQf3vTDuJmG/93Og5FKh4MU+iAmZ 8/T+M5XYGgvNmidSqXwrx3LaatVxC6nFA7MffetnEQd8jWwHqr3sQWGsdGuean33t4sY exOg== X-Gm-Message-State: AOJu0Yz9EDtolZEbp5CmZGLu/18glKJHLohJ0Z81tz0mZW2V3Dxj2Nhf XYrv1WB3Qg6IJr0+bKZzWaBaXuzwucLdfA0P1UGJ05PLIi5w4tGr6nKmPk8Ycd0= X-Received: by 2002:a05:6000:225:b0:341:9055:49b1 with SMTP id l5-20020a056000022500b00341905549b1mr75296wrz.46.1710850484930; Tue, 19 Mar 2024 05:14:44 -0700 (PDT) Received: from lion.localdomain (host-92-17-96-232.as13285.net. [92.17.96.232]) by smtp.gmail.com with ESMTPSA id u8-20020a5d4688000000b0033e3c4e600asm12345792wrq.7.2024.03.19.05.14.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Mar 2024 05:14:44 -0700 (PDT) From: Caleb Connolly Date: Tue, 19 Mar 2024 12:14:27 +0000 Subject: [PATCH v3 4/5] usb: gadget: UMS: support multiple sector sizes MIME-Version: 1.0 Message-Id: <20240319-b4-qcom-usb-v3-4-09ba1f86d259@linaro.org> References: <20240319-b4-qcom-usb-v3-0-09ba1f86d259@linaro.org> In-Reply-To: <20240319-b4-qcom-usb-v3-0-09ba1f86d259@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=owGbwMvMwCFYaeA6f6eBkTjjabUkhtSfjes3nkv5OimndNs141CVXXv3xPOdmLBMwES75uvq6 ATxZddCO0pZGAQ5GGTFFFnETyyzbFp72V5j+4ILMHNYmUCGMHBxCsBEfvAw/NPf8ZqhpdP4eH3q wcbzLHkv361hilM6pp5Q1FLU9utqaw7DP7u5BjUHw3NbjNtz2Ay+bBA7u0T9kNMjcRED3XlrVaY oSgMA 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 Tue Mar 19 12:14: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: 781081 Delivered-To: patch@linaro.org Received: by 2002:a5d:46c1:0:b0:33e:7753:30bd with SMTP id g1csp1892575wrs; Tue, 19 Mar 2024 05:15:40 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUfVIq0lFiLa5oc8p4KzGexIR0LXEvcIPSqxlw9t71PNIN2ACeganpRs9uMo5FIVXPVc/zhdeoHuTKjTLYKzPft X-Google-Smtp-Source: AGHT+IGw1ZCoXd1OyQOrxwQV2yZlEZGDSaHeV64rcLHDJ6aZLODbbfs2V7dE4sI7nxNXBz9ra4vh X-Received: by 2002:a05:600c:3ca8:b0:414:273:67d4 with SMTP id bg40-20020a05600c3ca800b00414027367d4mr8607831wmb.30.1710850540477; Tue, 19 Mar 2024 05:15:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1710850540; cv=none; d=google.com; s=arc-20160816; b=JiqqGjMJD83a9zbLfksu4taf4QEvYeeqYiXUJLTvIW5Jxp4zqsExrvxF/w/gYrlIHj lzH9PEoXEpDqHdzQcxwE+fjfz4iKmjtq7FIqOOnScKHiDt2qP/PFwEYFHj6bFGqkRmzf 9FaoI7ViIoNq4vwY4sUJ3dDss+NqhyrbkhyCmLt1qvsw1GVjBwP09wSxOtobACjZ8up4 hFz3pC58xBH2nY8yoGRdbXrJgccz9w+Wj700z3/DodIqY43YBRnjav6WR48IfOLRFmZo Jz/sUHOYsy+1DdAXajatdyEAW/5Ziz9YhC3N6rsgmGd+qDx/eisbcm/ln2f7VLKazDOf C/lg== 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=aXVVmschbjVz5w7smySfce/CBtWQP9Z2oSqAdH7qOzl88/07gkyv8nPfK8RRFhMduW 6nBnFhCtKhMgRrVO9eD+yWYH6/ZdP/MVqIjEU7ZF1U23RBIeJKdpx5y01VknK7cNFYaU jk+qyEdr5PqnEvXOF6wwkenPAvrHOcDlrbdJ4v1EqymXLXPM5YtWsPnMGc8nHt4fMR5J r7sSMl63vM8xHXF8Orggmj4GOTjcBVwbOmhvLQQrWRrZ/LnGCpECHStDe8VUk4CGySJ2 RO3Jw+JWSU3ycjKUBqo++BVeSduJqANCzq2Chj86f5H4Y1UYnWV1gPDDXQ+2X9VZg4rU 0yXA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=F9JFV7Au; 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 k6-20020a7bc406000000b00412eda81f7esi7842669wmi.180.2024.03.19.05.15.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Mar 2024 05:15:40 -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=F9JFV7Au; 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 1A70F87F30; Tue, 19 Mar 2024 13:14:53 +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="F9JFV7Au"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 1FF1788024; Tue, 19 Mar 2024 13:14:51 +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 8013F87F88 for ; Tue, 19 Mar 2024 13:14: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=caleb.connolly@linaro.org Received: by mail-wm1-x32f.google.com with SMTP id 5b1f17b1804b1-414617882b3so8556915e9.3 for ; Tue, 19 Mar 2024 05:14:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1710850486; x=1711455286; 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=F9JFV7AuVk6xC2b5zSCNApa9jaXgizBgx/jtaGhBZyFxhnZZiE2bd5QRxmWVSJsMWx hplsUzXuEuTLnAOhxFkoffybKD6ceda8ZTBWgS6IWuaL7p2BI0WKxltPhsZtupEzF3vt JJB84Z9UrAOGA7UchHEW7LNpW6ZRIH9wkYUxEo6AwDHt6eN2Dc7V5qbbaDs9IcXIKVnH ESLqlTL989JZqUlWDM3C8eJUuHIfDuioBFRGbEd9g/PkEUWksp5V/n763AdYcL8bGET3 Ez4H4x6vZOJPcDpaU9nGPe0TRBPpk29Da4mpZpZBojEJYg0+P6LX5WvE6/PTQXLcMfSi opwA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710850486; x=1711455286; 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=X1B1dQQZnspbzPD91CBmTzxQ+QreO98tjHnnA9podvKTm9rtglBT9v6nvtYOx+4x1l 3zEQe2ikc2ruV4y9WUoJLsdeuSTpFLZvN7jTPtwNYnVfNW3JlSe4jzNzBUaphOe7VChw eLM/kpLNclteNWAm5/4BcfNHKMLyJxEUjVf8q54pXIz/fl/qSeN63eV3wuQbUl+zs+/R sW4aKqLZlORw5FJRJx0UQdXG6ehA/yvrt88+MQCE9fUf2QxXp9gbQ7wZWG5eyOUAWJkE UayN2YFz4u3eWmOfEIXhkjaUPgV0TcAww5C8ZX7p7k5VqiDjHavU35lLYosZ338yLG2e k6CA== X-Gm-Message-State: AOJu0Yw+/uDqBCIAuA3qo+CvU6o7kgNVkwrw4hDaJL46XtY7DFAbKPRN NkXg4ML4Hj6uF/sUsv/6UW5sIAn6m3l4OHkqszpiepU3mG4UhPNHPFLiocGNlWk= X-Received: by 2002:adf:ee4f:0:b0:341:84ec:fff8 with SMTP id w15-20020adfee4f000000b0034184ecfff8mr1636656wro.20.1710850486046; Tue, 19 Mar 2024 05:14:46 -0700 (PDT) Received: from lion.localdomain (host-92-17-96-232.as13285.net. [92.17.96.232]) by smtp.gmail.com with ESMTPSA id u8-20020a5d4688000000b0033e3c4e600asm12345792wrq.7.2024.03.19.05.14.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Mar 2024 05:14:45 -0700 (PDT) From: Caleb Connolly Date: Tue, 19 Mar 2024 12:14:28 +0000 Subject: [PATCH v3 5/5] iommu: qcom-smmu: fix debugging MIME-Version: 1.0 Message-Id: <20240319-b4-qcom-usb-v3-5-09ba1f86d259@linaro.org> References: <20240319-b4-qcom-usb-v3-0-09ba1f86d259@linaro.org> In-Reply-To: <20240319-b4-qcom-usb-v3-0-09ba1f86d259@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=owGbwMvMwCFYaeA6f6eBkTjjabUkhtSfjesdOa63y1j1N3Knbp6s+VFKaKt5pxSj3Nqgm7JGJ yTyHvh1lLIwCHIwyIopsoifWGbZtPayvcb2BRdg5rAygQxh4OIUgIlc+8Pwz8r7knlCbOtFEwbp Pyv4xHP2egtqXgx8phdne9Dh9+vGJkaGBr/HjK57d5yZI7XtpdT2L2fZM14YO/zYde/3btXQv6H qNQA= 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;