* [PATCH v3 0/1] Fix configuration for on-chip USB 2.0 support
@ 2024-09-02 11:11 Minda Chen
2024-09-02 11:11 ` [PATCH v3 1/1] phy: starfive: jh7110-usb: Fix link configuration to controller Minda Chen
0 siblings, 1 reply; 6+ messages in thread
From: Minda Chen @ 2024-09-02 11:11 UTC (permalink / raw)
To: Vinod Koul, Kishon Vijay Abraham I, Jan Kiszka, linux-phy
Cc: Emil Renner Berthing, Rob Herring, Conor Dooley, linux-kernel,
Minda Chen
While mainline has support for the USB controller of the JH7110 since 6.5,
this never really worked, even not with latest downstream kernels by Starfive -
unless you were also using an old downstream U-Boot version. The reason for
that was a missing syscon setting that prevented the connection between USB
2.0 PHY and the controller. This series finally fixes the issue.
Changes in v2:
- fix copy&paste mistake in error patch found by kernel test robot and Dan Carpenter
Change in v3:
- Using syscon_regmap_lookup_by_compatible() to lookup regmap. So dts
with no changed. Delete v2 patch1 and patch 2.
base on v6.11-rc5
Jan Kiszka (1):
phy: starfive: jh7110-usb: Fix link configuration to controller
drivers/phy/starfive/phy-jh7110-usb.c | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
base-commit: 5be63fc19fcaa4c236b307420483578a56986a37
--
2.17.1
--
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH v3 1/1] phy: starfive: jh7110-usb: Fix link configuration to controller
2024-09-02 11:11 [PATCH v3 0/1] Fix configuration for on-chip USB 2.0 support Minda Chen
@ 2024-09-02 11:11 ` Minda Chen
2024-09-09 11:02 ` Conor Dooley
2024-10-29 11:26 ` Emil Renner Berthing
0 siblings, 2 replies; 6+ messages in thread
From: Minda Chen @ 2024-09-02 11:11 UTC (permalink / raw)
To: Vinod Koul, Kishon Vijay Abraham I, Jan Kiszka, linux-phy
Cc: Emil Renner Berthing, Rob Herring, Conor Dooley, linux-kernel,
Minda Chen
From: Jan Kiszka <jan.kiszka@siemens.com>
In order to connect the USB 2.0 PHY to its controller, we also need to
set "u0_pdrstn_split_sw_usbpipe_plugen" [1]. Some downstream U-Boot
versions did that, but upstream firmware does not, and the kernel must
not rely on such behavior anyway. Failing to set this left the USB
gadget port invisible to connected hosts behind.
Link: https://doc-en.rvspace.org/JH7110/TRM/JH7110_TRM/sys_syscon.html#sys_syscon__section_b3l_fqs_wsb [1]
Fixes: 16d3a71c20cf ("phy: starfive: Add JH7110 USB 2.0 PHY driver")
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Minda Chen <minda.chen@starfivetech.com>
---
drivers/phy/starfive/phy-jh7110-usb.c | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/drivers/phy/starfive/phy-jh7110-usb.c b/drivers/phy/starfive/phy-jh7110-usb.c
index 633912f8a05d..dabe59953070 100644
--- a/drivers/phy/starfive/phy-jh7110-usb.c
+++ b/drivers/phy/starfive/phy-jh7110-usb.c
@@ -10,18 +10,24 @@
#include <linux/clk.h>
#include <linux/err.h>
#include <linux/io.h>
+#include <linux/mfd/syscon.h>
#include <linux/module.h>
#include <linux/phy/phy.h>
#include <linux/platform_device.h>
+#include <linux/regmap.h>
#include <linux/usb/of.h>
#define USB_125M_CLK_RATE 125000000
#define USB_LS_KEEPALIVE_OFF 0x4
#define USB_LS_KEEPALIVE_ENABLE BIT(4)
+#define USB_PDRSTN_SPLIT BIT(17)
+#define SYSCON_USB_SPLIT_OFFSET 0x18
+
struct jh7110_usb2_phy {
struct phy *phy;
void __iomem *regs;
+ struct regmap *sys_syscon;
struct clk *usb_125m_clk;
struct clk *app_125m;
enum phy_mode mode;
@@ -61,6 +67,10 @@ static int usb2_phy_set_mode(struct phy *_phy,
usb2_set_ls_keepalive(phy, (mode != PHY_MODE_USB_DEVICE));
}
+ /* Connect usb 2.0 phy mode */
+ regmap_update_bits(phy->sys_syscon, SYSCON_USB_SPLIT_OFFSET,
+ USB_PDRSTN_SPLIT, USB_PDRSTN_SPLIT);
+
return 0;
}
@@ -129,6 +139,12 @@ static int jh7110_usb_phy_probe(struct platform_device *pdev)
phy_set_drvdata(phy->phy, phy);
phy_provider = devm_of_phy_provider_register(dev, of_phy_simple_xlate);
+ phy->sys_syscon =
+ syscon_regmap_lookup_by_compatible("starfive,jh7110-sys-syscon");
+ if (IS_ERR(phy->sys_syscon))
+ return dev_err_probe(dev, PTR_ERR(phy->sys_syscon),
+ "Failed to get sys-syscon\n");
+
return PTR_ERR_OR_ZERO(phy_provider);
}
--
2.17.1
--
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH v3 1/1] phy: starfive: jh7110-usb: Fix link configuration to controller
2024-09-02 11:11 ` [PATCH v3 1/1] phy: starfive: jh7110-usb: Fix link configuration to controller Minda Chen
@ 2024-09-09 11:02 ` Conor Dooley
2024-09-14 6:49 ` Minda Chen
2024-10-29 11:26 ` Emil Renner Berthing
1 sibling, 1 reply; 6+ messages in thread
From: Conor Dooley @ 2024-09-09 11:02 UTC (permalink / raw)
To: Minda Chen
Cc: Vinod Koul, Kishon Vijay Abraham I, Jan Kiszka, linux-phy,
Emil Renner Berthing, Rob Herring, Conor Dooley, linux-kernel
[-- Attachment #1.1: Type: text/plain, Size: 808 bytes --]
On Mon, Sep 02, 2024 at 07:11:27PM +0800, Minda Chen wrote:
> From: Jan Kiszka <jan.kiszka@siemens.com>
>
> In order to connect the USB 2.0 PHY to its controller, we also need to
> set "u0_pdrstn_split_sw_usbpipe_plugen" [1]. Some downstream U-Boot
> versions did that, but upstream firmware does not, and the kernel must
> not rely on such behavior anyway. Failing to set this left the USB
> gadget port invisible to connected hosts behind.
>
> Link: https://doc-en.rvspace.org/JH7110/TRM/JH7110_TRM/sys_syscon.html#sys_syscon__section_b3l_fqs_wsb [1]
> Fixes: 16d3a71c20cf ("phy: starfive: Add JH7110 USB 2.0 PHY driver")
> Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
> Signed-off-by: Minda Chen <minda.chen@starfivetech.com>
Reviewed-by: Conor Dooley <conor.dooley@microchip.com>
[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]
[-- Attachment #2: Type: text/plain, Size: 112 bytes --]
--
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH v3 1/1] phy: starfive: jh7110-usb: Fix link configuration to controller
2024-09-09 11:02 ` Conor Dooley
@ 2024-09-14 6:49 ` Minda Chen
0 siblings, 0 replies; 6+ messages in thread
From: Minda Chen @ 2024-09-14 6:49 UTC (permalink / raw)
To: Conor Dooley
Cc: Vinod Koul, Kishon Vijay Abraham I, Jan Kiszka,
linux-phy@lists.infradead.org, Emil Renner Berthing, Rob Herring,
Conor Dooley, linux-kernel@vger.kernel.org
>
> On Mon, Sep 02, 2024 at 07:11:27PM +0800, Minda Chen wrote:
> > From: Jan Kiszka <jan.kiszka@siemens.com>
> >
> > In order to connect the USB 2.0 PHY to its controller, we also need to
> > set "u0_pdrstn_split_sw_usbpipe_plugen" [1]. Some downstream U-Boot
> > versions did that, but upstream firmware does not, and the kernel must
> > not rely on such behavior anyway. Failing to set this left the USB
> > gadget port invisible to connected hosts behind.
> >
> > Link:
> > https://doc-en.rvspace.org/JH7110/TRM/JH7110_TRM/sys_syscon.html#sys_s
> > yscon__section_b3l_fqs_wsb [1]
> > Fixes: 16d3a71c20cf ("phy: starfive: Add JH7110 USB 2.0 PHY driver")
> > Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
> > Signed-off-by: Minda Chen <minda.chen@starfivetech.com>
>
> Reviewed-by: Conor Dooley <conor.dooley@microchip.com>
Conor :
Thanks
--
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v3 1/1] phy: starfive: jh7110-usb: Fix link configuration to controller
@ 2024-10-08 2:13 Minda Chen
0 siblings, 0 replies; 6+ messages in thread
From: Minda Chen @ 2024-10-08 2:13 UTC (permalink / raw)
To: Conor Dooley, Vinod Koul
Cc: Kishon Vijay Abraham I, Jan Kiszka, linux-phy@lists.infradead.org,
Emil Renner Berthing, Rob Herring, Conor Dooley,
linux-kernel@vger.kernel.org
>
> On Mon, Sep 02, 2024 at 07:11:27PM +0800, Minda Chen wrote:
> > From: Jan Kiszka <jan.kiszka@siemens.com>
> >
> > In order to connect the USB 2.0 PHY to its controller, we also need to
> > set "u0_pdrstn_split_sw_usbpipe_plugen" [1]. Some downstream U-Boot
> > versions did that, but upstream firmware does not, and the kernel must
> > not rely on such behavior anyway. Failing to set this left the USB
> > gadget port invisible to connected hosts behind.
> >
> > Link:
> > https://doc-en.rvspace.org/JH7110/TRM/JH7110_TRM/sys_syscon.html#sys_s
> > yscon__section_b3l_fqs_wsb [1]
> > Fixes: 16d3a71c20cf ("phy: starfive: Add JH7110 USB 2.0 PHY driver")
> > Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
> > Signed-off-by: Minda Chen <minda.chen@starfivetech.com>
>
> Reviewed-by: Conor Dooley <conor.dooley@microchip.com>
Hi Vinod
Could you review the new change of this patch? Thanks.
--
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v3 1/1] phy: starfive: jh7110-usb: Fix link configuration to controller
2024-09-02 11:11 ` [PATCH v3 1/1] phy: starfive: jh7110-usb: Fix link configuration to controller Minda Chen
2024-09-09 11:02 ` Conor Dooley
@ 2024-10-29 11:26 ` Emil Renner Berthing
1 sibling, 0 replies; 6+ messages in thread
From: Emil Renner Berthing @ 2024-10-29 11:26 UTC (permalink / raw)
To: Minda Chen, Vinod Koul, Kishon Vijay Abraham I, Jan Kiszka,
linux-phy
Cc: Emil Renner Berthing, Rob Herring, Conor Dooley, linux-kernel
Minda Chen wrote:
> From: Jan Kiszka <jan.kiszka@siemens.com>
>
> In order to connect the USB 2.0 PHY to its controller, we also need to
> set "u0_pdrstn_split_sw_usbpipe_plugen" [1]. Some downstream U-Boot
> versions did that, but upstream firmware does not, and the kernel must
> not rely on such behavior anyway. Failing to set this left the USB
> gadget port invisible to connected hosts behind.
>
> Link: https://doc-en.rvspace.org/JH7110/TRM/JH7110_TRM/sys_syscon.html#sys_syscon__section_b3l_fqs_wsb [1]
> Fixes: 16d3a71c20cf ("phy: starfive: Add JH7110 USB 2.0 PHY driver")
> Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
> Signed-off-by: Minda Chen <minda.chen@starfivetech.com>
Apologies if this was already applied somewhere, but I don't see message that
it was. In any case this looks good to me, thanks.
Reviewed-by: Emil Renner Berthing <emil.renner.berthing@canonical.com>
> ---
> drivers/phy/starfive/phy-jh7110-usb.c | 16 ++++++++++++++++
> 1 file changed, 16 insertions(+)
>
> diff --git a/drivers/phy/starfive/phy-jh7110-usb.c b/drivers/phy/starfive/phy-jh7110-usb.c
> index 633912f8a05d..dabe59953070 100644
> --- a/drivers/phy/starfive/phy-jh7110-usb.c
> +++ b/drivers/phy/starfive/phy-jh7110-usb.c
> @@ -10,18 +10,24 @@
> #include <linux/clk.h>
> #include <linux/err.h>
> #include <linux/io.h>
> +#include <linux/mfd/syscon.h>
> #include <linux/module.h>
> #include <linux/phy/phy.h>
> #include <linux/platform_device.h>
> +#include <linux/regmap.h>
> #include <linux/usb/of.h>
>
> #define USB_125M_CLK_RATE 125000000
> #define USB_LS_KEEPALIVE_OFF 0x4
> #define USB_LS_KEEPALIVE_ENABLE BIT(4)
>
> +#define USB_PDRSTN_SPLIT BIT(17)
> +#define SYSCON_USB_SPLIT_OFFSET 0x18
> +
> struct jh7110_usb2_phy {
> struct phy *phy;
> void __iomem *regs;
> + struct regmap *sys_syscon;
> struct clk *usb_125m_clk;
> struct clk *app_125m;
> enum phy_mode mode;
> @@ -61,6 +67,10 @@ static int usb2_phy_set_mode(struct phy *_phy,
> usb2_set_ls_keepalive(phy, (mode != PHY_MODE_USB_DEVICE));
> }
>
> + /* Connect usb 2.0 phy mode */
> + regmap_update_bits(phy->sys_syscon, SYSCON_USB_SPLIT_OFFSET,
> + USB_PDRSTN_SPLIT, USB_PDRSTN_SPLIT);
> +
> return 0;
> }
>
> @@ -129,6 +139,12 @@ static int jh7110_usb_phy_probe(struct platform_device *pdev)
> phy_set_drvdata(phy->phy, phy);
> phy_provider = devm_of_phy_provider_register(dev, of_phy_simple_xlate);
>
> + phy->sys_syscon =
> + syscon_regmap_lookup_by_compatible("starfive,jh7110-sys-syscon");
> + if (IS_ERR(phy->sys_syscon))
> + return dev_err_probe(dev, PTR_ERR(phy->sys_syscon),
> + "Failed to get sys-syscon\n");
> +
> return PTR_ERR_OR_ZERO(phy_provider);
> }
>
> --
> 2.17.1
>
--
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2024-10-29 11:47 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-09-02 11:11 [PATCH v3 0/1] Fix configuration for on-chip USB 2.0 support Minda Chen
2024-09-02 11:11 ` [PATCH v3 1/1] phy: starfive: jh7110-usb: Fix link configuration to controller Minda Chen
2024-09-09 11:02 ` Conor Dooley
2024-09-14 6:49 ` Minda Chen
2024-10-29 11:26 ` Emil Renner Berthing
-- strict thread matches above, loose matches on Subject: below --
2024-10-08 2:13 Minda Chen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).