diff options
author | Valentin Longchamp <valentin.longchamp@epfl.ch> | 2009-05-06 05:45:36 -0400 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2009-05-07 10:21:02 -0400 |
commit | 03c13ecc0d27d6c566afdb9624848fa0e0efe316 (patch) | |
tree | a5f6033350ea0dfff79c32a12e97116e9241f5a9 | |
parent | 4f163eb8811e8ea760d9fe654ecc6f17feecb477 (diff) |
mx31moboard: add support for usb OTG device (v3)
This is used on all board of our system, so again this is done in the
mx31moboard.c file.
changes since v2: call to gpio_request added in platform code, and
moved device initialization in baseboard files.
changes since v1: pins are claimed in another patch
Signed-off-by: Valentin Longchamp <valentin.longchamp@epfl.ch>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
-rw-r--r-- | arch/arm/mach-mx3/mx31moboard-devboard.c | 43 | ||||
-rw-r--r-- | arch/arm/mach-mx3/mx31moboard-marxbot.c | 43 | ||||
-rw-r--r-- | arch/arm/mach-mx3/mx31moboard.c | 12 |
3 files changed, 86 insertions, 12 deletions
diff --git a/arch/arm/mach-mx3/mx31moboard-devboard.c b/arch/arm/mach-mx3/mx31moboard-devboard.c index b3e8f251ac79..4704405165a1 100644 --- a/arch/arm/mach-mx3/mx31moboard-devboard.c +++ b/arch/arm/mach-mx3/mx31moboard-devboard.c | |||
@@ -16,6 +16,7 @@ | |||
16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | 16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
17 | */ | 17 | */ |
18 | 18 | ||
19 | #include <linux/fsl_devices.h> | ||
19 | #include <linux/gpio.h> | 20 | #include <linux/gpio.h> |
20 | #include <linux/init.h> | 21 | #include <linux/init.h> |
21 | #include <linux/interrupt.h> | 22 | #include <linux/interrupt.h> |
@@ -39,6 +40,18 @@ static unsigned int devboard_pins[] = { | |||
39 | MX31_PIN_PC_READY__SD2_DATA1, MX31_PIN_PC_WAIT_B__SD2_DATA0, | 40 | MX31_PIN_PC_READY__SD2_DATA1, MX31_PIN_PC_WAIT_B__SD2_DATA0, |
40 | MX31_PIN_PC_CD2_B__SD2_CLK, MX31_PIN_PC_CD1_B__SD2_CMD, | 41 | MX31_PIN_PC_CD2_B__SD2_CLK, MX31_PIN_PC_CD1_B__SD2_CMD, |
41 | MX31_PIN_ATA_DIOR__GPIO3_28, MX31_PIN_ATA_DIOW__GPIO3_29, | 42 | MX31_PIN_ATA_DIOR__GPIO3_28, MX31_PIN_ATA_DIOW__GPIO3_29, |
43 | /* USB OTG */ | ||
44 | MX31_PIN_USBOTG_DATA0__USBOTG_DATA0, | ||
45 | MX31_PIN_USBOTG_DATA1__USBOTG_DATA1, | ||
46 | MX31_PIN_USBOTG_DATA2__USBOTG_DATA2, | ||
47 | MX31_PIN_USBOTG_DATA3__USBOTG_DATA3, | ||
48 | MX31_PIN_USBOTG_DATA4__USBOTG_DATA4, | ||
49 | MX31_PIN_USBOTG_DATA5__USBOTG_DATA5, | ||
50 | MX31_PIN_USBOTG_DATA6__USBOTG_DATA6, | ||
51 | MX31_PIN_USBOTG_DATA7__USBOTG_DATA7, | ||
52 | MX31_PIN_USBOTG_CLK__USBOTG_CLK, MX31_PIN_USBOTG_DIR__USBOTG_DIR, | ||
53 | MX31_PIN_USBOTG_NXT__USBOTG_NXT, MX31_PIN_USBOTG_STP__USBOTG_STP, | ||
54 | MX31_PIN_USB_OC__GPIO1_30, | ||
42 | }; | 55 | }; |
43 | 56 | ||
44 | static struct imxuart_platform_data uart_pdata = { | 57 | static struct imxuart_platform_data uart_pdata = { |
@@ -98,6 +111,33 @@ static struct imxmmc_platform_data sdhc2_pdata = { | |||
98 | .exit = devboard_sdhc2_exit, | 111 | .exit = devboard_sdhc2_exit, |
99 | }; | 112 | }; |
100 | 113 | ||
114 | static struct fsl_usb2_platform_data usb_pdata = { | ||
115 | .operating_mode = FSL_USB2_DR_DEVICE, | ||
116 | .phy_mode = FSL_USB2_PHY_ULPI, | ||
117 | }; | ||
118 | |||
119 | #define OTG_PAD_CFG (PAD_CTL_DRV_MAX | PAD_CTL_SRE_FAST) | ||
120 | #define OTG_EN_B IOMUX_TO_GPIO(MX31_PIN_USB_OC) | ||
121 | |||
122 | static void devboard_usbotg_init(void) | ||
123 | { | ||
124 | mxc_iomux_set_pad(MX31_PIN_USBOTG_DATA0, OTG_PAD_CFG); | ||
125 | mxc_iomux_set_pad(MX31_PIN_USBOTG_DATA1, OTG_PAD_CFG); | ||
126 | mxc_iomux_set_pad(MX31_PIN_USBOTG_DATA2, OTG_PAD_CFG); | ||
127 | mxc_iomux_set_pad(MX31_PIN_USBOTG_DATA3, OTG_PAD_CFG); | ||
128 | mxc_iomux_set_pad(MX31_PIN_USBOTG_DATA4, OTG_PAD_CFG); | ||
129 | mxc_iomux_set_pad(MX31_PIN_USBOTG_DATA5, OTG_PAD_CFG); | ||
130 | mxc_iomux_set_pad(MX31_PIN_USBOTG_DATA6, OTG_PAD_CFG); | ||
131 | mxc_iomux_set_pad(MX31_PIN_USBOTG_DATA7, OTG_PAD_CFG); | ||
132 | mxc_iomux_set_pad(MX31_PIN_USBOTG_CLK, OTG_PAD_CFG); | ||
133 | mxc_iomux_set_pad(MX31_PIN_USBOTG_DIR, OTG_PAD_CFG); | ||
134 | mxc_iomux_set_pad(MX31_PIN_USBOTG_NXT, OTG_PAD_CFG); | ||
135 | mxc_iomux_set_pad(MX31_PIN_USBOTG_STP, OTG_PAD_CFG); | ||
136 | |||
137 | gpio_request(OTG_EN_B, "usb-udc-en"); | ||
138 | gpio_direction_output(OTG_EN_B, 0); | ||
139 | } | ||
140 | |||
101 | /* | 141 | /* |
102 | * system init for baseboard usage. Will be called by mx31moboard init. | 142 | * system init for baseboard usage. Will be called by mx31moboard init. |
103 | */ | 143 | */ |
@@ -111,4 +151,7 @@ void __init mx31moboard_devboard_init(void) | |||
111 | mxc_register_device(&mxc_uart_device1, &uart_pdata); | 151 | mxc_register_device(&mxc_uart_device1, &uart_pdata); |
112 | 152 | ||
113 | mxc_register_device(&mxcsdhc_device1, &sdhc2_pdata); | 153 | mxc_register_device(&mxcsdhc_device1, &sdhc2_pdata); |
154 | |||
155 | devboard_usbotg_init(); | ||
156 | mxc_register_device(&mxc_otg_udc_device, &usb_pdata); | ||
114 | } | 157 | } |
diff --git a/arch/arm/mach-mx3/mx31moboard-marxbot.c b/arch/arm/mach-mx3/mx31moboard-marxbot.c index 53ce7ff0637c..641c3d6153ae 100644 --- a/arch/arm/mach-mx3/mx31moboard-marxbot.c +++ b/arch/arm/mach-mx3/mx31moboard-marxbot.c | |||
@@ -16,6 +16,7 @@ | |||
16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | 16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
17 | */ | 17 | */ |
18 | 18 | ||
19 | #include <linux/fsl_devices.h> | ||
19 | #include <linux/gpio.h> | 20 | #include <linux/gpio.h> |
20 | #include <linux/init.h> | 21 | #include <linux/init.h> |
21 | #include <linux/interrupt.h> | 22 | #include <linux/interrupt.h> |
@@ -47,6 +48,18 @@ static unsigned int marxbot_pins[] = { | |||
47 | MX31_PIN_CSI_PIXCLK__CSI_PIXCLK, MX31_PIN_CSI_VSYNC__CSI_VSYNC, | 48 | MX31_PIN_CSI_PIXCLK__CSI_PIXCLK, MX31_PIN_CSI_VSYNC__CSI_VSYNC, |
48 | MX31_PIN_GPIO3_0__GPIO3_0, MX31_PIN_GPIO3_1__GPIO3_1, | 49 | MX31_PIN_GPIO3_0__GPIO3_0, MX31_PIN_GPIO3_1__GPIO3_1, |
49 | MX31_PIN_TXD2__GPIO1_28, | 50 | MX31_PIN_TXD2__GPIO1_28, |
51 | /* USB OTG */ | ||
52 | MX31_PIN_USBOTG_DATA0__USBOTG_DATA0, | ||
53 | MX31_PIN_USBOTG_DATA1__USBOTG_DATA1, | ||
54 | MX31_PIN_USBOTG_DATA2__USBOTG_DATA2, | ||
55 | MX31_PIN_USBOTG_DATA3__USBOTG_DATA3, | ||
56 | MX31_PIN_USBOTG_DATA4__USBOTG_DATA4, | ||
57 | MX31_PIN_USBOTG_DATA5__USBOTG_DATA5, | ||
58 | MX31_PIN_USBOTG_DATA6__USBOTG_DATA6, | ||
59 | MX31_PIN_USBOTG_DATA7__USBOTG_DATA7, | ||
60 | MX31_PIN_USBOTG_CLK__USBOTG_CLK, MX31_PIN_USBOTG_DIR__USBOTG_DIR, | ||
61 | MX31_PIN_USBOTG_NXT__USBOTG_NXT, MX31_PIN_USBOTG_STP__USBOTG_STP, | ||
62 | MX31_PIN_USB_OC__GPIO1_30, | ||
50 | }; | 63 | }; |
51 | 64 | ||
52 | #define SDHC2_CD IOMUX_TO_GPIO(MX31_PIN_ATA_DIOR) | 65 | #define SDHC2_CD IOMUX_TO_GPIO(MX31_PIN_ATA_DIOR) |
@@ -102,6 +115,33 @@ static struct imxmmc_platform_data sdhc2_pdata = { | |||
102 | .exit = marxbot_sdhc2_exit, | 115 | .exit = marxbot_sdhc2_exit, |
103 | }; | 116 | }; |
104 | 117 | ||
118 | static struct fsl_usb2_platform_data usb_pdata = { | ||
119 | .operating_mode = FSL_USB2_DR_DEVICE, | ||
120 | .phy_mode = FSL_USB2_PHY_ULPI, | ||
121 | }; | ||
122 | |||
123 | #define OTG_PAD_CFG (PAD_CTL_DRV_MAX | PAD_CTL_SRE_FAST) | ||
124 | #define OTG_EN_B IOMUX_TO_GPIO(MX31_PIN_USB_OC) | ||
125 | |||
126 | static void marxbot_usbotg_init(void) | ||
127 | { | ||
128 | mxc_iomux_set_pad(MX31_PIN_USBOTG_DATA0, OTG_PAD_CFG); | ||
129 | mxc_iomux_set_pad(MX31_PIN_USBOTG_DATA1, OTG_PAD_CFG); | ||
130 | mxc_iomux_set_pad(MX31_PIN_USBOTG_DATA2, OTG_PAD_CFG); | ||
131 | mxc_iomux_set_pad(MX31_PIN_USBOTG_DATA3, OTG_PAD_CFG); | ||
132 | mxc_iomux_set_pad(MX31_PIN_USBOTG_DATA4, OTG_PAD_CFG); | ||
133 | mxc_iomux_set_pad(MX31_PIN_USBOTG_DATA5, OTG_PAD_CFG); | ||
134 | mxc_iomux_set_pad(MX31_PIN_USBOTG_DATA6, OTG_PAD_CFG); | ||
135 | mxc_iomux_set_pad(MX31_PIN_USBOTG_DATA7, OTG_PAD_CFG); | ||
136 | mxc_iomux_set_pad(MX31_PIN_USBOTG_CLK, OTG_PAD_CFG); | ||
137 | mxc_iomux_set_pad(MX31_PIN_USBOTG_DIR, OTG_PAD_CFG); | ||
138 | mxc_iomux_set_pad(MX31_PIN_USBOTG_NXT, OTG_PAD_CFG); | ||
139 | mxc_iomux_set_pad(MX31_PIN_USBOTG_STP, OTG_PAD_CFG); | ||
140 | |||
141 | gpio_request(OTG_EN_B, "usb-udc-en"); | ||
142 | gpio_direction_output(OTG_EN_B, 0); | ||
143 | } | ||
144 | |||
105 | /* | 145 | /* |
106 | * system init for baseboard usage. Will be called by mx31moboard init. | 146 | * system init for baseboard usage. Will be called by mx31moboard init. |
107 | */ | 147 | */ |
@@ -113,4 +153,7 @@ void __init mx31moboard_marxbot_init(void) | |||
113 | "marxbot"); | 153 | "marxbot"); |
114 | 154 | ||
115 | mxc_register_device(&mxcsdhc_device1, &sdhc2_pdata); | 155 | mxc_register_device(&mxcsdhc_device1, &sdhc2_pdata); |
156 | |||
157 | marxbot_usbotg_init(); | ||
158 | mxc_register_device(&mxc_otg_udc_device, &usb_pdata); | ||
116 | } | 159 | } |
diff --git a/arch/arm/mach-mx3/mx31moboard.c b/arch/arm/mach-mx3/mx31moboard.c index 0df6ac610b65..a17f2e411609 100644 --- a/arch/arm/mach-mx3/mx31moboard.c +++ b/arch/arm/mach-mx3/mx31moboard.c | |||
@@ -55,18 +55,6 @@ static unsigned int moboard_pins[] = { | |||
55 | MX31_PIN_SD1_DATA1__SD1_DATA1, MX31_PIN_SD1_DATA0__SD1_DATA0, | 55 | MX31_PIN_SD1_DATA1__SD1_DATA1, MX31_PIN_SD1_DATA0__SD1_DATA0, |
56 | MX31_PIN_SD1_CLK__SD1_CLK, MX31_PIN_SD1_CMD__SD1_CMD, | 56 | MX31_PIN_SD1_CLK__SD1_CLK, MX31_PIN_SD1_CMD__SD1_CMD, |
57 | MX31_PIN_ATA_CS0__GPIO3_26, MX31_PIN_ATA_CS1__GPIO3_27, | 57 | MX31_PIN_ATA_CS0__GPIO3_26, MX31_PIN_ATA_CS1__GPIO3_27, |
58 | /* USB OTG */ | ||
59 | MX31_PIN_USBOTG_DATA0__USBOTG_DATA0, | ||
60 | MX31_PIN_USBOTG_DATA1__USBOTG_DATA1, | ||
61 | MX31_PIN_USBOTG_DATA2__USBOTG_DATA2, | ||
62 | MX31_PIN_USBOTG_DATA3__USBOTG_DATA3, | ||
63 | MX31_PIN_USBOTG_DATA4__USBOTG_DATA4, | ||
64 | MX31_PIN_USBOTG_DATA5__USBOTG_DATA5, | ||
65 | MX31_PIN_USBOTG_DATA6__USBOTG_DATA6, | ||
66 | MX31_PIN_USBOTG_DATA7__USBOTG_DATA7, | ||
67 | MX31_PIN_USBOTG_CLK__USBOTG_CLK, MX31_PIN_USBOTG_DIR__USBOTG_DIR, | ||
68 | MX31_PIN_USBOTG_NXT__USBOTG_NXT, MX31_PIN_USBOTG_STP__USBOTG_STP, | ||
69 | MX31_PIN_USB_OC__GPIO1_30, | ||
70 | }; | 58 | }; |
71 | 59 | ||
72 | static struct physmap_flash_data mx31moboard_flash_data = { | 60 | static struct physmap_flash_data mx31moboard_flash_data = { |