From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=141.14.17.11 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796299165; b=R8ZJpexcggN50SvVUwNXy011KpMWX8hgqZYM3AueuCJOK7jJ5R6GIUQkWgL/pec9S794 cfOy7aNXdYK3TO/qAE78Ubph14E06+jsr7C802embBf4/MNcLJAC3+8hu+14M7WST0Nss /9X3biQXlrjihSTqlwlaq+GlhBS270p0QcwybeCfXBHNdwonDHPZ/OHhGgsFX/0IX/ojg 5f5yRAcNfBOV9Pw00Bdp5kXCcbxO7keNCvPL7bIWTcZmolNJ4DxTuTDUZA71YoI4Wmap1 QXSi0HQ1JaBnWMtw9+txEfMDg8x20B4rJp1HCHw9L3MlxxMKm3MidET8RXbWL1qmXlA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796299165; h=DMARC-Filter:Received:Message-ID:Date:MIME-Version:User-Agent: Subject:To:Cc:References:Content-Language:From:In-Reply-To: Content-Type:Content-Transfer-Encoding:DKIM-Signature; bh=IzvsRsVuMR2D2wXxAkglJs+ZgF+PSllqhTRh86kEDf8=; b=RPJ8unIGRLT3gqForIM8cKiYMqt/FvJCTwzHGMffZwU+lY96NwR7L3vblyDRL57spzWV JhN3qS2yjDAQqtWSzaEdoaAEbzm3xMQVli296aiUCWiH+aUAwjsiFjq3x7iINbzinQvaa HuuIUp9ZD/IQkbL1Fff90D6zuGMJ/0/hJcjxtHzpQRTWe1VAkFwto/5CEZuXGlXIUf+hU UanACgphdiQWzfjUgo9iauZy6UgvxhB/oiUoaZ6KihiFBEgngK70eKtfgIww7glLaA+wv HkmI/N3IKIg0nhZdpgvF9BJ0srROQlQz3KbIe8y7aVx6vwA0Ibys0ULdjxOGdUn3WOQ== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=molgen.mpg.de; spf=pass smtp.mailfrom=molgen.mpg.de; dkim=pass header.d=molgen.mpg.de header.i=@molgen.mpg.de header.a=rsa-sha256 header.s=20260906 header.b=nmYIKDVF; arc=none smtp.remote-ip=141.14.17.11 Received: from mx3.molgen.mpg.de (mx3.molgen.mpg.de [141.14.17.11]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BCC6C606A332; Thu, 3 Dec 2026 11:59:23 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org BCC6C606A332 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=molgen.mpg.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=molgen.mpg.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=molgen.mpg.de header.i=@molgen.mpg.de header.a=rsa-sha256 header.s=20260906 header.b=nmYIKDVF Received: from [141.14.220.44] (g44.guest.molgen.mpg.de [141.14.220.44]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: pmenzel) by mx.molgen.mpg.de (Postfix) with ESMTPSA id 0F0544C50565AC; Thu, 03 Dec 2026 12:58:33 +0100 (CET) Message-ID: <16634e7d-3bf0-41de-b16e-dea539803a3d@molgen.mpg.de> Date: Thu, 3 Dec 2026 12:58:26 +0100 X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v3 3/5] phy: exynos5-usbdrd: support Exynos7885 USB PHY To: David Virag Cc: Vinod Koul , Krzysztof Kozlowski , Peter Griffin , linux-kernel@vger.kernel.org, linux-samsung-soc@vger.kernel.org, Umer Uddin , Krzysztof Kozlowski , Neil Armstrong , Manivannan Sadhasivam , Alim Akhtar , linux-phy@lists.infradead.org, linux-arm-kernel@lists.infradead.org References: <20261125145458.2594179-1-virag.david003@gmail.com> <20261125145458.2594179-4-virag.david003@gmail.com> Content-Language: en-US From: Paul Menzel In-Reply-To: <20261125145458.2594179-4-virag.david003@gmail.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=molgen.mpg.de; s=20260906; t=1796299114; h=from:from:subject:date:message-id:mime-version:content-type:content-transfer-encoding; bh=IzvsRsVuMR2D2wXxAkglJs+ZgF+PSllqhTRh86kEDf8=; b=nmYIKDVFUqlH4rUcmADtYooTf4v6M8Y7MpMW0i57MWXWXHbJyAfsGqWfHqn1BDjWxyMhyDyDr7ef nugOGjMjTjRJ3nHdid1CMHLNthAkZRAuiny549vFpfs3CYtpKykIE/gpHnjKb109Tq0eRyimK3uBpR ELIFi88FdnXhLy+95m1U786I6ee7cTYBkIRl8lCwVBmgDmJnUEXQHTn4lU/gdPViznhPQjNEJAVB2C g37MVK+3OkU+ATpeAy3KlVU7JDEJoVG5IZO4uMgsy4FLJ/aGtSRkCFTpPJB4wrcTalAqEVYGWctGxI rtzLGZkq1LZX9OxBifHSvZQiqq1TnoSw== Dear David, Thank you for your patch. Am 25.11.26 um 15:54 schrieb David Virag: > The Exynos7885 SoC has an Exynos USB PHY that theoretically supports > USB3 SuperSpeed, but all known devices using it only have USB2 and the > vendor driver has USB3 function stubbed out, so we'll only support USB2. > > Apart from this mysterius USB3 capability, it's the closest to Exynos850 mysteri*o*us > out of those supported. Unlike other SoCs though, this one doesn't set > the reference clock by default, so we have to set it manually. > For this, create a set_ref_clk_rate property in drvdata that can be set > to a predefined value to set the clockrate to. > > Co-developed-by: Umer Uddin > Signed-off-by: Umer Uddin > Signed-off-by: David Virag > Tested-by: Umer Uddin > Acked-by: Krzysztof Kozlowski > --- > Changes in v2: > - Use unsigned long for set_ref_clk_rate > - (from Umer Uddin:) Error-check clk_set_rate, and fail if returns an > error. > - Add Umer Uddin's Co-developed-by: tag for his improvement. > > Changes in v3: > - Add Tested-by and Acked-by tags > > drivers/phy/samsung/phy-exynos5-usbdrd.c | 26 +++++++++++++++++++++ > include/linux/soc/samsung/exynos-regs-pmu.h | 3 +++ > 2 files changed, 29 insertions(+) > > diff --git a/drivers/phy/samsung/phy-exynos5-usbdrd.c b/drivers/phy/samsung/phy-exynos5-usbdrd.c > index 087d552eb511..77bba791212d 100644 > --- a/drivers/phy/samsung/phy-exynos5-usbdrd.c > +++ b/drivers/phy/samsung/phy-exynos5-usbdrd.c > @@ -483,6 +483,7 @@ struct exynos5_usbdrd_phy_drvdata { > int n_clks; > const char * const *core_clk_names; > int n_core_clks; > + unsigned long set_ref_clk_rate; > const char * const *regulator_names; > int n_regulators; > u32 pmu_offset_usbdrd0_phy; > @@ -1847,6 +1848,15 @@ static int exynos5_usbdrd_phy_clk_handle(struct exynos5_usbdrd_phy *phy_drd) > return dev_err_probe(phy_drd->dev, -ENODEV, > "failed to find phy reference clock\n"); > > + /* Some SoCs (e.g. Exynos7885) leave the reference clock unset */ > + if (phy_drd->drv_data->set_ref_clk_rate) { > + ret = clk_set_rate(ref_clk, > + phy_drd->drv_data->set_ref_clk_rate); > + if (ret) > + return dev_err_probe(phy_drd->dev, ret, > + "failed to set ref clock rate\n"); > + } > + > ref_rate = clk_get_rate(ref_clk); > ret = exynos5_rate_to_clk(ref_rate, &phy_drd->extrefclk); > if (ret) > @@ -2095,6 +2105,19 @@ static const struct exynos5_usbdrd_phy_drvdata exynos7870_usbdrd_phy = { > .n_regulators = ARRAY_SIZE(exynos5_regulator_names), > }; > > +static const struct exynos5_usbdrd_phy_drvdata exynos7885_usbdrd_phy = { > + .phy_cfg = phy_cfg_exynos850, > + .phy_ops = &exynos850_usbdrd_phy_ops, `.n_phy_cfg` is missing. Since commit ba6618a1e7c0 ("phy: exynos5-usbdrd: Use dynamic phy_cfg size to prevent OOB access"), in Linus’ tree since v7.4-rc5, the driver creates `n_phy_cfg` PHYs, so with this entry it creates none, and `exynos5_usbdrd_phy_xlate()` warns and returns -ENODEV for index 0. The series applies to such a tree without a conflict, so the base used for the Tested-by probably predates that commit. On a Samsung Galaxy Tab A 10.1 (2019, Wi-Fi) (SM-T510, Exynos 7904), next-20261202 with this series and USB enabled like on gta3xllte, dwc3 probes without a PHY (trace below). Adding .n_phy_cfg = ARRAY_SIZE(phy_cfg_exynos850), fixes it: the WARN is gone, and a configfs ACM gadget enumerates on the host at high speed (an interactive shell over ttyACM0 works). > + .pmu_offset_usbdrd0_phy = EXYNOS7885_PHY_CTRL_USB20, > + .clk_names = exynos5_clk_names, > + .n_clks = ARRAY_SIZE(exynos5_clk_names), > + .core_clk_names = exynos5_core_clk_names, > + .n_core_clks = ARRAY_SIZE(exynos5_core_clk_names), > + .regulator_names = exynos5_regulator_names, > + .n_regulators = ARRAY_SIZE(exynos5_regulator_names), > + .set_ref_clk_rate = 50 * MHZ, > +}; > + > static const struct exynos5_usbdrd_phy_drvdata exynos850_usbdrd_phy = { > .phy_cfg = phy_cfg_exynos850, > .phy_ops = &exynos850_usbdrd_phy_ops, > @@ -2929,6 +2952,9 @@ static const struct of_device_id exynos5_usbdrd_phy_of_match[] = { > }, { > .compatible = "samsung,exynos7870-usbdrd-phy", > .data = &exynos7870_usbdrd_phy > + }, { > + .compatible = "samsung,exynos7885-usbdrd-phy", > + .data = &exynos7885_usbdrd_phy > }, { > .compatible = "samsung,exynos850-usbdrd-phy", > .data = &exynos850_usbdrd_phy > diff --git a/include/linux/soc/samsung/exynos-regs-pmu.h b/include/linux/soc/samsung/exynos-regs-pmu.h > index db8a7ca81080..73d9c509dae6 100644 > --- a/include/linux/soc/samsung/exynos-regs-pmu.h > +++ b/include/linux/soc/samsung/exynos-regs-pmu.h > @@ -665,6 +665,9 @@ > /* For Exynos990 */ > #define EXYNOS990_PHY_CTRL_USB20 (0x72C) > > +/* For Exynos7885 */ > +#define EXYNOS7885_PHY_CTRL_USB20 (0x674) > + > /* For Exynos7870 */ > #define EXYNOS7870_MIPI_PHY_CONTROL0 (0x070c) > #define EXYNOS7870_MIPI_PHY_CONTROL1 (0x0714) With the change above feel free to add: Tested-by: Paul Menzel Kind regards, Paul [ 0.190881] WARNING: drivers/phy/samsung/phy-exynos5-usbdrd.c:1178 at exynos5_usbdrd_phy_xlate+0x2c/0x40, CPU#2: swapper/0/1 [ 0.190984] CPU: 2 UID: 0 PID: 1 Comm: swapper/0 Not tainted 7.4.0-rc5-next-20261202-00016-g50142f8cf326 #4 PREEMPT(full) [ 0.191065] Hardware name: Samsung Galaxy Tab A 10.1 (2019, Wi-Fi) (DT) [ 0.191170] pc : exynos5_usbdrd_phy_xlate+0x2c/0x40 [ 0.191222] lr : _of_phy_get_with_args+0xa0/0xf0 [ 0.191948] Call trace: [ 0.191978] exynos5_usbdrd_phy_xlate+0x2c/0x40 (P) [ 0.192036] _of_phy_get+0xb4/0xd0 [ 0.192080] phy_get+0x58/0x160 [ 0.192122] devm_phy_get+0x50/0x9c [ 0.192165] dwc3_core_init+0x3d4/0x1300 [ 0.192211] dwc3_core_probe+0xe14/0x1758 [ 0.192254] dwc3_probe+0x78/0xc8 [ 0.192293] platform_probe+0x5c/0xa4 […] [ 0.192963] dwc3_exynos_probe+0x204/0x340 […] [ 0.193666] ---[ end trace 0000000000000000 ]---