diff options
author | Russell King <rmk+kernel@arm.linux.org.uk> | 2010-10-19 17:04:42 -0400 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2010-10-19 17:04:42 -0400 |
commit | 79a94c3538bda6869d7bb150b5e02dd3a72314dd (patch) | |
tree | 91ceaff680af17633f12d6feba4058fb70e620a5 /arch/arm/mach-mx5 | |
parent | f779b7dd3259ec138c7aba793f0602b20262af83 (diff) | |
parent | f1de1613da54f754d5d2bbf79fcacbd5ed965537 (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/Kconfig | 28 | ||||
-rw-r--r-- | arch/arm/mach-mx5/Makefile | 2 | ||||
-rw-r--r-- | arch/arm/mach-mx5/board-cpuimx51.c | 9 | ||||
-rw-r--r-- | arch/arm/mach-mx5/board-cpuimx51sd.c | 333 | ||||
-rw-r--r-- | arch/arm/mach-mx5/clock-mx51.c | 244 | ||||
-rw-r--r-- | arch/arm/mach-mx5/devices-imx51.h | 4 | ||||
-rw-r--r-- | arch/arm/mach-mx5/eukrea_mbimx51-baseboard.c | 23 | ||||
-rw-r--r-- | arch/arm/mach-mx5/eukrea_mbimxsd-baseboard.c | 166 |
8 files changed, 715 insertions, 94 deletions
diff --git a/arch/arm/mach-mx5/Kconfig b/arch/arm/mach-mx5/Kconfig index fad31cc5004b..a2df9ac37996 100644 --- a/arch/arm/mach-mx5/Kconfig +++ b/arch/arm/mach-mx5/Kconfig | |||
@@ -31,6 +31,8 @@ config MACH_EUKREA_CPUIMX51 | |||
31 | bool "Support Eukrea CPUIMX51 module" | 31 | bool "Support Eukrea CPUIMX51 module" |
32 | select IMX_HAVE_PLATFORM_IMX_I2C | 32 | select IMX_HAVE_PLATFORM_IMX_I2C |
33 | select IMX_HAVE_PLATFORM_IMX_UART | 33 | select IMX_HAVE_PLATFORM_IMX_UART |
34 | select IMX_HAVE_PLATFORM_MXC_NAND | ||
35 | select IMX_HAVE_PLATFORM_SPI_IMX | ||
34 | help | 36 | help |
35 | Include support for Eukrea CPUIMX51 platform. This includes | 37 | Include support for Eukrea CPUIMX51 platform. This includes |
36 | specific configurations for the module and its peripherals. | 38 | specific configurations for the module and its peripherals. |
@@ -43,12 +45,38 @@ choice | |||
43 | config MACH_EUKREA_MBIMX51_BASEBOARD | 45 | config MACH_EUKREA_MBIMX51_BASEBOARD |
44 | prompt "Eukrea MBIMX51 development board" | 46 | prompt "Eukrea MBIMX51 development board" |
45 | bool | 47 | bool |
48 | select IMX_HAVE_PLATFORM_ESDHC | ||
46 | help | 49 | help |
47 | This adds board specific devices that can be found on Eukrea's | 50 | This adds board specific devices that can be found on Eukrea's |
48 | MBIMX51 evaluation board. | 51 | MBIMX51 evaluation board. |
49 | 52 | ||
50 | endchoice | 53 | endchoice |
51 | 54 | ||
55 | config MACH_EUKREA_CPUIMX51SD | ||
56 | bool "Support Eukrea CPUIMX51SD module" | ||
57 | select IMX_HAVE_PLATFORM_IMX_I2C | ||
58 | select IMX_HAVE_PLATFORM_SPI_IMX | ||
59 | select IMX_HAVE_PLATFORM_IMX_UART | ||
60 | select IMX_HAVE_PLATFORM_MXC_NAND | ||
61 | help | ||
62 | Include support for Eukrea CPUIMX51SD platform. This includes | ||
63 | specific configurations for the module and its peripherals. | ||
64 | |||
65 | choice | ||
66 | prompt "Baseboard" | ||
67 | depends on MACH_EUKREA_CPUIMX51SD | ||
68 | default MACH_EUKREA_MBIMXSD51_BASEBOARD | ||
69 | |||
70 | config MACH_EUKREA_MBIMXSD51_BASEBOARD | ||
71 | prompt "Eukrea MBIMXSD development board" | ||
72 | bool | ||
73 | select IMX_HAVE_PLATFORM_ESDHC | ||
74 | help | ||
75 | This adds board specific devices that can be found on Eukrea's | ||
76 | MBIMXSD evaluation board. | ||
77 | |||
78 | endchoice | ||
79 | |||
52 | config MACH_MX51_EFIKAMX | 80 | config MACH_MX51_EFIKAMX |
53 | bool "Support MX51 Genesi Efika MX nettop" | 81 | bool "Support MX51 Genesi Efika MX nettop" |
54 | select IMX_HAVE_PLATFORM_IMX_UART | 82 | select IMX_HAVE_PLATFORM_IMX_UART |
diff --git a/arch/arm/mach-mx5/Makefile b/arch/arm/mach-mx5/Makefile index d1aac9c3d33c..1769c161a60d 100644 --- a/arch/arm/mach-mx5/Makefile +++ b/arch/arm/mach-mx5/Makefile | |||
@@ -9,4 +9,6 @@ obj-$(CONFIG_MACH_MX51_BABBAGE) += board-mx51_babbage.o | |||
9 | obj-$(CONFIG_MACH_MX51_3DS) += board-mx51_3ds.o | 9 | obj-$(CONFIG_MACH_MX51_3DS) += board-mx51_3ds.o |
10 | obj-$(CONFIG_MACH_EUKREA_CPUIMX51) += board-cpuimx51.o | 10 | obj-$(CONFIG_MACH_EUKREA_CPUIMX51) += board-cpuimx51.o |
11 | obj-$(CONFIG_MACH_EUKREA_MBIMX51_BASEBOARD) += eukrea_mbimx51-baseboard.o | 11 | obj-$(CONFIG_MACH_EUKREA_MBIMX51_BASEBOARD) += eukrea_mbimx51-baseboard.o |
12 | obj-$(CONFIG_MACH_EUKREA_CPUIMX51SD) += board-cpuimx51sd.o | ||
13 | obj-$(CONFIG_MACH_EUKREA_MBIMXSD51_BASEBOARD) += eukrea_mbimxsd-baseboard.o | ||
12 | obj-$(CONFIG_MACH_MX51_EFIKAMX) += board-mx51_efikamx.o | 14 | obj-$(CONFIG_MACH_MX51_EFIKAMX) += board-mx51_efikamx.o |
diff --git a/arch/arm/mach-mx5/board-cpuimx51.c b/arch/arm/mach-mx5/board-cpuimx51.c index 61f051043bbc..378f5327ae77 100644 --- a/arch/arm/mach-mx5/board-cpuimx51.c +++ b/arch/arm/mach-mx5/board-cpuimx51.c | |||
@@ -146,6 +146,13 @@ static struct pad_desc eukrea_cpuimx51_pads[] = { | |||
146 | MX51_PAD_USBH1_STP__USBH1_STP, | 146 | MX51_PAD_USBH1_STP__USBH1_STP, |
147 | }; | 147 | }; |
148 | 148 | ||
149 | static const struct mxc_nand_platform_data | ||
150 | eukrea_cpuimx51_nand_board_info __initconst = { | ||
151 | .width = 1, | ||
152 | .hw_ecc = 1, | ||
153 | .flash_bbt = 1, | ||
154 | }; | ||
155 | |||
149 | static const struct imxuart_platform_data uart_pdata __initconst = { | 156 | static const struct imxuart_platform_data uart_pdata __initconst = { |
150 | .flags = IMXUART_HAVE_RTSCTS, | 157 | .flags = IMXUART_HAVE_RTSCTS, |
151 | }; | 158 | }; |
@@ -239,6 +246,8 @@ static void __init eukrea_cpuimx51_init(void) | |||
239 | ARRAY_SIZE(eukrea_cpuimx51_pads)); | 246 | ARRAY_SIZE(eukrea_cpuimx51_pads)); |
240 | 247 | ||
241 | imx51_add_imx_uart(0, &uart_pdata); | 248 | imx51_add_imx_uart(0, &uart_pdata); |
249 | imx51_add_mxc_nand(&eukrea_cpuimx51_nand_board_info); | ||
250 | |||
242 | gpio_request(CPUIMX51_QUARTA_GPIO, "quarta_irq"); | 251 | gpio_request(CPUIMX51_QUARTA_GPIO, "quarta_irq"); |
243 | gpio_direction_input(CPUIMX51_QUARTA_GPIO); | 252 | gpio_direction_input(CPUIMX51_QUARTA_GPIO); |
244 | gpio_free(CPUIMX51_QUARTA_GPIO); | 253 | gpio_free(CPUIMX51_QUARTA_GPIO); |
diff --git a/arch/arm/mach-mx5/board-cpuimx51sd.c b/arch/arm/mach-mx5/board-cpuimx51sd.c new file mode 100644 index 000000000000..bd5eb61a7eba --- /dev/null +++ b/arch/arm/mach-mx5/board-cpuimx51sd.c | |||
@@ -0,0 +1,333 @@ | |||
1 | /* | ||
2 | * | ||
3 | * Copyright (C) 2010 Eric BĂ©nard <eric@eukrea.com> | ||
4 | * | ||
5 | * based on board-mx51_babbage.c which is | ||
6 | * Copyright 2009 Freescale Semiconductor, Inc. All Rights Reserved. | ||
7 | * Copyright (C) 2009-2010 Amit Kucheria <amit.kucheria@canonical.com> | ||
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/i2c/tsc2007.h> | ||
21 | #include <linux/gpio.h> | ||
22 | #include <linux/delay.h> | ||
23 | #include <linux/io.h> | ||
24 | #include <linux/interrupt.h> | ||
25 | #include <linux/irq.h> | ||
26 | #include <linux/fsl_devices.h> | ||
27 | #include <linux/i2c-gpio.h> | ||
28 | #include <linux/spi/spi.h> | ||
29 | #include <linux/can/platform/mcp251x.h> | ||
30 | |||
31 | #include <mach/eukrea-baseboards.h> | ||
32 | #include <mach/common.h> | ||
33 | #include <mach/hardware.h> | ||
34 | #include <mach/iomux-mx51.h> | ||
35 | #include <mach/mxc_ehci.h> | ||
36 | |||
37 | #include <asm/irq.h> | ||
38 | #include <asm/setup.h> | ||
39 | #include <asm/mach-types.h> | ||
40 | #include <asm/mach/arch.h> | ||
41 | #include <asm/mach/time.h> | ||
42 | |||
43 | #include "devices-imx51.h" | ||
44 | #include "devices.h" | ||
45 | |||
46 | #define USBH1_RST (1*32 + 28) | ||
47 | #define ETH_RST (1*32 + 31) | ||
48 | #define TSC2007_IRQGPIO (2*32 + 12) | ||
49 | #define CAN_IRQGPIO (0*32 + 1) | ||
50 | #define CAN_RST (3*32 + 15) | ||
51 | #define CAN_NCS (3*32 + 24) | ||
52 | #define CAN_RXOBF (0*32 + 4) | ||
53 | #define CAN_RX1BF (0*32 + 6) | ||
54 | #define CAN_TXORTS (0*32 + 7) | ||
55 | #define CAN_TX1RTS (0*32 + 8) | ||
56 | #define CAN_TX2RTS (0*32 + 9) | ||
57 | #define I2C_SCL (3*32 + 16) | ||
58 | #define I2C_SDA (3*32 + 17) | ||
59 | |||
60 | /* USB_CTRL_1 */ | ||
61 | #define MX51_USB_CTRL_1_OFFSET 0x10 | ||
62 | #define MX51_USB_CTRL_UH1_EXT_CLK_EN (1 << 25) | ||
63 | |||
64 | #define MX51_USB_PLLDIV_12_MHZ 0x00 | ||
65 | #define MX51_USB_PLL_DIV_19_2_MHZ 0x01 | ||
66 | #define MX51_USB_PLL_DIV_24_MHZ 0x02 | ||
67 | |||
68 | #define CPUIMX51SD_GPIO_3_12 IOMUX_PAD(0x57C, 0x194, 3, 0x0, 0, \ | ||
69 | MX51_PAD_CTRL_1 | PAD_CTL_PUS_22K_UP) | ||
70 | |||
71 | static struct pad_desc eukrea_cpuimx51sd_pads[] = { | ||
72 | /* UART1 */ | ||
73 | MX51_PAD_UART1_RXD__UART1_RXD, | ||
74 | MX51_PAD_UART1_TXD__UART1_TXD, | ||
75 | MX51_PAD_UART1_RTS__UART1_RTS, | ||
76 | MX51_PAD_UART1_CTS__UART1_CTS, | ||
77 | |||
78 | /* USB HOST1 */ | ||
79 | MX51_PAD_USBH1_CLK__USBH1_CLK, | ||
80 | MX51_PAD_USBH1_DIR__USBH1_DIR, | ||
81 | MX51_PAD_USBH1_NXT__USBH1_NXT, | ||
82 | MX51_PAD_USBH1_DATA0__USBH1_DATA0, | ||
83 | MX51_PAD_USBH1_DATA1__USBH1_DATA1, | ||
84 | MX51_PAD_USBH1_DATA2__USBH1_DATA2, | ||
85 | MX51_PAD_USBH1_DATA3__USBH1_DATA3, | ||
86 | MX51_PAD_USBH1_DATA4__USBH1_DATA4, | ||
87 | MX51_PAD_USBH1_DATA5__USBH1_DATA5, | ||
88 | MX51_PAD_USBH1_DATA6__USBH1_DATA6, | ||
89 | MX51_PAD_USBH1_DATA7__USBH1_DATA7, | ||
90 | MX51_PAD_USBH1_STP__USBH1_STP, | ||
91 | MX51_PAD_EIM_CS3__GPIO_2_28, /* PHY nRESET */ | ||
92 | |||
93 | /* FEC */ | ||
94 | MX51_PAD_EIM_DTACK__GPIO_2_31, /* PHY nRESET */ | ||
95 | |||
96 | /* HSI2C */ | ||
97 | MX51_PAD_I2C1_CLK__GPIO_4_16, | ||
98 | MX51_PAD_I2C1_DAT__GPIO_4_17, | ||
99 | |||
100 | /* CAN */ | ||
101 | MX51_PAD_CSPI1_MOSI__ECSPI1_MOSI, | ||
102 | MX51_PAD_CSPI1_MISO__ECSPI1_MISO, | ||
103 | MX51_PAD_CSPI1_SCLK__ECSPI1_SCLK, | ||
104 | MX51_PAD_CSPI1_SS0__GPIO_4_24, /* nCS */ | ||
105 | MX51_PAD_CSI2_PIXCLK__GPIO_4_15, /* nReset */ | ||
106 | MX51_PAD_GPIO_1_1__GPIO_1_1, /* IRQ */ | ||
107 | MX51_PAD_GPIO_1_4__GPIO_1_4, /* Control signals */ | ||
108 | MX51_PAD_GPIO_1_6__GPIO_1_6, | ||
109 | MX51_PAD_GPIO_1_7__GPIO_1_7, | ||
110 | MX51_PAD_GPIO_1_8__GPIO_1_8, | ||
111 | MX51_PAD_GPIO_1_9__GPIO_1_9, | ||
112 | |||
113 | /* Touchscreen */ | ||
114 | CPUIMX51SD_GPIO_3_12, /* IRQ */ | ||
115 | }; | ||
116 | |||
117 | static const struct imxuart_platform_data uart_pdata __initconst = { | ||
118 | .flags = IMXUART_HAVE_RTSCTS, | ||
119 | }; | ||
120 | |||
121 | static int ts_get_pendown_state(void) | ||
122 | { | ||
123 | return gpio_get_value(TSC2007_IRQGPIO) ? 0 : 1; | ||
124 | } | ||
125 | |||
126 | static struct tsc2007_platform_data tsc2007_info = { | ||
127 | .model = 2007, | ||
128 | .x_plate_ohms = 180, | ||
129 | .get_pendown_state = ts_get_pendown_state, | ||
130 | }; | ||
131 | |||
132 | static struct i2c_board_info eukrea_cpuimx51sd_i2c_devices[] = { | ||
133 | { | ||
134 | I2C_BOARD_INFO("pcf8563", 0x51), | ||
135 | }, { | ||
136 | I2C_BOARD_INFO("tsc2007", 0x49), | ||
137 | .type = "tsc2007", | ||
138 | .platform_data = &tsc2007_info, | ||
139 | .irq = gpio_to_irq(TSC2007_IRQGPIO), | ||
140 | }, | ||
141 | }; | ||
142 | |||
143 | static const struct mxc_nand_platform_data | ||
144 | eukrea_cpuimx51sd_nand_board_info __initconst = { | ||
145 | .width = 1, | ||
146 | .hw_ecc = 1, | ||
147 | .flash_bbt = 1, | ||
148 | }; | ||
149 | |||
150 | /* This function is board specific as the bit mask for the plldiv will also | ||
151 | be different for other Freescale SoCs, thus a common bitmask is not | ||
152 | possible and cannot get place in /plat-mxc/ehci.c.*/ | ||
153 | static int initialize_otg_port(struct platform_device *pdev) | ||
154 | { | ||
155 | u32 v; | ||
156 | void __iomem *usb_base; | ||
157 | void __iomem *usbother_base; | ||
158 | |||
159 | usb_base = ioremap(MX51_OTG_BASE_ADDR, SZ_4K); | ||
160 | usbother_base = usb_base + MX5_USBOTHER_REGS_OFFSET; | ||
161 | |||
162 | /* Set the PHY clock to 19.2MHz */ | ||
163 | v = __raw_readl(usbother_base + MXC_USB_PHY_CTR_FUNC2_OFFSET); | ||
164 | v &= ~MX5_USB_UTMI_PHYCTRL1_PLLDIV_MASK; | ||
165 | v |= MX51_USB_PLL_DIV_19_2_MHZ; | ||
166 | __raw_writel(v, usbother_base + MXC_USB_PHY_CTR_FUNC2_OFFSET); | ||
167 | iounmap(usb_base); | ||
168 | return 0; | ||
169 | } | ||
170 | |||
171 | static int initialize_usbh1_port(struct platform_device *pdev) | ||
172 | { | ||
173 | u32 v; | ||
174 | void __iomem *usb_base; | ||
175 | void __iomem *usbother_base; | ||
176 | |||
177 | usb_base = ioremap(MX51_OTG_BASE_ADDR, SZ_4K); | ||
178 | usbother_base = usb_base + MX5_USBOTHER_REGS_OFFSET; | ||
179 | |||
180 | /* The clock for the USBH1 ULPI port will come from the PHY. */ | ||
181 | v = __raw_readl(usbother_base + MX51_USB_CTRL_1_OFFSET); | ||
182 | __raw_writel(v | MX51_USB_CTRL_UH1_EXT_CLK_EN, | ||
183 | usbother_base + MX51_USB_CTRL_1_OFFSET); | ||
184 | iounmap(usb_base); | ||
185 | return 0; | ||
186 | } | ||
187 | |||
188 | static struct mxc_usbh_platform_data dr_utmi_config = { | ||
189 | .init = initialize_otg_port, | ||
190 | .portsc = MXC_EHCI_UTMI_16BIT, | ||
191 | .flags = MXC_EHCI_INTERNAL_PHY, | ||
192 | }; | ||
193 | |||
194 | static struct fsl_usb2_platform_data usb_pdata = { | ||
195 | .operating_mode = FSL_USB2_DR_DEVICE, | ||
196 | .phy_mode = FSL_USB2_PHY_UTMI_WIDE, | ||
197 | }; | ||
198 | |||
199 | static struct mxc_usbh_platform_data usbh1_config = { | ||
200 | .init = initialize_usbh1_port, | ||
201 | .portsc = MXC_EHCI_MODE_ULPI, | ||
202 | .flags = (MXC_EHCI_POWER_PINS_ENABLED | MXC_EHCI_ITC_NO_THRESHOLD), | ||
203 | }; | ||
204 | |||
205 | static int otg_mode_host; | ||
206 | |||
207 | static int __init eukrea_cpuimx51sd_otg_mode(char *options) | ||
208 | { | ||
209 | if (!strcmp(options, "host")) | ||
210 | otg_mode_host = 1; | ||
211 | else if (!strcmp(options, "device")) | ||
212 | otg_mode_host = 0; | ||
213 | else | ||
214 | pr_info("otg_mode neither \"host\" nor \"device\". " | ||
215 | "Defaulting to device\n"); | ||
216 | return 0; | ||
217 | } | ||
218 | __setup("otg_mode=", eukrea_cpuimx51sd_otg_mode); | ||
219 | |||
220 | static struct i2c_gpio_platform_data pdata = { | ||
221 | .sda_pin = I2C_SDA, | ||
222 | .sda_is_open_drain = 0, | ||
223 | .scl_pin = I2C_SCL, | ||
224 | .scl_is_open_drain = 0, | ||
225 | .udelay = 2, | ||
226 | }; | ||
227 | |||
228 | static struct platform_device hsi2c_gpio_device = { | ||
229 | .name = "i2c-gpio", | ||
230 | .id = 0, | ||
231 | .dev.platform_data = &pdata, | ||
232 | }; | ||
233 | |||
234 | static struct mcp251x_platform_data mcp251x_info = { | ||
235 | .oscillator_frequency = 24E6, | ||
236 | }; | ||
237 | |||
238 | static struct spi_board_info cpuimx51sd_spi_device[] = { | ||
239 | { | ||
240 | .modalias = "mcp2515", | ||
241 | .max_speed_hz = 6500000, | ||
242 | .bus_num = 0, | ||
243 | .mode = SPI_MODE_0, | ||
244 | .chip_select = 0, | ||
245 | .platform_data = &mcp251x_info, | ||
246 | .irq = gpio_to_irq(0 * 32 + 1) | ||
247 | }, | ||
248 | }; | ||
249 | |||
250 | static int cpuimx51sd_spi1_cs[] = { | ||
251 | CAN_NCS, | ||
252 | }; | ||
253 | |||
254 | static const struct spi_imx_master cpuimx51sd_ecspi1_pdata __initconst = { | ||
255 | .chipselect = cpuimx51sd_spi1_cs, | ||
256 | .num_chipselect = ARRAY_SIZE(cpuimx51sd_spi1_cs), | ||
257 | }; | ||
258 | |||
259 | static struct platform_device *platform_devices[] __initdata = { | ||
260 | &hsi2c_gpio_device, | ||
261 | }; | ||
262 | |||
263 | static void __init eukrea_cpuimx51sd_init(void) | ||
264 | { | ||
265 | mxc_iomux_v3_setup_multiple_pads(eukrea_cpuimx51sd_pads, | ||
266 | ARRAY_SIZE(eukrea_cpuimx51sd_pads)); | ||
267 | |||
268 | imx51_add_imx_uart(0, &uart_pdata); | ||
269 | imx51_add_mxc_nand(&eukrea_cpuimx51sd_nand_board_info); | ||
270 | |||
271 | gpio_request(ETH_RST, "eth_rst"); | ||
272 | gpio_set_value(ETH_RST, 1); | ||
273 | imx51_add_fec(NULL); | ||
274 | |||
275 | gpio_request(CAN_IRQGPIO, "can_irq"); | ||
276 | gpio_direction_input(CAN_IRQGPIO); | ||
277 | gpio_free(CAN_IRQGPIO); | ||
278 | gpio_request(CAN_NCS, "can_ncs"); | ||
279 | gpio_direction_output(CAN_NCS, 1); | ||
280 | gpio_free(CAN_NCS); | ||
281 | gpio_request(CAN_RST, "can_rst"); | ||
282 | gpio_direction_output(CAN_RST, 0); | ||
283 | msleep(20); | ||
284 | gpio_set_value(CAN_RST, 1); | ||
285 | imx51_add_ecspi(0, &cpuimx51sd_ecspi1_pdata); | ||
286 | spi_register_board_info(cpuimx51sd_spi_device, | ||
287 | ARRAY_SIZE(cpuimx51sd_spi_device)); | ||
288 | |||
289 | gpio_request(TSC2007_IRQGPIO, "tsc2007_irq"); | ||
290 | gpio_direction_input(TSC2007_IRQGPIO); | ||
291 | gpio_free(TSC2007_IRQGPIO); | ||
292 | |||
293 | i2c_register_board_info(0, eukrea_cpuimx51sd_i2c_devices, | ||
294 | ARRAY_SIZE(eukrea_cpuimx51sd_i2c_devices)); | ||
295 | platform_add_devices(platform_devices, ARRAY_SIZE(platform_devices)); | ||
296 | |||
297 | if (otg_mode_host) | ||
298 | mxc_register_device(&mxc_usbdr_host_device, &dr_utmi_config); | ||
299 | else { | ||
300 | initialize_otg_port(NULL); | ||
301 | mxc_register_device(&mxc_usbdr_udc_device, &usb_pdata); | ||
302 | } | ||
303 | |||
304 | gpio_request(USBH1_RST, "usb_rst"); | ||
305 | gpio_direction_output(USBH1_RST, 0); | ||
306 | msleep(20); | ||
307 | gpio_set_value(USBH1_RST, 1); | ||
308 | mxc_register_device(&mxc_usbh1_device, &usbh1_config); | ||
309 | |||
310 | #ifdef CONFIG_MACH_EUKREA_MBIMXSD51_BASEBOARD | ||
311 | eukrea_mbimxsd51_baseboard_init(); | ||
312 | #endif | ||
313 | } | ||
314 | |||
315 | static void __init eukrea_cpuimx51sd_timer_init(void) | ||
316 | { | ||
317 | mx51_clocks_init(32768, 24000000, 22579200, 0); | ||
318 | } | ||
319 | |||
320 | static struct sys_timer mxc_timer = { | ||
321 | .init = eukrea_cpuimx51sd_timer_init, | ||
322 | }; | ||
323 | |||
324 | MACHINE_START(EUKREA_CPUIMX51SD, "Eukrea CPUIMX51SD") | ||
325 | /* Maintainer: Eric BĂ©nard <eric@eukrea.com> */ | ||
326 | .phys_io = MX51_AIPS1_BASE_ADDR, | ||
327 | .io_pg_offst = ((MX51_AIPS1_BASE_ADDR_VIRT) >> 18) & 0xfffc, | ||
328 | .boot_params = PHYS_OFFSET + 0x100, | ||
329 | .map_io = mx51_map_io, | ||
330 | .init_irq = mx51_init_irq, | ||
331 | .init_machine = eukrea_cpuimx51sd_init, | ||
332 | .timer = &mxc_timer, | ||
333 | MACHINE_END | ||
diff --git a/arch/arm/mach-mx5/clock-mx51.c b/arch/arm/mach-mx5/clock-mx51.c index 21cecc040172..f2aae92cf0e2 100644 --- a/arch/arm/mach-mx5/clock-mx51.c +++ b/arch/arm/mach-mx5/clock-mx51.c | |||
@@ -41,6 +41,36 @@ static struct clk usboh3_clk; | |||
41 | 41 | ||
42 | #define MAX_DPLL_WAIT_TRIES 1000 /* 1000 * udelay(1) = 1ms */ | 42 | #define MAX_DPLL_WAIT_TRIES 1000 /* 1000 * udelay(1) = 1ms */ |
43 | 43 | ||
44 | /* calculate best pre and post dividers to get the required divider */ | ||
45 | static void __calc_pre_post_dividers(u32 div, u32 *pre, u32 *post, | ||
46 | u32 max_pre, u32 max_post) | ||
47 | { | ||
48 | if (div >= max_pre * max_post) { | ||
49 | *pre = max_pre; | ||
50 | *post = max_post; | ||
51 | } else if (div >= max_pre) { | ||
52 | u32 min_pre, temp_pre, old_err, err; | ||
53 | min_pre = DIV_ROUND_UP(div, max_post); | ||
54 | old_err = max_pre; | ||
55 | for (temp_pre = max_pre; temp_pre >= min_pre; temp_pre--) { | ||
56 | err = div % temp_pre; | ||
57 | if (err == 0) { | ||
58 | *pre = temp_pre; | ||
59 | break; | ||
60 | } | ||
61 | err = temp_pre - err; | ||
62 | if (err < old_err) { | ||
63 | old_err = err; | ||
64 | *pre = temp_pre; | ||
65 | } | ||
66 | } | ||
67 | *post = DIV_ROUND_UP(div, *pre); | ||
68 | } else { | ||
69 | *pre = div; | ||
70 | *post = 1; | ||
71 | } | ||
72 | } | ||
73 | |||
44 | static void _clk_ccgr_setclk(struct clk *clk, unsigned mode) | 74 | static void _clk_ccgr_setclk(struct clk *clk, unsigned mode) |
45 | { | 75 | { |
46 | u32 reg = __raw_readl(clk->enable_reg); | 76 | u32 reg = __raw_readl(clk->enable_reg); |
@@ -544,35 +574,6 @@ static int _clk_ipg_per_set_parent(struct clk *clk, struct clk *parent) | |||
544 | return 0; | 574 | return 0; |
545 | } | 575 | } |
546 | 576 | ||
547 | static unsigned long clk_uart_get_rate(struct clk *clk) | ||
548 | { | ||
549 | u32 reg, prediv, podf; | ||
550 | unsigned long parent_rate; | ||
551 | |||
552 | parent_rate = clk_get_rate(clk->parent); | ||
553 | |||
554 | reg = __raw_readl(MXC_CCM_CSCDR1); | ||
555 | prediv = ((reg & MXC_CCM_CSCDR1_UART_CLK_PRED_MASK) >> | ||
556 | MXC_CCM_CSCDR1_UART_CLK_PRED_OFFSET) + 1; | ||
557 | podf = ((reg & MXC_CCM_CSCDR1_UART_CLK_PODF_MASK) >> | ||
558 | MXC_CCM_CSCDR1_UART_CLK_PODF_OFFSET) + 1; | ||
559 | |||
560 | return parent_rate / (prediv * podf); | ||
561 | } | ||
562 | |||
563 | static int _clk_uart_set_parent(struct clk *clk, struct clk *parent) | ||
564 | { | ||
565 | u32 reg, mux; | ||
566 | |||
567 | mux = _get_mux(parent, &pll1_sw_clk, &pll2_sw_clk, &pll3_sw_clk, | ||
568 | &lp_apm_clk); | ||
569 | reg = __raw_readl(MXC_CCM_CSCMR1) & ~MXC_CCM_CSCMR1_UART_CLK_SEL_MASK; | ||
570 | reg |= mux << MXC_CCM_CSCMR1_UART_CLK_SEL_OFFSET; | ||
571 | __raw_writel(reg, MXC_CCM_CSCMR1); | ||
572 | |||
573 | return 0; | ||
574 | } | ||
575 | |||
576 | #define clk_nfc_set_parent NULL | 577 | #define clk_nfc_set_parent NULL |
577 | 578 | ||
578 | static unsigned long clk_nfc_get_rate(struct clk *clk) | 579 | static unsigned long clk_nfc_get_rate(struct clk *clk) |
@@ -631,35 +632,6 @@ static int clk_nfc_set_rate(struct clk *clk, unsigned long rate) | |||
631 | return 0; | 632 | return 0; |
632 | } | 633 | } |
633 | 634 | ||
634 | static unsigned long clk_usboh3_get_rate(struct clk *clk) | ||
635 | { | ||
636 | u32 reg, prediv, podf; | ||
637 | unsigned long parent_rate; | ||
638 | |||
639 | parent_rate = clk_get_rate(clk->parent); | ||
640 | |||
641 | reg = __raw_readl(MXC_CCM_CSCDR1); | ||
642 | prediv = ((reg & MXC_CCM_CSCDR1_USBOH3_CLK_PRED_MASK) >> | ||
643 | MXC_CCM_CSCDR1_USBOH3_CLK_PRED_OFFSET) + 1; | ||
644 | podf = ((reg & MXC_CCM_CSCDR1_USBOH3_CLK_PODF_MASK) >> | ||
645 | MXC_CCM_CSCDR1_USBOH3_CLK_PODF_OFFSET) + 1; | ||
646 | |||
647 | return parent_rate / (prediv * podf); | ||
648 | } | ||
649 | |||
650 | static int _clk_usboh3_set_parent(struct clk *clk, struct clk *parent) | ||
651 | { | ||
652 | u32 reg, mux; | ||
653 | |||
654 | mux = _get_mux(parent, &pll1_sw_clk, &pll2_sw_clk, &pll3_sw_clk, | ||
655 | &lp_apm_clk); | ||
656 | reg = __raw_readl(MXC_CCM_CSCMR1) & ~MXC_CCM_CSCMR1_USBOH3_CLK_SEL_MASK; | ||
657 | reg |= mux << MXC_CCM_CSCMR1_USBOH3_CLK_SEL_OFFSET; | ||
658 | __raw_writel(reg, MXC_CCM_CSCMR1); | ||
659 | |||
660 | return 0; | ||
661 | } | ||
662 | |||
663 | static unsigned long get_high_reference_clock_rate(struct clk *clk) | 635 | static unsigned long get_high_reference_clock_rate(struct clk *clk) |
664 | { | 636 | { |
665 | return external_high_reference; | 637 | return external_high_reference; |
@@ -786,18 +758,6 @@ static struct clk ipg_perclk = { | |||
786 | .set_parent = _clk_ipg_per_set_parent, | 758 | .set_parent = _clk_ipg_per_set_parent, |
787 | }; | 759 | }; |
788 | 760 | ||
789 | static struct clk uart_root_clk = { | ||
790 | .parent = &pll2_sw_clk, | ||
791 | .get_rate = clk_uart_get_rate, | ||
792 | .set_parent = _clk_uart_set_parent, | ||
793 | }; | ||
794 | |||
795 | static struct clk usboh3_clk = { | ||
796 | .parent = &pll2_sw_clk, | ||
797 | .get_rate = clk_usboh3_get_rate, | ||
798 | .set_parent = _clk_usboh3_set_parent, | ||
799 | }; | ||
800 | |||
801 | static struct clk ahb_max_clk = { | 761 | static struct clk ahb_max_clk = { |
802 | .parent = &ahb_clk, | 762 | .parent = &ahb_clk, |
803 | .enable_reg = MXC_CCM_CCGR0, | 763 | .enable_reg = MXC_CCM_CCGR0, |
@@ -842,7 +802,7 @@ static struct clk emi_slow_clk = { | |||
842 | .get_rate = clk_emi_slow_get_rate, | 802 | .get_rate = clk_emi_slow_get_rate, |
843 | }; | 803 | }; |
844 | 804 | ||
845 | #define DEFINE_CLOCK1(name, i, er, es, pfx, p, s) \ | 805 | #define DEFINE_CLOCK_CCGR(name, i, er, es, pfx, p, s) \ |
846 | static struct clk name = { \ | 806 | static struct clk name = { \ |
847 | .id = i, \ | 807 | .id = i, \ |
848 | .enable_reg = er, \ | 808 | .enable_reg = er, \ |
@@ -857,35 +817,104 @@ static struct clk emi_slow_clk = { | |||
857 | .secondary = s, \ | 817 | .secondary = s, \ |
858 | } | 818 | } |
859 | 819 | ||
860 | /* eCSPI */ | 820 | #define DEFINE_CLOCK_MAX(name, i, er, es, pfx, p, s) \ |
861 | static unsigned long clk_ecspi_get_rate(struct clk *clk) | 821 | static struct clk name = { \ |
862 | { | 822 | .id = i, \ |
863 | u32 reg, pred, podf; | 823 | .enable_reg = er, \ |
824 | .enable_shift = es, \ | ||
825 | .get_rate = pfx##_get_rate, \ | ||
826 | .set_rate = pfx##_set_rate, \ | ||
827 | .set_parent = pfx##_set_parent, \ | ||
828 | .enable = _clk_max_enable, \ | ||
829 | .disable = _clk_max_disable, \ | ||
830 | .parent = p, \ | ||
831 | .secondary = s, \ | ||
832 | } | ||
864 | 833 | ||
865 | reg = __raw_readl(MXC_CCM_CSCDR2); | 834 | #define CLK_GET_RATE(name, nr, bitsname) \ |
835 | static unsigned long clk_##name##_get_rate(struct clk *clk) \ | ||
836 | { \ | ||
837 | u32 reg, pred, podf; \ | ||
838 | \ | ||
839 | reg = __raw_readl(MXC_CCM_CSCDR##nr); \ | ||
840 | pred = (reg & MXC_CCM_CSCDR##nr##_##bitsname##_CLK_PRED_MASK) \ | ||
841 | >> MXC_CCM_CSCDR##nr##_##bitsname##_CLK_PRED_OFFSET; \ | ||
842 | podf = (reg & MXC_CCM_CSCDR##nr##_##bitsname##_CLK_PODF_MASK) \ | ||
843 | >> MXC_CCM_CSCDR##nr##_##bitsname##_CLK_PODF_OFFSET; \ | ||
844 | \ | ||
845 | return DIV_ROUND_CLOSEST(clk_get_rate(clk->parent), \ | ||
846 | (pred + 1) * (podf + 1)); \ | ||
847 | } | ||
866 | 848 | ||
867 | pred = (reg & MXC_CCM_CSCDR2_CSPI_CLK_PRED_MASK) >> | 849 | #define CLK_SET_PARENT(name, nr, bitsname) \ |
868 | MXC_CCM_CSCDR2_CSPI_CLK_PRED_OFFSET; | 850 | static int clk_##name##_set_parent(struct clk *clk, struct clk *parent) \ |
869 | podf = (reg & MXC_CCM_CSCDR2_CSPI_CLK_PODF_MASK) >> | 851 | { \ |
870 | MXC_CCM_CSCDR2_CSPI_CLK_PODF_OFFSET; | 852 | u32 reg, mux; \ |
853 | \ | ||
854 | mux = _get_mux(parent, &pll1_sw_clk, &pll2_sw_clk, \ | ||
855 | &pll3_sw_clk, &lp_apm_clk); \ | ||
856 | reg = __raw_readl(MXC_CCM_CSCMR##nr) & \ | ||
857 | ~MXC_CCM_CSCMR##nr##_##bitsname##_CLK_SEL_MASK; \ | ||
858 | reg |= mux << MXC_CCM_CSCMR##nr##_##bitsname##_CLK_SEL_OFFSET; \ | ||
859 | __raw_writel(reg, MXC_CCM_CSCMR##nr); \ | ||
860 | \ | ||
861 | return 0; \ | ||
862 | } | ||
871 | 863 | ||
872 | return DIV_ROUND_CLOSEST(clk_get_rate(clk->parent), | 864 | #define CLK_SET_RATE(name, nr, bitsname) \ |
873 | (pred + 1) * (podf + 1)); | 865 | static int clk_##name##_set_rate(struct clk *clk, unsigned long rate) \ |
866 | { \ | ||
867 | u32 reg, div, parent_rate; \ | ||
868 | u32 pre = 0, post = 0; \ | ||
869 | \ | ||
870 | parent_rate = clk_get_rate(clk->parent); \ | ||
871 | div = parent_rate / rate; \ | ||
872 | \ | ||
873 | if ((parent_rate / div) != rate) \ | ||
874 | return -EINVAL; \ | ||
875 | \ | ||
876 | __calc_pre_post_dividers(div, &pre, &post, \ | ||
877 | (MXC_CCM_CSCDR##nr##_##bitsname##_CLK_PRED_MASK >> \ | ||
878 | MXC_CCM_CSCDR##nr##_##bitsname##_CLK_PRED_OFFSET) + 1, \ | ||
879 | (MXC_CCM_CSCDR##nr##_##bitsname##_CLK_PODF_MASK >> \ | ||
880 | MXC_CCM_CSCDR##nr##_##bitsname##_CLK_PODF_OFFSET) + 1);\ | ||
881 | \ | ||
882 | /* Set sdhc1 clock divider */ \ | ||
883 | reg = __raw_readl(MXC_CCM_CSCDR##nr) & \ | ||
884 | ~(MXC_CCM_CSCDR##nr##_##bitsname##_CLK_PRED_MASK \ | ||
885 | | MXC_CCM_CSCDR##nr##_##bitsname##_CLK_PODF_MASK); \ | ||
886 | reg |= (post - 1) << \ | ||
887 | MXC_CCM_CSCDR##nr##_##bitsname##_CLK_PODF_OFFSET; \ | ||
888 | reg |= (pre - 1) << \ | ||
889 | MXC_CCM_CSCDR##nr##_##bitsname##_CLK_PRED_OFFSET; \ | ||
890 | __raw_writel(reg, MXC_CCM_CSCDR##nr); \ | ||
891 | \ | ||
892 | return 0; \ | ||
874 | } | 893 | } |
875 | 894 | ||
876 | static int clk_ecspi_set_parent(struct clk *clk, struct clk *parent) | 895 | /* UART */ |
877 | { | 896 | CLK_GET_RATE(uart, 1, UART) |
878 | u32 reg, mux; | 897 | CLK_SET_PARENT(uart, 1, UART) |
879 | 898 | ||
880 | mux = _get_mux(parent, &pll1_sw_clk, &pll2_sw_clk, &pll3_sw_clk, | 899 | static struct clk uart_root_clk = { |
881 | &lp_apm_clk); | 900 | .parent = &pll2_sw_clk, |
901 | .get_rate = clk_uart_get_rate, | ||
902 | .set_parent = clk_uart_set_parent, | ||
903 | }; | ||
882 | 904 | ||
883 | reg = __raw_readl(MXC_CCM_CSCMR1) & ~MXC_CCM_CSCMR1_CSPI_CLK_SEL_MASK; | 905 | /* USBOH3 */ |
884 | reg |= mux << MXC_CCM_CSCMR1_CSPI_CLK_SEL_OFFSET; | 906 | CLK_GET_RATE(usboh3, 1, USBOH3) |
885 | __raw_writel(reg, MXC_CCM_CSCMR1); | 907 | CLK_SET_PARENT(usboh3, 1, USBOH3) |
886 | 908 | ||
887 | return 0; | 909 | static struct clk usboh3_clk = { |
888 | } | 910 | .parent = &pll2_sw_clk, |
911 | .get_rate = clk_usboh3_get_rate, | ||
912 | .set_parent = clk_usboh3_set_parent, | ||
913 | }; | ||
914 | |||
915 | /* eCSPI */ | ||
916 | CLK_GET_RATE(ecspi, 2, CSPI) | ||
917 | CLK_SET_PARENT(ecspi, 1, CSPI) | ||
889 | 918 | ||
890 | static struct clk ecspi_main_clk = { | 919 | static struct clk ecspi_main_clk = { |
891 | .parent = &pll3_sw_clk, | 920 | .parent = &pll3_sw_clk, |
@@ -893,6 +922,15 @@ static struct clk ecspi_main_clk = { | |||
893 | .set_parent = clk_ecspi_set_parent, | 922 | .set_parent = clk_ecspi_set_parent, |
894 | }; | 923 | }; |
895 | 924 | ||
925 | /* eSDHC */ | ||
926 | CLK_GET_RATE(esdhc1, 1, ESDHC1_MSHC1) | ||
927 | CLK_SET_PARENT(esdhc1, 1, ESDHC1_MSHC1) | ||
928 | CLK_SET_RATE(esdhc1, 1, ESDHC1_MSHC1) | ||
929 | |||
930 | CLK_GET_RATE(esdhc2, 1, ESDHC2_MSHC2) | ||
931 | CLK_SET_PARENT(esdhc2, 1, ESDHC2_MSHC2) | ||
932 | CLK_SET_RATE(esdhc2, 1, ESDHC2_MSHC2) | ||
933 | |||
896 | #define DEFINE_CLOCK_FULL(name, i, er, es, gr, sr, e, d, p, s) \ | 934 | #define DEFINE_CLOCK_FULL(name, i, er, es, gr, sr, e, d, p, s) \ |
897 | static struct clk name = { \ | 935 | static struct clk name = { \ |
898 | .id = i, \ | 936 | .id = i, \ |
@@ -946,7 +984,7 @@ DEFINE_CLOCK(fec_clk, 0, MXC_CCM_CCGR2, MXC_CCM_CCGRx_CG12_OFFSET, | |||
946 | NULL, NULL, &ipg_clk, NULL); | 984 | NULL, NULL, &ipg_clk, NULL); |
947 | 985 | ||
948 | /* NFC */ | 986 | /* NFC */ |
949 | DEFINE_CLOCK1(nfc_clk, 0, MXC_CCM_CCGR5, MXC_CCM_CCGRx_CG10_OFFSET, | 987 | DEFINE_CLOCK_CCGR(nfc_clk, 0, MXC_CCM_CCGR5, MXC_CCM_CCGRx_CG10_OFFSET, |
950 | clk_nfc, &emi_slow_clk, NULL); | 988 | clk_nfc, &emi_slow_clk, NULL); |
951 | 989 | ||
952 | /* SSI */ | 990 | /* SSI */ |
@@ -981,6 +1019,16 @@ DEFINE_CLOCK(cspi_clk, 0, MXC_CCM_CCGR4, MXC_CCM_CCGRx_CG13_OFFSET, | |||
981 | DEFINE_CLOCK(sdma_clk, 1, MXC_CCM_CCGR4, MXC_CCM_CCGRx_CG15_OFFSET, | 1019 | DEFINE_CLOCK(sdma_clk, 1, MXC_CCM_CCGR4, MXC_CCM_CCGRx_CG15_OFFSET, |
982 | NULL, NULL, &ahb_clk, NULL); | 1020 | NULL, NULL, &ahb_clk, NULL); |
983 | 1021 | ||
1022 | /* eSDHC */ | ||
1023 | DEFINE_CLOCK_FULL(esdhc1_ipg_clk, 0, MXC_CCM_CCGR3, MXC_CCM_CCGRx_CG0_OFFSET, | ||
1024 | NULL, NULL, _clk_max_enable, _clk_max_disable, &ipg_clk, NULL); | ||
1025 | DEFINE_CLOCK_MAX(esdhc1_clk, 0, MXC_CCM_CCGR3, MXC_CCM_CCGRx_CG1_OFFSET, | ||
1026 | clk_esdhc1, &pll2_sw_clk, &esdhc1_ipg_clk); | ||
1027 | DEFINE_CLOCK_FULL(esdhc2_ipg_clk, 1, MXC_CCM_CCGR3, MXC_CCM_CCGRx_CG2_OFFSET, | ||
1028 | NULL, NULL, _clk_max_enable, _clk_max_disable, &ipg_clk, NULL); | ||
1029 | DEFINE_CLOCK_MAX(esdhc2_clk, 1, MXC_CCM_CCGR3, MXC_CCM_CCGRx_CG3_OFFSET, | ||
1030 | clk_esdhc2, &pll2_sw_clk, &esdhc2_ipg_clk); | ||
1031 | |||
984 | #define _REGISTER_CLOCK(d, n, c) \ | 1032 | #define _REGISTER_CLOCK(d, n, c) \ |
985 | { \ | 1033 | { \ |
986 | .dev_id = d, \ | 1034 | .dev_id = d, \ |
@@ -1014,6 +1062,8 @@ static struct clk_lookup lookups[] = { | |||
1014 | _REGISTER_CLOCK("imx51-ecspi.0", NULL, ecspi1_clk) | 1062 | _REGISTER_CLOCK("imx51-ecspi.0", NULL, ecspi1_clk) |
1015 | _REGISTER_CLOCK("imx51-ecspi.1", NULL, ecspi2_clk) | 1063 | _REGISTER_CLOCK("imx51-ecspi.1", NULL, ecspi2_clk) |
1016 | _REGISTER_CLOCK("imx51-cspi.0", NULL, cspi_clk) | 1064 | _REGISTER_CLOCK("imx51-cspi.0", NULL, cspi_clk) |
1065 | _REGISTER_CLOCK("sdhci-esdhc-imx.0", NULL, esdhc1_clk) | ||
1066 | _REGISTER_CLOCK("sdhci-esdhc-imx.1", NULL, esdhc2_clk) | ||
1017 | }; | 1067 | }; |
1018 | 1068 | ||
1019 | static void clk_tree_init(void) | 1069 | static void clk_tree_init(void) |
@@ -1057,6 +1107,14 @@ int __init mx51_clocks_init(unsigned long ckil, unsigned long osc, | |||
1057 | /* set the usboh3_clk parent to pll2_sw_clk */ | 1107 | /* set the usboh3_clk parent to pll2_sw_clk */ |
1058 | clk_set_parent(&usboh3_clk, &pll2_sw_clk); | 1108 | clk_set_parent(&usboh3_clk, &pll2_sw_clk); |
1059 | 1109 | ||
1110 | /* Set SDHC parents to be PLL2 */ | ||
1111 | clk_set_parent(&esdhc1_clk, &pll2_sw_clk); | ||
1112 | clk_set_parent(&esdhc2_clk, &pll2_sw_clk); | ||
1113 | |||
1114 | /* set SDHC root clock as 166.25MHZ*/ | ||
1115 | clk_set_rate(&esdhc1_clk, 166250000); | ||
1116 | clk_set_rate(&esdhc2_clk, 166250000); | ||
1117 | |||
1060 | /* System timer */ | 1118 | /* System timer */ |
1061 | mxc_timer_init(&gpt_clk, MX51_IO_ADDRESS(MX51_GPT1_BASE_ADDR), | 1119 | mxc_timer_init(&gpt_clk, MX51_IO_ADDRESS(MX51_GPT1_BASE_ADDR), |
1062 | MX51_MXC_INT_GPT); | 1120 | MX51_MXC_INT_GPT); |
diff --git a/arch/arm/mach-mx5/devices-imx51.h b/arch/arm/mach-mx5/devices-imx51.h index c233379256b8..5cc910e60538 100644 --- a/arch/arm/mach-mx5/devices-imx51.h +++ b/arch/arm/mach-mx5/devices-imx51.h | |||
@@ -36,3 +36,7 @@ extern const struct imx_spi_imx_data imx51_cspi_data __initconst; | |||
36 | extern const struct imx_spi_imx_data imx51_ecspi_data[] __initconst; | 36 | extern const struct imx_spi_imx_data imx51_ecspi_data[] __initconst; |
37 | #define imx51_add_ecspi(id, pdata) \ | 37 | #define imx51_add_ecspi(id, pdata) \ |
38 | imx_add_spi_imx(&imx51_ecspi_data[id], pdata) | 38 | imx_add_spi_imx(&imx51_ecspi_data[id], pdata) |
39 | |||
40 | extern const struct imx_esdhc_imx_data imx51_esdhc_data[] __initconst; | ||
41 | #define imx51_add_esdhc(id, pdata) \ | ||
42 | imx_add_esdhc(&imx51_esdhc_data[id], pdata) | ||
diff --git a/arch/arm/mach-mx5/eukrea_mbimx51-baseboard.c b/arch/arm/mach-mx5/eukrea_mbimx51-baseboard.c index d0e417ce2c08..a2e6e8c39d25 100644 --- a/arch/arm/mach-mx5/eukrea_mbimx51-baseboard.c +++ b/arch/arm/mach-mx5/eukrea_mbimx51-baseboard.c | |||
@@ -113,6 +113,22 @@ static struct pad_desc mbimx51_pads[] = { | |||
113 | MX51_PAD_KEY_COL1__KEY_COL1, | 113 | MX51_PAD_KEY_COL1__KEY_COL1, |
114 | MX51_PAD_KEY_COL2__KEY_COL2, | 114 | MX51_PAD_KEY_COL2__KEY_COL2, |
115 | MX51_PAD_KEY_COL3__KEY_COL3, | 115 | MX51_PAD_KEY_COL3__KEY_COL3, |
116 | |||
117 | /* SD 1 */ | ||
118 | MX51_PAD_SD1_CMD__SD1_CMD, | ||
119 | MX51_PAD_SD1_CLK__SD1_CLK, | ||
120 | MX51_PAD_SD1_DATA0__SD1_DATA0, | ||
121 | MX51_PAD_SD1_DATA1__SD1_DATA1, | ||
122 | MX51_PAD_SD1_DATA2__SD1_DATA2, | ||
123 | MX51_PAD_SD1_DATA3__SD1_DATA3, | ||
124 | |||
125 | /* SD 2 */ | ||
126 | MX51_PAD_SD2_CMD__SD2_CMD, | ||
127 | MX51_PAD_SD2_CLK__SD2_CLK, | ||
128 | MX51_PAD_SD2_DATA0__SD2_DATA0, | ||
129 | MX51_PAD_SD2_DATA1__SD2_DATA1, | ||
130 | MX51_PAD_SD2_DATA2__SD2_DATA2, | ||
131 | MX51_PAD_SD2_DATA3__SD2_DATA3, | ||
116 | }; | 132 | }; |
117 | 133 | ||
118 | static const struct imxuart_platform_data uart_pdata __initconst = { | 134 | static const struct imxuart_platform_data uart_pdata __initconst = { |
@@ -159,9 +175,11 @@ struct tsc2007_platform_data tsc2007_data = { | |||
159 | 175 | ||
160 | static struct i2c_board_info mbimx51_i2c_devices[] = { | 176 | static struct i2c_board_info mbimx51_i2c_devices[] = { |
161 | { | 177 | { |
162 | I2C_BOARD_INFO("tsc2007", 0x48), | 178 | I2C_BOARD_INFO("tsc2007", 0x49), |
163 | .irq = MBIMX51_TSC2007_IRQ, | 179 | .irq = MBIMX51_TSC2007_IRQ, |
164 | .platform_data = &tsc2007_data, | 180 | .platform_data = &tsc2007_data, |
181 | }, { | ||
182 | I2C_BOARD_INFO("tlv320aic23", 0x1a), | ||
165 | }, | 183 | }, |
166 | }; | 184 | }; |
167 | 185 | ||
@@ -198,4 +216,7 @@ void __init eukrea_mbimx51_baseboard_init(void) | |||
198 | set_irq_type(MBIMX51_TSC2007_IRQ, IRQF_TRIGGER_FALLING); | 216 | set_irq_type(MBIMX51_TSC2007_IRQ, IRQF_TRIGGER_FALLING); |
199 | i2c_register_board_info(1, mbimx51_i2c_devices, | 217 | i2c_register_board_info(1, mbimx51_i2c_devices, |
200 | ARRAY_SIZE(mbimx51_i2c_devices)); | 218 | ARRAY_SIZE(mbimx51_i2c_devices)); |
219 | |||
220 | imx51_add_esdhc(0, NULL); | ||
221 | imx51_add_esdhc(1, NULL); | ||
201 | } | 222 | } |
diff --git a/arch/arm/mach-mx5/eukrea_mbimxsd-baseboard.c b/arch/arm/mach-mx5/eukrea_mbimxsd-baseboard.c new file mode 100644 index 000000000000..2b48f5190830 --- /dev/null +++ b/arch/arm/mach-mx5/eukrea_mbimxsd-baseboard.c | |||
@@ -0,0 +1,166 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2010 Eric Benard - eric@eukrea.com | ||
3 | * | ||
4 | * Based on pcm970-baseboard.c which is : | ||
5 | * Copyright (C) 2008 Juergen Beisert (kernel@pengutronix.de) | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or | ||
8 | * modify it under the terms of the GNU General Public License | ||
9 | * as published by the Free Software Foundation; either version 2 | ||
10 | * of the License, or (at your option) any later version. | ||
11 | * This program is distributed in the hope that it will be useful, | ||
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
14 | * GNU General Public License for more details. | ||
15 | * | ||
16 | * You should have received a copy of the GNU General Public License | ||
17 | * along with this program; if not, write to the Free Software | ||
18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, | ||
19 | * MA 02110-1301, USA. | ||
20 | */ | ||
21 | |||
22 | #include <linux/types.h> | ||
23 | #include <linux/init.h> | ||
24 | |||
25 | #include <linux/gpio.h> | ||
26 | #include <linux/interrupt.h> | ||
27 | #include <linux/irq.h> | ||
28 | #include <linux/leds.h> | ||
29 | #include <linux/platform_device.h> | ||
30 | #include <linux/gpio_keys.h> | ||
31 | #include <linux/input.h> | ||
32 | #include <linux/i2c.h> | ||
33 | |||
34 | #include <asm/mach-types.h> | ||
35 | #include <asm/mach/arch.h> | ||
36 | #include <asm/mach/time.h> | ||
37 | #include <asm/mach/map.h> | ||
38 | |||
39 | #include <mach/hardware.h> | ||
40 | #include <mach/common.h> | ||
41 | #include <mach/imx-uart.h> | ||
42 | #include <mach/iomux-mx51.h> | ||
43 | #include <mach/audmux.h> | ||
44 | |||
45 | #include "devices-imx51.h" | ||
46 | #include "devices.h" | ||
47 | |||
48 | #define MBIMXSD_GPIO_3_31 IOMUX_PAD(0x554, 0x16C, 3, 0x0, 0, \ | ||
49 | MX51_PAD_CTRL_1 | PAD_CTL_PUS_22K_UP) | ||
50 | |||
51 | static struct pad_desc eukrea_mbimxsd_pads[] = { | ||
52 | /* LED */ | ||
53 | MX51_PAD_NANDF_D10__GPIO_3_30, | ||
54 | /* SWITCH */ | ||
55 | MBIMXSD_GPIO_3_31, | ||
56 | /* UART2 */ | ||
57 | MX51_PAD_UART2_RXD__UART2_RXD, | ||
58 | MX51_PAD_UART2_TXD__UART2_TXD, | ||
59 | /* UART 3 */ | ||
60 | MX51_PAD_UART3_RXD__UART3_RXD, | ||
61 | MX51_PAD_UART3_TXD__UART3_TXD, | ||
62 | MX51_PAD_KEY_COL4__UART3_RTS, | ||
63 | MX51_PAD_KEY_COL5__UART3_CTS, | ||
64 | /* SD */ | ||
65 | MX51_PAD_SD1_CMD__SD1_CMD, | ||
66 | MX51_PAD_SD1_CLK__SD1_CLK, | ||
67 | MX51_PAD_SD1_DATA0__SD1_DATA0, | ||
68 | MX51_PAD_SD1_DATA1__SD1_DATA1, | ||
69 | MX51_PAD_SD1_DATA2__SD1_DATA2, | ||
70 | MX51_PAD_SD1_DATA3__SD1_DATA3, | ||
71 | }; | ||
72 | |||
73 | #define GPIO_LED1 (2 * 32 + 30) | ||
74 | #define GPIO_SWITCH1 (2 * 32 + 31) | ||
75 | |||
76 | static struct gpio_led eukrea_mbimxsd_leds[] = { | ||
77 | { | ||
78 | .name = "led1", | ||
79 | .default_trigger = "heartbeat", | ||
80 | .active_low = 1, | ||
81 | .gpio = GPIO_LED1, | ||
82 | }, | ||
83 | }; | ||
84 | |||
85 | static struct gpio_led_platform_data eukrea_mbimxsd_led_info = { | ||
86 | .leds = eukrea_mbimxsd_leds, | ||
87 | .num_leds = ARRAY_SIZE(eukrea_mbimxsd_leds), | ||
88 | }; | ||
89 | |||
90 | static struct platform_device eukrea_mbimxsd_leds_gpio = { | ||
91 | .name = "leds-gpio", | ||
92 | .id = -1, | ||
93 | .dev = { | ||
94 | .platform_data = &eukrea_mbimxsd_led_info, | ||
95 | }, | ||
96 | }; | ||
97 | |||
98 | static struct gpio_keys_button eukrea_mbimxsd_gpio_buttons[] = { | ||
99 | { | ||
100 | .gpio = GPIO_SWITCH1, | ||
101 | .code = BTN_0, | ||
102 | .desc = "BP1", | ||
103 | .active_low = 1, | ||
104 | .wakeup = 1, | ||
105 | }, | ||
106 | }; | ||
107 | |||
108 | static struct gpio_keys_platform_data eukrea_mbimxsd_button_data = { | ||
109 | .buttons = eukrea_mbimxsd_gpio_buttons, | ||
110 | .nbuttons = ARRAY_SIZE(eukrea_mbimxsd_gpio_buttons), | ||
111 | }; | ||
112 | |||
113 | static struct platform_device eukrea_mbimxsd_button_device = { | ||
114 | .name = "gpio-keys", | ||
115 | .id = -1, | ||
116 | .num_resources = 0, | ||
117 | .dev = { | ||
118 | .platform_data = &eukrea_mbimxsd_button_data, | ||
119 | } | ||
120 | }; | ||
121 | |||
122 | static struct platform_device *platform_devices[] __initdata = { | ||
123 | &eukrea_mbimxsd_leds_gpio, | ||
124 | &eukrea_mbimxsd_button_device, | ||
125 | }; | ||
126 | |||
127 | static const struct imxuart_platform_data uart_pdata __initconst = { | ||
128 | .flags = IMXUART_HAVE_RTSCTS, | ||
129 | }; | ||
130 | |||
131 | static struct i2c_board_info eukrea_mbimxsd_i2c_devices[] = { | ||
132 | { | ||
133 | I2C_BOARD_INFO("tlv320aic23", 0x1a), | ||
134 | }, | ||
135 | }; | ||
136 | |||
137 | /* | ||
138 | * system init for baseboard usage. Will be called by cpuimx51sd init. | ||
139 | * | ||
140 | * Add platform devices present on this baseboard and init | ||
141 | * them from CPU side as far as required to use them later on | ||
142 | */ | ||
143 | void __init eukrea_mbimxsd51_baseboard_init(void) | ||
144 | { | ||
145 | if (mxc_iomux_v3_setup_multiple_pads(eukrea_mbimxsd_pads, | ||
146 | ARRAY_SIZE(eukrea_mbimxsd_pads))) | ||
147 | printk(KERN_ERR "error setting mbimxsd pads !\n"); | ||
148 | |||
149 | imx51_add_imx_uart(1, NULL); | ||
150 | imx51_add_imx_uart(2, &uart_pdata); | ||
151 | |||
152 | imx51_add_esdhc(0, NULL); | ||
153 | |||
154 | gpio_request(GPIO_LED1, "LED1"); | ||
155 | gpio_direction_output(GPIO_LED1, 1); | ||
156 | gpio_free(GPIO_LED1); | ||
157 | |||
158 | gpio_request(GPIO_SWITCH1, "SWITCH1"); | ||
159 | gpio_direction_input(GPIO_SWITCH1); | ||
160 | gpio_free(GPIO_SWITCH1); | ||
161 | |||
162 | i2c_register_board_info(0, eukrea_mbimxsd_i2c_devices, | ||
163 | ARRAY_SIZE(eukrea_mbimxsd_i2c_devices)); | ||
164 | |||
165 | platform_add_devices(platform_devices, ARRAY_SIZE(platform_devices)); | ||
166 | } | ||