diff options
author | Tony Lindgren <tony@atomide.com> | 2008-12-10 20:37:16 -0500 |
---|---|---|
committer | Tony Lindgren <tony@atomide.com> | 2008-12-10 20:37:16 -0500 |
commit | d88746652b4d133284d1fdd05b5e999e8f44c998 (patch) | |
tree | 2a6cfd6fe175a18eb4b4f600e0a79444259c9a5d /arch/arm/mach-omap1 | |
parent | 652bcd8f72cc0cdf4499ce7d73990514e5e3e4b9 (diff) |
omap mmc: Add better MMC low-level init
This will simplify the MMC low-level init, and make it more
flexible to add support for a newer MMC controller in the
following patches.
The patch rearranges platform data and gets rid of slot vs
controller confusion in the old data structures. Also fix
device id numbering in the clock code.
Some code snippets are based on an earlier patch by
Russell King <linux@arm.linux.org.uk>.
Cc: Pierre Ossman <drzeus-mmc@drzeus.cx>
Signed-off-by: Tony Lindgren <tony@atomide.com>
Diffstat (limited to 'arch/arm/mach-omap1')
-rw-r--r-- | arch/arm/mach-omap1/board-h2-mmc.c | 63 | ||||
-rw-r--r-- | arch/arm/mach-omap1/board-h2.c | 15 | ||||
-rw-r--r-- | arch/arm/mach-omap1/board-h3-mmc.c | 50 | ||||
-rw-r--r-- | arch/arm/mach-omap1/board-innovator.c | 50 | ||||
-rw-r--r-- | arch/arm/mach-omap1/board-nokia770.c | 74 | ||||
-rw-r--r-- | arch/arm/mach-omap1/board-sx1-mmc.c | 31 | ||||
-rw-r--r-- | arch/arm/mach-omap1/clock.h | 3 | ||||
-rw-r--r-- | arch/arm/mach-omap1/devices.c | 90 |
8 files changed, 329 insertions, 47 deletions
diff --git a/arch/arm/mach-omap1/board-h2-mmc.c b/arch/arm/mach-omap1/board-h2-mmc.c index 504ae881360f..409fa56d0a87 100644 --- a/arch/arm/mach-omap1/board-h2-mmc.c +++ b/arch/arm/mach-omap1/board-h2-mmc.c | |||
@@ -12,13 +12,74 @@ | |||
12 | * published by the Free Software Foundation. | 12 | * published by the Free Software Foundation. |
13 | */ | 13 | */ |
14 | 14 | ||
15 | #include <linux/platform_device.h> | ||
16 | |||
17 | #include <linux/i2c/tps65010.h> | ||
18 | |||
15 | #include <mach/mmc.h> | 19 | #include <mach/mmc.h> |
16 | #include <mach/gpio.h> | 20 | #include <mach/gpio.h> |
17 | 21 | ||
22 | #if defined(CONFIG_MMC_OMAP) || defined(CONFIG_MMC_OMAP_MODULE) | ||
23 | |||
24 | static int mmc_set_power(struct device *dev, int slot, int power_on, | ||
25 | int vdd) | ||
26 | { | ||
27 | if (power_on) | ||
28 | gpio_direction_output(H2_TPS_GPIO_MMC_PWR_EN, 1); | ||
29 | else | ||
30 | gpio_direction_output(H2_TPS_GPIO_MMC_PWR_EN, 0); | ||
31 | |||
32 | return 0; | ||
33 | } | ||
34 | |||
35 | static int mmc_late_init(struct device *dev) | ||
36 | { | ||
37 | int ret; | ||
38 | |||
39 | ret = gpio_request(H2_TPS_GPIO_MMC_PWR_EN, "MMC power"); | ||
40 | if (ret < 0) | ||
41 | return ret; | ||
42 | |||
43 | gpio_direction_output(H2_TPS_GPIO_MMC_PWR_EN, 0); | ||
44 | |||
45 | return ret; | ||
46 | } | ||
47 | |||
48 | static void mmc_shutdown(struct device *dev) | ||
49 | { | ||
50 | gpio_free(H2_TPS_GPIO_MMC_PWR_EN); | ||
51 | } | ||
52 | |||
53 | /* | ||
54 | * H2 could use the following functions tested: | ||
55 | * - mmc_get_cover_state that uses OMAP_MPUIO(1) | ||
56 | * - mmc_get_wp that uses OMAP_MPUIO(3) | ||
57 | */ | ||
58 | static struct omap_mmc_platform_data mmc1_data = { | ||
59 | .nr_slots = 1, | ||
60 | .init = mmc_late_init, | ||
61 | .shutdown = mmc_shutdown, | ||
62 | .dma_mask = 0xffffffff, | ||
63 | .slots[0] = { | ||
64 | .set_power = mmc_set_power, | ||
65 | .ocr_mask = MMC_VDD_28_29 | MMC_VDD_30_31 | | ||
66 | MMC_VDD_32_33 | MMC_VDD_33_34, | ||
67 | .name = "mmcblk", | ||
68 | }, | ||
69 | }; | ||
70 | |||
71 | static struct omap_mmc_platform_data *mmc_data[OMAP16XX_NR_MMC]; | ||
72 | |||
18 | void __init h2_mmc_init(void) | 73 | void __init h2_mmc_init(void) |
19 | { | 74 | { |
75 | mmc_data[0] = &mmc1_data; | ||
76 | omap1_init_mmc(mmc_data, OMAP16XX_NR_MMC); | ||
20 | } | 77 | } |
21 | 78 | ||
22 | void h2_mmc_slot_cover_handler(void *arg, int state) | 79 | #else |
80 | |||
81 | void __init h2_mmc_init(void) | ||
23 | { | 82 | { |
24 | } | 83 | } |
84 | |||
85 | #endif | ||
diff --git a/arch/arm/mach-omap1/board-h2.c b/arch/arm/mach-omap1/board-h2.c index 125d8e21dcea..b240c5f861da 100644 --- a/arch/arm/mach-omap1/board-h2.c +++ b/arch/arm/mach-omap1/board-h2.c | |||
@@ -345,10 +345,25 @@ static void __init h2_init_smc91x(void) | |||
345 | } | 345 | } |
346 | } | 346 | } |
347 | 347 | ||
348 | static int tps_setup(struct i2c_client *client, void *context) | ||
349 | { | ||
350 | tps65010_config_vregs1(TPS_LDO2_ENABLE | TPS_VLDO2_3_0V | | ||
351 | TPS_LDO1_ENABLE | TPS_VLDO1_3_0V); | ||
352 | |||
353 | return 0; | ||
354 | } | ||
355 | |||
356 | static struct tps65010_board tps_board = { | ||
357 | .base = H2_TPS_GPIO_BASE, | ||
358 | .outmask = 0x0f, | ||
359 | .setup = tps_setup, | ||
360 | }; | ||
361 | |||
348 | static struct i2c_board_info __initdata h2_i2c_board_info[] = { | 362 | static struct i2c_board_info __initdata h2_i2c_board_info[] = { |
349 | { | 363 | { |
350 | I2C_BOARD_INFO("tps65010", 0x48), | 364 | I2C_BOARD_INFO("tps65010", 0x48), |
351 | .irq = OMAP_GPIO_IRQ(58), | 365 | .irq = OMAP_GPIO_IRQ(58), |
366 | .platform_data = &tps_board, | ||
352 | }, { | 367 | }, { |
353 | I2C_BOARD_INFO("isp1301_omap", 0x2d), | 368 | I2C_BOARD_INFO("isp1301_omap", 0x2d), |
354 | .irq = OMAP_GPIO_IRQ(2), | 369 | .irq = OMAP_GPIO_IRQ(2), |
diff --git a/arch/arm/mach-omap1/board-h3-mmc.c b/arch/arm/mach-omap1/board-h3-mmc.c index 0baba1c4d12d..fdfe793d56f2 100644 --- a/arch/arm/mach-omap1/board-h3-mmc.c +++ b/arch/arm/mach-omap1/board-h3-mmc.c | |||
@@ -12,13 +12,61 @@ | |||
12 | * published by the Free Software Foundation. | 12 | * published by the Free Software Foundation. |
13 | */ | 13 | */ |
14 | 14 | ||
15 | #include <linux/platform_device.h> | ||
16 | |||
17 | #include <linux/i2c/tps65010.h> | ||
18 | |||
15 | #include <mach/mmc.h> | 19 | #include <mach/mmc.h> |
16 | #include <mach/gpio.h> | 20 | #include <mach/gpio.h> |
17 | 21 | ||
22 | #if defined(CONFIG_MMC_OMAP) || defined(CONFIG_MMC_OMAP_MODULE) | ||
23 | |||
24 | static int mmc_set_power(struct device *dev, int slot, int power_on, | ||
25 | int vdd) | ||
26 | { | ||
27 | if (power_on) | ||
28 | gpio_direction_output(H3_TPS_GPIO_MMC_PWR_EN, 1); | ||
29 | else | ||
30 | gpio_direction_output(H3_TPS_GPIO_MMC_PWR_EN, 0); | ||
31 | |||
32 | return 0; | ||
33 | } | ||
34 | |||
35 | /* | ||
36 | * H3 could use the following functions tested: | ||
37 | * - mmc_get_cover_state that uses OMAP_MPUIO(1) | ||
38 | * - mmc_get_wp that maybe uses OMAP_MPUIO(3) | ||
39 | */ | ||
40 | static struct omap_mmc_platform_data mmc1_data = { | ||
41 | .nr_slots = 1, | ||
42 | .dma_mask = 0xffffffff, | ||
43 | .slots[0] = { | ||
44 | .set_power = mmc_set_power, | ||
45 | .ocr_mask = MMC_VDD_28_29 | MMC_VDD_30_31 | | ||
46 | MMC_VDD_32_33 | MMC_VDD_33_34, | ||
47 | .name = "mmcblk", | ||
48 | }, | ||
49 | }; | ||
50 | |||
51 | static struct omap_mmc_platform_data *mmc_data[OMAP16XX_NR_MMC]; | ||
52 | |||
18 | void __init h3_mmc_init(void) | 53 | void __init h3_mmc_init(void) |
19 | { | 54 | { |
55 | int ret; | ||
56 | |||
57 | ret = gpio_request(H3_TPS_GPIO_MMC_PWR_EN, "MMC power"); | ||
58 | if (ret < 0) | ||
59 | return; | ||
60 | gpio_direction_output(H3_TPS_GPIO_MMC_PWR_EN, 0); | ||
61 | |||
62 | mmc_data[0] = &mmc1_data; | ||
63 | omap1_init_mmc(mmc_data, OMAP16XX_NR_MMC); | ||
20 | } | 64 | } |
21 | 65 | ||
22 | void h3_mmc_slot_cover_handler(void *arg, int state) | 66 | #else |
67 | |||
68 | void __init h3_mmc_init(void) | ||
23 | { | 69 | { |
24 | } | 70 | } |
71 | |||
72 | #endif | ||
diff --git a/arch/arm/mach-omap1/board-innovator.c b/arch/arm/mach-omap1/board-innovator.c index a21e365a7a87..8ffb06fc0f08 100644 --- a/arch/arm/mach-omap1/board-innovator.c +++ b/arch/arm/mach-omap1/board-innovator.c | |||
@@ -39,6 +39,7 @@ | |||
39 | #include <mach/common.h> | 39 | #include <mach/common.h> |
40 | #include <mach/mcbsp.h> | 40 | #include <mach/mcbsp.h> |
41 | #include <mach/omap-alsa.h> | 41 | #include <mach/omap-alsa.h> |
42 | #include <mach/mmc.h> | ||
42 | 43 | ||
43 | static int innovator_keymap[] = { | 44 | static int innovator_keymap[] = { |
44 | KEY(0, 0, KEY_F1), | 45 | KEY(0, 0, KEY_F1), |
@@ -360,16 +361,49 @@ static struct omap_lcd_config innovator1610_lcd_config __initdata = { | |||
360 | }; | 361 | }; |
361 | #endif | 362 | #endif |
362 | 363 | ||
363 | static struct omap_mmc_config innovator_mmc_config __initdata = { | 364 | #if defined(CONFIG_MMC_OMAP) || defined(CONFIG_MMC_OMAP_MODULE) |
364 | .mmc [0] = { | 365 | |
365 | .enabled = 1, | 366 | static int mmc_set_power(struct device *dev, int slot, int power_on, |
366 | .wire4 = 1, | 367 | int vdd) |
367 | .wp_pin = OMAP_MPUIO(3), | 368 | { |
368 | .power_pin = -1, /* FPGA F3 UIO42 */ | 369 | if (power_on) |
369 | .switch_pin = -1, /* FPGA F4 UIO43 */ | 370 | fpga_write(fpga_read(OMAP1510_FPGA_POWER) | (1 << 3), |
371 | OMAP1510_FPGA_POWER); | ||
372 | else | ||
373 | fpga_write(fpga_read(OMAP1510_FPGA_POWER) & ~(1 << 3), | ||
374 | OMAP1510_FPGA_POWER); | ||
375 | |||
376 | return 0; | ||
377 | } | ||
378 | |||
379 | /* | ||
380 | * Innovator could use the following functions tested: | ||
381 | * - mmc_get_wp that uses OMAP_MPUIO(3) | ||
382 | * - mmc_get_cover_state that uses FPGA F4 UIO43 | ||
383 | */ | ||
384 | static struct omap_mmc_platform_data mmc1_data = { | ||
385 | .nr_slots = 1, | ||
386 | .slots[0] = { | ||
387 | .set_power = mmc_set_power, | ||
388 | .wire4 = 1, | ||
389 | .name = "mmcblk", | ||
370 | }, | 390 | }, |
371 | }; | 391 | }; |
372 | 392 | ||
393 | static struct omap_mmc_platform_data *mmc_data[OMAP16XX_NR_MMC]; | ||
394 | |||
395 | void __init innovator_mmc_init(void) | ||
396 | { | ||
397 | mmc_data[0] = &mmc1_data; | ||
398 | omap1_init_mmc(mmc_data, OMAP15XX_NR_MMC); | ||
399 | } | ||
400 | |||
401 | #else | ||
402 | static inline void innovator_mmc_init(void) | ||
403 | { | ||
404 | } | ||
405 | #endif | ||
406 | |||
373 | static struct omap_uart_config innovator_uart_config __initdata = { | 407 | static struct omap_uart_config innovator_uart_config __initdata = { |
374 | .enabled_uarts = ((1 << 0) | (1 << 1) | (1 << 2)), | 408 | .enabled_uarts = ((1 << 0) | (1 << 1) | (1 << 2)), |
375 | }; | 409 | }; |
@@ -377,7 +411,6 @@ static struct omap_uart_config innovator_uart_config __initdata = { | |||
377 | static struct omap_board_config_kernel innovator_config[] = { | 411 | static struct omap_board_config_kernel innovator_config[] = { |
378 | { OMAP_TAG_USB, NULL }, | 412 | { OMAP_TAG_USB, NULL }, |
379 | { OMAP_TAG_LCD, NULL }, | 413 | { OMAP_TAG_LCD, NULL }, |
380 | { OMAP_TAG_MMC, &innovator_mmc_config }, | ||
381 | { OMAP_TAG_UART, &innovator_uart_config }, | 414 | { OMAP_TAG_UART, &innovator_uart_config }, |
382 | }; | 415 | }; |
383 | 416 | ||
@@ -412,6 +445,7 @@ static void __init innovator_init(void) | |||
412 | omap_board_config_size = ARRAY_SIZE(innovator_config); | 445 | omap_board_config_size = ARRAY_SIZE(innovator_config); |
413 | omap_serial_init(); | 446 | omap_serial_init(); |
414 | omap_register_i2c_bus(1, 100, NULL, 0); | 447 | omap_register_i2c_bus(1, 100, NULL, 0); |
448 | innovator_mmc_init(); | ||
415 | } | 449 | } |
416 | 450 | ||
417 | static void __init innovator_map_io(void) | 451 | static void __init innovator_map_io(void) |
diff --git a/arch/arm/mach-omap1/board-nokia770.c b/arch/arm/mach-omap1/board-nokia770.c index b26782471e59..4970c402a594 100644 --- a/arch/arm/mach-omap1/board-nokia770.c +++ b/arch/arm/mach-omap1/board-nokia770.c | |||
@@ -35,6 +35,7 @@ | |||
35 | #include <mach/aic23.h> | 35 | #include <mach/aic23.h> |
36 | #include <mach/omapfb.h> | 36 | #include <mach/omapfb.h> |
37 | #include <mach/lcd_mipid.h> | 37 | #include <mach/lcd_mipid.h> |
38 | #include <mach/mmc.h> | ||
38 | 39 | ||
39 | #define ADS7846_PENDOWN_GPIO 15 | 40 | #define ADS7846_PENDOWN_GPIO 15 |
40 | 41 | ||
@@ -173,26 +174,68 @@ static struct omap_usb_config nokia770_usb_config __initdata = { | |||
173 | .pins[0] = 6, | 174 | .pins[0] = 6, |
174 | }; | 175 | }; |
175 | 176 | ||
176 | static struct omap_mmc_config nokia770_mmc_config __initdata = { | 177 | #if defined(CONFIG_MMC_OMAP) || defined(CONFIG_MMC_OMAP_MODULE) |
177 | .mmc[0] = { | 178 | |
178 | .enabled = 0, | 179 | #define NOKIA770_GPIO_MMC_POWER 41 |
179 | .wire4 = 0, | 180 | #define NOKIA770_GPIO_MMC_SWITCH 23 |
180 | .wp_pin = -1, | 181 | |
181 | .power_pin = -1, | 182 | static int nokia770_mmc_set_power(struct device *dev, int slot, int power_on, |
182 | .switch_pin = -1, | 183 | int vdd) |
183 | }, | 184 | { |
184 | .mmc[1] = { | 185 | if (power_on) |
185 | .enabled = 0, | 186 | gpio_set_value(NOKIA770_GPIO_MMC_POWER, 1); |
186 | .wire4 = 0, | 187 | else |
187 | .wp_pin = -1, | 188 | gpio_set_value(NOKIA770_GPIO_MMC_POWER, 0); |
188 | .power_pin = -1, | 189 | |
189 | .switch_pin = -1, | 190 | return 0; |
191 | } | ||
192 | |||
193 | static int nokia770_mmc_get_cover_state(struct device *dev, int slot) | ||
194 | { | ||
195 | return gpio_get_value(NOKIA770_GPIO_MMC_SWITCH); | ||
196 | } | ||
197 | |||
198 | static struct omap_mmc_platform_data nokia770_mmc2_data = { | ||
199 | .nr_slots = 1, | ||
200 | .dma_mask = 0xffffffff, | ||
201 | .slots[0] = { | ||
202 | .set_power = nokia770_mmc_set_power, | ||
203 | .get_cover_state = nokia770_mmc_get_cover_state, | ||
204 | .name = "mmcblk", | ||
190 | }, | 205 | }, |
191 | }; | 206 | }; |
192 | 207 | ||
208 | static struct omap_mmc_platform_data *nokia770_mmc_data[OMAP16XX_NR_MMC]; | ||
209 | |||
210 | static void __init nokia770_mmc_init(void) | ||
211 | { | ||
212 | int ret; | ||
213 | |||
214 | ret = gpio_request(NOKIA770_GPIO_MMC_POWER, "MMC power"); | ||
215 | if (ret < 0) | ||
216 | return; | ||
217 | gpio_direction_output(NOKIA770_GPIO_MMC_POWER, 0); | ||
218 | |||
219 | ret = gpio_request(NOKIA770_GPIO_MMC_SWITCH, "MMC cover"); | ||
220 | if (ret < 0) { | ||
221 | gpio_free(NOKIA770_GPIO_MMC_POWER); | ||
222 | return; | ||
223 | } | ||
224 | gpio_direction_input(NOKIA770_GPIO_MMC_SWITCH); | ||
225 | |||
226 | /* Only the second MMC controller is used */ | ||
227 | nokia770_mmc_data[1] = &nokia770_mmc2_data; | ||
228 | omap1_init_mmc(nokia770_mmc_data, OMAP16XX_NR_MMC); | ||
229 | } | ||
230 | |||
231 | #else | ||
232 | static inline void nokia770_mmc_init(void) | ||
233 | { | ||
234 | } | ||
235 | #endif | ||
236 | |||
193 | static struct omap_board_config_kernel nokia770_config[] __initdata = { | 237 | static struct omap_board_config_kernel nokia770_config[] __initdata = { |
194 | { OMAP_TAG_USB, NULL }, | 238 | { OMAP_TAG_USB, NULL }, |
195 | { OMAP_TAG_MMC, &nokia770_mmc_config }, | ||
196 | }; | 239 | }; |
197 | 240 | ||
198 | #if defined(CONFIG_OMAP_DSP) | 241 | #if defined(CONFIG_OMAP_DSP) |
@@ -335,6 +378,7 @@ static void __init omap_nokia770_init(void) | |||
335 | omap_dsp_init(); | 378 | omap_dsp_init(); |
336 | ads7846_dev_init(); | 379 | ads7846_dev_init(); |
337 | mipid_dev_init(); | 380 | mipid_dev_init(); |
381 | nokia770_mmc_init(); | ||
338 | } | 382 | } |
339 | 383 | ||
340 | static void __init omap_nokia770_map_io(void) | 384 | static void __init omap_nokia770_map_io(void) |
diff --git a/arch/arm/mach-omap1/board-sx1-mmc.c b/arch/arm/mach-omap1/board-sx1-mmc.c index 0ece109aee41..66a4d7d5255d 100644 --- a/arch/arm/mach-omap1/board-sx1-mmc.c +++ b/arch/arm/mach-omap1/board-sx1-mmc.c | |||
@@ -12,30 +12,20 @@ | |||
12 | * published by the Free Software Foundation. | 12 | * published by the Free Software Foundation. |
13 | */ | 13 | */ |
14 | 14 | ||
15 | #include <linux/platform_device.h> | ||
16 | |||
15 | #include <mach/hardware.h> | 17 | #include <mach/hardware.h> |
16 | #include <mach/mmc.h> | 18 | #include <mach/mmc.h> |
17 | #include <mach/gpio.h> | 19 | #include <mach/gpio.h> |
18 | 20 | ||
19 | #ifdef CONFIG_MMC_OMAP | 21 | #if defined(CONFIG_MMC_OMAP) || defined(CONFIG_MMC_OMAP_MODULE) |
20 | static int slot_cover_open; | ||
21 | static struct device *mmc_device; | ||
22 | 22 | ||
23 | static int sx1_mmc_set_power(struct device *dev, int slot, int power_on, | 23 | static int mmc_set_power(struct device *dev, int slot, int power_on, |
24 | int vdd) | 24 | int vdd) |
25 | { | 25 | { |
26 | int err; | 26 | int err; |
27 | u8 dat = 0; | 27 | u8 dat = 0; |
28 | 28 | ||
29 | #ifdef CONFIG_MMC_DEBUG | ||
30 | dev_dbg(dev, "Set slot %d power: %s (vdd %d)\n", slot + 1, | ||
31 | power_on ? "on" : "off", vdd); | ||
32 | #endif | ||
33 | |||
34 | if (slot != 0) { | ||
35 | dev_err(dev, "No such slot %d\n", slot + 1); | ||
36 | return -ENODEV; | ||
37 | } | ||
38 | |||
39 | err = sx1_i2c_read_byte(SOFIA_I2C_ADDR, SOFIA_POWER1_REG, &dat); | 29 | err = sx1_i2c_read_byte(SOFIA_I2C_ADDR, SOFIA_POWER1_REG, &dat); |
40 | if (err < 0) | 30 | if (err < 0) |
41 | return err; | 31 | return err; |
@@ -48,19 +38,23 @@ static int sx1_mmc_set_power(struct device *dev, int slot, int power_on, | |||
48 | return sx1_i2c_write_byte(SOFIA_I2C_ADDR, SOFIA_POWER1_REG, dat); | 38 | return sx1_i2c_write_byte(SOFIA_I2C_ADDR, SOFIA_POWER1_REG, dat); |
49 | } | 39 | } |
50 | 40 | ||
51 | static struct omap_mmc_platform_data sx1_mmc_data = { | 41 | /* Cover switch is at OMAP_MPUIO(3) */ |
42 | static struct omap_mmc_platform_data mmc1_data = { | ||
52 | .nr_slots = 1, | 43 | .nr_slots = 1, |
53 | .slots[0] = { | 44 | .slots[0] = { |
54 | .set_power = sx1_mmc_set_power, | 45 | .set_power = mmc_set_power, |
55 | .ocr_mask = MMC_VDD_28_29 | MMC_VDD_30_31 | | 46 | .ocr_mask = MMC_VDD_28_29 | MMC_VDD_30_31 | |
56 | MMC_VDD_32_33 | MMC_VDD_33_34, | 47 | MMC_VDD_32_33 | MMC_VDD_33_34, |
57 | .name = "mmcblk", | 48 | .name = "mmcblk", |
58 | }, | 49 | }, |
59 | }; | 50 | }; |
60 | 51 | ||
52 | static struct omap_mmc_platform_data *mmc_data[OMAP15XX_NR_MMC]; | ||
53 | |||
61 | void __init sx1_mmc_init(void) | 54 | void __init sx1_mmc_init(void) |
62 | { | 55 | { |
63 | omap_set_mmc_info(1, &sx1_mmc_data); | 56 | mmc_data[0] = &mmc1_data; |
57 | omap1_init_mmc(mmc_data, OMAP15XX_NR_MMC); | ||
64 | } | 58 | } |
65 | 59 | ||
66 | #else | 60 | #else |
@@ -69,7 +63,4 @@ void __init sx1_mmc_init(void) | |||
69 | { | 63 | { |
70 | } | 64 | } |
71 | 65 | ||
72 | void sx1_mmc_slot_cover_handler(void *arg, int state) | ||
73 | { | ||
74 | } | ||
75 | #endif | 66 | #endif |
diff --git a/arch/arm/mach-omap1/clock.h b/arch/arm/mach-omap1/clock.h index 5635b511ab6f..c1dcdf18d8dd 100644 --- a/arch/arm/mach-omap1/clock.h +++ b/arch/arm/mach-omap1/clock.h | |||
@@ -705,7 +705,6 @@ static struct clk bclk_16xx = { | |||
705 | 705 | ||
706 | static struct clk mmc1_ck = { | 706 | static struct clk mmc1_ck = { |
707 | .name = "mmc_ck", | 707 | .name = "mmc_ck", |
708 | .id = 1, | ||
709 | /* Functional clock is direct from ULPD, interface clock is ARMPER */ | 708 | /* Functional clock is direct from ULPD, interface clock is ARMPER */ |
710 | .parent = &armper_ck.clk, | 709 | .parent = &armper_ck.clk, |
711 | .rate = 48000000, | 710 | .rate = 48000000, |
@@ -720,7 +719,7 @@ static struct clk mmc1_ck = { | |||
720 | 719 | ||
721 | static struct clk mmc2_ck = { | 720 | static struct clk mmc2_ck = { |
722 | .name = "mmc_ck", | 721 | .name = "mmc_ck", |
723 | .id = 2, | 722 | .id = 1, |
724 | /* Functional clock is direct from ULPD, interface clock is ARMPER */ | 723 | /* Functional clock is direct from ULPD, interface clock is ARMPER */ |
725 | .parent = &armper_ck.clk, | 724 | .parent = &armper_ck.clk, |
726 | .rate = 48000000, | 725 | .rate = 48000000, |
diff --git a/arch/arm/mach-omap1/devices.c b/arch/arm/mach-omap1/devices.c index e382b438c64e..024dab13d4b4 100644 --- a/arch/arm/mach-omap1/devices.c +++ b/arch/arm/mach-omap1/devices.c | |||
@@ -22,6 +22,7 @@ | |||
22 | #include <mach/board.h> | 22 | #include <mach/board.h> |
23 | #include <mach/mux.h> | 23 | #include <mach/mux.h> |
24 | #include <mach/gpio.h> | 24 | #include <mach/gpio.h> |
25 | #include <mach/mmc.h> | ||
25 | 26 | ||
26 | /*-------------------------------------------------------------------------*/ | 27 | /*-------------------------------------------------------------------------*/ |
27 | 28 | ||
@@ -99,6 +100,95 @@ static inline void omap_init_mbox(void) | |||
99 | static inline void omap_init_mbox(void) { } | 100 | static inline void omap_init_mbox(void) { } |
100 | #endif | 101 | #endif |
101 | 102 | ||
103 | /*-------------------------------------------------------------------------*/ | ||
104 | |||
105 | #if defined(CONFIG_MMC_OMAP) || defined(CONFIG_MMC_OMAP_MODULE) | ||
106 | |||
107 | static inline void omap1_mmc_mux(struct omap_mmc_platform_data *mmc_controller, | ||
108 | int controller_nr) | ||
109 | { | ||
110 | if (controller_nr == 0) { | ||
111 | omap_cfg_reg(MMC_CMD); | ||
112 | omap_cfg_reg(MMC_CLK); | ||
113 | omap_cfg_reg(MMC_DAT0); | ||
114 | if (cpu_is_omap1710()) { | ||
115 | omap_cfg_reg(M15_1710_MMC_CLKI); | ||
116 | omap_cfg_reg(P19_1710_MMC_CMDDIR); | ||
117 | omap_cfg_reg(P20_1710_MMC_DATDIR0); | ||
118 | } | ||
119 | if (mmc_controller->slots[0].wire4) { | ||
120 | omap_cfg_reg(MMC_DAT1); | ||
121 | /* NOTE: DAT2 can be on W10 (here) or M15 */ | ||
122 | if (!mmc_controller->slots[0].nomux) | ||
123 | omap_cfg_reg(MMC_DAT2); | ||
124 | omap_cfg_reg(MMC_DAT3); | ||
125 | } | ||
126 | } | ||
127 | |||
128 | /* Block 2 is on newer chips, and has many pinout options */ | ||
129 | if (cpu_is_omap16xx() && controller_nr == 1) { | ||
130 | if (!mmc_controller->slots[1].nomux) { | ||
131 | omap_cfg_reg(Y8_1610_MMC2_CMD); | ||
132 | omap_cfg_reg(Y10_1610_MMC2_CLK); | ||
133 | omap_cfg_reg(R18_1610_MMC2_CLKIN); | ||
134 | omap_cfg_reg(W8_1610_MMC2_DAT0); | ||
135 | if (mmc_controller->slots[1].wire4) { | ||
136 | omap_cfg_reg(V8_1610_MMC2_DAT1); | ||
137 | omap_cfg_reg(W15_1610_MMC2_DAT2); | ||
138 | omap_cfg_reg(R10_1610_MMC2_DAT3); | ||
139 | } | ||
140 | |||
141 | /* These are needed for the level shifter */ | ||
142 | omap_cfg_reg(V9_1610_MMC2_CMDDIR); | ||
143 | omap_cfg_reg(V5_1610_MMC2_DATDIR0); | ||
144 | omap_cfg_reg(W19_1610_MMC2_DATDIR1); | ||
145 | } | ||
146 | |||
147 | /* Feedback clock must be set on OMAP-1710 MMC2 */ | ||
148 | if (cpu_is_omap1710()) | ||
149 | omap_writel(omap_readl(MOD_CONF_CTRL_1) | (1 << 24), | ||
150 | MOD_CONF_CTRL_1); | ||
151 | } | ||
152 | } | ||
153 | |||
154 | void __init omap1_init_mmc(struct omap_mmc_platform_data **mmc_data, | ||
155 | int nr_controllers) | ||
156 | { | ||
157 | int i; | ||
158 | |||
159 | for (i = 0; i < nr_controllers; i++) { | ||
160 | unsigned long base, size; | ||
161 | unsigned int irq = 0; | ||
162 | |||
163 | if (!mmc_data[i]) | ||
164 | continue; | ||
165 | |||
166 | omap1_mmc_mux(mmc_data[i], i); | ||
167 | |||
168 | switch (i) { | ||
169 | case 0: | ||
170 | base = OMAP1_MMC1_BASE; | ||
171 | irq = INT_MMC; | ||
172 | break; | ||
173 | case 1: | ||
174 | if (!cpu_is_omap16xx()) | ||
175 | return; | ||
176 | base = OMAP1_MMC2_BASE; | ||
177 | irq = INT_1610_MMC2; | ||
178 | break; | ||
179 | default: | ||
180 | continue; | ||
181 | } | ||
182 | size = OMAP1_MMC_SIZE; | ||
183 | |||
184 | omap_mmc_add(i, base, size, irq, mmc_data[i]); | ||
185 | }; | ||
186 | } | ||
187 | |||
188 | #endif | ||
189 | |||
190 | /*-------------------------------------------------------------------------*/ | ||
191 | |||
102 | #if defined(CONFIG_OMAP_STI) | 192 | #if defined(CONFIG_OMAP_STI) |
103 | 193 | ||
104 | #define OMAP1_STI_BASE 0xfffea000 | 194 | #define OMAP1_STI_BASE 0xfffea000 |