[U-Boot] [PATCH][v2] powerpc/85xx: enable USB2 gadget mode for corenet ds board

to make USB2 worked in gadget mode, we need to set it's 'dr_mode' to 'peripheral' in hwconfig, but driver starts scan from 'usb1', it'll break if it cannot find 'usb1', so we need to tell driver do not break until it scaned all the 'usbx' that the board may have.
Signed-off-by: Shaohui Xie Shaohui.Xie@freescale.com --- changes for v2: 1. fixed a typo in title. 2. Added some details in commit.
arch/powerpc/cpu/mpc8xxx/fdt.c | 3 ++- board/freescale/corenet_ds/corenet_ds.c | 1 + include/configs/corenet_ds.h | 2 ++ 3 files changed, 5 insertions(+), 1 deletions(-)
diff --git a/arch/powerpc/cpu/mpc8xxx/fdt.c b/arch/powerpc/cpu/mpc8xxx/fdt.c index d9e3e7e..60cb210 100644 --- a/arch/powerpc/cpu/mpc8xxx/fdt.c +++ b/arch/powerpc/cpu/mpc8xxx/fdt.c @@ -164,7 +164,8 @@ void fdt_fixup_dr_usb(void *blob, bd_t *bd) if (mode_idx < 0 && phy_idx < 0) printf("WARNING: invalid phy or mode\n"); } else { - break; + if (i > CONFIG_SYS_USB_DEVICE) + break; } } if (!usb1_defined) { diff --git a/board/freescale/corenet_ds/corenet_ds.c b/board/freescale/corenet_ds/corenet_ds.c index cf9b7b8..b1e7823 100644 --- a/board/freescale/corenet_ds/corenet_ds.c +++ b/board/freescale/corenet_ds/corenet_ds.c @@ -236,6 +236,7 @@ void ft_board_setup(void *blob, bd_t *bd) #endif
fdt_fixup_liodn(blob); + fdt_fixup_dr_usb(blob, bd); }
int board_eth_init(bd_t *bis) diff --git a/include/configs/corenet_ds.h b/include/configs/corenet_ds.h index c9cc22a..2c86ba3 100644 --- a/include/configs/corenet_ds.h +++ b/include/configs/corenet_ds.h @@ -580,6 +580,8 @@ #define CONFIG_USB_EHCI_FSL #define CONFIG_EHCI_HCD_INIT_AFTER_RESET #define CONFIG_CMD_EXT2 +#define CONFIG_HAS_FSL_DR_USB +#define CONFIG_SYS_USB_DEVICE 2
#define CONFIG_MMC

Hi Kumar,
How about this patch? There is no feedback till now.
Best Regards, Shaohui Xie
-----Original Message----- From: Xie Shaohui-B21989 Sent: Monday, July 18, 2011 2:11 PM To: u-boot@lists.denx.de Cc: Gala Kumar-B11780; linux@bohmer.net; Xie Shaohui-B21989 Subject: [PATCH][v2] powerpc/85xx: enable USB2 gadget mode for corenet ds board
to make USB2 worked in gadget mode, we need to set it's 'dr_mode' to 'peripheral' in hwconfig, but driver starts scan from 'usb1', it'll break if it cannot find 'usb1', so we need to tell driver do not break until it scaned all the 'usbx' that the board may have.
Signed-off-by: Shaohui Xie Shaohui.Xie@freescale.com
changes for v2:
- fixed a typo in title.
- Added some details in commit.
arch/powerpc/cpu/mpc8xxx/fdt.c | 3 ++- board/freescale/corenet_ds/corenet_ds.c | 1 + include/configs/corenet_ds.h | 2 ++ 3 files changed, 5 insertions(+), 1 deletions(-)
diff --git a/arch/powerpc/cpu/mpc8xxx/fdt.c b/arch/powerpc/cpu/mpc8xxx/fdt.c index d9e3e7e..60cb210 100644 --- a/arch/powerpc/cpu/mpc8xxx/fdt.c +++ b/arch/powerpc/cpu/mpc8xxx/fdt.c @@ -164,7 +164,8 @@ void fdt_fixup_dr_usb(void *blob, bd_t *bd) if (mode_idx < 0 && phy_idx < 0) printf("WARNING: invalid phy or mode\n"); } else {
break;
if (i > CONFIG_SYS_USB_DEVICE)
} } if (!usb1_defined) {break;
diff --git a/board/freescale/corenet_ds/corenet_ds.c b/board/freescale/corenet_ds/corenet_ds.c index cf9b7b8..b1e7823 100644 --- a/board/freescale/corenet_ds/corenet_ds.c +++ b/board/freescale/corenet_ds/corenet_ds.c @@ -236,6 +236,7 @@ void ft_board_setup(void *blob, bd_t *bd) #endif
fdt_fixup_liodn(blob);
- fdt_fixup_dr_usb(blob, bd);
}
int board_eth_init(bd_t *bis) diff --git a/include/configs/corenet_ds.h b/include/configs/corenet_ds.h index c9cc22a..2c86ba3 100644 --- a/include/configs/corenet_ds.h +++ b/include/configs/corenet_ds.h @@ -580,6 +580,8 @@ #define CONFIG_USB_EHCI_FSL #define CONFIG_EHCI_HCD_INIT_AFTER_RESET #define CONFIG_CMD_EXT2 +#define CONFIG_HAS_FSL_DR_USB +#define CONFIG_SYS_USB_DEVICE 2
#define CONFIG_MMC
-- 1.6.4

On Jul 18, 2011, at 1:10 AM, Shaohui Xie wrote:
to make USB2 worked in gadget mode, we need to set it's 'dr_mode' to 'peripheral' in hwconfig, but driver starts scan from 'usb1', it'll break if it cannot find 'usb1', so we need to tell driver do not break until it scaned all the 'usbx' that the board may have.
Signed-off-by: Shaohui Xie Shaohui.Xie@freescale.com
changes for v2:
- fixed a typo in title.
- Added some details in commit.
arch/powerpc/cpu/mpc8xxx/fdt.c | 3 ++- board/freescale/corenet_ds/corenet_ds.c | 1 + include/configs/corenet_ds.h | 2 ++ 3 files changed, 5 insertions(+), 1 deletions(-)
diff --git a/arch/powerpc/cpu/mpc8xxx/fdt.c b/arch/powerpc/cpu/mpc8xxx/fdt.c index d9e3e7e..60cb210 100644 --- a/arch/powerpc/cpu/mpc8xxx/fdt.c +++ b/arch/powerpc/cpu/mpc8xxx/fdt.c @@ -164,7 +164,8 @@ void fdt_fixup_dr_usb(void *blob, bd_t *bd) if (mode_idx < 0 && phy_idx < 0) printf("WARNING: invalid phy or mode\n"); } else {
break;
if (i > CONFIG_SYS_USB_DEVICE)
} }break;
I still dont understand why this is needed. While we might execute the loop more times than needed, will USB_MAX_DEVICE not cover us?
if (!usb1_defined) {
- k

From: Gala Kumar-B11780 Sent: Wednesday, July 27, 2011 8:18 PM To: Xie Shaohui-B21989 Cc: u-boot@lists.denx.de Subject: Re: [U-Boot] [PATCH][v2] powerpc/85xx: enable USB2 gadget mode for corenet ds board
On Jul 18, 2011, at 1:10 AM, Shaohui Xie wrote:
to make USB2 worked in gadget mode, we need to set it's 'dr_mode' to 'peripheral' in hwconfig, but driver starts scan from 'usb1', it'll break if it cannot find 'usb1', so we need to tell driver do not break until it scaned all the 'usbx' that the board may have.
Signed-off-by: Shaohui Xie Shaohui.Xie@freescale.com
changes for v2:
- fixed a typo in title.
- Added some details in commit.
arch/powerpc/cpu/mpc8xxx/fdt.c | 3 ++- board/freescale/corenet_ds/corenet_ds.c | 1 + include/configs/corenet_ds.h | 2 ++ 3 files changed, 5 insertions(+), 1 deletions(-)
diff --git a/arch/powerpc/cpu/mpc8xxx/fdt.c b/arch/powerpc/cpu/mpc8xxx/fdt.c index d9e3e7e..60cb210 100644 --- a/arch/powerpc/cpu/mpc8xxx/fdt.c +++ b/arch/powerpc/cpu/mpc8xxx/fdt.c @@ -164,7 +164,8 @@ void fdt_fixup_dr_usb(void *blob, bd_t *bd) if (mode_idx < 0 && phy_idx < 0) printf("WARNING: invalid phy or mode\n"); } else {
break;
if (i > CONFIG_SYS_USB_DEVICE)
} }break;
I still dont understand why this is needed. While we might execute the loop more times than needed, will USB_MAX_DEVICE not cover us?
[Xie Shaohui] Yes, if we drop the 'else', the USB_MAX_DEVICE will cover our case, If you thought loop more times than needed is OK, fine with me.
Best Regards, Shaohui Xie

On Jul 27, 2011, at 9:16 PM, Xie Shaohui-B21989 wrote:
From: Gala Kumar-B11780 Sent: Wednesday, July 27, 2011 8:18 PM To: Xie Shaohui-B21989 Cc: u-boot@lists.denx.de Subject: Re: [U-Boot] [PATCH][v2] powerpc/85xx: enable USB2 gadget mode for corenet ds board
On Jul 18, 2011, at 1:10 AM, Shaohui Xie wrote:
to make USB2 worked in gadget mode, we need to set it's 'dr_mode' to 'peripheral' in hwconfig, but driver starts scan from 'usb1', it'll break if it cannot find 'usb1', so we need to tell driver do not break until it scaned all the 'usbx' that the board may have.
Signed-off-by: Shaohui Xie Shaohui.Xie@freescale.com
changes for v2:
- fixed a typo in title.
- Added some details in commit.
arch/powerpc/cpu/mpc8xxx/fdt.c | 3 ++- board/freescale/corenet_ds/corenet_ds.c | 1 + include/configs/corenet_ds.h | 2 ++ 3 files changed, 5 insertions(+), 1 deletions(-)
diff --git a/arch/powerpc/cpu/mpc8xxx/fdt.c b/arch/powerpc/cpu/mpc8xxx/fdt.c index d9e3e7e..60cb210 100644 --- a/arch/powerpc/cpu/mpc8xxx/fdt.c +++ b/arch/powerpc/cpu/mpc8xxx/fdt.c @@ -164,7 +164,8 @@ void fdt_fixup_dr_usb(void *blob, bd_t *bd) if (mode_idx < 0 && phy_idx < 0) printf("WARNING: invalid phy or mode\n"); } else {
break;
if (i > CONFIG_SYS_USB_DEVICE)
} }break;
I still dont understand why this is needed. While we might execute the loop more times than needed, will USB_MAX_DEVICE not cover us?
[Xie Shaohui] Yes, if we drop the 'else', the USB_MAX_DEVICE will cover our case, If you thought loop more times than needed is OK, fine with me.
yes, lets drop the else and setting the #define of CONFIG_SYS_USB_DEVICE
- k
participants (4)
-
Kumar Gala
-
Kumar Gala
-
Shaohui Xie
-
Xie Shaohui-B21989