aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/arm/mach-mx5/Kconfig1
-rw-r--r--arch/arm/mach-mx5/board-mx51_efikamx.c14
-rw-r--r--arch/arm/mach-mx5/efika.h4
-rw-r--r--arch/arm/mach-mx5/mx51_efika.c107
4 files changed, 122 insertions, 4 deletions
diff --git a/arch/arm/mach-mx5/Kconfig b/arch/arm/mach-mx5/Kconfig
index aa20a38ccc8a..1405464c1034 100644
--- a/arch/arm/mach-mx5/Kconfig
+++ b/arch/arm/mach-mx5/Kconfig
@@ -119,6 +119,7 @@ config MX51_EFIKA_COMMON
119 select IMX_HAVE_PLATFORM_IMX_UART 119 select IMX_HAVE_PLATFORM_IMX_UART
120 select IMX_HAVE_PLATFORM_SDHCI_ESDHC_IMX 120 select IMX_HAVE_PLATFORM_SDHCI_ESDHC_IMX
121 select IMX_HAVE_PLATFORM_SPI_IMX 121 select IMX_HAVE_PLATFORM_SPI_IMX
122 select MXC_ULPI if USB_ULPI
122 123
123config MACH_MX51_EFIKAMX 124config MACH_MX51_EFIKAMX
124 bool "Support MX51 Genesi Efika MX nettop" 125 bool "Support MX51 Genesi Efika MX nettop"
diff --git a/arch/arm/mach-mx5/board-mx51_efikamx.c b/arch/arm/mach-mx5/board-mx51_efikamx.c
index 272de6e883e7..8f173366b29c 100644
--- a/arch/arm/mach-mx5/board-mx51_efikamx.c
+++ b/arch/arm/mach-mx5/board-mx51_efikamx.c
@@ -211,6 +211,20 @@ static void __init mx51_efikamx_init(void)
211 gpio_request(EFIKAMX_RESET, "reset"); 211 gpio_request(EFIKAMX_RESET, "reset");
212 gpio_direction_output(EFIKAMX_RESET, 1); 212 gpio_direction_output(EFIKAMX_RESET, 1);
213 } 213 }
214
215 /*
216 * enable wifi by default only on mx
217 * sb and mx have same wlan pin but the value to enable it are
218 * different :/
219 */
220 gpio_request(EFIKA_WLAN_EN, "wlan_en");
221 gpio_direction_output(EFIKA_WLAN_EN, 0);
222 msleep(10);
223
224 gpio_request(EFIKA_WLAN_RESET, "wlan_rst");
225 gpio_direction_output(EFIKA_WLAN_RESET, 0);
226 msleep(10);
227 gpio_set_value(EFIKA_WLAN_RESET, 1);
214} 228}
215 229
216static void __init mx51_efikamx_timer_init(void) 230static void __init mx51_efikamx_timer_init(void)
diff --git a/arch/arm/mach-mx5/efika.h b/arch/arm/mach-mx5/efika.h
index c8280435934a..014aa985faae 100644
--- a/arch/arm/mach-mx5/efika.h
+++ b/arch/arm/mach-mx5/efika.h
@@ -1,6 +1,10 @@
1#ifndef _EFIKA_H 1#ifndef _EFIKA_H
2#define _EFIKA_H 2#define _EFIKA_H
3 3
4#define EFIKA_WLAN_EN IMX_GPIO_NR(2, 16)
5#define EFIKA_WLAN_RESET IMX_GPIO_NR(2, 10)
6#define EFIKA_USB_PHY_RESET IMX_GPIO_NR(2, 9)
7
4void __init efika_board_common_init(void); 8void __init efika_board_common_init(void);
5 9
6#endif 10#endif
diff --git a/arch/arm/mach-mx5/mx51_efika.c b/arch/arm/mach-mx5/mx51_efika.c
index a249ca3c4138..c08ec63415e5 100644
--- a/arch/arm/mach-mx5/mx51_efika.c
+++ b/arch/arm/mach-mx5/mx51_efika.c
@@ -30,6 +30,10 @@
30#include <mach/i2c.h> 30#include <mach/i2c.h>
31#include <mach/mxc_ehci.h> 31#include <mach/mxc_ehci.h>
32 32
33#include <linux/usb/otg.h>
34#include <linux/usb/ulpi.h>
35#include <mach/ulpi.h>
36
33#include <asm/irq.h> 37#include <asm/irq.h>
34#include <asm/setup.h> 38#include <asm/setup.h>
35#include <asm/mach-types.h> 39#include <asm/mach-types.h>
@@ -40,7 +44,12 @@
40#include "devices.h" 44#include "devices.h"
41#include "efika.h" 45#include "efika.h"
42 46
43#define MX51_USB_PLL_DIV_24_MHZ 0x01 47#define MX51_USB_CTRL_1_OFFSET 0x10
48#define MX51_USB_CTRL_UH1_EXT_CLK_EN (1 << 25)
49#define MX51_USB_PLL_DIV_19_2_MHZ 0x01
50
51#define EFIKAMX_USB_HUB_RESET IMX_GPIO_NR(1, 5)
52#define EFIKAMX_USBH1_STP IMX_GPIO_NR(1, 27)
44 53
45#define EFIKAMX_SPI_CS0 IMX_GPIO_NR(4, 24) 54#define EFIKAMX_SPI_CS0 IMX_GPIO_NR(4, 24)
46#define EFIKAMX_SPI_CS1 IMX_GPIO_NR(4, 25) 55#define EFIKAMX_SPI_CS1 IMX_GPIO_NR(4, 25)
@@ -81,6 +90,29 @@ static iomux_v3_cfg_t mx51efika_pads[] = {
81 MX51_PAD_CSPI1_SS1__GPIO4_25, 90 MX51_PAD_CSPI1_SS1__GPIO4_25,
82 MX51_PAD_CSPI1_RDY__ECSPI1_RDY, 91 MX51_PAD_CSPI1_RDY__ECSPI1_RDY,
83 MX51_PAD_CSPI1_SCLK__ECSPI1_SCLK, 92 MX51_PAD_CSPI1_SCLK__ECSPI1_SCLK,
93
94 /* USB HOST1 */
95 MX51_PAD_USBH1_CLK__USBH1_CLK,
96 MX51_PAD_USBH1_DIR__USBH1_DIR,
97 MX51_PAD_USBH1_NXT__USBH1_NXT,
98 MX51_PAD_USBH1_DATA0__USBH1_DATA0,
99 MX51_PAD_USBH1_DATA1__USBH1_DATA1,
100 MX51_PAD_USBH1_DATA2__USBH1_DATA2,
101 MX51_PAD_USBH1_DATA3__USBH1_DATA3,
102 MX51_PAD_USBH1_DATA4__USBH1_DATA4,
103 MX51_PAD_USBH1_DATA5__USBH1_DATA5,
104 MX51_PAD_USBH1_DATA6__USBH1_DATA6,
105 MX51_PAD_USBH1_DATA7__USBH1_DATA7,
106
107 /* USB HUB RESET */
108 MX51_PAD_GPIO1_5__GPIO1_5,
109
110 /* WLAN */
111 MX51_PAD_EIM_A22__GPIO2_16,
112 MX51_PAD_EIM_A16__GPIO2_10,
113
114 /* USB PHY RESET */
115 MX51_PAD_EIM_D27__GPIO2_9,
84}; 116};
85 117
86/* Serial ports */ 118/* Serial ports */
@@ -105,13 +137,13 @@ static int initialize_otg_port(struct platform_device *pdev)
105 /* Set the PHY clock to 19.2MHz */ 137 /* Set the PHY clock to 19.2MHz */
106 v = __raw_readl(usbother_base + MXC_USB_PHY_CTR_FUNC2_OFFSET); 138 v = __raw_readl(usbother_base + MXC_USB_PHY_CTR_FUNC2_OFFSET);
107 v &= ~MX5_USB_UTMI_PHYCTRL1_PLLDIV_MASK; 139 v &= ~MX5_USB_UTMI_PHYCTRL1_PLLDIV_MASK;
108 v |= MX51_USB_PLL_DIV_24_MHZ; 140 v |= MX51_USB_PLL_DIV_19_2_MHZ;
109 __raw_writel(v, usbother_base + MXC_USB_PHY_CTR_FUNC2_OFFSET); 141 __raw_writel(v, usbother_base + MXC_USB_PHY_CTR_FUNC2_OFFSET);
110 iounmap(usb_base); 142 iounmap(usb_base);
111 143
112 mdelay(10); 144 mdelay(10);
113 145
114 return mx51_initialize_usb_hw(0, MXC_EHCI_INTERNAL_PHY); 146 return mx51_initialize_usb_hw(pdev->id, MXC_EHCI_INTERNAL_PHY);
115} 147}
116 148
117static struct mxc_usbh_platform_data dr_utmi_config = { 149static struct mxc_usbh_platform_data dr_utmi_config = {
@@ -119,6 +151,73 @@ static struct mxc_usbh_platform_data dr_utmi_config = {
119 .portsc = MXC_EHCI_UTMI_16BIT, 151 .portsc = MXC_EHCI_UTMI_16BIT,
120}; 152};
121 153
154static int initialize_usbh1_port(struct platform_device *pdev)
155{
156 iomux_v3_cfg_t usbh1stp = MX51_PAD_USBH1_STP__USBH1_STP;
157 iomux_v3_cfg_t usbh1gpio = MX51_PAD_USBH1_STP__GPIO1_27;
158 u32 v;
159 void __iomem *usb_base;
160 void __iomem *socregs_base;
161
162 mxc_iomux_v3_setup_pad(usbh1gpio);
163 gpio_request(EFIKAMX_USBH1_STP, "usbh1_stp");
164 gpio_direction_output(EFIKAMX_USBH1_STP, 0);
165 msleep(1);
166 gpio_set_value(EFIKAMX_USBH1_STP, 1);
167 msleep(1);
168
169 usb_base = ioremap(MX51_OTG_BASE_ADDR, SZ_4K);
170 socregs_base = (void __iomem *)(usb_base + MX5_USBOTHER_REGS_OFFSET);
171
172 /* The clock for the USBH1 ULPI port will come externally */
173 /* from the PHY. */
174 v = __raw_readl(socregs_base + MX51_USB_CTRL_1_OFFSET);
175 __raw_writel(v | MX51_USB_CTRL_UH1_EXT_CLK_EN,
176 socregs_base + MX51_USB_CTRL_1_OFFSET);
177
178 iounmap(usb_base);
179
180 gpio_free(EFIKAMX_USBH1_STP);
181 mxc_iomux_v3_setup_pad(usbh1stp);
182
183 mdelay(10);
184
185 return mx51_initialize_usb_hw(0, MXC_EHCI_ITC_NO_THRESHOLD);
186}
187
188static struct mxc_usbh_platform_data usbh1_config = {
189 .init = initialize_usbh1_port,
190 .portsc = MXC_EHCI_MODE_ULPI,
191};
192
193static void mx51_efika_hubreset(void)
194{
195 gpio_request(EFIKAMX_USB_HUB_RESET, "usb_hub_rst");
196 gpio_direction_output(EFIKAMX_USB_HUB_RESET, 1);
197 msleep(1);
198 gpio_set_value(EFIKAMX_USB_HUB_RESET, 0);
199 msleep(1);
200 gpio_set_value(EFIKAMX_USB_HUB_RESET, 1);
201}
202
203static void __init mx51_efika_usb(void)
204{
205 mx51_efika_hubreset();
206
207 /* pulling it low, means no USB at all... */
208 gpio_request(EFIKA_USB_PHY_RESET, "usb_phy_reset");
209 gpio_direction_output(EFIKA_USB_PHY_RESET, 0);
210 msleep(1);
211 gpio_set_value(EFIKA_USB_PHY_RESET, 1);
212
213 usbh1_config.otg = otg_ulpi_create(&mxc_ulpi_access_ops,
214 ULPI_OTG_DRVVBUS | ULPI_OTG_DRVVBUS_EXT |
215 ULPI_OTG_EXTVBUSIND);
216
217 mxc_register_device(&mxc_usbdr_host_device, &dr_utmi_config);
218 mxc_register_device(&mxc_usbh1_device, &usbh1_config);
219}
220
122static struct mtd_partition mx51_efika_spi_nor_partitions[] = { 221static struct mtd_partition mx51_efika_spi_nor_partitions[] = {
123 { 222 {
124 .name = "u-boot", 223 .name = "u-boot",
@@ -164,8 +263,8 @@ void __init efika_board_common_init(void)
164{ 263{
165 mxc_iomux_v3_setup_multiple_pads(mx51efika_pads, 264 mxc_iomux_v3_setup_multiple_pads(mx51efika_pads,
166 ARRAY_SIZE(mx51efika_pads)); 265 ARRAY_SIZE(mx51efika_pads));
167 mxc_register_device(&mxc_usbdr_host_device, &dr_utmi_config);
168 imx51_add_imx_uart(0, &uart_pdata); 266 imx51_add_imx_uart(0, &uart_pdata);
267 mx51_efika_usb();
169 imx51_add_sdhci_esdhc_imx(0, NULL); 268 imx51_add_sdhci_esdhc_imx(0, NULL);
170 269
171 spi_register_board_info(mx51_efika_spi_board_info, 270 spi_register_board_info(mx51_efika_spi_board_info,