Skip to contentSkip to conversation

usb: ehci-mx6: Limit PHY address parsing to !CONFIG_PHY

PATCH New Marek Vasut 3 participants 4 messages Apr 27, 2021 – Apr 28, 2021

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 usb: ehci-mx6: Limit PHY address parsing to !CONFIG_PHY

For systems which use generic PHY support and implement USB PHY driver, the parsing of PHY properties is unnecessary, disable it.

Cc Fabio Estevam <[email protected]>
Cc Peng Fan <[email protected]>
Cc Stefano Babic <[email protected]>
Cc Tim Harvey <[email protected]>
Cc uboot-imx <[email protected]>
---
 drivers/usb/host/ehci-mx6.c | 17 ++++++++++++-----
 1 file changed, 12 insertions(+), 5 deletions(-)
drivers/usb/host/ehci-mx6.c +12 -5
index 7642a31b655..06be9deaaae 100644
@@ -265,6 +265,8 @@ int usb_phy_mode(int port)
 }
 #endif
 
+#if !defined(CONFIG_PHY)
+/* Should be done in the MXS PHY driver */
 static void usb_oc_config(struct usbnc_regs *usbnc, int index)
 {
 	void __iomem *ctrl = (void __iomem *)(&usbnc->ctrl[index]);
@@ -285,6 +287,7 @@ static void usb_oc_config(struct usbnc_regs *usbnc, int index)
 	clrbits_le32(ctrl, UCTRL_PWR_POL);
 #endif
 }
+#endif
 
 #if !CONFIG_IS_ENABLED(DM_USB)
 /**
@@ -432,10 +435,12 @@ struct ehci_mx6_priv_data {
 	struct clk clk;
 	struct phy phy;
 	enum usb_init_type init_type;
+#if !defined(CONFIG_PHY)
 	int portnr;
 	void __iomem *phy_addr;
 	void __iomem *misc_addr;
 	void __iomem *anatop_addr;
+#endif
 };
 
 static int mx6_init_after_reset(struct ehci_ctrl *dev)
@@ -448,14 +453,14 @@ static int mx6_init_after_reset(struct ehci_ctrl *dev)
 	usb_power_config_mx6(priv->anatop_addr, priv->portnr);
 	usb_power_config_mx7(priv->misc_addr);
 	usb_power_config_mx7ulp(priv->phy_addr);
-#endif
 
 	usb_oc_config(priv->misc_addr, priv->portnr);
 
-#if !defined(CONFIG_PHY) && (defined(CONFIG_MX6) || defined(CONFIG_MX7ULP))
+#if defined(CONFIG_MX6) || defined(CONFIG_MX7ULP)
 	usb_internal_phy_clock_gate(priv->phy_addr, 1);
 	usb_phy_enable(ehci, priv->phy_addr);
 #endif
+#endif
 
 #if CONFIG_IS_ENABLED(DM_REGULATOR)
 	if (priv->vbus_supply) {
@@ -558,6 +563,7 @@ static int ehci_usb_of_to_plat(struct udevice *dev)
 
 static int mx6_parse_dt_addrs(struct udevice *dev)
 {
+#if !defined(CONFIG_PHY)
 	struct ehci_mx6_priv_data *priv = dev_get_priv(dev);
 	int phy_off, misc_off;
 	const void *blob = gd->fdt_blob;
@@ -594,7 +600,7 @@ static int mx6_parse_dt_addrs(struct udevice *dev)
 
 	priv->misc_addr = addr;
 
-#if !defined(CONFIG_PHY) && defined(CONFIG_MX6)
+#if defined(CONFIG_MX6)
 	int anatop_off;
 
 	/* Resolve ANATOP offset through USB PHY node */
@@ -607,6 +613,7 @@ static int mx6_parse_dt_addrs(struct udevice *dev)
 		return -EINVAL;
 
 	priv->anatop_addr = addr;
+#endif
 #endif
 	return 0;
 }
@@ -661,14 +668,14 @@ static int ehci_usb_probe(struct udevice *dev)
 	usb_power_config_mx6(priv->anatop_addr, priv->portnr);
 	usb_power_config_mx7(priv->misc_addr);
 	usb_power_config_mx7ulp(priv->phy_addr);
-#endif
 
 	usb_oc_config(priv->misc_addr, priv->portnr);
 
-#if !defined(CONFIG_PHY) && (defined(CONFIG_MX6) || defined(CONFIG_MX7ULP))
+#if defined(CONFIG_MX6) || defined(CONFIG_MX7ULP)
 	usb_internal_phy_clock_gate(priv->phy_addr, 1);
 	usb_phy_enable(ehci, priv->phy_addr);
 #endif
+#endif
 
 #if CONFIG_IS_ENABLED(DM_REGULATOR)
 	if (priv->vbus_supply) {
Signature · 1 line
2.30.2
#1 lore raw

PATCH 1/1 usb: ehci-mx6: Limit PHY address parsing to !CONFIG_PHY

Quoted 109 lines · Marek Vasut

For systems which use generic PHY support and implement USB PHY driver, the parsing of PHY properties is unnecessary, disable it.

Cc Fabio Estevam <[email protected]>
Cc Peng Fan <[email protected]>
Cc Stefano Babic <[email protected]>
Cc Tim Harvey <[email protected]>
Cc uboot-imx <[email protected]>
---
 drivers/usb/host/ehci-mx6.c | 17 ++++++++++++-----
 1 file changed, 12 insertions(+), 5 deletions(-)
drivers/usb/host/ehci-mx6.c +12 -6
index 7642a31b655..06be9deaaae 100644
@@ -265,6 +265,8 @@ int usb_phy_mode(int port)
 }
 #endif
 
+#if !defined(CONFIG_PHY)
+/* Should be done in the MXS PHY driver */
 static void usb_oc_config(struct usbnc_regs *usbnc, int index)
 {
        void __iomem *ctrl = (void __iomem *)(&usbnc->ctrl[index]);
@@ -285,6 +287,7 @@ static void usb_oc_config(struct usbnc_regs *usbnc, int index)
        clrbits_le32(ctrl, UCTRL_PWR_POL);
 #endif
 }
+#endif
 
 #if !CONFIG_IS_ENABLED(DM_USB)
 /**
@@ -432,10 +435,12 @@ struct ehci_mx6_priv_data {
        struct clk clk;
        struct phy phy;
        enum usb_init_type init_type;
+#if !defined(CONFIG_PHY)
        int portnr;
        void __iomem *phy_addr;
        void __iomem *misc_addr;
        void __iomem *anatop_addr;
+#endif
 };
 
 static int mx6_init_after_reset(struct ehci_ctrl *dev)
@@ -448,14 +453,14 @@ static int mx6_init_after_reset(struct ehci_ctrl *dev)
        usb_power_config_mx6(priv->anatop_addr, priv->portnr);
        usb_power_config_mx7(priv->misc_addr);
        usb_power_config_mx7ulp(priv->phy_addr);
-#endif
 
        usb_oc_config(priv->misc_addr, priv->portnr);
 
-#if !defined(CONFIG_PHY) && (defined(CONFIG_MX6) || defined(CONFIG_MX7ULP))
+#if defined(CONFIG_MX6) || defined(CONFIG_MX7ULP)
        usb_internal_phy_clock_gate(priv->phy_addr, 1);
        usb_phy_enable(ehci, priv->phy_addr);
 #endif
+#endif
 
 #if CONFIG_IS_ENABLED(DM_REGULATOR)
        if (priv->vbus_supply) {
@@ -558,6 +563,7 @@ static int ehci_usb_of_to_plat(struct udevice *dev)
 
 static int mx6_parse_dt_addrs(struct udevice *dev)
 {
+#if !defined(CONFIG_PHY)
        struct ehci_mx6_priv_data *priv = dev_get_priv(dev);
        int phy_off, misc_off;
        const void *blob = gd->fdt_blob;
@@ -594,7 +600,7 @@ static int mx6_parse_dt_addrs(struct udevice *dev)
 
        priv->misc_addr = addr;
 
-#if !defined(CONFIG_PHY) && defined(CONFIG_MX6)
+#if defined(CONFIG_MX6)
        int anatop_off;
 
        /* Resolve ANATOP offset through USB PHY node */
@@ -607,6 +613,7 @@ static int mx6_parse_dt_addrs(struct udevice *dev)
                return -EINVAL;
 
        priv->anatop_addr = addr;
+#endif
 #endif
        return 0;
 }
@@ -661,14 +668,14 @@ static int ehci_usb_probe(struct udevice *dev)
        usb_power_config_mx6(priv->anatop_addr, priv->portnr);
        usb_power_config_mx7(priv->misc_addr);
        usb_power_config_mx7ulp(priv->phy_addr);
-#endif
 
        usb_oc_config(priv->misc_addr, priv->portnr);
 
-#if !defined(CONFIG_PHY) && (defined(CONFIG_MX6) || defined(CONFIG_MX7ULP))
+#if defined(CONFIG_MX6) || defined(CONFIG_MX7ULP)
        usb_internal_phy_clock_gate(priv->phy_addr, 1);
        usb_phy_enable(ehci, priv->phy_addr);
 #endif
+#endif
 
 #if CONFIG_IS_ENABLED(DM_REGULATOR)
        if (priv->vbus_supply) {
--
Quoted 2 lines

2.30.2

Tested on IMX8M Mini Venice
Tested on IMX6DL Ventana

#2 lore raw

PATCH 1/1 usb: ehci-mx6: Limit PHY address parsing to !CONFIG_PHY

In reply to Marek Vasut

Marek Vasut ? 2021/4/28 ??12:06 ??:

drivers/usb/host/ehci-mx6.c static void usb_oc_config(struct usbnc_regs *usbnc,

Quoted 28 lines

For systems which use generic PHY support and implement USB PHY driver, the parsing of PHY properties is unnecessary, disable it.

Cc Fabio Estevam <[email protected]>
Cc Peng Fan <[email protected]>
Cc Stefano Babic <[email protected]>
Cc Tim Harvey <[email protected]>
Cc uboot-imx <[email protected]>
---
 drivers/usb/host/ehci-mx6.c | 17 ++++++++++++-----
 1 file changed, 12 insertions(+), 5 deletions(-)
drivers/usb/host/ehci-mx6.c +2 -0
index 7642a31b655..06be9deaaae 100644
@@ -265,6 +265,8 @@ int usb_phy_mode(int port)
 }
 #endif
 
+#if !defined(CONFIG_PHY)
+/* Should be done in the MXS PHY driver */
 static void usb_oc_config(struct usbnc_regs *usbnc, int index)
 {
 	void __iomem *ctrl = (void __iomem *)(&usbnc->ctrl[index]);
@@ -285,6 +287,7 @@ static void usb_oc_config(struct usbnc_regs *usbnc, 

int index)

Quoted 69 lines
drivers/usb/host/ehci-mx6.c +8 -4
 	clrbits_le32(ctrl, UCTRL_PWR_POL);
 #endif
 }
+#endif
 
 #if !CONFIG_IS_ENABLED(DM_USB)
 /**
@@ -432,10 +435,12 @@ struct ehci_mx6_priv_data {
 	struct clk clk;
 	struct phy phy;
 	enum usb_init_type init_type;
+#if !defined(CONFIG_PHY)
 	int portnr;
 	void __iomem *phy_addr;
 	void __iomem *misc_addr;
 	void __iomem *anatop_addr;
+#endif
 };
 
 static int mx6_init_after_reset(struct ehci_ctrl *dev)
@@ -448,14 +453,14 @@ static int mx6_init_after_reset(struct ehci_ctrl *dev)
 	usb_power_config_mx6(priv->anatop_addr, priv->portnr);
 	usb_power_config_mx7(priv->misc_addr);
 	usb_power_config_mx7ulp(priv->phy_addr);
-#endif
 
 	usb_oc_config(priv->misc_addr, priv->portnr);
 
-#if !defined(CONFIG_PHY) && (defined(CONFIG_MX6) || defined(CONFIG_MX7ULP))
+#if defined(CONFIG_MX6) || defined(CONFIG_MX7ULP)
 	usb_internal_phy_clock_gate(priv->phy_addr, 1);
 	usb_phy_enable(ehci, priv->phy_addr);
 #endif
+#endif
 
 #if CONFIG_IS_ENABLED(DM_REGULATOR)
 	if (priv->vbus_supply) {
@@ -558,6 +563,7 @@ static int ehci_usb_of_to_plat(struct udevice *dev)
 
 static int mx6_parse_dt_addrs(struct udevice *dev)
 {
+#if !defined(CONFIG_PHY)
 	struct ehci_mx6_priv_data *priv = dev_get_priv(dev);
 	int phy_off, misc_off;
 	const void *blob = gd->fdt_blob;
@@ -594,7 +600,7 @@ static int mx6_parse_dt_addrs(struct udevice *dev)
 
 	priv->misc_addr = addr;
 
-#if !defined(CONFIG_PHY) && defined(CONFIG_MX6)
+#if defined(CONFIG_MX6)
 	int anatop_off;
 
 	/* Resolve ANATOP offset through USB PHY node */
@@ -607,6 +613,7 @@ static int mx6_parse_dt_addrs(struct udevice *dev)
 		return -EINVAL;
 
 	priv->anatop_addr = addr;
+#endif
 #endif
 	return 0;
 }
@@ -661,14 +668,14 @@ static int ehci_usb_probe(struct udevice *dev)
 	usb_power_config_mx6(priv->anatop_addr, priv->portnr);
 	usb_power_config_mx7(priv->misc_addr);
 	usb_power_config_mx7ulp(priv->phy_addr);
-#endif
 
 	usb_oc_config(priv->misc_addr, priv->portnr);

drivers/usb/host/ehci-mx6.c static int ehci_usb_probe(struct udevice *dev) · line 681

Quoted 10 lines
drivers/usb/host/ehci-mx6.c +2 -1
 
-#if !defined(CONFIG_PHY) && (defined(CONFIG_MX6) || defined(CONFIG_MX7ULP))
+#if defined(CONFIG_MX6) || defined(CONFIG_MX7ULP)
 	usb_internal_phy_clock_gate(priv->phy_addr, 1);
 	usb_phy_enable(ehci, priv->phy_addr);
 #endif
+#endif
 
 #if CONFIG_IS_ENABLED(DM_REGULATOR)
 	if (priv->vbus_supply) {

Tested on IMX8M Compulab IoT gate

-------------- next part --------------
A non-text attachment was scrubbed...
Name: OpenPGP_signature
Type: application/pgp-signature
Size: 840 bytes
Desc: OpenPGP digital signature
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20210428/76f0e047/attachment.sig>

#3 lore raw

PATCH 1/1 usb: ehci-mx6: Limit PHY address parsing to !CONFIG_PHY

On 4/28/21 5:13 PM, Ying-Chun Liu (PaulLiu) wrote:
[...]

Quoted 7 lines
Quoted 7 lines
drivers/usb/host/ehci-mx6.c +2 -1
-#if !defined(CONFIG_PHY) && (defined(CONFIG_MX6) || defined(CONFIG_MX7ULP))
+#if defined(CONFIG_MX6) || defined(CONFIG_MX7ULP)
  	usb_internal_phy_clock_gate(priv->phy_addr, 1);
  	usb_phy_enable(ehci, priv->phy_addr);
  #endif
+#endif
Quoted 8 lines
Quoted 2 lines
  #if CONFIG_IS_ENABLED(DM_REGULATOR)
  	if (priv->vbus_supply) {

Tested on IMX8M Compulab IoT gate

Nice, thanks.