aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTony Lindgren <tony@atomide.com>2005-09-08 18:07:38 -0400
committerRussell King <rmk+kernel@arm.linux.org.uk>2005-09-08 18:07:38 -0400
commit7c38cf021b42a4297bc8f860ab627734bdd6c8d1 (patch)
tree89c3b807ca90f5c7e5692ddbcd388511dc289530
parentd7b6b3589471c3856f1e6dc9c77abc4af962ffdb (diff)
[ARM] 2890/1: OMAP 1/4: Update omap1 specific files, take 2
Patch from Tony Lindgren This patch syncs the mainline kernel with linux-omap tree. The highlights of the patch are: - Convert more drivers to register resources in board-*.c to take advantage of the driver model by David Brownell and Ladislav Michl - Use set_irq_type() for GPIO interrupts instead of omap_set_gpio_edge_ctrl() by David Brownell - Add minimal support for handling optional add-on boards, such as OSK Mistral board with LCD and keypad, by David Brownell - Minimal support for loading functions to SRAM by Tony Lindgren - Wake up from serial port by muxing RX lines temporarily into GPIO interrupts by Tony Lindgren - 32KHz sched_clock by Tony Lindgren and Juha Yrjola Signed-off-by: Tony Lindgren <tony@atomide.com> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
-rw-r--r--arch/arm/mach-omap1/Kconfig8
-rw-r--r--arch/arm/mach-omap1/Makefile3
-rw-r--r--arch/arm/mach-omap1/board-generic.c38
-rw-r--r--arch/arm/mach-omap1/board-h2.c27
-rw-r--r--arch/arm/mach-omap1/board-h3.c17
-rw-r--r--arch/arm/mach-omap1/board-innovator.c13
-rw-r--r--arch/arm/mach-omap1/board-netstar.c9
-rw-r--r--arch/arm/mach-omap1/board-osk.c124
-rw-r--r--arch/arm/mach-omap1/board-perseus2.c5
-rw-r--r--arch/arm/mach-omap1/board-voiceblue.c62
-rw-r--r--arch/arm/mach-omap1/devices.c351
-rw-r--r--arch/arm/mach-omap1/fpga.c4
-rw-r--r--arch/arm/mach-omap1/io.c30
-rw-r--r--arch/arm/mach-omap1/irq.c2
-rw-r--r--arch/arm/mach-omap1/leds-h2p2-debug.c3
-rw-r--r--arch/arm/mach-omap1/leds-innovator.c2
-rw-r--r--arch/arm/mach-omap1/leds-osk.c8
-rw-r--r--arch/arm/mach-omap1/leds.c12
-rw-r--r--arch/arm/mach-omap1/serial.c84
-rw-r--r--arch/arm/mach-omap1/time.c40
20 files changed, 743 insertions, 99 deletions
diff --git a/arch/arm/mach-omap1/Kconfig b/arch/arm/mach-omap1/Kconfig
index 7408ac94f771..27fc2e8e5fca 100644
--- a/arch/arm/mach-omap1/Kconfig
+++ b/arch/arm/mach-omap1/Kconfig
@@ -47,6 +47,14 @@ config MACH_OMAP_OSK
47 TI OMAP 5912 OSK (OMAP Starter Kit) board support. Say Y here 47 TI OMAP 5912 OSK (OMAP Starter Kit) board support. Say Y here
48 if you have such a board. 48 if you have such a board.
49 49
50config OMAP_OSK_MISTRAL
51 bool "Mistral QVGA board Support"
52 depends on MACH_OMAP_OSK
53 help
54 The OSK supports an optional add-on board with a Quarter-VGA
55 touchscreen, PDA-ish buttons, a resume button, bicolor LED,
56 and camera connector. Say Y here if you have this board.
57
50config MACH_OMAP_PERSEUS2 58config MACH_OMAP_PERSEUS2
51 bool "TI Perseus2" 59 bool "TI Perseus2"
52 depends on ARCH_OMAP1 && ARCH_OMAP730 60 depends on ARCH_OMAP1 && ARCH_OMAP730
diff --git a/arch/arm/mach-omap1/Makefile b/arch/arm/mach-omap1/Makefile
index d386fd913f0c..181a93deaaee 100644
--- a/arch/arm/mach-omap1/Makefile
+++ b/arch/arm/mach-omap1/Makefile
@@ -3,7 +3,7 @@
3# 3#
4 4
5# Common support 5# Common support
6obj-y := io.o id.o irq.o time.o serial.o 6obj-y := io.o id.o irq.o time.o serial.o devices.o
7led-y := leds.o 7led-y := leds.o
8 8
9# Specific board support 9# Specific board support
@@ -23,6 +23,7 @@ endif
23 23
24# LEDs support 24# LEDs support
25led-$(CONFIG_MACH_OMAP_H2) += leds-h2p2-debug.o 25led-$(CONFIG_MACH_OMAP_H2) += leds-h2p2-debug.o
26led-$(CONFIG_MACH_OMAP_H3) += leds-h2p2-debug.o
26led-$(CONFIG_MACH_OMAP_INNOVATOR) += leds-innovator.o 27led-$(CONFIG_MACH_OMAP_INNOVATOR) += leds-innovator.o
27led-$(CONFIG_MACH_OMAP_PERSEUS2) += leds-h2p2-debug.o 28led-$(CONFIG_MACH_OMAP_PERSEUS2) += leds-h2p2-debug.o
28led-$(CONFIG_MACH_OMAP_OSK) += leds-osk.o 29led-$(CONFIG_MACH_OMAP_OSK) += leds-osk.o
diff --git a/arch/arm/mach-omap1/board-generic.c b/arch/arm/mach-omap1/board-generic.c
index 122796ebe8f5..c209c7172a9a 100644
--- a/arch/arm/mach-omap1/board-generic.c
+++ b/arch/arm/mach-omap1/board-generic.c
@@ -48,19 +48,43 @@ static struct omap_usb_config generic1510_usb_config __initdata = {
48 48
49#if defined(CONFIG_ARCH_OMAP16XX) 49#if defined(CONFIG_ARCH_OMAP16XX)
50static struct omap_usb_config generic1610_usb_config __initdata = { 50static struct omap_usb_config generic1610_usb_config __initdata = {
51#ifdef CONFIG_USB_OTG
52 .otg = 1,
53#endif
51 .register_host = 1, 54 .register_host = 1,
52 .register_dev = 1, 55 .register_dev = 1,
53 .hmc_mode = 16, 56 .hmc_mode = 16,
54 .pins[0] = 6, 57 .pins[0] = 6,
55}; 58};
59
60static struct omap_mmc_config generic_mmc_config __initdata = {
61 .mmc [0] = {
62 .enabled = 0,
63 .wire4 = 0,
64 .wp_pin = -1,
65 .power_pin = -1,
66 .switch_pin = -1,
67 },
68 .mmc [1] = {
69 .enabled = 0,
70 .wire4 = 0,
71 .wp_pin = -1,
72 .power_pin = -1,
73 .switch_pin = -1,
74 },
75};
76
56#endif 77#endif
57 78
58static struct omap_board_config_kernel generic_config[] = { 79static struct omap_board_config_kernel generic_config[] = {
59 { OMAP_TAG_USB, NULL }, 80 { OMAP_TAG_USB, NULL },
81 { OMAP_TAG_MMC, &generic_mmc_config },
60}; 82};
61 83
62static void __init omap_generic_init(void) 84static void __init omap_generic_init(void)
63{ 85{
86 const struct omap_uart_config *uart_conf;
87
64 /* 88 /*
65 * Make sure the serial ports are muxed on at this point. 89 * Make sure the serial ports are muxed on at this point.
66 * You have to mux them off in device drivers later on 90 * You have to mux them off in device drivers later on
@@ -76,6 +100,18 @@ static void __init omap_generic_init(void)
76 generic_config[0].data = &generic1610_usb_config; 100 generic_config[0].data = &generic1610_usb_config;
77 } 101 }
78#endif 102#endif
103
104 uart_conf = omap_get_config(OMAP_TAG_UART, struct omap_uart_config);
105 if (uart_conf != NULL) {
106 unsigned int enabled_ports, i;
107
108 enabled_ports = uart_conf->enabled_uarts;
109 for (i = 0; i < 3; i++) {
110 if (!(enabled_ports & (1 << i)))
111 generic_serial_ports[i] = 0;
112 }
113 }
114
79 omap_board_config = generic_config; 115 omap_board_config = generic_config;
80 omap_board_config_size = ARRAY_SIZE(generic_config); 116 omap_board_config_size = ARRAY_SIZE(generic_config);
81 omap_serial_init(generic_serial_ports); 117 omap_serial_init(generic_serial_ports);
@@ -83,7 +119,7 @@ static void __init omap_generic_init(void)
83 119
84static void __init omap_generic_map_io(void) 120static void __init omap_generic_map_io(void)
85{ 121{
86 omap_map_common_io() 122 omap_map_common_io();
87} 123}
88 124
89MACHINE_START(OMAP_GENERIC, "Generic OMAP1510/1610/1710") 125MACHINE_START(OMAP_GENERIC, "Generic OMAP1510/1610/1710")
diff --git a/arch/arm/mach-omap1/board-h2.c b/arch/arm/mach-omap1/board-h2.c
index f4983ee95ab4..d46a70063b0c 100644
--- a/arch/arm/mach-omap1/board-h2.c
+++ b/arch/arm/mach-omap1/board-h2.c
@@ -33,6 +33,7 @@
33#include <asm/mach/map.h> 33#include <asm/mach/map.h>
34 34
35#include <asm/arch/gpio.h> 35#include <asm/arch/gpio.h>
36#include <asm/arch/mux.h>
36#include <asm/arch/tc.h> 37#include <asm/arch/tc.h>
37#include <asm/arch/usb.h> 38#include <asm/arch/usb.h>
38#include <asm/arch/common.h> 39#include <asm/arch/common.h>
@@ -80,8 +81,7 @@ static struct flash_platform_data h2_flash_data = {
80}; 81};
81 82
82static struct resource h2_flash_resource = { 83static struct resource h2_flash_resource = {
83 .start = OMAP_CS2B_PHYS, 84 /* This is on CS3, wherever it's mapped */
84 .end = OMAP_CS2B_PHYS + OMAP_CS2B_SIZE - 1,
85 .flags = IORESOURCE_MEM, 85 .flags = IORESOURCE_MEM,
86}; 86};
87 87
@@ -126,10 +126,9 @@ static void __init h2_init_smc91x(void)
126 printk("Error requesting gpio 0 for smc91x irq\n"); 126 printk("Error requesting gpio 0 for smc91x irq\n");
127 return; 127 return;
128 } 128 }
129 omap_set_gpio_edge_ctrl(0, OMAP_GPIO_FALLING_EDGE);
130} 129}
131 130
132void h2_init_irq(void) 131static void __init h2_init_irq(void)
133{ 132{
134 omap_init_irq(); 133 omap_init_irq();
135 omap_gpio_init(); 134 omap_gpio_init();
@@ -152,9 +151,13 @@ static struct omap_usb_config h2_usb_config __initdata = {
152}; 151};
153 152
154static struct omap_mmc_config h2_mmc_config __initdata = { 153static struct omap_mmc_config h2_mmc_config __initdata = {
155 .mmc_blocks = 1, 154 .mmc [0] = {
156 .mmc1_power_pin = -1, /* tps65010 gpio3 */ 155 .enabled = 1,
157 .mmc1_switch_pin = OMAP_MPUIO(1), 156 .wire4 = 1,
157 .wp_pin = OMAP_MPUIO(3),
158 .power_pin = -1, /* tps65010 gpio3 */
159 .switch_pin = OMAP_MPUIO(1),
160 },
158}; 161};
159 162
160static struct omap_board_config_kernel h2_config[] = { 163static struct omap_board_config_kernel h2_config[] = {
@@ -164,6 +167,16 @@ static struct omap_board_config_kernel h2_config[] = {
164 167
165static void __init h2_init(void) 168static void __init h2_init(void)
166{ 169{
170 /* NOTE: revC boards support NAND-boot, which can put NOR on CS2B
171 * and NAND (either 16bit or 8bit) on CS3.
172 */
173 h2_flash_resource.end = h2_flash_resource.start = omap_cs3_phys();
174 h2_flash_resource.end += SZ_32M - 1;
175
176 /* MMC: card detect and WP */
177 // omap_cfg_reg(U19_ARMIO1); /* CD */
178 omap_cfg_reg(BALLOUT_V8_ARMIO3); /* WP */
179
167 platform_add_devices(h2_devices, ARRAY_SIZE(h2_devices)); 180 platform_add_devices(h2_devices, ARRAY_SIZE(h2_devices));
168 omap_board_config = h2_config; 181 omap_board_config = h2_config;
169 omap_board_config_size = ARRAY_SIZE(h2_config); 182 omap_board_config_size = ARRAY_SIZE(h2_config);
diff --git a/arch/arm/mach-omap1/board-h3.c b/arch/arm/mach-omap1/board-h3.c
index 7cd419d61b40..2798613696fa 100644
--- a/arch/arm/mach-omap1/board-h3.c
+++ b/arch/arm/mach-omap1/board-h3.c
@@ -82,8 +82,7 @@ static struct flash_platform_data h3_flash_data = {
82}; 82};
83 83
84static struct resource h3_flash_resource = { 84static struct resource h3_flash_resource = {
85 .start = OMAP_CS2B_PHYS, 85 /* This is on CS3, wherever it's mapped */
86 .end = OMAP_CS2B_PHYS + OMAP_CS2B_SIZE - 1,
87 .flags = IORESOURCE_MEM, 86 .flags = IORESOURCE_MEM,
88}; 87};
89 88
@@ -161,13 +160,26 @@ static struct omap_usb_config h3_usb_config __initdata = {
161 .pins[1] = 3, 160 .pins[1] = 3,
162}; 161};
163 162
163static struct omap_mmc_config h3_mmc_config __initdata = {
164 .mmc[0] = {
165 .enabled = 1,
166 .power_pin = -1, /* tps65010 GPIO4 */
167 .switch_pin = OMAP_MPUIO(1),
168 },
169};
170
164static struct omap_board_config_kernel h3_config[] = { 171static struct omap_board_config_kernel h3_config[] = {
165 { OMAP_TAG_USB, &h3_usb_config }, 172 { OMAP_TAG_USB, &h3_usb_config },
173 { OMAP_TAG_MMC, &h3_mmc_config },
166}; 174};
167 175
168static void __init h3_init(void) 176static void __init h3_init(void)
169{ 177{
178 h3_flash_resource.end = h3_flash_resource.start = omap_cs3_phys();
179 h3_flash_resource.end += OMAP_CS3_SIZE - 1;
170 (void) platform_add_devices(devices, ARRAY_SIZE(devices)); 180 (void) platform_add_devices(devices, ARRAY_SIZE(devices));
181 omap_board_config = h3_config;
182 omap_board_config_size = ARRAY_SIZE(h3_config);
171} 183}
172 184
173static void __init h3_init_smc91x(void) 185static void __init h3_init_smc91x(void)
@@ -177,7 +189,6 @@ static void __init h3_init_smc91x(void)
177 printk("Error requesting gpio 40 for smc91x irq\n"); 189 printk("Error requesting gpio 40 for smc91x irq\n");
178 return; 190 return;
179 } 191 }
180 omap_set_gpio_edge_ctrl(40, OMAP_GPIO_FALLING_EDGE);
181} 192}
182 193
183void h3_init_irq(void) 194void h3_init_irq(void)
diff --git a/arch/arm/mach-omap1/board-innovator.c b/arch/arm/mach-omap1/board-innovator.c
index 91de60a91ef8..df0312b596e4 100644
--- a/arch/arm/mach-omap1/board-innovator.c
+++ b/arch/arm/mach-omap1/board-innovator.c
@@ -29,6 +29,7 @@
29#include <asm/mach/flash.h> 29#include <asm/mach/flash.h>
30#include <asm/mach/map.h> 30#include <asm/mach/map.h>
31 31
32#include <asm/arch/mux.h>
32#include <asm/arch/fpga.h> 33#include <asm/arch/fpga.h>
33#include <asm/arch/gpio.h> 34#include <asm/arch/gpio.h>
34#include <asm/arch/tc.h> 35#include <asm/arch/tc.h>
@@ -173,7 +174,6 @@ static void __init innovator_init_smc91x(void)
173 printk("Error requesting gpio 0 for smc91x irq\n"); 174 printk("Error requesting gpio 0 for smc91x irq\n");
174 return; 175 return;
175 } 176 }
176 omap_set_gpio_edge_ctrl(0, OMAP_GPIO_RISING_EDGE);
177 } 177 }
178} 178}
179 179
@@ -220,8 +220,19 @@ static struct omap_usb_config h2_usb_config __initdata = {
220}; 220};
221#endif 221#endif
222 222
223static struct omap_mmc_config innovator_mmc_config __initdata = {
224 .mmc [0] = {
225 .enabled = 1,
226 .wire4 = 1,
227 .wp_pin = OMAP_MPUIO(3),
228 .power_pin = -1, /* FPGA F3 UIO42 */
229 .switch_pin = -1, /* FPGA F4 UIO43 */
230 },
231};
232
223static struct omap_board_config_kernel innovator_config[] = { 233static struct omap_board_config_kernel innovator_config[] = {
224 { OMAP_TAG_USB, NULL }, 234 { OMAP_TAG_USB, NULL },
235 { OMAP_TAG_MMC, &innovator_mmc_config },
225}; 236};
226 237
227static void __init innovator_init(void) 238static void __init innovator_init(void)
diff --git a/arch/arm/mach-omap1/board-netstar.c b/arch/arm/mach-omap1/board-netstar.c
index 6750b2014092..d904e643f5ec 100644
--- a/arch/arm/mach-omap1/board-netstar.c
+++ b/arch/arm/mach-omap1/board-netstar.c
@@ -75,16 +75,15 @@ static void __init netstar_init(void)
75 mdelay(50); /* 50ms until PHY ready */ 75 mdelay(50); /* 50ms until PHY ready */
76 /* smc91x interrupt pin */ 76 /* smc91x interrupt pin */
77 omap_request_gpio(8); 77 omap_request_gpio(8);
78 omap_set_gpio_edge_ctrl(8, OMAP_GPIO_RISING_EDGE);
79 78
80 omap_request_gpio(12); 79 omap_request_gpio(12);
81 omap_request_gpio(13); 80 omap_request_gpio(13);
82 omap_request_gpio(14); 81 omap_request_gpio(14);
83 omap_request_gpio(15); 82 omap_request_gpio(15);
84 omap_set_gpio_edge_ctrl(12, OMAP_GPIO_FALLING_EDGE); 83 set_irq_type(OMAP_GPIO_IRQ(12), IRQT_FALLING);
85 omap_set_gpio_edge_ctrl(13, OMAP_GPIO_FALLING_EDGE); 84 set_irq_type(OMAP_GPIO_IRQ(13), IRQT_FALLING);
86 omap_set_gpio_edge_ctrl(14, OMAP_GPIO_FALLING_EDGE); 85 set_irq_type(OMAP_GPIO_IRQ(14), IRQT_FALLING);
87 omap_set_gpio_edge_ctrl(15, OMAP_GPIO_FALLING_EDGE); 86 set_irq_type(OMAP_GPIO_IRQ(15), IRQT_FALLING);
88 87
89 platform_add_devices(netstar_devices, ARRAY_SIZE(netstar_devices)); 88 platform_add_devices(netstar_devices, ARRAY_SIZE(netstar_devices));
90 89
diff --git a/arch/arm/mach-omap1/board-osk.c b/arch/arm/mach-omap1/board-osk.c
index 6844e536c698..21103df50415 100644
--- a/arch/arm/mach-omap1/board-osk.c
+++ b/arch/arm/mach-omap1/board-osk.c
@@ -29,11 +29,16 @@
29#include <linux/kernel.h> 29#include <linux/kernel.h>
30#include <linux/init.h> 30#include <linux/init.h>
31#include <linux/device.h> 31#include <linux/device.h>
32#include <linux/interrupt.h>
33
34#include <linux/mtd/mtd.h>
35#include <linux/mtd/partitions.h>
32 36
33#include <asm/hardware.h> 37#include <asm/hardware.h>
34#include <asm/mach-types.h> 38#include <asm/mach-types.h>
35#include <asm/mach/arch.h> 39#include <asm/mach/arch.h>
36#include <asm/mach/map.h> 40#include <asm/mach/map.h>
41#include <asm/mach/flash.h>
37 42
38#include <asm/arch/gpio.h> 43#include <asm/arch/gpio.h>
39#include <asm/arch/usb.h> 44#include <asm/arch/usb.h>
@@ -41,12 +46,56 @@
41#include <asm/arch/tc.h> 46#include <asm/arch/tc.h>
42#include <asm/arch/common.h> 47#include <asm/arch/common.h>
43 48
44static struct map_desc osk5912_io_desc[] __initdata = { 49static int __initdata osk_serial_ports[OMAP_MAX_NR_PORTS] = {1, 0, 0};
45{ OMAP_OSK_NOR_FLASH_BASE, OMAP_OSK_NOR_FLASH_START, OMAP_OSK_NOR_FLASH_SIZE, 50
46 MT_DEVICE }, 51static struct mtd_partition osk_partitions[] = {
52 /* bootloader (U-Boot, etc) in first sector */
53 {
54 .name = "bootloader",
55 .offset = 0,
56 .size = SZ_128K,
57 .mask_flags = MTD_WRITEABLE, /* force read-only */
58 },
59 /* bootloader params in the next sector */
60 {
61 .name = "params",
62 .offset = MTDPART_OFS_APPEND,
63 .size = SZ_128K,
64 .mask_flags = 0,
65 }, {
66 .name = "kernel",
67 .offset = MTDPART_OFS_APPEND,
68 .size = SZ_2M,
69 .mask_flags = 0
70 }, {
71 .name = "filesystem",
72 .offset = MTDPART_OFS_APPEND,
73 .size = MTDPART_SIZ_FULL,
74 .mask_flags = 0
75 }
47}; 76};
48 77
49static int __initdata osk_serial_ports[OMAP_MAX_NR_PORTS] = {1, 0, 0}; 78static struct flash_platform_data osk_flash_data = {
79 .map_name = "cfi_probe",
80 .width = 2,
81 .parts = osk_partitions,
82 .nr_parts = ARRAY_SIZE(osk_partitions),
83};
84
85static struct resource osk_flash_resource = {
86 /* this is on CS3, wherever it's mapped */
87 .flags = IORESOURCE_MEM,
88};
89
90static struct platform_device osk5912_flash_device = {
91 .name = "omapflash",
92 .id = 0,
93 .dev = {
94 .platform_data = &osk_flash_data,
95 },
96 .num_resources = 1,
97 .resource = &osk_flash_resource,
98};
50 99
51static struct resource osk5912_smc91x_resources[] = { 100static struct resource osk5912_smc91x_resources[] = {
52 [0] = { 101 [0] = {
@@ -86,9 +135,16 @@ static struct platform_device osk5912_cf_device = {
86 .resource = osk5912_cf_resources, 135 .resource = osk5912_cf_resources,
87}; 136};
88 137
138static struct platform_device osk5912_mcbsp1_device = {
139 .name = "omap_mcbsp",
140 .id = 1,
141};
142
89static struct platform_device *osk5912_devices[] __initdata = { 143static struct platform_device *osk5912_devices[] __initdata = {
144 &osk5912_flash_device,
90 &osk5912_smc91x_device, 145 &osk5912_smc91x_device,
91 &osk5912_cf_device, 146 &osk5912_cf_device,
147 &osk5912_mcbsp1_device,
92}; 148};
93 149
94static void __init osk_init_smc91x(void) 150static void __init osk_init_smc91x(void)
@@ -97,7 +153,6 @@ static void __init osk_init_smc91x(void)
97 printk("Error requesting gpio 0 for smc91x irq\n"); 153 printk("Error requesting gpio 0 for smc91x irq\n");
98 return; 154 return;
99 } 155 }
100 omap_set_gpio_edge_ctrl(0, OMAP_GPIO_RISING_EDGE);
101 156
102 /* Check EMIFS wait states to fix errors with SMC_GET_PKT_HDR */ 157 /* Check EMIFS wait states to fix errors with SMC_GET_PKT_HDR */
103 EMIFS_CCS(1) |= 0x2; 158 EMIFS_CCS(1) |= 0x2;
@@ -110,11 +165,11 @@ static void __init osk_init_cf(void)
110 printk("Error requesting gpio 62 for CF irq\n"); 165 printk("Error requesting gpio 62 for CF irq\n");
111 return; 166 return;
112 } 167 }
113 /* it's really active-low */ 168 /* the CF I/O IRQ is really active-low */
114 omap_set_gpio_edge_ctrl(62, OMAP_GPIO_FALLING_EDGE); 169 set_irq_type(OMAP_GPIO_IRQ(62), IRQT_FALLING);
115} 170}
116 171
117void osk_init_irq(void) 172static void __init osk_init_irq(void)
118{ 173{
119 omap_init_irq(); 174 omap_init_irq();
120 omap_gpio_init(); 175 omap_gpio_init();
@@ -142,18 +197,69 @@ static struct omap_board_config_kernel osk_config[] = {
142 { OMAP_TAG_USB, &osk_usb_config }, 197 { OMAP_TAG_USB, &osk_usb_config },
143}; 198};
144 199
200#ifdef CONFIG_OMAP_OSK_MISTRAL
201
202#ifdef CONFIG_PM
203static irqreturn_t
204osk_mistral_wake_interrupt(int irq, void *ignored, struct pt_regs *regs)
205{
206 return IRQ_HANDLED;
207}
208#endif
209
210static void __init osk_mistral_init(void)
211{
212 /* FIXME here's where to feed in framebuffer, touchpad, and
213 * keyboard setup ... not in the drivers for those devices!
214 *
215 * NOTE: we could actually tell if there's a Mistral board
216 * attached, e.g. by trying to read something from the ads7846.
217 * But this is too early for that...
218 */
219
220 /* the sideways button (SW1) is for use as a "wakeup" button */
221 omap_cfg_reg(N15_1610_MPUIO2);
222 if (omap_request_gpio(OMAP_MPUIO(2)) == 0) {
223 int ret = 0;
224 omap_set_gpio_direction(OMAP_MPUIO(2), 1);
225 set_irq_type(OMAP_GPIO_IRQ(OMAP_MPUIO(2)), IRQT_RISING);
226#ifdef CONFIG_PM
227 /* share the IRQ in case someone wants to use the
228 * button for more than wakeup from system sleep.
229 */
230 ret = request_irq(OMAP_GPIO_IRQ(OMAP_MPUIO(2)),
231 &osk_mistral_wake_interrupt,
232 SA_SHIRQ, "mistral_wakeup",
233 &osk_mistral_wake_interrupt);
234 if (ret != 0) {
235 omap_free_gpio(OMAP_MPUIO(2));
236 printk(KERN_ERR "OSK+Mistral: no wakeup irq, %d?\n",
237 ret);
238 } else
239 enable_irq_wake(OMAP_GPIO_IRQ(OMAP_MPUIO(2)));
240#endif
241 } else
242 printk(KERN_ERR "OSK+Mistral: wakeup button is awol\n");
243}
244#else
245static void __init osk_mistral_init(void) { }
246#endif
247
145static void __init osk_init(void) 248static void __init osk_init(void)
146{ 249{
250 osk_flash_resource.end = osk_flash_resource.start = omap_cs3_phys();
251 osk_flash_resource.end += SZ_32M - 1;
147 platform_add_devices(osk5912_devices, ARRAY_SIZE(osk5912_devices)); 252 platform_add_devices(osk5912_devices, ARRAY_SIZE(osk5912_devices));
148 omap_board_config = osk_config; 253 omap_board_config = osk_config;
149 omap_board_config_size = ARRAY_SIZE(osk_config); 254 omap_board_config_size = ARRAY_SIZE(osk_config);
150 USB_TRANSCEIVER_CTRL_REG |= (3 << 1); 255 USB_TRANSCEIVER_CTRL_REG |= (3 << 1);
256
257 osk_mistral_init();
151} 258}
152 259
153static void __init osk_map_io(void) 260static void __init osk_map_io(void)
154{ 261{
155 omap_map_common_io(); 262 omap_map_common_io();
156 iotable_init(osk5912_io_desc, ARRAY_SIZE(osk5912_io_desc));
157 omap_serial_init(osk_serial_ports); 263 omap_serial_init(osk_serial_ports);
158} 264}
159 265
diff --git a/arch/arm/mach-omap1/board-perseus2.c b/arch/arm/mach-omap1/board-perseus2.c
index 213317392d9b..107c68c8ab54 100644
--- a/arch/arm/mach-omap1/board-perseus2.c
+++ b/arch/arm/mach-omap1/board-perseus2.c
@@ -24,6 +24,7 @@
24#include <asm/mach/flash.h> 24#include <asm/mach/flash.h>
25#include <asm/mach/map.h> 25#include <asm/mach/map.h>
26 26
27#include <asm/arch/tc.h>
27#include <asm/arch/gpio.h> 28#include <asm/arch/gpio.h>
28#include <asm/arch/mux.h> 29#include <asm/arch/mux.h>
29#include <asm/arch/fpga.h> 30#include <asm/arch/fpga.h>
@@ -83,8 +84,8 @@ static struct flash_platform_data p2_flash_data = {
83}; 84};
84 85
85static struct resource p2_flash_resource = { 86static struct resource p2_flash_resource = {
86 .start = OMAP_FLASH_0_START, 87 .start = OMAP_CS0_PHYS,
87 .end = OMAP_FLASH_0_START + OMAP_FLASH_0_SIZE - 1, 88 .end = OMAP_CS0_PHYS + SZ_32M - 1,
88 .flags = IORESOURCE_MEM, 89 .flags = IORESOURCE_MEM,
89}; 90};
90 91
diff --git a/arch/arm/mach-omap1/board-voiceblue.c b/arch/arm/mach-omap1/board-voiceblue.c
index e42281988990..209d79ef1d5f 100644
--- a/arch/arm/mach-omap1/board-voiceblue.c
+++ b/arch/arm/mach-omap1/board-voiceblue.c
@@ -25,13 +25,14 @@
25#include <asm/hardware.h> 25#include <asm/hardware.h>
26#include <asm/mach-types.h> 26#include <asm/mach-types.h>
27#include <asm/mach/arch.h> 27#include <asm/mach/arch.h>
28#include <asm/mach/flash.h>
28#include <asm/mach/map.h> 29#include <asm/mach/map.h>
29 30
31#include <asm/arch/common.h>
30#include <asm/arch/gpio.h> 32#include <asm/arch/gpio.h>
31#include <asm/arch/tc.h>
32#include <asm/arch/mux.h> 33#include <asm/arch/mux.h>
34#include <asm/arch/tc.h>
33#include <asm/arch/usb.h> 35#include <asm/arch/usb.h>
34#include <asm/arch/common.h>
35 36
36extern void omap_init_time(void); 37extern void omap_init_time(void);
37extern int omap_gpio_init(void); 38extern int omap_gpio_init(void);
@@ -86,6 +87,27 @@ static int __init ext_uart_init(void)
86} 87}
87arch_initcall(ext_uart_init); 88arch_initcall(ext_uart_init);
88 89
90static struct flash_platform_data voiceblue_flash_data = {
91 .map_name = "cfi_probe",
92 .width = 2,
93};
94
95static struct resource voiceblue_flash_resource = {
96 .start = OMAP_CS0_PHYS,
97 .end = OMAP_CS0_PHYS + SZ_32M - 1,
98 .flags = IORESOURCE_MEM,
99};
100
101static struct platform_device voiceblue_flash_device = {
102 .name = "omapflash",
103 .id = 0,
104 .dev = {
105 .platform_data = &voiceblue_flash_data,
106 },
107 .num_resources = 1,
108 .resource = &voiceblue_flash_resource,
109};
110
89static struct resource voiceblue_smc91x_resources[] = { 111static struct resource voiceblue_smc91x_resources[] = {
90 [0] = { 112 [0] = {
91 .start = OMAP_CS2_PHYS + 0x300, 113 .start = OMAP_CS2_PHYS + 0x300,
@@ -107,6 +129,7 @@ static struct platform_device voiceblue_smc91x_device = {
107}; 129};
108 130
109static struct platform_device *voiceblue_devices[] __initdata = { 131static struct platform_device *voiceblue_devices[] __initdata = {
132 &voiceblue_flash_device,
110 &voiceblue_smc91x_device, 133 &voiceblue_smc91x_device,
111}; 134};
112 135
@@ -119,8 +142,17 @@ static struct omap_usb_config voiceblue_usb_config __initdata = {
119 .pins[2] = 6, 142 .pins[2] = 6,
120}; 143};
121 144
145static struct omap_mmc_config voiceblue_mmc_config __initdata = {
146 .mmc[0] = {
147 .enabled = 1,
148 .power_pin = 2,
149 .switch_pin = -1,
150 },
151};
152
122static struct omap_board_config_kernel voiceblue_config[] = { 153static struct omap_board_config_kernel voiceblue_config[] = {
123 { OMAP_TAG_USB, &voiceblue_usb_config }, 154 { OMAP_TAG_USB, &voiceblue_usb_config },
155 { OMAP_TAG_MMC, &voiceblue_mmc_config },
124}; 156};
125 157
126static void __init voiceblue_init_irq(void) 158static void __init voiceblue_init_irq(void)
@@ -131,9 +163,6 @@ static void __init voiceblue_init_irq(void)
131 163
132static void __init voiceblue_init(void) 164static void __init voiceblue_init(void)
133{ 165{
134 /* There is a good chance board is going up, so enable Power LED
135 * (it is connected through invertor) */
136 omap_writeb(0x00, OMAP_LPG1_LCR);
137 /* Watchdog */ 166 /* Watchdog */
138 omap_request_gpio(0); 167 omap_request_gpio(0);
139 /* smc91x reset */ 168 /* smc91x reset */
@@ -145,7 +174,6 @@ static void __init voiceblue_init(void)
145 mdelay(50); /* 50ms until PHY ready */ 174 mdelay(50); /* 50ms until PHY ready */
146 /* smc91x interrupt pin */ 175 /* smc91x interrupt pin */
147 omap_request_gpio(8); 176 omap_request_gpio(8);
148 omap_set_gpio_edge_ctrl(8, OMAP_GPIO_RISING_EDGE);
149 /* 16C554 reset*/ 177 /* 16C554 reset*/
150 omap_request_gpio(6); 178 omap_request_gpio(6);
151 omap_set_gpio_direction(6, 0); 179 omap_set_gpio_direction(6, 0);
@@ -155,14 +183,19 @@ static void __init voiceblue_init(void)
155 omap_request_gpio(13); 183 omap_request_gpio(13);
156 omap_request_gpio(14); 184 omap_request_gpio(14);
157 omap_request_gpio(15); 185 omap_request_gpio(15);
158 omap_set_gpio_edge_ctrl(12, OMAP_GPIO_RISING_EDGE); 186 set_irq_type(OMAP_GPIO_IRQ(12), IRQT_RISING);
159 omap_set_gpio_edge_ctrl(13, OMAP_GPIO_RISING_EDGE); 187 set_irq_type(OMAP_GPIO_IRQ(13), IRQT_RISING);
160 omap_set_gpio_edge_ctrl(14, OMAP_GPIO_RISING_EDGE); 188 set_irq_type(OMAP_GPIO_IRQ(14), IRQT_RISING);
161 omap_set_gpio_edge_ctrl(15, OMAP_GPIO_RISING_EDGE); 189 set_irq_type(OMAP_GPIO_IRQ(15), IRQT_RISING);
162 190
163 platform_add_devices(voiceblue_devices, ARRAY_SIZE(voiceblue_devices)); 191 platform_add_devices(voiceblue_devices, ARRAY_SIZE(voiceblue_devices));
164 omap_board_config = voiceblue_config; 192 omap_board_config = voiceblue_config;
165 omap_board_config_size = ARRAY_SIZE(voiceblue_config); 193 omap_board_config_size = ARRAY_SIZE(voiceblue_config);
194
195 /* There is a good chance board is going up, so enable power LED
196 * (it is connected through invertor) */
197 omap_writeb(0x00, OMAP_LPG1_LCR);
198 omap_writeb(0x00, OMAP_LPG1_PMR); /* Disable clock */
166} 199}
167 200
168static int __initdata omap_serial_ports[OMAP_MAX_NR_PORTS] = {1, 1, 1}; 201static int __initdata omap_serial_ports[OMAP_MAX_NR_PORTS] = {1, 1, 1};
@@ -184,9 +217,9 @@ static int panic_event(struct notifier_block *this, unsigned long event,
184 if (test_and_set_bit(MACHINE_PANICED, &machine_state)) 217 if (test_and_set_bit(MACHINE_PANICED, &machine_state))
185 return NOTIFY_DONE; 218 return NOTIFY_DONE;
186 219
187 /* Flash Power LED 220 /* Flash power LED */
188 * (TODO: Enable clock right way (enabled in bootloader already)) */
189 omap_writeb(0x78, OMAP_LPG1_LCR); 221 omap_writeb(0x78, OMAP_LPG1_LCR);
222 omap_writeb(0x01, OMAP_LPG1_PMR); /* Enable clock */
190 223
191 return NOTIFY_DONE; 224 return NOTIFY_DONE;
192} 225}
@@ -195,15 +228,14 @@ static struct notifier_block panic_block = {
195 .notifier_call = panic_event, 228 .notifier_call = panic_event,
196}; 229};
197 230
198static int __init setup_notifier(void) 231static int __init voiceblue_setup(void)
199{ 232{
200 /* Setup panic notifier */ 233 /* Setup panic notifier */
201 notifier_chain_register(&panic_notifier_list, &panic_block); 234 notifier_chain_register(&panic_notifier_list, &panic_block);
202 235
203 return 0; 236 return 0;
204} 237}
205 238postcore_initcall(voiceblue_setup);
206postcore_initcall(setup_notifier);
207 239
208static int wdt_gpio_state; 240static int wdt_gpio_state;
209 241
diff --git a/arch/arm/mach-omap1/devices.c b/arch/arm/mach-omap1/devices.c
new file mode 100644
index 000000000000..e8b3981444cd
--- /dev/null
+++ b/arch/arm/mach-omap1/devices.c
@@ -0,0 +1,351 @@
1/*
2 * linux/arch/arm/mach-omap1/devices.c
3 *
4 * OMAP1 platform device setup/initialization
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 */
11
12#include <linux/config.h>
13#include <linux/module.h>
14#include <linux/kernel.h>
15#include <linux/init.h>
16#include <linux/device.h>
17
18#include <asm/hardware.h>
19#include <asm/io.h>
20#include <asm/mach-types.h>
21#include <asm/mach/map.h>
22
23#include <asm/arch/tc.h>
24#include <asm/arch/board.h>
25#include <asm/arch/mux.h>
26#include <asm/arch/gpio.h>
27
28
29static void omap_nop_release(struct device *dev)
30{
31 /* Nothing */
32}
33
34/*-------------------------------------------------------------------------*/
35
36#if defined(CONFIG_I2C_OMAP) || defined(CONFIG_I2C_OMAP_MODULE)
37
38#define OMAP_I2C_BASE 0xfffb3800
39
40static struct resource i2c_resources[] = {
41 {
42 .start = OMAP_I2C_BASE,
43 .end = OMAP_I2C_BASE + 0x3f,
44 .flags = IORESOURCE_MEM,
45 },
46 {
47 .start = INT_I2C,
48 .flags = IORESOURCE_IRQ,
49 },
50};
51
52/* DMA not used; works around erratum writing to non-empty i2c fifo */
53
54static struct platform_device omap_i2c_device = {
55 .name = "i2c_omap",
56 .id = -1,
57 .dev = {
58 .release = omap_nop_release,
59 },
60 .num_resources = ARRAY_SIZE(i2c_resources),
61 .resource = i2c_resources,
62};
63
64static void omap_init_i2c(void)
65{
66 /* FIXME define and use a boot tag, in case of boards that
67 * either don't wire up I2C, or chips that mux it differently...
68 * it can include clocking and address info, maybe more.
69 */
70 omap_cfg_reg(I2C_SCL);
71 omap_cfg_reg(I2C_SDA);
72
73 (void) platform_device_register(&omap_i2c_device);
74}
75#else
76static inline void omap_init_i2c(void) {}
77#endif
78
79/*-------------------------------------------------------------------------*/
80
81#if defined(CONFIG_OMAP1610_IR) || defined(CONFIG_OMAP161O_IR_MODULE)
82
83static u64 irda_dmamask = 0xffffffff;
84
85static struct platform_device omap1610ir_device = {
86 .name = "omap1610-ir",
87 .id = -1,
88 .dev = {
89 .release = omap_nop_release,
90 .dma_mask = &irda_dmamask,
91 },
92};
93
94static void omap_init_irda(void)
95{
96 /* FIXME define and use a boot tag, members something like:
97 * u8 uart; // uart1, or uart3
98 * ... but driver only handles uart3 for now
99 * s16 fir_sel; // gpio for SIR vs FIR
100 * ... may prefer a callback for SIR/MIR/FIR mode select;
101 * while h2 uses a GPIO, H3 uses a gpio expander
102 */
103 if (machine_is_omap_h2()
104 || machine_is_omap_h3())
105 (void) platform_device_register(&omap1610ir_device);
106}
107#else
108static inline void omap_init_irda(void) {}
109#endif
110
111/*-------------------------------------------------------------------------*/
112
113#if defined(CONFIG_MMC_OMAP) || defined(CONFIG_MMC_OMAP_MODULE)
114
115#define OMAP_MMC1_BASE 0xfffb7800
116#define OMAP_MMC2_BASE 0xfffb7c00 /* omap16xx only */
117
118static struct omap_mmc_conf mmc1_conf;
119
120static u64 mmc1_dmamask = 0xffffffff;
121
122static struct resource mmc1_resources[] = {
123 {
124 .start = IO_ADDRESS(OMAP_MMC1_BASE),
125 .end = IO_ADDRESS(OMAP_MMC1_BASE) + 0x7f,
126 .flags = IORESOURCE_MEM,
127 },
128 {
129 .start = INT_MMC,
130 .flags = IORESOURCE_IRQ,
131 },
132};
133
134static struct platform_device mmc_omap_device1 = {
135 .name = "mmci-omap",
136 .id = 1,
137 .dev = {
138 .release = omap_nop_release,
139 .dma_mask = &mmc1_dmamask,
140 .platform_data = &mmc1_conf,
141 },
142 .num_resources = ARRAY_SIZE(mmc1_resources),
143 .resource = mmc1_resources,
144};
145
146#ifdef CONFIG_ARCH_OMAP16XX
147
148static struct omap_mmc_conf mmc2_conf;
149
150static u64 mmc2_dmamask = 0xffffffff;
151
152static struct resource mmc2_resources[] = {
153 {
154 .start = IO_ADDRESS(OMAP_MMC2_BASE),
155 .end = IO_ADDRESS(OMAP_MMC2_BASE) + 0x7f,
156 .flags = IORESOURCE_MEM,
157 },
158 {
159 .start = INT_1610_MMC2,
160 .flags = IORESOURCE_IRQ,
161 },
162};
163
164static struct platform_device mmc_omap_device2 = {
165 .name = "mmci-omap",
166 .id = 2,
167 .dev = {
168 .release = omap_nop_release,
169 .dma_mask = &mmc2_dmamask,
170 .platform_data = &mmc2_conf,
171 },
172 .num_resources = ARRAY_SIZE(mmc2_resources),
173 .resource = mmc2_resources,
174};
175#endif
176
177static void __init omap_init_mmc(void)
178{
179 const struct omap_mmc_config *mmc_conf;
180 const struct omap_mmc_conf *mmc;
181
182 /* NOTE: assumes MMC was never (wrongly) enabled */
183 mmc_conf = omap_get_config(OMAP_TAG_MMC, struct omap_mmc_config);
184 if (!mmc_conf)
185 return;
186
187 /* block 1 is always available and has just one pinout option */
188 mmc = &mmc_conf->mmc[0];
189 if (mmc->enabled) {
190 omap_cfg_reg(MMC_CMD);
191 omap_cfg_reg(MMC_CLK);
192 omap_cfg_reg(MMC_DAT0);
193 if (cpu_is_omap1710()) {
194 omap_cfg_reg(M15_1710_MMC_CLKI);
195 omap_cfg_reg(P19_1710_MMC_CMDDIR);
196 omap_cfg_reg(P20_1710_MMC_DATDIR0);
197 }
198 if (mmc->wire4) {
199 omap_cfg_reg(MMC_DAT1);
200 /* NOTE: DAT2 can be on W10 (here) or M15 */
201 if (!mmc->nomux)
202 omap_cfg_reg(MMC_DAT2);
203 omap_cfg_reg(MMC_DAT3);
204 }
205 mmc1_conf = *mmc;
206 (void) platform_device_register(&mmc_omap_device1);
207 }
208
209#ifdef CONFIG_ARCH_OMAP16XX
210 /* block 2 is on newer chips, and has many pinout options */
211 mmc = &mmc_conf->mmc[1];
212 if (mmc->enabled) {
213 if (!mmc->nomux) {
214 omap_cfg_reg(Y8_1610_MMC2_CMD);
215 omap_cfg_reg(Y10_1610_MMC2_CLK);
216 omap_cfg_reg(R18_1610_MMC2_CLKIN);
217 omap_cfg_reg(W8_1610_MMC2_DAT0);
218 if (mmc->wire4) {
219 omap_cfg_reg(V8_1610_MMC2_DAT1);
220 omap_cfg_reg(W15_1610_MMC2_DAT2);
221 omap_cfg_reg(R10_1610_MMC2_DAT3);
222 }
223
224 /* These are needed for the level shifter */
225 omap_cfg_reg(V9_1610_MMC2_CMDDIR);
226 omap_cfg_reg(V5_1610_MMC2_DATDIR0);
227 omap_cfg_reg(W19_1610_MMC2_DATDIR1);
228 }
229
230 /* Feedback clock must be set on OMAP-1710 MMC2 */
231 if (cpu_is_omap1710())
232 omap_writel(omap_readl(MOD_CONF_CTRL_1) | (1 << 24),
233 MOD_CONF_CTRL_1);
234 mmc2_conf = *mmc;
235 (void) platform_device_register(&mmc_omap_device2);
236 }
237#endif
238 return;
239}
240#else
241static inline void omap_init_mmc(void) {}
242#endif
243
244#if defined(CONFIG_OMAP_RTC) || defined(CONFIG_OMAP_RTC)
245
246#define OMAP_RTC_BASE 0xfffb4800
247
248static struct resource rtc_resources[] = {
249 {
250 .start = OMAP_RTC_BASE,
251 .end = OMAP_RTC_BASE + 0x5f,
252 .flags = IORESOURCE_MEM,
253 },
254 {
255 .start = INT_RTC_TIMER,
256 .flags = IORESOURCE_IRQ,
257 },
258 {
259 .start = INT_RTC_ALARM,
260 .flags = IORESOURCE_IRQ,
261 },
262};
263
264static struct platform_device omap_rtc_device = {
265 .name = "omap_rtc",
266 .id = -1,
267 .dev = {
268 .release = omap_nop_release,
269 },
270 .num_resources = ARRAY_SIZE(rtc_resources),
271 .resource = rtc_resources,
272};
273
274static void omap_init_rtc(void)
275{
276 (void) platform_device_register(&omap_rtc_device);
277}
278#else
279static inline void omap_init_rtc(void) {}
280#endif
281
282/*-------------------------------------------------------------------------*/
283
284#if defined(CONFIG_OMAP16XX_WATCHDOG) || defined(CONFIG_OMAP16XX_WATCHDOG_MODULE)
285
286#define OMAP_WDT_BASE 0xfffeb000
287
288static struct resource wdt_resources[] = {
289 {
290 .start = OMAP_WDT_BASE,
291 .end = OMAP_WDT_BASE + 0x4f,
292 .flags = IORESOURCE_MEM,
293 },
294};
295
296static struct platform_device omap_wdt_device = {
297 .name = "omap1610_wdt",
298 .id = -1,
299 .dev = {
300 .release = omap_nop_release,
301 },
302 .num_resources = ARRAY_SIZE(wdt_resources),
303 .resource = wdt_resources,
304};
305
306static void omap_init_wdt(void)
307{
308 (void) platform_device_register(&omap_wdt_device);
309}
310#else
311static inline void omap_init_wdt(void) {}
312#endif
313
314
315/*-------------------------------------------------------------------------*/
316
317/*
318 * This gets called after board-specific INIT_MACHINE, and initializes most
319 * on-chip peripherals accessible on this board (except for few like USB):
320 *
321 * (a) Does any "standard config" pin muxing needed. Board-specific
322 * code will have muxed GPIO pins and done "nonstandard" setup;
323 * that code could live in the boot loader.
324 * (b) Populating board-specific platform_data with the data drivers
325 * rely on to handle wiring variations.
326 * (c) Creating platform devices as meaningful on this board and
327 * with this kernel configuration.
328 *
329 * Claiming GPIOs, and setting their direction and initial values, is the
330 * responsibility of the device drivers. So is responding to probe().
331 *
332 * Board-specific knowlege like creating devices or pin setup is to be
333 * kept out of drivers as much as possible. In particular, pin setup
334 * may be handled by the boot loader, and drivers should expect it will
335 * normally have been done by the time they're probed.
336 */
337static int __init omap_init_devices(void)
338{
339 /* please keep these calls, and their implementations above,
340 * in alphabetical order so they're easier to sort through.
341 */
342 omap_init_i2c();
343 omap_init_irda();
344 omap_init_mmc();
345 omap_init_rtc();
346 omap_init_wdt();
347
348 return 0;
349}
350arch_initcall(omap_init_devices);
351
diff --git a/arch/arm/mach-omap1/fpga.c b/arch/arm/mach-omap1/fpga.c
index c12a78335625..aca2a120813a 100644
--- a/arch/arm/mach-omap1/fpga.c
+++ b/arch/arm/mach-omap1/fpga.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * linux/arch/arm/mach-omap/fpga.c 2 * linux/arch/arm/mach-omap1/fpga.c
3 * 3 *
4 * Interrupt handler for OMAP-1510 Innovator FPGA 4 * Interrupt handler for OMAP-1510 Innovator FPGA
5 * 5 *
@@ -181,7 +181,7 @@ void omap1510_fpga_init_irq(void)
181 */ 181 */
182 omap_request_gpio(13); 182 omap_request_gpio(13);
183 omap_set_gpio_direction(13, 1); 183 omap_set_gpio_direction(13, 1);
184 omap_set_gpio_edge_ctrl(13, OMAP_GPIO_RISING_EDGE); 184 set_irq_type(OMAP_GPIO_IRQ(13), IRQT_RISING);
185 set_irq_chained_handler(OMAP1510_INT_FPGA, innovator_fpga_IRQ_demux); 185 set_irq_chained_handler(OMAP1510_INT_FPGA, innovator_fpga_IRQ_demux);
186} 186}
187 187
diff --git a/arch/arm/mach-omap1/io.c b/arch/arm/mach-omap1/io.c
index 207df0fe934d..eb8261d7dead 100644
--- a/arch/arm/mach-omap1/io.c
+++ b/arch/arm/mach-omap1/io.c
@@ -19,6 +19,7 @@
19 19
20extern int clk_init(void); 20extern int clk_init(void);
21extern void omap_check_revision(void); 21extern void omap_check_revision(void);
22extern void omap_sram_init(void);
22 23
23/* 24/*
24 * The machine specific code may provide the extra mapping besides the 25 * The machine specific code may provide the extra mapping besides the
@@ -32,7 +33,6 @@ static struct map_desc omap_io_desc[] __initdata = {
32static struct map_desc omap730_io_desc[] __initdata = { 33static struct map_desc omap730_io_desc[] __initdata = {
33 { OMAP730_DSP_BASE, OMAP730_DSP_START, OMAP730_DSP_SIZE, MT_DEVICE }, 34 { OMAP730_DSP_BASE, OMAP730_DSP_START, OMAP730_DSP_SIZE, MT_DEVICE },
34 { OMAP730_DSPREG_BASE, OMAP730_DSPREG_START, OMAP730_DSPREG_SIZE, MT_DEVICE }, 35 { OMAP730_DSPREG_BASE, OMAP730_DSPREG_START, OMAP730_DSPREG_SIZE, MT_DEVICE },
35 { OMAP730_SRAM_BASE, OMAP730_SRAM_START, OMAP730_SRAM_SIZE, MT_DEVICE }
36}; 36};
37#endif 37#endif
38 38
@@ -40,27 +40,13 @@ static struct map_desc omap730_io_desc[] __initdata = {
40static struct map_desc omap1510_io_desc[] __initdata = { 40static struct map_desc omap1510_io_desc[] __initdata = {
41 { OMAP1510_DSP_BASE, OMAP1510_DSP_START, OMAP1510_DSP_SIZE, MT_DEVICE }, 41 { OMAP1510_DSP_BASE, OMAP1510_DSP_START, OMAP1510_DSP_SIZE, MT_DEVICE },
42 { OMAP1510_DSPREG_BASE, OMAP1510_DSPREG_START, OMAP1510_DSPREG_SIZE, MT_DEVICE }, 42 { OMAP1510_DSPREG_BASE, OMAP1510_DSPREG_START, OMAP1510_DSPREG_SIZE, MT_DEVICE },
43 { OMAP1510_SRAM_BASE, OMAP1510_SRAM_START, OMAP1510_SRAM_SIZE, MT_DEVICE }
44}; 43};
45#endif 44#endif
46 45
47#if defined(CONFIG_ARCH_OMAP16XX) 46#if defined(CONFIG_ARCH_OMAP16XX)
48static struct map_desc omap1610_io_desc[] __initdata = { 47static struct map_desc omap16xx_io_desc[] __initdata = {
49 { OMAP16XX_DSP_BASE, OMAP16XX_DSP_START, OMAP16XX_DSP_SIZE, MT_DEVICE }, 48 { OMAP16XX_DSP_BASE, OMAP16XX_DSP_START, OMAP16XX_DSP_SIZE, MT_DEVICE },
50 { OMAP16XX_DSPREG_BASE, OMAP16XX_DSPREG_START, OMAP16XX_DSPREG_SIZE, MT_DEVICE }, 49 { OMAP16XX_DSPREG_BASE, OMAP16XX_DSPREG_START, OMAP16XX_DSPREG_SIZE, MT_DEVICE },
51 { OMAP16XX_SRAM_BASE, OMAP16XX_SRAM_START, OMAP1610_SRAM_SIZE, MT_DEVICE }
52};
53
54static struct map_desc omap5912_io_desc[] __initdata = {
55 { OMAP16XX_DSP_BASE, OMAP16XX_DSP_START, OMAP16XX_DSP_SIZE, MT_DEVICE },
56 { OMAP16XX_DSPREG_BASE, OMAP16XX_DSPREG_START, OMAP16XX_DSPREG_SIZE, MT_DEVICE },
57/*
58 * The OMAP5912 has 250kByte internal SRAM. Because the mapping is baseed on page
59 * size (4kByte), it seems that the last 2kByte (=0x800) of the 250kByte are not mapped.
60 * Add additional 2kByte (0x800) so that the last page is mapped and the last 2kByte
61 * can be used.
62 */
63 { OMAP16XX_SRAM_BASE, OMAP16XX_SRAM_START, OMAP5912_SRAM_SIZE + 0x800, MT_DEVICE }
64}; 50};
65#endif 51#endif
66 52
@@ -86,14 +72,13 @@ static void __init _omap_map_io(void)
86 } 72 }
87#endif 73#endif
88#if defined(CONFIG_ARCH_OMAP16XX) 74#if defined(CONFIG_ARCH_OMAP16XX)
89 if (cpu_is_omap1610() || cpu_is_omap1710()) { 75 if (cpu_is_omap16xx()) {
90 iotable_init(omap1610_io_desc, ARRAY_SIZE(omap1610_io_desc)); 76 iotable_init(omap16xx_io_desc, ARRAY_SIZE(omap16xx_io_desc));
91 }
92 if (cpu_is_omap5912()) {
93 iotable_init(omap5912_io_desc, ARRAY_SIZE(omap5912_io_desc));
94 } 77 }
95#endif 78#endif
96 79
80 omap_sram_init();
81
97 /* REVISIT: Refer to OMAP5910 Errata, Advisory SYS_1: "Timeout Abort 82 /* REVISIT: Refer to OMAP5910 Errata, Advisory SYS_1: "Timeout Abort
98 * on a Posted Write in the TIPB Bridge". 83 * on a Posted Write in the TIPB Bridge".
99 */ 84 */
@@ -108,8 +93,9 @@ static void __init _omap_map_io(void)
108/* 93/*
109 * This should only get called from board specific init 94 * This should only get called from board specific init
110 */ 95 */
111void omap_map_common_io(void) 96void __init omap_map_common_io(void)
112{ 97{
113 if (!initialized) 98 if (!initialized)
114 _omap_map_io(); 99 _omap_map_io();
115} 100}
101
diff --git a/arch/arm/mach-omap1/irq.c b/arch/arm/mach-omap1/irq.c
index afd5d67e4ae7..192ce6055faa 100644
--- a/arch/arm/mach-omap1/irq.c
+++ b/arch/arm/mach-omap1/irq.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * linux/arch/arm/mach-omap/irq.c 2 * linux/arch/arm/mach-omap1/irq.c
3 * 3 *
4 * Interrupt handler for all OMAP boards 4 * Interrupt handler for all OMAP boards
5 * 5 *
diff --git a/arch/arm/mach-omap1/leds-h2p2-debug.c b/arch/arm/mach-omap1/leds-h2p2-debug.c
index ec0d8285f243..be283cda63dd 100644
--- a/arch/arm/mach-omap1/leds-h2p2-debug.c
+++ b/arch/arm/mach-omap1/leds-h2p2-debug.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * linux/arch/arm/mach-omap/leds-h2p2-debug.c 2 * linux/arch/arm/mach-omap1/leds-h2p2-debug.c
3 * 3 *
4 * Copyright 2003 by Texas Instruments Incorporated 4 * Copyright 2003 by Texas Instruments Incorporated
5 * 5 *
@@ -13,6 +13,7 @@
13#include <linux/init.h> 13#include <linux/init.h>
14#include <linux/kernel_stat.h> 14#include <linux/kernel_stat.h>
15#include <linux/sched.h> 15#include <linux/sched.h>
16#include <linux/version.h>
16 17
17#include <asm/io.h> 18#include <asm/io.h>
18#include <asm/hardware.h> 19#include <asm/hardware.h>
diff --git a/arch/arm/mach-omap1/leds-innovator.c b/arch/arm/mach-omap1/leds-innovator.c
index 8043b7d0f66e..c8ffd1ddcded 100644
--- a/arch/arm/mach-omap1/leds-innovator.c
+++ b/arch/arm/mach-omap1/leds-innovator.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * linux/arch/arm/mach-omap/leds-innovator.c 2 * linux/arch/arm/mach-omap1/leds-innovator.c
3 */ 3 */
4#include <linux/config.h> 4#include <linux/config.h>
5#include <linux/init.h> 5#include <linux/init.h>
diff --git a/arch/arm/mach-omap1/leds-osk.c b/arch/arm/mach-omap1/leds-osk.c
index 4a0e8b9d4fc3..2c8bda847c18 100644
--- a/arch/arm/mach-omap1/leds-osk.c
+++ b/arch/arm/mach-omap1/leds-osk.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * linux/arch/arm/mach-omap/leds-osk.c 2 * linux/arch/arm/mach-omap1/leds-osk.c
3 * 3 *
4 * LED driver for OSK, and optionally Mistral QVGA, boards 4 * LED driver for OSK, and optionally Mistral QVGA, boards
5 */ 5 */
@@ -64,7 +64,7 @@ static void tps_work(void *unused)
64 64
65static DECLARE_WORK(work, tps_work, NULL); 65static DECLARE_WORK(work, tps_work, NULL);
66 66
67#ifdef CONFIG_FB_OMAP 67#ifdef CONFIG_OMAP_OSK_MISTRAL
68 68
69/* For now, all system indicators require the Mistral board, since that 69/* For now, all system indicators require the Mistral board, since that
70 * LED can be manipulated without a task context. This LED is either red, 70 * LED can be manipulated without a task context. This LED is either red,
@@ -127,7 +127,7 @@ void osk_leds_event(led_event_t evt)
127 hw_led_state = 0; 127 hw_led_state = 0;
128 break; 128 break;
129 129
130#ifdef CONFIG_FB_OMAP 130#ifdef CONFIG_OMAP_OSK_MISTRAL
131 131
132 case led_timer: 132 case led_timer:
133 hw_led_state ^= TIMER_LED; 133 hw_led_state ^= TIMER_LED;
@@ -144,7 +144,7 @@ void osk_leds_event(led_event_t evt)
144 mistral_setled(); 144 mistral_setled();
145 break; 145 break;
146 146
147#endif /* CONFIG_FB_OMAP */ 147#endif /* CONFIG_OMAP_OSK_MISTRAL */
148 148
149 /* "green" == tps LED1 (leftmost, normally power-good) 149 /* "green" == tps LED1 (leftmost, normally power-good)
150 * works only with DC adapter, not on battery power! 150 * works only with DC adapter, not on battery power!
diff --git a/arch/arm/mach-omap1/leds.c b/arch/arm/mach-omap1/leds.c
index 8ab21fe98e1b..5c6b1bb6e722 100644
--- a/arch/arm/mach-omap1/leds.c
+++ b/arch/arm/mach-omap1/leds.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * linux/arch/arm/mach-omap/leds.c 2 * linux/arch/arm/mach-omap1/leds.c
3 * 3 *
4 * OMAP LEDs dispatcher 4 * OMAP LEDs dispatcher
5 */ 5 */
@@ -20,7 +20,9 @@ omap_leds_init(void)
20 if (machine_is_omap_innovator()) 20 if (machine_is_omap_innovator())
21 leds_event = innovator_leds_event; 21 leds_event = innovator_leds_event;
22 22
23 else if (machine_is_omap_h2() || machine_is_omap_perseus2()) 23 else if (machine_is_omap_h2()
24 || machine_is_omap_h3()
25 || machine_is_omap_perseus2())
24 leds_event = h2p2_dbg_leds_event; 26 leds_event = h2p2_dbg_leds_event;
25 27
26 else if (machine_is_omap_osk()) 28 else if (machine_is_omap_osk())
@@ -30,8 +32,12 @@ omap_leds_init(void)
30 return -1; 32 return -1;
31 33
32 if (machine_is_omap_h2() 34 if (machine_is_omap_h2()
35 || machine_is_omap_h3()
33 || machine_is_omap_perseus2() 36 || machine_is_omap_perseus2()
34 || machine_is_omap_osk()) { 37#ifdef CONFIG_OMAP_OSK_MISTRAL
38 || machine_is_omap_osk()
39#endif
40 ) {
35 41
36 /* LED1/LED2 pins can be used as GPIO (as done here), or by 42 /* LED1/LED2 pins can be used as GPIO (as done here), or by
37 * the LPG (works even in deep sleep!), to drive a bicolor 43 * the LPG (works even in deep sleep!), to drive a bicolor
diff --git a/arch/arm/mach-omap1/serial.c b/arch/arm/mach-omap1/serial.c
index 214e5d17c8b5..e702e0cb899e 100644
--- a/arch/arm/mach-omap1/serial.c
+++ b/arch/arm/mach-omap1/serial.c
@@ -24,7 +24,11 @@
24 24
25#include <asm/arch/board.h> 25#include <asm/arch/board.h>
26#include <asm/arch/mux.h> 26#include <asm/arch/mux.h>
27#include <asm/arch/gpio.h>
27#include <asm/arch/fpga.h> 28#include <asm/arch/fpga.h>
29#ifdef CONFIG_PM
30#include <asm/arch/pm.h>
31#endif
28 32
29static struct clk * uart1_ck = NULL; 33static struct clk * uart1_ck = NULL;
30static struct clk * uart2_ck = NULL; 34static struct clk * uart2_ck = NULL;
@@ -193,6 +197,86 @@ void __init omap_serial_init(int ports[OMAP_MAX_NR_PORTS])
193 } 197 }
194} 198}
195 199
200#ifdef CONFIG_OMAP_SERIAL_WAKE
201
202static irqreturn_t omap_serial_wake_interrupt(int irq, void *dev_id,
203 struct pt_regs *regs)
204{
205 /* Need to do something with serial port right after wake-up? */
206 return IRQ_HANDLED;
207}
208
209/*
210 * Reroutes serial RX lines to GPIO lines for the duration of
211 * sleep to allow waking up the device from serial port even
212 * in deep sleep.
213 */
214void omap_serial_wake_trigger(int enable)
215{
216 if (!cpu_is_omap16xx())
217 return;
218
219 if (uart1_ck != NULL) {
220 if (enable)
221 omap_cfg_reg(V14_16XX_GPIO37);
222 else
223 omap_cfg_reg(V14_16XX_UART1_RX);
224 }
225 if (uart2_ck != NULL) {
226 if (enable)
227 omap_cfg_reg(R9_16XX_GPIO18);
228 else
229 omap_cfg_reg(R9_16XX_UART2_RX);
230 }
231 if (uart3_ck != NULL) {
232 if (enable)
233 omap_cfg_reg(L14_16XX_GPIO49);
234 else
235 omap_cfg_reg(L14_16XX_UART3_RX);
236 }
237}
238
239static void __init omap_serial_set_port_wakeup(int gpio_nr)
240{
241 int ret;
242
243 ret = omap_request_gpio(gpio_nr);
244 if (ret < 0) {
245 printk(KERN_ERR "Could not request UART wake GPIO: %i\n",
246 gpio_nr);
247 return;
248 }
249 omap_set_gpio_direction(gpio_nr, 1);
250 set_irq_type(OMAP_GPIO_IRQ(gpio_nr), IRQT_RISING);
251 ret = request_irq(OMAP_GPIO_IRQ(gpio_nr), &omap_serial_wake_interrupt,
252 0, "serial wakeup", NULL);
253 if (ret) {
254 omap_free_gpio(gpio_nr);
255 printk(KERN_ERR "No interrupt for UART wake GPIO: %i\n",
256 gpio_nr);
257 return;
258 }
259 enable_irq_wake(OMAP_GPIO_IRQ(gpio_nr));
260}
261
262static int __init omap_serial_wakeup_init(void)
263{
264 if (!cpu_is_omap16xx())
265 return 0;
266
267 if (uart1_ck != NULL)
268 omap_serial_set_port_wakeup(37);
269 if (uart2_ck != NULL)
270 omap_serial_set_port_wakeup(18);
271 if (uart3_ck != NULL)
272 omap_serial_set_port_wakeup(49);
273
274 return 0;
275}
276late_initcall(omap_serial_wakeup_init);
277
278#endif /* CONFIG_OMAP_SERIAL_WAKE */
279
196static int __init omap_init(void) 280static int __init omap_init(void)
197{ 281{
198 return platform_device_register(&serial_device); 282 return platform_device_register(&serial_device);
diff --git a/arch/arm/mach-omap1/time.c b/arch/arm/mach-omap1/time.c
index d540539c9bbb..191a9b1ee9b7 100644
--- a/arch/arm/mach-omap1/time.c
+++ b/arch/arm/mach-omap1/time.c
@@ -247,13 +247,6 @@ unsigned long long sched_clock(void)
247#define OMAP_32K_TIMER_TCR 0x04 247#define OMAP_32K_TIMER_TCR 0x04
248 248
249#define OMAP_32K_TICKS_PER_HZ (32768 / HZ) 249#define OMAP_32K_TICKS_PER_HZ (32768 / HZ)
250#if (32768 % HZ) != 0
251/* We cannot ignore modulo.
252 * Potential error can be as high as several percent.
253 */
254#define OMAP_32K_TICK_MODULO (32768 % HZ)
255static unsigned modulo_count = 0; /* Counts 1/HZ units */
256#endif
257 250
258/* 251/*
259 * TRM says 1 / HZ = ( TVR + 1) / 32768, so TRV = (32768 / HZ) - 1 252 * TRM says 1 / HZ = ( TVR + 1) / 32768, so TRV = (32768 / HZ) - 1
@@ -296,13 +289,22 @@ static inline void omap_32k_timer_stop(void)
296} 289}
297 290
298/* 291/*
299 * Rounds down to nearest usec 292 * Rounds down to nearest usec. Note that this will overflow for larger values.
300 */ 293 */
301static inline unsigned long omap_32k_ticks_to_usecs(unsigned long ticks_32k) 294static inline unsigned long omap_32k_ticks_to_usecs(unsigned long ticks_32k)
302{ 295{
303 return (ticks_32k * 5*5*5*5*5*5) >> 9; 296 return (ticks_32k * 5*5*5*5*5*5) >> 9;
304} 297}
305 298
299/*
300 * Rounds down to nearest nsec.
301 */
302static inline unsigned long long
303omap_32k_ticks_to_nsecs(unsigned long ticks_32k)
304{
305 return (unsigned long long) ticks_32k * 1000 * 5*5*5*5*5*5 >> 9;
306}
307
306static unsigned long omap_32k_last_tick = 0; 308static unsigned long omap_32k_last_tick = 0;
307 309
308/* 310/*
@@ -315,6 +317,15 @@ static unsigned long omap_32k_timer_gettimeoffset(void)
315} 317}
316 318
317/* 319/*
320 * Returns current time from boot in nsecs. It's OK for this to wrap
321 * around for now, as it's just a relative time stamp.
322 */
323unsigned long long sched_clock(void)
324{
325 return omap_32k_ticks_to_nsecs(omap_32k_sync_timer_read());
326}
327
328/*
318 * Timer interrupt for 32KHz timer. When dynamic tick is enabled, this 329 * Timer interrupt for 32KHz timer. When dynamic tick is enabled, this
319 * function is also called from other interrupts to remove latency 330 * function is also called from other interrupts to remove latency
320 * issues with dynamic tick. In the dynamic tick case, we need to lock 331 * issues with dynamic tick. In the dynamic tick case, we need to lock
@@ -330,19 +341,6 @@ static irqreturn_t omap_32k_timer_interrupt(int irq, void *dev_id,
330 now = omap_32k_sync_timer_read(); 341 now = omap_32k_sync_timer_read();
331 342
332 while (now - omap_32k_last_tick >= OMAP_32K_TICKS_PER_HZ) { 343 while (now - omap_32k_last_tick >= OMAP_32K_TICKS_PER_HZ) {
333#ifdef OMAP_32K_TICK_MODULO
334 /* Modulo addition may put omap_32k_last_tick ahead of now
335 * and cause unwanted repetition of the while loop.
336 */
337 if (unlikely(now - omap_32k_last_tick == ~0))
338 break;
339
340 modulo_count += OMAP_32K_TICK_MODULO;
341 if (modulo_count > HZ) {
342 ++omap_32k_last_tick;
343 modulo_count -= HZ;
344 }
345#endif
346 omap_32k_last_tick += OMAP_32K_TICKS_PER_HZ; 344 omap_32k_last_tick += OMAP_32K_TICKS_PER_HZ;
347 timer_tick(regs); 345 timer_tick(regs);
348 } 346 }