aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-omap1
diff options
context:
space:
mode:
authorFelipe Balbi <felipe.lima@indt.org.br>2007-11-26 23:01:45 -0500
committerTony Lindgren <tony@atomide.com>2008-02-08 13:38:01 -0500
commit138ab9f8321f67c71984ca43222efa71b0a0a0a9 (patch)
tree57e8bcabfb647fd2ecad10d3641ef2041857ff09 /arch/arm/mach-omap1
parent6e2d4107245cc0411959e91d7a1613e15097f117 (diff)
ARM: OMAP1: Make omap1 use MMC multislot structures
Make omap1 use new MMC multislot structures. The related MMC patches will be sent separately. Signed-off-by: Felipe Balbi <felipe.lima@indt.org.br> Signed-off-by: Anderson Briglia <anderson.briglia@indt.org.br> Signed-off-by: Carlos Eduardo Aguiar <carlos.aguiar@indt.org.br> Signed-off-by: David Cohen <david.cohen@indt.org.br> Signed-off-by: Eduardo Valentin <eduardo.valentin@indt.org.br> Signed-off-by: Tony Lindgren <tony@atomide.com>
Diffstat (limited to 'arch/arm/mach-omap1')
-rw-r--r--arch/arm/mach-omap1/Makefile4
-rw-r--r--arch/arm/mach-omap1/board-h2-mmc.c110
-rw-r--r--arch/arm/mach-omap1/board-h2.c10
-rw-r--r--arch/arm/mach-omap1/board-h3-mmc.c114
-rw-r--r--arch/arm/mach-omap1/board-h3.c22
5 files changed, 249 insertions, 11 deletions
diff --git a/arch/arm/mach-omap1/Makefile b/arch/arm/mach-omap1/Makefile
index 391b6f4827f6..416a778611b4 100644
--- a/arch/arm/mach-omap1/Makefile
+++ b/arch/arm/mach-omap1/Makefile
@@ -13,13 +13,13 @@ obj-$(CONFIG_PM) += pm.o sleep.o
13led-y := leds.o 13led-y := leds.o
14 14
15# Specific board support 15# Specific board support
16obj-$(CONFIG_MACH_OMAP_H2) += board-h2.o 16obj-$(CONFIG_MACH_OMAP_H2) += board-h2.o board-h2-mmc.o
17obj-$(CONFIG_MACH_OMAP_INNOVATOR) += board-innovator.o 17obj-$(CONFIG_MACH_OMAP_INNOVATOR) += board-innovator.o
18obj-$(CONFIG_MACH_OMAP_GENERIC) += board-generic.o 18obj-$(CONFIG_MACH_OMAP_GENERIC) += board-generic.o
19obj-$(CONFIG_MACH_OMAP_PERSEUS2) += board-perseus2.o 19obj-$(CONFIG_MACH_OMAP_PERSEUS2) += board-perseus2.o
20obj-$(CONFIG_MACH_OMAP_FSAMPLE) += board-fsample.o 20obj-$(CONFIG_MACH_OMAP_FSAMPLE) += board-fsample.o
21obj-$(CONFIG_MACH_OMAP_OSK) += board-osk.o 21obj-$(CONFIG_MACH_OMAP_OSK) += board-osk.o
22obj-$(CONFIG_MACH_OMAP_H3) += board-h3.o 22obj-$(CONFIG_MACH_OMAP_H3) += board-h3.o board-h3-mmc.o
23obj-$(CONFIG_MACH_VOICEBLUE) += board-voiceblue.o 23obj-$(CONFIG_MACH_VOICEBLUE) += board-voiceblue.o
24obj-$(CONFIG_MACH_OMAP_PALMTE) += board-palmte.o 24obj-$(CONFIG_MACH_OMAP_PALMTE) += board-palmte.o
25obj-$(CONFIG_MACH_OMAP_PALMZ71) += board-palmz71.o 25obj-$(CONFIG_MACH_OMAP_PALMZ71) += board-palmz71.o
diff --git a/arch/arm/mach-omap1/board-h2-mmc.c b/arch/arm/mach-omap1/board-h2-mmc.c
new file mode 100644
index 000000000000..6fdc78406b21
--- /dev/null
+++ b/arch/arm/mach-omap1/board-h2-mmc.c
@@ -0,0 +1,110 @@
1/*
2 * linux/arch/arm/mach-omap1/board-h2-mmc.c
3 *
4 * Copyright (C) 2007 Instituto Nokia de Tecnologia - INdT
5 * Author: Felipe Balbi <felipe.lima@indt.org.br>
6 *
7 * This code is based on linux/arch/arm/mach-omap2/board-n800-mmc.c, which is:
8 * Copyright (C) 2006 Nokia Corporation
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License version 2 as
12 * published by the Free Software Foundation.
13 */
14
15#include <asm/arch/mmc.h>
16#include <asm/arch/gpio.h>
17
18#ifdef CONFIG_MMC_OMAP
19static int slot_cover_open;
20static struct device *mmc_device;
21
22static int h2_mmc_set_power(struct device *dev, int slot, int power_on,
23 int vdd)
24{
25#ifdef CONFIG_MMC_DEBUG
26 dev_dbg(dev, "Set slot %d power: %s (vdd %d)\n", slot + 1,
27 power_on ? "on" : "off", vdd);
28#endif
29 if (slot != 0) {
30 dev_err(dev, "No such slot %d\n", slot + 1);
31 return -ENODEV;
32 }
33
34 return 0;
35}
36
37static int h2_mmc_set_bus_mode(struct device *dev, int slot, int bus_mode)
38{
39#ifdef CONFIG_MMC_DEBUG
40 dev_dbg(dev, "Set slot %d bus_mode %s\n", slot + 1,
41 bus_mode == MMC_BUSMODE_OPENDRAIN ? "open-drain" : "push-pull");
42#endif
43 if (slot != 0) {
44 dev_err(dev, "No such slot %d\n", slot + 1);
45 return -ENODEV;
46 }
47
48 return 0;
49}
50
51static int h2_mmc_get_cover_state(struct device *dev, int slot)
52{
53 BUG_ON(slot != 0);
54
55 return slot_cover_open;
56}
57
58void h2_mmc_slot_cover_handler(void *arg, int state)
59{
60 if (mmc_device == NULL)
61 return;
62
63 slot_cover_open = state;
64 omap_mmc_notify_cover_event(mmc_device, 0, state);
65}
66
67static int h2_mmc_late_init(struct device *dev)
68{
69 int ret = 0;
70
71 mmc_device = dev;
72
73 return ret;
74}
75
76static void h2_mmc_cleanup(struct device *dev)
77{
78}
79
80static struct omap_mmc_platform_data h2_mmc_data = {
81 .nr_slots = 1,
82 .switch_slot = NULL,
83 .init = h2_mmc_late_init,
84 .cleanup = h2_mmc_cleanup,
85 .slots[0] = {
86 .set_power = h2_mmc_set_power,
87 .set_bus_mode = h2_mmc_set_bus_mode,
88 .get_ro = NULL,
89 .get_cover_state = h2_mmc_get_cover_state,
90 .ocr_mask = MMC_VDD_28_29 | MMC_VDD_30_31 |
91 MMC_VDD_32_33 | MMC_VDD_33_34,
92 .name = "mmcblk",
93 },
94};
95
96void __init h2_mmc_init(void)
97{
98 omap_set_mmc_info(1, &h2_mmc_data);
99}
100
101#else
102
103void __init h2_mmc_init(void)
104{
105}
106
107void h2_mmc_slot_cover_handler(void *arg, int state)
108{
109}
110#endif
diff --git a/arch/arm/mach-omap1/board-h2.c b/arch/arm/mach-omap1/board-h2.c
index 18899d74d4c0..ab6e68b00064 100644
--- a/arch/arm/mach-omap1/board-h2.c
+++ b/arch/arm/mach-omap1/board-h2.c
@@ -389,15 +389,14 @@ static struct omap_usb_config h2_usb_config __initdata = {
389}; 389};
390 390
391static struct omap_mmc_config h2_mmc_config __initdata = { 391static struct omap_mmc_config h2_mmc_config __initdata = {
392 .mmc [0] = { 392 .mmc[0] = {
393 .enabled = 1, 393 .enabled = 1,
394 .wire4 = 1, 394 .wire4 = 1,
395 .wp_pin = OMAP_MPUIO(3),
396 .power_pin = -1, /* tps65010 gpio3 */
397 .switch_pin = OMAP_MPUIO(1),
398 }, 395 },
399}; 396};
400 397
398extern struct omap_mmc_platform_data h2_mmc_data;
399
401static struct omap_uart_config h2_uart_config __initdata = { 400static struct omap_uart_config h2_uart_config __initdata = {
402 .enabled_uarts = ((1 << 0) | (1 << 1) | (1 << 2)), 401 .enabled_uarts = ((1 << 0) | (1 << 1) | (1 << 2)),
403}; 402};
@@ -459,6 +458,7 @@ static void __init h2_init(void)
459 omap_board_config = h2_config; 458 omap_board_config = h2_config;
460 omap_board_config_size = ARRAY_SIZE(h2_config); 459 omap_board_config_size = ARRAY_SIZE(h2_config);
461 omap_serial_init(); 460 omap_serial_init();
461 h2_mmc_init();
462 462
463 /* irq for tps65010 chip */ 463 /* irq for tps65010 chip */
464 omap_cfg_reg(W4_GPIO58); 464 omap_cfg_reg(W4_GPIO58);
diff --git a/arch/arm/mach-omap1/board-h3-mmc.c b/arch/arm/mach-omap1/board-h3-mmc.c
new file mode 100644
index 000000000000..66ecc437928f
--- /dev/null
+++ b/arch/arm/mach-omap1/board-h3-mmc.c
@@ -0,0 +1,114 @@
1/*
2 * linux/arch/arm/mach-omap1/board-h3-mmc.c
3 *
4 * Copyright (C) 2007 Instituto Nokia de Tecnologia - INdT
5 * Author: Felipe Balbi <felipe.lima@indt.org.br>
6 *
7 * This code is based on linux/arch/arm/mach-omap2/board-n800-mmc.c, which is:
8 * Copyright (C) 2006 Nokia Corporation
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License version 2 as
12 * published by the Free Software Foundation.
13 */
14
15#include <asm/arch/mmc.h>
16#include <asm/arch/gpio.h>
17
18#ifdef CONFIG_MMC_OMAP
19static int slot_cover_open;
20static struct device *mmc_device;
21
22static int h3_mmc_set_power(struct device *dev, int slot, int power_on,
23 int vdd)
24{
25#ifdef CONFIG_MMC_DEBUG
26 dev_dbg(dev, "Set slot %d power: %s (vdd %d)\n", slot + 1,
27 power_on ? "on" : "off", vdd);
28#endif
29 if (slot != 0) {
30 dev_err(dev, "No such slot %d\n", slot + 1);
31 return -ENODEV;
32 }
33
34 return 0;
35}
36
37static int h3_mmc_set_bus_mode(struct device *dev, int slot, int bus_mode)
38{
39 int ret = 0;
40
41#ifdef CONFIG_MMC_DEBUG
42 dev_dbg(dev, "Set slot %d bus_mode %s\n", slot + 1,
43 bus_mode == MMC_BUSMODE_OPENDRAIN ? "open-drain" : "push-pull");
44#endif
45 if (slot != 0) {
46 dev_err(dev, "No such slot %d\n", slot + 1);
47 return -ENODEV;
48 }
49
50 /* Treated on upper level */
51
52 return bus_mode;
53}
54
55static int h3_mmc_get_cover_state(struct device *dev, int slot)
56{
57 BUG_ON(slot != 0);
58
59 return slot_cover_open;
60}
61
62void h3_mmc_slot_cover_handler(void *arg, int state)
63{
64 if (mmc_device == NULL)
65 return;
66
67 slot_cover_open = state;
68 omap_mmc_notify_cover_event(mmc_device, 0, state);
69}
70
71static int h3_mmc_late_init(struct device *dev)
72{
73 int ret = 0;
74
75 mmc_device = dev;
76
77 return ret;
78}
79
80static void h3_mmc_cleanup(struct device *dev)
81{
82}
83
84static struct omap_mmc_platform_data h3_mmc_data = {
85 .nr_slots = 1,
86 .switch_slot = NULL,
87 .init = h3_mmc_late_init,
88 .cleanup = h3_mmc_cleanup,
89 .slots[0] = {
90 .set_power = h3_mmc_set_power,
91 .set_bus_mode = h3_mmc_set_bus_mode,
92 .get_ro = NULL,
93 .get_cover_state = h3_mmc_get_cover_state,
94 .ocr_mask = MMC_VDD_28_29 | MMC_VDD_30_31 |
95 MMC_VDD_32_33 | MMC_VDD_33_34,
96 .name = "mmcblk",
97 },
98};
99
100void __init h3_mmc_init(void)
101{
102 omap_set_mmc_info(1, &h3_mmc_data);
103}
104
105#else
106
107void __init h3_mmc_init(void)
108{
109}
110
111void h3_mmc_slot_cover_handler(void *arg, int state)
112{
113}
114#endif
diff --git a/arch/arm/mach-omap1/board-h3.c b/arch/arm/mach-omap1/board-h3.c
index 67ae5035a7ef..f28f05d6760d 100644
--- a/arch/arm/mach-omap1/board-h3.c
+++ b/arch/arm/mach-omap1/board-h3.c
@@ -437,12 +437,13 @@ static struct omap_usb_config h3_usb_config __initdata = {
437 437
438static struct omap_mmc_config h3_mmc_config __initdata = { 438static struct omap_mmc_config h3_mmc_config __initdata = {
439 .mmc[0] = { 439 .mmc[0] = {
440 .enabled = 1, 440 .enabled = 1,
441 .power_pin = -1, /* tps65010 GPIO4 */ 441 .wire4 = 1,
442 .switch_pin = OMAP_MPUIO(1), 442 },
443 },
444}; 443};
445 444
445extern struct omap_mmc_platform_data h3_mmc_data;
446
446static struct omap_uart_config h3_uart_config __initdata = { 447static struct omap_uart_config h3_uart_config __initdata = {
447 .enabled_uarts = ((1 << 0) | (1 << 1) | (1 << 2)), 448 .enabled_uarts = ((1 << 0) | (1 << 1) | (1 << 2)),
448}; 449};
@@ -471,6 +472,18 @@ static struct i2c_board_info __initdata h3_i2c_board_info[] = {
471 */ 472 */
472}; 473};
473 474
475static struct omap_gpio_switch h3_gpio_switches[] __initdata = {
476 {
477 .name = "mmc_slot",
478 .gpio = OMAP_MPUIO(1),
479 .type = OMAP_GPIO_SWITCH_TYPE_COVER,
480 .debounce_rising = 100,
481 .debounce_falling = 0,
482 .notify = h3_mmc_slot_cover_handler,
483 .notify_data = NULL,
484 },
485};
486
474#define H3_NAND_RB_GPIO_PIN 10 487#define H3_NAND_RB_GPIO_PIN 10
475 488
476static int nand_dev_ready(struct omap_nand_platform_data *data) 489static int nand_dev_ready(struct omap_nand_platform_data *data)
@@ -504,6 +517,7 @@ static void __init h3_init(void)
504 omap_board_config = h3_config; 517 omap_board_config = h3_config;
505 omap_board_config_size = ARRAY_SIZE(h3_config); 518 omap_board_config_size = ARRAY_SIZE(h3_config);
506 omap_serial_init(); 519 omap_serial_init();
520 h3_mmc_init();
507 521
508 /* FIXME setup irq for tps65013 chip */ 522 /* FIXME setup irq for tps65013 chip */
509 i2c_register_board_info(1, h3_i2c_board_info, 523 i2c_register_board_info(1, h3_i2c_board_info,