Commit 7c38cf021b42a4297bc8f860ab627734bdd6c8d1

Authored by Tony Lindgren
Committed by Russell King
1 parent d7b6b35894

[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>

Showing 20 changed files with 743 additions and 99 deletions Side-by-side Diff

arch/arm/mach-omap1/Kconfig
... ... @@ -47,6 +47,14 @@
47 47 TI OMAP 5912 OSK (OMAP Starter Kit) board support. Say Y here
48 48 if you have such a board.
49 49  
  50 +config 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 +
50 58 config MACH_OMAP_PERSEUS2
51 59 bool "TI Perseus2"
52 60 depends on ARCH_OMAP1 && ARCH_OMAP730
arch/arm/mach-omap1/Makefile
... ... @@ -3,7 +3,7 @@
3 3 #
4 4  
5 5 # Common support
6   -obj-y := io.o id.o irq.o time.o serial.o
  6 +obj-y := io.o id.o irq.o time.o serial.o devices.o
7 7 led-y := leds.o
8 8  
9 9 # Specific board support
... ... @@ -23,6 +23,7 @@
23 23  
24 24 # LEDs support
25 25 led-$(CONFIG_MACH_OMAP_H2) += leds-h2p2-debug.o
  26 +led-$(CONFIG_MACH_OMAP_H3) += leds-h2p2-debug.o
26 27 led-$(CONFIG_MACH_OMAP_INNOVATOR) += leds-innovator.o
27 28 led-$(CONFIG_MACH_OMAP_PERSEUS2) += leds-h2p2-debug.o
28 29 led-$(CONFIG_MACH_OMAP_OSK) += leds-osk.o
arch/arm/mach-omap1/board-generic.c
... ... @@ -48,19 +48,43 @@
48 48  
49 49 #if defined(CONFIG_ARCH_OMAP16XX)
50 50 static struct omap_usb_config generic1610_usb_config __initdata = {
  51 +#ifdef CONFIG_USB_OTG
  52 + .otg = 1,
  53 +#endif
51 54 .register_host = 1,
52 55 .register_dev = 1,
53 56 .hmc_mode = 16,
54 57 .pins[0] = 6,
55 58 };
  59 +
  60 +static 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 77 #endif
57 78  
58 79 static struct omap_board_config_kernel generic_config[] = {
59 80 { OMAP_TAG_USB, NULL },
  81 + { OMAP_TAG_MMC, &generic_mmc_config },
60 82 };
61 83  
62 84 static void __init omap_generic_init(void)
63 85 {
  86 + const struct omap_uart_config *uart_conf;
  87 +
64 88 /*
65 89 * Make sure the serial ports are muxed on at this point.
66 90 * You have to mux them off in device drivers later on
... ... @@ -76,6 +100,18 @@
76 100 generic_config[0].data = &generic1610_usb_config;
77 101 }
78 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 115 omap_board_config = generic_config;
80 116 omap_board_config_size = ARRAY_SIZE(generic_config);
81 117 omap_serial_init(generic_serial_ports);
... ... @@ -83,7 +119,7 @@
83 119  
84 120 static void __init omap_generic_map_io(void)
85 121 {
86   - omap_map_common_io()
  122 + omap_map_common_io();
87 123 }
88 124  
89 125 MACHINE_START(OMAP_GENERIC, "Generic OMAP1510/1610/1710")
arch/arm/mach-omap1/board-h2.c
... ... @@ -33,6 +33,7 @@
33 33 #include <asm/mach/map.h>
34 34  
35 35 #include <asm/arch/gpio.h>
  36 +#include <asm/arch/mux.h>
36 37 #include <asm/arch/tc.h>
37 38 #include <asm/arch/usb.h>
38 39 #include <asm/arch/common.h>
... ... @@ -80,8 +81,7 @@
80 81 };
81 82  
82 83 static struct resource h2_flash_resource = {
83   - .start = OMAP_CS2B_PHYS,
84   - .end = OMAP_CS2B_PHYS + OMAP_CS2B_SIZE - 1,
  84 + /* This is on CS3, wherever it's mapped */
85 85 .flags = IORESOURCE_MEM,
86 86 };
87 87  
88 88  
... ... @@ -126,10 +126,9 @@
126 126 printk("Error requesting gpio 0 for smc91x irq\n");
127 127 return;
128 128 }
129   - omap_set_gpio_edge_ctrl(0, OMAP_GPIO_FALLING_EDGE);
130 129 }
131 130  
132   -void h2_init_irq(void)
  131 +static void __init h2_init_irq(void)
133 132 {
134 133 omap_init_irq();
135 134 omap_gpio_init();
... ... @@ -152,9 +151,13 @@
152 151 };
153 152  
154 153 static struct omap_mmc_config h2_mmc_config __initdata = {
155   - .mmc_blocks = 1,
156   - .mmc1_power_pin = -1, /* tps65010 gpio3 */
157   - .mmc1_switch_pin = OMAP_MPUIO(1),
  154 + .mmc [0] = {
  155 + .enabled = 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  
160 163 static struct omap_board_config_kernel h2_config[] = {
... ... @@ -164,6 +167,16 @@
164 167  
165 168 static 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 180 platform_add_devices(h2_devices, ARRAY_SIZE(h2_devices));
168 181 omap_board_config = h2_config;
169 182 omap_board_config_size = ARRAY_SIZE(h2_config);
arch/arm/mach-omap1/board-h3.c
... ... @@ -82,8 +82,7 @@
82 82 };
83 83  
84 84 static struct resource h3_flash_resource = {
85   - .start = OMAP_CS2B_PHYS,
86   - .end = OMAP_CS2B_PHYS + OMAP_CS2B_SIZE - 1,
  85 + /* This is on CS3, wherever it's mapped */
87 86 .flags = IORESOURCE_MEM,
88 87 };
89 88  
90 89  
91 90  
92 91  
... ... @@ -161,13 +160,26 @@
161 160 .pins[1] = 3,
162 161 };
163 162  
  163 +static 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 +
164 171 static struct omap_board_config_kernel h3_config[] = {
165 172 { OMAP_TAG_USB, &h3_usb_config },
  173 + { OMAP_TAG_MMC, &h3_mmc_config },
166 174 };
167 175  
168 176 static 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 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  
173 185 static void __init h3_init_smc91x(void)
... ... @@ -177,7 +189,6 @@
177 189 printk("Error requesting gpio 40 for smc91x irq\n");
178 190 return;
179 191 }
180   - omap_set_gpio_edge_ctrl(40, OMAP_GPIO_FALLING_EDGE);
181 192 }
182 193  
183 194 void h3_init_irq(void)
arch/arm/mach-omap1/board-innovator.c
... ... @@ -29,6 +29,7 @@
29 29 #include <asm/mach/flash.h>
30 30 #include <asm/mach/map.h>
31 31  
  32 +#include <asm/arch/mux.h>
32 33 #include <asm/arch/fpga.h>
33 34 #include <asm/arch/gpio.h>
34 35 #include <asm/arch/tc.h>
... ... @@ -173,7 +174,6 @@
173 174 printk("Error requesting gpio 0 for smc91x irq\n");
174 175 return;
175 176 }
176   - omap_set_gpio_edge_ctrl(0, OMAP_GPIO_RISING_EDGE);
177 177 }
178 178 }
179 179  
180 180  
... ... @@ -220,8 +220,19 @@
220 220 };
221 221 #endif
222 222  
  223 +static 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 +
223 233 static struct omap_board_config_kernel innovator_config[] = {
224 234 { OMAP_TAG_USB, NULL },
  235 + { OMAP_TAG_MMC, &innovator_mmc_config },
225 236 };
226 237  
227 238 static void __init innovator_init(void)
arch/arm/mach-omap1/board-netstar.c
... ... @@ -75,16 +75,15 @@
75 75 mdelay(50); /* 50ms until PHY ready */
76 76 /* smc91x interrupt pin */
77 77 omap_request_gpio(8);
78   - omap_set_gpio_edge_ctrl(8, OMAP_GPIO_RISING_EDGE);
79 78  
80 79 omap_request_gpio(12);
81 80 omap_request_gpio(13);
82 81 omap_request_gpio(14);
83 82 omap_request_gpio(15);
84   - omap_set_gpio_edge_ctrl(12, OMAP_GPIO_FALLING_EDGE);
85   - omap_set_gpio_edge_ctrl(13, OMAP_GPIO_FALLING_EDGE);
86   - omap_set_gpio_edge_ctrl(14, OMAP_GPIO_FALLING_EDGE);
87   - omap_set_gpio_edge_ctrl(15, OMAP_GPIO_FALLING_EDGE);
  83 + set_irq_type(OMAP_GPIO_IRQ(12), IRQT_FALLING);
  84 + set_irq_type(OMAP_GPIO_IRQ(13), IRQT_FALLING);
  85 + set_irq_type(OMAP_GPIO_IRQ(14), IRQT_FALLING);
  86 + set_irq_type(OMAP_GPIO_IRQ(15), IRQT_FALLING);
88 87  
89 88 platform_add_devices(netstar_devices, ARRAY_SIZE(netstar_devices));
90 89  
arch/arm/mach-omap1/board-osk.c
... ... @@ -29,11 +29,16 @@
29 29 #include <linux/kernel.h>
30 30 #include <linux/init.h>
31 31 #include <linux/device.h>
  32 +#include <linux/interrupt.h>
32 33  
  34 +#include <linux/mtd/mtd.h>
  35 +#include <linux/mtd/partitions.h>
  36 +
33 37 #include <asm/hardware.h>
34 38 #include <asm/mach-types.h>
35 39 #include <asm/mach/arch.h>
36 40 #include <asm/mach/map.h>
  41 +#include <asm/mach/flash.h>
37 42  
38 43 #include <asm/arch/gpio.h>
39 44 #include <asm/arch/usb.h>
40 45  
41 46  
... ... @@ -41,13 +46,57 @@
41 46 #include <asm/arch/tc.h>
42 47 #include <asm/arch/common.h>
43 48  
44   -static struct map_desc osk5912_io_desc[] __initdata = {
45   -{ OMAP_OSK_NOR_FLASH_BASE, OMAP_OSK_NOR_FLASH_START, OMAP_OSK_NOR_FLASH_SIZE,
46   - MT_DEVICE },
  49 +static int __initdata osk_serial_ports[OMAP_MAX_NR_PORTS] = {1, 0, 0};
  50 +
  51 +static 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  
49   -static int __initdata osk_serial_ports[OMAP_MAX_NR_PORTS] = {1, 0, 0};
  78 +static 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 +};
50 84  
  85 +static struct resource osk_flash_resource = {
  86 + /* this is on CS3, wherever it's mapped */
  87 + .flags = IORESOURCE_MEM,
  88 +};
  89 +
  90 +static 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 +};
  99 +
51 100 static struct resource osk5912_smc91x_resources[] = {
52 101 [0] = {
53 102 .start = OMAP_OSK_ETHR_START, /* Physical */
54 103  
55 104  
... ... @@ -86,9 +135,16 @@
86 135 .resource = osk5912_cf_resources,
87 136 };
88 137  
  138 +static struct platform_device osk5912_mcbsp1_device = {
  139 + .name = "omap_mcbsp",
  140 + .id = 1,
  141 +};
  142 +
89 143 static struct platform_device *osk5912_devices[] __initdata = {
  144 + &osk5912_flash_device,
90 145 &osk5912_smc91x_device,
91 146 &osk5912_cf_device,
  147 + &osk5912_mcbsp1_device,
92 148 };
93 149  
94 150 static void __init osk_init_smc91x(void)
... ... @@ -97,7 +153,6 @@
97 153 printk("Error requesting gpio 0 for smc91x irq\n");
98 154 return;
99 155 }
100   - omap_set_gpio_edge_ctrl(0, OMAP_GPIO_RISING_EDGE);
101 156  
102 157 /* Check EMIFS wait states to fix errors with SMC_GET_PKT_HDR */
103 158 EMIFS_CCS(1) |= 0x2;
104 159  
... ... @@ -110,11 +165,11 @@
110 165 printk("Error requesting gpio 62 for CF irq\n");
111 166 return;
112 167 }
113   - /* it's really active-low */
114   - omap_set_gpio_edge_ctrl(62, OMAP_GPIO_FALLING_EDGE);
  168 + /* the CF I/O IRQ is really active-low */
  169 + set_irq_type(OMAP_GPIO_IRQ(62), IRQT_FALLING);
115 170 }
116 171  
117   -void osk_init_irq(void)
  172 +static void __init osk_init_irq(void)
118 173 {
119 174 omap_init_irq();
120 175 omap_gpio_init();
121 176  
122 177  
123 178  
... ... @@ -142,18 +197,69 @@
142 197 { OMAP_TAG_USB, &osk_usb_config },
143 198 };
144 199  
  200 +#ifdef CONFIG_OMAP_OSK_MISTRAL
  201 +
  202 +#ifdef CONFIG_PM
  203 +static irqreturn_t
  204 +osk_mistral_wake_interrupt(int irq, void *ignored, struct pt_regs *regs)
  205 +{
  206 + return IRQ_HANDLED;
  207 +}
  208 +#endif
  209 +
  210 +static 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
  245 +static void __init osk_mistral_init(void) { }
  246 +#endif
  247 +
145 248 static 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 252 platform_add_devices(osk5912_devices, ARRAY_SIZE(osk5912_devices));
148 253 omap_board_config = osk_config;
149 254 omap_board_config_size = ARRAY_SIZE(osk_config);
150 255 USB_TRANSCEIVER_CTRL_REG |= (3 << 1);
  256 +
  257 + osk_mistral_init();
151 258 }
152 259  
153 260 static void __init osk_map_io(void)
154 261 {
155 262 omap_map_common_io();
156   - iotable_init(osk5912_io_desc, ARRAY_SIZE(osk5912_io_desc));
157 263 omap_serial_init(osk_serial_ports);
158 264 }
159 265  
arch/arm/mach-omap1/board-perseus2.c
... ... @@ -24,6 +24,7 @@
24 24 #include <asm/mach/flash.h>
25 25 #include <asm/mach/map.h>
26 26  
  27 +#include <asm/arch/tc.h>
27 28 #include <asm/arch/gpio.h>
28 29 #include <asm/arch/mux.h>
29 30 #include <asm/arch/fpga.h>
... ... @@ -83,8 +84,8 @@
83 84 };
84 85  
85 86 static struct resource p2_flash_resource = {
86   - .start = OMAP_FLASH_0_START,
87   - .end = OMAP_FLASH_0_START + OMAP_FLASH_0_SIZE - 1,
  87 + .start = OMAP_CS0_PHYS,
  88 + .end = OMAP_CS0_PHYS + SZ_32M - 1,
88 89 .flags = IORESOURCE_MEM,
89 90 };
90 91  
arch/arm/mach-omap1/board-voiceblue.c
... ... @@ -25,13 +25,14 @@
25 25 #include <asm/hardware.h>
26 26 #include <asm/mach-types.h>
27 27 #include <asm/mach/arch.h>
  28 +#include <asm/mach/flash.h>
28 29 #include <asm/mach/map.h>
29 30  
  31 +#include <asm/arch/common.h>
30 32 #include <asm/arch/gpio.h>
31   -#include <asm/arch/tc.h>
32 33 #include <asm/arch/mux.h>
  34 +#include <asm/arch/tc.h>
33 35 #include <asm/arch/usb.h>
34   -#include <asm/arch/common.h>
35 36  
36 37 extern void omap_init_time(void);
37 38 extern int omap_gpio_init(void);
... ... @@ -86,6 +87,27 @@
86 87 }
87 88 arch_initcall(ext_uart_init);
88 89  
  90 +static struct flash_platform_data voiceblue_flash_data = {
  91 + .map_name = "cfi_probe",
  92 + .width = 2,
  93 +};
  94 +
  95 +static struct resource voiceblue_flash_resource = {
  96 + .start = OMAP_CS0_PHYS,
  97 + .end = OMAP_CS0_PHYS + SZ_32M - 1,
  98 + .flags = IORESOURCE_MEM,
  99 +};
  100 +
  101 +static 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 +
89 111 static struct resource voiceblue_smc91x_resources[] = {
90 112 [0] = {
91 113 .start = OMAP_CS2_PHYS + 0x300,
... ... @@ -107,6 +129,7 @@
107 129 };
108 130  
109 131 static struct platform_device *voiceblue_devices[] __initdata = {
  132 + &voiceblue_flash_device,
110 133 &voiceblue_smc91x_device,
111 134 };
112 135  
113 136  
... ... @@ -119,8 +142,17 @@
119 142 .pins[2] = 6,
120 143 };
121 144  
  145 +static 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 +
122 153 static struct omap_board_config_kernel voiceblue_config[] = {
123 154 { OMAP_TAG_USB, &voiceblue_usb_config },
  155 + { OMAP_TAG_MMC, &voiceblue_mmc_config },
124 156 };
125 157  
126 158 static void __init voiceblue_init_irq(void)
... ... @@ -131,9 +163,6 @@
131 163  
132 164 static 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 166 /* Watchdog */
138 167 omap_request_gpio(0);
139 168 /* smc91x reset */
... ... @@ -145,7 +174,6 @@
145 174 mdelay(50); /* 50ms until PHY ready */
146 175 /* smc91x interrupt pin */
147 176 omap_request_gpio(8);
148   - omap_set_gpio_edge_ctrl(8, OMAP_GPIO_RISING_EDGE);
149 177 /* 16C554 reset*/
150 178 omap_request_gpio(6);
151 179 omap_set_gpio_direction(6, 0);
152 180  
... ... @@ -155,14 +183,19 @@
155 183 omap_request_gpio(13);
156 184 omap_request_gpio(14);
157 185 omap_request_gpio(15);
158   - omap_set_gpio_edge_ctrl(12, OMAP_GPIO_RISING_EDGE);
159   - omap_set_gpio_edge_ctrl(13, OMAP_GPIO_RISING_EDGE);
160   - omap_set_gpio_edge_ctrl(14, OMAP_GPIO_RISING_EDGE);
161   - omap_set_gpio_edge_ctrl(15, OMAP_GPIO_RISING_EDGE);
  186 + set_irq_type(OMAP_GPIO_IRQ(12), IRQT_RISING);
  187 + set_irq_type(OMAP_GPIO_IRQ(13), IRQT_RISING);
  188 + set_irq_type(OMAP_GPIO_IRQ(14), IRQT_RISING);
  189 + set_irq_type(OMAP_GPIO_IRQ(15), IRQT_RISING);
162 190  
163 191 platform_add_devices(voiceblue_devices, ARRAY_SIZE(voiceblue_devices));
164 192 omap_board_config = voiceblue_config;
165 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  
168 201 static int __initdata omap_serial_ports[OMAP_MAX_NR_PORTS] = {1, 1, 1};
169 202  
... ... @@ -184,9 +217,9 @@
184 217 if (test_and_set_bit(MACHINE_PANICED, &machine_state))
185 218 return NOTIFY_DONE;
186 219  
187   - /* Flash Power LED
188   - * (TODO: Enable clock right way (enabled in bootloader already)) */
  220 + /* Flash power LED */
189 221 omap_writeb(0x78, OMAP_LPG1_LCR);
  222 + omap_writeb(0x01, OMAP_LPG1_PMR); /* Enable clock */
190 223  
191 224 return NOTIFY_DONE;
192 225 }
193 226  
... ... @@ -195,15 +228,14 @@
195 228 .notifier_call = panic_event,
196 229 };
197 230  
198   -static int __init setup_notifier(void)
  231 +static int __init voiceblue_setup(void)
199 232 {
200 233 /* Setup panic notifier */
201 234 notifier_chain_register(&panic_notifier_list, &panic_block);
202 235  
203 236 return 0;
204 237 }
205   -
206   -postcore_initcall(setup_notifier);
  238 +postcore_initcall(voiceblue_setup);
207 239  
208 240 static int wdt_gpio_state;
209 241  
arch/arm/mach-omap1/devices.c
  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 +
  29 +static 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 +
  40 +static 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 +
  54 +static 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 +
  64 +static 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
  76 +static inline void omap_init_i2c(void) {}
  77 +#endif
  78 +
  79 +/*-------------------------------------------------------------------------*/
  80 +
  81 +#if defined(CONFIG_OMAP1610_IR) || defined(CONFIG_OMAP161O_IR_MODULE)
  82 +
  83 +static u64 irda_dmamask = 0xffffffff;
  84 +
  85 +static 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 +
  94 +static 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
  108 +static 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 +
  118 +static struct omap_mmc_conf mmc1_conf;
  119 +
  120 +static u64 mmc1_dmamask = 0xffffffff;
  121 +
  122 +static 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 +
  134 +static 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 +
  148 +static struct omap_mmc_conf mmc2_conf;
  149 +
  150 +static u64 mmc2_dmamask = 0xffffffff;
  151 +
  152 +static 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 +
  164 +static 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 +
  177 +static 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
  241 +static 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 +
  248 +static 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 +
  264 +static 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 +
  274 +static void omap_init_rtc(void)
  275 +{
  276 + (void) platform_device_register(&omap_rtc_device);
  277 +}
  278 +#else
  279 +static 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 +
  288 +static struct resource wdt_resources[] = {
  289 + {
  290 + .start = OMAP_WDT_BASE,
  291 + .end = OMAP_WDT_BASE + 0x4f,
  292 + .flags = IORESOURCE_MEM,
  293 + },
  294 +};
  295 +
  296 +static 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 +
  306 +static void omap_init_wdt(void)
  307 +{
  308 + (void) platform_device_register(&omap_wdt_device);
  309 +}
  310 +#else
  311 +static 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 + */
  337 +static 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 +}
  350 +arch_initcall(omap_init_devices);
arch/arm/mach-omap1/fpga.c
1 1 /*
2   - * linux/arch/arm/mach-omap/fpga.c
  2 + * linux/arch/arm/mach-omap1/fpga.c
3 3 *
4 4 * Interrupt handler for OMAP-1510 Innovator FPGA
5 5 *
... ... @@ -181,7 +181,7 @@
181 181 */
182 182 omap_request_gpio(13);
183 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 185 set_irq_chained_handler(OMAP1510_INT_FPGA, innovator_fpga_IRQ_demux);
186 186 }
187 187  
arch/arm/mach-omap1/io.c
... ... @@ -19,6 +19,7 @@
19 19  
20 20 extern int clk_init(void);
21 21 extern void omap_check_revision(void);
  22 +extern void omap_sram_init(void);
22 23  
23 24 /*
24 25 * The machine specific code may provide the extra mapping besides the
... ... @@ -32,7 +33,6 @@
32 33 static struct map_desc omap730_io_desc[] __initdata = {
33 34 { OMAP730_DSP_BASE, OMAP730_DSP_START, OMAP730_DSP_SIZE, MT_DEVICE },
34 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 37 #endif
38 38  
39 39  
40 40  
41 41  
... ... @@ -40,28 +40,14 @@
40 40 static struct map_desc omap1510_io_desc[] __initdata = {
41 41 { OMAP1510_DSP_BASE, OMAP1510_DSP_START, OMAP1510_DSP_SIZE, MT_DEVICE },
42 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 44 #endif
46 45  
47 46 #if defined(CONFIG_ARCH_OMAP16XX)
48   -static struct map_desc omap1610_io_desc[] __initdata = {
  47 +static struct map_desc omap16xx_io_desc[] __initdata = {
49 48 { OMAP16XX_DSP_BASE, OMAP16XX_DSP_START, OMAP16XX_DSP_SIZE, MT_DEVICE },
50 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 50 };
53   -
54   -static 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   -};
65 51 #endif
66 52  
67 53 static int initialized = 0;
68 54  
69 55  
... ... @@ -86,14 +72,13 @@
86 72 }
87 73 #endif
88 74 #if defined(CONFIG_ARCH_OMAP16XX)
89   - if (cpu_is_omap1610() || cpu_is_omap1710()) {
90   - iotable_init(omap1610_io_desc, ARRAY_SIZE(omap1610_io_desc));
  75 + if (cpu_is_omap16xx()) {
  76 + iotable_init(omap16xx_io_desc, ARRAY_SIZE(omap16xx_io_desc));
91 77 }
92   - if (cpu_is_omap5912()) {
93   - iotable_init(omap5912_io_desc, ARRAY_SIZE(omap5912_io_desc));
94   - }
95 78 #endif
96 79  
  80 + omap_sram_init();
  81 +
97 82 /* REVISIT: Refer to OMAP5910 Errata, Advisory SYS_1: "Timeout Abort
98 83 * on a Posted Write in the TIPB Bridge".
99 84 */
... ... @@ -108,7 +93,7 @@
108 93 /*
109 94 * This should only get called from board specific init
110 95 */
111   -void omap_map_common_io(void)
  96 +void __init omap_map_common_io(void)
112 97 {
113 98 if (!initialized)
114 99 _omap_map_io();
arch/arm/mach-omap1/irq.c
1 1 /*
2   - * linux/arch/arm/mach-omap/irq.c
  2 + * linux/arch/arm/mach-omap1/irq.c
3 3 *
4 4 * Interrupt handler for all OMAP boards
5 5 *
arch/arm/mach-omap1/leds-h2p2-debug.c
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 4 * Copyright 2003 by Texas Instruments Incorporated
5 5 *
... ... @@ -13,6 +13,7 @@
13 13 #include <linux/init.h>
14 14 #include <linux/kernel_stat.h>
15 15 #include <linux/sched.h>
  16 +#include <linux/version.h>
16 17  
17 18 #include <asm/io.h>
18 19 #include <asm/hardware.h>
arch/arm/mach-omap1/leds-innovator.c
1 1 /*
2   - * linux/arch/arm/mach-omap/leds-innovator.c
  2 + * linux/arch/arm/mach-omap1/leds-innovator.c
3 3 */
4 4 #include <linux/config.h>
5 5 #include <linux/init.h>
arch/arm/mach-omap1/leds-osk.c
1 1 /*
2   - * linux/arch/arm/mach-omap/leds-osk.c
  2 + * linux/arch/arm/mach-omap1/leds-osk.c
3 3 *
4 4 * LED driver for OSK, and optionally Mistral QVGA, boards
5 5 */
... ... @@ -64,7 +64,7 @@
64 64  
65 65 static DECLARE_WORK(work, tps_work, NULL);
66 66  
67   -#ifdef CONFIG_FB_OMAP
  67 +#ifdef CONFIG_OMAP_OSK_MISTRAL
68 68  
69 69 /* For now, all system indicators require the Mistral board, since that
70 70 * LED can be manipulated without a task context. This LED is either red,
... ... @@ -127,7 +127,7 @@
127 127 hw_led_state = 0;
128 128 break;
129 129  
130   -#ifdef CONFIG_FB_OMAP
  130 +#ifdef CONFIG_OMAP_OSK_MISTRAL
131 131  
132 132 case led_timer:
133 133 hw_led_state ^= TIMER_LED;
... ... @@ -144,7 +144,7 @@
144 144 mistral_setled();
145 145 break;
146 146  
147   -#endif /* CONFIG_FB_OMAP */
  147 +#endif /* CONFIG_OMAP_OSK_MISTRAL */
148 148  
149 149 /* "green" == tps LED1 (leftmost, normally power-good)
150 150 * works only with DC adapter, not on battery power!
arch/arm/mach-omap1/leds.c
1 1 /*
2   - * linux/arch/arm/mach-omap/leds.c
  2 + * linux/arch/arm/mach-omap1/leds.c
3 3 *
4 4 * OMAP LEDs dispatcher
5 5 */
... ... @@ -20,7 +20,9 @@
20 20 if (machine_is_omap_innovator())
21 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 26 leds_event = h2p2_dbg_leds_event;
25 27  
26 28 else if (machine_is_omap_osk())
27 29  
... ... @@ -30,8 +32,12 @@
30 32 return -1;
31 33  
32 34 if (machine_is_omap_h2()
  35 + || machine_is_omap_h3()
33 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 42 /* LED1/LED2 pins can be used as GPIO (as done here), or by
37 43 * the LPG (works even in deep sleep!), to drive a bicolor
arch/arm/mach-omap1/serial.c
... ... @@ -24,7 +24,11 @@
24 24  
25 25 #include <asm/arch/board.h>
26 26 #include <asm/arch/mux.h>
  27 +#include <asm/arch/gpio.h>
27 28 #include <asm/arch/fpga.h>
  29 +#ifdef CONFIG_PM
  30 +#include <asm/arch/pm.h>
  31 +#endif
28 32  
29 33 static struct clk * uart1_ck = NULL;
30 34 static struct clk * uart2_ck = NULL;
... ... @@ -192,6 +196,86 @@
192 196 omap_serial_reset(&serial_platform_data[i]);
193 197 }
194 198 }
  199 +
  200 +#ifdef CONFIG_OMAP_SERIAL_WAKE
  201 +
  202 +static 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 + */
  214 +void 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 +
  239 +static 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 +
  262 +static 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 +}
  276 +late_initcall(omap_serial_wakeup_init);
  277 +
  278 +#endif /* CONFIG_OMAP_SERIAL_WAKE */
195 279  
196 280 static int __init omap_init(void)
197 281 {
arch/arm/mach-omap1/time.c
... ... @@ -247,13 +247,6 @@
247 247 #define OMAP_32K_TIMER_TCR 0x04
248 248  
249 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)
255   -static unsigned modulo_count = 0; /* Counts 1/HZ units */
256   -#endif
257 250  
258 251 /*
259 252 * TRM says 1 / HZ = ( TVR + 1) / 32768, so TRV = (32768 / HZ) - 1
260 253  
... ... @@ -296,13 +289,22 @@
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 */
301 294 static inline unsigned long omap_32k_ticks_to_usecs(unsigned long ticks_32k)
302 295 {
303 296 return (ticks_32k * 5*5*5*5*5*5) >> 9;
304 297 }
305 298  
  299 +/*
  300 + * Rounds down to nearest nsec.
  301 + */
  302 +static inline unsigned long long
  303 +omap_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 +
306 308 static unsigned long omap_32k_last_tick = 0;
307 309  
308 310 /*
... ... @@ -315,6 +317,15 @@
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 + */
  323 +unsigned long long sched_clock(void)
  324 +{
  325 + return omap_32k_ticks_to_nsecs(omap_32k_sync_timer_read());
  326 +}
  327 +
  328 +/*
318 329 * Timer interrupt for 32KHz timer. When dynamic tick is enabled, this
319 330 * function is also called from other interrupts to remove latency
320 331 * issues with dynamic tick. In the dynamic tick case, we need to lock
... ... @@ -330,19 +341,6 @@
330 341 now = omap_32k_sync_timer_read();
331 342  
332 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 344 omap_32k_last_tick += OMAP_32K_TICKS_PER_HZ;
347 345 timer_tick(regs);
348 346 }