aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-omap1
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@woody.linux-foundation.org>2007-10-15 19:08:50 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-10-15 19:08:50 -0400
commit65a6ec0d72a07f16719e9b7a96e1c4bae044b591 (patch)
tree344e03a5039a44982c1b78d6113633b21b434820 /arch/arm/mach-omap1
parent541010e4b8921cd781ff02ae68028501457045b6 (diff)
parent0181b61a988424b5cc44fe09e6968142359c815e (diff)
Merge branch 'devel' of master.kernel.org:/home/rmk/linux-2.6-arm
* 'devel' of master.kernel.org:/home/rmk/linux-2.6-arm: (95 commits) [ARM] 4578/1: CM-x270: PCMCIA support [ARM] 4577/1: ITE 8152 PCI bridge support [ARM] 4576/1: CM-X270 machine support [ARM] pxa: Avoid pxa_gpio_mode() in gpio_direction_{in,out}put() [ARM] pxa: move pxa_set_mode() from pxa2xx_mainstone.c to mainstone.c [ARM] pxa: move pxa_set_mode() from pxa2xx_lubbock.c to lubbock.c [ARM] pxa: Make cpu_is_pxaXXX dependent on configuration symbols [ARM] pxa: PXA3xx base support [NET] smc91x: fix PXA DMA support code [SERIAL] Fix console initialisation ordering [ARM] pxa: tidy up arch/arm/mach-pxa/Makefile [ARM] Update arch/arm/Kconfig for drivers/Kconfig changes [ARM] 4600/1: fix kernel build failure with build-id-supporting binutils [ARM] 4599/1: Preserve ATAG list for use with kexec (2.6.23) [ARM] Rename consistent_sync() as dma_cache_maint() [ARM] 4572/1: ep93xx: add cirrus logic edb9307 support [ARM] 4596/1: S3C2412: Correct IRQs for SDI+CF and add decoding support [ARM] 4595/1: ns9xxx: define registers as void __iomem * instead of volatile u32 [ARM] 4594/1: ns9xxx: use the new gpio functions [ARM] 4593/1: ns9xxx: implement generic clockevents ...
Diffstat (limited to 'arch/arm/mach-omap1')
-rw-r--r--arch/arm/mach-omap1/Kconfig38
-rw-r--r--arch/arm/mach-omap1/Makefile3
-rw-r--r--arch/arm/mach-omap1/board-ams-delta.c120
-rw-r--r--arch/arm/mach-omap1/board-h2.c79
-rw-r--r--arch/arm/mach-omap1/board-h3.c41
-rw-r--r--arch/arm/mach-omap1/board-nokia770.c98
-rw-r--r--arch/arm/mach-omap1/board-osk.c55
-rw-r--r--arch/arm/mach-omap1/board-palmte.c377
-rw-r--r--arch/arm/mach-omap1/board-palmtt.c357
-rw-r--r--arch/arm/mach-omap1/board-palmz71.c383
-rw-r--r--arch/arm/mach-omap1/board-sx1.c494
-rw-r--r--arch/arm/mach-omap1/board-voiceblue.c2
-rw-r--r--arch/arm/mach-omap1/clock.c34
-rw-r--r--arch/arm/mach-omap1/clock.h35
-rw-r--r--arch/arm/mach-omap1/leds-innovator.c3
-rw-r--r--arch/arm/mach-omap1/mux.c24
-rw-r--r--arch/arm/mach-omap1/pm.c5
17 files changed, 2099 insertions, 49 deletions
diff --git a/arch/arm/mach-omap1/Kconfig b/arch/arm/mach-omap1/Kconfig
index f6ecdd3a2478..79f0b1f8497b 100644
--- a/arch/arm/mach-omap1/Kconfig
+++ b/arch/arm/mach-omap1/Kconfig
@@ -84,11 +84,39 @@ config MACH_OMAP_PALMTE
84 bool "Palm Tungsten E" 84 bool "Palm Tungsten E"
85 depends on ARCH_OMAP1 && ARCH_OMAP15XX 85 depends on ARCH_OMAP1 && ARCH_OMAP15XX
86 help 86 help
87 Support for the Palm Tungsten E PDA. Currently only the LCD panel 87 Support for the Palm Tungsten E PDA. To boot the kernel, you'll
88 is supported. To boot the kernel, you'll need a PalmOS compatible 88 need a PalmOS compatible bootloader; check out
89 bootloader; check out http://palmtelinux.sourceforge.net for more 89 http://palmtelinux.sourceforge.net/ for more information.
90 information. 90 Say Y here if you have this PDA model, say N otherwise.
91 Say Y here if you have such a PDA, say NO otherwise. 91
92config MACH_OMAP_PALMZ71
93 bool "Palm Zire71"
94 depends on ARCH_OMAP1 && ARCH_OMAP15XX
95 help
96 Support for the Palm Zire71 PDA. To boot the kernel,
97 you'll need a PalmOS compatible bootloader; check out
98 http://hackndev.com/palm/z71 for more informations.
99 Say Y here if you have such a PDA, say N otherwise.
100
101config MACH_OMAP_PALMTT
102 bool "Palm Tungsten|T"
103 depends on ARCH_OMAP1 && ARCH_OMAP15XX
104 help
105 Support for the Palm Tungsten|T PDA. To boot the kernel, you'll
106 need a PalmOS compatible bootloader (Garux); check out
107 http://www.hackndev.com/palm/tt/ for more information.
108 Say Y here if you have this PDA model, say N otherwise.
109
110config MACH_SX1
111 bool "Siemens SX1"
112 depends on ARCH_OMAP1 && ARCH_OMAP15XX
113 help
114 Support for the Siemens SX1 phone. To boot the kernel,
115 you'll need a SX1 compatible bootloader; check out
116 http://forum.oslik.ru and
117 http://www.handhelds.org/moin/moin.cgi/SiemensSX1
118 for more information.
119 Say Y here if you have such a phone, say NO otherwise.
92 120
93config MACH_NOKIA770 121config MACH_NOKIA770
94 bool "Nokia 770" 122 bool "Nokia 770"
diff --git a/arch/arm/mach-omap1/Makefile b/arch/arm/mach-omap1/Makefile
index a8b9a00cea22..391b6f4827f6 100644
--- a/arch/arm/mach-omap1/Makefile
+++ b/arch/arm/mach-omap1/Makefile
@@ -22,8 +22,11 @@ obj-$(CONFIG_MACH_OMAP_OSK) += board-osk.o
22obj-$(CONFIG_MACH_OMAP_H3) += board-h3.o 22obj-$(CONFIG_MACH_OMAP_H3) += board-h3.o
23obj-$(CONFIG_MACH_VOICEBLUE) += board-voiceblue.o 23obj-$(CONFIG_MACH_VOICEBLUE) += board-voiceblue.o
24obj-$(CONFIG_MACH_OMAP_PALMTE) += board-palmte.o 24obj-$(CONFIG_MACH_OMAP_PALMTE) += board-palmte.o
25obj-$(CONFIG_MACH_OMAP_PALMZ71) += board-palmz71.o
26obj-$(CONFIG_MACH_OMAP_PALMTT) += board-palmtt.o
25obj-$(CONFIG_MACH_NOKIA770) += board-nokia770.o 27obj-$(CONFIG_MACH_NOKIA770) += board-nokia770.o
26obj-$(CONFIG_MACH_AMS_DELTA) += board-ams-delta.o 28obj-$(CONFIG_MACH_AMS_DELTA) += board-ams-delta.o
29obj-$(CONFIG_MACH_SX1) += board-sx1.o
27 30
28ifeq ($(CONFIG_ARCH_OMAP15XX),y) 31ifeq ($(CONFIG_ARCH_OMAP15XX),y)
29# Innovator-1510 FPGA 32# Innovator-1510 FPGA
diff --git a/arch/arm/mach-omap1/board-ams-delta.c b/arch/arm/mach-omap1/board-ams-delta.c
index 8437d065ada5..c73ca61e585e 100644
--- a/arch/arm/mach-omap1/board-ams-delta.c
+++ b/arch/arm/mach-omap1/board-ams-delta.c
@@ -14,6 +14,7 @@
14 14
15#include <linux/kernel.h> 15#include <linux/kernel.h>
16#include <linux/init.h> 16#include <linux/init.h>
17#include <linux/input.h>
17#include <linux/platform_device.h> 18#include <linux/platform_device.h>
18 19
19#include <asm/hardware.h> 20#include <asm/hardware.h>
@@ -23,6 +24,7 @@
23 24
24#include <asm/arch/board-ams-delta.h> 25#include <asm/arch/board-ams-delta.h>
25#include <asm/arch/gpio.h> 26#include <asm/arch/gpio.h>
27#include <asm/arch/keypad.h>
26#include <asm/arch/mux.h> 28#include <asm/arch/mux.h>
27#include <asm/arch/usb.h> 29#include <asm/arch/usb.h>
28#include <asm/arch/board.h> 30#include <asm/arch/board.h>
@@ -31,6 +33,86 @@
31static u8 ams_delta_latch1_reg; 33static u8 ams_delta_latch1_reg;
32static u16 ams_delta_latch2_reg; 34static u16 ams_delta_latch2_reg;
33 35
36static int ams_delta_keymap[] = {
37 KEY(0, 0, KEY_F1), /* Advert */
38
39 KEY(3, 0, KEY_COFFEE), /* Games */
40 KEY(2, 0, KEY_QUESTION), /* Directory */
41 KEY(3, 2, KEY_CONNECT), /* Internet */
42 KEY(2, 1, KEY_SHOP), /* Services */
43 KEY(1, 1, KEY_PHONE), /* VoiceMail */
44
45 KEY(1, 0, KEY_DELETE), /* Delete */
46 KEY(2, 2, KEY_PLAY), /* Play */
47 KEY(0, 1, KEY_PAGEUP), /* Up */
48 KEY(3, 1, KEY_PAGEDOWN), /* Down */
49 KEY(0, 2, KEY_EMAIL), /* ReadEmail */
50 KEY(1, 2, KEY_STOP), /* Stop */
51
52 /* Numeric keypad portion */
53 KEY(7, 0, KEY_KP1),
54 KEY(6, 0, KEY_KP2),
55 KEY(5, 0, KEY_KP3),
56 KEY(7, 1, KEY_KP4),
57 KEY(6, 1, KEY_KP5),
58 KEY(5, 1, KEY_KP6),
59 KEY(7, 2, KEY_KP7),
60 KEY(6, 2, KEY_KP8),
61 KEY(5, 2, KEY_KP9),
62 KEY(6, 3, KEY_KP0),
63 KEY(7, 3, KEY_KPASTERISK),
64 KEY(5, 3, KEY_KPDOT), /* # key */
65 KEY(2, 7, KEY_NUMLOCK), /* Mute */
66 KEY(1, 7, KEY_KPMINUS), /* Recall */
67 KEY(1, 6, KEY_KPPLUS), /* Redial */
68 KEY(6, 7, KEY_KPSLASH), /* Handsfree */
69 KEY(0, 6, KEY_ENTER), /* Video */
70
71 KEY(4, 7, KEY_CAMERA), /* Photo */
72
73 KEY(4, 0, KEY_F2), /* Home */
74 KEY(4, 1, KEY_F3), /* Office */
75 KEY(4, 2, KEY_F4), /* Mobile */
76 KEY(7, 7, KEY_F5), /* SMS */
77 KEY(5, 7, KEY_F6), /* Email */
78
79 /* QWERTY portion of keypad */
80 KEY(4, 3, KEY_Q),
81 KEY(3, 3, KEY_W),
82 KEY(2, 3, KEY_E),
83 KEY(1, 3, KEY_R),
84 KEY(0, 3, KEY_T),
85 KEY(7, 4, KEY_Y),
86 KEY(6, 4, KEY_U),
87 KEY(5, 4, KEY_I),
88 KEY(4, 4, KEY_O),
89 KEY(3, 4, KEY_P),
90
91 KEY(2, 4, KEY_A),
92 KEY(1, 4, KEY_S),
93 KEY(0, 4, KEY_D),
94 KEY(7, 5, KEY_F),
95 KEY(6, 5, KEY_G),
96 KEY(5, 5, KEY_H),
97 KEY(4, 5, KEY_J),
98 KEY(3, 5, KEY_K),
99 KEY(2, 5, KEY_L),
100
101 KEY(1, 5, KEY_Z),
102 KEY(0, 5, KEY_X),
103 KEY(7, 6, KEY_C),
104 KEY(6, 6, KEY_V),
105 KEY(5, 6, KEY_B),
106 KEY(4, 6, KEY_N),
107 KEY(3, 6, KEY_M),
108 KEY(2, 6, KEY_SPACE),
109
110 KEY(0, 7, KEY_LEFTSHIFT), /* Vol up */
111 KEY(3, 7, KEY_LEFTCTRL), /* Vol down */
112
113 0
114};
115
34void ams_delta_latch1_write(u8 mask, u8 value) 116void ams_delta_latch1_write(u8 mask, u8 value)
35{ 117{
36 ams_delta_latch1_reg &= ~mask; 118 ams_delta_latch1_reg &= ~mask;
@@ -76,6 +158,10 @@ static struct map_desc ams_delta_io_desc[] __initdata = {
76 } 158 }
77}; 159};
78 160
161static struct omap_lcd_config ams_delta_lcd_config __initdata = {
162 .ctrl_name = "internal",
163};
164
79static struct omap_uart_config ams_delta_uart_config __initdata = { 165static struct omap_uart_config ams_delta_uart_config __initdata = {
80 .enabled_uarts = 1, 166 .enabled_uarts = 1,
81}; 167};
@@ -87,16 +173,50 @@ static struct omap_usb_config ams_delta_usb_config __initdata = {
87}; 173};
88 174
89static struct omap_board_config_kernel ams_delta_config[] = { 175static struct omap_board_config_kernel ams_delta_config[] = {
176 { OMAP_TAG_LCD, &ams_delta_lcd_config },
90 { OMAP_TAG_UART, &ams_delta_uart_config }, 177 { OMAP_TAG_UART, &ams_delta_uart_config },
91 { OMAP_TAG_USB, &ams_delta_usb_config }, 178 { OMAP_TAG_USB, &ams_delta_usb_config },
92}; 179};
93 180
181static struct resource ams_delta_kp_resources[] = {
182 [0] = {
183 .start = INT_KEYBOARD,
184 .end = INT_KEYBOARD,
185 .flags = IORESOURCE_IRQ,
186 },
187};
188
189static struct omap_kp_platform_data ams_delta_kp_data = {
190 .rows = 8,
191 .cols = 8,
192 .keymap = ams_delta_keymap,
193 .keymapsize = ARRAY_SIZE(ams_delta_keymap),
194 .delay = 9,
195};
196
197static struct platform_device ams_delta_kp_device = {
198 .name = "omap-keypad",
199 .id = -1,
200 .dev = {
201 .platform_data = &ams_delta_kp_data,
202 },
203 .num_resources = ARRAY_SIZE(ams_delta_kp_resources),
204 .resource = ams_delta_kp_resources,
205};
206
207static struct platform_device ams_delta_lcd_device = {
208 .name = "lcd_ams_delta",
209 .id = -1,
210};
211
94static struct platform_device ams_delta_led_device = { 212static struct platform_device ams_delta_led_device = {
95 .name = "ams-delta-led", 213 .name = "ams-delta-led",
96 .id = -1 214 .id = -1
97}; 215};
98 216
99static struct platform_device *ams_delta_devices[] __initdata = { 217static struct platform_device *ams_delta_devices[] __initdata = {
218 &ams_delta_kp_device,
219 &ams_delta_lcd_device,
100 &ams_delta_led_device, 220 &ams_delta_led_device,
101}; 221};
102 222
diff --git a/arch/arm/mach-omap1/board-h2.c b/arch/arm/mach-omap1/board-h2.c
index 2f8f6ecf111f..b0921622566f 100644
--- a/arch/arm/mach-omap1/board-h2.c
+++ b/arch/arm/mach-omap1/board-h2.c
@@ -140,6 +140,66 @@ static struct platform_device h2_nor_device = {
140 .resource = &h2_nor_resource, 140 .resource = &h2_nor_resource,
141}; 141};
142 142
143#if 0 /* REVISIT: Enable when nand_platform_data is applied */
144
145static struct mtd_partition h2_nand_partitions[] = {
146#if 0
147 /* REVISIT: enable these partitions if you make NAND BOOT
148 * work on your H2 (rev C or newer); published versions of
149 * x-load only support P2 and H3.
150 */
151 {
152 .name = "xloader",
153 .offset = 0,
154 .size = 64 * 1024,
155 .mask_flags = MTD_WRITEABLE, /* force read-only */
156 },
157 {
158 .name = "bootloader",
159 .offset = MTDPART_OFS_APPEND,
160 .size = 256 * 1024,
161 .mask_flags = MTD_WRITEABLE, /* force read-only */
162 },
163 {
164 .name = "params",
165 .offset = MTDPART_OFS_APPEND,
166 .size = 192 * 1024,
167 },
168 {
169 .name = "kernel",
170 .offset = MTDPART_OFS_APPEND,
171 .size = 2 * SZ_1M,
172 },
173#endif
174 {
175 .name = "filesystem",
176 .size = MTDPART_SIZ_FULL,
177 .offset = MTDPART_OFS_APPEND,
178 },
179};
180
181/* dip switches control NAND chip access: 8 bit, 16 bit, or neither */
182static struct nand_platform_data h2_nand_data = {
183 .options = NAND_SAMSUNG_LP_OPTIONS,
184 .parts = h2_nand_partitions,
185 .nr_parts = ARRAY_SIZE(h2_nand_partitions),
186};
187
188static struct resource h2_nand_resource = {
189 .flags = IORESOURCE_MEM,
190};
191
192static struct platform_device h2_nand_device = {
193 .name = "omapnand",
194 .id = 0,
195 .dev = {
196 .platform_data = &h2_nand_data,
197 },
198 .num_resources = 1,
199 .resource = &h2_nand_resource,
200};
201#endif
202
143static struct resource h2_smc91x_resources[] = { 203static struct resource h2_smc91x_resources[] = {
144 [0] = { 204 [0] = {
145 .start = OMAP1610_ETHR_START, /* Physical */ 205 .start = OMAP1610_ETHR_START, /* Physical */
@@ -219,11 +279,15 @@ static struct resource h2_irda_resources[] = {
219 .flags = IORESOURCE_IRQ, 279 .flags = IORESOURCE_IRQ,
220 }, 280 },
221}; 281};
282
283static u64 irda_dmamask = 0xffffffff;
284
222static struct platform_device h2_irda_device = { 285static struct platform_device h2_irda_device = {
223 .name = "omapirda", 286 .name = "omapirda",
224 .id = 0, 287 .id = 0,
225 .dev = { 288 .dev = {
226 .platform_data = &h2_irda_data, 289 .platform_data = &h2_irda_data,
290 .dma_mask = &irda_dmamask,
227 }, 291 },
228 .num_resources = ARRAY_SIZE(h2_irda_resources), 292 .num_resources = ARRAY_SIZE(h2_irda_resources),
229 .resource = h2_irda_resources, 293 .resource = h2_irda_resources,
@@ -271,6 +335,7 @@ static struct platform_device h2_mcbsp1_device = {
271 335
272static struct platform_device *h2_devices[] __initdata = { 336static struct platform_device *h2_devices[] __initdata = {
273 &h2_nor_device, 337 &h2_nor_device,
338 //&h2_nand_device,
274 &h2_smc91x_device, 339 &h2_smc91x_device,
275 &h2_irda_device, 340 &h2_irda_device,
276 &h2_kp_device, 341 &h2_kp_device,
@@ -348,6 +413,13 @@ static struct omap_board_config_kernel h2_config[] __initdata = {
348 { OMAP_TAG_LCD, &h2_lcd_config }, 413 { OMAP_TAG_LCD, &h2_lcd_config },
349}; 414};
350 415
416#define H2_NAND_RB_GPIO_PIN 62
417
418static int h2_nand_dev_ready(struct nand_platform_data *data)
419{
420 return omap_get_gpio_datain(H2_NAND_RB_GPIO_PIN);
421}
422
351static void __init h2_init(void) 423static void __init h2_init(void)
352{ 424{
353 /* Here we assume the NOR boot config: NOR on CS3 (possibly swapped 425 /* Here we assume the NOR boot config: NOR on CS3 (possibly swapped
@@ -362,6 +434,13 @@ static void __init h2_init(void)
362 h2_nor_resource.end = h2_nor_resource.start = omap_cs3_phys(); 434 h2_nor_resource.end = h2_nor_resource.start = omap_cs3_phys();
363 h2_nor_resource.end += SZ_32M - 1; 435 h2_nor_resource.end += SZ_32M - 1;
364 436
437#if 0 /* REVISIT: Enable when nand_platform_data is applied */
438 h2_nand_resource.end = h2_nand_resource.start = OMAP_CS2B_PHYS;
439 h2_nand_resource.end += SZ_4K - 1;
440 if (!(omap_request_gpio(H2_NAND_RB_GPIO_PIN)))
441 h2_nand_data.dev_ready = h2_nand_dev_ready;
442#endif
443
365 omap_cfg_reg(L3_1610_FLASH_CS2B_OE); 444 omap_cfg_reg(L3_1610_FLASH_CS2B_OE);
366 omap_cfg_reg(M8_1610_FLASH_CS2B_WE); 445 omap_cfg_reg(M8_1610_FLASH_CS2B_WE);
367 446
diff --git a/arch/arm/mach-omap1/board-h3.c b/arch/arm/mach-omap1/board-h3.c
index add2f703204f..4f84ae273a1f 100644
--- a/arch/arm/mach-omap1/board-h3.c
+++ b/arch/arm/mach-omap1/board-h3.c
@@ -47,6 +47,8 @@
47#include <asm/arch/keypad.h> 47#include <asm/arch/keypad.h>
48#include <asm/arch/dma.h> 48#include <asm/arch/dma.h>
49#include <asm/arch/common.h> 49#include <asm/arch/common.h>
50#include <asm/arch/mcbsp.h>
51#include <asm/arch/omap-alsa.h>
50 52
51extern int omap_gpio_init(void); 53extern int omap_gpio_init(void);
52 54
@@ -354,11 +356,14 @@ static struct resource h3_irda_resources[] = {
354 }, 356 },
355}; 357};
356 358
359static u64 irda_dmamask = 0xffffffff;
360
357static struct platform_device h3_irda_device = { 361static struct platform_device h3_irda_device = {
358 .name = "omapirda", 362 .name = "omapirda",
359 .id = 0, 363 .id = 0,
360 .dev = { 364 .dev = {
361 .platform_data = &h3_irda_data, 365 .platform_data = &h3_irda_data,
366 .dma_mask = &irda_dmamask,
362 }, 367 },
363 .num_resources = ARRAY_SIZE(h3_irda_resources), 368 .num_resources = ARRAY_SIZE(h3_irda_resources),
364 .resource = h3_irda_resources, 369 .resource = h3_irda_resources,
@@ -369,6 +374,41 @@ static struct platform_device h3_lcd_device = {
369 .id = -1, 374 .id = -1,
370}; 375};
371 376
377static struct omap_mcbsp_reg_cfg mcbsp_regs = {
378 .spcr2 = FREE | FRST | GRST | XRST | XINTM(3),
379 .spcr1 = RINTM(3) | RRST,
380 .rcr2 = RPHASE | RFRLEN2(OMAP_MCBSP_WORD_8) |
381 RWDLEN2(OMAP_MCBSP_WORD_16) | RDATDLY(1),
382 .rcr1 = RFRLEN1(OMAP_MCBSP_WORD_8) | RWDLEN1(OMAP_MCBSP_WORD_16),
383 .xcr2 = XPHASE | XFRLEN2(OMAP_MCBSP_WORD_8) |
384 XWDLEN2(OMAP_MCBSP_WORD_16) | XDATDLY(1) | XFIG,
385 .xcr1 = XFRLEN1(OMAP_MCBSP_WORD_8) | XWDLEN1(OMAP_MCBSP_WORD_16),
386 .srgr1 = FWID(15),
387 .srgr2 = GSYNC | CLKSP | FSGM | FPER(31),
388
389 .pcr0 = CLKRM | SCLKME | FSXP | FSRP | CLKXP | CLKRP,
390 //.pcr0 = CLKXP | CLKRP, /* mcbsp: slave */
391};
392
393static struct omap_alsa_codec_config alsa_config = {
394 .name = "H3 TSC2101",
395 .mcbsp_regs_alsa = &mcbsp_regs,
396 .codec_configure_dev = NULL, // tsc2101_configure,
397 .codec_set_samplerate = NULL, // tsc2101_set_samplerate,
398 .codec_clock_setup = NULL, // tsc2101_clock_setup,
399 .codec_clock_on = NULL, // tsc2101_clock_on,
400 .codec_clock_off = NULL, // tsc2101_clock_off,
401 .get_default_samplerate = NULL, // tsc2101_get_default_samplerate,
402};
403
404static struct platform_device h3_mcbsp1_device = {
405 .name = "omap_alsa_mcbsp",
406 .id = 1,
407 .dev = {
408 .platform_data = &alsa_config,
409 },
410};
411
372static struct platform_device *devices[] __initdata = { 412static struct platform_device *devices[] __initdata = {
373 &nor_device, 413 &nor_device,
374 &nand_device, 414 &nand_device,
@@ -377,6 +417,7 @@ static struct platform_device *devices[] __initdata = {
377 &h3_irda_device, 417 &h3_irda_device,
378 &h3_kp_device, 418 &h3_kp_device,
379 &h3_lcd_device, 419 &h3_lcd_device,
420 &h3_mcbsp1_device,
380}; 421};
381 422
382static struct omap_usb_config h3_usb_config __initdata = { 423static struct omap_usb_config h3_usb_config __initdata = {
diff --git a/arch/arm/mach-omap1/board-nokia770.c b/arch/arm/mach-omap1/board-nokia770.c
index 70014f751bc4..22db19a53647 100644
--- a/arch/arm/mach-omap1/board-nokia770.c
+++ b/arch/arm/mach-omap1/board-nokia770.c
@@ -33,6 +33,12 @@
33#include <asm/arch/dsp_common.h> 33#include <asm/arch/dsp_common.h>
34#include <asm/arch/aic23.h> 34#include <asm/arch/aic23.h>
35#include <asm/arch/gpio.h> 35#include <asm/arch/gpio.h>
36#include <asm/arch/omapfb.h>
37#include <asm/arch/lcd_mipid.h>
38
39#include "../plat-omap/dsp/dsp_common.h"
40
41#define ADS7846_PENDOWN_GPIO 15
36 42
37static void __init omap_nokia770_init_irq(void) 43static void __init omap_nokia770_init_irq(void)
38{ 44{
@@ -91,9 +97,44 @@ static struct platform_device nokia770_kp_device = {
91}; 97};
92 98
93static struct platform_device *nokia770_devices[] __initdata = { 99static struct platform_device *nokia770_devices[] __initdata = {
94 &nokia770_kp_device, 100 &nokia770_kp_device,
101};
102
103static void mipid_shutdown(struct mipid_platform_data *pdata)
104{
105 if (pdata->nreset_gpio != -1) {
106 printk(KERN_INFO "shutdown LCD\n");
107 omap_set_gpio_dataout(pdata->nreset_gpio, 0);
108 msleep(120);
109 }
110}
111
112static struct mipid_platform_data nokia770_mipid_platform_data = {
113 .shutdown = mipid_shutdown,
95}; 114};
96 115
116static void mipid_dev_init(void)
117{
118 const struct omap_lcd_config *conf;
119
120 conf = omap_get_config(OMAP_TAG_LCD, struct omap_lcd_config);
121 if (conf != NULL) {
122 nokia770_mipid_platform_data.nreset_gpio = conf->nreset_gpio;
123 nokia770_mipid_platform_data.data_lines = conf->data_lines;
124 }
125}
126
127static void ads7846_dev_init(void)
128{
129 if (omap_request_gpio(ADS7846_PENDOWN_GPIO) < 0)
130 printk(KERN_ERR "can't get ads7846 pen down GPIO\n");
131}
132
133static int ads7846_get_pendown_state(void)
134{
135 return !omap_get_gpio_datain(ADS7846_PENDOWN_GPIO);
136}
137
97static struct ads7846_platform_data nokia770_ads7846_platform_data __initdata = { 138static struct ads7846_platform_data nokia770_ads7846_platform_data __initdata = {
98 .x_max = 0x0fff, 139 .x_max = 0x0fff,
99 .y_max = 0x0fff, 140 .y_max = 0x0fff,
@@ -101,14 +142,17 @@ static struct ads7846_platform_data nokia770_ads7846_platform_data __initdata =
101 .pressure_max = 255, 142 .pressure_max = 255,
102 .debounce_max = 10, 143 .debounce_max = 10,
103 .debounce_tol = 3, 144 .debounce_tol = 3,
145 .debounce_rep = 1,
146 .get_pendown_state = ads7846_get_pendown_state,
104}; 147};
105 148
106static struct spi_board_info nokia770_spi_board_info[] __initdata = { 149static struct spi_board_info nokia770_spi_board_info[] __initdata = {
107 [0] = { 150 [0] = {
108 .modalias = "lcd_mipid", 151 .modalias = "lcd_mipid",
109 .bus_num = 2, 152 .bus_num = 2,
110 .chip_select = 3, 153 .chip_select = 3,
111 .max_speed_hz = 12000000, 154 .max_speed_hz = 12000000,
155 .platform_data = &nokia770_mipid_platform_data,
112 }, 156 },
113 [1] = { 157 [1] = {
114 .modalias = "ads7846", 158 .modalias = "ads7846",
@@ -153,6 +197,7 @@ static struct omap_board_config_kernel nokia770_config[] = {
153 { OMAP_TAG_MMC, &nokia770_mmc_config }, 197 { OMAP_TAG_MMC, &nokia770_mmc_config },
154}; 198};
155 199
200#if defined(CONFIG_OMAP_DSP)
156/* 201/*
157 * audio power control 202 * audio power control
158 */ 203 */
@@ -183,7 +228,7 @@ static void nokia770_audio_pwr_up(void)
183 clk_enable(dspxor_ck); 228 clk_enable(dspxor_ck);
184 229
185 /* Turn on codec */ 230 /* Turn on codec */
186 tlv320aic23_power_up(); 231 aic23_power_up();
187 232
188 if (omap_get_gpio_datain(HEADPHONE_GPIO)) 233 if (omap_get_gpio_datain(HEADPHONE_GPIO))
189 /* HP not connected, turn on amplifier */ 234 /* HP not connected, turn on amplifier */
@@ -197,7 +242,7 @@ static void codec_delayed_power_down(struct work_struct *work)
197{ 242{
198 down(&audio_pwr_sem); 243 down(&audio_pwr_sem);
199 if (audio_pwr_state == -1) 244 if (audio_pwr_state == -1)
200 tlv320aic23_power_down(); 245 aic23_power_down();
201 clk_disable(dspxor_ck); 246 clk_disable(dspxor_ck);
202 up(&audio_pwr_sem); 247 up(&audio_pwr_sem);
203} 248}
@@ -213,7 +258,8 @@ static void nokia770_audio_pwr_down(void)
213 schedule_delayed_work(&codec_power_down_work, HZ / 20); /* 50ms */ 258 schedule_delayed_work(&codec_power_down_work, HZ / 20); /* 50ms */
214} 259}
215 260
216void nokia770_audio_pwr_up_request(int stage) 261static int
262nokia770_audio_pwr_up_request(struct dsp_kfunc_device *kdev, int stage)
217{ 263{
218 down(&audio_pwr_sem); 264 down(&audio_pwr_sem);
219 if (audio_pwr_state == -1) 265 if (audio_pwr_state == -1)
@@ -221,9 +267,11 @@ void nokia770_audio_pwr_up_request(int stage)
221 /* force audio_pwr_state = 0, even if it was 1. */ 267 /* force audio_pwr_state = 0, even if it was 1. */
222 audio_pwr_state = 0; 268 audio_pwr_state = 0;
223 up(&audio_pwr_sem); 269 up(&audio_pwr_sem);
270 return 0;
224} 271}
225 272
226void nokia770_audio_pwr_down_request(int stage) 273static int
274nokia770_audio_pwr_down_request(struct dsp_kfunc_device *kdev, int stage)
227{ 275{
228 down(&audio_pwr_sem); 276 down(&audio_pwr_sem);
229 switch (stage) { 277 switch (stage) {
@@ -239,8 +287,39 @@ void nokia770_audio_pwr_down_request(int stage)
239 break; 287 break;
240 } 288 }
241 up(&audio_pwr_sem); 289 up(&audio_pwr_sem);
290 return 0;
242} 291}
243 292
293static struct dsp_kfunc_device nokia770_audio_device = {
294 .name = "audio",
295 .type = DSP_KFUNC_DEV_TYPE_AUDIO,
296 .enable = nokia770_audio_pwr_up_request,
297 .disable = nokia770_audio_pwr_down_request,
298};
299
300static __init int omap_dsp_init(void)
301{
302 int ret;
303
304 dspxor_ck = clk_get(0, "dspxor_ck");
305 if (IS_ERR(dspxor_ck)) {
306 printk(KERN_ERR "couldn't acquire dspxor_ck\n");
307 return PTR_ERR(dspxor_ck);
308 }
309
310 ret = dsp_kfunc_device_register(&nokia770_audio_device);
311 if (ret) {
312 printk(KERN_ERR
313 "KFUNC device registration faild: %s\n",
314 nokia770_audio_device.name);
315 goto out;
316 }
317 return 0;
318 out:
319 return ret;
320}
321#endif /* CONFIG_OMAP_DSP */
322
244static void __init omap_nokia770_init(void) 323static void __init omap_nokia770_init(void)
245{ 324{
246 nokia770_config[0].data = &nokia770_usb_config; 325 nokia770_config[0].data = &nokia770_usb_config;
@@ -250,10 +329,11 @@ static void __init omap_nokia770_init(void)
250 ARRAY_SIZE(nokia770_spi_board_info)); 329 ARRAY_SIZE(nokia770_spi_board_info));
251 omap_board_config = nokia770_config; 330 omap_board_config = nokia770_config;
252 omap_board_config_size = ARRAY_SIZE(nokia770_config); 331 omap_board_config_size = ARRAY_SIZE(nokia770_config);
332 omap_gpio_init();
253 omap_serial_init(); 333 omap_serial_init();
254 omap_dsp_audio_pwr_up_request = nokia770_audio_pwr_up_request; 334 omap_dsp_init();
255 omap_dsp_audio_pwr_down_request = nokia770_audio_pwr_down_request; 335 ads7846_dev_init();
256 dspxor_ck = clk_get(0, "dspxor_ck"); 336 mipid_dev_init();
257} 337}
258 338
259static void __init omap_nokia770_map_io(void) 339static void __init omap_nokia770_map_io(void)
diff --git a/arch/arm/mach-omap1/board-osk.c b/arch/arm/mach-omap1/board-osk.c
index a61bf455ee02..5db182da322b 100644
--- a/arch/arm/mach-omap1/board-osk.c
+++ b/arch/arm/mach-omap1/board-osk.c
@@ -29,6 +29,7 @@
29#include <linux/kernel.h> 29#include <linux/kernel.h>
30#include <linux/init.h> 30#include <linux/init.h>
31#include <linux/platform_device.h> 31#include <linux/platform_device.h>
32#include <linux/interrupt.h>
32#include <linux/irq.h> 33#include <linux/irq.h>
33#include <linux/interrupt.h> 34#include <linux/interrupt.h>
34#include <linux/i2c.h> 35#include <linux/i2c.h>
@@ -308,6 +309,18 @@ static struct platform_device osk5912_kp_device = {
308 .resource = osk5912_kp_resources, 309 .resource = osk5912_kp_resources,
309}; 310};
310 311
312static struct omap_backlight_config mistral_bl_data = {
313 .default_intensity = 0xa0,
314};
315
316static struct platform_device mistral_bl_device = {
317 .name = "omap-bl",
318 .id = -1,
319 .dev = {
320 .platform_data = &mistral_bl_data,
321 },
322};
323
311static struct platform_device osk5912_lcd_device = { 324static struct platform_device osk5912_lcd_device = {
312 .name = "lcd_osk", 325 .name = "lcd_osk",
313 .id = -1, 326 .id = -1,
@@ -315,6 +328,7 @@ static struct platform_device osk5912_lcd_device = {
315 328
316static struct platform_device *mistral_devices[] __initdata = { 329static struct platform_device *mistral_devices[] __initdata = {
317 &osk5912_kp_device, 330 &osk5912_kp_device,
331 &mistral_bl_device,
318 &osk5912_lcd_device, 332 &osk5912_lcd_device,
319}; 333};
320 334
@@ -358,6 +372,38 @@ static void __init osk_mistral_init(void)
358 * can't talk to the ads or even the i2c eeprom. 372 * can't talk to the ads or even the i2c eeprom.
359 */ 373 */
360 374
375 /* parallel camera interface */
376 omap_cfg_reg(J15_1610_CAM_LCLK);
377 omap_cfg_reg(J18_1610_CAM_D7);
378 omap_cfg_reg(J19_1610_CAM_D6);
379 omap_cfg_reg(J14_1610_CAM_D5);
380 omap_cfg_reg(K18_1610_CAM_D4);
381 omap_cfg_reg(K19_1610_CAM_D3);
382 omap_cfg_reg(K15_1610_CAM_D2);
383 omap_cfg_reg(K14_1610_CAM_D1);
384 omap_cfg_reg(L19_1610_CAM_D0);
385 omap_cfg_reg(L18_1610_CAM_VS);
386 omap_cfg_reg(L15_1610_CAM_HS);
387 omap_cfg_reg(M19_1610_CAM_RSTZ);
388 omap_cfg_reg(Y15_1610_CAM_OUTCLK);
389
390 /* serial camera interface */
391 omap_cfg_reg(H19_1610_CAM_EXCLK);
392 omap_cfg_reg(W13_1610_CCP_CLKM);
393 omap_cfg_reg(Y12_1610_CCP_CLKP);
394 /* CCP_DATAM CONFLICTS WITH UART1.TX (and serial console) */
395 // omap_cfg_reg(Y14_1610_CCP_DATAM);
396 omap_cfg_reg(W14_1610_CCP_DATAP);
397
398 /* CAM_PWDN */
399 if (omap_request_gpio(11) == 0) {
400 omap_cfg_reg(N20_1610_GPIO11);
401 omap_set_gpio_direction(11, 0 /* out */);
402 omap_set_gpio_dataout(11, 0 /* off */);
403 } else
404 pr_debug("OSK+Mistral: CAM_PWDN is awol\n");
405
406
361 // omap_cfg_reg(P19_1610_GPIO6); // BUSY 407 // omap_cfg_reg(P19_1610_GPIO6); // BUSY
362 omap_cfg_reg(P20_1610_GPIO4); // PENIRQ 408 omap_cfg_reg(P20_1610_GPIO4); // PENIRQ
363 set_irq_type(OMAP_GPIO_IRQ(4), IRQT_FALLING); 409 set_irq_type(OMAP_GPIO_IRQ(4), IRQT_FALLING);
@@ -388,6 +434,15 @@ static void __init osk_mistral_init(void)
388 } else 434 } else
389 printk(KERN_ERR "OSK+Mistral: wakeup button is awol\n"); 435 printk(KERN_ERR "OSK+Mistral: wakeup button is awol\n");
390 436
437 /* LCD: backlight, and power; power controls other devices on the
438 * board, like the touchscreen, EEPROM, and wakeup (!) switch.
439 */
440 omap_cfg_reg(PWL);
441 if (omap_request_gpio(2) == 0) {
442 omap_set_gpio_direction(2, 0 /* out */);
443 omap_set_gpio_dataout(2, 1 /* on */);
444 }
445
391 platform_add_devices(mistral_devices, ARRAY_SIZE(mistral_devices)); 446 platform_add_devices(mistral_devices, ARRAY_SIZE(mistral_devices));
392} 447}
393#else 448#else
diff --git a/arch/arm/mach-omap1/board-palmte.c b/arch/arm/mach-omap1/board-palmte.c
index 015824185629..2f9d00a00135 100644
--- a/arch/arm/mach-omap1/board-palmte.c
+++ b/arch/arm/mach-omap1/board-palmte.c
@@ -17,49 +17,189 @@
17 17
18#include <linux/kernel.h> 18#include <linux/kernel.h>
19#include <linux/init.h> 19#include <linux/init.h>
20#include <linux/input.h>
20#include <linux/platform_device.h> 21#include <linux/platform_device.h>
21#include <linux/notifier.h> 22#include <linux/mtd/mtd.h>
22#include <linux/clk.h> 23#include <linux/mtd/partitions.h>
24#include <linux/spi/spi.h>
25#include <linux/spi/tsc2102.h>
26#include <linux/interrupt.h>
23 27
28#include <asm/apm.h>
24#include <asm/hardware.h> 29#include <asm/hardware.h>
25#include <asm/mach-types.h> 30#include <asm/mach-types.h>
26#include <asm/mach/arch.h> 31#include <asm/mach/arch.h>
27#include <asm/mach/map.h> 32#include <asm/mach/map.h>
33#include <asm/mach/flash.h>
28 34
29#include <asm/arch/gpio.h> 35#include <asm/arch/gpio.h>
30#include <asm/arch/mux.h> 36#include <asm/arch/mux.h>
31#include <asm/arch/usb.h> 37#include <asm/arch/usb.h>
38#include <asm/arch/tc.h>
39#include <asm/arch/dma.h>
32#include <asm/arch/board.h> 40#include <asm/arch/board.h>
41#include <asm/arch/irda.h>
42#include <asm/arch/keypad.h>
33#include <asm/arch/common.h> 43#include <asm/arch/common.h>
44#include <asm/arch/mcbsp.h>
45#include <asm/arch/omap-alsa.h>
34 46
35static void __init omap_generic_init_irq(void) 47static void __init omap_palmte_init_irq(void)
36{ 48{
37 omap1_init_common_hw(); 49 omap1_init_common_hw();
38 omap_init_irq(); 50 omap_init_irq();
51 omap_gpio_init();
39} 52}
40 53
54static int palmte_keymap[] = {
55 KEY(0, 0, KEY_F1),
56 KEY(0, 1, KEY_F2),
57 KEY(0, 2, KEY_F3),
58 KEY(0, 3, KEY_F4),
59 KEY(0, 4, KEY_POWER),
60 KEY(1, 0, KEY_LEFT),
61 KEY(1, 1, KEY_DOWN),
62 KEY(1, 2, KEY_UP),
63 KEY(1, 3, KEY_RIGHT),
64 KEY(1, 4, KEY_CENTER),
65 0,
66};
67
68static struct omap_kp_platform_data palmte_kp_data = {
69 .rows = 8,
70 .cols = 8,
71 .keymap = palmte_keymap,
72 .rep = 1,
73 .delay = 12,
74};
75
76static struct resource palmte_kp_resources[] = {
77 [0] = {
78 .start = INT_KEYBOARD,
79 .end = INT_KEYBOARD,
80 .flags = IORESOURCE_IRQ,
81 },
82};
83
84static struct platform_device palmte_kp_device = {
85 .name = "omap-keypad",
86 .id = -1,
87 .dev = {
88 .platform_data = &palmte_kp_data,
89 },
90 .num_resources = ARRAY_SIZE(palmte_kp_resources),
91 .resource = palmte_kp_resources,
92};
93
94static struct mtd_partition palmte_rom_partitions[] = {
95 /* PalmOS "Small ROM", contains the bootloader and the debugger */
96 {
97 .name = "smallrom",
98 .offset = 0,
99 .size = 0xa000,
100 .mask_flags = MTD_WRITEABLE,
101 },
102 /* PalmOS "Big ROM", a filesystem with all the OS code and data */
103 {
104 .name = "bigrom",
105 .offset = SZ_128K,
106 /*
107 * 0x5f0000 bytes big in the multi-language ("EFIGS") version,
108 * 0x7b0000 bytes in the English-only ("enUS") version.
109 */
110 .size = 0x7b0000,
111 .mask_flags = MTD_WRITEABLE,
112 },
113};
114
115static struct flash_platform_data palmte_rom_data = {
116 .map_name = "map_rom",
117 .width = 2,
118 .parts = palmte_rom_partitions,
119 .nr_parts = ARRAY_SIZE(palmte_rom_partitions),
120};
121
122static struct resource palmte_rom_resource = {
123 .start = OMAP_CS0_PHYS,
124 .end = OMAP_CS0_PHYS + SZ_8M - 1,
125 .flags = IORESOURCE_MEM,
126};
127
128static struct platform_device palmte_rom_device = {
129 .name = "omapflash",
130 .id = -1,
131 .dev = {
132 .platform_data = &palmte_rom_data,
133 },
134 .num_resources = 1,
135 .resource = &palmte_rom_resource,
136};
137
41static struct platform_device palmte_lcd_device = { 138static struct platform_device palmte_lcd_device = {
42 .name = "lcd_palmte", 139 .name = "lcd_palmte",
43 .id = -1, 140 .id = -1,
44}; 141};
45 142
143static struct omap_backlight_config palmte_backlight_config = {
144 .default_intensity = 0xa0,
145};
146
147static struct platform_device palmte_backlight_device = {
148 .name = "omap-bl",
149 .id = -1,
150 .dev = {
151 .platform_data = &palmte_backlight_config,
152 },
153};
154
155static struct omap_irda_config palmte_irda_config = {
156 .transceiver_cap = IR_SIRMODE,
157 .rx_channel = OMAP_DMA_UART3_RX,
158 .tx_channel = OMAP_DMA_UART3_TX,
159 .dest_start = UART3_THR,
160 .src_start = UART3_RHR,
161 .tx_trigger = 0,
162 .rx_trigger = 0,
163};
164
165static struct resource palmte_irda_resources[] = {
166 [0] = {
167 .start = INT_UART3,
168 .end = INT_UART3,
169 .flags = IORESOURCE_IRQ,
170 },
171};
172
173static struct platform_device palmte_irda_device = {
174 .name = "omapirda",
175 .id = -1,
176 .dev = {
177 .platform_data = &palmte_irda_config,
178 },
179 .num_resources = ARRAY_SIZE(palmte_irda_resources),
180 .resource = palmte_irda_resources,
181};
182
46static struct platform_device *devices[] __initdata = { 183static struct platform_device *devices[] __initdata = {
184 &palmte_rom_device,
185 &palmte_kp_device,
47 &palmte_lcd_device, 186 &palmte_lcd_device,
187 &palmte_backlight_device,
188 &palmte_irda_device,
48}; 189};
49 190
50static struct omap_usb_config palmte_usb_config __initdata = { 191static struct omap_usb_config palmte_usb_config __initdata = {
51 .register_dev = 1, 192 .register_dev = 1, /* Mini-B only receptacle */
52 .hmc_mode = 0, 193 .hmc_mode = 0,
53 .pins[0] = 3, 194 .pins[0] = 2,
54}; 195};
55 196
56static struct omap_mmc_config palmte_mmc_config __initdata = { 197static struct omap_mmc_config palmte_mmc_config __initdata = {
57 .mmc [0] = { 198 .mmc[0] = {
58 .enabled = 1, 199 .enabled = 1,
59 .wire4 = 1, 200 .wp_pin = PALMTE_MMC_WP_GPIO,
60 .wp_pin = OMAP_MPUIO(3), 201 .power_pin = PALMTE_MMC_POWER_GPIO,
61 .power_pin = -1, 202 .switch_pin = PALMTE_MMC_SWITCH_GPIO,
62 .switch_pin = -1,
63 }, 203 },
64}; 204};
65 205
@@ -67,21 +207,222 @@ static struct omap_lcd_config palmte_lcd_config __initdata = {
67 .ctrl_name = "internal", 207 .ctrl_name = "internal",
68}; 208};
69 209
210static struct omap_uart_config palmte_uart_config __initdata = {
211 .enabled_uarts = (1 << 0) | (1 << 1) | (0 << 2),
212};
213
214static struct omap_mcbsp_reg_cfg palmte_mcbsp1_regs = {
215 .spcr2 = FRST | GRST | XRST | XINTM(3),
216 .xcr2 = XDATDLY(1) | XFIG,
217 .xcr1 = XWDLEN1(OMAP_MCBSP_WORD_32),
218 .pcr0 = SCLKME | FSXP | CLKXP,
219};
220
221static struct omap_alsa_codec_config palmte_alsa_config = {
222 .name = "TSC2102 audio",
223 .mcbsp_regs_alsa = &palmte_mcbsp1_regs,
224 .codec_configure_dev = NULL, /* tsc2102_configure, */
225 .codec_set_samplerate = NULL, /* tsc2102_set_samplerate, */
226 .codec_clock_setup = NULL, /* tsc2102_clock_setup, */
227 .codec_clock_on = NULL, /* tsc2102_clock_on, */
228 .codec_clock_off = NULL, /* tsc2102_clock_off, */
229 .get_default_samplerate = NULL, /* tsc2102_get_default_samplerate, */
230};
231
232#ifdef CONFIG_APM
233/*
234 * Values measured in 10 minute intervals averaged over 10 samples.
235 * May differ slightly from device to device but should be accurate
236 * enough to give basic idea of battery life left and trigger
237 * potential alerts.
238 */
239static const int palmte_battery_sample[] = {
240 2194, 2157, 2138, 2120,
241 2104, 2089, 2075, 2061,
242 2048, 2038, 2026, 2016,
243 2008, 1998, 1989, 1980,
244 1970, 1958, 1945, 1928,
245 1910, 1888, 1860, 1827,
246 1791, 1751, 1709, 1656,
247};
248
249#define INTERVAL 10
250#define BATTERY_HIGH_TRESHOLD 66
251#define BATTERY_LOW_TRESHOLD 33
252
253static void palmte_get_power_status(struct apm_power_info *info, int *battery)
254{
255 int charging, batt, hi, lo, mid;
256
257 charging = !omap_get_gpio_datain(PALMTE_DC_GPIO);
258 batt = battery[0];
259 if (charging)
260 batt -= 60;
261
262 hi = ARRAY_SIZE(palmte_battery_sample);
263 lo = 0;
264
265 info->battery_flag = 0;
266 info->units = APM_UNITS_MINS;
267
268 if (batt > palmte_battery_sample[lo]) {
269 info->battery_life = 100;
270 info->time = INTERVAL * ARRAY_SIZE(palmte_battery_sample);
271 } else if (batt <= palmte_battery_sample[hi - 1]) {
272 info->battery_life = 0;
273 info->time = 0;
274 } else {
275 while (hi > lo + 1) {
276 mid = (hi + lo) >> 2;
277 if (batt <= palmte_battery_sample[mid])
278 lo = mid;
279 else
280 hi = mid;
281 }
282
283 mid = palmte_battery_sample[lo] - palmte_battery_sample[hi];
284 hi = palmte_battery_sample[lo] - batt;
285 info->battery_life = 100 - (100 * lo + 100 * hi / mid) /
286 ARRAY_SIZE(palmte_battery_sample);
287 info->time = INTERVAL * (ARRAY_SIZE(palmte_battery_sample) -
288 lo) - INTERVAL * hi / mid;
289 }
290
291 if (charging) {
292 info->ac_line_status = APM_AC_ONLINE;
293 info->battery_status = APM_BATTERY_STATUS_CHARGING;
294 info->battery_flag |= APM_BATTERY_FLAG_CHARGING;
295 } else {
296 info->ac_line_status = APM_AC_OFFLINE;
297 if (info->battery_life > BATTERY_HIGH_TRESHOLD)
298 info->battery_status = APM_BATTERY_STATUS_HIGH;
299 else if (info->battery_life > BATTERY_LOW_TRESHOLD)
300 info->battery_status = APM_BATTERY_STATUS_LOW;
301 else
302 info->battery_status = APM_BATTERY_STATUS_CRITICAL;
303 }
304
305 if (info->battery_life > BATTERY_HIGH_TRESHOLD)
306 info->battery_flag |= APM_BATTERY_FLAG_HIGH;
307 else if (info->battery_life > BATTERY_LOW_TRESHOLD)
308 info->battery_flag |= APM_BATTERY_FLAG_LOW;
309 else
310 info->battery_flag |= APM_BATTERY_FLAG_CRITICAL;
311}
312#else
313#define palmte_get_power_status NULL
314#endif
315
316static struct tsc2102_config palmte_tsc2102_config = {
317 .use_internal = 0,
318 .monitor = TSC_BAT1 | TSC_AUX | TSC_TEMP,
319 .temp_at25c = { 2200, 2615 },
320 .apm_report = palmte_get_power_status,
321 .alsa_config = &palmte_alsa_config,
322};
323
70static struct omap_board_config_kernel palmte_config[] = { 324static struct omap_board_config_kernel palmte_config[] = {
71 { OMAP_TAG_USB, &palmte_usb_config }, 325 { OMAP_TAG_USB, &palmte_usb_config },
72 { OMAP_TAG_MMC, &palmte_mmc_config }, 326 { OMAP_TAG_MMC, &palmte_mmc_config },
73 { OMAP_TAG_LCD, &palmte_lcd_config }, 327 { OMAP_TAG_LCD, &palmte_lcd_config },
328 { OMAP_TAG_UART, &palmte_uart_config },
74}; 329};
75 330
76static void __init omap_generic_init(void) 331static struct spi_board_info palmte_spi_info[] __initdata = {
332 {
333 .modalias = "tsc2102",
334 .bus_num = 2, /* uWire (officially) */
335 .chip_select = 0, /* As opposed to 3 */
336 .irq = OMAP_GPIO_IRQ(PALMTE_PINTDAV_GPIO),
337 .platform_data = &palmte_tsc2102_config,
338 .max_speed_hz = 8000000,
339 },
340};
341
342/* Periodically check for changes on important input pins */
343struct timer_list palmte_pin_timer;
344int prev_power, prev_headphones;
345
346static void palmte_pin_handler(unsigned long data) {
347 int power, headphones;
348
349 power = !omap_get_gpio_datain(PALMTE_DC_GPIO);
350 headphones = omap_get_gpio_datain(PALMTE_HEADPHONES_GPIO);
351
352 if (power && !prev_power)
353 printk(KERN_INFO "PM: cable connected\n");
354 else if (!power && prev_power)
355 printk(KERN_INFO "PM: cable disconnected\n");
356
357 if (headphones && !prev_headphones) {
358 /* Headphones connected, disable speaker */
359 omap_set_gpio_dataout(PALMTE_SPEAKER_GPIO, 0);
360 printk(KERN_INFO "PM: speaker off\n");
361 } else if (!headphones && prev_headphones) {
362 /* Headphones unplugged, re-enable speaker */
363 omap_set_gpio_dataout(PALMTE_SPEAKER_GPIO, 1);
364 printk(KERN_INFO "PM: speaker on\n");
365 }
366
367 prev_power = power;
368 prev_headphones = headphones;
369 mod_timer(&palmte_pin_timer, jiffies + msecs_to_jiffies(500));
370}
371
372static void __init palmte_gpio_setup(void)
373{
374 /* Set TSC2102 PINTDAV pin as input */
375 if (omap_request_gpio(PALMTE_PINTDAV_GPIO)) {
376 printk(KERN_ERR "Could not reserve PINTDAV GPIO!\n");
377 return;
378 }
379 omap_set_gpio_direction(PALMTE_PINTDAV_GPIO, 1);
380
381 /* Monitor cable-connected signals */
382 if (omap_request_gpio(PALMTE_DC_GPIO) ||
383 omap_request_gpio(PALMTE_USB_OR_DC_GPIO) ||
384 omap_request_gpio(PALMTE_USBDETECT_GPIO)) {
385 printk(KERN_ERR "Could not reserve cable signal GPIO!\n");
386 return;
387 }
388 omap_set_gpio_direction(PALMTE_DC_GPIO, 1);
389 omap_set_gpio_direction(PALMTE_USB_OR_DC_GPIO, 1);
390 omap_set_gpio_direction(PALMTE_USBDETECT_GPIO, 1);
391
392 /* Set speaker-enable pin as output */
393 if (omap_request_gpio(PALMTE_SPEAKER_GPIO)) {
394 printk(KERN_ERR "Could not reserve speaker GPIO!\n");
395 return;
396 }
397 omap_set_gpio_direction(PALMTE_SPEAKER_GPIO, 0);
398
399 /* Monitor the headphones-connected signal */
400 if (omap_request_gpio(PALMTE_HEADPHONES_GPIO)) {
401 printk(KERN_ERR "Could not reserve headphones signal GPIO!\n");
402 return;
403 }
404 omap_set_gpio_direction(PALMTE_HEADPHONES_GPIO, 1);
405
406 prev_power = omap_get_gpio_datain(PALMTE_DC_GPIO);
407 prev_headphones = !omap_get_gpio_datain(PALMTE_HEADPHONES_GPIO);
408 setup_timer(&palmte_pin_timer, palmte_pin_handler, 0);
409 palmte_pin_handler(0);
410}
411
412static void __init omap_palmte_init(void)
77{ 413{
78 omap_board_config = palmte_config; 414 omap_board_config = palmte_config;
79 omap_board_config_size = ARRAY_SIZE(palmte_config); 415 omap_board_config_size = ARRAY_SIZE(palmte_config);
80 416
81 platform_add_devices(devices, ARRAY_SIZE(devices)); 417 platform_add_devices(devices, ARRAY_SIZE(devices));
418
419 spi_register_board_info(palmte_spi_info, ARRAY_SIZE(palmte_spi_info));
420
421 omap_serial_init();
422 palmte_gpio_setup();
82} 423}
83 424
84static void __init omap_generic_map_io(void) 425static void __init omap_palmte_map_io(void)
85{ 426{
86 omap1_map_common_io(); 427 omap1_map_common_io();
87} 428}
@@ -90,8 +431,8 @@ MACHINE_START(OMAP_PALMTE, "OMAP310 based Palm Tungsten E")
90 .phys_io = 0xfff00000, 431 .phys_io = 0xfff00000,
91 .io_pg_offst = ((0xfef00000) >> 18) & 0xfffc, 432 .io_pg_offst = ((0xfef00000) >> 18) & 0xfffc,
92 .boot_params = 0x10000100, 433 .boot_params = 0x10000100,
93 .map_io = omap_generic_map_io, 434 .map_io = omap_palmte_map_io,
94 .init_irq = omap_generic_init_irq, 435 .init_irq = omap_palmte_init_irq,
95 .init_machine = omap_generic_init, 436 .init_machine = omap_palmte_init,
96 .timer = &omap_timer, 437 .timer = &omap_timer,
97MACHINE_END 438MACHINE_END
diff --git a/arch/arm/mach-omap1/board-palmtt.c b/arch/arm/mach-omap1/board-palmtt.c
new file mode 100644
index 000000000000..e47010fec275
--- /dev/null
+++ b/arch/arm/mach-omap1/board-palmtt.c
@@ -0,0 +1,357 @@
1/*
2 * linux/arch/arm/mach-omap1/board-palmtt.c
3 *
4 * Modified from board-palmtt2.c
5 *
6 * Modified and amended for Palm Tungsten|T
7 * by Marek Vasut <marek.vasut@gmail.com>
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License version 2 as
11 * published by the Free Software Foundation.
12 */
13
14#include <linux/delay.h>
15#include <linux/kernel.h>
16#include <linux/init.h>
17#include <linux/platform_device.h>
18#include <linux/notifier.h>
19#include <linux/clk.h>
20#include <linux/input.h>
21#include <linux/interrupt.h>
22#include <linux/mtd/mtd.h>
23#include <linux/mtd/partitions.h>
24#include <linux/leds.h>
25
26#include <asm/hardware.h>
27#include <asm/mach-types.h>
28#include <asm/mach/arch.h>
29#include <asm/mach/map.h>
30#include <asm/mach/flash.h>
31
32#include <asm/arch/led.h>
33#include <asm/arch/mcbsp.h>
34#include <asm/arch/gpio.h>
35#include <asm/arch/mux.h>
36#include <asm/arch/usb.h>
37#include <asm/arch/dma.h>
38#include <asm/arch/tc.h>
39#include <asm/arch/board.h>
40#include <asm/arch/irda.h>
41#include <asm/arch/keypad.h>
42#include <asm/arch/common.h>
43#include <asm/arch/omap-alsa.h>
44
45#include <linux/input.h>
46#include <linux/spi/spi.h>
47#include <linux/spi/ads7846.h>
48
49static int palmtt_keymap[] = {
50 KEY(0, 0, KEY_ESC),
51 KEY(0, 1, KEY_SPACE),
52 KEY(0, 2, KEY_LEFTCTRL),
53 KEY(0, 3, KEY_TAB),
54 KEY(0, 4, KEY_ENTER),
55 KEY(1, 0, KEY_LEFT),
56 KEY(1, 1, KEY_DOWN),
57 KEY(1, 2, KEY_UP),
58 KEY(1, 3, KEY_RIGHT),
59 KEY(2, 0, KEY_SLEEP),
60 KEY(2, 4, KEY_Y),
61 0
62};
63
64static struct mtd_partition palmtt_partitions[] = {
65 {
66 .name = "write8k",
67 .offset = 0,
68 .size = SZ_8K,
69 .mask_flags = 0,
70 },
71 {
72 .name = "PalmOS-BootLoader(ro)",
73 .offset = SZ_8K,
74 .size = 7 * SZ_8K,
75 .mask_flags = MTD_WRITEABLE,
76 },
77 {
78 .name = "u-boot",
79 .offset = MTDPART_OFS_APPEND,
80 .size = 8 * SZ_8K,
81 .mask_flags = 0,
82 },
83 {
84 .name = "PalmOS-FS(ro)",
85 .offset = MTDPART_OFS_APPEND,
86 .size = 7 * SZ_1M + 4 * SZ_64K - 16 * SZ_8K,
87 .mask_flags = MTD_WRITEABLE,
88 },
89 {
90 .name = "u-boot(rez)",
91 .offset = MTDPART_OFS_APPEND,
92 .size = SZ_128K,
93 .mask_flags = 0
94 },
95 {
96 .name = "empty",
97 .offset = MTDPART_OFS_APPEND,
98 .size = MTDPART_SIZ_FULL,
99 .mask_flags = 0
100 }
101};
102
103static struct flash_platform_data palmtt_flash_data = {
104 .map_name = "cfi_probe",
105 .width = 2,
106 .parts = palmtt_partitions,
107 .nr_parts = ARRAY_SIZE(palmtt_partitions),
108};
109
110static struct resource palmtt_flash_resource = {
111 .start = OMAP_CS0_PHYS,
112 .end = OMAP_CS0_PHYS + SZ_8M - 1,
113 .flags = IORESOURCE_MEM,
114};
115
116static struct platform_device palmtt_flash_device = {
117 .name = "omapflash",
118 .id = 0,
119 .dev = {
120 .platform_data = &palmtt_flash_data,
121 },
122 .num_resources = 1,
123 .resource = &palmtt_flash_resource,
124};
125
126#define DEFAULT_BITPERSAMPLE 16
127
128static struct omap_mcbsp_reg_cfg mcbsp_regs = {
129 .spcr2 = FREE | FRST | GRST | XRST | XINTM(3),
130 .spcr1 = RINTM(3) | RRST,
131 .rcr2 = RPHASE | RFRLEN2(OMAP_MCBSP_WORD_8) |
132 RWDLEN2(OMAP_MCBSP_WORD_16) | RDATDLY(0),
133 .rcr1 = RFRLEN1(OMAP_MCBSP_WORD_8) |
134 RWDLEN1(OMAP_MCBSP_WORD_16),
135 .xcr2 = XPHASE | XFRLEN2(OMAP_MCBSP_WORD_8) |
136 XWDLEN2(OMAP_MCBSP_WORD_16) | XDATDLY(0) | XFIG,
137 .xcr1 = XFRLEN1(OMAP_MCBSP_WORD_8) |
138 XWDLEN1(OMAP_MCBSP_WORD_16),
139 .srgr1 = FWID(DEFAULT_BITPERSAMPLE - 1),
140 .srgr2 = GSYNC | CLKSP | FSGM |
141 FPER(DEFAULT_BITPERSAMPLE * 2 - 1),
142 .pcr0 = CLKXP | CLKRP, /* mcbsp: slave */
143};
144
145static struct omap_alsa_codec_config alsa_config = {
146 .name = "PalmTT AIC23",
147 .mcbsp_regs_alsa = &mcbsp_regs,
148 .codec_configure_dev = NULL, // aic23_configure,
149 .codec_set_samplerate = NULL, // aic23_set_samplerate,
150 .codec_clock_setup = NULL, // aic23_clock_setup,
151 .codec_clock_on = NULL, // aic23_clock_on,
152 .codec_clock_off = NULL, // aic23_clock_off,
153 .get_default_samplerate = NULL, // aic23_get_default_samplerate,
154};
155
156static struct platform_device palmtt_mcbsp1_device = {
157 .name = "omap_alsa_mcbsp",
158 .id = 1,
159 .dev = {
160 .platform_data = &alsa_config,
161 },
162};
163
164static struct resource palmtt_kp_resources[] = {
165 [0] = {
166 .start = INT_KEYBOARD,
167 .end = INT_KEYBOARD,
168 .flags = IORESOURCE_IRQ,
169 },
170};
171
172static struct omap_kp_platform_data palmtt_kp_data = {
173 .rows = 6,
174 .cols = 3,
175 .keymap = palmtt_keymap,
176};
177
178static struct platform_device palmtt_kp_device = {
179 .name = "omap-keypad",
180 .id = -1,
181 .dev = {
182 .platform_data = &palmtt_kp_data,
183 },
184 .num_resources = ARRAY_SIZE(palmtt_kp_resources),
185 .resource = palmtt_kp_resources,
186};
187
188static struct platform_device palmtt_lcd_device = {
189 .name = "lcd_palmtt",
190 .id = -1,
191};
192static struct omap_irda_config palmtt_irda_config = {
193 .transceiver_cap = IR_SIRMODE,
194 .rx_channel = OMAP_DMA_UART3_RX,
195 .tx_channel = OMAP_DMA_UART3_TX,
196 .dest_start = UART3_THR,
197 .src_start = UART3_RHR,
198 .tx_trigger = 0,
199 .rx_trigger = 0,
200};
201
202static struct resource palmtt_irda_resources[] = {
203 [0] = {
204 .start = INT_UART3,
205 .end = INT_UART3,
206 .flags = IORESOURCE_IRQ,
207 },
208};
209
210static struct platform_device palmtt_irda_device = {
211 .name = "omapirda",
212 .id = -1,
213 .dev = {
214 .platform_data = &palmtt_irda_config,
215 },
216 .num_resources = ARRAY_SIZE(palmtt_irda_resources),
217 .resource = palmtt_irda_resources,
218};
219
220static struct platform_device palmtt_spi_device = {
221 .name = "spi_palmtt",
222 .id = -1,
223};
224
225static struct omap_backlight_config palmtt_backlight_config = {
226 .default_intensity = 0xa0,
227};
228
229static struct platform_device palmtt_backlight_device = {
230 .name = "omap-bl",
231 .id = -1,
232 .dev = {
233 .platform_data= &palmtt_backlight_config,
234 },
235};
236
237static struct omap_led_config palmtt_led_config[] = {
238 {
239 .cdev = {
240 .name = "palmtt:led0",
241 },
242 .gpio = PALMTT_LED_GPIO,
243 },
244};
245
246static struct omap_led_platform_data palmtt_led_data = {
247 .nr_leds = ARRAY_SIZE(palmtt_led_config),
248 .leds = palmtt_led_config,
249};
250
251static struct platform_device palmtt_led_device = {
252 .name = "omap-led",
253 .id = -1,
254 .dev = {
255 .platform_data = &palmtt_led_data,
256 },
257};
258
259static struct platform_device *palmtt_devices[] __initdata = {
260 &palmtt_flash_device,
261 &palmtt_mcbsp1_device,
262 &palmtt_kp_device,
263 &palmtt_lcd_device,
264 &palmtt_irda_device,
265 &palmtt_spi_device,
266 &palmtt_backlight_device,
267 &palmtt_led_device,
268};
269
270static int palmtt_get_pendown_state(void)
271{
272 return !omap_get_gpio_datain(6);
273}
274
275static const struct ads7846_platform_data palmtt_ts_info = {
276 .model = 7846,
277 .vref_delay_usecs = 100, /* internal, no capacitor */
278 .x_plate_ohms = 419,
279 .y_plate_ohms = 486,
280 .get_pendown_state = palmtt_get_pendown_state,
281};
282
283static struct spi_board_info __initdata palmtt_boardinfo[] = {
284 {
285 /* MicroWire (bus 2) CS0 has an ads7846e */
286 .modalias = "ads7846",
287 .platform_data = &palmtt_ts_info,
288 .irq = OMAP_GPIO_IRQ(6),
289 .max_speed_hz = 120000 /* max sample rate at 3V */
290 * 26 /* command + data + overhead */,
291 .bus_num = 2,
292 .chip_select = 0,
293 }
294};
295
296static void __init omap_palmtt_init_irq(void)
297{
298 omap1_init_common_hw();
299 omap_init_irq();
300}
301
302static struct omap_usb_config palmtt_usb_config __initdata = {
303 .register_dev = 1,
304 .hmc_mode = 0,
305 .pins[0] = 2,
306};
307
308static struct omap_lcd_config palmtt_lcd_config __initdata = {
309 .ctrl_name = "internal",
310};
311
312static struct omap_uart_config palmtt_uart_config __initdata = {
313 .enabled_uarts = (1 << 0) | (1 << 1) | (0 << 2),
314};
315
316static struct omap_board_config_kernel palmtt_config[] = {
317 { OMAP_TAG_USB, &palmtt_usb_config },
318 { OMAP_TAG_LCD, &palmtt_lcd_config },
319 { OMAP_TAG_UART, &palmtt_uart_config },
320};
321
322static void __init omap_mpu_wdt_mode(int mode) {
323 if (mode)
324 omap_writew(0x8000, OMAP_WDT_TIMER_MODE);
325 else {
326 omap_writew(0x00f5, OMAP_WDT_TIMER_MODE);
327 omap_writew(0x00a0, OMAP_WDT_TIMER_MODE);
328 }
329}
330
331static void __init omap_palmtt_init(void)
332{
333 omap_mpu_wdt_mode(0);
334
335 omap_board_config = palmtt_config;
336 omap_board_config_size = ARRAY_SIZE(palmtt_config);
337
338 platform_add_devices(palmtt_devices, ARRAY_SIZE(palmtt_devices));
339
340 spi_register_board_info(palmtt_boardinfo,ARRAY_SIZE(palmtt_boardinfo));
341 omap_serial_init();
342}
343
344static void __init omap_palmtt_map_io(void)
345{
346 omap1_map_common_io();
347}
348
349MACHINE_START(OMAP_PALMTT, "OMAP1510 based Palm Tungsten|T")
350 .phys_io = 0xfff00000,
351 .io_pg_offst = ((0xfef00000) >> 18) & 0xfffc,
352 .boot_params = 0x10000100,
353 .map_io = omap_palmtt_map_io,
354 .init_irq = omap_palmtt_init_irq,
355 .init_machine = omap_palmtt_init,
356 .timer = &omap_timer,
357MACHINE_END
diff --git a/arch/arm/mach-omap1/board-palmz71.c b/arch/arm/mach-omap1/board-palmz71.c
new file mode 100644
index 000000000000..c275d517764a
--- /dev/null
+++ b/arch/arm/mach-omap1/board-palmz71.c
@@ -0,0 +1,383 @@
1/*
2 * linux/arch/arm/mach-omap1/board-palmz71.c
3 *
4 * Modified from board-generic.c
5 *
6 * Support for the Palm Zire71 PDA.
7 *
8 * Original version : Laurent Gonzalez
9 *
10 * Modified for zire71 : Marek Vasut
11 *
12 * This program is free software; you can redistribute it and/or modify
13 * it under the terms of the GNU General Public License version 2 as
14 * published by the Free Software Foundation.
15 */
16
17#include <linux/delay.h>
18#include <linux/kernel.h>
19#include <linux/init.h>
20#include <linux/platform_device.h>
21#include <linux/notifier.h>
22#include <linux/clk.h>
23#include <linux/irq.h>
24#include <linux/input.h>
25#include <linux/interrupt.h>
26#include <linux/mtd/mtd.h>
27#include <linux/mtd/partitions.h>
28
29#include <asm/hardware.h>
30#include <asm/mach-types.h>
31#include <asm/mach/arch.h>
32#include <asm/mach/map.h>
33#include <asm/mach/flash.h>
34
35#include <asm/arch/mcbsp.h>
36#include <asm/arch/gpio.h>
37#include <asm/arch/mux.h>
38#include <asm/arch/usb.h>
39#include <asm/arch/dma.h>
40#include <asm/arch/tc.h>
41#include <asm/arch/board.h>
42#include <asm/arch/irda.h>
43#include <asm/arch/keypad.h>
44#include <asm/arch/common.h>
45#include <asm/arch/omap-alsa.h>
46
47#include <linux/input.h>
48#include <linux/spi/spi.h>
49#include <linux/spi/ads7846.h>
50
51static void __init
52omap_palmz71_init_irq(void)
53{
54 omap1_init_common_hw();
55 omap_init_irq();
56 omap_gpio_init();
57}
58
59static int palmz71_keymap[] = {
60 KEY(0, 0, KEY_F1),
61 KEY(0, 1, KEY_F2),
62 KEY(0, 2, KEY_F3),
63 KEY(0, 3, KEY_F4),
64 KEY(0, 4, KEY_POWER),
65 KEY(1, 0, KEY_LEFT),
66 KEY(1, 1, KEY_DOWN),
67 KEY(1, 2, KEY_UP),
68 KEY(1, 3, KEY_RIGHT),
69 KEY(1, 4, KEY_CENTER),
70 KEY(2, 0, KEY_CAMERA),
71 0,
72};
73
74static struct omap_kp_platform_data palmz71_kp_data = {
75 .rows = 8,
76 .cols = 8,
77 .keymap = palmz71_keymap,
78 .rep = 1,
79 .delay = 80,
80};
81
82static struct resource palmz71_kp_resources[] = {
83 [0] = {
84 .start = INT_KEYBOARD,
85 .end = INT_KEYBOARD,
86 .flags = IORESOURCE_IRQ,
87 },
88};
89
90static struct platform_device palmz71_kp_device = {
91 .name = "omap-keypad",
92 .id = -1,
93 .dev = {
94 .platform_data = &palmz71_kp_data,
95 },
96 .num_resources = ARRAY_SIZE(palmz71_kp_resources),
97 .resource = palmz71_kp_resources,
98};
99
100static struct mtd_partition palmz71_rom_partitions[] = {
101 /* PalmOS "Small ROM", contains the bootloader and the debugger */
102 {
103 .name = "smallrom",
104 .offset = 0,
105 .size = 0xa000,
106 .mask_flags = MTD_WRITEABLE,
107 },
108 /* PalmOS "Big ROM", a filesystem with all the OS code and data */
109 {
110 .name = "bigrom",
111 .offset = SZ_128K,
112 /*
113 * 0x5f0000 bytes big in the multi-language ("EFIGS") version,
114 * 0x7b0000 bytes in the English-only ("enUS") version.
115 */
116 .size = 0x7b0000,
117 .mask_flags = MTD_WRITEABLE,
118 },
119};
120
121static struct flash_platform_data palmz71_rom_data = {
122 .map_name = "map_rom",
123 .name = "onboardrom",
124 .width = 2,
125 .parts = palmz71_rom_partitions,
126 .nr_parts = ARRAY_SIZE(palmz71_rom_partitions),
127};
128
129static struct resource palmz71_rom_resource = {
130 .start = OMAP_CS0_PHYS,
131 .end = OMAP_CS0_PHYS + SZ_8M - 1,
132 .flags = IORESOURCE_MEM,
133};
134
135static struct platform_device palmz71_rom_device = {
136 .name = "omapflash",
137 .id = -1,
138 .dev = {
139 .platform_data = &palmz71_rom_data,
140 },
141 .num_resources = 1,
142 .resource = &palmz71_rom_resource,
143};
144
145static struct platform_device palmz71_lcd_device = {
146 .name = "lcd_palmz71",
147 .id = -1,
148};
149
150static struct omap_irda_config palmz71_irda_config = {
151 .transceiver_cap = IR_SIRMODE,
152 .rx_channel = OMAP_DMA_UART3_RX,
153 .tx_channel = OMAP_DMA_UART3_TX,
154 .dest_start = UART3_THR,
155 .src_start = UART3_RHR,
156 .tx_trigger = 0,
157 .rx_trigger = 0,
158};
159
160static struct resource palmz71_irda_resources[] = {
161 [0] = {
162 .start = INT_UART3,
163 .end = INT_UART3,
164 .flags = IORESOURCE_IRQ,
165 },
166};
167
168static struct platform_device palmz71_irda_device = {
169 .name = "omapirda",
170 .id = -1,
171 .dev = {
172 .platform_data = &palmz71_irda_config,
173 },
174 .num_resources = ARRAY_SIZE(palmz71_irda_resources),
175 .resource = palmz71_irda_resources,
176};
177
178static struct platform_device palmz71_spi_device = {
179 .name = "spi_palmz71",
180 .id = -1,
181};
182
183#define DEFAULT_BITPERSAMPLE 16
184
185static struct omap_mcbsp_reg_cfg mcbsp_regs = {
186 .spcr2 = FREE | FRST | GRST | XRST | XINTM(3),
187 .spcr1 = RINTM(3) | RRST,
188 .rcr2 = RPHASE | RFRLEN2(OMAP_MCBSP_WORD_8) |
189 RWDLEN2(OMAP_MCBSP_WORD_16) | RDATDLY(0),
190 .rcr1 = RFRLEN1(OMAP_MCBSP_WORD_8) | RWDLEN1(OMAP_MCBSP_WORD_16),
191 .xcr2 = XPHASE | XFRLEN2(OMAP_MCBSP_WORD_8) |
192 XWDLEN2(OMAP_MCBSP_WORD_16) | XDATDLY(0) | XFIG,
193 .xcr1 = XFRLEN1(OMAP_MCBSP_WORD_8) | XWDLEN1(OMAP_MCBSP_WORD_16),
194 .srgr1 = FWID(DEFAULT_BITPERSAMPLE - 1),
195 .srgr2 = GSYNC | CLKSP | FSGM | FPER(DEFAULT_BITPERSAMPLE * 2 - 1),
196 .pcr0 = CLKXP | CLKRP, /* mcbsp: slave */
197};
198
199static struct omap_alsa_codec_config alsa_config = {
200 .name = "PalmZ71 AIC23",
201 .mcbsp_regs_alsa = &mcbsp_regs,
202 .codec_configure_dev = NULL, /* aic23_configure */
203 .codec_set_samplerate = NULL, /* aic23_set_samplerate */
204 .codec_clock_setup = NULL, /* aic23_clock_setup */
205 .codec_clock_on = NULL, /* aic23_clock_on */
206 .codec_clock_off = NULL, /* aic23_clock_off */
207 .get_default_samplerate = NULL, /* aic23_get_default_samplerate */
208};
209
210static struct platform_device palmz71_mcbsp1_device = {
211 .name = "omap_alsa_mcbsp",
212 .id = 1,
213 .dev = {
214 .platform_data = &alsa_config,
215 },
216};
217
218static struct omap_backlight_config palmz71_backlight_config = {
219 .default_intensity = 0xa0,
220};
221
222static struct platform_device palmz71_backlight_device = {
223 .name = "omap-bl",
224 .id = -1,
225 .dev = {
226 .platform_data = &palmz71_backlight_config,
227 },
228};
229
230static struct platform_device *devices[] __initdata = {
231 &palmz71_rom_device,
232 &palmz71_kp_device,
233 &palmz71_mcbsp1_device,
234 &palmz71_lcd_device,
235 &palmz71_irda_device,
236 &palmz71_spi_device,
237 &palmz71_backlight_device,
238};
239
240static int
241palmz71_get_pendown_state(void)
242{
243 return !omap_get_gpio_datain(PALMZ71_PENIRQ_GPIO);
244}
245
246static const struct ads7846_platform_data palmz71_ts_info = {
247 .model = 7846,
248 .vref_delay_usecs = 100, /* internal, no capacitor */
249 .x_plate_ohms = 419,
250 .y_plate_ohms = 486,
251 .get_pendown_state = palmz71_get_pendown_state,
252};
253
254static struct spi_board_info __initdata palmz71_boardinfo[] = { {
255 /* MicroWire (bus 2) CS0 has an ads7846e */
256 .modalias = "ads7846",
257 .platform_data = &palmz71_ts_info,
258 .irq = OMAP_GPIO_IRQ(PALMZ71_PENIRQ_GPIO),
259 .max_speed_hz = 120000 /* max sample rate at 3V */
260 * 26 /* command + data + overhead */,
261 .bus_num = 2,
262 .chip_select = 0,
263} };
264
265static struct omap_usb_config palmz71_usb_config __initdata = {
266 .register_dev = 1, /* Mini-B only receptacle */
267 .hmc_mode = 0,
268 .pins[0] = 2,
269};
270
271static struct omap_mmc_config palmz71_mmc_config __initdata = {
272 .mmc[0] = {
273 .enabled = 1,
274 .wire4 = 0,
275 .wp_pin = PALMZ71_MMC_WP_GPIO,
276 .power_pin = -1,
277 .switch_pin = PALMZ71_MMC_IN_GPIO,
278 },
279};
280
281static struct omap_lcd_config palmz71_lcd_config __initdata = {
282 .ctrl_name = "internal",
283};
284
285static struct omap_uart_config palmz71_uart_config __initdata = {
286 .enabled_uarts = (1 << 0) | (1 << 1) | (0 << 2),
287};
288
289static struct omap_board_config_kernel palmz71_config[] = {
290 {OMAP_TAG_USB, &palmz71_usb_config},
291 {OMAP_TAG_MMC, &palmz71_mmc_config},
292 {OMAP_TAG_LCD, &palmz71_lcd_config},
293 {OMAP_TAG_UART, &palmz71_uart_config},
294};
295
296static irqreturn_t
297palmz71_powercable(int irq, void *dev_id)
298{
299 if (omap_get_gpio_datain(PALMZ71_USBDETECT_GPIO)) {
300 printk(KERN_INFO "PM: Power cable connected\n");
301 set_irq_type(OMAP_GPIO_IRQ(PALMZ71_USBDETECT_GPIO),
302 IRQT_FALLING);
303 } else {
304 printk(KERN_INFO "PM: Power cable disconnected\n");
305 set_irq_type(OMAP_GPIO_IRQ(PALMZ71_USBDETECT_GPIO),
306 IRQT_RISING);
307 }
308 return IRQ_HANDLED;
309}
310
311static void __init
312omap_mpu_wdt_mode(int mode)
313{
314 if (mode)
315 omap_writew(0x8000, OMAP_WDT_TIMER_MODE);
316 else {
317 omap_writew(0x00f5, OMAP_WDT_TIMER_MODE);
318 omap_writew(0x00a0, OMAP_WDT_TIMER_MODE);
319 }
320}
321
322static void __init
323palmz71_gpio_setup(int early)
324{
325 if (early) {
326 /* Only set GPIO1 so we have a working serial */
327 omap_set_gpio_dataout(1, 1);
328 omap_set_gpio_direction(1, 0);
329 } else {
330 /* Set MMC/SD host WP pin as input */
331 if (omap_request_gpio(PALMZ71_MMC_WP_GPIO)) {
332 printk(KERN_ERR "Could not reserve WP GPIO!\n");
333 return;
334 }
335 omap_set_gpio_direction(PALMZ71_MMC_WP_GPIO, 1);
336
337 /* Monitor the Power-cable-connected signal */
338 if (omap_request_gpio(PALMZ71_USBDETECT_GPIO)) {
339 printk(KERN_ERR
340 "Could not reserve cable signal GPIO!\n");
341 return;
342 }
343 omap_set_gpio_direction(PALMZ71_USBDETECT_GPIO, 1);
344 if (request_irq(OMAP_GPIO_IRQ(PALMZ71_USBDETECT_GPIO),
345 palmz71_powercable, IRQF_SAMPLE_RANDOM,
346 "palmz71-cable", 0))
347 printk(KERN_ERR
348 "IRQ request for power cable failed!\n");
349 palmz71_powercable(OMAP_GPIO_IRQ(PALMZ71_USBDETECT_GPIO), 0);
350 }
351}
352
353static void __init
354omap_palmz71_init(void)
355{
356 palmz71_gpio_setup(1);
357 omap_mpu_wdt_mode(0);
358
359 omap_board_config = palmz71_config;
360 omap_board_config_size = ARRAY_SIZE(palmz71_config);
361
362 platform_add_devices(devices, ARRAY_SIZE(devices));
363
364 spi_register_board_info(palmz71_boardinfo,
365 ARRAY_SIZE(palmz71_boardinfo));
366 omap_serial_init();
367 palmz71_gpio_setup(0);
368}
369
370static void __init
371omap_palmz71_map_io(void)
372{
373 omap1_map_common_io();
374}
375
376MACHINE_START(OMAP_PALMZ71, "OMAP310 based Palm Zire71")
377 .phys_io = 0xfff00000,
378 .io_pg_offst = ((0xfef00000) >> 18) & 0xfffc,
379 .boot_params = 0x10000100,.map_io = omap_palmz71_map_io,
380 .init_irq = omap_palmz71_init_irq,
381 .init_machine = omap_palmz71_init,
382 .timer = &omap_timer,
383MACHINE_END
diff --git a/arch/arm/mach-omap1/board-sx1.c b/arch/arm/mach-omap1/board-sx1.c
new file mode 100644
index 000000000000..2743d639aa05
--- /dev/null
+++ b/arch/arm/mach-omap1/board-sx1.c
@@ -0,0 +1,494 @@
1/*
2* linux/arch/arm/mach-omap1/board-sx1.c
3*
4* Modified from board-generic.c
5*
6* Support for the Siemens SX1 mobile phone.
7*
8* Original version : Vladimir Ananiev (Vovan888-at-gmail com)
9*
10* Maintainters : Vladimir Ananiev (aka Vovan888), Sergge
11* oslik.ru
12*
13* This program is free software; you can redistribute it and/or modify
14* it under the terms of the GNU General Public License version 2 as
15* published by the Free Software Foundation.
16*/
17
18#include <linux/kernel.h>
19#include <linux/init.h>
20#include <linux/input.h>
21#include <linux/platform_device.h>
22#include <linux/notifier.h>
23#include <linux/mtd/mtd.h>
24#include <linux/mtd/partitions.h>
25#include <linux/types.h>
26#include <linux/i2c.h>
27#include <linux/errno.h>
28
29#include <asm/hardware.h>
30#include <asm/mach-types.h>
31#include <asm/mach/arch.h>
32#include <asm/mach/flash.h>
33#include <asm/mach/map.h>
34
35#include <asm/arch/gpio.h>
36#include <asm/arch/mux.h>
37#include <asm/arch/irda.h>
38#include <asm/arch/usb.h>
39#include <asm/arch/tc.h>
40#include <asm/arch/board.h>
41#include <asm/arch/common.h>
42#include <asm/arch/mcbsp.h>
43#include <asm/arch/omap-alsa.h>
44#include <asm/arch/keypad.h>
45
46/* Write to I2C device */
47int i2c_write_byte(u8 devaddr, u8 regoffset, u8 value)
48{
49 struct i2c_adapter *adap;
50 int err;
51 struct i2c_msg msg[1];
52 unsigned char data[2];
53
54 adap = i2c_get_adapter(0);
55 if (!adap)
56 return -ENODEV;
57 msg->addr = devaddr; /* I2C address of chip */
58 msg->flags = 0;
59 msg->len = 2;
60 msg->buf = data;
61 data[0] = regoffset; /* register num */
62 data[1] = value; /* register data */
63 err = i2c_transfer(adap, msg, 1);
64 if (err >= 0)
65 return 0;
66 return err;
67}
68
69/* Read from I2C device */
70int i2c_read_byte(u8 devaddr, u8 regoffset, u8 * value)
71{
72 struct i2c_adapter *adap;
73 int err;
74 struct i2c_msg msg[1];
75 unsigned char data[2];
76
77 adap = i2c_get_adapter(0);
78 if (!adap)
79 return -ENODEV;
80
81 msg->addr = devaddr; /* I2C address of chip */
82 msg->flags = 0;
83 msg->len = 1;
84 msg->buf = data;
85 data[0] = regoffset; /* register num */
86 err = i2c_transfer(adap, msg, 1);
87
88 msg->addr = devaddr; /* I2C address */
89 msg->flags = I2C_M_RD;
90 msg->len = 1;
91 msg->buf = data;
92 err = i2c_transfer(adap, msg, 1);
93 *value = data[0];
94
95 if (err >= 0)
96 return 0;
97 return err;
98}
99/* set keyboard backlight intensity */
100int sx1_setkeylight(u8 keylight)
101{
102 if (keylight > SOFIA_MAX_LIGHT_VAL)
103 keylight = SOFIA_MAX_LIGHT_VAL;
104 return i2c_write_byte(SOFIA_I2C_ADDR, SOFIA_KEYLIGHT_REG, keylight);
105}
106/* get current keylight intensity */
107int sx1_getkeylight(u8 * keylight)
108{
109 return i2c_read_byte(SOFIA_I2C_ADDR, SOFIA_KEYLIGHT_REG, keylight);
110}
111/* set LCD backlight intensity */
112int sx1_setbacklight(u8 backlight)
113{
114 if (backlight > SOFIA_MAX_LIGHT_VAL)
115 backlight = SOFIA_MAX_LIGHT_VAL;
116 return i2c_write_byte(SOFIA_I2C_ADDR, SOFIA_BACKLIGHT_REG, backlight);
117}
118/* get current LCD backlight intensity */
119int sx1_getbacklight (u8 * backlight)
120{
121 return i2c_read_byte(SOFIA_I2C_ADDR, SOFIA_BACKLIGHT_REG, backlight);
122}
123/* set LCD backlight power on/off */
124int sx1_setmmipower(u8 onoff)
125{
126 int err;
127 u8 dat = 0;
128 err = i2c_read_byte(SOFIA_I2C_ADDR, SOFIA_POWER1_REG, &dat);
129 if (err < 0)
130 return err;
131 if (onoff)
132 dat |= SOFIA_MMILIGHT_POWER;
133 else
134 dat &= ~SOFIA_MMILIGHT_POWER;
135 return i2c_write_byte(SOFIA_I2C_ADDR, SOFIA_POWER1_REG, dat);
136}
137/* set MMC power on/off */
138int sx1_setmmcpower(u8 onoff)
139{
140 int err;
141 u8 dat = 0;
142 err = i2c_read_byte(SOFIA_I2C_ADDR, SOFIA_POWER1_REG, &dat);
143 if (err < 0)
144 return err;
145 if (onoff)
146 dat |= SOFIA_MMC_POWER;
147 else
148 dat &= ~SOFIA_MMC_POWER;
149 return i2c_write_byte(SOFIA_I2C_ADDR, SOFIA_POWER1_REG, dat);
150}
151/* set USB power on/off */
152int sx1_setusbpower(u8 onoff)
153{
154 int err;
155 u8 dat = 0;
156 err = i2c_read_byte(SOFIA_I2C_ADDR, SOFIA_POWER1_REG, &dat);
157 if (err < 0)
158 return err;
159 if (onoff)
160 dat |= SOFIA_USB_POWER;
161 else
162 dat &= ~SOFIA_USB_POWER;
163 return i2c_write_byte(SOFIA_I2C_ADDR, SOFIA_POWER1_REG, dat);
164}
165
166EXPORT_SYMBOL(sx1_setkeylight);
167EXPORT_SYMBOL(sx1_getkeylight);
168EXPORT_SYMBOL(sx1_setbacklight);
169EXPORT_SYMBOL(sx1_getbacklight);
170EXPORT_SYMBOL(sx1_setmmipower);
171EXPORT_SYMBOL(sx1_setmmcpower);
172EXPORT_SYMBOL(sx1_setusbpower);
173
174/*----------- Keypad -------------------------*/
175
176static int sx1_keymap[] = {
177 KEY(5, 3, GROUP_0 | 117), /* camera Qt::Key_F17 */
178 KEY(0, 4, GROUP_0 | 114), /* voice memo Qt::Key_F14 */
179 KEY(1, 4, GROUP_2 | 114), /* voice memo */
180 KEY(2, 4, GROUP_3 | 114), /* voice memo */
181 KEY(0, 0, GROUP_1 | KEY_F12), /* red button Qt::Key_Hangup */
182 KEY(4, 3, GROUP_1 | KEY_LEFT),
183 KEY(2, 3, GROUP_1 | KEY_DOWN),
184 KEY(1, 3, GROUP_1 | KEY_RIGHT),
185 KEY(0, 3, GROUP_1 | KEY_UP),
186 KEY(3, 3, GROUP_1 | KEY_POWER), /* joystick press or Qt::Key_Select */
187 KEY(5, 0, GROUP_1 | KEY_1),
188 KEY(4, 0, GROUP_1 | KEY_2),
189 KEY(3, 0, GROUP_1 | KEY_3),
190 KEY(3, 4, GROUP_1 | KEY_4),
191 KEY(4, 4, GROUP_1 | KEY_5),
192 KEY(5, 4, GROUP_1 | KEY_KPASTERISK),/* "*" */
193 KEY(4, 1, GROUP_1 | KEY_6),
194 KEY(5, 1, GROUP_1 | KEY_7),
195 KEY(3, 1, GROUP_1 | KEY_8),
196 KEY(3, 2, GROUP_1 | KEY_9),
197 KEY(5, 2, GROUP_1 | KEY_0),
198 KEY(4, 2, GROUP_1 | 113), /* # F13 Toggle input method Qt::Key_F13 */
199 KEY(0, 1, GROUP_1 | KEY_F11), /* green button Qt::Key_Call */
200 KEY(1, 2, GROUP_1 | KEY_YEN), /* left soft Qt::Key_Context1 */
201 KEY(2, 2, GROUP_1 | KEY_F8), /* right soft Qt::Key_Back */
202 KEY(2, 1, GROUP_1 | KEY_LEFTSHIFT), /* shift */
203 KEY(1, 1, GROUP_1 | KEY_BACKSPACE), /* C (clear) */
204 KEY(0, 2, GROUP_1 | KEY_F7), /* menu Qt::Key_Menu */
205 0
206};
207
208static struct resource sx1_kp_resources[] = {
209 [0] = {
210 .start = INT_KEYBOARD,
211 .end = INT_KEYBOARD,
212 .flags = IORESOURCE_IRQ,
213 },
214};
215
216static struct omap_kp_platform_data sx1_kp_data = {
217 .rows = 6,
218 .cols = 6,
219 .keymap = sx1_keymap,
220 .keymapsize = ARRAY_SIZE(sx1_keymap),
221 .delay = 80,
222};
223
224static struct platform_device sx1_kp_device = {
225 .name = "omap-keypad",
226 .id = -1,
227 .dev = {
228 .platform_data = &sx1_kp_data,
229 },
230 .num_resources = ARRAY_SIZE(sx1_kp_resources),
231 .resource = sx1_kp_resources,
232};
233
234/*----------- IRDA -------------------------*/
235
236static struct omap_irda_config sx1_irda_data = {
237 .transceiver_cap = IR_SIRMODE,
238 .rx_channel = OMAP_DMA_UART3_RX,
239 .tx_channel = OMAP_DMA_UART3_TX,
240 .dest_start = UART3_THR,
241 .src_start = UART3_RHR,
242 .tx_trigger = 0,
243 .rx_trigger = 0,
244};
245
246static struct resource sx1_irda_resources[] = {
247 [0] = {
248 .start = INT_UART3,
249 .end = INT_UART3,
250 .flags = IORESOURCE_IRQ,
251 },
252};
253
254static u64 irda_dmamask = 0xffffffff;
255
256static struct platform_device sx1_irda_device = {
257 .name = "omapirda",
258 .id = 0,
259 .dev = {
260 .platform_data = &sx1_irda_data,
261 .dma_mask = &irda_dmamask,
262 },
263 .num_resources = ARRAY_SIZE(sx1_irda_resources),
264 .resource = sx1_irda_resources,
265};
266
267/*----------- McBSP & Sound -------------------------*/
268
269/* Playback interface - McBSP1 */
270static struct omap_mcbsp_reg_cfg mcbsp1_regs = {
271 .spcr2 = XINTM(3), /* SPCR2=30 */
272 .spcr1 = RINTM(3), /* SPCR1=30 */
273 .rcr2 = 0, /* RCR2 =00 */
274 .rcr1 = RFRLEN1(1) | RWDLEN1(OMAP_MCBSP_WORD_16), /* RCR1=140 */
275 .xcr2 = 0, /* XCR2 = 0 */
276 .xcr1 = XFRLEN1(1) | XWDLEN1(OMAP_MCBSP_WORD_16), /* XCR1 = 140 */
277 .srgr1 = FWID(15) | CLKGDV(12), /* SRGR1=0f0c */
278 .srgr2 = FSGM | FPER(31), /* SRGR2=101f */
279 .pcr0 = FSXM | FSRM | CLKXM | CLKRM | FSXP | FSRP | CLKXP | CLKRP,
280 /* PCR0 =0f0f */
281};
282
283/* TODO: PCM interface - McBSP2 */
284static struct omap_mcbsp_reg_cfg mcbsp2_regs = {
285 .spcr2 = FRST | GRST | XRST | XINTM(3), /* SPCR2=F1 */
286 .spcr1 = RINTM(3) | RRST, /* SPCR1=30 */
287 .rcr2 = 0, /* RCR2 =00 */
288 .rcr1 = RFRLEN1(1) | RWDLEN1(OMAP_MCBSP_WORD_16), /* RCR1 = 140 */
289 .xcr2 = 0, /* XCR2 = 0 */
290 .xcr1 = XFRLEN1(1) | XWDLEN1(OMAP_MCBSP_WORD_16), /* XCR1 = 140 */
291 .srgr1 = FWID(15) | CLKGDV(12), /* SRGR1=0f0c */
292 .srgr2 = FSGM | FPER(31), /* SRGR2=101f */
293 .pcr0 = FSXM | FSRM | CLKXM | CLKRM | FSXP | FSRP | CLKXP | CLKRP,
294 /* PCR0=0f0f */
295 /* mcbsp: slave */
296};
297
298static struct omap_alsa_codec_config sx1_alsa_config = {
299 .name = "SX1 EGold",
300 .mcbsp_regs_alsa = &mcbsp1_regs,
301};
302
303static struct platform_device sx1_mcbsp1_device = {
304 .name = "omap_alsa_mcbsp",
305 .id = 1,
306 .dev = {
307 .platform_data = &sx1_alsa_config,
308 },
309};
310
311/*----------- MTD -------------------------*/
312
313static struct mtd_partition sx1_partitions[] = {
314 /* bootloader (U-Boot, etc) in first sector */
315 {
316 .name = "bootloader",
317 .offset = 0x01800000,
318 .size = SZ_128K,
319 .mask_flags = MTD_WRITEABLE, /* force read-only */
320 },
321 /* bootloader params in the next sector */
322 {
323 .name = "params",
324 .offset = MTDPART_OFS_APPEND,
325 .size = SZ_128K,
326 .mask_flags = 0,
327 },
328 /* kernel */
329 {
330 .name = "kernel",
331 .offset = MTDPART_OFS_APPEND,
332 .size = SZ_2M - 2 * SZ_128K,
333 .mask_flags = 0
334 },
335 /* file system */
336 {
337 .name = "filesystem",
338 .offset = MTDPART_OFS_APPEND,
339 .size = MTDPART_SIZ_FULL,
340 .mask_flags = 0
341 }
342};
343
344static struct flash_platform_data sx1_flash_data = {
345 .map_name = "cfi_probe",
346 .width = 2,
347 .parts = sx1_partitions,
348 .nr_parts = ARRAY_SIZE(sx1_partitions),
349};
350
351#ifdef CONFIG_SX1_OLD_FLASH
352/* MTD Intel StrataFlash - old flashes */
353static struct resource sx1_old_flash_resource[] = {
354 [0] = {
355 .start = OMAP_CS0_PHYS, /* Physical */
356 .end = OMAP_CS0_PHYS + SZ_16M - 1,,
357 .flags = IORESOURCE_MEM,
358 },
359 [1] = {
360 .start = OMAP_CS1_PHYS,
361 .end = OMAP_CS1_PHYS + SZ_8M - 1,
362 .flags = IORESOURCE_MEM,
363 },
364};
365
366static struct platform_device sx1_flash_device = {
367 .name = "omapflash",
368 .id = 0,
369 .dev = {
370 .platform_data = &sx1_flash_data,
371 },
372 .num_resources = 2,
373 .resource = &sx1_old_flash_resource,
374};
375#else
376/* MTD Intel 4000 flash - new flashes */
377static struct resource sx1_new_flash_resource = {
378 .start = OMAP_CS0_PHYS,
379 .end = OMAP_CS0_PHYS + SZ_32M - 1,
380 .flags = IORESOURCE_MEM,
381};
382
383static struct platform_device sx1_flash_device = {
384 .name = "omapflash",
385 .id = 0,
386 .dev = {
387 .platform_data = &sx1_flash_data,
388 },
389 .num_resources = 1,
390 .resource = &sx1_new_flash_resource,
391};
392#endif
393
394/*----------- USB -------------------------*/
395
396static struct omap_usb_config sx1_usb_config __initdata = {
397 .otg = 0,
398 .register_dev = 1,
399 .register_host = 0,
400 .hmc_mode = 0,
401 .pins[0] = 2,
402 .pins[1] = 0,
403 .pins[2] = 0,
404};
405
406/*----------- MMC -------------------------*/
407
408static struct omap_mmc_config sx1_mmc_config __initdata = {
409 .mmc [0] = {
410 .enabled = 1,
411 .wire4 = 0,
412 .wp_pin = -1,
413 .power_pin = -1, /* power is in Sofia */
414 .switch_pin = OMAP_MPUIO(3),
415 },
416};
417
418/*----------- LCD -------------------------*/
419
420static struct platform_device sx1_lcd_device = {
421 .name = "lcd_sx1",
422 .id = -1,
423};
424
425static struct omap_lcd_config sx1_lcd_config __initdata = {
426 .ctrl_name = "internal",
427};
428
429/*-----------------------------------------*/
430static struct platform_device *sx1_devices[] __initdata = {
431 &sx1_flash_device,
432 &sx1_kp_device,
433 &sx1_lcd_device,
434 &sx1_mcbsp1_device,
435 &sx1_irda_device,
436};
437/*-----------------------------------------*/
438
439static struct omap_uart_config sx1_uart_config __initdata = {
440 .enabled_uarts = ((1 << 0) | (1 << 1) | (1 << 2)),
441};
442
443static struct omap_board_config_kernel sx1_config[] = {
444 { OMAP_TAG_USB, &sx1_usb_config },
445 { OMAP_TAG_MMC, &sx1_mmc_config },
446 { OMAP_TAG_LCD, &sx1_lcd_config },
447 { OMAP_TAG_UART, &sx1_uart_config },
448};
449/*-----------------------------------------*/
450static void __init omap_sx1_init(void)
451{
452 platform_add_devices(sx1_devices, ARRAY_SIZE(sx1_devices));
453
454 omap_board_config = sx1_config;
455 omap_board_config_size = ARRAY_SIZE(sx1_config);
456 omap_serial_init();
457
458 /* turn on USB power */
459 /* sx1_setusbpower(1); cant do it here because i2c is not ready */
460 omap_request_gpio(1); /* A_IRDA_OFF */
461 omap_request_gpio(11); /* A_SWITCH */
462 omap_request_gpio(15); /* A_USB_ON */
463 omap_set_gpio_direction(1, 0);/* gpio1 -> output */
464 omap_set_gpio_direction(11, 0);/* gpio11 -> output */
465 omap_set_gpio_direction(15, 0);/* gpio15 -> output */
466 /* set GPIO data */
467 omap_set_gpio_dataout(1, 1);/*A_IRDA_OFF = 1 */
468 omap_set_gpio_dataout(11, 0);/*A_SWITCH = 0 */
469 omap_set_gpio_dataout(15, 0);/*A_USB_ON = 0 */
470
471}
472/*----------------------------------------*/
473static void __init omap_sx1_init_irq(void)
474{
475 omap1_init_common_hw();
476 omap_init_irq();
477 omap_gpio_init();
478}
479/*----------------------------------------*/
480
481static void __init omap_sx1_map_io(void)
482{
483 omap1_map_common_io();
484}
485
486MACHINE_START(SX1, "OMAP310 based Siemens SX1")
487 .phys_io = 0xfff00000,
488 .io_pg_offst = ((0xfef00000) >> 18) & 0xfffc,
489 .boot_params = 0x10000100,
490 .map_io = omap_sx1_map_io,
491 .init_irq = omap_sx1_init_irq,
492 .init_machine = omap_sx1_init,
493 .timer = &omap_timer,
494MACHINE_END
diff --git a/arch/arm/mach-omap1/board-voiceblue.c b/arch/arm/mach-omap1/board-voiceblue.c
index 447a586eb334..214dd19889ac 100644
--- a/arch/arm/mach-omap1/board-voiceblue.c
+++ b/arch/arm/mach-omap1/board-voiceblue.c
@@ -235,7 +235,7 @@ static struct notifier_block panic_block = {
235static int __init voiceblue_setup(void) 235static int __init voiceblue_setup(void)
236{ 236{
237 /* Setup panic notifier */ 237 /* Setup panic notifier */
238 notifier_chain_register(&panic_notifier_list, &panic_block); 238 atomic_notifier_chain_register(&panic_notifier_list, &panic_block);
239 239
240 return 0; 240 return 0;
241} 241}
diff --git a/arch/arm/mach-omap1/clock.c b/arch/arm/mach-omap1/clock.c
index f625f6dd228a..5d9faa68d2ec 100644
--- a/arch/arm/mach-omap1/clock.c
+++ b/arch/arm/mach-omap1/clock.c
@@ -49,6 +49,15 @@ static void omap1_uart_recalc(struct clk * clk)
49 clk->rate = 12000000; 49 clk->rate = 12000000;
50} 50}
51 51
52static void omap1_sossi_recalc(struct clk *clk)
53{
54 u32 div = omap_readl(MOD_CONF_CTRL_1);
55
56 div = (div >> 17) & 0x7;
57 div++;
58 clk->rate = clk->parent->rate / div;
59}
60
52static int omap1_clk_enable_dsp_domain(struct clk *clk) 61static int omap1_clk_enable_dsp_domain(struct clk *clk)
53{ 62{
54 int retval; 63 int retval;
@@ -396,6 +405,31 @@ static int omap1_set_ext_clk_rate(struct clk * clk, unsigned long rate)
396 return 0; 405 return 0;
397} 406}
398 407
408static int omap1_set_sossi_rate(struct clk *clk, unsigned long rate)
409{
410 u32 l;
411 int div;
412 unsigned long p_rate;
413
414 p_rate = clk->parent->rate;
415 /* Round towards slower frequency */
416 div = (p_rate + rate - 1) / rate;
417 div--;
418 if (div < 0 || div > 7)
419 return -EINVAL;
420
421 l = omap_readl(MOD_CONF_CTRL_1);
422 l &= ~(7 << 17);
423 l |= div << 17;
424 omap_writel(l, MOD_CONF_CTRL_1);
425
426 clk->rate = p_rate / (div + 1);
427 if (unlikely(clk->flags & RATE_PROPAGATES))
428 propagate_rate(clk);
429
430 return 0;
431}
432
399static long omap1_round_ext_clk_rate(struct clk * clk, unsigned long rate) 433static long omap1_round_ext_clk_rate(struct clk * clk, unsigned long rate)
400{ 434{
401 return 96000000 / calc_ext_dsor(rate); 435 return 96000000 / calc_ext_dsor(rate);
diff --git a/arch/arm/mach-omap1/clock.h b/arch/arm/mach-omap1/clock.h
index f7df00205c4a..6eadf72828d8 100644
--- a/arch/arm/mach-omap1/clock.h
+++ b/arch/arm/mach-omap1/clock.h
@@ -17,6 +17,8 @@ static int omap1_clk_enable_generic(struct clk * clk);
17static void omap1_clk_disable_generic(struct clk * clk); 17static void omap1_clk_disable_generic(struct clk * clk);
18static void omap1_ckctl_recalc(struct clk * clk); 18static void omap1_ckctl_recalc(struct clk * clk);
19static void omap1_watchdog_recalc(struct clk * clk); 19static void omap1_watchdog_recalc(struct clk * clk);
20static int omap1_set_sossi_rate(struct clk *clk, unsigned long rate);
21static void omap1_sossi_recalc(struct clk *clk);
20static void omap1_ckctl_recalc_dsp_domain(struct clk * clk); 22static void omap1_ckctl_recalc_dsp_domain(struct clk * clk);
21static int omap1_clk_enable_dsp_domain(struct clk * clk); 23static int omap1_clk_enable_dsp_domain(struct clk * clk);
22static int omap1_clk_set_rate_dsp_domain(struct clk * clk, unsigned long rate); 24static int omap1_clk_set_rate_dsp_domain(struct clk * clk, unsigned long rate);
@@ -168,9 +170,10 @@ static struct clk ck_dpll1 = {
168 170
169static struct arm_idlect1_clk ck_dpll1out = { 171static struct arm_idlect1_clk ck_dpll1out = {
170 .clk = { 172 .clk = {
171 .name = "ck_dpll1out", 173 .name = "ck_dpll1out",
172 .parent = &ck_dpll1, 174 .parent = &ck_dpll1,
173 .flags = CLOCK_IN_OMAP16XX | CLOCK_IDLE_CONTROL, 175 .flags = CLOCK_IN_OMAP16XX | CLOCK_IDLE_CONTROL |
176 ENABLE_REG_32BIT | RATE_PROPAGATES,
174 .enable_reg = (void __iomem *)ARM_IDLECT2, 177 .enable_reg = (void __iomem *)ARM_IDLECT2,
175 .enable_bit = EN_CKOUT_ARM, 178 .enable_bit = EN_CKOUT_ARM,
176 .recalc = &followparent_recalc, 179 .recalc = &followparent_recalc,
@@ -180,6 +183,19 @@ static struct arm_idlect1_clk ck_dpll1out = {
180 .idlect_shift = 12, 183 .idlect_shift = 12,
181}; 184};
182 185
186static struct clk sossi_ck = {
187 .name = "ck_sossi",
188 .parent = &ck_dpll1out.clk,
189 .flags = CLOCK_IN_OMAP16XX | CLOCK_NO_IDLE_PARENT |
190 ENABLE_REG_32BIT,
191 .enable_reg = (void __iomem *)MOD_CONF_CTRL_1,
192 .enable_bit = 16,
193 .recalc = &omap1_sossi_recalc,
194 .set_rate = &omap1_set_sossi_rate,
195 .enable = &omap1_clk_enable_generic,
196 .disable = &omap1_clk_disable_generic,
197};
198
183static struct clk arm_ck = { 199static struct clk arm_ck = {
184 .name = "arm_ck", 200 .name = "arm_ck",
185 .parent = &ck_dpll1, 201 .parent = &ck_dpll1,
@@ -282,7 +298,7 @@ static struct clk arminth_ck16xx = {
282static struct clk dsp_ck = { 298static struct clk dsp_ck = {
283 .name = "dsp_ck", 299 .name = "dsp_ck",
284 .parent = &ck_dpll1, 300 .parent = &ck_dpll1,
285 .flags = CLOCK_IN_OMAP1510 | CLOCK_IN_OMAP16XX | 301 .flags = CLOCK_IN_OMAP310 | CLOCK_IN_OMAP1510 | CLOCK_IN_OMAP16XX |
286 RATE_CKCTL, 302 RATE_CKCTL,
287 .enable_reg = (void __iomem *)ARM_CKCTL, 303 .enable_reg = (void __iomem *)ARM_CKCTL,
288 .enable_bit = EN_DSPCK, 304 .enable_bit = EN_DSPCK,
@@ -295,7 +311,7 @@ static struct clk dsp_ck = {
295static struct clk dspmmu_ck = { 311static struct clk dspmmu_ck = {
296 .name = "dspmmu_ck", 312 .name = "dspmmu_ck",
297 .parent = &ck_dpll1, 313 .parent = &ck_dpll1,
298 .flags = CLOCK_IN_OMAP1510 | CLOCK_IN_OMAP16XX | 314 .flags = CLOCK_IN_OMAP310 | CLOCK_IN_OMAP1510 | CLOCK_IN_OMAP16XX |
299 RATE_CKCTL | ALWAYS_ENABLED, 315 RATE_CKCTL | ALWAYS_ENABLED,
300 .rate_offset = CKCTL_DSPMMUDIV_OFFSET, 316 .rate_offset = CKCTL_DSPMMUDIV_OFFSET,
301 .recalc = &omap1_ckctl_recalc, 317 .recalc = &omap1_ckctl_recalc,
@@ -306,7 +322,7 @@ static struct clk dspmmu_ck = {
306static struct clk dspper_ck = { 322static struct clk dspper_ck = {
307 .name = "dspper_ck", 323 .name = "dspper_ck",
308 .parent = &ck_dpll1, 324 .parent = &ck_dpll1,
309 .flags = CLOCK_IN_OMAP1510 | CLOCK_IN_OMAP16XX | 325 .flags = CLOCK_IN_OMAP310 | CLOCK_IN_OMAP1510 | CLOCK_IN_OMAP16XX |
310 RATE_CKCTL | VIRTUAL_IO_ADDRESS, 326 RATE_CKCTL | VIRTUAL_IO_ADDRESS,
311 .enable_reg = (void __iomem *)DSP_IDLECT2, 327 .enable_reg = (void __iomem *)DSP_IDLECT2,
312 .enable_bit = EN_PERCK, 328 .enable_bit = EN_PERCK,
@@ -320,7 +336,7 @@ static struct clk dspper_ck = {
320static struct clk dspxor_ck = { 336static struct clk dspxor_ck = {
321 .name = "dspxor_ck", 337 .name = "dspxor_ck",
322 .parent = &ck_ref, 338 .parent = &ck_ref,
323 .flags = CLOCK_IN_OMAP1510 | CLOCK_IN_OMAP16XX | 339 .flags = CLOCK_IN_OMAP310 | CLOCK_IN_OMAP1510 | CLOCK_IN_OMAP16XX |
324 VIRTUAL_IO_ADDRESS, 340 VIRTUAL_IO_ADDRESS,
325 .enable_reg = (void __iomem *)DSP_IDLECT2, 341 .enable_reg = (void __iomem *)DSP_IDLECT2,
326 .enable_bit = EN_XORPCK, 342 .enable_bit = EN_XORPCK,
@@ -332,7 +348,7 @@ static struct clk dspxor_ck = {
332static struct clk dsptim_ck = { 348static struct clk dsptim_ck = {
333 .name = "dsptim_ck", 349 .name = "dsptim_ck",
334 .parent = &ck_ref, 350 .parent = &ck_ref,
335 .flags = CLOCK_IN_OMAP1510 | CLOCK_IN_OMAP16XX | 351 .flags = CLOCK_IN_OMAP310 | CLOCK_IN_OMAP1510 | CLOCK_IN_OMAP16XX |
336 VIRTUAL_IO_ADDRESS, 352 VIRTUAL_IO_ADDRESS,
337 .enable_reg = (void __iomem *)DSP_IDLECT2, 353 .enable_reg = (void __iomem *)DSP_IDLECT2,
338 .enable_bit = EN_DSPTIMCK, 354 .enable_bit = EN_DSPTIMCK,
@@ -374,7 +390,7 @@ static struct clk arminth_ck1510 = {
374 390
375static struct clk tipb_ck = { 391static struct clk tipb_ck = {
376 /* No-idle controlled by "tc_ck" */ 392 /* No-idle controlled by "tc_ck" */
377 .name = "tibp_ck", 393 .name = "tipb_ck",
378 .parent = &tc_ck.clk, 394 .parent = &tc_ck.clk,
379 .flags = CLOCK_IN_OMAP1510 | CLOCK_IN_OMAP310 | 395 .flags = CLOCK_IN_OMAP1510 | CLOCK_IN_OMAP310 |
380 ALWAYS_ENABLED, 396 ALWAYS_ENABLED,
@@ -733,7 +749,7 @@ remains active during MPU idle whenever this is enabled */
733static struct clk i2c_fck = { 749static struct clk i2c_fck = {
734 .name = "i2c_fck", 750 .name = "i2c_fck",
735 .id = 1, 751 .id = 1,
736 .flags = CLOCK_IN_OMAP1510 | CLOCK_IN_OMAP16XX | 752 .flags = CLOCK_IN_OMAP310 | CLOCK_IN_OMAP1510 | CLOCK_IN_OMAP16XX |
737 VIRTUAL_CLOCK | CLOCK_NO_IDLE_PARENT | 753 VIRTUAL_CLOCK | CLOCK_NO_IDLE_PARENT |
738 ALWAYS_ENABLED, 754 ALWAYS_ENABLED,
739 .parent = &armxor_ck.clk, 755 .parent = &armxor_ck.clk,
@@ -760,6 +776,7 @@ static struct clk * onchip_clks[] = {
760 &ck_dpll1, 776 &ck_dpll1,
761 /* CK_GEN1 clocks */ 777 /* CK_GEN1 clocks */
762 &ck_dpll1out.clk, 778 &ck_dpll1out.clk,
779 &sossi_ck,
763 &arm_ck, 780 &arm_ck,
764 &armper_ck.clk, 781 &armper_ck.clk,
765 &arm_gpio_ck, 782 &arm_gpio_ck,
diff --git a/arch/arm/mach-omap1/leds-innovator.c b/arch/arm/mach-omap1/leds-innovator.c
index a0cd001ac39a..e7835d6f53a0 100644
--- a/arch/arm/mach-omap1/leds-innovator.c
+++ b/arch/arm/mach-omap1/leds-innovator.c
@@ -95,8 +95,5 @@ void innovator_leds_event(led_event_t evt)
95 break; 95 break;
96 } 96 }
97 97
98 if (led_state & LED_STATE_ENABLED)
99 ;
100
101 local_irq_restore(flags); 98 local_irq_restore(flags);
102} 99}
diff --git a/arch/arm/mach-omap1/mux.c b/arch/arm/mach-omap1/mux.c
index 5432335bc493..52c70e5fcf65 100644
--- a/arch/arm/mach-omap1/mux.c
+++ b/arch/arm/mach-omap1/mux.c
@@ -283,6 +283,30 @@ MUX_CFG("R11_1610_CF_IOIS16", B, 0, 3, 2, 16, 1, 2, 1, 1)
283MUX_CFG("V10_1610_CF_IREQ", A, 24, 3, 2, 14, 0, 2, 0, 1) 283MUX_CFG("V10_1610_CF_IREQ", A, 24, 3, 2, 14, 0, 2, 0, 1)
284MUX_CFG("W10_1610_CF_RESET", A, 18, 3, 2, 12, 1, 2, 1, 1) 284MUX_CFG("W10_1610_CF_RESET", A, 18, 3, 2, 12, 1, 2, 1, 1)
285MUX_CFG("W11_1610_CF_CD1", 10, 15, 3, 3, 8, 1, 3, 1, 1) 285MUX_CFG("W11_1610_CF_CD1", 10, 15, 3, 3, 8, 1, 3, 1, 1)
286
287/* parallel camera */
288MUX_CFG("J15_1610_CAM_LCLK", 4, 24, 0, 0, 18, 1, 0, 0, 0)
289MUX_CFG("J18_1610_CAM_D7", 4, 27, 0, 0, 19, 1, 0, 0, 0)
290MUX_CFG("J19_1610_CAM_D6", 5, 0, 0, 0, 20, 1, 0, 0, 0)
291MUX_CFG("J14_1610_CAM_D5", 5, 3, 0, 0, 21, 1, 0, 0, 0)
292MUX_CFG("K18_1610_CAM_D4", 5, 6, 0, 0, 22, 1, 0, 0, 0)
293MUX_CFG("K19_1610_CAM_D3", 5, 9, 0, 0, 23, 1, 0, 0, 0)
294MUX_CFG("K15_1610_CAM_D2", 5, 12, 0, 0, 24, 1, 0, 0, 0)
295MUX_CFG("K14_1610_CAM_D1", 5, 15, 0, 0, 25, 1, 0, 0, 0)
296MUX_CFG("L19_1610_CAM_D0", 5, 18, 0, 0, 26, 1, 0, 0, 0)
297MUX_CFG("L18_1610_CAM_VS", 5, 21, 0, 0, 27, 1, 0, 0, 0)
298MUX_CFG("L15_1610_CAM_HS", 5, 24, 0, 0, 28, 1, 0, 0, 0)
299MUX_CFG("M19_1610_CAM_RSTZ", 5, 27, 0, 0, 29, 0, 0, 0, 0)
300MUX_CFG("Y15_1610_CAM_OUTCLK", A, 0, 6, 2, 6, 0, 2, 0, 0)
301
302/* serial camera */
303MUX_CFG("H19_1610_CAM_EXCLK", 4, 21, 0, 0, 17, 0, 0, 0, 0)
304 /* REVISIT 5912 spec sez CCP_* can't pullup or pulldown ... ? */
305MUX_CFG("Y12_1610_CCP_CLKP", 8, 18, 6, 1, 24, 1, 1, 0, 0)
306MUX_CFG("W13_1610_CCP_CLKM", 9, 0, 6, 1, 28, 1, 1, 0, 0)
307MUX_CFG("W14_1610_CCP_DATAP", 9, 24, 6, 2, 4, 1, 2, 0, 0)
308MUX_CFG("Y14_1610_CCP_DATAM", 9, 21, 6, 2, 3, 1, 2, 0, 0)
309
286}; 310};
287#endif /* CONFIG_ARCH_OMAP15XX || CONFIG_ARCH_OMAP16XX */ 311#endif /* CONFIG_ARCH_OMAP15XX || CONFIG_ARCH_OMAP16XX */
288 312
diff --git a/arch/arm/mach-omap1/pm.c b/arch/arm/mach-omap1/pm.c
index 2e68be607295..089b8208de0e 100644
--- a/arch/arm/mach-omap1/pm.c
+++ b/arch/arm/mach-omap1/pm.c
@@ -153,11 +153,8 @@ void omap_pm_idle(void)
153 use_idlect1 = omap_dm_timer_modify_idlect_mask(use_idlect1); 153 use_idlect1 = omap_dm_timer_modify_idlect_mask(use_idlect1);
154#endif 154#endif
155 155
156 if (omap_dma_running()) { 156 if (omap_dma_running())
157 use_idlect1 &= ~(1 << 6); 157 use_idlect1 &= ~(1 << 6);
158 if (omap_lcd_dma_ext_running())
159 use_idlect1 &= ~(1 << 12);
160 }
161 158
162 /* We should be able to remove the do_sleep variable and multiple 159 /* We should be able to remove the do_sleep variable and multiple
163 * tests above as soon as drivers, timer and DMA code have been fixed. 160 * tests above as soon as drivers, timer and DMA code have been fixed.