diff mbox

[U-Boot,v3,09/10] mx23_olinuxino: Enable USB support

Message ID 1361130325-5202-10-git-send-email-otavio@ossystems.com.br
State Superseded
Headers show

Commit Message

Otavio Salvador Feb. 17, 2013, 7:45 p.m. UTC
This enabled USB support for the mx23_olinuxino board.

Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>
---
Changes in v3: None
Changes in v2:
- Add changes for allow use of the USB hub

 board/olimex/mx23_olinuxino/mx23_olinuxino.c |  6 ++++++
 board/olimex/mx23_olinuxino/spl_boot.c       |  4 ++++
 include/configs/mx23_olinuxino.h             | 10 ++++++++++
 3 files changed, 20 insertions(+)

Comments

Fabio Estevam Feb. 18, 2013, 11:16 p.m. UTC | #1
On Sun, Feb 17, 2013 at 4:45 PM, Otavio Salvador
<otavio@ossystems.com.br> wrote:

> +#ifdef CONFIG_CMD_USB
> +       /* Enable LAN9512 */
> +       gpio_direction_output(MX23_PAD_GPMI_ALE__GPIO_0_17, 1);
> +#endif

What about doing like we do with other imx devices and write something like:

gpio_direction_output(MXS_GPIO_NR(0, 17), 1);

,where

#define MXS_GPIO_NR(bank, nr)      ((bank) * 32 + (nr))

This also aligns with the kernel style.
Otavio Salvador Feb. 19, 2013, 12:25 a.m. UTC | #2
On Mon, Feb 18, 2013 at 8:16 PM, Fabio Estevam <festevam@gmail.com> wrote:
> On Sun, Feb 17, 2013 at 4:45 PM, Otavio Salvador
> <otavio@ossystems.com.br> wrote:
>
>> +#ifdef CONFIG_CMD_USB
>> +       /* Enable LAN9512 */
>> +       gpio_direction_output(MX23_PAD_GPMI_ALE__GPIO_0_17, 1);
>> +#endif
>
> What about doing like we do with other imx devices and write something like:
>
> gpio_direction_output(MXS_GPIO_NR(0, 17), 1);
>
> ,where
>
> #define MXS_GPIO_NR(bank, nr)      ((bank) * 32 + (nr))
>
> This also aligns with the kernel style.

Awesome; I have added it to v5. Thx!
Marek Vasut Feb. 19, 2013, 1:38 a.m. UTC | #3
Dear Otavio Salvador,

> On Mon, Feb 18, 2013 at 8:16 PM, Fabio Estevam <festevam@gmail.com> wrote:
> > On Sun, Feb 17, 2013 at 4:45 PM, Otavio Salvador
> > 
> > <otavio@ossystems.com.br> wrote:
> >> +#ifdef CONFIG_CMD_USB
> >> +       /* Enable LAN9512 */
> >> +       gpio_direction_output(MX23_PAD_GPMI_ALE__GPIO_0_17, 1);
> >> +#endif
> > 
> > What about doing like we do with other imx devices and write something
> > like:
> > 
> > gpio_direction_output(MXS_GPIO_NR(0, 17), 1);
> > 
> > ,where
> > 
> > #define MXS_GPIO_NR(bank, nr)      ((bank) * 32 + (nr))
> > 
> > This also aligns with the kernel style.
> 
> Awesome; I have added it to v5. Thx!

This will bring in quite a lot of inconsistency, will it not?

Best regards,
Marek Vasut
Otavio Salvador Feb. 19, 2013, 11:55 a.m. UTC | #4
On Mon, Feb 18, 2013 at 10:38 PM, Marek Vasut <marex@denx.de> wrote:
> Dear Otavio Salvador,
>
>> On Mon, Feb 18, 2013 at 8:16 PM, Fabio Estevam <festevam@gmail.com> wrote:
>> > On Sun, Feb 17, 2013 at 4:45 PM, Otavio Salvador
>> >
>> > <otavio@ossystems.com.br> wrote:
>> >> +#ifdef CONFIG_CMD_USB
>> >> +       /* Enable LAN9512 */
>> >> +       gpio_direction_output(MX23_PAD_GPMI_ALE__GPIO_0_17, 1);
>> >> +#endif
>> >
>> > What about doing like we do with other imx devices and write something
>> > like:
>> >
>> > gpio_direction_output(MXS_GPIO_NR(0, 17), 1);
>> >
>> > ,where
>> >
>> > #define MXS_GPIO_NR(bank, nr)      ((bank) * 32 + (nr))
>> >
>> > This also aligns with the kernel style.
>>
>> Awesome; I have added it to v5. Thx!
>
> This will bring in quite a lot of inconsistency, will it not?

Really? why?
Marek Vasut Feb. 19, 2013, 12:21 p.m. UTC | #5
Dear Otavio Salvador,

> On Mon, Feb 18, 2013 at 10:38 PM, Marek Vasut <marex@denx.de> wrote:
> > Dear Otavio Salvador,
> > 
> >> On Mon, Feb 18, 2013 at 8:16 PM, Fabio Estevam <festevam@gmail.com> wrote:
> >> > On Sun, Feb 17, 2013 at 4:45 PM, Otavio Salvador
> >> > 
> >> > <otavio@ossystems.com.br> wrote:
> >> >> +#ifdef CONFIG_CMD_USB
> >> >> +       /* Enable LAN9512 */
> >> >> +       gpio_direction_output(MX23_PAD_GPMI_ALE__GPIO_0_17, 1);
> >> >> +#endif
> >> > 
> >> > What about doing like we do with other imx devices and write something
> >> > like:
> >> > 
> >> > gpio_direction_output(MXS_GPIO_NR(0, 17), 1);
> >> > 
> >> > ,where
> >> > 
> >> > #define MXS_GPIO_NR(bank, nr)      ((bank) * 32 + (nr))
> >> > 
> >> > This also aligns with the kernel style.
> >> 
> >> Awesome; I have added it to v5. Thx!
> > 
> > This will bring in quite a lot of inconsistency, will it not?
> 
> Really? why?

Because this will not be used globally with all GPIOs, but only locally for this 
one case. So my suggestion is to postpone this change and do this in one large 
swipe afterwards.

Best regards,
Marek Vasut
Otavio Salvador Feb. 19, 2013, 1:22 p.m. UTC | #6
On Tue, Feb 19, 2013 at 9:21 AM, Marek Vasut <marex@denx.de> wrote:
> Dear Otavio Salvador,
>
>> On Mon, Feb 18, 2013 at 10:38 PM, Marek Vasut <marex@denx.de> wrote:
>> > Dear Otavio Salvador,
>> >
>> >> On Mon, Feb 18, 2013 at 8:16 PM, Fabio Estevam <festevam@gmail.com> wrote:
>> >> > On Sun, Feb 17, 2013 at 4:45 PM, Otavio Salvador
>> >> >
>> >> > <otavio@ossystems.com.br> wrote:
>> >> >> +#ifdef CONFIG_CMD_USB
>> >> >> +       /* Enable LAN9512 */
>> >> >> +       gpio_direction_output(MX23_PAD_GPMI_ALE__GPIO_0_17, 1);
>> >> >> +#endif
>> >> >
>> >> > What about doing like we do with other imx devices and write something
>> >> > like:
>> >> >
>> >> > gpio_direction_output(MXS_GPIO_NR(0, 17), 1);
>> >> >
>> >> > ,where
>> >> >
>> >> > #define MXS_GPIO_NR(bank, nr)      ((bank) * 32 + (nr))
>> >> >
>> >> > This also aligns with the kernel style.
>> >>
>> >> Awesome; I have added it to v5. Thx!
>> >
>> > This will bring in quite a lot of inconsistency, will it not?
>>
>> Really? why?
>
> Because this will not be used globally with all GPIOs, but only locally for this
> one case. So my suggestion is to postpone this change and do this in one large
> swipe afterwards.

I see; I agree with you.
Fabio Estevam Feb. 19, 2013, 7:45 p.m. UTC | #7
On Tue, Feb 19, 2013 at 10:22 AM, Otavio Salvador
<otavio@ossystems.com.br> wrote:

>> Because this will not be used globally with all GPIOs, but only locally for this
>> one case. So my suggestion is to postpone this change and do this in one large
>> swipe afterwards.
>
> I see; I agree with you.

I can take care of this GPIO change later then.
diff mbox

Patch

diff --git a/board/olimex/mx23_olinuxino/mx23_olinuxino.c b/board/olimex/mx23_olinuxino/mx23_olinuxino.c
index 2501417..9ed7718 100644
--- a/board/olimex/mx23_olinuxino/mx23_olinuxino.c
+++ b/board/olimex/mx23_olinuxino/mx23_olinuxino.c
@@ -23,6 +23,7 @@ 
  */
 
 #include <common.h>
+#include <asm/gpio.h>
 #include <asm/io.h>
 #include <asm/arch/iomux-mx23.h>
 #include <asm/arch/imx-regs.h>
@@ -45,6 +46,11 @@  int board_early_init_f(void)
 	/* SSP0 clock at 96MHz */
 	mxs_set_sspclk(MXC_SSPCLK0, 96000, 0);
 
+#ifdef CONFIG_CMD_USB
+	/* Enable LAN9512 */
+	gpio_direction_output(MX23_PAD_GPMI_ALE__GPIO_0_17, 1);
+#endif
+
 	return 0;
 }
 
diff --git a/board/olimex/mx23_olinuxino/spl_boot.c b/board/olimex/mx23_olinuxino/spl_boot.c
index 3bbf5ad..a96c293 100644
--- a/board/olimex/mx23_olinuxino/spl_boot.c
+++ b/board/olimex/mx23_olinuxino/spl_boot.c
@@ -95,6 +95,10 @@  const iomux_cfg_t iomux_setup[] = {
 	MX23_PAD_SSP1_DATA2__SSP1_DATA2 | MUX_CONFIG_SSP,
 	MX23_PAD_SSP1_DATA3__SSP1_DATA3 | MUX_CONFIG_SSP,
 	MX23_PAD_SSP1_SCK__SSP1_SCK | MUX_CONFIG_SSP,
+
+	/* Ethernet */
+	MX23_PAD_GPMI_ALE__GPIO_0_17 |
+		(MXS_PAD_3V3 | MXS_PAD_12MA | MXS_PAD_NOPULL),
 };
 
 void board_init_ll(void)
diff --git a/include/configs/mx23_olinuxino.h b/include/configs/mx23_olinuxino.h
index d019944..e081c49 100644
--- a/include/configs/mx23_olinuxino.h
+++ b/include/configs/mx23_olinuxino.h
@@ -60,6 +60,7 @@ 
 #define	CONFIG_CMD_GPIO
 #define	CONFIG_CMD_LED
 #define	CONFIG_CMD_MMC
+#define	CONFIG_CMD_USB
 
 /*
  * Memory configurations
@@ -140,6 +141,15 @@ 
  */
 #define CONFIG_APBH_DMA
 
+/* USB */
+#ifdef	CONFIG_CMD_USB
+#define	CONFIG_USB_EHCI
+#define	CONFIG_USB_EHCI_MXS
+#define	CONFIG_EHCI_MXS_PORT 0
+#define	CONFIG_EHCI_IS_TDI
+#define	CONFIG_USB_STORAGE
+#endif
+
 /*
  * Boot Linux
  */