* [U-Boot] [PATCH 1/5] imx:mx6sxsabresd add usb support
2014-11-01 2:19 [U-Boot] [PATCH 0/5] add usb support for mx6 board Peng Fan
@ 2014-11-01 2:19 ` Peng Fan
2014-11-01 7:45 ` Li Ye-B37916
` (2 more replies)
2014-11-01 2:19 ` [U-Boot] [PATCH 2/5] imx:mx6slevk " Peng Fan
` (3 subsequent siblings)
4 siblings, 3 replies; 14+ messages in thread
From: Peng Fan @ 2014-11-01 2:19 UTC (permalink / raw)
To: u-boot
Add usb support for mx6sxsabresd board.
Signed-off-by: Peng Fan <Peng.Fan@freescale.com>
Signed-off-by: Ye.Li <B37916@freescale.com>
---
board/freescale/mx6sxsabresd/mx6sxsabresd.c | 29 +++++++++++++++++++++++++++++
include/configs/mx6sxsabresd.h | 14 ++++++++++++++
2 files changed, 43 insertions(+)
diff --git a/board/freescale/mx6sxsabresd/mx6sxsabresd.c b/board/freescale/mx6sxsabresd/mx6sxsabresd.c
index 256ea29..016b8e8 100644
--- a/board/freescale/mx6sxsabresd/mx6sxsabresd.c
+++ b/board/freescale/mx6sxsabresd/mx6sxsabresd.c
@@ -296,3 +296,32 @@ int checkboard(void)
return 0;
}
+
+#ifdef CONFIG_USB_EHCI_MX6
+iomux_v3_cfg_t const usb_otg1_pads[] = {
+ MX6_PAD_GPIO1_IO09__USB_OTG1_PWR | MUX_PAD_CTRL(NO_PAD_CTRL),
+ MX6_PAD_GPIO1_IO10__ANATOP_OTG1_ID | MUX_PAD_CTRL(NO_PAD_CTRL)
+};
+
+iomux_v3_cfg_t const usb_otg2_pads[] = {
+ MX6_PAD_GPIO1_IO12__USB_OTG2_PWR | MUX_PAD_CTRL(NO_PAD_CTRL),
+};
+
+int board_ehci_hcd_init(int port)
+{
+ switch (port) {
+ case 0:
+ imx_iomux_v3_setup_multiple_pads(usb_otg1_pads,
+ ARRAY_SIZE(usb_otg1_pads));
+ break;
+ case 1:
+ imx_iomux_v3_setup_multiple_pads(usb_otg2_pads,
+ ARRAY_SIZE(usb_otg2_pads));
+ break;
+ default:
+ printf("MXC USB port %d not yet supported\n", port);
+ return 1;
+ }
+ return 0;
+}
+#endif
diff --git a/include/configs/mx6sxsabresd.h b/include/configs/mx6sxsabresd.h
index e02ea18..8edf187 100644
--- a/include/configs/mx6sxsabresd.h
+++ b/include/configs/mx6sxsabresd.h
@@ -198,6 +198,20 @@
#define CONFIG_PHYLIB
#define CONFIG_PHY_ATHEROS
+
+#define CONFIG_CMD_USB
+#ifdef CONFIG_CMD_USB
+#define CONFIG_USB_EHCI
+#define CONFIG_USB_EHCI_MX6
+#define CONFIG_USB_STORAGE
+#define CONFIG_EHCI_HCD_INIT_AFTER_RESET
+#define CONFIG_USB_HOST_ETHER
+#define CONFIG_USB_ETHER_ASIX
+#define CONFIG_MXC_USB_PORTSC (PORT_PTS_UTMI | PORT_PTS_PTW)
+#define CONFIG_MXC_USB_FLAGS 0
+#define CONFIG_USB_MAX_CONTROLLER_COUNT 2
+#endif
+
#define CONFIG_CMD_PCI
#ifdef CONFIG_CMD_PCI
#define CONFIG_PCI
--
1.8.4.5
^ permalink raw reply related [flat|nested] 14+ messages in thread* [U-Boot] [PATCH 1/5] imx:mx6sxsabresd add usb support
2014-11-01 2:19 ` [U-Boot] [PATCH 1/5] imx:mx6sxsabresd add usb support Peng Fan
@ 2014-11-01 7:45 ` Li Ye-B37916
2014-11-01 13:45 ` Fabio Estevam
2014-11-03 12:28 ` Stefano Babic
2 siblings, 0 replies; 14+ messages in thread
From: Li Ye-B37916 @ 2014-11-01 7:45 UTC (permalink / raw)
To: u-boot
Hi Peng,
On 11/1/2014 10:19 AM, Peng Fan wrote:
> Add usb support for mx6sxsabresd board.
>
> Signed-off-by: Peng Fan <Peng.Fan@freescale.com>
> Signed-off-by: Ye.Li <B37916@freescale.com>
> ---
> board/freescale/mx6sxsabresd/mx6sxsabresd.c | 29 +++++++++++++++++++++++++++++
> include/configs/mx6sxsabresd.h | 14 ++++++++++++++
> 2 files changed, 43 insertions(+)
>
> diff --git a/board/freescale/mx6sxsabresd/mx6sxsabresd.c b/board/freescale/mx6sxsabresd/mx6sxsabresd.c
> index 256ea29..016b8e8 100644
> --- a/board/freescale/mx6sxsabresd/mx6sxsabresd.c
> +++ b/board/freescale/mx6sxsabresd/mx6sxsabresd.c
> @@ -296,3 +296,32 @@ int checkboard(void)
>
> return 0;
> }
> +
> +#ifdef CONFIG_USB_EHCI_MX6
> +iomux_v3_cfg_t const usb_otg1_pads[] = {
> + MX6_PAD_GPIO1_IO09__USB_OTG1_PWR | MUX_PAD_CTRL(NO_PAD_CTRL),
> + MX6_PAD_GPIO1_IO10__ANATOP_OTG1_ID | MUX_PAD_CTRL(NO_PAD_CTRL)
> +};
> +
> +iomux_v3_cfg_t const usb_otg2_pads[] = {
> + MX6_PAD_GPIO1_IO12__USB_OTG2_PWR | MUX_PAD_CTRL(NO_PAD_CTRL),
> +};
> +
> +int board_ehci_hcd_init(int port)
> +{
> + switch (port) {
> + case 0:
> + imx_iomux_v3_setup_multiple_pads(usb_otg1_pads,
> + ARRAY_SIZE(usb_otg1_pads));
> + break;
> + case 1:
> + imx_iomux_v3_setup_multiple_pads(usb_otg2_pads,
> + ARRAY_SIZE(usb_otg2_pads));
> + break;
> + default:
> + printf("MXC USB port %d not yet supported\n", port);
> + return 1;
> + }
> + return 0;
> +}
> +#endif
> diff --git a/include/configs/mx6sxsabresd.h b/include/configs/mx6sxsabresd.h
> index e02ea18..8edf187 100644
> --- a/include/configs/mx6sxsabresd.h
> +++ b/include/configs/mx6sxsabresd.h
> @@ -198,6 +198,20 @@
> #define CONFIG_PHYLIB
> #define CONFIG_PHY_ATHEROS
>
> +
> +#define CONFIG_CMD_USB
> +#ifdef CONFIG_CMD_USB
> +#define CONFIG_USB_EHCI
> +#define CONFIG_USB_EHCI_MX6
> +#define CONFIG_USB_STORAGE
> +#define CONFIG_EHCI_HCD_INIT_AFTER_RESET
> +#define CONFIG_USB_HOST_ETHER
> +#define CONFIG_USB_ETHER_ASIX
> +#define CONFIG_MXC_USB_PORTSC (PORT_PTS_UTMI | PORT_PTS_PTW)
> +#define CONFIG_MXC_USB_FLAGS 0
> +#define CONFIG_USB_MAX_CONTROLLER_COUNT 2
> +#endif
> +
> #define CONFIG_CMD_PCI
> #ifdef CONFIG_CMD_PCI
> #define CONFIG_PCI
The OTG power polarity setting in ehci-imx6 driver is opposed with the board design. So without changing the polarity setting, we have to use GPIO to control the power switch.
Best regards,
Ye Li
^ permalink raw reply [flat|nested] 14+ messages in thread* [U-Boot] [PATCH 1/5] imx:mx6sxsabresd add usb support
2014-11-01 2:19 ` [U-Boot] [PATCH 1/5] imx:mx6sxsabresd add usb support Peng Fan
2014-11-01 7:45 ` Li Ye-B37916
@ 2014-11-01 13:45 ` Fabio Estevam
2014-11-03 12:28 ` Stefano Babic
2 siblings, 0 replies; 14+ messages in thread
From: Fabio Estevam @ 2014-11-01 13:45 UTC (permalink / raw)
To: u-boot
On Sat, Nov 1, 2014 at 12:19 AM, Peng Fan <Peng.Fan@freescale.com> wrote:
> Add usb support for mx6sxsabresd board.
>
> Signed-off-by: Peng Fan <Peng.Fan@freescale.com>
> Signed-off-by: Ye.Li <B37916@freescale.com>
> ---
> board/freescale/mx6sxsabresd/mx6sxsabresd.c | 29 +++++++++++++++++++++++++++++
> include/configs/mx6sxsabresd.h | 14 ++++++++++++++
> 2 files changed, 43 insertions(+)
>
> diff --git a/board/freescale/mx6sxsabresd/mx6sxsabresd.c b/board/freescale/mx6sxsabresd/mx6sxsabresd.c
> index 256ea29..016b8e8 100644
> --- a/board/freescale/mx6sxsabresd/mx6sxsabresd.c
> +++ b/board/freescale/mx6sxsabresd/mx6sxsabresd.c
> @@ -296,3 +296,32 @@ int checkboard(void)
>
> return 0;
> }
> +
> +#ifdef CONFIG_USB_EHCI_MX6
> +iomux_v3_cfg_t const usb_otg1_pads[] = {
> + MX6_PAD_GPIO1_IO09__USB_OTG1_PWR | MUX_PAD_CTRL(NO_PAD_CTRL),
> + MX6_PAD_GPIO1_IO10__ANATOP_OTG1_ID | MUX_PAD_CTRL(NO_PAD_CTRL)
> +};
> +
> +iomux_v3_cfg_t const usb_otg2_pads[] = {
> + MX6_PAD_GPIO1_IO12__USB_OTG2_PWR | MUX_PAD_CTRL(NO_PAD_CTRL),
> +};
Please make both 'static'
> +
> +int board_ehci_hcd_init(int port)
> +{
> + switch (port) {
> + case 0:
> + imx_iomux_v3_setup_multiple_pads(usb_otg1_pads,
> + ARRAY_SIZE(usb_otg1_pads));
> + break;
> + case 1:
> + imx_iomux_v3_setup_multiple_pads(usb_otg2_pads,
> + ARRAY_SIZE(usb_otg2_pads));
> + break;
> + default:
> + printf("MXC USB port %d not yet supported\n", port);
> + return 1;
> + }
Please return -EINVAL.
^ permalink raw reply [flat|nested] 14+ messages in thread* [U-Boot] [PATCH 1/5] imx:mx6sxsabresd add usb support
2014-11-01 2:19 ` [U-Boot] [PATCH 1/5] imx:mx6sxsabresd add usb support Peng Fan
2014-11-01 7:45 ` Li Ye-B37916
2014-11-01 13:45 ` Fabio Estevam
@ 2014-11-03 12:28 ` Stefano Babic
2014-11-03 13:32 ` Peng Fan
2 siblings, 1 reply; 14+ messages in thread
From: Stefano Babic @ 2014-11-03 12:28 UTC (permalink / raw)
To: u-boot
Hi Peng,
On 01/11/2014 03:19, Peng Fan wrote:
> Add usb support for mx6sxsabresd board.
>
> Signed-off-by: Peng Fan <Peng.Fan@freescale.com>
> Signed-off-by: Ye.Li <B37916@freescale.com>
> ---
> board/freescale/mx6sxsabresd/mx6sxsabresd.c | 29 +++++++++++++++++++++++++++++
> include/configs/mx6sxsabresd.h | 14 ++++++++++++++
> 2 files changed, 43 insertions(+)
>
> diff --git a/board/freescale/mx6sxsabresd/mx6sxsabresd.c b/board/freescale/mx6sxsabresd/mx6sxsabresd.c
> index 256ea29..016b8e8 100644
> --- a/board/freescale/mx6sxsabresd/mx6sxsabresd.c
> +++ b/board/freescale/mx6sxsabresd/mx6sxsabresd.c
> @@ -296,3 +296,32 @@ int checkboard(void)
>
> return 0;
> }
> +
> +#ifdef CONFIG_USB_EHCI_MX6
> +iomux_v3_cfg_t const usb_otg1_pads[] = {
> + MX6_PAD_GPIO1_IO09__USB_OTG1_PWR | MUX_PAD_CTRL(NO_PAD_CTRL),
> + MX6_PAD_GPIO1_IO10__ANATOP_OTG1_ID | MUX_PAD_CTRL(NO_PAD_CTRL)
> +};
> +
> +iomux_v3_cfg_t const usb_otg2_pads[] = {
> + MX6_PAD_GPIO1_IO12__USB_OTG2_PWR | MUX_PAD_CTRL(NO_PAD_CTRL),
> +};
> +
> +int board_ehci_hcd_init(int port)
> +{
> + switch (port) {
> + case 0:
> + imx_iomux_v3_setup_multiple_pads(usb_otg1_pads,
> + ARRAY_SIZE(usb_otg1_pads));
> + break;
> + case 1:
> + imx_iomux_v3_setup_multiple_pads(usb_otg2_pads,
> + ARRAY_SIZE(usb_otg2_pads));
> + break;
> + default:
> + printf("MXC USB port %d not yet supported\n", port);
> + return 1;
> + }
> + return 0;
> +}
> +#endif
Frankly, I am expecting that this function power up the bus instead of
pin multiplexing. If the pins are reserved for USB, why should we set
the pinmux each time board_ehci_hcd_init() is called ? And, in any case,
pins are not reset after their usage for USB. You can move this setup in
board_init() or in another init function.
Best regards,
Stefano Babic
--
=====================================================================
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de
=====================================================================
^ permalink raw reply [flat|nested] 14+ messages in thread* [U-Boot] [PATCH 1/5] imx:mx6sxsabresd add usb support
2014-11-03 12:28 ` Stefano Babic
@ 2014-11-03 13:32 ` Peng Fan
0 siblings, 0 replies; 14+ messages in thread
From: Peng Fan @ 2014-11-03 13:32 UTC (permalink / raw)
To: u-boot
Hi,
? 11/3/2014 8:28 PM, Stefano Babic ??:
> Hi Peng,
>
> On 01/11/2014 03:19, Peng Fan wrote:
>> Add usb support for mx6sxsabresd board.
>>
>> Signed-off-by: Peng Fan <Peng.Fan@freescale.com>
>> Signed-off-by: Ye.Li <B37916@freescale.com>
>> ---
>> board/freescale/mx6sxsabresd/mx6sxsabresd.c | 29 +++++++++++++++++++++++++++++
>> include/configs/mx6sxsabresd.h | 14 ++++++++++++++
>> 2 files changed, 43 insertions(+)
>>
>> diff --git a/board/freescale/mx6sxsabresd/mx6sxsabresd.c b/board/freescale/mx6sxsabresd/mx6sxsabresd.c
>> index 256ea29..016b8e8 100644
>> --- a/board/freescale/mx6sxsabresd/mx6sxsabresd.c
>> +++ b/board/freescale/mx6sxsabresd/mx6sxsabresd.c
>> @@ -296,3 +296,32 @@ int checkboard(void)
>>
>> return 0;
>> }
>> +
>> +#ifdef CONFIG_USB_EHCI_MX6
>> +iomux_v3_cfg_t const usb_otg1_pads[] = {
>> + MX6_PAD_GPIO1_IO09__USB_OTG1_PWR | MUX_PAD_CTRL(NO_PAD_CTRL),
>> + MX6_PAD_GPIO1_IO10__ANATOP_OTG1_ID | MUX_PAD_CTRL(NO_PAD_CTRL)
>> +};
>> +
>> +iomux_v3_cfg_t const usb_otg2_pads[] = {
>> + MX6_PAD_GPIO1_IO12__USB_OTG2_PWR | MUX_PAD_CTRL(NO_PAD_CTRL),
>> +};
>> +
>> +int board_ehci_hcd_init(int port)
>> +{
>> + switch (port) {
>> + case 0:
>> + imx_iomux_v3_setup_multiple_pads(usb_otg1_pads,
>> + ARRAY_SIZE(usb_otg1_pads));
>> + break;
>> + case 1:
>> + imx_iomux_v3_setup_multiple_pads(usb_otg2_pads,
>> + ARRAY_SIZE(usb_otg2_pads));
>> + break;
>> + default:
>> + printf("MXC USB port %d not yet supported\n", port);
>> + return 1;
>> + }
>> + return 0;
>> +}
>> +#endif
>
> Frankly, I am expecting that this function power up the bus instead of
> pin multiplexing. If the pins are reserved for USB, why should we set
> the pinmux each time board_ehci_hcd_init() is called ? And, in any case,
> pins are not reset after their usage for USB. You can move this setup in
> board_init() or in another init function.
Because otg power problem which is pointed out by Ye Li, I'll do power
enable/disable in board_ehci_power function and move the pin settings to
board_init.
And sent patch v2.
Thanks,
Peng.
>
> Best regards,
> Stefano Babic
>
^ permalink raw reply [flat|nested] 14+ messages in thread
* [U-Boot] [PATCH 2/5] imx:mx6slevk add usb support
2014-11-01 2:19 [U-Boot] [PATCH 0/5] add usb support for mx6 board Peng Fan
2014-11-01 2:19 ` [U-Boot] [PATCH 1/5] imx:mx6sxsabresd add usb support Peng Fan
@ 2014-11-01 2:19 ` Peng Fan
2014-11-01 13:44 ` Fabio Estevam
2014-11-01 2:19 ` [U-Boot] [PATCH 3/5] arm:imx-common introduce a new function to set gpr Peng Fan
` (2 subsequent siblings)
4 siblings, 1 reply; 14+ messages in thread
From: Peng Fan @ 2014-11-01 2:19 UTC (permalink / raw)
To: u-boot
Add usb support for mx6slevk board.
Signed-off-by: Peng Fan <Peng.Fan@freescale.com>
Signed-off-by: Ye.Li <B37916@freescale.com>
---
board/freescale/mx6slevk/mx6slevk.c | 29 +++++++++++++++++++++++++++++
include/configs/mx6slevk.h | 14 ++++++++++++++
2 files changed, 43 insertions(+)
diff --git a/board/freescale/mx6slevk/mx6slevk.c b/board/freescale/mx6slevk/mx6slevk.c
index a500133..6d972e8 100644
--- a/board/freescale/mx6slevk/mx6slevk.c
+++ b/board/freescale/mx6slevk/mx6slevk.c
@@ -182,3 +182,32 @@ int checkboard(void)
return 0;
}
+
+#ifdef CONFIG_USB_EHCI_MX6
+iomux_v3_cfg_t const usb_otg1_pads[] = {
+ MX6_PAD_KEY_COL4__USB_USBOTG1_PWR | MUX_PAD_CTRL(NO_PAD_CTRL),
+ MX6_PAD_EPDC_PWRCOM__ANATOP_USBOTG1_ID | MUX_PAD_CTRL(NO_PAD_CTRL)
+};
+
+iomux_v3_cfg_t const usb_otg2_pads[] = {
+ MX6_PAD_KEY_COL5__USB_USBOTG2_PWR | MUX_PAD_CTRL(NO_PAD_CTRL),
+};
+
+int board_ehci_hcd_init(int port)
+{
+ switch (port) {
+ case 0:
+ imx_iomux_v3_setup_multiple_pads(usb_otg1_pads,
+ ARRAY_SIZE(usb_otg1_pads));
+ break;
+ case 1:
+ imx_iomux_v3_setup_multiple_pads(usb_otg2_pads,
+ ARRAY_SIZE(usb_otg2_pads));
+ break;
+ default:
+ printf("MXC USB port %d not yet supported\n", port);
+ return 1;
+ }
+ return 0;
+}
+#endif
diff --git a/include/configs/mx6slevk.h b/include/configs/mx6slevk.h
index fddedf1..021dc0e 100644
--- a/include/configs/mx6slevk.h
+++ b/include/configs/mx6slevk.h
@@ -210,4 +210,18 @@
#define CONFIG_SF_DEFAULT_MODE SPI_MODE_0
#endif
+/* USB Configs */
+#define CONFIG_CMD_USB
+#ifdef CONFIG_CMD_USB
+#define CONFIG_USB_EHCI
+#define CONFIG_USB_EHCI_MX6
+#define CONFIG_USB_STORAGE
+#define CONFIG_EHCI_HCD_INIT_AFTER_RESET
+#define CONFIG_USB_HOST_ETHER
+#define CONFIG_USB_ETHER_ASIX
+#define CONFIG_MXC_USB_PORTSC (PORT_PTS_UTMI | PORT_PTS_PTW)
+#define CONFIG_MXC_USB_FLAGS 0
+#define CONFIG_USB_MAX_CONTROLLER_COUNT 2
+#endif
+
#endif /* __CONFIG_H */
--
1.8.4.5
^ permalink raw reply related [flat|nested] 14+ messages in thread* [U-Boot] [PATCH 2/5] imx:mx6slevk add usb support
2014-11-01 2:19 ` [U-Boot] [PATCH 2/5] imx:mx6slevk " Peng Fan
@ 2014-11-01 13:44 ` Fabio Estevam
0 siblings, 0 replies; 14+ messages in thread
From: Fabio Estevam @ 2014-11-01 13:44 UTC (permalink / raw)
To: u-boot
On Sat, Nov 1, 2014 at 12:19 AM, Peng Fan <Peng.Fan@freescale.com> wrote:
> }
> +
> +#ifdef CONFIG_USB_EHCI_MX6
> +iomux_v3_cfg_t const usb_otg1_pads[] = {
> + MX6_PAD_KEY_COL4__USB_USBOTG1_PWR | MUX_PAD_CTRL(NO_PAD_CTRL),
This can be 'static'.
> +int board_ehci_hcd_init(int port)
> +{
> + switch (port) {
> + case 0:
> + imx_iomux_v3_setup_multiple_pads(usb_otg1_pads,
> + ARRAY_SIZE(usb_otg1_pads));
> + break;
> + case 1:
> + imx_iomux_v3_setup_multiple_pads(usb_otg2_pads,
> + ARRAY_SIZE(usb_otg2_pads));
> + break;
> + default:
> + printf("MXC USB port %d not yet supported\n", port);
> + return 1;
It would be better to return -EINVAL instead.
^ permalink raw reply [flat|nested] 14+ messages in thread
* [U-Boot] [PATCH 3/5] arm:imx-common introduce a new function to set gpr
2014-11-01 2:19 [U-Boot] [PATCH 0/5] add usb support for mx6 board Peng Fan
2014-11-01 2:19 ` [U-Boot] [PATCH 1/5] imx:mx6sxsabresd add usb support Peng Fan
2014-11-01 2:19 ` [U-Boot] [PATCH 2/5] imx:mx6slevk " Peng Fan
@ 2014-11-01 2:19 ` Peng Fan
2014-11-01 7:39 ` Li Ye-B37916
2014-11-01 13:44 ` Wolfgang Denk
2014-11-01 2:19 ` [U-Boot] [PATCH 4/5] imx:mx6qarm2 add usb support Peng Fan
2014-11-01 2:19 ` [U-Boot] [PATCH 5/5] imx:mx6sabresd " Peng Fan
4 siblings, 2 replies; 14+ messages in thread
From: Peng Fan @ 2014-11-01 2:19 UTC (permalink / raw)
To: u-boot
Add a new function mxc_iomux_set_gpr_register to
set the iomux gpr register.
32-bit general purpose registers according to SoC
requirements for any usage.
Signed-off-by: Peng Fan <Peng.Fan@freescale.com>
Signed-off-by: Ye.Li <B37916@freescale.com>
Signed-off-by: Nitin Garg <nitin.garg@freescale.com>
---
arch/arm/imx-common/iomux-v3.c | 25 +++++++++++++++++++++++++
1 file changed, 25 insertions(+)
diff --git a/arch/arm/imx-common/iomux-v3.c b/arch/arm/imx-common/iomux-v3.c
index 22cd11a..b27aab8 100644
--- a/arch/arm/imx-common/iomux-v3.c
+++ b/arch/arm/imx-common/iomux-v3.c
@@ -77,3 +77,28 @@ void imx_iomux_v3_setup_multiple_pads(iomux_v3_cfg_t const *pad_list,
p += stride;
}
}
+
+/*
+ * Configure the IOMUX General Purpose Registers.
+ *
+ * @group, which gpr register to configure.
+ * @start_bit, the first bit to set
+ * @num_bits, how many bits to set
+ * @value, the value will be set to [start_bits...start_bits+num_bits-1]
+ */
+void mxc_iomux_set_gpr_register(int group, int start_bit, int num_bits,
+ int value)
+{
+ int i = 0;
+ u32 reg;
+
+ reg = readl(base + group * 4);
+ while (num_bits) {
+ reg &= ~(1 << (start_bit + i));
+ i++;
+ num_bits--;
+ }
+
+ reg |= (value << start_bit);
+ writel(reg, base + group * 4);
+}
--
1.8.4.5
^ permalink raw reply related [flat|nested] 14+ messages in thread* [U-Boot] [PATCH 3/5] arm:imx-common introduce a new function to set gpr
2014-11-01 2:19 ` [U-Boot] [PATCH 3/5] arm:imx-common introduce a new function to set gpr Peng Fan
@ 2014-11-01 7:39 ` Li Ye-B37916
2014-11-01 10:49 ` Peng Fan
2014-11-01 13:44 ` Wolfgang Denk
1 sibling, 1 reply; 14+ messages in thread
From: Li Ye-B37916 @ 2014-11-01 7:39 UTC (permalink / raw)
To: u-boot
Hi Peng,
On 11/1/2014 10:19 AM, Peng Fan wrote:
> Add a new function mxc_iomux_set_gpr_register to
> set the iomux gpr register.
>
> 32-bit general purpose registers according to SoC
> requirements for any usage.
>
> Signed-off-by: Peng Fan <Peng.Fan@freescale.com>
> Signed-off-by: Ye.Li <B37916@freescale.com>
> Signed-off-by: Nitin Garg <nitin.garg@freescale.com>
> ---
> arch/arm/imx-common/iomux-v3.c | 25 +++++++++++++++++++++++++
> 1 file changed, 25 insertions(+)
>
> diff --git a/arch/arm/imx-common/iomux-v3.c b/arch/arm/imx-common/iomux-v3.c
> index 22cd11a..b27aab8 100644
> --- a/arch/arm/imx-common/iomux-v3.c
> +++ b/arch/arm/imx-common/iomux-v3.c
> @@ -77,3 +77,28 @@ void imx_iomux_v3_setup_multiple_pads(iomux_v3_cfg_t const *pad_list,
> p += stride;
> }
> }
> +
> +/*
> + * Configure the IOMUX General Purpose Registers.
> + *
> + * @group, which gpr register to configure.
> + * @start_bit, the first bit to set
> + * @num_bits, how many bits to set
> + * @value, the value will be set to [start_bits...start_bits+num_bits-1]
> + */
> +void mxc_iomux_set_gpr_register(int group, int start_bit, int num_bits,
> + int value)
> +{
> + int i = 0;
> + u32 reg;
> +
> + reg = readl(base + group * 4);
> + while (num_bits) {
> + reg &= ~(1 << (start_bit + i));
> + i++;
> + num_bits--;
> + }
> +
> + reg |= (value << start_bit);
> + writel(reg, base + group * 4);
> +}
This function is already in my previous patch (http://patchwork.ozlabs.org/patch/405013/). The function name is changed to imx_iomux_set_gpr_register.
Best regards,
Ye Li
^ permalink raw reply [flat|nested] 14+ messages in thread* [U-Boot] [PATCH 3/5] arm:imx-common introduce a new function to set gpr
2014-11-01 7:39 ` Li Ye-B37916
@ 2014-11-01 10:49 ` Peng Fan
0 siblings, 0 replies; 14+ messages in thread
From: Peng Fan @ 2014-11-01 10:49 UTC (permalink / raw)
To: u-boot
On 11/01/2014 03:39 PM, Li Ye-B37916 wrote:
> Hi Peng,
>
>
>
> On 11/1/2014 10:19 AM, Peng Fan wrote:
>> Add a new function mxc_iomux_set_gpr_register to
>> set the iomux gpr register.
>>
>> 32-bit general purpose registers according to SoC
>> requirements for any usage.
>>
>> Signed-off-by: Peng Fan <Peng.Fan@freescale.com>
>> Signed-off-by: Ye.Li <B37916@freescale.com>
>> Signed-off-by: Nitin Garg <nitin.garg@freescale.com>
>> ---
>> arch/arm/imx-common/iomux-v3.c | 25 +++++++++++++++++++++++++
>> 1 file changed, 25 insertions(+)
>>
>> diff --git a/arch/arm/imx-common/iomux-v3.c b/arch/arm/imx-common/iomux-v3.c
>> index 22cd11a..b27aab8 100644
>> --- a/arch/arm/imx-common/iomux-v3.c
>> +++ b/arch/arm/imx-common/iomux-v3.c
>> @@ -77,3 +77,28 @@ void imx_iomux_v3_setup_multiple_pads(iomux_v3_cfg_t const *pad_list,
>> p += stride;
>> }
>> }
>> +
>> +/*
>> + * Configure the IOMUX General Purpose Registers.
>> + *
>> + * @group, which gpr register to configure.
>> + * @start_bit, the first bit to set
>> + * @num_bits, how many bits to set
>> + * @value, the value will be set to [start_bits...start_bits+num_bits-1]
>> + */
>> +void mxc_iomux_set_gpr_register(int group, int start_bit, int num_bits,
>> + int value)
>> +{
>> + int i = 0;
>> + u32 reg;
>> +
>> + reg = readl(base + group * 4);
>> + while (num_bits) {
>> + reg &= ~(1 << (start_bit + i));
>> + i++;
>> + num_bits--;
>> + }
>> +
>> + reg |= (value << start_bit);
>> + writel(reg, base + group * 4);
>> +}
> This function is already in my previous patch (http://patchwork.ozlabs.org/patch/405013/). The function name is changed to imx_iomux_set_gpr_register.
>
oh. I missed this piece of code.
Then please ignore this patch set. Sorry for troubles.
Regards,
Peng.
>
>
> Best regards,
>
> Ye Li
>
>
^ permalink raw reply [flat|nested] 14+ messages in thread
* [U-Boot] [PATCH 3/5] arm:imx-common introduce a new function to set gpr
2014-11-01 2:19 ` [U-Boot] [PATCH 3/5] arm:imx-common introduce a new function to set gpr Peng Fan
2014-11-01 7:39 ` Li Ye-B37916
@ 2014-11-01 13:44 ` Wolfgang Denk
1 sibling, 0 replies; 14+ messages in thread
From: Wolfgang Denk @ 2014-11-01 13:44 UTC (permalink / raw)
To: u-boot
Dear Peng Fan,
In message <1414808359-4750-4-git-send-email-Peng.Fan@freescale.com> you wrote:
> Add a new function mxc_iomux_set_gpr_register to
> set the iomux gpr register.
>
> 32-bit general purpose registers according to SoC
> requirements for any usage.
...
> +/*
> + * Configure the IOMUX General Purpose Registers.
> + *
> + * @group, which gpr register to configure.
> + * @start_bit, the first bit to set
> + * @num_bits, how many bits to set
> + * @value, the value will be set to [start_bits...start_bits+num_bits-1]
> + */
Can you please rework the API and use a mask instead of counting
bits? Relying on bit numbers is error prone and inherently
non-portable.
Use the standard register access macros (like setbits, clrbits,
clrsetbits) as example, please.
Best regards,
Wolfgang Denk
--
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
All I ask is a chance to prove that money can't make me happy.
^ permalink raw reply [flat|nested] 14+ messages in thread
* [U-Boot] [PATCH 4/5] imx:mx6qarm2 add usb support
2014-11-01 2:19 [U-Boot] [PATCH 0/5] add usb support for mx6 board Peng Fan
` (2 preceding siblings ...)
2014-11-01 2:19 ` [U-Boot] [PATCH 3/5] arm:imx-common introduce a new function to set gpr Peng Fan
@ 2014-11-01 2:19 ` Peng Fan
2014-11-01 2:19 ` [U-Boot] [PATCH 5/5] imx:mx6sabresd " Peng Fan
4 siblings, 0 replies; 14+ messages in thread
From: Peng Fan @ 2014-11-01 2:19 UTC (permalink / raw)
To: u-boot
Add usb support for mx6qarm2 board.
Signed-off-by: Peng Fan <Peng.Fan@freescale.com>
Signed-off-by: Ye.Li <B37916@freescale.com>
---
board/freescale/mx6qarm2/mx6qarm2.c | 27 +++++++++++++++++++++++++++
include/configs/mx6qarm2.h | 14 ++++++++++++++
2 files changed, 41 insertions(+)
diff --git a/board/freescale/mx6qarm2/mx6qarm2.c b/board/freescale/mx6qarm2/mx6qarm2.c
index 667dca5..3108750 100644
--- a/board/freescale/mx6qarm2/mx6qarm2.c
+++ b/board/freescale/mx6qarm2/mx6qarm2.c
@@ -237,3 +237,30 @@ int checkboard(void)
return 0;
}
+
+#ifdef CONFIG_USB_EHCI_MX6
+iomux_v3_cfg_t const usb_otg_pads[] = {
+ MX6_PAD_EIM_D22__USB_OTG_PWR | MUX_PAD_CTRL(NO_PAD_CTRL),
+ MX6_PAD_GPIO_1__USB_OTG_ID | MUX_PAD_CTRL(NO_PAD_CTRL),
+};
+
+int board_ehci_hcd_init(int port)
+{
+ switch (port) {
+ case 0:
+ imx_iomux_v3_setup_multiple_pads(usb_otg_pads,
+ ARRAY_SIZE(usb_otg_pads));
+
+ /*
+ * set daisy chain for otg_pin_id on 6q.
+ * for 6dl, this bit is reserved
+ */
+ mxc_iomux_set_gpr_register(1, 13, 1, 1);
+ break;
+ default:
+ printf("MXC USB port %d not yet supported\n", port);
+ return 1;
+ }
+ return 0;
+}
+#endif
diff --git a/include/configs/mx6qarm2.h b/include/configs/mx6qarm2.h
index 6e01fa0..76cfef1 100644
--- a/include/configs/mx6qarm2.h
+++ b/include/configs/mx6qarm2.h
@@ -189,4 +189,18 @@
#define CONFIG_OF_LIBFDT
#define CONFIG_CMD_BOOTZ
+/* USB Configs */
+#define CONFIG_CMD_USB
+#ifdef CONFIG_CMD_USB
+#define CONFIG_USB_EHCI
+#define CONFIG_USB_EHCI_MX6
+#define CONFIG_USB_STORAGE
+#define CONFIG_EHCI_HCD_INIT_AFTER_RESET
+#define CONFIG_USB_HOST_ETHER
+#define CONFIG_USB_ETHER_ASIX
+#define CONFIG_MXC_USB_PORTSC (PORT_PTS_UTMI | PORT_PTS_PTW)
+#define CONFIG_MXC_USB_FLAGS 0
+#define CONFIG_USB_MAX_CONTROLLER_COUNT 1
+#endif
+
#endif /* __CONFIG_H */
--
1.8.4.5
^ permalink raw reply related [flat|nested] 14+ messages in thread* [U-Boot] [PATCH 5/5] imx:mx6sabresd add usb support
2014-11-01 2:19 [U-Boot] [PATCH 0/5] add usb support for mx6 board Peng Fan
` (3 preceding siblings ...)
2014-11-01 2:19 ` [U-Boot] [PATCH 4/5] imx:mx6qarm2 add usb support Peng Fan
@ 2014-11-01 2:19 ` Peng Fan
4 siblings, 0 replies; 14+ messages in thread
From: Peng Fan @ 2014-11-01 2:19 UTC (permalink / raw)
To: u-boot
Add usb support for mx6sabresd.
Signed-off-by: Peng Fan <Peng.Fan@freescale.com>
Signed-off-by: Ye.Li <B37916@freescale.com>
---
board/freescale/mx6sabresd/mx6sabresd.c | 53 +++++++++++++++++++++++++++++++++
include/configs/mx6sabresd.h | 14 +++++++++
2 files changed, 67 insertions(+)
diff --git a/board/freescale/mx6sabresd/mx6sabresd.c b/board/freescale/mx6sabresd/mx6sabresd.c
index 81dcd6e..6bf9b25 100644
--- a/board/freescale/mx6sabresd/mx6sabresd.c
+++ b/board/freescale/mx6sabresd/mx6sabresd.c
@@ -546,3 +546,56 @@ int checkboard(void)
puts("Board: MX6-SabreSD\n");
return 0;
}
+
+#ifdef CONFIG_USB_EHCI_MX6
+iomux_v3_cfg_t const usb_otg_pads[] = {
+ MX6_PAD_EIM_D22__USB_OTG_PWR | MUX_PAD_CTRL(NO_PAD_CTRL),
+ MX6_PAD_ENET_RX_ER__USB_OTG_ID | MUX_PAD_CTRL(NO_PAD_CTRL),
+};
+
+iomux_v3_cfg_t const usb_hc1_pads[] = {
+ MX6_PAD_ENET_TXD1__GPIO1_IO29 | MUX_PAD_CTRL(NO_PAD_CTRL),
+};
+
+int board_ehci_hcd_init(int port)
+{
+ switch (port) {
+ case 0:
+ imx_iomux_v3_setup_multiple_pads(usb_otg_pads,
+ ARRAY_SIZE(usb_otg_pads));
+
+ /*
+ * set daisy chain for otg_pin_id on 6q.
+ * for 6dl, this bit is reserved.
+ */
+ mxc_iomux_set_gpr_register(1, 13, 1, 0);
+ break;
+ case 1:
+ imx_iomux_v3_setup_multiple_pads(usb_hc1_pads,
+ ARRAY_SIZE(usb_hc1_pads));
+ break;
+ default:
+ printf("MXC USB port %d not yet supported\n", port);
+ return 1;
+ }
+ return 0;
+}
+
+int board_ehci_power(int port, int on)
+{
+ switch (port) {
+ case 0:
+ break;
+ case 1:
+ if (on)
+ gpio_direction_output(IMX_GPIO_NR(1, 29), 1);
+ else
+ gpio_direction_output(IMX_GPIO_NR(1, 29), 0);
+ break;
+ default:
+ printf("MXC USB port %d not yet supported\n", port);
+ return 1;
+ }
+ return 0;
+}
+#endif
diff --git a/include/configs/mx6sabresd.h b/include/configs/mx6sabresd.h
index 938030d..da870f3 100644
--- a/include/configs/mx6sabresd.h
+++ b/include/configs/mx6sabresd.h
@@ -54,4 +54,18 @@
#define CONFIG_POWER_PFUZE100
#define CONFIG_POWER_PFUZE100_I2C_ADDR 0x08
+/* USB Configs */
+#define CONFIG_CMD_USB
+#ifdef CONFIG_CMD_USB
+#define CONFIG_USB_EHCI
+#define CONFIG_USB_EHCI_MX6
+#define CONFIG_USB_STORAGE
+#define CONFIG_EHCI_HCD_INIT_AFTER_RESET
+#define CONFIG_USB_HOST_ETHER
+#define CONFIG_USB_ETHER_ASIX
+#define CONFIG_MXC_USB_PORTSC (PORT_PTS_UTMI | PORT_PTS_PTW)
+#define CONFIG_MXC_USB_FLAGS 0
+#define CONFIG_USB_MAX_CONTROLLER_COUNT 1 /* Enabled USB controller number */
+#endif
+
#endif /* __MX6QSABRESD_CONFIG_H */
--
1.8.4.5
^ permalink raw reply related [flat|nested] 14+ messages in thread