aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-mx5
diff options
context:
space:
mode:
authorRussell King <rmk+kernel@arm.linux.org.uk>2011-03-10 08:53:29 -0500
committerRussell King <rmk+kernel@arm.linux.org.uk>2011-03-10 08:53:29 -0500
commit3afdb0f3528991de0833224f2dba60dc061e01fa (patch)
tree0d9c7529c6cc2b41f0df778cc396edd74699721a /arch/arm/mach-mx5
parent71d8c5b11e3b5936ae6c2e0b1dd6f5c78b305b65 (diff)
parentf7fdaca910e6bc13659ecdffc28c97938b752e01 (diff)
Merge branch 'for-rmk' of git://git.pengutronix.de/git/imx/linux-2.6 into devel-stable
Diffstat (limited to 'arch/arm/mach-mx5')
-rw-r--r--arch/arm/mach-mx5/Kconfig27
-rw-r--r--arch/arm/mach-mx5/Makefile4
-rw-r--r--arch/arm/mach-mx5/board-cpuimx51.c20
-rw-r--r--arch/arm/mach-mx5/board-cpuimx51sd.c31
-rw-r--r--arch/arm/mach-mx5/board-mx50_rdp.c34
-rw-r--r--arch/arm/mach-mx5/board-mx51_3ds.c43
-rw-r--r--arch/arm/mach-mx5/board-mx51_babbage.c43
-rw-r--r--arch/arm/mach-mx5/board-mx51_efikamx.c211
-rw-r--r--arch/arm/mach-mx5/board-mx51_efikasb.c283
-rw-r--r--arch/arm/mach-mx5/board-mx53_evk.c40
-rw-r--r--arch/arm/mach-mx5/board-mx53_loco.c178
-rw-r--r--arch/arm/mach-mx5/board-mx53_smd.c40
-rw-r--r--arch/arm/mach-mx5/clock-mx51-mx53.c148
-rw-r--r--arch/arm/mach-mx5/cpu.c11
-rw-r--r--arch/arm/mach-mx5/crm_regs.h7
-rw-r--r--arch/arm/mach-mx5/devices-imx50.h (renamed from arch/arm/mach-mx5/devices-mx50.h)8
-rw-r--r--arch/arm/mach-mx5/devices-imx53.h4
-rw-r--r--arch/arm/mach-mx5/efika.h10
-rw-r--r--arch/arm/mach-mx5/ehci.c156
-rw-r--r--arch/arm/mach-mx5/mm-mx50.c19
-rw-r--r--arch/arm/mach-mx5/mm.c14
-rw-r--r--arch/arm/mach-mx5/mx51_efika.c636
22 files changed, 1664 insertions, 303 deletions
diff --git a/arch/arm/mach-mx5/Kconfig b/arch/arm/mach-mx5/Kconfig
index de4fa992fc3..83ee08847d4 100644
--- a/arch/arm/mach-mx5/Kconfig
+++ b/arch/arm/mach-mx5/Kconfig
@@ -1,5 +1,6 @@
1if ARCH_MX5 1if ARCH_MX5
2# ARCH_MX51 and ARCH_MX50 are left for compatibility 2# ARCH_MX50/51/53 are left to mark places where prevent multi-soc in single
3# image. So for most time, SOC_IMX50/51/53 should be used.
3 4
4config ARCH_MX50 5config ARCH_MX50
5 bool 6 bool
@@ -50,6 +51,7 @@ config MACH_MX51_BABBAGE
50config MACH_MX51_3DS 51config MACH_MX51_3DS
51 bool "Support MX51PDK (3DS)" 52 bool "Support MX51PDK (3DS)"
52 select SOC_IMX51 53 select SOC_IMX51
54 select IMX_HAVE_PLATFORM_IMX2_WDT
53 select IMX_HAVE_PLATFORM_IMX_KEYPAD 55 select IMX_HAVE_PLATFORM_IMX_KEYPAD
54 select IMX_HAVE_PLATFORM_IMX_UART 56 select IMX_HAVE_PLATFORM_IMX_UART
55 select IMX_HAVE_PLATFORM_SDHCI_ESDHC_IMX 57 select IMX_HAVE_PLATFORM_SDHCI_ESDHC_IMX
@@ -112,19 +114,32 @@ config MACH_EUKREA_MBIMXSD51_BASEBOARD
112 114
113endchoice 115endchoice
114 116
115config MACH_MX51_EFIKAMX 117config MX51_EFIKA_COMMON
116 bool "Support MX51 Genesi Efika MX nettop" 118 bool
117 select SOC_IMX51 119 select SOC_IMX51
118 select IMX_HAVE_PLATFORM_IMX_UART 120 select IMX_HAVE_PLATFORM_IMX_UART
119 select IMX_HAVE_PLATFORM_SDHCI_ESDHC_IMX 121 select IMX_HAVE_PLATFORM_SDHCI_ESDHC_IMX
120 select IMX_HAVE_PLATFORM_SPI_IMX 122 select IMX_HAVE_PLATFORM_SPI_IMX
123 select MXC_ULPI if USB_ULPI
124
125config MACH_MX51_EFIKAMX
126 bool "Support MX51 Genesi Efika MX nettop"
127 select MX51_EFIKA_COMMON
121 help 128 help
122 Include support for Genesi Efika MX nettop. This includes specific 129 Include support for Genesi Efika MX nettop. This includes specific
123 configurations for the board and its peripherals. 130 configurations for the board and its peripherals.
124 131
132config MACH_MX51_EFIKASB
133 bool "Support MX51 Genesi Efika Smartbook"
134 select MX51_EFIKA_COMMON
135 help
136 Include support for Genesi Efika Smartbook. This includes specific
137 configurations for the board and its peripherals.
138
125config MACH_MX53_EVK 139config MACH_MX53_EVK
126 bool "Support MX53 EVK platforms" 140 bool "Support MX53 EVK platforms"
127 select SOC_IMX53 141 select SOC_IMX53
142 select IMX_HAVE_PLATFORM_IMX2_WDT
128 select IMX_HAVE_PLATFORM_IMX_UART 143 select IMX_HAVE_PLATFORM_IMX_UART
129 select IMX_HAVE_PLATFORM_IMX_I2C 144 select IMX_HAVE_PLATFORM_IMX_I2C
130 select IMX_HAVE_PLATFORM_SDHCI_ESDHC_IMX 145 select IMX_HAVE_PLATFORM_SDHCI_ESDHC_IMX
@@ -136,6 +151,8 @@ config MACH_MX53_EVK
136config MACH_MX53_SMD 151config MACH_MX53_SMD
137 bool "Support MX53 SMD platforms" 152 bool "Support MX53 SMD platforms"
138 select SOC_IMX53 153 select SOC_IMX53
154 select IMX_HAVE_PLATFORM_IMX2_WDT
155 select IMX_HAVE_PLATFORM_IMX_I2C
139 select IMX_HAVE_PLATFORM_IMX_UART 156 select IMX_HAVE_PLATFORM_IMX_UART
140 help 157 help
141 Include support for MX53 SMD platform. This includes specific 158 Include support for MX53 SMD platform. This includes specific
@@ -144,7 +161,10 @@ config MACH_MX53_SMD
144config MACH_MX53_LOCO 161config MACH_MX53_LOCO
145 bool "Support MX53 LOCO platforms" 162 bool "Support MX53 LOCO platforms"
146 select SOC_IMX53 163 select SOC_IMX53
164 select IMX_HAVE_PLATFORM_IMX2_WDT
165 select IMX_HAVE_PLATFORM_IMX_I2C
147 select IMX_HAVE_PLATFORM_IMX_UART 166 select IMX_HAVE_PLATFORM_IMX_UART
167 select IMX_HAVE_PLATFORM_SDHCI_ESDHC_IMX
148 help 168 help
149 Include support for MX53 LOCO platform. This includes specific 169 Include support for MX53 LOCO platform. This includes specific
150 configurations for the board and its peripherals. 170 configurations for the board and its peripherals.
@@ -157,6 +177,7 @@ config MACH_MX50_RDP
157 select IMX_HAVE_PLATFORM_IMX_UART 177 select IMX_HAVE_PLATFORM_IMX_UART
158 select IMX_HAVE_PLATFORM_SDHCI_ESDHC_IMX 178 select IMX_HAVE_PLATFORM_SDHCI_ESDHC_IMX
159 select IMX_HAVE_PLATFORM_SPI_IMX 179 select IMX_HAVE_PLATFORM_SPI_IMX
180 select IMX_HAVE_PLATFORM_FEC
160 help 181 help
161 Include support for MX50 reference design platform (RDP) board. This 182 Include support for MX50 reference design platform (RDP) board. This
162 includes specific configurations for the board and its peripherals. 183 includes specific configurations for the board and its peripherals.
diff --git a/arch/arm/mach-mx5/Makefile b/arch/arm/mach-mx5/Makefile
index 0d43be98e51..4f63048be3c 100644
--- a/arch/arm/mach-mx5/Makefile
+++ b/arch/arm/mach-mx5/Makefile
@@ -3,7 +3,7 @@
3# 3#
4 4
5# Object file lists. 5# Object file lists.
6obj-y := cpu.o mm.o clock-mx51-mx53.o devices.o 6obj-y := cpu.o mm.o clock-mx51-mx53.o devices.o ehci.o
7obj-$(CONFIG_SOC_IMX50) += mm-mx50.o 7obj-$(CONFIG_SOC_IMX50) += mm-mx50.o
8 8
9obj-$(CONFIG_CPU_FREQ_IMX) += cpu_op-mx51.o 9obj-$(CONFIG_CPU_FREQ_IMX) += cpu_op-mx51.o
@@ -16,5 +16,7 @@ obj-$(CONFIG_MACH_EUKREA_CPUIMX51) += board-cpuimx51.o
16obj-$(CONFIG_MACH_EUKREA_MBIMX51_BASEBOARD) += eukrea_mbimx51-baseboard.o 16obj-$(CONFIG_MACH_EUKREA_MBIMX51_BASEBOARD) += eukrea_mbimx51-baseboard.o
17obj-$(CONFIG_MACH_EUKREA_CPUIMX51SD) += board-cpuimx51sd.o 17obj-$(CONFIG_MACH_EUKREA_CPUIMX51SD) += board-cpuimx51sd.o
18obj-$(CONFIG_MACH_EUKREA_MBIMXSD51_BASEBOARD) += eukrea_mbimxsd-baseboard.o 18obj-$(CONFIG_MACH_EUKREA_MBIMXSD51_BASEBOARD) += eukrea_mbimxsd-baseboard.o
19obj-$(CONFIG_MX51_EFIKA_COMMON) += mx51_efika.o
19obj-$(CONFIG_MACH_MX51_EFIKAMX) += board-mx51_efikamx.o 20obj-$(CONFIG_MACH_MX51_EFIKAMX) += board-mx51_efikamx.o
21obj-$(CONFIG_MACH_MX51_EFIKASB) += board-mx51_efikasb.o
20obj-$(CONFIG_MACH_MX50_RDP) += board-mx50_rdp.o 22obj-$(CONFIG_MACH_MX50_RDP) += board-mx50_rdp.o
diff --git a/arch/arm/mach-mx5/board-cpuimx51.c b/arch/arm/mach-mx5/board-cpuimx51.c
index f8652ef25f8..d0296a94c47 100644
--- a/arch/arm/mach-mx5/board-cpuimx51.c
+++ b/arch/arm/mach-mx5/board-cpuimx51.c
@@ -60,7 +60,6 @@
60#define MX51_USB_PLL_DIV_19_2_MHZ 0x01 60#define MX51_USB_PLL_DIV_19_2_MHZ 0x01
61#define MX51_USB_PLL_DIV_24_MHZ 0x02 61#define MX51_USB_PLL_DIV_24_MHZ 0x02
62 62
63#if defined(CONFIG_SERIAL_8250) || defined(CONFIG_SERIAL_8250_MODULE)
64static struct plat_serial8250_port serial_platform_data[] = { 63static struct plat_serial8250_port serial_platform_data[] = {
65 { 64 {
66 .mapbase = (unsigned long)(MX51_CS1_BASE_ADDR + 0x400000), 65 .mapbase = (unsigned long)(MX51_CS1_BASE_ADDR + 0x400000),
@@ -105,12 +104,9 @@ static struct platform_device serial_device = {
105 .platform_data = serial_platform_data, 104 .platform_data = serial_platform_data,
106 }, 105 },
107}; 106};
108#endif
109 107
110static struct platform_device *devices[] __initdata = { 108static struct platform_device *devices[] __initdata = {
111#if defined(CONFIG_SERIAL_8250) || defined(CONFIG_SERIAL_8250_MODULE)
112 &serial_device, 109 &serial_device,
113#endif
114}; 110};
115 111
116static iomux_v3_cfg_t eukrea_cpuimx51_pads[] = { 112static iomux_v3_cfg_t eukrea_cpuimx51_pads[] = {
@@ -188,7 +184,10 @@ static int initialize_otg_port(struct platform_device *pdev)
188 v |= MX51_USB_PLL_DIV_19_2_MHZ; 184 v |= MX51_USB_PLL_DIV_19_2_MHZ;
189 __raw_writel(v, usbother_base + MXC_USB_PHY_CTR_FUNC2_OFFSET); 185 __raw_writel(v, usbother_base + MXC_USB_PHY_CTR_FUNC2_OFFSET);
190 iounmap(usb_base); 186 iounmap(usb_base);
191 return 0; 187
188 mdelay(10);
189
190 return mx51_initialize_usb_hw(0, MXC_EHCI_INTERNAL_PHY);
192} 191}
193 192
194static int initialize_usbh1_port(struct platform_device *pdev) 193static int initialize_usbh1_port(struct platform_device *pdev)
@@ -206,13 +205,16 @@ static int initialize_usbh1_port(struct platform_device *pdev)
206 v = __raw_readl(usbother_base + MX51_USB_CTRL_1_OFFSET); 205 v = __raw_readl(usbother_base + MX51_USB_CTRL_1_OFFSET);
207 __raw_writel(v | MX51_USB_CTRL_UH1_EXT_CLK_EN, usbother_base + MX51_USB_CTRL_1_OFFSET); 206 __raw_writel(v | MX51_USB_CTRL_UH1_EXT_CLK_EN, usbother_base + MX51_USB_CTRL_1_OFFSET);
208 iounmap(usb_base); 207 iounmap(usb_base);
209 return 0; 208
209 mdelay(10);
210
211 return mx51_initialize_usb_hw(1, MXC_EHCI_POWER_PINS_ENABLED |
212 MXC_EHCI_ITC_NO_THRESHOLD);
210} 213}
211 214
212static struct mxc_usbh_platform_data dr_utmi_config = { 215static struct mxc_usbh_platform_data dr_utmi_config = {
213 .init = initialize_otg_port, 216 .init = initialize_otg_port,
214 .portsc = MXC_EHCI_UTMI_16BIT, 217 .portsc = MXC_EHCI_UTMI_16BIT,
215 .flags = MXC_EHCI_INTERNAL_PHY,
216}; 218};
217 219
218static struct fsl_usb2_platform_data usb_pdata = { 220static struct fsl_usb2_platform_data usb_pdata = {
@@ -223,7 +225,6 @@ static struct fsl_usb2_platform_data usb_pdata = {
223static struct mxc_usbh_platform_data usbh1_config = { 225static struct mxc_usbh_platform_data usbh1_config = {
224 .init = initialize_usbh1_port, 226 .init = initialize_usbh1_port,
225 .portsc = MXC_EHCI_MODE_ULPI, 227 .portsc = MXC_EHCI_MODE_ULPI,
226 .flags = (MXC_EHCI_POWER_PINS_ENABLED | MXC_EHCI_ITC_NO_THRESHOLD),
227}; 228};
228 229
229static int otg_mode_host; 230static int otg_mode_host;
@@ -298,7 +299,8 @@ MACHINE_START(EUKREA_CPUIMX51, "Eukrea CPUIMX51 Module")
298 /* Maintainer: Eric Bénard <eric@eukrea.com> */ 299 /* Maintainer: Eric Bénard <eric@eukrea.com> */
299 .boot_params = MX51_PHYS_OFFSET + 0x100, 300 .boot_params = MX51_PHYS_OFFSET + 0x100,
300 .map_io = mx51_map_io, 301 .map_io = mx51_map_io,
302 .init_early = imx51_init_early,
301 .init_irq = mx51_init_irq, 303 .init_irq = mx51_init_irq,
302 .init_machine = eukrea_cpuimx51_init,
303 .timer = &mxc_timer, 304 .timer = &mxc_timer,
305 .init_machine = eukrea_cpuimx51_init,
304MACHINE_END 306MACHINE_END
diff --git a/arch/arm/mach-mx5/board-cpuimx51sd.c b/arch/arm/mach-mx5/board-cpuimx51sd.c
index ad931895d8b..29b180823bf 100644
--- a/arch/arm/mach-mx5/board-cpuimx51sd.c
+++ b/arch/arm/mach-mx5/board-cpuimx51sd.c
@@ -42,6 +42,7 @@
42 42
43#include "devices-imx51.h" 43#include "devices-imx51.h"
44#include "devices.h" 44#include "devices.h"
45#include "cpu_op-mx51.h"
45 46
46#define USBH1_RST IMX_GPIO_NR(2, 28) 47#define USBH1_RST IMX_GPIO_NR(2, 28)
47#define ETH_RST IMX_GPIO_NR(2, 31) 48#define ETH_RST IMX_GPIO_NR(2, 31)
@@ -109,7 +110,7 @@ static iomux_v3_cfg_t eukrea_cpuimx51sd_pads[] = {
109 110
110 /* Touchscreen */ 111 /* Touchscreen */
111 /* IRQ */ 112 /* IRQ */
112 _MX51_PAD_CSI1_D8__GPIO3_12 | MUX_PAD_CTRL(PAD_CTL_PUS_22K_UP | 113 _MX51_PAD_GPIO_NAND__GPIO_NAND | MUX_PAD_CTRL(PAD_CTL_PUS_22K_UP |
113 PAD_CTL_PKE | PAD_CTL_SRE_FAST | 114 PAD_CTL_PKE | PAD_CTL_SRE_FAST |
114 PAD_CTL_DSE_HIGH | PAD_CTL_PUE | PAD_CTL_HYS), 115 PAD_CTL_DSE_HIGH | PAD_CTL_PUE | PAD_CTL_HYS),
115}; 116};
@@ -118,15 +119,9 @@ static const struct imxuart_platform_data uart_pdata __initconst = {
118 .flags = IMXUART_HAVE_RTSCTS, 119 .flags = IMXUART_HAVE_RTSCTS,
119}; 120};
120 121
121static int ts_get_pendown_state(void)
122{
123 return gpio_get_value(TSC2007_IRQGPIO) ? 0 : 1;
124}
125
126static struct tsc2007_platform_data tsc2007_info = { 122static struct tsc2007_platform_data tsc2007_info = {
127 .model = 2007, 123 .model = 2007,
128 .x_plate_ohms = 180, 124 .x_plate_ohms = 180,
129 .get_pendown_state = ts_get_pendown_state,
130}; 125};
131 126
132static struct i2c_board_info eukrea_cpuimx51sd_i2c_devices[] = { 127static struct i2c_board_info eukrea_cpuimx51sd_i2c_devices[] = {
@@ -167,7 +162,10 @@ static int initialize_otg_port(struct platform_device *pdev)
167 v |= MX51_USB_PLL_DIV_19_2_MHZ; 162 v |= MX51_USB_PLL_DIV_19_2_MHZ;
168 __raw_writel(v, usbother_base + MXC_USB_PHY_CTR_FUNC2_OFFSET); 163 __raw_writel(v, usbother_base + MXC_USB_PHY_CTR_FUNC2_OFFSET);
169 iounmap(usb_base); 164 iounmap(usb_base);
170 return 0; 165
166 mdelay(10);
167
168 return mx51_initialize_usb_hw(0, MXC_EHCI_INTERNAL_PHY);
171} 169}
172 170
173static int initialize_usbh1_port(struct platform_device *pdev) 171static int initialize_usbh1_port(struct platform_device *pdev)
@@ -186,13 +184,16 @@ static int initialize_usbh1_port(struct platform_device *pdev)
186 __raw_writel(v | MX51_USB_CTRL_UH1_EXT_CLK_EN, 184 __raw_writel(v | MX51_USB_CTRL_UH1_EXT_CLK_EN,
187 usbother_base + MX51_USB_CTRL_1_OFFSET); 185 usbother_base + MX51_USB_CTRL_1_OFFSET);
188 iounmap(usb_base); 186 iounmap(usb_base);
189 return 0; 187
188 mdelay(10);
189
190 return mx51_initialize_usb_hw(1, MXC_EHCI_POWER_PINS_ENABLED |
191 MXC_EHCI_ITC_NO_THRESHOLD);
190} 192}
191 193
192static struct mxc_usbh_platform_data dr_utmi_config = { 194static struct mxc_usbh_platform_data dr_utmi_config = {
193 .init = initialize_otg_port, 195 .init = initialize_otg_port,
194 .portsc = MXC_EHCI_UTMI_16BIT, 196 .portsc = MXC_EHCI_UTMI_16BIT,
195 .flags = MXC_EHCI_INTERNAL_PHY,
196}; 197};
197 198
198static struct fsl_usb2_platform_data usb_pdata = { 199static struct fsl_usb2_platform_data usb_pdata = {
@@ -203,7 +204,6 @@ static struct fsl_usb2_platform_data usb_pdata = {
203static struct mxc_usbh_platform_data usbh1_config = { 204static struct mxc_usbh_platform_data usbh1_config = {
204 .init = initialize_usbh1_port, 205 .init = initialize_usbh1_port,
205 .portsc = MXC_EHCI_MODE_ULPI, 206 .portsc = MXC_EHCI_MODE_ULPI,
206 .flags = (MXC_EHCI_POWER_PINS_ENABLED | MXC_EHCI_ITC_NO_THRESHOLD),
207}; 207};
208 208
209static int otg_mode_host; 209static int otg_mode_host;
@@ -242,7 +242,7 @@ static struct mcp251x_platform_data mcp251x_info = {
242static struct spi_board_info cpuimx51sd_spi_device[] = { 242static struct spi_board_info cpuimx51sd_spi_device[] = {
243 { 243 {
244 .modalias = "mcp2515", 244 .modalias = "mcp2515",
245 .max_speed_hz = 6500000, 245 .max_speed_hz = 10000000,
246 .bus_num = 0, 246 .bus_num = 0,
247 .mode = SPI_MODE_0, 247 .mode = SPI_MODE_0,
248 .chip_select = 0, 248 .chip_select = 0,
@@ -269,6 +269,10 @@ static void __init eukrea_cpuimx51sd_init(void)
269 mxc_iomux_v3_setup_multiple_pads(eukrea_cpuimx51sd_pads, 269 mxc_iomux_v3_setup_multiple_pads(eukrea_cpuimx51sd_pads,
270 ARRAY_SIZE(eukrea_cpuimx51sd_pads)); 270 ARRAY_SIZE(eukrea_cpuimx51sd_pads));
271 271
272#if defined(CONFIG_CPU_FREQ_IMX)
273 get_cpu_op = mx51_get_cpu_op;
274#endif
275
272 imx51_add_imx_uart(0, &uart_pdata); 276 imx51_add_imx_uart(0, &uart_pdata);
273 imx51_add_mxc_nand(&eukrea_cpuimx51sd_nand_board_info); 277 imx51_add_mxc_nand(&eukrea_cpuimx51sd_nand_board_info);
274 278
@@ -329,7 +333,8 @@ MACHINE_START(EUKREA_CPUIMX51SD, "Eukrea CPUIMX51SD")
329 /* Maintainer: Eric Bénard <eric@eukrea.com> */ 333 /* Maintainer: Eric Bénard <eric@eukrea.com> */
330 .boot_params = MX51_PHYS_OFFSET + 0x100, 334 .boot_params = MX51_PHYS_OFFSET + 0x100,
331 .map_io = mx51_map_io, 335 .map_io = mx51_map_io,
336 .init_early = imx51_init_early,
332 .init_irq = mx51_init_irq, 337 .init_irq = mx51_init_irq,
333 .init_machine = eukrea_cpuimx51sd_init,
334 .timer = &mxc_timer, 338 .timer = &mxc_timer,
339 .init_machine = eukrea_cpuimx51sd_init,
335MACHINE_END 340MACHINE_END
diff --git a/arch/arm/mach-mx5/board-mx50_rdp.c b/arch/arm/mach-mx5/board-mx50_rdp.c
index fd32e4c450e..dedf7f2d6d0 100644
--- a/arch/arm/mach-mx5/board-mx50_rdp.c
+++ b/arch/arm/mach-mx5/board-mx50_rdp.c
@@ -35,7 +35,10 @@
35#include <asm/mach/arch.h> 35#include <asm/mach/arch.h>
36#include <asm/mach/time.h> 36#include <asm/mach/time.h>
37 37
38#include "devices-mx50.h" 38#include "devices-imx50.h"
39
40#define FEC_EN IMX_GPIO_NR(6, 23)
41#define FEC_RESET_B IMX_GPIO_NR(4, 12)
39 42
40static iomux_v3_cfg_t mx50_rdp_pads[] __initdata = { 43static iomux_v3_cfg_t mx50_rdp_pads[] __initdata = {
41 /* SD1 */ 44 /* SD1 */
@@ -102,7 +105,7 @@ static iomux_v3_cfg_t mx50_rdp_pads[] __initdata = {
102 MX50_PAD_I2C3_SCL__USBOTG_OC, 105 MX50_PAD_I2C3_SCL__USBOTG_OC,
103 106
104 MX50_PAD_SSI_RXC__FEC_MDIO, 107 MX50_PAD_SSI_RXC__FEC_MDIO,
105 MX50_PAD_SSI_RXC__FEC_MDIO, 108 MX50_PAD_SSI_RXFS__FEC_MDC,
106 MX50_PAD_DISP_D0__FEC_TXCLK, 109 MX50_PAD_DISP_D0__FEC_TXCLK,
107 MX50_PAD_DISP_D1__FEC_RX_ER, 110 MX50_PAD_DISP_D1__FEC_RX_ER,
108 MX50_PAD_DISP_D2__FEC_RX_DV, 111 MX50_PAD_DISP_D2__FEC_RX_DV,
@@ -111,7 +114,6 @@ static iomux_v3_cfg_t mx50_rdp_pads[] __initdata = {
111 MX50_PAD_DISP_D5__FEC_TX_EN, 114 MX50_PAD_DISP_D5__FEC_TX_EN,
112 MX50_PAD_DISP_D6__FEC_TXD1, 115 MX50_PAD_DISP_D6__FEC_TXD1,
113 MX50_PAD_DISP_D7__FEC_TXD0, 116 MX50_PAD_DISP_D7__FEC_TXD0,
114 MX50_PAD_SSI_RXFS__FEC_MDC,
115 MX50_PAD_I2C3_SDA__GPIO_6_23, 117 MX50_PAD_I2C3_SDA__GPIO_6_23,
116 MX50_PAD_ECSPI1_SCLK__GPIO_4_12, 118 MX50_PAD_ECSPI1_SCLK__GPIO_4_12,
117 119
@@ -168,6 +170,24 @@ static const struct imxuart_platform_data uart_pdata __initconst = {
168 .flags = IMXUART_HAVE_RTSCTS, 170 .flags = IMXUART_HAVE_RTSCTS,
169}; 171};
170 172
173static const struct fec_platform_data fec_data __initconst = {
174 .phy = PHY_INTERFACE_MODE_RMII,
175};
176
177static inline void mx50_rdp_fec_reset(void)
178{
179 gpio_request(FEC_EN, "fec-en");
180 gpio_direction_output(FEC_EN, 0);
181 gpio_request(FEC_RESET_B, "fec-reset_b");
182 gpio_direction_output(FEC_RESET_B, 0);
183 msleep(1);
184 gpio_set_value(FEC_RESET_B, 1);
185}
186
187static const struct imxi2c_platform_data i2c_data __initconst = {
188 .bitrate = 100000,
189};
190
171/* 191/*
172 * Board specific initialization. 192 * Board specific initialization.
173 */ 193 */
@@ -178,6 +198,11 @@ static void __init mx50_rdp_board_init(void)
178 198
179 imx50_add_imx_uart(0, &uart_pdata); 199 imx50_add_imx_uart(0, &uart_pdata);
180 imx50_add_imx_uart(1, &uart_pdata); 200 imx50_add_imx_uart(1, &uart_pdata);
201 mx50_rdp_fec_reset();
202 imx50_add_fec(&fec_data);
203 imx50_add_imx_i2c(0, &i2c_data);
204 imx50_add_imx_i2c(1, &i2c_data);
205 imx50_add_imx_i2c(2, &i2c_data);
181} 206}
182 207
183static void __init mx50_rdp_timer_init(void) 208static void __init mx50_rdp_timer_init(void)
@@ -191,7 +216,8 @@ static struct sys_timer mx50_rdp_timer = {
191 216
192MACHINE_START(MX50_RDP, "Freescale MX50 Reference Design Platform") 217MACHINE_START(MX50_RDP, "Freescale MX50 Reference Design Platform")
193 .map_io = mx50_map_io, 218 .map_io = mx50_map_io,
219 .init_early = imx50_init_early,
194 .init_irq = mx50_init_irq, 220 .init_irq = mx50_init_irq,
195 .init_machine = mx50_rdp_board_init,
196 .timer = &mx50_rdp_timer, 221 .timer = &mx50_rdp_timer,
222 .init_machine = mx50_rdp_board_init,
197MACHINE_END 223MACHINE_END
diff --git a/arch/arm/mach-mx5/board-mx51_3ds.c b/arch/arm/mach-mx5/board-mx51_3ds.c
index 49d64484237..63dfbeafbc1 100644
--- a/arch/arm/mach-mx5/board-mx51_3ds.c
+++ b/arch/arm/mach-mx5/board-mx51_3ds.c
@@ -71,24 +71,10 @@ static iomux_v3_cfg_t mx51_3ds_pads[] = {
71}; 71};
72 72
73/* Serial ports */ 73/* Serial ports */
74#if defined(CONFIG_SERIAL_IMX) || defined(CONFIG_SERIAL_IMX_MODULE)
75static const struct imxuart_platform_data uart_pdata __initconst = { 74static const struct imxuart_platform_data uart_pdata __initconst = {
76 .flags = IMXUART_HAVE_RTSCTS, 75 .flags = IMXUART_HAVE_RTSCTS,
77}; 76};
78 77
79static inline void mxc_init_imx_uart(void)
80{
81 imx51_add_imx_uart(0, &uart_pdata);
82 imx51_add_imx_uart(1, &uart_pdata);
83 imx51_add_imx_uart(2, &uart_pdata);
84}
85#else /* !SERIAL_IMX */
86static inline void mxc_init_imx_uart(void)
87{
88}
89#endif /* SERIAL_IMX */
90
91#if defined(CONFIG_KEYBOARD_IMX) || defined(CONFIG_KEYBOARD_IMX_MODULE)
92static int mx51_3ds_board_keymap[] = { 78static int mx51_3ds_board_keymap[] = {
93 KEY(0, 0, KEY_1), 79 KEY(0, 0, KEY_1),
94 KEY(0, 1, KEY_2), 80 KEY(0, 1, KEY_2),
@@ -124,16 +110,6 @@ static const struct matrix_keymap_data mx51_3ds_map_data __initconst = {
124 .keymap_size = ARRAY_SIZE(mx51_3ds_board_keymap), 110 .keymap_size = ARRAY_SIZE(mx51_3ds_board_keymap),
125}; 111};
126 112
127static void mxc_init_keypad(void)
128{
129 imx51_add_imx_keypad(&mx51_3ds_map_data);
130}
131#else
132static inline void mxc_init_keypad(void)
133{
134}
135#endif
136
137static int mx51_3ds_spi2_cs[] = { 113static int mx51_3ds_spi2_cs[] = {
138 MXC_SPI_CS(0), 114 MXC_SPI_CS(0),
139 MX51_3DS_ECSPI2_CS, 115 MX51_3DS_ECSPI2_CS,
@@ -157,11 +133,14 @@ static struct spi_board_info mx51_3ds_spi_nor_device[] = {
157/* 133/*
158 * Board specific initialization. 134 * Board specific initialization.
159 */ 135 */
160static void __init mxc_board_init(void) 136static void __init mx51_3ds_init(void)
161{ 137{
162 mxc_iomux_v3_setup_multiple_pads(mx51_3ds_pads, 138 mxc_iomux_v3_setup_multiple_pads(mx51_3ds_pads,
163 ARRAY_SIZE(mx51_3ds_pads)); 139 ARRAY_SIZE(mx51_3ds_pads));
164 mxc_init_imx_uart(); 140
141 imx51_add_imx_uart(0, &uart_pdata);
142 imx51_add_imx_uart(1, &uart_pdata);
143 imx51_add_imx_uart(2, &uart_pdata);
165 144
166 imx51_add_ecspi(1, &mx51_3ds_ecspi2_pdata); 145 imx51_add_ecspi(1, &mx51_3ds_ecspi2_pdata);
167 spi_register_board_info(mx51_3ds_spi_nor_device, 146 spi_register_board_info(mx51_3ds_spi_nor_device,
@@ -172,7 +151,8 @@ static void __init mxc_board_init(void)
172 "devices on the board are unusable.\n"); 151 "devices on the board are unusable.\n");
173 152
174 imx51_add_sdhci_esdhc_imx(0, NULL); 153 imx51_add_sdhci_esdhc_imx(0, NULL);
175 mxc_init_keypad(); 154 imx51_add_imx_keypad(&mx51_3ds_map_data);
155 imx51_add_imx2_wdt(0, NULL);
176} 156}
177 157
178static void __init mx51_3ds_timer_init(void) 158static void __init mx51_3ds_timer_init(void)
@@ -180,15 +160,16 @@ static void __init mx51_3ds_timer_init(void)
180 mx51_clocks_init(32768, 24000000, 22579200, 0); 160 mx51_clocks_init(32768, 24000000, 22579200, 0);
181} 161}
182 162
183static struct sys_timer mxc_timer = { 163static struct sys_timer mx51_3ds_timer = {
184 .init = mx51_3ds_timer_init, 164 .init = mx51_3ds_timer_init,
185}; 165};
186 166
187MACHINE_START(MX51_3DS, "Freescale MX51 3-Stack Board") 167MACHINE_START(MX51_3DS, "Freescale MX51 3-Stack Board")
188 /* Maintainer: Freescale Semiconductor, Inc. */ 168 /* Maintainer: Freescale Semiconductor, Inc. */
189 .boot_params = MX51_PHYS_OFFSET + 0x100, 169 .boot_params = MX51_PHYS_OFFSET + 0x100,
190 .map_io = mx51_map_io, 170 .map_io = mx51_map_io,
171 .init_early = imx51_init_early,
191 .init_irq = mx51_init_irq, 172 .init_irq = mx51_init_irq,
192 .init_machine = mxc_board_init, 173 .timer = &mx51_3ds_timer,
193 .timer = &mxc_timer, 174 .init_machine = mx51_3ds_init,
194MACHINE_END 175MACHINE_END
diff --git a/arch/arm/mach-mx5/board-mx51_babbage.c b/arch/arm/mach-mx5/board-mx51_babbage.c
index 1d231e84107..b2ecd194e76 100644
--- a/arch/arm/mach-mx5/board-mx51_babbage.c
+++ b/arch/arm/mach-mx5/board-mx51_babbage.c
@@ -161,23 +161,10 @@ static iomux_v3_cfg_t mx51babbage_pads[] = {
161}; 161};
162 162
163/* Serial ports */ 163/* Serial ports */
164#if defined(CONFIG_SERIAL_IMX) || defined(CONFIG_SERIAL_IMX_MODULE)
165static const struct imxuart_platform_data uart_pdata __initconst = { 164static const struct imxuart_platform_data uart_pdata __initconst = {
166 .flags = IMXUART_HAVE_RTSCTS, 165 .flags = IMXUART_HAVE_RTSCTS,
167}; 166};
168 167
169static inline void mxc_init_imx_uart(void)
170{
171 imx51_add_imx_uart(0, &uart_pdata);
172 imx51_add_imx_uart(1, &uart_pdata);
173 imx51_add_imx_uart(2, &uart_pdata);
174}
175#else /* !SERIAL_IMX */
176static inline void mxc_init_imx_uart(void)
177{
178}
179#endif /* SERIAL_IMX */
180
181static const struct imxi2c_platform_data babbage_i2c_data __initconst = { 168static const struct imxi2c_platform_data babbage_i2c_data __initconst = {
182 .bitrate = 100000, 169 .bitrate = 100000,
183}; 170};
@@ -272,7 +259,10 @@ static int initialize_otg_port(struct platform_device *pdev)
272 v |= MX51_USB_PLL_DIV_19_2_MHZ; 259 v |= MX51_USB_PLL_DIV_19_2_MHZ;
273 __raw_writel(v, usbother_base + MXC_USB_PHY_CTR_FUNC2_OFFSET); 260 __raw_writel(v, usbother_base + MXC_USB_PHY_CTR_FUNC2_OFFSET);
274 iounmap(usb_base); 261 iounmap(usb_base);
275 return 0; 262
263 mdelay(10);
264
265 return mx51_initialize_usb_hw(0, MXC_EHCI_INTERNAL_PHY);
276} 266}
277 267
278static int initialize_usbh1_port(struct platform_device *pdev) 268static int initialize_usbh1_port(struct platform_device *pdev)
@@ -290,13 +280,16 @@ static int initialize_usbh1_port(struct platform_device *pdev)
290 v = __raw_readl(usbother_base + MX51_USB_CTRL_1_OFFSET); 280 v = __raw_readl(usbother_base + MX51_USB_CTRL_1_OFFSET);
291 __raw_writel(v | MX51_USB_CTRL_UH1_EXT_CLK_EN, usbother_base + MX51_USB_CTRL_1_OFFSET); 281 __raw_writel(v | MX51_USB_CTRL_UH1_EXT_CLK_EN, usbother_base + MX51_USB_CTRL_1_OFFSET);
292 iounmap(usb_base); 282 iounmap(usb_base);
293 return 0; 283
284 mdelay(10);
285
286 return mx51_initialize_usb_hw(1, MXC_EHCI_POWER_PINS_ENABLED |
287 MXC_EHCI_ITC_NO_THRESHOLD);
294} 288}
295 289
296static struct mxc_usbh_platform_data dr_utmi_config = { 290static struct mxc_usbh_platform_data dr_utmi_config = {
297 .init = initialize_otg_port, 291 .init = initialize_otg_port,
298 .portsc = MXC_EHCI_UTMI_16BIT, 292 .portsc = MXC_EHCI_UTMI_16BIT,
299 .flags = MXC_EHCI_INTERNAL_PHY,
300}; 293};
301 294
302static struct fsl_usb2_platform_data usb_pdata = { 295static struct fsl_usb2_platform_data usb_pdata = {
@@ -307,7 +300,6 @@ static struct fsl_usb2_platform_data usb_pdata = {
307static struct mxc_usbh_platform_data usbh1_config = { 300static struct mxc_usbh_platform_data usbh1_config = {
308 .init = initialize_usbh1_port, 301 .init = initialize_usbh1_port,
309 .portsc = MXC_EHCI_MODE_ULPI, 302 .portsc = MXC_EHCI_MODE_ULPI,
310 .flags = (MXC_EHCI_POWER_PINS_ENABLED | MXC_EHCI_ITC_NO_THRESHOLD),
311}; 303};
312 304
313static int otg_mode_host; 305static int otg_mode_host;
@@ -349,7 +341,7 @@ static const struct spi_imx_master mx51_babbage_spi_pdata __initconst = {
349/* 341/*
350 * Board specific initialization. 342 * Board specific initialization.
351 */ 343 */
352static void __init mxc_board_init(void) 344static void __init mx51_babbage_init(void)
353{ 345{
354 iomux_v3_cfg_t usbh1stp = MX51_PAD_USBH1_STP__USBH1_STP; 346 iomux_v3_cfg_t usbh1stp = MX51_PAD_USBH1_STP__USBH1_STP;
355 iomux_v3_cfg_t power_key = _MX51_PAD_EIM_A27__GPIO2_21 | 347 iomux_v3_cfg_t power_key = _MX51_PAD_EIM_A27__GPIO2_21 |
@@ -360,7 +352,11 @@ static void __init mxc_board_init(void)
360#endif 352#endif
361 mxc_iomux_v3_setup_multiple_pads(mx51babbage_pads, 353 mxc_iomux_v3_setup_multiple_pads(mx51babbage_pads,
362 ARRAY_SIZE(mx51babbage_pads)); 354 ARRAY_SIZE(mx51babbage_pads));
363 mxc_init_imx_uart(); 355
356 imx51_add_imx_uart(0, &uart_pdata);
357 imx51_add_imx_uart(1, &uart_pdata);
358 imx51_add_imx_uart(2, &uart_pdata);
359
364 babbage_fec_reset(); 360 babbage_fec_reset();
365 imx51_add_fec(NULL); 361 imx51_add_fec(NULL);
366 362
@@ -399,15 +395,16 @@ static void __init mx51_babbage_timer_init(void)
399 mx51_clocks_init(32768, 24000000, 22579200, 0); 395 mx51_clocks_init(32768, 24000000, 22579200, 0);
400} 396}
401 397
402static struct sys_timer mxc_timer = { 398static struct sys_timer mx51_babbage_timer = {
403 .init = mx51_babbage_timer_init, 399 .init = mx51_babbage_timer_init,
404}; 400};
405 401
406MACHINE_START(MX51_BABBAGE, "Freescale MX51 Babbage Board") 402MACHINE_START(MX51_BABBAGE, "Freescale MX51 Babbage Board")
407 /* Maintainer: Amit Kucheria <amit.kucheria@canonical.com> */ 403 /* Maintainer: Amit Kucheria <amit.kucheria@canonical.com> */
408 .boot_params = MX51_PHYS_OFFSET + 0x100, 404 .boot_params = MX51_PHYS_OFFSET + 0x100,
409 .map_io = mx51_map_io, 405 .map_io = mx51_map_io,
406 .init_early = imx51_init_early,
410 .init_irq = mx51_init_irq, 407 .init_irq = mx51_init_irq,
411 .init_machine = mxc_board_init, 408 .timer = &mx51_babbage_timer,
412 .timer = &mxc_timer, 409 .init_machine = mx51_babbage_init,
413MACHINE_END 410MACHINE_END
diff --git a/arch/arm/mach-mx5/board-mx51_efikamx.c b/arch/arm/mach-mx5/board-mx51_efikamx.c
index b7946f8e8d4..acab1911cb3 100644
--- a/arch/arm/mach-mx5/board-mx51_efikamx.c
+++ b/arch/arm/mach-mx5/board-mx51_efikamx.c
@@ -25,6 +25,9 @@
25#include <linux/fsl_devices.h> 25#include <linux/fsl_devices.h>
26#include <linux/spi/flash.h> 26#include <linux/spi/flash.h>
27#include <linux/spi/spi.h> 27#include <linux/spi/spi.h>
28#include <linux/mfd/mc13892.h>
29#include <linux/regulator/machine.h>
30#include <linux/regulator/consumer.h>
28 31
29#include <mach/common.h> 32#include <mach/common.h>
30#include <mach/hardware.h> 33#include <mach/hardware.h>
@@ -40,8 +43,7 @@
40 43
41#include "devices-imx51.h" 44#include "devices-imx51.h"
42#include "devices.h" 45#include "devices.h"
43 46#include "efika.h"
44#define MX51_USB_PLL_DIV_24_MHZ 0x01
45 47
46#define EFIKAMX_PCBID0 IMX_GPIO_NR(3, 16) 48#define EFIKAMX_PCBID0 IMX_GPIO_NR(3, 16)
47#define EFIKAMX_PCBID1 IMX_GPIO_NR(3, 17) 49#define EFIKAMX_PCBID1 IMX_GPIO_NR(3, 17)
@@ -53,13 +55,14 @@
53 55
54#define EFIKAMX_POWER_KEY IMX_GPIO_NR(2, 31) 56#define EFIKAMX_POWER_KEY IMX_GPIO_NR(2, 31)
55 57
56#define EFIKAMX_SPI_CS0 IMX_GPIO_NR(4, 24)
57#define EFIKAMX_SPI_CS1 IMX_GPIO_NR(4, 25)
58
59/* board 1.1 doesn't have same reset gpio */ 58/* board 1.1 doesn't have same reset gpio */
60#define EFIKAMX_RESET1_1 IMX_GPIO_NR(3, 2) 59#define EFIKAMX_RESET1_1 IMX_GPIO_NR(3, 2)
61#define EFIKAMX_RESET IMX_GPIO_NR(1, 4) 60#define EFIKAMX_RESET IMX_GPIO_NR(1, 4)
62 61
62#define EFIKAMX_POWEROFF IMX_GPIO_NR(4, 13)
63
64#define EFIKAMX_PMIC IMX_GPIO_NR(1, 6)
65
63/* the pci ids pin have pull up. they're driven low according to board id */ 66/* the pci ids pin have pull up. they're driven low according to board id */
64#define MX51_PAD_PCBID0 IOMUX_PAD(0x518, 0x130, 3, 0x0, 0, PAD_CTL_PUS_100K_UP) 67#define MX51_PAD_PCBID0 IOMUX_PAD(0x518, 0x130, 3, 0x0, 0, PAD_CTL_PUS_100K_UP)
65#define MX51_PAD_PCBID1 IOMUX_PAD(0x51C, 0x134, 3, 0x0, 0, PAD_CTL_PUS_100K_UP) 68#define MX51_PAD_PCBID1 IOMUX_PAD(0x51C, 0x134, 3, 0x0, 0, PAD_CTL_PUS_100K_UP)
@@ -67,38 +70,11 @@
67#define MX51_PAD_PWRKEY IOMUX_PAD(0x48c, 0x0f8, 1, 0x0, 0, PAD_CTL_PUS_100K_UP | PAD_CTL_PKE) 70#define MX51_PAD_PWRKEY IOMUX_PAD(0x48c, 0x0f8, 1, 0x0, 0, PAD_CTL_PUS_100K_UP | PAD_CTL_PKE)
68 71
69static iomux_v3_cfg_t mx51efikamx_pads[] = { 72static iomux_v3_cfg_t mx51efikamx_pads[] = {
70 /* UART1 */
71 MX51_PAD_UART1_RXD__UART1_RXD,
72 MX51_PAD_UART1_TXD__UART1_TXD,
73 MX51_PAD_UART1_RTS__UART1_RTS,
74 MX51_PAD_UART1_CTS__UART1_CTS,
75 /* board id */ 73 /* board id */
76 MX51_PAD_PCBID0, 74 MX51_PAD_PCBID0,
77 MX51_PAD_PCBID1, 75 MX51_PAD_PCBID1,
78 MX51_PAD_PCBID2, 76 MX51_PAD_PCBID2,
79 77
80 /* SD 1 */
81 MX51_PAD_SD1_CMD__SD1_CMD,
82 MX51_PAD_SD1_CLK__SD1_CLK,
83 MX51_PAD_SD1_DATA0__SD1_DATA0,
84 MX51_PAD_SD1_DATA1__SD1_DATA1,
85 MX51_PAD_SD1_DATA2__SD1_DATA2,
86 MX51_PAD_SD1_DATA3__SD1_DATA3,
87
88 /* SD 2 */
89 MX51_PAD_SD2_CMD__SD2_CMD,
90 MX51_PAD_SD2_CLK__SD2_CLK,
91 MX51_PAD_SD2_DATA0__SD2_DATA0,
92 MX51_PAD_SD2_DATA1__SD2_DATA1,
93 MX51_PAD_SD2_DATA2__SD2_DATA2,
94 MX51_PAD_SD2_DATA3__SD2_DATA3,
95
96 /* SD/MMC WP/CD */
97 MX51_PAD_GPIO1_0__SD1_CD,
98 MX51_PAD_GPIO1_1__SD1_WP,
99 MX51_PAD_GPIO1_7__SD2_WP,
100 MX51_PAD_GPIO1_8__SD2_CD,
101
102 /* leds */ 78 /* leds */
103 MX51_PAD_CSI1_D9__GPIO3_13, 79 MX51_PAD_CSI1_D9__GPIO3_13,
104 MX51_PAD_CSI1_VSYNC__GPIO3_14, 80 MX51_PAD_CSI1_VSYNC__GPIO3_14,
@@ -107,64 +83,12 @@ static iomux_v3_cfg_t mx51efikamx_pads[] = {
107 /* power key */ 83 /* power key */
108 MX51_PAD_PWRKEY, 84 MX51_PAD_PWRKEY,
109 85
110 /* spi */
111 MX51_PAD_CSPI1_MOSI__ECSPI1_MOSI,
112 MX51_PAD_CSPI1_MISO__ECSPI1_MISO,
113 MX51_PAD_CSPI1_SS0__GPIO4_24,
114 MX51_PAD_CSPI1_SS1__GPIO4_25,
115 MX51_PAD_CSPI1_RDY__ECSPI1_RDY,
116 MX51_PAD_CSPI1_SCLK__ECSPI1_SCLK,
117
118 /* reset */ 86 /* reset */
119 MX51_PAD_DI1_PIN13__GPIO3_2, 87 MX51_PAD_DI1_PIN13__GPIO3_2,
120 MX51_PAD_GPIO1_4__GPIO1_4, 88 MX51_PAD_GPIO1_4__GPIO1_4,
121};
122 89
123/* Serial ports */ 90 /* power off */
124#if defined(CONFIG_SERIAL_IMX) || defined(CONFIG_SERIAL_IMX_MODULE) 91 MX51_PAD_CSI2_VSYNC__GPIO4_13,
125static const struct imxuart_platform_data uart_pdata = {
126 .flags = IMXUART_HAVE_RTSCTS,
127};
128
129static inline void mxc_init_imx_uart(void)
130{
131 imx51_add_imx_uart(0, &uart_pdata);
132 imx51_add_imx_uart(1, &uart_pdata);
133 imx51_add_imx_uart(2, &uart_pdata);
134}
135#else /* !SERIAL_IMX */
136static inline void mxc_init_imx_uart(void)
137{
138}
139#endif /* SERIAL_IMX */
140
141/* This function is board specific as the bit mask for the plldiv will also
142 * be different for other Freescale SoCs, thus a common bitmask is not
143 * possible and cannot get place in /plat-mxc/ehci.c.
144 */
145static int initialize_otg_port(struct platform_device *pdev)
146{
147 u32 v;
148 void __iomem *usb_base;
149 void __iomem *usbother_base;
150 usb_base = ioremap(MX51_OTG_BASE_ADDR, SZ_4K);
151 if (!usb_base)
152 return -ENOMEM;
153 usbother_base = (void __iomem *)(usb_base + MX5_USBOTHER_REGS_OFFSET);
154
155 /* Set the PHY clock to 19.2MHz */
156 v = __raw_readl(usbother_base + MXC_USB_PHY_CTR_FUNC2_OFFSET);
157 v &= ~MX5_USB_UTMI_PHYCTRL1_PLLDIV_MASK;
158 v |= MX51_USB_PLL_DIV_24_MHZ;
159 __raw_writel(v, usbother_base + MXC_USB_PHY_CTR_FUNC2_OFFSET);
160 iounmap(usb_base);
161 return 0;
162}
163
164static struct mxc_usbh_platform_data dr_utmi_config = {
165 .init = initialize_otg_port,
166 .portsc = MXC_EHCI_UTMI_16BIT,
167 .flags = MXC_EHCI_INTERNAL_PHY,
168}; 92};
169 93
170/* PCBID2 PCBID1 PCBID0 STATE 94/* PCBID2 PCBID1 PCBID0 STATE
@@ -265,47 +189,6 @@ static const struct gpio_keys_platform_data mx51_efikamx_powerkey_data __initcon
265 .nbuttons = ARRAY_SIZE(mx51_efikamx_powerkey), 189 .nbuttons = ARRAY_SIZE(mx51_efikamx_powerkey),
266}; 190};
267 191
268static struct mtd_partition mx51_efikamx_spi_nor_partitions[] = {
269 {
270 .name = "u-boot",
271 .offset = 0,
272 .size = SZ_256K,
273 },
274 {
275 .name = "config",
276 .offset = MTDPART_OFS_APPEND,
277 .size = SZ_64K,
278 },
279};
280
281static struct flash_platform_data mx51_efikamx_spi_flash_data = {
282 .name = "spi_flash",
283 .parts = mx51_efikamx_spi_nor_partitions,
284 .nr_parts = ARRAY_SIZE(mx51_efikamx_spi_nor_partitions),
285 .type = "sst25vf032b",
286};
287
288static struct spi_board_info mx51_efikamx_spi_board_info[] __initdata = {
289 {
290 .modalias = "m25p80",
291 .max_speed_hz = 25000000,
292 .bus_num = 0,
293 .chip_select = 1,
294 .platform_data = &mx51_efikamx_spi_flash_data,
295 .irq = -1,
296 },
297};
298
299static int mx51_efikamx_spi_cs[] = {
300 EFIKAMX_SPI_CS0,
301 EFIKAMX_SPI_CS1,
302};
303
304static const struct spi_imx_master mx51_efikamx_spi_pdata __initconst = {
305 .chipselect = mx51_efikamx_spi_cs,
306 .num_chipselect = ARRAY_SIZE(mx51_efikamx_spi_cs),
307};
308
309void mx51_efikamx_reset(void) 192void mx51_efikamx_reset(void)
310{ 193{
311 if (system_rev == 0x11) 194 if (system_rev == 0x11)
@@ -314,14 +197,53 @@ void mx51_efikamx_reset(void)
314 gpio_direction_output(EFIKAMX_RESET, 0); 197 gpio_direction_output(EFIKAMX_RESET, 0);
315} 198}
316 199
317static void __init mxc_board_init(void) 200static struct regulator *pwgt1, *pwgt2, *coincell;
201
202static void mx51_efikamx_power_off(void)
203{
204 if (!IS_ERR(coincell))
205 regulator_disable(coincell);
206
207 if (!IS_ERR(pwgt1) && !IS_ERR(pwgt2)) {
208 regulator_disable(pwgt2);
209 regulator_disable(pwgt1);
210 }
211 gpio_direction_output(EFIKAMX_POWEROFF, 1);
212}
213
214static int __init mx51_efikamx_power_init(void)
215{
216 if (machine_is_mx51_efikamx()) {
217 pwgt1 = regulator_get(NULL, "pwgt1");
218 pwgt2 = regulator_get(NULL, "pwgt2");
219 if (!IS_ERR(pwgt1) && !IS_ERR(pwgt2)) {
220 regulator_enable(pwgt1);
221 regulator_enable(pwgt2);
222 }
223 gpio_request(EFIKAMX_POWEROFF, "poweroff");
224 pm_power_off = mx51_efikamx_power_off;
225
226 /* enable coincell charger. maybe need a small power driver ? */
227 coincell = regulator_get(NULL, "coincell");
228 if (!IS_ERR(coincell)) {
229 regulator_set_voltage(coincell, 3000000, 3000000);
230 regulator_enable(coincell);
231 }
232
233 regulator_has_full_constraints();
234 }
235
236 return 0;
237}
238late_initcall(mx51_efikamx_power_init);
239
240static void __init mx51_efikamx_init(void)
318{ 241{
319 mxc_iomux_v3_setup_multiple_pads(mx51efikamx_pads, 242 mxc_iomux_v3_setup_multiple_pads(mx51efikamx_pads,
320 ARRAY_SIZE(mx51efikamx_pads)); 243 ARRAY_SIZE(mx51efikamx_pads));
244 efika_board_common_init();
245
321 mx51_efikamx_board_id(); 246 mx51_efikamx_board_id();
322 mxc_register_device(&mxc_usbdr_host_device, &dr_utmi_config);
323 mxc_init_imx_uart();
324 imx51_add_sdhci_esdhc_imx(0, NULL);
325 247
326 /* on < 1.2 boards both SD controllers are used */ 248 /* on < 1.2 boards both SD controllers are used */
327 if (system_rev < 0x12) { 249 if (system_rev < 0x12) {
@@ -332,10 +254,6 @@ static void __init mxc_board_init(void)
332 platform_device_register(&mx51_efikamx_leds_device); 254 platform_device_register(&mx51_efikamx_leds_device);
333 imx51_add_gpio_keys(&mx51_efikamx_powerkey_data); 255 imx51_add_gpio_keys(&mx51_efikamx_powerkey_data);
334 256
335 spi_register_board_info(mx51_efikamx_spi_board_info,
336 ARRAY_SIZE(mx51_efikamx_spi_board_info));
337 imx51_add_ecspi(0, &mx51_efikamx_spi_pdata);
338
339 if (system_rev == 0x11) { 257 if (system_rev == 0x11) {
340 gpio_request(EFIKAMX_RESET1_1, "reset"); 258 gpio_request(EFIKAMX_RESET1_1, "reset");
341 gpio_direction_output(EFIKAMX_RESET1_1, 1); 259 gpio_direction_output(EFIKAMX_RESET1_1, 1);
@@ -343,6 +261,20 @@ static void __init mxc_board_init(void)
343 gpio_request(EFIKAMX_RESET, "reset"); 261 gpio_request(EFIKAMX_RESET, "reset");
344 gpio_direction_output(EFIKAMX_RESET, 1); 262 gpio_direction_output(EFIKAMX_RESET, 1);
345 } 263 }
264
265 /*
266 * enable wifi by default only on mx
267 * sb and mx have same wlan pin but the value to enable it are
268 * different :/
269 */
270 gpio_request(EFIKA_WLAN_EN, "wlan_en");
271 gpio_direction_output(EFIKA_WLAN_EN, 0);
272 msleep(10);
273
274 gpio_request(EFIKA_WLAN_RESET, "wlan_rst");
275 gpio_direction_output(EFIKA_WLAN_RESET, 0);
276 msleep(10);
277 gpio_set_value(EFIKA_WLAN_RESET, 1);
346} 278}
347 279
348static void __init mx51_efikamx_timer_init(void) 280static void __init mx51_efikamx_timer_init(void)
@@ -350,15 +282,16 @@ static void __init mx51_efikamx_timer_init(void)
350 mx51_clocks_init(32768, 24000000, 22579200, 24576000); 282 mx51_clocks_init(32768, 24000000, 22579200, 24576000);
351} 283}
352 284
353static struct sys_timer mxc_timer = { 285static struct sys_timer mx51_efikamx_timer = {
354 .init = mx51_efikamx_timer_init, 286 .init = mx51_efikamx_timer_init,
355}; 287};
356 288
357MACHINE_START(MX51_EFIKAMX, "Genesi EfikaMX nettop") 289MACHINE_START(MX51_EFIKAMX, "Genesi EfikaMX nettop")
358 /* Maintainer: Amit Kucheria <amit.kucheria@linaro.org> */ 290 /* Maintainer: Amit Kucheria <amit.kucheria@linaro.org> */
359 .boot_params = MX51_PHYS_OFFSET + 0x100, 291 .boot_params = MX51_PHYS_OFFSET + 0x100,
360 .map_io = mx51_map_io, 292 .map_io = mx51_map_io,
293 .init_early = imx51_init_early,
361 .init_irq = mx51_init_irq, 294 .init_irq = mx51_init_irq,
362 .init_machine = mxc_board_init, 295 .timer = &mx51_efikamx_timer,
363 .timer = &mxc_timer, 296 .init_machine = mx51_efikamx_init,
364MACHINE_END 297MACHINE_END
diff --git a/arch/arm/mach-mx5/board-mx51_efikasb.c b/arch/arm/mach-mx5/board-mx51_efikasb.c
new file mode 100644
index 00000000000..db04ce8462d
--- /dev/null
+++ b/arch/arm/mach-mx5/board-mx51_efikasb.c
@@ -0,0 +1,283 @@
1/*
2 * Copyright (C) Arnaud Patard <arnaud.patard@rtp-net.org>
3 *
4 * based on code from the following
5 * Copyright 2009-2010 Freescale Semiconductor, Inc. All Rights Reserved.
6 * Copyright 2009-2010 Pegatron Corporation. All Rights Reserved.
7 * Copyright 2009-2010 Genesi USA, Inc. All Rights Reserved.
8 *
9 * The code contained herein is licensed under the GNU General Public
10 * License. You may obtain a copy of the GNU General Public License
11 * Version 2 or later at the following locations:
12 *
13 * http://www.opensource.org/licenses/gpl-license.html
14 * http://www.gnu.org/copyleft/gpl.html
15 */
16
17#include <linux/init.h>
18#include <linux/platform_device.h>
19#include <linux/i2c.h>
20#include <linux/gpio.h>
21#include <linux/leds.h>
22#include <linux/input.h>
23#include <linux/delay.h>
24#include <linux/io.h>
25#include <linux/fsl_devices.h>
26#include <linux/spi/flash.h>
27#include <linux/spi/spi.h>
28#include <linux/mfd/mc13892.h>
29#include <linux/regulator/machine.h>
30#include <linux/regulator/consumer.h>
31#include <linux/usb/otg.h>
32#include <linux/usb/ulpi.h>
33#include <mach/ulpi.h>
34
35#include <mach/common.h>
36#include <mach/hardware.h>
37#include <mach/iomux-mx51.h>
38#include <mach/i2c.h>
39#include <mach/mxc_ehci.h>
40
41#include <asm/irq.h>
42#include <asm/setup.h>
43#include <asm/mach-types.h>
44#include <asm/mach/arch.h>
45#include <asm/mach/time.h>
46
47#include "devices-imx51.h"
48#include "devices.h"
49#include "efika.h"
50
51#define EFIKASB_USBH2_STP IMX_GPIO_NR(2, 20)
52#define EFIKASB_GREEN_LED IMX_GPIO_NR(1, 3)
53#define EFIKASB_WHITE_LED IMX_GPIO_NR(2, 25)
54#define EFIKASB_PCBID0 IMX_GPIO_NR(2, 28)
55#define EFIKASB_PCBID1 IMX_GPIO_NR(2, 29)
56#define EFIKASB_PWRKEY IMX_GPIO_NR(2, 31)
57#define EFIKASB_LID IMX_GPIO_NR(3, 14)
58#define EFIKASB_POWEROFF IMX_GPIO_NR(4, 13)
59#define EFIKASB_RFKILL IMX_GPIO_NR(3, 1)
60
61#define MX51_PAD_PWRKEY IOMUX_PAD(0x48c, 0x0f8, 1, 0x0, 0, PAD_CTL_PUS_100K_UP | PAD_CTL_PKE)
62
63static iomux_v3_cfg_t mx51efikasb_pads[] = {
64 /* USB HOST2 */
65 MX51_PAD_EIM_D16__USBH2_DATA0,
66 MX51_PAD_EIM_D17__USBH2_DATA1,
67 MX51_PAD_EIM_D18__USBH2_DATA2,
68 MX51_PAD_EIM_D19__USBH2_DATA3,
69 MX51_PAD_EIM_D20__USBH2_DATA4,
70 MX51_PAD_EIM_D21__USBH2_DATA5,
71 MX51_PAD_EIM_D22__USBH2_DATA6,
72 MX51_PAD_EIM_D23__USBH2_DATA7,
73 MX51_PAD_EIM_A24__USBH2_CLK,
74 MX51_PAD_EIM_A25__USBH2_DIR,
75 MX51_PAD_EIM_A26__USBH2_STP,
76 MX51_PAD_EIM_A27__USBH2_NXT,
77
78 /* leds */
79 MX51_PAD_EIM_CS0__GPIO2_25,
80 MX51_PAD_GPIO1_3__GPIO1_3,
81
82 /* pcb id */
83 MX51_PAD_EIM_CS3__GPIO2_28,
84 MX51_PAD_EIM_CS4__GPIO2_29,
85
86 /* lid */
87 MX51_PAD_CSI1_VSYNC__GPIO3_14,
88
89 /* power key*/
90 MX51_PAD_PWRKEY,
91
92 /* wifi/bt button */
93 MX51_PAD_DI1_PIN12__GPIO3_1,
94
95 /* power off */
96 MX51_PAD_CSI2_VSYNC__GPIO4_13,
97
98 /* wdog reset */
99 MX51_PAD_GPIO1_4__WDOG1_WDOG_B,
100
101 /* BT */
102 MX51_PAD_EIM_A17__GPIO2_11,
103};
104
105static int initialize_usbh2_port(struct platform_device *pdev)
106{
107 iomux_v3_cfg_t usbh2stp = MX51_PAD_EIM_A26__USBH2_STP;
108 iomux_v3_cfg_t usbh2gpio = MX51_PAD_EIM_A26__GPIO2_20;
109
110 mxc_iomux_v3_setup_pad(usbh2gpio);
111 gpio_request(EFIKASB_USBH2_STP, "usbh2_stp");
112 gpio_direction_output(EFIKASB_USBH2_STP, 0);
113 msleep(1);
114 gpio_set_value(EFIKASB_USBH2_STP, 1);
115 msleep(1);
116
117 gpio_free(EFIKASB_USBH2_STP);
118 mxc_iomux_v3_setup_pad(usbh2stp);
119
120 mdelay(10);
121
122 return mx51_initialize_usb_hw(pdev->id, MXC_EHCI_ITC_NO_THRESHOLD);
123}
124
125static struct mxc_usbh_platform_data usbh2_config = {
126 .init = initialize_usbh2_port,
127 .portsc = MXC_EHCI_MODE_ULPI,
128};
129
130static void __init mx51_efikasb_usb(void)
131{
132 usbh2_config.otg = imx_otg_ulpi_create(ULPI_OTG_DRVVBUS |
133 ULPI_OTG_DRVVBUS_EXT | ULPI_OTG_EXTVBUSIND);
134 if (usbh2_config.otg)
135 mxc_register_device(&mxc_usbh2_device, &usbh2_config);
136}
137
138static struct gpio_led mx51_efikasb_leds[] = {
139 {
140 .name = "efikasb:green",
141 .default_trigger = "default-on",
142 .gpio = EFIKASB_GREEN_LED,
143 .active_low = 1,
144 },
145 {
146 .name = "efikasb:white",
147 .default_trigger = "caps",
148 .gpio = EFIKASB_WHITE_LED,
149 },
150};
151
152static struct gpio_led_platform_data mx51_efikasb_leds_data = {
153 .leds = mx51_efikasb_leds,
154 .num_leds = ARRAY_SIZE(mx51_efikasb_leds),
155};
156
157static struct platform_device mx51_efikasb_leds_device = {
158 .name = "leds-gpio",
159 .id = -1,
160 .dev = {
161 .platform_data = &mx51_efikasb_leds_data,
162 },
163};
164
165static struct gpio_keys_button mx51_efikasb_keys[] = {
166 {
167 .code = KEY_POWER,
168 .gpio = EFIKASB_PWRKEY,
169 .type = EV_PWR,
170 .desc = "Power Button",
171 .wakeup = 1,
172 .debounce_interval = 10, /* ms */
173 },
174 {
175 .code = SW_LID,
176 .gpio = EFIKASB_LID,
177 .type = EV_SW,
178 .desc = "Lid Switch",
179 },
180 {
181 /* SW_RFKILLALL vs KEY_RFKILL ? */
182 .code = SW_RFKILL_ALL,
183 .gpio = EFIKASB_RFKILL,
184 .type = EV_SW,
185 .desc = "rfkill",
186 },
187};
188
189static const struct gpio_keys_platform_data mx51_efikasb_keys_data __initconst = {
190 .buttons = mx51_efikasb_keys,
191 .nbuttons = ARRAY_SIZE(mx51_efikasb_keys),
192};
193
194static struct regulator *pwgt1, *pwgt2;
195
196static void mx51_efikasb_power_off(void)
197{
198 gpio_set_value(EFIKA_USB_PHY_RESET, 0);
199
200 if (!IS_ERR(pwgt1) && !IS_ERR(pwgt2)) {
201 regulator_disable(pwgt2);
202 regulator_disable(pwgt1);
203 }
204 gpio_direction_output(EFIKASB_POWEROFF, 1);
205}
206
207static int __init mx51_efikasb_power_init(void)
208{
209 if (machine_is_mx51_efikasb()) {
210 pwgt1 = regulator_get(NULL, "pwgt1");
211 pwgt2 = regulator_get(NULL, "pwgt2");
212 if (!IS_ERR(pwgt1) && !IS_ERR(pwgt2)) {
213 regulator_enable(pwgt1);
214 regulator_enable(pwgt2);
215 }
216 gpio_request(EFIKASB_POWEROFF, "poweroff");
217 pm_power_off = mx51_efikasb_power_off;
218
219 regulator_has_full_constraints();
220 }
221
222 return 0;
223}
224late_initcall(mx51_efikasb_power_init);
225
226/* 01 R1.3 board
227 10 R2.0 board */
228static void __init mx51_efikasb_board_id(void)
229{
230 int id;
231
232 gpio_request(EFIKASB_PCBID0, "pcb id0");
233 gpio_direction_input(EFIKASB_PCBID0);
234 gpio_request(EFIKASB_PCBID1, "pcb id1");
235 gpio_direction_input(EFIKASB_PCBID1);
236
237 id = gpio_get_value(EFIKASB_PCBID0);
238 id |= gpio_get_value(EFIKASB_PCBID1) << 1;
239
240 switch (id) {
241 default:
242 break;
243 case 1:
244 system_rev = 0x13;
245 break;
246 case 2:
247 system_rev = 0x20;
248 break;
249 }
250}
251
252static void __init efikasb_board_init(void)
253{
254 mxc_iomux_v3_setup_multiple_pads(mx51efikasb_pads,
255 ARRAY_SIZE(mx51efikasb_pads));
256 efika_board_common_init();
257
258 mx51_efikasb_board_id();
259 mx51_efikasb_usb();
260 imx51_add_sdhci_esdhc_imx(1, NULL);
261
262 platform_device_register(&mx51_efikasb_leds_device);
263 imx51_add_gpio_keys(&mx51_efikasb_keys_data);
264
265}
266
267static void __init mx51_efikasb_timer_init(void)
268{
269 mx51_clocks_init(32768, 24000000, 22579200, 24576000);
270}
271
272static struct sys_timer mx51_efikasb_timer = {
273 .init = mx51_efikasb_timer_init,
274};
275
276MACHINE_START(MX51_EFIKASB, "Genesi Efika Smartbook")
277 .boot_params = MX51_PHYS_OFFSET + 0x100,
278 .map_io = mx51_map_io,
279 .init_early = imx51_init_early,
280 .init_irq = mx51_init_irq,
281 .init_machine = efikasb_board_init,
282 .timer = &mx51_efikasb_timer,
283MACHINE_END
diff --git a/arch/arm/mach-mx5/board-mx53_evk.c b/arch/arm/mach-mx5/board-mx53_evk.c
index caee04c0823..7b5735c5ea5 100644
--- a/arch/arm/mach-mx5/board-mx53_evk.c
+++ b/arch/arm/mach-mx5/board-mx53_evk.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (C) 2010 Freescale Semiconductor, Inc. All Rights Reserved. 2 * Copyright (C) 2010-2011 Freescale Semiconductor, Inc. All Rights Reserved.
3 * Copyright (C) 2010 Yong Shen. <Yong.Shen@linaro.org> 3 * Copyright (C) 2010 Yong Shen. <Yong.Shen@linaro.org>
4 */ 4 */
5 5
@@ -42,28 +42,24 @@
42#include "devices-imx53.h" 42#include "devices-imx53.h"
43 43
44static iomux_v3_cfg_t mx53_evk_pads[] = { 44static iomux_v3_cfg_t mx53_evk_pads[] = {
45 MX53_PAD_CSI0_D10__UART1_TXD, 45 MX53_PAD_CSI0_DAT10__UART1_TXD_MUX,
46 MX53_PAD_CSI0_D11__UART1_RXD, 46 MX53_PAD_CSI0_DAT11__UART1_RXD_MUX,
47 MX53_PAD_ATA_DIOW__UART1_TXD,
48 MX53_PAD_ATA_DMACK__UART1_RXD,
49 47
50 MX53_PAD_ATA_BUFFER_EN__UART2_RXD, 48 MX53_PAD_PATA_BUFFER_EN__UART2_RXD_MUX,
51 MX53_PAD_ATA_DMARQ__UART2_TXD, 49 MX53_PAD_PATA_DMARQ__UART2_TXD_MUX,
52 MX53_PAD_ATA_DIOR__UART2_RTS, 50 MX53_PAD_PATA_DIOR__UART2_RTS,
53 MX53_PAD_ATA_INTRQ__UART2_CTS, 51 MX53_PAD_PATA_INTRQ__UART2_CTS,
54 52
55 MX53_PAD_ATA_CS_0__UART3_TXD, 53 MX53_PAD_PATA_CS_0__UART3_TXD_MUX,
56 MX53_PAD_ATA_CS_1__UART3_RXD, 54 MX53_PAD_PATA_CS_1__UART3_RXD_MUX,
57 MX53_PAD_ATA_DA_1__UART3_CTS,
58 MX53_PAD_ATA_DA_2__UART3_RTS,
59 55
60 MX53_PAD_EIM_D16__CSPI1_SCLK, 56 MX53_PAD_EIM_D16__ECSPI1_SCLK,
61 MX53_PAD_EIM_D17__CSPI1_MISO, 57 MX53_PAD_EIM_D17__ECSPI1_MISO,
62 MX53_PAD_EIM_D18__CSPI1_MOSI, 58 MX53_PAD_EIM_D18__ECSPI1_MOSI,
63 59
64 /* ecspi chip select lines */ 60 /* ecspi chip select lines */
65 MX53_PAD_EIM_EB2__GPIO_2_30, 61 MX53_PAD_EIM_EB2__GPIO2_30,
66 MX53_PAD_EIM_D19__GPIO_3_19, 62 MX53_PAD_EIM_D19__GPIO3_19,
67}; 63};
68 64
69static const struct imxuart_platform_data mx53_evk_uart_pdata __initconst = { 65static const struct imxuart_platform_data mx53_evk_uart_pdata __initconst = {
@@ -72,9 +68,9 @@ static const struct imxuart_platform_data mx53_evk_uart_pdata __initconst = {
72 68
73static inline void mx53_evk_init_uart(void) 69static inline void mx53_evk_init_uart(void)
74{ 70{
75 imx53_add_imx_uart(0, &mx53_evk_uart_pdata); 71 imx53_add_imx_uart(0, NULL);
76 imx53_add_imx_uart(1, &mx53_evk_uart_pdata); 72 imx53_add_imx_uart(1, &mx53_evk_uart_pdata);
77 imx53_add_imx_uart(2, &mx53_evk_uart_pdata); 73 imx53_add_imx_uart(2, NULL);
78} 74}
79 75
80static const struct imxi2c_platform_data mx53_evk_i2c_data __initconst = { 76static const struct imxi2c_platform_data mx53_evk_i2c_data __initconst = {
@@ -139,6 +135,7 @@ static void __init mx53_evk_board_init(void)
139 spi_register_board_info(mx53_evk_spi_board_info, 135 spi_register_board_info(mx53_evk_spi_board_info,
140 ARRAY_SIZE(mx53_evk_spi_board_info)); 136 ARRAY_SIZE(mx53_evk_spi_board_info));
141 imx53_add_ecspi(0, &mx53_evk_spi_data); 137 imx53_add_ecspi(0, &mx53_evk_spi_data);
138 imx53_add_imx2_wdt(0, NULL);
142} 139}
143 140
144static void __init mx53_evk_timer_init(void) 141static void __init mx53_evk_timer_init(void)
@@ -152,7 +149,8 @@ static struct sys_timer mx53_evk_timer = {
152 149
153MACHINE_START(MX53_EVK, "Freescale MX53 EVK Board") 150MACHINE_START(MX53_EVK, "Freescale MX53 EVK Board")
154 .map_io = mx53_map_io, 151 .map_io = mx53_map_io,
152 .init_early = imx53_init_early,
155 .init_irq = mx53_init_irq, 153 .init_irq = mx53_init_irq,
156 .init_machine = mx53_evk_board_init,
157 .timer = &mx53_evk_timer, 154 .timer = &mx53_evk_timer,
155 .init_machine = mx53_evk_board_init,
158MACHINE_END 156MACHINE_END
diff --git a/arch/arm/mach-mx5/board-mx53_loco.c b/arch/arm/mach-mx5/board-mx53_loco.c
index d1348e04ace..0a18f8d23eb 100644
--- a/arch/arm/mach-mx5/board-mx53_loco.c
+++ b/arch/arm/mach-mx5/board-mx53_loco.c
@@ -39,33 +39,147 @@
39#define LOCO_FEC_PHY_RST IMX_GPIO_NR(7, 6) 39#define LOCO_FEC_PHY_RST IMX_GPIO_NR(7, 6)
40 40
41static iomux_v3_cfg_t mx53_loco_pads[] = { 41static iomux_v3_cfg_t mx53_loco_pads[] = {
42 MX53_PAD_CSI0_D10__UART1_TXD, 42 /* FEC */
43 MX53_PAD_CSI0_D11__UART1_RXD, 43 MX53_PAD_FEC_MDC__FEC_MDC,
44 MX53_PAD_ATA_DIOW__UART1_TXD, 44 MX53_PAD_FEC_MDIO__FEC_MDIO,
45 MX53_PAD_ATA_DMACK__UART1_RXD, 45 MX53_PAD_FEC_REF_CLK__FEC_TX_CLK,
46 46 MX53_PAD_FEC_RX_ER__FEC_RX_ER,
47 MX53_PAD_ATA_BUFFER_EN__UART2_RXD, 47 MX53_PAD_FEC_CRS_DV__FEC_RX_DV,
48 MX53_PAD_ATA_DMARQ__UART2_TXD, 48 MX53_PAD_FEC_RXD1__FEC_RDATA_1,
49 MX53_PAD_ATA_DIOR__UART2_RTS, 49 MX53_PAD_FEC_RXD0__FEC_RDATA_0,
50 MX53_PAD_ATA_INTRQ__UART2_CTS, 50 MX53_PAD_FEC_TX_EN__FEC_TX_EN,
51 51 MX53_PAD_FEC_TXD1__FEC_TDATA_1,
52 MX53_PAD_ATA_CS_0__UART3_TXD, 52 MX53_PAD_FEC_TXD0__FEC_TDATA_0,
53 MX53_PAD_ATA_CS_1__UART3_RXD, 53 /* FEC_nRST */
54 MX53_PAD_ATA_DA_1__UART3_CTS, 54 MX53_PAD_PATA_DA_0__GPIO7_6,
55 MX53_PAD_ATA_DA_2__UART3_RTS, 55 /* FEC_nINT */
56 MX53_PAD_PATA_DATA4__GPIO2_4,
57 /* AUDMUX5 */
58 MX53_PAD_KEY_COL0__AUDMUX_AUD5_TXC,
59 MX53_PAD_KEY_ROW0__AUDMUX_AUD5_TXD,
60 MX53_PAD_KEY_COL1__AUDMUX_AUD5_TXFS,
61 MX53_PAD_KEY_ROW1__AUDMUX_AUD5_RXD,
62 /* I2C2 */
63 MX53_PAD_KEY_COL3__I2C2_SCL,
64 MX53_PAD_KEY_ROW3__I2C2_SDA,
65 /* SD1 */
66 MX53_PAD_SD1_CMD__ESDHC1_CMD,
67 MX53_PAD_SD1_CLK__ESDHC1_CLK,
68 MX53_PAD_SD1_DATA0__ESDHC1_DAT0,
69 MX53_PAD_SD1_DATA1__ESDHC1_DAT1,
70 MX53_PAD_SD1_DATA2__ESDHC1_DAT2,
71 MX53_PAD_SD1_DATA3__ESDHC1_DAT3,
72 /* SD3 */
73 MX53_PAD_PATA_DATA8__ESDHC3_DAT0,
74 MX53_PAD_PATA_DATA9__ESDHC3_DAT1,
75 MX53_PAD_PATA_DATA10__ESDHC3_DAT2,
76 MX53_PAD_PATA_DATA11__ESDHC3_DAT3,
77 MX53_PAD_PATA_DATA0__ESDHC3_DAT4,
78 MX53_PAD_PATA_DATA1__ESDHC3_DAT5,
79 MX53_PAD_PATA_DATA2__ESDHC3_DAT6,
80 MX53_PAD_PATA_DATA3__ESDHC3_DAT7,
81 MX53_PAD_PATA_IORDY__ESDHC3_CLK,
82 MX53_PAD_PATA_RESET_B__ESDHC3_CMD,
83 /* SD3_CD */
84 MX53_PAD_EIM_DA11__GPIO3_11,
85 /* SD3_WP */
86 MX53_PAD_EIM_DA12__GPIO3_12,
87 /* VGA */
88 MX53_PAD_EIM_OE__IPU_DI1_PIN7,
89 MX53_PAD_EIM_RW__IPU_DI1_PIN8,
90 /* DISPLB */
91 MX53_PAD_EIM_D20__IPU_SER_DISP0_CS,
92 MX53_PAD_EIM_D21__IPU_DISPB0_SER_CLK,
93 MX53_PAD_EIM_D22__IPU_DISPB0_SER_DIN,
94 MX53_PAD_EIM_D23__IPU_DI0_D0_CS,
95 /* DISP0_POWER_EN */
96 MX53_PAD_EIM_D24__GPIO3_24,
97 /* DISP0 DET INT */
98 MX53_PAD_EIM_D31__GPIO3_31,
99 /* LVDS */
100 MX53_PAD_LVDS0_TX3_P__LDB_LVDS0_TX3,
101 MX53_PAD_LVDS0_CLK_P__LDB_LVDS0_CLK,
102 MX53_PAD_LVDS0_TX2_P__LDB_LVDS0_TX2,
103 MX53_PAD_LVDS0_TX1_P__LDB_LVDS0_TX1,
104 MX53_PAD_LVDS0_TX0_P__LDB_LVDS0_TX0,
105 MX53_PAD_LVDS1_TX3_P__LDB_LVDS1_TX3,
106 MX53_PAD_LVDS1_TX2_P__LDB_LVDS1_TX2,
107 MX53_PAD_LVDS1_CLK_P__LDB_LVDS1_CLK,
108 MX53_PAD_LVDS1_TX1_P__LDB_LVDS1_TX1,
109 MX53_PAD_LVDS1_TX0_P__LDB_LVDS1_TX0,
110 /* I2C1 */
111 MX53_PAD_CSI0_DAT8__I2C1_SDA,
112 MX53_PAD_CSI0_DAT9__I2C1_SCL,
113 /* UART1 */
114 MX53_PAD_CSI0_DAT10__UART1_TXD_MUX,
115 MX53_PAD_CSI0_DAT11__UART1_RXD_MUX,
116 /* CSI0 */
117 MX53_PAD_CSI0_DAT12__IPU_CSI0_D_12,
118 MX53_PAD_CSI0_DAT13__IPU_CSI0_D_13,
119 MX53_PAD_CSI0_DAT14__IPU_CSI0_D_14,
120 MX53_PAD_CSI0_DAT15__IPU_CSI0_D_15,
121 MX53_PAD_CSI0_DAT16__IPU_CSI0_D_16,
122 MX53_PAD_CSI0_DAT17__IPU_CSI0_D_17,
123 MX53_PAD_CSI0_DAT18__IPU_CSI0_D_18,
124 MX53_PAD_CSI0_DAT19__IPU_CSI0_D_19,
125 MX53_PAD_CSI0_VSYNC__IPU_CSI0_VSYNC,
126 MX53_PAD_CSI0_MCLK__IPU_CSI0_HSYNC,
127 MX53_PAD_CSI0_PIXCLK__IPU_CSI0_PIXCLK,
128 /* DISPLAY */
129 MX53_PAD_DI0_DISP_CLK__IPU_DI0_DISP_CLK,
130 MX53_PAD_DI0_PIN15__IPU_DI0_PIN15,
131 MX53_PAD_DI0_PIN2__IPU_DI0_PIN2,
132 MX53_PAD_DI0_PIN3__IPU_DI0_PIN3,
133 MX53_PAD_DISP0_DAT0__IPU_DISP0_DAT_0,
134 MX53_PAD_DISP0_DAT1__IPU_DISP0_DAT_1,
135 MX53_PAD_DISP0_DAT2__IPU_DISP0_DAT_2,
136 MX53_PAD_DISP0_DAT3__IPU_DISP0_DAT_3,
137 MX53_PAD_DISP0_DAT4__IPU_DISP0_DAT_4,
138 MX53_PAD_DISP0_DAT5__IPU_DISP0_DAT_5,
139 MX53_PAD_DISP0_DAT6__IPU_DISP0_DAT_6,
140 MX53_PAD_DISP0_DAT7__IPU_DISP0_DAT_7,
141 MX53_PAD_DISP0_DAT8__IPU_DISP0_DAT_8,
142 MX53_PAD_DISP0_DAT9__IPU_DISP0_DAT_9,
143 MX53_PAD_DISP0_DAT10__IPU_DISP0_DAT_10,
144 MX53_PAD_DISP0_DAT11__IPU_DISP0_DAT_11,
145 MX53_PAD_DISP0_DAT12__IPU_DISP0_DAT_12,
146 MX53_PAD_DISP0_DAT13__IPU_DISP0_DAT_13,
147 MX53_PAD_DISP0_DAT14__IPU_DISP0_DAT_14,
148 MX53_PAD_DISP0_DAT15__IPU_DISP0_DAT_15,
149 MX53_PAD_DISP0_DAT16__IPU_DISP0_DAT_16,
150 MX53_PAD_DISP0_DAT17__IPU_DISP0_DAT_17,
151 MX53_PAD_DISP0_DAT18__IPU_DISP0_DAT_18,
152 MX53_PAD_DISP0_DAT19__IPU_DISP0_DAT_19,
153 MX53_PAD_DISP0_DAT20__IPU_DISP0_DAT_20,
154 MX53_PAD_DISP0_DAT21__IPU_DISP0_DAT_21,
155 MX53_PAD_DISP0_DAT22__IPU_DISP0_DAT_22,
156 MX53_PAD_DISP0_DAT23__IPU_DISP0_DAT_23,
157 /* Audio CLK*/
158 MX53_PAD_GPIO_0__CCM_SSI_EXT1_CLK,
159 /* PWM */
160 MX53_PAD_GPIO_1__PWM2_PWMO,
161 /* SPDIF */
162 MX53_PAD_GPIO_7__SPDIF_PLOCK,
163 MX53_PAD_GPIO_17__SPDIF_OUT1,
164 /* GPIO */
165 MX53_PAD_PATA_DA_1__GPIO7_7,
166 MX53_PAD_PATA_DA_2__GPIO7_8,
167 MX53_PAD_PATA_DATA5__GPIO2_5,
168 MX53_PAD_PATA_DATA6__GPIO2_6,
169 MX53_PAD_PATA_DATA14__GPIO2_14,
170 MX53_PAD_PATA_DATA15__GPIO2_15,
171 MX53_PAD_PATA_INTRQ__GPIO7_2,
172 MX53_PAD_EIM_WAIT__GPIO5_0,
173 MX53_PAD_NANDF_WP_B__GPIO6_9,
174 MX53_PAD_NANDF_RB0__GPIO6_10,
175 MX53_PAD_NANDF_CS1__GPIO6_14,
176 MX53_PAD_NANDF_CS2__GPIO6_15,
177 MX53_PAD_NANDF_CS3__GPIO6_16,
178 MX53_PAD_GPIO_5__GPIO1_5,
179 MX53_PAD_GPIO_16__GPIO7_11,
180 MX53_PAD_GPIO_8__GPIO1_8,
56}; 181};
57 182
58static const struct imxuart_platform_data mx53_loco_uart_data __initconst = {
59 .flags = IMXUART_HAVE_RTSCTS,
60};
61
62static inline void mx53_loco_init_uart(void)
63{
64 imx53_add_imx_uart(0, &mx53_loco_uart_data);
65 imx53_add_imx_uart(1, &mx53_loco_uart_data);
66 imx53_add_imx_uart(2, &mx53_loco_uart_data);
67}
68
69static inline void mx53_loco_fec_reset(void) 183static inline void mx53_loco_fec_reset(void)
70{ 184{
71 int ret; 185 int ret;
@@ -85,13 +199,22 @@ static struct fec_platform_data mx53_loco_fec_data = {
85 .phy = PHY_INTERFACE_MODE_RMII, 199 .phy = PHY_INTERFACE_MODE_RMII,
86}; 200};
87 201
202static const struct imxi2c_platform_data mx53_loco_i2c_data __initconst = {
203 .bitrate = 100000,
204};
205
88static void __init mx53_loco_board_init(void) 206static void __init mx53_loco_board_init(void)
89{ 207{
90 mxc_iomux_v3_setup_multiple_pads(mx53_loco_pads, 208 mxc_iomux_v3_setup_multiple_pads(mx53_loco_pads,
91 ARRAY_SIZE(mx53_loco_pads)); 209 ARRAY_SIZE(mx53_loco_pads));
92 mx53_loco_init_uart(); 210 imx53_add_imx_uart(0, NULL);
93 mx53_loco_fec_reset(); 211 mx53_loco_fec_reset();
94 imx53_add_fec(&mx53_loco_fec_data); 212 imx53_add_fec(&mx53_loco_fec_data);
213 imx53_add_imx2_wdt(0, NULL);
214 imx53_add_imx_i2c(0, &mx53_loco_i2c_data);
215 imx53_add_imx_i2c(1, &mx53_loco_i2c_data);
216 imx53_add_sdhci_esdhc_imx(0, NULL);
217 imx53_add_sdhci_esdhc_imx(2, NULL);
95} 218}
96 219
97static void __init mx53_loco_timer_init(void) 220static void __init mx53_loco_timer_init(void)
@@ -105,7 +228,8 @@ static struct sys_timer mx53_loco_timer = {
105 228
106MACHINE_START(MX53_LOCO, "Freescale MX53 LOCO Board") 229MACHINE_START(MX53_LOCO, "Freescale MX53 LOCO Board")
107 .map_io = mx53_map_io, 230 .map_io = mx53_map_io,
231 .init_early = imx53_init_early,
108 .init_irq = mx53_init_irq, 232 .init_irq = mx53_init_irq,
109 .init_machine = mx53_loco_board_init,
110 .timer = &mx53_loco_timer, 233 .timer = &mx53_loco_timer,
234 .init_machine = mx53_loco_board_init,
111MACHINE_END 235MACHINE_END
diff --git a/arch/arm/mach-mx5/board-mx53_smd.c b/arch/arm/mach-mx5/board-mx53_smd.c
index 7970f7a4858..31e173267ed 100644
--- a/arch/arm/mach-mx5/board-mx53_smd.c
+++ b/arch/arm/mach-mx5/board-mx53_smd.c
@@ -39,20 +39,19 @@
39#define SMD_FEC_PHY_RST IMX_GPIO_NR(7, 6) 39#define SMD_FEC_PHY_RST IMX_GPIO_NR(7, 6)
40 40
41static iomux_v3_cfg_t mx53_smd_pads[] = { 41static iomux_v3_cfg_t mx53_smd_pads[] = {
42 MX53_PAD_CSI0_D10__UART1_TXD, 42 MX53_PAD_CSI0_DAT10__UART1_TXD_MUX,
43 MX53_PAD_CSI0_D11__UART1_RXD, 43 MX53_PAD_CSI0_DAT11__UART1_RXD_MUX,
44 MX53_PAD_ATA_DIOW__UART1_TXD, 44
45 MX53_PAD_ATA_DMACK__UART1_RXD, 45 MX53_PAD_PATA_BUFFER_EN__UART2_RXD_MUX,
46 46 MX53_PAD_PATA_DMARQ__UART2_TXD_MUX,
47 MX53_PAD_ATA_BUFFER_EN__UART2_RXD, 47
48 MX53_PAD_ATA_DMARQ__UART2_TXD, 48 MX53_PAD_PATA_CS_0__UART3_TXD_MUX,
49 MX53_PAD_ATA_DIOR__UART2_RTS, 49 MX53_PAD_PATA_CS_1__UART3_RXD_MUX,
50 MX53_PAD_ATA_INTRQ__UART2_CTS, 50 MX53_PAD_PATA_DA_1__UART3_CTS,
51 51 MX53_PAD_PATA_DA_2__UART3_RTS,
52 MX53_PAD_ATA_CS_0__UART3_TXD, 52 /* I2C1 */
53 MX53_PAD_ATA_CS_1__UART3_RXD, 53 MX53_PAD_CSI0_DAT8__I2C1_SDA,
54 MX53_PAD_ATA_DA_1__UART3_CTS, 54 MX53_PAD_CSI0_DAT9__I2C1_SCL,
55 MX53_PAD_ATA_DA_2__UART3_RTS,
56}; 55};
57 56
58static const struct imxuart_platform_data mx53_smd_uart_data __initconst = { 57static const struct imxuart_platform_data mx53_smd_uart_data __initconst = {
@@ -61,8 +60,8 @@ static const struct imxuart_platform_data mx53_smd_uart_data __initconst = {
61 60
62static inline void mx53_smd_init_uart(void) 61static inline void mx53_smd_init_uart(void)
63{ 62{
64 imx53_add_imx_uart(0, &mx53_smd_uart_data); 63 imx53_add_imx_uart(0, NULL);
65 imx53_add_imx_uart(1, &mx53_smd_uart_data); 64 imx53_add_imx_uart(1, NULL);
66 imx53_add_imx_uart(2, &mx53_smd_uart_data); 65 imx53_add_imx_uart(2, &mx53_smd_uart_data);
67} 66}
68 67
@@ -85,6 +84,10 @@ static struct fec_platform_data mx53_smd_fec_data = {
85 .phy = PHY_INTERFACE_MODE_RMII, 84 .phy = PHY_INTERFACE_MODE_RMII,
86}; 85};
87 86
87static const struct imxi2c_platform_data mx53_smd_i2c_data __initconst = {
88 .bitrate = 100000,
89};
90
88static void __init mx53_smd_board_init(void) 91static void __init mx53_smd_board_init(void)
89{ 92{
90 mxc_iomux_v3_setup_multiple_pads(mx53_smd_pads, 93 mxc_iomux_v3_setup_multiple_pads(mx53_smd_pads,
@@ -92,6 +95,8 @@ static void __init mx53_smd_board_init(void)
92 mx53_smd_init_uart(); 95 mx53_smd_init_uart();
93 mx53_smd_fec_reset(); 96 mx53_smd_fec_reset();
94 imx53_add_fec(&mx53_smd_fec_data); 97 imx53_add_fec(&mx53_smd_fec_data);
98 imx53_add_imx2_wdt(0, NULL);
99 imx53_add_imx_i2c(0, &mx53_smd_i2c_data);
95} 100}
96 101
97static void __init mx53_smd_timer_init(void) 102static void __init mx53_smd_timer_init(void)
@@ -105,7 +110,8 @@ static struct sys_timer mx53_smd_timer = {
105 110
106MACHINE_START(MX53_SMD, "Freescale MX53 SMD Board") 111MACHINE_START(MX53_SMD, "Freescale MX53 SMD Board")
107 .map_io = mx53_map_io, 112 .map_io = mx53_map_io,
113 .init_early = imx53_init_early,
108 .init_irq = mx53_init_irq, 114 .init_irq = mx53_init_irq,
109 .init_machine = mx53_smd_board_init,
110 .timer = &mx53_smd_timer, 115 .timer = &mx53_smd_timer,
116 .init_machine = mx53_smd_board_init,
111MACHINE_END 117MACHINE_END
diff --git a/arch/arm/mach-mx5/clock-mx51-mx53.c b/arch/arm/mach-mx5/clock-mx51-mx53.c
index 0a19e7567c0..652ace41382 100644
--- a/arch/arm/mach-mx5/clock-mx51-mx53.c
+++ b/arch/arm/mach-mx5/clock-mx51-mx53.c
@@ -42,6 +42,9 @@ static struct clk usboh3_clk;
42static struct clk emi_fast_clk; 42static struct clk emi_fast_clk;
43static struct clk ipu_clk; 43static struct clk ipu_clk;
44static struct clk mipi_hsc1_clk; 44static struct clk mipi_hsc1_clk;
45static struct clk esdhc1_clk;
46static struct clk esdhc2_clk;
47static struct clk esdhc3_mx53_clk;
45 48
46#define MAX_DPLL_WAIT_TRIES 1000 /* 1000 * udelay(1) = 1ms */ 49#define MAX_DPLL_WAIT_TRIES 1000 /* 1000 * udelay(1) = 1ms */
47 50
@@ -867,10 +870,6 @@ static struct clk gpt_32k_clk = {
867 .parent = &ckil_clk, 870 .parent = &ckil_clk,
868}; 871};
869 872
870static struct clk kpp_clk = {
871 .id = 0,
872};
873
874static struct clk dummy_clk = { 873static struct clk dummy_clk = {
875 .id = 0, 874 .id = 0,
876}; 875};
@@ -1147,10 +1146,80 @@ CLK_GET_RATE(esdhc1, 1, ESDHC1_MSHC1)
1147CLK_SET_PARENT(esdhc1, 1, ESDHC1_MSHC1) 1146CLK_SET_PARENT(esdhc1, 1, ESDHC1_MSHC1)
1148CLK_SET_RATE(esdhc1, 1, ESDHC1_MSHC1) 1147CLK_SET_RATE(esdhc1, 1, ESDHC1_MSHC1)
1149 1148
1149/* mx51 specific */
1150CLK_GET_RATE(esdhc2, 1, ESDHC2_MSHC2) 1150CLK_GET_RATE(esdhc2, 1, ESDHC2_MSHC2)
1151CLK_SET_PARENT(esdhc2, 1, ESDHC2_MSHC2) 1151CLK_SET_PARENT(esdhc2, 1, ESDHC2_MSHC2)
1152CLK_SET_RATE(esdhc2, 1, ESDHC2_MSHC2) 1152CLK_SET_RATE(esdhc2, 1, ESDHC2_MSHC2)
1153 1153
1154static int clk_esdhc3_set_parent(struct clk *clk, struct clk *parent)
1155{
1156 u32 reg;
1157
1158 reg = __raw_readl(MXC_CCM_CSCMR1);
1159 if (parent == &esdhc1_clk)
1160 reg &= ~MXC_CCM_CSCMR1_ESDHC3_CLK_SEL;
1161 else if (parent == &esdhc2_clk)
1162 reg |= MXC_CCM_CSCMR1_ESDHC3_CLK_SEL;
1163 else
1164 return -EINVAL;
1165 __raw_writel(reg, MXC_CCM_CSCMR1);
1166
1167 return 0;
1168}
1169
1170static int clk_esdhc4_set_parent(struct clk *clk, struct clk *parent)
1171{
1172 u32 reg;
1173
1174 reg = __raw_readl(MXC_CCM_CSCMR1);
1175 if (parent == &esdhc1_clk)
1176 reg &= ~MXC_CCM_CSCMR1_ESDHC4_CLK_SEL;
1177 else if (parent == &esdhc2_clk)
1178 reg |= MXC_CCM_CSCMR1_ESDHC4_CLK_SEL;
1179 else
1180 return -EINVAL;
1181 __raw_writel(reg, MXC_CCM_CSCMR1);
1182
1183 return 0;
1184}
1185
1186/* mx53 specific */
1187static int clk_esdhc2_mx53_set_parent(struct clk *clk, struct clk *parent)
1188{
1189 u32 reg;
1190
1191 reg = __raw_readl(MXC_CCM_CSCMR1);
1192 if (parent == &esdhc1_clk)
1193 reg &= ~MXC_CCM_CSCMR1_ESDHC2_MSHC2_MX53_CLK_SEL;
1194 else if (parent == &esdhc3_mx53_clk)
1195 reg |= MXC_CCM_CSCMR1_ESDHC2_MSHC2_MX53_CLK_SEL;
1196 else
1197 return -EINVAL;
1198 __raw_writel(reg, MXC_CCM_CSCMR1);
1199
1200 return 0;
1201}
1202
1203CLK_GET_RATE(esdhc3_mx53, 1, ESDHC3_MX53)
1204CLK_SET_PARENT(esdhc3_mx53, 1, ESDHC3_MX53)
1205CLK_SET_RATE(esdhc3_mx53, 1, ESDHC3_MX53)
1206
1207static int clk_esdhc4_mx53_set_parent(struct clk *clk, struct clk *parent)
1208{
1209 u32 reg;
1210
1211 reg = __raw_readl(MXC_CCM_CSCMR1);
1212 if (parent == &esdhc1_clk)
1213 reg &= ~MXC_CCM_CSCMR1_ESDHC4_CLK_SEL;
1214 else if (parent == &esdhc3_mx53_clk)
1215 reg |= MXC_CCM_CSCMR1_ESDHC4_CLK_SEL;
1216 else
1217 return -EINVAL;
1218 __raw_writel(reg, MXC_CCM_CSCMR1);
1219
1220 return 0;
1221}
1222
1154#define DEFINE_CLOCK_FULL(name, i, er, es, gr, sr, e, d, p, s) \ 1223#define DEFINE_CLOCK_FULL(name, i, er, es, gr, sr, e, d, p, s) \
1155 static struct clk name = { \ 1224 static struct clk name = { \
1156 .id = i, \ 1225 .id = i, \
@@ -1255,9 +1324,62 @@ DEFINE_CLOCK_MAX(esdhc1_clk, 0, MXC_CCM_CCGR3, MXC_CCM_CCGRx_CG1_OFFSET,
1255 clk_esdhc1, &pll2_sw_clk, &esdhc1_ipg_clk); 1324 clk_esdhc1, &pll2_sw_clk, &esdhc1_ipg_clk);
1256DEFINE_CLOCK_FULL(esdhc2_ipg_clk, 1, MXC_CCM_CCGR3, MXC_CCM_CCGRx_CG2_OFFSET, 1325DEFINE_CLOCK_FULL(esdhc2_ipg_clk, 1, MXC_CCM_CCGR3, MXC_CCM_CCGRx_CG2_OFFSET,
1257 NULL, NULL, _clk_max_enable, _clk_max_disable, &ipg_clk, NULL); 1326 NULL, NULL, _clk_max_enable, _clk_max_disable, &ipg_clk, NULL);
1327DEFINE_CLOCK_FULL(esdhc3_ipg_clk, 2, MXC_CCM_CCGR3, MXC_CCM_CCGRx_CG4_OFFSET,
1328 NULL, NULL, _clk_max_enable, _clk_max_disable, &ipg_clk, NULL);
1329DEFINE_CLOCK_FULL(esdhc4_ipg_clk, 3, MXC_CCM_CCGR3, MXC_CCM_CCGRx_CG6_OFFSET,
1330 NULL, NULL, _clk_max_enable, _clk_max_disable, &ipg_clk, NULL);
1331
1332/* mx51 specific */
1258DEFINE_CLOCK_MAX(esdhc2_clk, 1, MXC_CCM_CCGR3, MXC_CCM_CCGRx_CG3_OFFSET, 1333DEFINE_CLOCK_MAX(esdhc2_clk, 1, MXC_CCM_CCGR3, MXC_CCM_CCGRx_CG3_OFFSET,
1259 clk_esdhc2, &pll2_sw_clk, &esdhc2_ipg_clk); 1334 clk_esdhc2, &pll2_sw_clk, &esdhc2_ipg_clk);
1260 1335
1336static struct clk esdhc3_clk = {
1337 .id = 2,
1338 .parent = &esdhc1_clk,
1339 .set_parent = clk_esdhc3_set_parent,
1340 .enable_reg = MXC_CCM_CCGR3,
1341 .enable_shift = MXC_CCM_CCGRx_CG5_OFFSET,
1342 .enable = _clk_max_enable,
1343 .disable = _clk_max_disable,
1344 .secondary = &esdhc3_ipg_clk,
1345};
1346static struct clk esdhc4_clk = {
1347 .id = 3,
1348 .parent = &esdhc1_clk,
1349 .set_parent = clk_esdhc4_set_parent,
1350 .enable_reg = MXC_CCM_CCGR3,
1351 .enable_shift = MXC_CCM_CCGRx_CG7_OFFSET,
1352 .enable = _clk_max_enable,
1353 .disable = _clk_max_disable,
1354 .secondary = &esdhc4_ipg_clk,
1355};
1356
1357/* mx53 specific */
1358static struct clk esdhc2_mx53_clk = {
1359 .id = 2,
1360 .parent = &esdhc1_clk,
1361 .set_parent = clk_esdhc2_mx53_set_parent,
1362 .enable_reg = MXC_CCM_CCGR3,
1363 .enable_shift = MXC_CCM_CCGRx_CG3_OFFSET,
1364 .enable = _clk_max_enable,
1365 .disable = _clk_max_disable,
1366 .secondary = &esdhc3_ipg_clk,
1367};
1368
1369DEFINE_CLOCK_MAX(esdhc3_mx53_clk, 2, MXC_CCM_CCGR3, MXC_CCM_CCGRx_CG5_OFFSET,
1370 clk_esdhc3_mx53, &pll2_sw_clk, &esdhc2_ipg_clk);
1371
1372static struct clk esdhc4_mx53_clk = {
1373 .id = 3,
1374 .parent = &esdhc1_clk,
1375 .set_parent = clk_esdhc4_mx53_set_parent,
1376 .enable_reg = MXC_CCM_CCGR3,
1377 .enable_shift = MXC_CCM_CCGRx_CG7_OFFSET,
1378 .enable = _clk_max_enable,
1379 .disable = _clk_max_disable,
1380 .secondary = &esdhc4_ipg_clk,
1381};
1382
1261DEFINE_CLOCK(mipi_esc_clk, 0, MXC_CCM_CCGR4, MXC_CCM_CCGRx_CG5_OFFSET, NULL, NULL, NULL, &pll2_sw_clk); 1383DEFINE_CLOCK(mipi_esc_clk, 0, MXC_CCM_CCGR4, MXC_CCM_CCGRx_CG5_OFFSET, NULL, NULL, NULL, &pll2_sw_clk);
1262DEFINE_CLOCK(mipi_hsc2_clk, 0, MXC_CCM_CCGR4, MXC_CCM_CCGRx_CG4_OFFSET, NULL, NULL, &mipi_esc_clk, &pll2_sw_clk); 1384DEFINE_CLOCK(mipi_hsc2_clk, 0, MXC_CCM_CCGR4, MXC_CCM_CCGRx_CG4_OFFSET, NULL, NULL, &mipi_esc_clk, &pll2_sw_clk);
1263DEFINE_CLOCK(mipi_hsc1_clk, 0, MXC_CCM_CCGR4, MXC_CCM_CCGRx_CG3_OFFSET, NULL, NULL, &mipi_hsc2_clk, &pll2_sw_clk); 1385DEFINE_CLOCK(mipi_hsc1_clk, 0, MXC_CCM_CCGR4, MXC_CCM_CCGRx_CG3_OFFSET, NULL, NULL, &mipi_hsc2_clk, &pll2_sw_clk);
@@ -1302,7 +1424,7 @@ static struct clk_lookup mx51_lookups[] = {
1302 _REGISTER_CLOCK("mxc-ehci.2", "usb_ahb", usb_ahb_clk) 1424 _REGISTER_CLOCK("mxc-ehci.2", "usb_ahb", usb_ahb_clk)
1303 _REGISTER_CLOCK("fsl-usb2-udc", "usb", usboh3_clk) 1425 _REGISTER_CLOCK("fsl-usb2-udc", "usb", usboh3_clk)
1304 _REGISTER_CLOCK("fsl-usb2-udc", "usb_ahb", ahb_clk) 1426 _REGISTER_CLOCK("fsl-usb2-udc", "usb_ahb", ahb_clk)
1305 _REGISTER_CLOCK("imx-keypad", NULL, kpp_clk) 1427 _REGISTER_CLOCK("imx-keypad", NULL, dummy_clk)
1306 _REGISTER_CLOCK("mxc_nand", NULL, nfc_clk) 1428 _REGISTER_CLOCK("mxc_nand", NULL, nfc_clk)
1307 _REGISTER_CLOCK("imx-ssi.0", NULL, ssi1_clk) 1429 _REGISTER_CLOCK("imx-ssi.0", NULL, ssi1_clk)
1308 _REGISTER_CLOCK("imx-ssi.1", NULL, ssi2_clk) 1430 _REGISTER_CLOCK("imx-ssi.1", NULL, ssi2_clk)
@@ -1316,6 +1438,8 @@ static struct clk_lookup mx51_lookups[] = {
1316 _REGISTER_CLOCK("imx51-cspi.0", NULL, cspi_clk) 1438 _REGISTER_CLOCK("imx51-cspi.0", NULL, cspi_clk)
1317 _REGISTER_CLOCK("sdhci-esdhc-imx.0", NULL, esdhc1_clk) 1439 _REGISTER_CLOCK("sdhci-esdhc-imx.0", NULL, esdhc1_clk)
1318 _REGISTER_CLOCK("sdhci-esdhc-imx.1", NULL, esdhc2_clk) 1440 _REGISTER_CLOCK("sdhci-esdhc-imx.1", NULL, esdhc2_clk)
1441 _REGISTER_CLOCK("sdhci-esdhc-imx.2", NULL, esdhc3_clk)
1442 _REGISTER_CLOCK("sdhci-esdhc-imx.3", NULL, esdhc4_clk)
1319 _REGISTER_CLOCK(NULL, "cpu_clk", cpu_clk) 1443 _REGISTER_CLOCK(NULL, "cpu_clk", cpu_clk)
1320 _REGISTER_CLOCK(NULL, "iim_clk", iim_clk) 1444 _REGISTER_CLOCK(NULL, "iim_clk", iim_clk)
1321 _REGISTER_CLOCK("imx2-wdt.0", NULL, dummy_clk) 1445 _REGISTER_CLOCK("imx2-wdt.0", NULL, dummy_clk)
@@ -1336,10 +1460,14 @@ static struct clk_lookup mx53_lookups[] = {
1336 _REGISTER_CLOCK("imx-i2c.0", NULL, i2c1_clk) 1460 _REGISTER_CLOCK("imx-i2c.0", NULL, i2c1_clk)
1337 _REGISTER_CLOCK("imx-i2c.1", NULL, i2c2_clk) 1461 _REGISTER_CLOCK("imx-i2c.1", NULL, i2c2_clk)
1338 _REGISTER_CLOCK("sdhci-esdhc-imx.0", NULL, esdhc1_clk) 1462 _REGISTER_CLOCK("sdhci-esdhc-imx.0", NULL, esdhc1_clk)
1339 _REGISTER_CLOCK("sdhci-esdhc-imx.1", NULL, esdhc2_clk) 1463 _REGISTER_CLOCK("sdhci-esdhc-imx.1", NULL, esdhc2_mx53_clk)
1464 _REGISTER_CLOCK("sdhci-esdhc-imx.2", NULL, esdhc3_mx53_clk)
1465 _REGISTER_CLOCK("sdhci-esdhc-imx.3", NULL, esdhc4_mx53_clk)
1340 _REGISTER_CLOCK("imx53-ecspi.0", NULL, ecspi1_clk) 1466 _REGISTER_CLOCK("imx53-ecspi.0", NULL, ecspi1_clk)
1341 _REGISTER_CLOCK("imx53-ecspi.1", NULL, ecspi2_clk) 1467 _REGISTER_CLOCK("imx53-ecspi.1", NULL, ecspi2_clk)
1342 _REGISTER_CLOCK("imx53-cspi.0", NULL, cspi_clk) 1468 _REGISTER_CLOCK("imx53-cspi.0", NULL, cspi_clk)
1469 _REGISTER_CLOCK("imx2-wdt.0", NULL, dummy_clk)
1470 _REGISTER_CLOCK("imx2-wdt.1", NULL, dummy_clk)
1343}; 1471};
1344 1472
1345static void clk_tree_init(void) 1473static void clk_tree_init(void)
@@ -1427,6 +1555,14 @@ int __init mx53_clocks_init(unsigned long ckil, unsigned long osc,
1427 mx53_revision(); 1555 mx53_revision();
1428 clk_disable(&iim_clk); 1556 clk_disable(&iim_clk);
1429 1557
1558 /* Set SDHC parents to be PLL2 */
1559 clk_set_parent(&esdhc1_clk, &pll2_sw_clk);
1560 clk_set_parent(&esdhc3_mx53_clk, &pll2_sw_clk);
1561
1562 /* set SDHC root clock as 200MHZ*/
1563 clk_set_rate(&esdhc1_clk, 200000000);
1564 clk_set_rate(&esdhc3_mx53_clk, 200000000);
1565
1430 /* System timer */ 1566 /* System timer */
1431 mxc_timer_init(&gpt_clk, MX53_IO_ADDRESS(MX53_GPT1_BASE_ADDR), 1567 mxc_timer_init(&gpt_clk, MX53_IO_ADDRESS(MX53_GPT1_BASE_ADDR),
1432 MX53_INT_GPT); 1568 MX53_INT_GPT);
diff --git a/arch/arm/mach-mx5/cpu.c b/arch/arm/mach-mx5/cpu.c
index d40671da437..df46b5e6085 100644
--- a/arch/arm/mach-mx5/cpu.c
+++ b/arch/arm/mach-mx5/cpu.c
@@ -78,11 +78,16 @@ static int get_mx53_srev(void)
78 void __iomem *iim_base = MX51_IO_ADDRESS(MX53_IIM_BASE_ADDR); 78 void __iomem *iim_base = MX51_IO_ADDRESS(MX53_IIM_BASE_ADDR);
79 u32 rev = readl(iim_base + IIM_SREV) & 0xff; 79 u32 rev = readl(iim_base + IIM_SREV) & 0xff;
80 80
81 if (rev == 0x0) 81 switch (rev) {
82 case 0x0:
82 return IMX_CHIP_REVISION_1_0; 83 return IMX_CHIP_REVISION_1_0;
83 else if (rev == 0x10) 84 case 0x2:
84 return IMX_CHIP_REVISION_2_0; 85 return IMX_CHIP_REVISION_2_0;
85 return 0; 86 case 0x3:
87 return IMX_CHIP_REVISION_2_1;
88 default:
89 return IMX_CHIP_REVISION_UNKNOWN;
90 }
86} 91}
87 92
88/* 93/*
diff --git a/arch/arm/mach-mx5/crm_regs.h b/arch/arm/mach-mx5/crm_regs.h
index b462c22f53d..87c0c58f27a 100644
--- a/arch/arm/mach-mx5/crm_regs.h
+++ b/arch/arm/mach-mx5/crm_regs.h
@@ -217,9 +217,12 @@
217#define MXC_CCM_CSCMR1_ESDHC1_MSHC1_CLK_SEL_OFFSET (20) 217#define MXC_CCM_CSCMR1_ESDHC1_MSHC1_CLK_SEL_OFFSET (20)
218#define MXC_CCM_CSCMR1_ESDHC1_MSHC1_CLK_SEL_MASK (0x3 << 20) 218#define MXC_CCM_CSCMR1_ESDHC1_MSHC1_CLK_SEL_MASK (0x3 << 20)
219#define MXC_CCM_CSCMR1_ESDHC3_CLK_SEL (0x1 << 19) 219#define MXC_CCM_CSCMR1_ESDHC3_CLK_SEL (0x1 << 19)
220#define MXC_CCM_CSCMR1_ESDHC2_MSHC2_MX53_CLK_SEL (0x1 << 19)
220#define MXC_CCM_CSCMR1_ESDHC4_CLK_SEL (0x1 << 18) 221#define MXC_CCM_CSCMR1_ESDHC4_CLK_SEL (0x1 << 18)
221#define MXC_CCM_CSCMR1_ESDHC2_MSHC2_CLK_SEL_OFFSET (16) 222#define MXC_CCM_CSCMR1_ESDHC2_MSHC2_CLK_SEL_OFFSET (16)
222#define MXC_CCM_CSCMR1_ESDHC2_MSHC2_CLK_SEL_MASK (0x3 << 16) 223#define MXC_CCM_CSCMR1_ESDHC2_MSHC2_CLK_SEL_MASK (0x3 << 16)
224#define MXC_CCM_CSCMR1_ESDHC3_MX53_CLK_SEL_OFFSET (16)
225#define MXC_CCM_CSCMR1_ESDHC3_MX53_CLK_SEL_MASK (0x3 << 16)
223#define MXC_CCM_CSCMR1_SSI1_CLK_SEL_OFFSET (14) 226#define MXC_CCM_CSCMR1_SSI1_CLK_SEL_OFFSET (14)
224#define MXC_CCM_CSCMR1_SSI1_CLK_SEL_MASK (0x3 << 14) 227#define MXC_CCM_CSCMR1_SSI1_CLK_SEL_MASK (0x3 << 14)
225#define MXC_CCM_CSCMR1_SSI2_CLK_SEL_OFFSET (12) 228#define MXC_CCM_CSCMR1_SSI2_CLK_SEL_OFFSET (12)
@@ -271,6 +274,10 @@
271#define MXC_CCM_CSCDR1_ESDHC2_MSHC2_CLK_PRED_MASK (0x7 << 22) 274#define MXC_CCM_CSCDR1_ESDHC2_MSHC2_CLK_PRED_MASK (0x7 << 22)
272#define MXC_CCM_CSCDR1_ESDHC2_MSHC2_CLK_PODF_OFFSET (19) 275#define MXC_CCM_CSCDR1_ESDHC2_MSHC2_CLK_PODF_OFFSET (19)
273#define MXC_CCM_CSCDR1_ESDHC2_MSHC2_CLK_PODF_MASK (0x7 << 19) 276#define MXC_CCM_CSCDR1_ESDHC2_MSHC2_CLK_PODF_MASK (0x7 << 19)
277#define MXC_CCM_CSCDR1_ESDHC3_MX53_CLK_PRED_OFFSET (22)
278#define MXC_CCM_CSCDR1_ESDHC3_MX53_CLK_PRED_MASK (0x7 << 22)
279#define MXC_CCM_CSCDR1_ESDHC3_MX53_CLK_PODF_OFFSET (19)
280#define MXC_CCM_CSCDR1_ESDHC3_MX53_CLK_PODF_MASK (0x7 << 19)
274#define MXC_CCM_CSCDR1_ESDHC1_MSHC1_CLK_PRED_OFFSET (16) 281#define MXC_CCM_CSCDR1_ESDHC1_MSHC1_CLK_PRED_OFFSET (16)
275#define MXC_CCM_CSCDR1_ESDHC1_MSHC1_CLK_PRED_MASK (0x7 << 16) 282#define MXC_CCM_CSCDR1_ESDHC1_MSHC1_CLK_PRED_MASK (0x7 << 16)
276#define MXC_CCM_CSCDR1_PGC_CLK_PODF_OFFSET (14) 283#define MXC_CCM_CSCDR1_PGC_CLK_PODF_OFFSET (14)
diff --git a/arch/arm/mach-mx5/devices-mx50.h b/arch/arm/mach-mx5/devices-imx50.h
index 98ab07468a0..c9e42823c7e 100644
--- a/arch/arm/mach-mx5/devices-mx50.h
+++ b/arch/arm/mach-mx5/devices-imx50.h
@@ -24,3 +24,11 @@
24extern const struct imx_imx_uart_1irq_data imx50_imx_uart_data[] __initconst; 24extern const struct imx_imx_uart_1irq_data imx50_imx_uart_data[] __initconst;
25#define imx50_add_imx_uart(id, pdata) \ 25#define imx50_add_imx_uart(id, pdata) \
26 imx_add_imx_uart_1irq(&imx50_imx_uart_data[id], pdata) 26 imx_add_imx_uart_1irq(&imx50_imx_uart_data[id], pdata)
27
28extern const struct imx_fec_data imx50_fec_data __initconst;
29#define imx50_add_fec(pdata) \
30 imx_add_fec(&imx50_fec_data, pdata)
31
32extern const struct imx_imx_i2c_data imx50_imx_i2c_data[] __initconst;
33#define imx50_add_imx_i2c(id, pdata) \
34 imx_add_imx_i2c(&imx50_imx_i2c_data[id], pdata)
diff --git a/arch/arm/mach-mx5/devices-imx53.h b/arch/arm/mach-mx5/devices-imx53.h
index 8639735a117..9251008dad1 100644
--- a/arch/arm/mach-mx5/devices-imx53.h
+++ b/arch/arm/mach-mx5/devices-imx53.h
@@ -29,3 +29,7 @@ imx53_sdhci_esdhc_imx_data[] __initconst;
29extern const struct imx_spi_imx_data imx53_ecspi_data[] __initconst; 29extern const struct imx_spi_imx_data imx53_ecspi_data[] __initconst;
30#define imx53_add_ecspi(id, pdata) \ 30#define imx53_add_ecspi(id, pdata) \
31 imx_add_spi_imx(&imx53_ecspi_data[id], pdata) 31 imx_add_spi_imx(&imx53_ecspi_data[id], pdata)
32
33extern const struct imx_imx2_wdt_data imx53_imx2_wdt_data[] __initconst;
34#define imx53_add_imx2_wdt(id, pdata) \
35 imx_add_imx2_wdt(&imx53_imx2_wdt_data[id])
diff --git a/arch/arm/mach-mx5/efika.h b/arch/arm/mach-mx5/efika.h
new file mode 100644
index 00000000000..014aa985faa
--- /dev/null
+++ b/arch/arm/mach-mx5/efika.h
@@ -0,0 +1,10 @@
1#ifndef _EFIKA_H
2#define _EFIKA_H
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
8void __init efika_board_common_init(void);
9
10#endif
diff --git a/arch/arm/mach-mx5/ehci.c b/arch/arm/mach-mx5/ehci.c
new file mode 100644
index 00000000000..7ce12c804a3
--- /dev/null
+++ b/arch/arm/mach-mx5/ehci.c
@@ -0,0 +1,156 @@
1/*
2 * Copyright (c) 2009 Daniel Mack <daniel@caiaq.de>
3 * Copyright (C) 2010 Freescale Semiconductor, Inc.
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License as published by the
7 * Free Software Foundation; either version 2 of the License, or (at your
8 * option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
13 * for more details.
14 */
15
16#include <linux/platform_device.h>
17#include <linux/io.h>
18
19#include <mach/hardware.h>
20#include <mach/mxc_ehci.h>
21
22#define MXC_OTG_OFFSET 0
23#define MXC_H1_OFFSET 0x200
24#define MXC_H2_OFFSET 0x400
25
26/* USB_CTRL */
27#define MXC_OTG_UCTRL_OWIE_BIT (1 << 27) /* OTG wakeup intr enable */
28#define MXC_OTG_UCTRL_OPM_BIT (1 << 24) /* OTG power mask */
29#define MXC_H1_UCTRL_H1UIE_BIT (1 << 12) /* Host1 ULPI interrupt enable */
30#define MXC_H1_UCTRL_H1WIE_BIT (1 << 11) /* HOST1 wakeup intr enable */
31#define MXC_H1_UCTRL_H1PM_BIT (1 << 8) /* HOST1 power mask */
32
33/* USB_PHY_CTRL_FUNC */
34#define MXC_OTG_PHYCTRL_OC_DIS_BIT (1 << 8) /* OTG Disable Overcurrent Event */
35#define MXC_H1_OC_DIS_BIT (1 << 5) /* UH1 Disable Overcurrent Event */
36
37/* USBH2CTRL */
38#define MXC_H2_UCTRL_H2UIE_BIT (1 << 8)
39#define MXC_H2_UCTRL_H2WIE_BIT (1 << 7)
40#define MXC_H2_UCTRL_H2PM_BIT (1 << 4)
41
42#define MXC_USBCMD_OFFSET 0x140
43
44/* USBCMD */
45#define MXC_UCMD_ITC_NO_THRESHOLD_MASK (~(0xff << 16)) /* Interrupt Threshold Control */
46
47int mx51_initialize_usb_hw(int port, unsigned int flags)
48{
49 unsigned int v;
50 void __iomem *usb_base;
51 void __iomem *usbotg_base;
52 void __iomem *usbother_base;
53 int ret = 0;
54
55 usb_base = ioremap(MX51_OTG_BASE_ADDR, SZ_4K);
56 if (!usb_base) {
57 printk(KERN_ERR "%s(): ioremap failed\n", __func__);
58 return -ENOMEM;
59 }
60
61 switch (port) {
62 case 0: /* OTG port */
63 usbotg_base = usb_base + MXC_OTG_OFFSET;
64 break;
65 case 1: /* Host 1 port */
66 usbotg_base = usb_base + MXC_H1_OFFSET;
67 break;
68 case 2: /* Host 2 port */
69 usbotg_base = usb_base + MXC_H2_OFFSET;
70 break;
71 default:
72 printk(KERN_ERR"%s no such port %d\n", __func__, port);
73 ret = -ENOENT;
74 goto error;
75 }
76 usbother_base = usb_base + MX5_USBOTHER_REGS_OFFSET;
77
78 switch (port) {
79 case 0: /*OTG port */
80 if (flags & MXC_EHCI_INTERNAL_PHY) {
81 v = __raw_readl(usbother_base + MXC_USB_PHY_CTR_FUNC_OFFSET);
82
83 if (flags & MXC_EHCI_POWER_PINS_ENABLED) {
84 /* OC/USBPWR is not used */
85 v |= MXC_OTG_PHYCTRL_OC_DIS_BIT;
86 } else {
87 /* OC/USBPWR is used */
88 v &= ~MXC_OTG_PHYCTRL_OC_DIS_BIT;
89 }
90 __raw_writel(v, usbother_base + MXC_USB_PHY_CTR_FUNC_OFFSET);
91
92 v = __raw_readl(usbother_base + MXC_USBCTRL_OFFSET);
93 if (flags & MXC_EHCI_WAKEUP_ENABLED)
94 v |= MXC_OTG_UCTRL_OWIE_BIT;/* OTG wakeup enable */
95 else
96 v &= ~MXC_OTG_UCTRL_OWIE_BIT;/* OTG wakeup disable */
97 if (flags & MXC_EHCI_POWER_PINS_ENABLED)
98 v |= MXC_OTG_UCTRL_OPM_BIT;
99 else
100 v &= ~MXC_OTG_UCTRL_OPM_BIT;
101 __raw_writel(v, usbother_base + MXC_USBCTRL_OFFSET);
102 }
103 break;
104 case 1: /* Host 1 */
105 /*Host ULPI */
106 v = __raw_readl(usbother_base + MXC_USBCTRL_OFFSET);
107 if (flags & MXC_EHCI_WAKEUP_ENABLED) {
108 /* HOST1 wakeup/ULPI intr enable */
109 v |= (MXC_H1_UCTRL_H1WIE_BIT | MXC_H1_UCTRL_H1UIE_BIT);
110 } else {
111 /* HOST1 wakeup/ULPI intr disable */
112 v &= ~(MXC_H1_UCTRL_H1WIE_BIT | MXC_H1_UCTRL_H1UIE_BIT);
113 }
114
115 if (flags & MXC_EHCI_POWER_PINS_ENABLED)
116 v &= ~MXC_H1_UCTRL_H1PM_BIT; /* HOST1 power mask used*/
117 else
118 v |= MXC_H1_UCTRL_H1PM_BIT; /* HOST1 power mask used*/
119 __raw_writel(v, usbother_base + MXC_USBCTRL_OFFSET);
120
121 v = __raw_readl(usbother_base + MXC_USB_PHY_CTR_FUNC_OFFSET);
122 if (flags & MXC_EHCI_POWER_PINS_ENABLED)
123 v &= ~MXC_H1_OC_DIS_BIT; /* OC is used */
124 else
125 v |= MXC_H1_OC_DIS_BIT; /* OC is not used */
126 __raw_writel(v, usbother_base + MXC_USB_PHY_CTR_FUNC_OFFSET);
127
128 v = __raw_readl(usbotg_base + MXC_USBCMD_OFFSET);
129 if (flags & MXC_EHCI_ITC_NO_THRESHOLD)
130 /* Interrupt Threshold Control:Immediate (no threshold) */
131 v &= MXC_UCMD_ITC_NO_THRESHOLD_MASK;
132 __raw_writel(v, usbotg_base + MXC_USBCMD_OFFSET);
133 break;
134 case 2: /* Host 2 ULPI */
135 v = __raw_readl(usbother_base + MXC_USBH2CTRL_OFFSET);
136 if (flags & MXC_EHCI_WAKEUP_ENABLED) {
137 /* HOST1 wakeup/ULPI intr enable */
138 v |= (MXC_H2_UCTRL_H2WIE_BIT | MXC_H2_UCTRL_H2UIE_BIT);
139 } else {
140 /* HOST1 wakeup/ULPI intr disable */
141 v &= ~(MXC_H2_UCTRL_H2WIE_BIT | MXC_H2_UCTRL_H2UIE_BIT);
142 }
143
144 if (flags & MXC_EHCI_POWER_PINS_ENABLED)
145 v &= ~MXC_H2_UCTRL_H2PM_BIT; /* HOST2 power mask used*/
146 else
147 v |= MXC_H2_UCTRL_H2PM_BIT; /* HOST2 power mask used*/
148 __raw_writel(v, usbother_base + MXC_USBH2CTRL_OFFSET);
149 break;
150 }
151
152error:
153 iounmap(usb_base);
154 return ret;
155}
156
diff --git a/arch/arm/mach-mx5/mm-mx50.c b/arch/arm/mach-mx5/mm-mx50.c
index 8c6540e5839..b9c363b514a 100644
--- a/arch/arm/mach-mx5/mm-mx50.c
+++ b/arch/arm/mach-mx5/mm-mx50.c
@@ -26,6 +26,8 @@
26#include <mach/hardware.h> 26#include <mach/hardware.h>
27#include <mach/common.h> 27#include <mach/common.h>
28#include <mach/iomux-v3.h> 28#include <mach/iomux-v3.h>
29#include <mach/gpio.h>
30#include <mach/irqs.h>
29 31
30/* 32/*
31 * Define the MX50 memory map. 33 * Define the MX50 memory map.
@@ -44,16 +46,27 @@ static struct map_desc mx50_io_desc[] __initdata = {
44 */ 46 */
45void __init mx50_map_io(void) 47void __init mx50_map_io(void)
46{ 48{
49 iotable_init(mx50_io_desc, ARRAY_SIZE(mx50_io_desc));
50}
51
52void __init imx50_init_early(void)
53{
47 mxc_set_cpu_type(MXC_CPU_MX50); 54 mxc_set_cpu_type(MXC_CPU_MX50);
48 mxc_iomux_v3_init(MX50_IO_ADDRESS(MX50_IOMUXC_BASE_ADDR)); 55 mxc_iomux_v3_init(MX50_IO_ADDRESS(MX50_IOMUXC_BASE_ADDR));
49 mxc_arch_reset_init(MX50_IO_ADDRESS(MX50_WDOG_BASE_ADDR)); 56 mxc_arch_reset_init(MX50_IO_ADDRESS(MX50_WDOG_BASE_ADDR));
50 iotable_init(mx50_io_desc, ARRAY_SIZE(mx50_io_desc));
51} 57}
52 58
53int imx50_register_gpios(void); 59static struct mxc_gpio_port imx50_gpio_ports[] = {
60 DEFINE_IMX_GPIO_PORT_IRQ_HIGH(MX50, 0, 1, MX50_INT_GPIO1_LOW, MX50_INT_GPIO1_HIGH),
61 DEFINE_IMX_GPIO_PORT_IRQ_HIGH(MX50, 1, 2, MX50_INT_GPIO2_LOW, MX50_INT_GPIO2_HIGH),
62 DEFINE_IMX_GPIO_PORT_IRQ_HIGH(MX50, 2, 3, MX50_INT_GPIO3_LOW, MX50_INT_GPIO3_HIGH),
63 DEFINE_IMX_GPIO_PORT_IRQ_HIGH(MX50, 3, 4, MX50_INT_GPIO3_LOW, MX50_INT_GPIO3_HIGH),
64 DEFINE_IMX_GPIO_PORT_IRQ_HIGH(MX50, 4, 5, MX50_INT_GPIO3_LOW, MX50_INT_GPIO3_HIGH),
65 DEFINE_IMX_GPIO_PORT_IRQ_HIGH(MX50, 5, 6, MX50_INT_GPIO3_LOW, MX50_INT_GPIO3_HIGH),
66};
54 67
55void __init mx50_init_irq(void) 68void __init mx50_init_irq(void)
56{ 69{
57 tzic_init_irq(MX50_IO_ADDRESS(MX50_TZIC_BASE_ADDR)); 70 tzic_init_irq(MX50_IO_ADDRESS(MX50_TZIC_BASE_ADDR));
58 imx50_register_gpios(); 71 mxc_gpio_init(imx50_gpio_ports, ARRAY_SIZE(imx50_gpio_ports));
59} 72}
diff --git a/arch/arm/mach-mx5/mm.c b/arch/arm/mach-mx5/mm.c
index 457f9f95204..ff557301b42 100644
--- a/arch/arm/mach-mx5/mm.c
+++ b/arch/arm/mach-mx5/mm.c
@@ -47,18 +47,26 @@ static struct map_desc mx53_io_desc[] __initdata = {
47 */ 47 */
48void __init mx51_map_io(void) 48void __init mx51_map_io(void)
49{ 49{
50 iotable_init(mx51_io_desc, ARRAY_SIZE(mx51_io_desc));
51}
52
53void __init imx51_init_early(void)
54{
50 mxc_set_cpu_type(MXC_CPU_MX51); 55 mxc_set_cpu_type(MXC_CPU_MX51);
51 mxc_iomux_v3_init(MX51_IO_ADDRESS(MX51_IOMUXC_BASE_ADDR)); 56 mxc_iomux_v3_init(MX51_IO_ADDRESS(MX51_IOMUXC_BASE_ADDR));
52 mxc_arch_reset_init(MX51_IO_ADDRESS(MX51_WDOG1_BASE_ADDR)); 57 mxc_arch_reset_init(MX51_IO_ADDRESS(MX51_WDOG1_BASE_ADDR));
53 iotable_init(mx51_io_desc, ARRAY_SIZE(mx51_io_desc));
54} 58}
55 59
56void __init mx53_map_io(void) 60void __init mx53_map_io(void)
57{ 61{
62 iotable_init(mx53_io_desc, ARRAY_SIZE(mx53_io_desc));
63}
64
65void __init imx53_init_early(void)
66{
58 mxc_set_cpu_type(MXC_CPU_MX53); 67 mxc_set_cpu_type(MXC_CPU_MX53);
59 mxc_iomux_v3_init(MX53_IO_ADDRESS(MX53_IOMUXC_BASE_ADDR)); 68 mxc_iomux_v3_init(MX53_IO_ADDRESS(MX53_IOMUXC_BASE_ADDR));
60 mxc_arch_reset_init(MX53_IO_ADDRESS(MX53_WDOG_BASE_ADDR)); 69 mxc_arch_reset_init(MX53_IO_ADDRESS(MX53_WDOG1_BASE_ADDR));
61 iotable_init(mx53_io_desc, ARRAY_SIZE(mx53_io_desc));
62} 70}
63 71
64int imx51_register_gpios(void); 72int imx51_register_gpios(void);
diff --git a/arch/arm/mach-mx5/mx51_efika.c b/arch/arm/mach-mx5/mx51_efika.c
new file mode 100644
index 00000000000..51a67fc7f0e
--- /dev/null
+++ b/arch/arm/mach-mx5/mx51_efika.c
@@ -0,0 +1,636 @@
1/*
2 * based on code from the following
3 * Copyright 2009-2010 Freescale Semiconductor, Inc. All Rights Reserved.
4 * Copyright 2009-2010 Pegatron Corporation. All Rights Reserved.
5 * Copyright 2009-2010 Genesi USA, Inc. All Rights Reserved.
6 *
7 * The code contained herein is licensed under the GNU General Public
8 * License. You may obtain a copy of the GNU General Public License
9 * Version 2 or later at the following locations:
10 *
11 * http://www.opensource.org/licenses/gpl-license.html
12 * http://www.gnu.org/copyleft/gpl.html
13 */
14
15#include <linux/init.h>
16#include <linux/platform_device.h>
17#include <linux/i2c.h>
18#include <linux/gpio.h>
19#include <linux/leds.h>
20#include <linux/input.h>
21#include <linux/delay.h>
22#include <linux/io.h>
23#include <linux/fsl_devices.h>
24#include <linux/spi/flash.h>
25#include <linux/spi/spi.h>
26#include <linux/mfd/mc13892.h>
27#include <linux/regulator/machine.h>
28#include <linux/regulator/consumer.h>
29
30#include <mach/common.h>
31#include <mach/hardware.h>
32#include <mach/iomux-mx51.h>
33#include <mach/i2c.h>
34#include <mach/mxc_ehci.h>
35
36#include <linux/usb/otg.h>
37#include <linux/usb/ulpi.h>
38#include <mach/ulpi.h>
39
40#include <asm/irq.h>
41#include <asm/setup.h>
42#include <asm/mach-types.h>
43#include <asm/mach/arch.h>
44#include <asm/mach/time.h>
45#include <asm/mach-types.h>
46
47#include "devices-imx51.h"
48#include "devices.h"
49#include "efika.h"
50#include "cpu_op-mx51.h"
51
52#define MX51_USB_CTRL_1_OFFSET 0x10
53#define MX51_USB_CTRL_UH1_EXT_CLK_EN (1 << 25)
54#define MX51_USB_PLL_DIV_19_2_MHZ 0x01
55
56#define EFIKAMX_USB_HUB_RESET IMX_GPIO_NR(1, 5)
57#define EFIKAMX_USBH1_STP IMX_GPIO_NR(1, 27)
58
59#define EFIKAMX_SPI_CS0 IMX_GPIO_NR(4, 24)
60#define EFIKAMX_SPI_CS1 IMX_GPIO_NR(4, 25)
61
62#define EFIKAMX_PMIC IMX_GPIO_NR(1, 6)
63
64static iomux_v3_cfg_t mx51efika_pads[] = {
65 /* UART1 */
66 MX51_PAD_UART1_RXD__UART1_RXD,
67 MX51_PAD_UART1_TXD__UART1_TXD,
68 MX51_PAD_UART1_RTS__UART1_RTS,
69 MX51_PAD_UART1_CTS__UART1_CTS,
70
71 /* SD 1 */
72 MX51_PAD_SD1_CMD__SD1_CMD,
73 MX51_PAD_SD1_CLK__SD1_CLK,
74 MX51_PAD_SD1_DATA0__SD1_DATA0,
75 MX51_PAD_SD1_DATA1__SD1_DATA1,
76 MX51_PAD_SD1_DATA2__SD1_DATA2,
77 MX51_PAD_SD1_DATA3__SD1_DATA3,
78
79 /* SD 2 */
80 MX51_PAD_SD2_CMD__SD2_CMD,
81 MX51_PAD_SD2_CLK__SD2_CLK,
82 MX51_PAD_SD2_DATA0__SD2_DATA0,
83 MX51_PAD_SD2_DATA1__SD2_DATA1,
84 MX51_PAD_SD2_DATA2__SD2_DATA2,
85 MX51_PAD_SD2_DATA3__SD2_DATA3,
86
87 /* SD/MMC WP/CD */
88 MX51_PAD_GPIO1_0__SD1_CD,
89 MX51_PAD_GPIO1_1__SD1_WP,
90 MX51_PAD_GPIO1_7__SD2_WP,
91 MX51_PAD_GPIO1_8__SD2_CD,
92
93 /* spi */
94 MX51_PAD_CSPI1_MOSI__ECSPI1_MOSI,
95 MX51_PAD_CSPI1_MISO__ECSPI1_MISO,
96 MX51_PAD_CSPI1_SS0__GPIO4_24,
97 MX51_PAD_CSPI1_SS1__GPIO4_25,
98 MX51_PAD_CSPI1_RDY__ECSPI1_RDY,
99 MX51_PAD_CSPI1_SCLK__ECSPI1_SCLK,
100 MX51_PAD_GPIO1_6__GPIO1_6,
101
102 /* USB HOST1 */
103 MX51_PAD_USBH1_CLK__USBH1_CLK,
104 MX51_PAD_USBH1_DIR__USBH1_DIR,
105 MX51_PAD_USBH1_NXT__USBH1_NXT,
106 MX51_PAD_USBH1_DATA0__USBH1_DATA0,
107 MX51_PAD_USBH1_DATA1__USBH1_DATA1,
108 MX51_PAD_USBH1_DATA2__USBH1_DATA2,
109 MX51_PAD_USBH1_DATA3__USBH1_DATA3,
110 MX51_PAD_USBH1_DATA4__USBH1_DATA4,
111 MX51_PAD_USBH1_DATA5__USBH1_DATA5,
112 MX51_PAD_USBH1_DATA6__USBH1_DATA6,
113 MX51_PAD_USBH1_DATA7__USBH1_DATA7,
114
115 /* USB HUB RESET */
116 MX51_PAD_GPIO1_5__GPIO1_5,
117
118 /* WLAN */
119 MX51_PAD_EIM_A22__GPIO2_16,
120 MX51_PAD_EIM_A16__GPIO2_10,
121
122 /* USB PHY RESET */
123 MX51_PAD_EIM_D27__GPIO2_9,
124};
125
126/* Serial ports */
127static const struct imxuart_platform_data uart_pdata = {
128 .flags = IMXUART_HAVE_RTSCTS,
129};
130
131/* This function is board specific as the bit mask for the plldiv will also
132 * be different for other Freescale SoCs, thus a common bitmask is not
133 * possible and cannot get place in /plat-mxc/ehci.c.
134 */
135static int initialize_otg_port(struct platform_device *pdev)
136{
137 u32 v;
138 void __iomem *usb_base;
139 void __iomem *usbother_base;
140 usb_base = ioremap(MX51_OTG_BASE_ADDR, SZ_4K);
141 if (!usb_base)
142 return -ENOMEM;
143 usbother_base = (void __iomem *)(usb_base + MX5_USBOTHER_REGS_OFFSET);
144
145 /* Set the PHY clock to 19.2MHz */
146 v = __raw_readl(usbother_base + MXC_USB_PHY_CTR_FUNC2_OFFSET);
147 v &= ~MX5_USB_UTMI_PHYCTRL1_PLLDIV_MASK;
148 v |= MX51_USB_PLL_DIV_19_2_MHZ;
149 __raw_writel(v, usbother_base + MXC_USB_PHY_CTR_FUNC2_OFFSET);
150 iounmap(usb_base);
151
152 mdelay(10);
153
154 return mx51_initialize_usb_hw(pdev->id, MXC_EHCI_INTERNAL_PHY);
155}
156
157static struct mxc_usbh_platform_data dr_utmi_config = {
158 .init = initialize_otg_port,
159 .portsc = MXC_EHCI_UTMI_16BIT,
160};
161
162static int initialize_usbh1_port(struct platform_device *pdev)
163{
164 iomux_v3_cfg_t usbh1stp = MX51_PAD_USBH1_STP__USBH1_STP;
165 iomux_v3_cfg_t usbh1gpio = MX51_PAD_USBH1_STP__GPIO1_27;
166 u32 v;
167 void __iomem *usb_base;
168 void __iomem *socregs_base;
169
170 mxc_iomux_v3_setup_pad(usbh1gpio);
171 gpio_request(EFIKAMX_USBH1_STP, "usbh1_stp");
172 gpio_direction_output(EFIKAMX_USBH1_STP, 0);
173 msleep(1);
174 gpio_set_value(EFIKAMX_USBH1_STP, 1);
175 msleep(1);
176
177 usb_base = ioremap(MX51_OTG_BASE_ADDR, SZ_4K);
178 socregs_base = (void __iomem *)(usb_base + MX5_USBOTHER_REGS_OFFSET);
179
180 /* The clock for the USBH1 ULPI port will come externally */
181 /* from the PHY. */
182 v = __raw_readl(socregs_base + MX51_USB_CTRL_1_OFFSET);
183 __raw_writel(v | MX51_USB_CTRL_UH1_EXT_CLK_EN,
184 socregs_base + MX51_USB_CTRL_1_OFFSET);
185
186 iounmap(usb_base);
187
188 gpio_free(EFIKAMX_USBH1_STP);
189 mxc_iomux_v3_setup_pad(usbh1stp);
190
191 mdelay(10);
192
193 return mx51_initialize_usb_hw(0, MXC_EHCI_ITC_NO_THRESHOLD);
194}
195
196static struct mxc_usbh_platform_data usbh1_config = {
197 .init = initialize_usbh1_port,
198 .portsc = MXC_EHCI_MODE_ULPI,
199};
200
201static void mx51_efika_hubreset(void)
202{
203 gpio_request(EFIKAMX_USB_HUB_RESET, "usb_hub_rst");
204 gpio_direction_output(EFIKAMX_USB_HUB_RESET, 1);
205 msleep(1);
206 gpio_set_value(EFIKAMX_USB_HUB_RESET, 0);
207 msleep(1);
208 gpio_set_value(EFIKAMX_USB_HUB_RESET, 1);
209}
210
211static void __init mx51_efika_usb(void)
212{
213 mx51_efika_hubreset();
214
215 /* pulling it low, means no USB at all... */
216 gpio_request(EFIKA_USB_PHY_RESET, "usb_phy_reset");
217 gpio_direction_output(EFIKA_USB_PHY_RESET, 0);
218 msleep(1);
219 gpio_set_value(EFIKA_USB_PHY_RESET, 1);
220
221 usbh1_config.otg = imx_otg_ulpi_create(ULPI_OTG_DRVVBUS |
222 ULPI_OTG_DRVVBUS_EXT | ULPI_OTG_EXTVBUSIND);
223
224 mxc_register_device(&mxc_usbdr_host_device, &dr_utmi_config);
225 if (usbh1_config.otg)
226 mxc_register_device(&mxc_usbh1_device, &usbh1_config);
227}
228
229static struct mtd_partition mx51_efika_spi_nor_partitions[] = {
230 {
231 .name = "u-boot",
232 .offset = 0,
233 .size = SZ_256K,
234 },
235 {
236 .name = "config",
237 .offset = MTDPART_OFS_APPEND,
238 .size = SZ_64K,
239 },
240};
241
242static struct flash_platform_data mx51_efika_spi_flash_data = {
243 .name = "spi_flash",
244 .parts = mx51_efika_spi_nor_partitions,
245 .nr_parts = ARRAY_SIZE(mx51_efika_spi_nor_partitions),
246 .type = "sst25vf032b",
247};
248
249static struct regulator_consumer_supply sw1_consumers[] = {
250 {
251 .supply = "cpu_vcc",
252 }
253};
254
255static struct regulator_consumer_supply vdig_consumers[] = {
256 /* sgtl5000 */
257 REGULATOR_SUPPLY("VDDA", "1-000a"),
258 REGULATOR_SUPPLY("VDDD", "1-000a"),
259};
260
261static struct regulator_consumer_supply vvideo_consumers[] = {
262 /* sgtl5000 */
263 REGULATOR_SUPPLY("VDDIO", "1-000a"),
264};
265
266static struct regulator_consumer_supply vsd_consumers[] = {
267 REGULATOR_SUPPLY("vmmc", "sdhci-esdhc-imx.0"),
268 REGULATOR_SUPPLY("vmmc", "sdhci-esdhc-imx.1"),
269};
270
271static struct regulator_consumer_supply pwgt1_consumer[] = {
272 {
273 .supply = "pwgt1",
274 }
275};
276
277static struct regulator_consumer_supply pwgt2_consumer[] = {
278 {
279 .supply = "pwgt2",
280 }
281};
282
283static struct regulator_consumer_supply coincell_consumer[] = {
284 {
285 .supply = "coincell",
286 }
287};
288
289static struct regulator_init_data sw1_init = {
290 .constraints = {
291 .name = "SW1",
292 .min_uV = 600000,
293 .max_uV = 1375000,
294 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE,
295 .valid_modes_mask = 0,
296 .always_on = 1,
297 .boot_on = 1,
298 .state_mem = {
299 .uV = 850000,
300 .mode = REGULATOR_MODE_NORMAL,
301 .enabled = 1,
302 },
303 },
304 .num_consumer_supplies = ARRAY_SIZE(sw1_consumers),
305 .consumer_supplies = sw1_consumers,
306};
307
308static struct regulator_init_data sw2_init = {
309 .constraints = {
310 .name = "SW2",
311 .min_uV = 900000,
312 .max_uV = 1850000,
313 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE,
314 .always_on = 1,
315 .boot_on = 1,
316 .state_mem = {
317 .uV = 950000,
318 .mode = REGULATOR_MODE_NORMAL,
319 .enabled = 1,
320 },
321 }
322};
323
324static struct regulator_init_data sw3_init = {
325 .constraints = {
326 .name = "SW3",
327 .min_uV = 1100000,
328 .max_uV = 1850000,
329 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE,
330 .always_on = 1,
331 .boot_on = 1,
332 }
333};
334
335static struct regulator_init_data sw4_init = {
336 .constraints = {
337 .name = "SW4",
338 .min_uV = 1100000,
339 .max_uV = 1850000,
340 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE,
341 .always_on = 1,
342 .boot_on = 1,
343 }
344};
345
346static struct regulator_init_data viohi_init = {
347 .constraints = {
348 .name = "VIOHI",
349 .boot_on = 1,
350 .always_on = 1,
351 }
352};
353
354static struct regulator_init_data vusb_init = {
355 .constraints = {
356 .name = "VUSB",
357 .boot_on = 1,
358 .always_on = 1,
359 }
360};
361
362static struct regulator_init_data swbst_init = {
363 .constraints = {
364 .name = "SWBST",
365 }
366};
367
368static struct regulator_init_data vdig_init = {
369 .constraints = {
370 .name = "VDIG",
371 .min_uV = 1050000,
372 .max_uV = 1800000,
373 .valid_ops_mask =
374 REGULATOR_CHANGE_VOLTAGE | REGULATOR_CHANGE_STATUS,
375 .boot_on = 1,
376 .always_on = 1,
377 },
378 .num_consumer_supplies = ARRAY_SIZE(vdig_consumers),
379 .consumer_supplies = vdig_consumers,
380};
381
382static struct regulator_init_data vpll_init = {
383 .constraints = {
384 .name = "VPLL",
385 .min_uV = 1050000,
386 .max_uV = 1800000,
387 .valid_ops_mask =
388 REGULATOR_CHANGE_VOLTAGE | REGULATOR_CHANGE_STATUS,
389 .boot_on = 1,
390 .always_on = 1,
391 }
392};
393
394static struct regulator_init_data vusb2_init = {
395 .constraints = {
396 .name = "VUSB2",
397 .min_uV = 2400000,
398 .max_uV = 2775000,
399 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE,
400 .boot_on = 1,
401 .always_on = 1,
402 }
403};
404
405static struct regulator_init_data vvideo_init = {
406 .constraints = {
407 .name = "VVIDEO",
408 .min_uV = 2775000,
409 .max_uV = 2775000,
410 .valid_ops_mask =
411 REGULATOR_CHANGE_VOLTAGE | REGULATOR_CHANGE_STATUS,
412 .boot_on = 1,
413 .apply_uV = 1,
414 },
415 .num_consumer_supplies = ARRAY_SIZE(vvideo_consumers),
416 .consumer_supplies = vvideo_consumers,
417};
418
419static struct regulator_init_data vaudio_init = {
420 .constraints = {
421 .name = "VAUDIO",
422 .min_uV = 2300000,
423 .max_uV = 3000000,
424 .valid_ops_mask =
425 REGULATOR_CHANGE_VOLTAGE | REGULATOR_CHANGE_STATUS,
426 .boot_on = 1,
427 }
428};
429
430static struct regulator_init_data vsd_init = {
431 .constraints = {
432 .name = "VSD",
433 .min_uV = 1800000,
434 .max_uV = 3150000,
435 .valid_ops_mask =
436 REGULATOR_CHANGE_VOLTAGE,
437 .boot_on = 1,
438 },
439 .num_consumer_supplies = ARRAY_SIZE(vsd_consumers),
440 .consumer_supplies = vsd_consumers,
441};
442
443static struct regulator_init_data vcam_init = {
444 .constraints = {
445 .name = "VCAM",
446 .min_uV = 2500000,
447 .max_uV = 3000000,
448 .valid_ops_mask =
449 REGULATOR_CHANGE_VOLTAGE |
450 REGULATOR_CHANGE_MODE | REGULATOR_CHANGE_STATUS,
451 .valid_modes_mask = REGULATOR_MODE_FAST | REGULATOR_MODE_NORMAL,
452 .boot_on = 1,
453 }
454};
455
456static struct regulator_init_data vgen1_init = {
457 .constraints = {
458 .name = "VGEN1",
459 .min_uV = 1200000,
460 .max_uV = 3150000,
461 .valid_ops_mask =
462 REGULATOR_CHANGE_VOLTAGE | REGULATOR_CHANGE_STATUS,
463 .boot_on = 1,
464 .always_on = 1,
465 }
466};
467
468static struct regulator_init_data vgen2_init = {
469 .constraints = {
470 .name = "VGEN2",
471 .min_uV = 1200000,
472 .max_uV = 3150000,
473 .valid_ops_mask =
474 REGULATOR_CHANGE_VOLTAGE | REGULATOR_CHANGE_STATUS,
475 .boot_on = 1,
476 .always_on = 1,
477 }
478};
479
480static struct regulator_init_data vgen3_init = {
481 .constraints = {
482 .name = "VGEN3",
483 .min_uV = 1800000,
484 .max_uV = 2900000,
485 .valid_ops_mask =
486 REGULATOR_CHANGE_VOLTAGE | REGULATOR_CHANGE_STATUS,
487 .boot_on = 1,
488 .always_on = 1,
489 }
490};
491
492static struct regulator_init_data gpo1_init = {
493 .constraints = {
494 .name = "GPO1",
495 }
496};
497
498static struct regulator_init_data gpo2_init = {
499 .constraints = {
500 .name = "GPO2",
501 }
502};
503
504static struct regulator_init_data gpo3_init = {
505 .constraints = {
506 .name = "GPO3",
507 }
508};
509
510static struct regulator_init_data gpo4_init = {
511 .constraints = {
512 .name = "GPO4",
513 }
514};
515
516static struct regulator_init_data pwgt1_init = {
517 .constraints = {
518 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
519 .boot_on = 1,
520 },
521 .num_consumer_supplies = ARRAY_SIZE(pwgt1_consumer),
522 .consumer_supplies = pwgt1_consumer,
523};
524
525static struct regulator_init_data pwgt2_init = {
526 .constraints = {
527 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
528 .boot_on = 1,
529 },
530 .num_consumer_supplies = ARRAY_SIZE(pwgt2_consumer),
531 .consumer_supplies = pwgt2_consumer,
532};
533
534static struct regulator_init_data vcoincell_init = {
535 .constraints = {
536 .name = "COINCELL",
537 .min_uV = 3000000,
538 .max_uV = 3000000,
539 .valid_ops_mask =
540 REGULATOR_CHANGE_VOLTAGE | REGULATOR_CHANGE_STATUS,
541 },
542 .num_consumer_supplies = ARRAY_SIZE(coincell_consumer),
543 .consumer_supplies = coincell_consumer,
544};
545
546static struct mc13xxx_regulator_init_data mx51_efika_regulators[] = {
547 { .id = MC13892_SW1, .init_data = &sw1_init },
548 { .id = MC13892_SW2, .init_data = &sw2_init },
549 { .id = MC13892_SW3, .init_data = &sw3_init },
550 { .id = MC13892_SW4, .init_data = &sw4_init },
551 { .id = MC13892_SWBST, .init_data = &swbst_init },
552 { .id = MC13892_VIOHI, .init_data = &viohi_init },
553 { .id = MC13892_VPLL, .init_data = &vpll_init },
554 { .id = MC13892_VDIG, .init_data = &vdig_init },
555 { .id = MC13892_VSD, .init_data = &vsd_init },
556 { .id = MC13892_VUSB2, .init_data = &vusb2_init },
557 { .id = MC13892_VVIDEO, .init_data = &vvideo_init },
558 { .id = MC13892_VAUDIO, .init_data = &vaudio_init },
559 { .id = MC13892_VCAM, .init_data = &vcam_init },
560 { .id = MC13892_VGEN1, .init_data = &vgen1_init },
561 { .id = MC13892_VGEN2, .init_data = &vgen2_init },
562 { .id = MC13892_VGEN3, .init_data = &vgen3_init },
563 { .id = MC13892_VUSB, .init_data = &vusb_init },
564 { .id = MC13892_GPO1, .init_data = &gpo1_init },
565 { .id = MC13892_GPO2, .init_data = &gpo2_init },
566 { .id = MC13892_GPO3, .init_data = &gpo3_init },
567 { .id = MC13892_GPO4, .init_data = &gpo4_init },
568 { .id = MC13892_PWGT1SPI, .init_data = &pwgt1_init },
569 { .id = MC13892_PWGT2SPI, .init_data = &pwgt2_init },
570 { .id = MC13892_VCOINCELL, .init_data = &vcoincell_init },
571};
572
573static struct mc13xxx_platform_data mx51_efika_mc13892_data = {
574 .flags = MC13XXX_USE_RTC | MC13XXX_USE_REGULATOR,
575 .num_regulators = ARRAY_SIZE(mx51_efika_regulators),
576 .regulators = mx51_efika_regulators,
577};
578
579static struct spi_board_info mx51_efika_spi_board_info[] __initdata = {
580 {
581 .modalias = "m25p80",
582 .max_speed_hz = 25000000,
583 .bus_num = 0,
584 .chip_select = 1,
585 .platform_data = &mx51_efika_spi_flash_data,
586 .irq = -1,
587 },
588 {
589 .modalias = "mc13892",
590 .max_speed_hz = 1000000,
591 .bus_num = 0,
592 .chip_select = 0,
593 .platform_data = &mx51_efika_mc13892_data,
594 .irq = gpio_to_irq(EFIKAMX_PMIC),
595 },
596};
597
598static int mx51_efika_spi_cs[] = {
599 EFIKAMX_SPI_CS0,
600 EFIKAMX_SPI_CS1,
601};
602
603static const struct spi_imx_master mx51_efika_spi_pdata __initconst = {
604 .chipselect = mx51_efika_spi_cs,
605 .num_chipselect = ARRAY_SIZE(mx51_efika_spi_cs),
606};
607
608void __init efika_board_common_init(void)
609{
610 mxc_iomux_v3_setup_multiple_pads(mx51efika_pads,
611 ARRAY_SIZE(mx51efika_pads));
612 imx51_add_imx_uart(0, &uart_pdata);
613 mx51_efika_usb();
614 imx51_add_sdhci_esdhc_imx(0, NULL);
615
616 /* FIXME: comes from original code. check this. */
617 if (mx51_revision() < IMX_CHIP_REVISION_2_0)
618 sw2_init.constraints.state_mem.uV = 1100000;
619 else if (mx51_revision() == IMX_CHIP_REVISION_2_0) {
620 sw2_init.constraints.state_mem.uV = 1250000;
621 sw1_init.constraints.state_mem.uV = 1000000;
622 }
623 if (machine_is_mx51_efikasb())
624 vgen1_init.constraints.max_uV = 1200000;
625
626 gpio_request(EFIKAMX_PMIC, "pmic irq");
627 gpio_direction_input(EFIKAMX_PMIC);
628 spi_register_board_info(mx51_efika_spi_board_info,
629 ARRAY_SIZE(mx51_efika_spi_board_info));
630 imx51_add_ecspi(0, &mx51_efika_spi_pdata);
631
632#if defined(CONFIG_CPU_FREQ_IMX)
633 get_cpu_op = mx51_get_cpu_op;
634#endif
635}
636