All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] usb: ehci-mx6: Move fdtdec_get_alias_seq() inside the CONFIG_MX6
@ 2021-06-20 15:00 Fabio Estevam
  2021-06-20 15:00 ` [PATCH 2/2] usb: ehci-mx6: Do not fail when 'reg' is not found Fabio Estevam
  0 siblings, 1 reply; 7+ messages in thread
From: Fabio Estevam @ 2021-06-20 15:00 UTC (permalink / raw)
  To: marex; +Cc: u-boot, sbabic, ye.li, peng.fan, Fabio Estevam

On a imx7s-warp board the fdtdec_get_alias_seq() function 
always fails.

As priv->portnr is only used on i.MX6, move fdtdec_get_alias_seq()
inside the CONFIG_MX6 block.

Signed-off-by: Fabio Estevam <festevam@denx.de>
---
 drivers/usb/host/ehci-mx6.c | 15 +++++++--------
 1 file changed, 7 insertions(+), 8 deletions(-)

diff --git a/drivers/usb/host/ehci-mx6.c b/drivers/usb/host/ehci-mx6.c
index 238c93183b05..48b5c8b0c53c 100644
--- a/drivers/usb/host/ehci-mx6.c
+++ b/drivers/usb/host/ehci-mx6.c
@@ -569,7 +569,6 @@ static int mx6_parse_dt_addrs(struct udevice *dev)
 	const void *blob = gd->fdt_blob;
 	int offset = dev_of_offset(dev);
 	void *__iomem addr;
-	int ret, devnump;
 
 	phy_off = fdtdec_lookup_phandle(blob, offset, "fsl,usbphy");
 	if (phy_off < 0) {
@@ -578,11 +577,6 @@ static int mx6_parse_dt_addrs(struct udevice *dev)
 			return -EINVAL;
 	}
 
-	ret = fdtdec_get_alias_seq(blob, dev->uclass->uc_drv->name,
-				   phy_off, &devnump);
-	if (ret < 0)
-		return ret;
-
 	misc_off = fdtdec_lookup_phandle(blob, offset, "fsl,usbmisc");
 	if (misc_off < 0)
 		return -EINVAL;
@@ -592,7 +586,6 @@ static int mx6_parse_dt_addrs(struct udevice *dev)
 		return -EINVAL;
 
 	priv->phy_addr = addr;
-	priv->portnr = devnump;
 
 	addr = (void __iomem *)fdtdec_get_addr(blob, misc_off, "reg");
 	if ((fdt_addr_t)addr == FDT_ADDR_T_NONE)
@@ -601,7 +594,13 @@ static int mx6_parse_dt_addrs(struct udevice *dev)
 	priv->misc_addr = addr;
 
 #if defined(CONFIG_MX6)
-	int anatop_off;
+	int anatop_off, ret, devnump;
+
+	ret = fdtdec_get_alias_seq(blob, dev->uclass->uc_drv->name,
+				   phy_off, &devnump);
+	if (ret < 0)
+		return ret;
+	priv->portnr = devnump;
 
 	/* Resolve ANATOP offset through USB PHY node */
 	anatop_off = fdtdec_lookup_phandle(blob, phy_off, "fsl,anatop");
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 2/2] usb: ehci-mx6: Do not fail when 'reg' is not found
  2021-06-20 15:00 [PATCH 1/2] usb: ehci-mx6: Move fdtdec_get_alias_seq() inside the CONFIG_MX6 Fabio Estevam
@ 2021-06-20 15:00 ` Fabio Estevam
  2021-06-20 16:01   ` Pierre-Jean Texier
  2021-06-20 20:11   ` Marek Vasut
  0 siblings, 2 replies; 7+ messages in thread
From: Fabio Estevam @ 2021-06-20 15:00 UTC (permalink / raw)
  To: marex; +Cc: u-boot, sbabic, ye.li, peng.fan, Fabio Estevam

Unlike imx6, on imx7 the USB PHY is described as:

	usbphynop1: usbphynop1 {
		compatible = "usb-nop-xceiv";
		clocks = <&clks IMX7D_USB_PHY1_CLK>;
		clock-names = "main_clk";
		#phy-cells = <0>;
	};
	
which does not have the 'reg' property.

Do not return an error when the 'reg' property is not found
for the USB PHY.

This fixes USB gadget regression on a imx7s-warp board.

Successfully tested the "ums 0 mmc 0" command on two boards:
imx7s-warp and imx6dl-pico-pi.

Signed-off-by: Fabio Estevam <festevam@denx.de>
---
 drivers/usb/host/ehci-mx6.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/usb/host/ehci-mx6.c b/drivers/usb/host/ehci-mx6.c
index 48b5c8b0c53c..c3e4170513ec 100644
--- a/drivers/usb/host/ehci-mx6.c
+++ b/drivers/usb/host/ehci-mx6.c
@@ -583,7 +583,7 @@ static int mx6_parse_dt_addrs(struct udevice *dev)
 
 	addr = (void __iomem *)fdtdec_get_addr(blob, phy_off, "reg");
 	if ((fdt_addr_t)addr == FDT_ADDR_T_NONE)
-		return -EINVAL;
+		addr = NULL;
 
 	priv->phy_addr = addr;
 
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH 2/2] usb: ehci-mx6: Do not fail when 'reg' is not found
  2021-06-20 15:00 ` [PATCH 2/2] usb: ehci-mx6: Do not fail when 'reg' is not found Fabio Estevam
@ 2021-06-20 16:01   ` Pierre-Jean Texier
  2021-06-20 16:28     ` Fabio Estevam
  2021-06-20 20:11   ` Marek Vasut
  1 sibling, 1 reply; 7+ messages in thread
From: Pierre-Jean Texier @ 2021-06-20 16:01 UTC (permalink / raw)
  To: Fabio Estevam; +Cc: marex, u-boot, sbabic, ye.li, peng.fan

Hi Fabio,

Le 20/06/2021 à 17:00, Fabio Estevam a écrit :
> Unlike imx6, on imx7 the USB PHY is described as:
> 
> 	usbphynop1: usbphynop1 {
> 		compatible = "usb-nop-xceiv";
> 		clocks = <&clks IMX7D_USB_PHY1_CLK>;
> 		clock-names = "main_clk";
> 		#phy-cells = <0>;
> 	};
> 	
> which does not have the 'reg' property.
> 
> Do not return an error when the 'reg' property is not found
> for the USB PHY.
> 
> This fixes USB gadget regression on a imx7s-warp board.
> 
> Successfully tested the "ums 0 mmc 0" command on two boards:
> imx7s-warp and imx6dl-pico-pi.
> 
> Signed-off-by: Fabio Estevam <festevam@denx.de>

Thanks for the fix.

Successfully tested on two boards:
  - imx7s-warp,
  - imx7d-pico-pi

Tested-by: Pierre-Jean Texier <texier.pj2@gmail.com>

> ---
>   drivers/usb/host/ehci-mx6.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/usb/host/ehci-mx6.c b/drivers/usb/host/ehci-mx6.c
> index 48b5c8b0c53c..c3e4170513ec 100644
> --- a/drivers/usb/host/ehci-mx6.c
> +++ b/drivers/usb/host/ehci-mx6.c
> @@ -583,7 +583,7 @@ static int mx6_parse_dt_addrs(struct udevice *dev)
>   
>   	addr = (void __iomem *)fdtdec_get_addr(blob, phy_off, "reg");
>   	if ((fdt_addr_t)addr == FDT_ADDR_T_NONE)
> -		return -EINVAL;
> +		addr = NULL;
>   
>   	priv->phy_addr = addr;
>   
> 

Regards,
-- 
Pierre-Jean Texier

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 2/2] usb: ehci-mx6: Do not fail when 'reg' is not found
  2021-06-20 16:01   ` Pierre-Jean Texier
@ 2021-06-20 16:28     ` Fabio Estevam
  2021-06-20 16:40       ` Pierre-Jean Texier
  0 siblings, 1 reply; 7+ messages in thread
From: Fabio Estevam @ 2021-06-20 16:28 UTC (permalink / raw)
  To: Pierre-Jean Texier; +Cc: marex, u-boot, sbabic, ye.li, peng.fan

Hi Pierre-Jean,

On 20/06/2021 13:01, Pierre-Jean Texier wrote:

> Thanks for the fix.
> 
> Successfully tested on two boards:
>  - imx7s-warp,
>  - imx7d-pico-pi
> 
> Tested-by: Pierre-Jean Texier <texier.pj2@gmail.com>

Thanks for testing.

As you tested on the imx7s-warp board, you probably
noticed a 'slowdown' related to the MMC.

I have sent a revert to restore the original MMC behavior:
https://lore.kernel.org/u-boot/AM0PR04MB5283657FEFD76E04A8BA3F7B90369@AM0PR04MB5283.eurprd04.prod.outlook.com/T/#t

If this patch helps on your test, could you please send
a Tested-by tag for this one too?

Thanks,

Fabio Estevam

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 2/2] usb: ehci-mx6: Do not fail when 'reg' is not found
  2021-06-20 16:28     ` Fabio Estevam
@ 2021-06-20 16:40       ` Pierre-Jean Texier
  0 siblings, 0 replies; 7+ messages in thread
From: Pierre-Jean Texier @ 2021-06-20 16:40 UTC (permalink / raw)
  To: Fabio Estevam; +Cc: marex, u-boot, sbabic, ye.li, peng.fan

Fabio,

Le 20/06/2021 à 18:28, Fabio Estevam a écrit :
> Hi Pierre-Jean,
> 
> On 20/06/2021 13:01, Pierre-Jean Texier wrote:
> 
>> Thanks for the fix.
>>
>> Successfully tested on two boards:
>>  - imx7s-warp,
>>  - imx7d-pico-pi
>>
>> Tested-by: Pierre-Jean Texier <texier.pj2@gmail.com>
> 
> Thanks for testing.
> 
> As you tested on the imx7s-warp board, you probably
> noticed a 'slowdown' related to the MMC.

Yes indeed, I noticed this issue.

> 
> I have sent a revert to restore the original MMC behavior:
> https://lore.kernel.org/u-boot/AM0PR04MB5283657FEFD76E04A8BA3F7B90369@AM0PR04MB5283.eurprd04.prod.outlook.com/T/#t 
> 
> 
> If this patch helps on your test, could you please send
> a Tested-by tag for this one too?

Sure, will do ;)

Thanks,
-- 
Pierre-Jean Texier

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 2/2] usb: ehci-mx6: Do not fail when 'reg' is not found
  2021-06-20 15:00 ` [PATCH 2/2] usb: ehci-mx6: Do not fail when 'reg' is not found Fabio Estevam
  2021-06-20 16:01   ` Pierre-Jean Texier
@ 2021-06-20 20:11   ` Marek Vasut
  2021-06-20 20:50     ` Fabio Estevam
  1 sibling, 1 reply; 7+ messages in thread
From: Marek Vasut @ 2021-06-20 20:11 UTC (permalink / raw)
  To: Fabio Estevam; +Cc: u-boot, sbabic, ye.li, peng.fan

On 6/20/21 5:00 PM, Fabio Estevam wrote:
> Unlike imx6, on imx7 the USB PHY is described as:
> 
> 	usbphynop1: usbphynop1 {
> 		compatible = "usb-nop-xceiv";
> 		clocks = <&clks IMX7D_USB_PHY1_CLK>;
> 		clock-names = "main_clk";
> 		#phy-cells = <0>;
> 	};
> 	
> which does not have the 'reg' property.
> 
> Do not return an error when the 'reg' property is not found
> for the USB PHY.
> 
> This fixes USB gadget regression on a imx7s-warp board.
> 
> Successfully tested the "ums 0 mmc 0" command on two boards:
> imx7s-warp and imx6dl-pico-pi.
> 
> Signed-off-by: Fabio Estevam <festevam@denx.de>
> ---
>   drivers/usb/host/ehci-mx6.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/usb/host/ehci-mx6.c b/drivers/usb/host/ehci-mx6.c
> index 48b5c8b0c53c..c3e4170513ec 100644
> --- a/drivers/usb/host/ehci-mx6.c
> +++ b/drivers/usb/host/ehci-mx6.c
> @@ -583,7 +583,7 @@ static int mx6_parse_dt_addrs(struct udevice *dev)
>   
>   	addr = (void __iomem *)fdtdec_get_addr(blob, phy_off, "reg");
>   	if ((fdt_addr_t)addr == FDT_ADDR_T_NONE)
> -		return -EINVAL;
> +		addr = NULL;
>   
>   	priv->phy_addr = addr;

I applied both, but this looks very much like mx8mm which also uses 
nop-phy . So I think what would be even nicer is if you could try and 
enable CONFIG_PHY , patch the DT to specify phys = <&usbphynop1>; 
instead of fsl,usbphy = <&usbphynop1>; and see whether that works. You 
can have a look at how the usb was enabled on the verdin board.

Maybe then we can get rid of some of those ifdefs and switch to generic 
EHCI PHY etc.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 2/2] usb: ehci-mx6: Do not fail when 'reg' is not found
  2021-06-20 20:11   ` Marek Vasut
@ 2021-06-20 20:50     ` Fabio Estevam
  0 siblings, 0 replies; 7+ messages in thread
From: Fabio Estevam @ 2021-06-20 20:50 UTC (permalink / raw)
  To: Marek Vasut; +Cc: Fabio Estevam, U-Boot-Denx, Stefano Babic, Ye Li, Peng Fan

Hi Marek,

On Sun, Jun 20, 2021 at 5:11 PM Marek Vasut <marex@denx.de> wrote:

> I applied both, but this looks very much like mx8mm which also uses
> nop-phy . So I think what would be even nicer is if you could try and
> enable CONFIG_PHY , patch the DT to specify phys = <&usbphynop1>;
> instead of fsl,usbphy = <&usbphynop1>; and see whether that works. You
> can have a look at how the usb was enabled on the verdin board.
>
> Maybe then we can get rid of some of those ifdefs and switch to generic
> EHCI PHY etc.

I will follow these suggestions after 2021.07 is out, thanks.

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2021-06-21 16:54 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-20 15:00 [PATCH 1/2] usb: ehci-mx6: Move fdtdec_get_alias_seq() inside the CONFIG_MX6 Fabio Estevam
2021-06-20 15:00 ` [PATCH 2/2] usb: ehci-mx6: Do not fail when 'reg' is not found Fabio Estevam
2021-06-20 16:01   ` Pierre-Jean Texier
2021-06-20 16:28     ` Fabio Estevam
2021-06-20 16:40       ` Pierre-Jean Texier
2021-06-20 20:11   ` Marek Vasut
2021-06-20 20:50     ` Fabio Estevam

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.