aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-sa1100
diff options
context:
space:
mode:
authorRussell King <rmk+kernel@arm.linux.org.uk>2009-12-06 12:00:33 -0500
committerRussell King <rmk+kernel@arm.linux.org.uk>2009-12-06 12:00:33 -0500
commit3d14b5beba35250c548d3851a2b84fce742d8311 (patch)
tree065e3d93c3fcbc5ee4c44fa78662393cddbdf6de /arch/arm/mach-sa1100
parent0719dc341389882cc834ed18fc9b7fc6006b2b85 (diff)
parent1bf8e6219552d5dd27012d567ec8c4bb9c2d86b4 (diff)
Merge branch 'sa1100' into devel
Diffstat (limited to 'arch/arm/mach-sa1100')
-rw-r--r--arch/arm/mach-sa1100/Kconfig4
-rw-r--r--arch/arm/mach-sa1100/Makefile4
-rw-r--r--arch/arm/mach-sa1100/assabet.c8
-rw-r--r--arch/arm/mach-sa1100/badge4.c2
-rw-r--r--arch/arm/mach-sa1100/cerf.c4
-rw-r--r--arch/arm/mach-sa1100/collie.c85
-rw-r--r--arch/arm/mach-sa1100/generic.c31
-rw-r--r--arch/arm/mach-sa1100/generic.h11
-rw-r--r--arch/arm/mach-sa1100/h3100.c95
-rw-r--r--arch/arm/mach-sa1100/h3600.c454
-rw-r--r--arch/arm/mach-sa1100/h3xxx.c313
-rw-r--r--arch/arm/mach-sa1100/hackkit.c2
-rw-r--r--arch/arm/mach-sa1100/include/mach/collie.h77
-rw-r--r--arch/arm/mach-sa1100/include/mach/gpio.h19
-rw-r--r--arch/arm/mach-sa1100/include/mach/h3600.h100
-rw-r--r--arch/arm/mach-sa1100/include/mach/h3600_gpio.h77
-rw-r--r--arch/arm/mach-sa1100/include/mach/h3xxx.h94
-rw-r--r--arch/arm/mach-sa1100/include/mach/mcp.h1
-rw-r--r--arch/arm/mach-sa1100/jornada720.c2
-rw-r--r--arch/arm/mach-sa1100/lart.c2
-rw-r--r--arch/arm/mach-sa1100/pleb.c2
-rw-r--r--arch/arm/mach-sa1100/shannon.c4
-rw-r--r--arch/arm/mach-sa1100/simpad.c4
23 files changed, 748 insertions, 647 deletions
diff --git a/arch/arm/mach-sa1100/Kconfig b/arch/arm/mach-sa1100/Kconfig
index 4e5c07f4e456..03a7f3857c5e 100644
--- a/arch/arm/mach-sa1100/Kconfig
+++ b/arch/arm/mach-sa1100/Kconfig
@@ -53,23 +53,23 @@ config SA1100_COLLIE
53 53
54config SA1100_H3100 54config SA1100_H3100
55 bool "Compaq iPAQ H3100" 55 bool "Compaq iPAQ H3100"
56 select HTC_EGPIO
56 help 57 help
57 Say Y here if you intend to run this kernel on the Compaq iPAQ 58 Say Y here if you intend to run this kernel on the Compaq iPAQ
58 H3100 handheld computer. Information about this machine and the 59 H3100 handheld computer. Information about this machine and the
59 Linux port to this machine can be found at: 60 Linux port to this machine can be found at:
60 61
61 <http://www.handhelds.org/Compaq/index.html#iPAQ_H3100> 62 <http://www.handhelds.org/Compaq/index.html#iPAQ_H3100>
62 <http://www.compaq.com/products/handhelds/pocketpc/>
63 63
64config SA1100_H3600 64config SA1100_H3600
65 bool "Compaq iPAQ H3600/H3700" 65 bool "Compaq iPAQ H3600/H3700"
66 select HTC_EGPIO
66 help 67 help
67 Say Y here if you intend to run this kernel on the Compaq iPAQ 68 Say Y here if you intend to run this kernel on the Compaq iPAQ
68 H3600 handheld computer. Information about this machine and the 69 H3600 handheld computer. Information about this machine and the
69 Linux port to this machine can be found at: 70 Linux port to this machine can be found at:
70 71
71 <http://www.handhelds.org/Compaq/index.html#iPAQ_H3600> 72 <http://www.handhelds.org/Compaq/index.html#iPAQ_H3600>
72 <http://www.compaq.com/products/handhelds/pocketpc/>
73 73
74config SA1100_BADGE4 74config SA1100_BADGE4
75 bool "HP Labs BadgePAD 4" 75 bool "HP Labs BadgePAD 4"
diff --git a/arch/arm/mach-sa1100/Makefile b/arch/arm/mach-sa1100/Makefile
index bb7b8198d0c4..89349c1dd7a6 100644
--- a/arch/arm/mach-sa1100/Makefile
+++ b/arch/arm/mach-sa1100/Makefile
@@ -25,8 +25,8 @@ led-$(CONFIG_SA1100_CERF) += leds-cerf.o
25 25
26obj-$(CONFIG_SA1100_COLLIE) += collie.o 26obj-$(CONFIG_SA1100_COLLIE) += collie.o
27 27
28obj-$(CONFIG_SA1100_H3100) += h3600.o 28obj-$(CONFIG_SA1100_H3100) += h3100.o h3xxx.o
29obj-$(CONFIG_SA1100_H3600) += h3600.o 29obj-$(CONFIG_SA1100_H3600) += h3600.o h3xxx.o
30 30
31obj-$(CONFIG_SA1100_HACKKIT) += hackkit.o 31obj-$(CONFIG_SA1100_HACKKIT) += hackkit.o
32led-$(CONFIG_SA1100_HACKKIT) += leds-hackkit.o 32led-$(CONFIG_SA1100_HACKKIT) += leds-hackkit.o
diff --git a/arch/arm/mach-sa1100/assabet.c b/arch/arm/mach-sa1100/assabet.c
index 55e64477a876..169e5b87dbff 100644
--- a/arch/arm/mach-sa1100/assabet.c
+++ b/arch/arm/mach-sa1100/assabet.c
@@ -249,10 +249,10 @@ static void __init assabet_init(void)
249#endif 249#endif
250 } 250 }
251 251
252 sa11x0_set_flash_data(&assabet_flash_data, assabet_flash_resources, 252 sa11x0_register_mtd(&assabet_flash_data, assabet_flash_resources,
253 ARRAY_SIZE(assabet_flash_resources)); 253 ARRAY_SIZE(assabet_flash_resources));
254 sa11x0_set_irda_data(&assabet_irda_data); 254 sa11x0_register_irda(&assabet_irda_data);
255 sa11x0_set_mcp_data(&assabet_mcp_data); 255 sa11x0_register_mcp(&assabet_mcp_data);
256} 256}
257 257
258/* 258/*
diff --git a/arch/arm/mach-sa1100/badge4.c b/arch/arm/mach-sa1100/badge4.c
index ab5883b39ddf..051ec0f0023c 100644
--- a/arch/arm/mach-sa1100/badge4.c
+++ b/arch/arm/mach-sa1100/badge4.c
@@ -212,7 +212,7 @@ static int __init badge4_init(void)
212 /* maybe turn on 5v0 from the start */ 212 /* maybe turn on 5v0 from the start */
213 badge4_set_5V(BADGE4_5V_INITIALLY, five_v_on); 213 badge4_set_5V(BADGE4_5V_INITIALLY, five_v_on);
214 214
215 sa11x0_set_flash_data(&badge4_flash_data, &badge4_flash_resource, 1); 215 sa11x0_register_mtd(&badge4_flash_data, &badge4_flash_resource, 1);
216 216
217 return 0; 217 return 0;
218} 218}
diff --git a/arch/arm/mach-sa1100/cerf.c b/arch/arm/mach-sa1100/cerf.c
index fd3ad9cfc912..bc950ef418af 100644
--- a/arch/arm/mach-sa1100/cerf.c
+++ b/arch/arm/mach-sa1100/cerf.c
@@ -129,8 +129,8 @@ static struct mcp_plat_data cerf_mcp_data = {
129static void __init cerf_init(void) 129static void __init cerf_init(void)
130{ 130{
131 platform_add_devices(cerf_devices, ARRAY_SIZE(cerf_devices)); 131 platform_add_devices(cerf_devices, ARRAY_SIZE(cerf_devices));
132 sa11x0_set_flash_data(&cerf_flash_data, &cerf_flash_resource, 1); 132 sa11x0_register_mtd(&cerf_flash_data, &cerf_flash_resource, 1);
133 sa11x0_set_mcp_data(&cerf_mcp_data); 133 sa11x0_register_mcp(&cerf_mcp_data);
134} 134}
135 135
136MACHINE_START(CERF, "Intrinsyc CerfBoard/CerfCube") 136MACHINE_START(CERF, "Intrinsyc CerfBoard/CerfCube")
diff --git a/arch/arm/mach-sa1100/collie.c b/arch/arm/mach-sa1100/collie.c
index bbf2ebcc3066..9982c5c28edf 100644
--- a/arch/arm/mach-sa1100/collie.c
+++ b/arch/arm/mach-sa1100/collie.c
@@ -26,6 +26,7 @@
26#include <linux/mtd/partitions.h> 26#include <linux/mtd/partitions.h>
27#include <linux/timer.h> 27#include <linux/timer.h>
28#include <linux/gpio.h> 28#include <linux/gpio.h>
29#include <linux/pda_power.h>
29 30
30#include <mach/hardware.h> 31#include <mach/hardware.h>
31#include <asm/mach-types.h> 32#include <asm/mach-types.h>
@@ -56,6 +57,7 @@ static struct resource collie_scoop_resources[] = {
56static struct scoop_config collie_scoop_setup = { 57static struct scoop_config collie_scoop_setup = {
57 .io_dir = COLLIE_SCOOP_IO_DIR, 58 .io_dir = COLLIE_SCOOP_IO_DIR,
58 .io_out = COLLIE_SCOOP_IO_OUT, 59 .io_out = COLLIE_SCOOP_IO_OUT,
60 .gpio_base = COLLIE_SCOOP_GPIO_BASE,
59}; 61};
60 62
61struct platform_device colliescoop_device = { 63struct platform_device colliescoop_device = {
@@ -85,6 +87,70 @@ static struct scoop_pcmcia_config collie_pcmcia_config = {
85static struct mcp_plat_data collie_mcp_data = { 87static struct mcp_plat_data collie_mcp_data = {
86 .mccr0 = MCCR0_ADM | MCCR0_ExtClk, 88 .mccr0 = MCCR0_ADM | MCCR0_ExtClk,
87 .sclk_rate = 9216000, 89 .sclk_rate = 9216000,
90 .gpio_base = COLLIE_TC35143_GPIO_BASE,
91};
92
93/*
94 * Collie AC IN
95 */
96static int collie_power_init(struct device *dev)
97{
98 int ret = gpio_request(COLLIE_GPIO_AC_IN, "ac in");
99 if (ret)
100 goto err_gpio_req;
101
102 ret = gpio_direction_input(COLLIE_GPIO_AC_IN);
103 if (ret)
104 goto err_gpio_in;
105
106 return 0;
107
108err_gpio_in:
109 gpio_free(COLLIE_GPIO_AC_IN);
110err_gpio_req:
111 return ret;
112}
113
114static void collie_power_exit(struct device *dev)
115{
116 gpio_free(COLLIE_GPIO_AC_IN);
117}
118
119static int collie_power_ac_online(void)
120{
121 return gpio_get_value(COLLIE_GPIO_AC_IN) == 2;
122}
123
124static char *collie_ac_supplied_to[] = {
125 "main-battery",
126 "backup-battery",
127};
128
129static struct pda_power_pdata collie_power_data = {
130 .init = collie_power_init,
131 .is_ac_online = collie_power_ac_online,
132 .exit = collie_power_exit,
133 .supplied_to = collie_ac_supplied_to,
134 .num_supplicants = ARRAY_SIZE(collie_ac_supplied_to),
135};
136
137static struct resource collie_power_resource[] = {
138 {
139 .name = "ac",
140 .start = gpio_to_irq(COLLIE_GPIO_AC_IN),
141 .end = gpio_to_irq(COLLIE_GPIO_AC_IN),
142 .flags = IORESOURCE_IRQ |
143 IORESOURCE_IRQ_HIGHEDGE |
144 IORESOURCE_IRQ_LOWEDGE,
145 },
146};
147
148static struct platform_device collie_power_device = {
149 .name = "pda-power",
150 .id = -1,
151 .dev.platform_data = &collie_power_data,
152 .resource = collie_power_resource,
153 .num_resources = ARRAY_SIZE(collie_power_resource),
88}; 154};
89 155
90#ifdef CONFIG_SHARP_LOCOMO 156#ifdef CONFIG_SHARP_LOCOMO
@@ -178,6 +244,7 @@ struct platform_device collie_locomo_device = {
178static struct platform_device *devices[] __initdata = { 244static struct platform_device *devices[] __initdata = {
179 &collie_locomo_device, 245 &collie_locomo_device,
180 &colliescoop_device, 246 &colliescoop_device,
247 &collie_power_device,
181}; 248};
182 249
183static struct mtd_partition collie_partitions[] = { 250static struct mtd_partition collie_partitions[] = {
@@ -248,22 +315,24 @@ static void __init collie_init(void)
248 GPDR = GPIO_LDD8 | GPIO_LDD9 | GPIO_LDD10 | GPIO_LDD11 | GPIO_LDD12 | 315 GPDR = GPIO_LDD8 | GPIO_LDD9 | GPIO_LDD10 | GPIO_LDD11 | GPIO_LDD12 |
249 GPIO_LDD13 | GPIO_LDD14 | GPIO_LDD15 | GPIO_SSP_TXD | 316 GPIO_LDD13 | GPIO_LDD14 | GPIO_LDD15 | GPIO_SSP_TXD |
250 GPIO_SSP_SCLK | GPIO_SSP_SFRM | GPIO_SDLC_SCLK | 317 GPIO_SSP_SCLK | GPIO_SSP_SFRM | GPIO_SDLC_SCLK |
251 COLLIE_GPIO_UCB1x00_RESET | COLLIE_GPIO_nMIC_ON | 318 _COLLIE_GPIO_UCB1x00_RESET | _COLLIE_GPIO_nMIC_ON |
252 COLLIE_GPIO_nREMOCON_ON | GPIO_32_768kHz; 319 _COLLIE_GPIO_nREMOCON_ON | GPIO_32_768kHz;
253 320
254 PPDR = PPC_LDD0 | PPC_LDD1 | PPC_LDD2 | PPC_LDD3 | PPC_LDD4 | PPC_LDD5 | 321 PPDR = PPC_LDD0 | PPC_LDD1 | PPC_LDD2 | PPC_LDD3 | PPC_LDD4 | PPC_LDD5 |
255 PPC_LDD6 | PPC_LDD7 | PPC_L_PCLK | PPC_L_LCLK | PPC_L_FCLK | PPC_L_BIAS | 322 PPC_LDD6 | PPC_LDD7 | PPC_L_PCLK | PPC_L_LCLK | PPC_L_FCLK | PPC_L_BIAS |
256 PPC_TXD1 | PPC_TXD2 | PPC_TXD3 | PPC_TXD4 | PPC_SCLK | PPC_SFRM; 323 PPC_TXD1 | PPC_TXD2 | PPC_TXD3 | PPC_TXD4 | PPC_SCLK | PPC_SFRM;
257 324
258 PWER = COLLIE_GPIO_AC_IN | COLLIE_GPIO_CO | COLLIE_GPIO_ON_KEY | 325 PWER = _COLLIE_GPIO_AC_IN | _COLLIE_GPIO_CO | _COLLIE_GPIO_ON_KEY |
259 COLLIE_GPIO_WAKEUP | COLLIE_GPIO_nREMOCON_INT | PWER_RTC; 326 _COLLIE_GPIO_WAKEUP | _COLLIE_GPIO_nREMOCON_INT | PWER_RTC;
260 327
261 PGSR = COLLIE_GPIO_nREMOCON_ON; 328 PGSR = _COLLIE_GPIO_nREMOCON_ON;
262 329
263 PSDR = PPC_RXD1 | PPC_RXD2 | PPC_RXD3 | PPC_RXD4; 330 PSDR = PPC_RXD1 | PPC_RXD2 | PPC_RXD3 | PPC_RXD4;
264 331
265 PCFR = PCFR_OPDE; 332 PCFR = PCFR_OPDE;
266 333
334 GPSR |= _COLLIE_GPIO_UCB1x00_RESET;
335
267 336
268 platform_scoop_config = &collie_pcmcia_config; 337 platform_scoop_config = &collie_pcmcia_config;
269 338
@@ -272,9 +341,9 @@ static void __init collie_init(void)
272 printk(KERN_WARNING "collie: Unable to register LoCoMo device\n"); 341 printk(KERN_WARNING "collie: Unable to register LoCoMo device\n");
273 } 342 }
274 343
275 sa11x0_set_flash_data(&collie_flash_data, collie_flash_resources, 344 sa11x0_register_mtd(&collie_flash_data, collie_flash_resources,
276 ARRAY_SIZE(collie_flash_resources)); 345 ARRAY_SIZE(collie_flash_resources));
277 sa11x0_set_mcp_data(&collie_mcp_data); 346 sa11x0_register_mcp(&collie_mcp_data);
278 347
279 sharpsl_save_param(); 348 sharpsl_save_param();
280} 349}
diff --git a/arch/arm/mach-sa1100/generic.c b/arch/arm/mach-sa1100/generic.c
index 23cfdd593954..9faea1511c1f 100644
--- a/arch/arm/mach-sa1100/generic.c
+++ b/arch/arm/mach-sa1100/generic.c
@@ -162,6 +162,17 @@ static void sa1100_power_off(void)
162 PMCR = PMCR_SF; 162 PMCR = PMCR_SF;
163} 163}
164 164
165static void sa11x0_register_device(struct platform_device *dev, void *data)
166{
167 int err;
168 dev->dev.platform_data = data;
169 err = platform_device_register(dev);
170 if (err)
171 printk(KERN_ERR "Unable to register device %s: %d\n",
172 dev->name, err);
173}
174
175
165static struct resource sa11x0udc_resources[] = { 176static struct resource sa11x0udc_resources[] = {
166 [0] = { 177 [0] = {
167 .start = 0x80000000, 178 .start = 0x80000000,
@@ -234,9 +245,9 @@ static struct platform_device sa11x0mcp_device = {
234 .resource = sa11x0mcp_resources, 245 .resource = sa11x0mcp_resources,
235}; 246};
236 247
237void sa11x0_set_mcp_data(struct mcp_plat_data *data) 248void sa11x0_register_mcp(struct mcp_plat_data *data)
238{ 249{
239 sa11x0mcp_device.dev.platform_data = data; 250 sa11x0_register_device(&sa11x0mcp_device, data);
240} 251}
241 252
242static struct resource sa11x0ssp_resources[] = { 253static struct resource sa11x0ssp_resources[] = {
@@ -293,13 +304,13 @@ static struct platform_device sa11x0mtd_device = {
293 .id = -1, 304 .id = -1,
294}; 305};
295 306
296void sa11x0_set_flash_data(struct flash_platform_data *flash, 307void sa11x0_register_mtd(struct flash_platform_data *flash,
297 struct resource *res, int nr) 308 struct resource *res, int nr)
298{ 309{
299 flash->name = "sa1100"; 310 flash->name = "sa1100";
300 sa11x0mtd_device.dev.platform_data = flash;
301 sa11x0mtd_device.resource = res; 311 sa11x0mtd_device.resource = res;
302 sa11x0mtd_device.num_resources = nr; 312 sa11x0mtd_device.num_resources = nr;
313 sa11x0_register_device(&sa11x0mtd_device, flash);
303} 314}
304 315
305static struct resource sa11x0ir_resources[] = { 316static struct resource sa11x0ir_resources[] = {
@@ -329,9 +340,9 @@ static struct platform_device sa11x0ir_device = {
329 .resource = sa11x0ir_resources, 340 .resource = sa11x0ir_resources,
330}; 341};
331 342
332void sa11x0_set_irda_data(struct irda_platform_data *irda) 343void sa11x0_register_irda(struct irda_platform_data *irda)
333{ 344{
334 sa11x0ir_device.dev.platform_data = irda; 345 sa11x0_register_device(&sa11x0ir_device, irda);
335} 346}
336 347
337static struct platform_device sa11x0rtc_device = { 348static struct platform_device sa11x0rtc_device = {
@@ -343,21 +354,15 @@ static struct platform_device *sa11x0_devices[] __initdata = {
343 &sa11x0udc_device, 354 &sa11x0udc_device,
344 &sa11x0uart1_device, 355 &sa11x0uart1_device,
345 &sa11x0uart3_device, 356 &sa11x0uart3_device,
346 &sa11x0mcp_device,
347 &sa11x0ssp_device, 357 &sa11x0ssp_device,
348 &sa11x0pcmcia_device, 358 &sa11x0pcmcia_device,
349 &sa11x0fb_device, 359 &sa11x0fb_device,
350 &sa11x0mtd_device,
351 &sa11x0rtc_device, 360 &sa11x0rtc_device,
352}; 361};
353 362
354static int __init sa1100_init(void) 363static int __init sa1100_init(void)
355{ 364{
356 pm_power_off = sa1100_power_off; 365 pm_power_off = sa1100_power_off;
357
358 if (sa11x0ir_device.dev.platform_data)
359 platform_device_register(&sa11x0ir_device);
360
361 return platform_add_devices(sa11x0_devices, ARRAY_SIZE(sa11x0_devices)); 366 return platform_add_devices(sa11x0_devices, ARRAY_SIZE(sa11x0_devices));
362} 367}
363 368
diff --git a/arch/arm/mach-sa1100/generic.h b/arch/arm/mach-sa1100/generic.h
index 793c2e6c991f..ec03f187c52b 100644
--- a/arch/arm/mach-sa1100/generic.h
+++ b/arch/arm/mach-sa1100/generic.h
@@ -32,14 +32,11 @@ extern unsigned int sa11x0_ppcr_to_freq(unsigned int idx);
32struct flash_platform_data; 32struct flash_platform_data;
33struct resource; 33struct resource;
34 34
35extern void sa11x0_set_flash_data(struct flash_platform_data *flash, 35void sa11x0_register_mtd(struct flash_platform_data *flash,
36 struct resource *res, int nr); 36 struct resource *res, int nr);
37
38struct sa11x0_ssp_plat_ops;
39extern void sa11x0_set_ssp_data(struct sa11x0_ssp_plat_ops *ops);
40 37
41struct irda_platform_data; 38struct irda_platform_data;
42void sa11x0_set_irda_data(struct irda_platform_data *irda); 39void sa11x0_register_irda(struct irda_platform_data *irda);
43 40
44struct mcp_plat_data; 41struct mcp_plat_data;
45void sa11x0_set_mcp_data(struct mcp_plat_data *data); 42void sa11x0_register_mcp(struct mcp_plat_data *data);
diff --git a/arch/arm/mach-sa1100/h3100.c b/arch/arm/mach-sa1100/h3100.c
new file mode 100644
index 000000000000..0c7cea0dc013
--- /dev/null
+++ b/arch/arm/mach-sa1100/h3100.c
@@ -0,0 +1,95 @@
1/*
2 * Support for Compaq iPAQ H3100 handheld computer
3 *
4 * Copyright (c) 2000,1 Compaq Computer Corporation. (Author: Jamey Hicks)
5 * Copyright (c) 2009 Dmitry Artamonow <mad_soft@inbox.ru>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10 *
11 */
12
13#include <linux/init.h>
14#include <linux/kernel.h>
15#include <linux/gpio.h>
16
17#include <asm/mach-types.h>
18#include <asm/mach/arch.h>
19#include <asm/mach/irda.h>
20
21#include <mach/h3xxx.h>
22
23#include "generic.h"
24
25/*
26 * helper for sa1100fb
27 */
28static void h3100_lcd_power(int enable)
29{
30 if (!gpio_request(H3XXX_EGPIO_LCD_ON, "LCD ON")) {
31 gpio_set_value(H3100_GPIO_LCD_3V_ON, enable);
32 gpio_direction_output(H3XXX_EGPIO_LCD_ON, enable);
33 gpio_free(H3XXX_EGPIO_LCD_ON);
34 } else {
35 pr_err("%s: can't request H3XXX_EGPIO_LCD_ON\n", __func__);
36 }
37}
38
39
40static void __init h3100_map_io(void)
41{
42 h3xxx_map_io();
43
44 sa1100fb_lcd_power = h3100_lcd_power;
45
46 /* Older bootldrs put GPIO2-9 in alternate mode on the
47 assumption that they are used for video */
48 GAFR &= ~0x000001fb;
49}
50
51/*
52 * This turns the IRDA power on or off on the Compaq H3100
53 */
54static int h3100_irda_set_power(struct device *dev, unsigned int state)
55{
56 gpio_set_value(H3100_GPIO_IR_ON, state);
57 return 0;
58}
59
60static void h3100_irda_set_speed(struct device *dev, unsigned int speed)
61{
62 gpio_set_value(H3100_GPIO_IR_FSEL, !(speed < 4000000));
63}
64
65static struct irda_platform_data h3100_irda_data = {
66 .set_power = h3100_irda_set_power,
67 .set_speed = h3100_irda_set_speed,
68};
69
70static struct gpio_default_state h3100_default_gpio[] = {
71 { H3100_GPIO_IR_ON, GPIO_MODE_OUT0, "IrDA power" },
72 { H3100_GPIO_IR_FSEL, GPIO_MODE_OUT0, "IrDA fsel" },
73 { H3XXX_GPIO_COM_DCD, GPIO_MODE_IN, "COM DCD" },
74 { H3XXX_GPIO_COM_CTS, GPIO_MODE_IN, "COM CTS" },
75 { H3XXX_GPIO_COM_RTS, GPIO_MODE_OUT0, "COM RTS" },
76 { H3100_GPIO_LCD_3V_ON, GPIO_MODE_OUT0, "LCD 3v" },
77};
78
79static void __init h3100_mach_init(void)
80{
81 h3xxx_init_gpio(h3100_default_gpio, ARRAY_SIZE(h3100_default_gpio));
82 h3xxx_mach_init();
83 sa11x0_register_irda(&h3100_irda_data);
84}
85
86MACHINE_START(H3100, "Compaq iPAQ H3100")
87 .phys_io = 0x80000000,
88 .io_pg_offst = ((0xf8000000) >> 18) & 0xfffc,
89 .boot_params = 0xc0000100,
90 .map_io = h3100_map_io,
91 .init_irq = sa1100_init_irq,
92 .timer = &sa1100_timer,
93 .init_machine = h3100_mach_init,
94MACHINE_END
95
diff --git a/arch/arm/mach-sa1100/h3600.c b/arch/arm/mach-sa1100/h3600.c
index 0eb2f159578b..af3b71459f8d 100644
--- a/arch/arm/mach-sa1100/h3600.c
+++ b/arch/arm/mach-sa1100/h3600.c
@@ -1,421 +1,127 @@
1/* 1/*
2 * Hardware definitions for Compaq iPAQ H3xxx Handheld Computers 2 * Support for Compaq iPAQ H3600 handheld computer
3 * 3 *
4 * Copyright 2000,1 Compaq Computer Corporation. 4 * Copyright (c) 2000,1 Compaq Computer Corporation. (Author: Jamey Hicks)
5 * Copyright (c) 2009 Dmitry Artamonow <mad_soft@inbox.ru>
5 * 6 *
6 * Use consistent with the GNU GPL is permitted, 7 * This program is free software; you can redistribute it and/or modify
7 * provided that this copyright notice is 8 * it under the terms of the GNU General Public License version 2 as
8 * preserved in its entirety in all copies and derived works. 9 * published by the Free Software Foundation.
9 *
10 * COMPAQ COMPUTER CORPORATION MAKES NO WARRANTIES, EXPRESSED OR IMPLIED,
11 * AS TO THE USEFULNESS OR CORRECTNESS OF THIS CODE OR ITS
12 * FITNESS FOR ANY PARTICULAR PURPOSE.
13 *
14 * Author: Jamey Hicks.
15 *
16 * History:
17 *
18 * 2001-10-?? Andrew Christian Added support for iPAQ H3800
19 * and abstracted EGPIO interface.
20 * 10 *
21 */ 11 */
22#include <linux/module.h> 12
23#include <linux/init.h> 13#include <linux/init.h>
24#include <linux/kernel.h> 14#include <linux/kernel.h>
25#include <linux/tty.h> 15#include <linux/gpio.h>
26#include <linux/pm.h>
27#include <linux/device.h>
28#include <linux/mtd/mtd.h>
29#include <linux/mtd/partitions.h>
30#include <linux/serial_core.h>
31 16
32#include <asm/irq.h>
33#include <mach/hardware.h>
34#include <asm/mach-types.h> 17#include <asm/mach-types.h>
35#include <asm/setup.h>
36
37#include <asm/mach/irq.h>
38#include <asm/mach/arch.h> 18#include <asm/mach/arch.h>
39#include <asm/mach/flash.h>
40#include <asm/mach/irda.h> 19#include <asm/mach/irda.h>
41#include <asm/mach/map.h>
42#include <asm/mach/serial_sa1100.h>
43 20
44#include <mach/h3600.h> 21#include <mach/h3xxx.h>
45#include <mach/h3600_gpio.h>
46 22
47#include "generic.h" 23#include "generic.h"
48 24
49void (*assign_h3600_egpio)(enum ipaq_egpio_type x, int level);
50EXPORT_SYMBOL(assign_h3600_egpio);
51
52static struct mtd_partition h3xxx_partitions[] = {
53 {
54 .name = "H3XXX boot firmware",
55 .size = 0x00040000,
56 .offset = 0,
57 .mask_flags = MTD_WRITEABLE, /* force read-only */
58 }, {
59 .name = "H3XXX rootfs",
60 .size = MTDPART_SIZ_FULL,
61 .offset = 0x00040000,
62 }
63};
64
65static void h3xxx_set_vpp(int vpp)
66{
67 assign_h3600_egpio(IPAQ_EGPIO_VPP_ON, vpp);
68}
69
70static struct flash_platform_data h3xxx_flash_data = {
71 .map_name = "cfi_probe",
72 .set_vpp = h3xxx_set_vpp,
73 .parts = h3xxx_partitions,
74 .nr_parts = ARRAY_SIZE(h3xxx_partitions),
75};
76
77static struct resource h3xxx_flash_resource = {
78 .start = SA1100_CS0_PHYS,
79 .end = SA1100_CS0_PHYS + SZ_32M - 1,
80 .flags = IORESOURCE_MEM,
81};
82
83/* 25/*
84 * This turns the IRDA power on or off on the Compaq H3600 26 * helper for sa1100fb
85 */
86static int h3600_irda_set_power(struct device *dev, unsigned int state)
87{
88 assign_h3600_egpio( IPAQ_EGPIO_IR_ON, state );
89
90 return 0;
91}
92
93static void h3600_irda_set_speed(struct device *dev, unsigned int speed)
94{
95 assign_h3600_egpio(IPAQ_EGPIO_IR_FSEL, !(speed < 4000000));
96}
97
98static struct irda_platform_data h3600_irda_data = {
99 .set_power = h3600_irda_set_power,
100 .set_speed = h3600_irda_set_speed,
101};
102
103static void h3xxx_mach_init(void)
104{
105 sa11x0_set_flash_data(&h3xxx_flash_data, &h3xxx_flash_resource, 1);
106 sa11x0_set_irda_data(&h3600_irda_data);
107}
108
109/*
110 * low-level UART features
111 */ 27 */
112 28static void h3600_lcd_power(int enable)
113static void h3600_uart_set_mctrl(struct uart_port *port, u_int mctrl)
114{ 29{
115 if (port->mapbase == _Ser3UTCR0) { 30 if (gpio_request(H3XXX_EGPIO_LCD_ON, "LCD power")) {
116 if (mctrl & TIOCM_RTS) 31 pr_err("%s: can't request H3XXX_EGPIO_LCD_ON\n", __func__);
117 GPCR = GPIO_H3600_COM_RTS; 32 goto err1;
118 else
119 GPSR = GPIO_H3600_COM_RTS;
120 } 33 }
121} 34 if (gpio_request(H3600_EGPIO_LCD_PCI, "LCD control")) {
122 35 pr_err("%s: can't request H3XXX_EGPIO_LCD_PCI\n", __func__);
123static u_int h3600_uart_get_mctrl(struct uart_port *port) 36 goto err2;
124{ 37 }
125 u_int ret = TIOCM_CD | TIOCM_CTS | TIOCM_DSR; 38 if (gpio_request(H3600_EGPIO_LCD_5V_ON, "LCD 5v")) {
126 39 pr_err("%s: can't request H3XXX_EGPIO_LCD_5V_ON\n", __func__);
127 if (port->mapbase == _Ser3UTCR0) { 40 goto err3;
128 int gplr = GPLR; 41 }
129 /* DCD and CTS bits are inverted in GPLR by RS232 transceiver */ 42 if (gpio_request(H3600_EGPIO_LVDD_ON, "LCD 9v/-6.5v")) {
130 if (gplr & GPIO_H3600_COM_DCD) 43 pr_err("%s: can't request H3600_EGPIO_LVDD_ON\n", __func__);
131 ret &= ~TIOCM_CD; 44 goto err4;
132 if (gplr & GPIO_H3600_COM_CTS)
133 ret &= ~TIOCM_CTS;
134 } 45 }
135 46
136 return ret; 47 gpio_direction_output(H3XXX_EGPIO_LCD_ON, enable);
137} 48 gpio_direction_output(H3600_EGPIO_LCD_PCI, enable);
49 gpio_direction_output(H3600_EGPIO_LCD_5V_ON, enable);
50 gpio_direction_output(H3600_EGPIO_LVDD_ON, enable);
138 51
139static void h3600_uart_pm(struct uart_port *port, u_int state, u_int oldstate) 52 gpio_free(H3600_EGPIO_LVDD_ON);
140{ 53err4: gpio_free(H3600_EGPIO_LCD_5V_ON);
141 if (port->mapbase == _Ser2UTCR0) { /* TODO: REMOVE THIS */ 54err3: gpio_free(H3600_EGPIO_LCD_PCI);
142 assign_h3600_egpio(IPAQ_EGPIO_IR_ON, !state); 55err2: gpio_free(H3XXX_EGPIO_LCD_ON);
143 } else if (port->mapbase == _Ser3UTCR0) { 56err1: return;
144 assign_h3600_egpio(IPAQ_EGPIO_RS232_ON, !state);
145 }
146} 57}
147 58
148/* 59static void __init h3600_map_io(void)
149 * Enable/Disable wake up events for this serial port.
150 * Obviously, we only support this on the normal COM port.
151 */
152static int h3600_uart_set_wake(struct uart_port *port, u_int enable)
153{ 60{
154 int err = -EINVAL; 61 h3xxx_map_io();
155 62
156 if (port->mapbase == _Ser3UTCR0) { 63 sa1100fb_lcd_power = h3600_lcd_power;
157 if (enable)
158 PWER |= PWER_GPIO23 | PWER_GPIO25; /* DCD and CTS */
159 else
160 PWER &= ~(PWER_GPIO23 | PWER_GPIO25); /* DCD and CTS */
161 err = 0;
162 }
163 return err;
164} 64}
165 65
166static struct sa1100_port_fns h3600_port_fns __initdata = {
167 .set_mctrl = h3600_uart_set_mctrl,
168 .get_mctrl = h3600_uart_get_mctrl,
169 .pm = h3600_uart_pm,
170 .set_wake = h3600_uart_set_wake,
171};
172
173/* 66/*
174 * helper for sa1100fb 67 * This turns the IRDA power on or off on the Compaq H3600
175 */ 68 */
176static void h3xxx_lcd_power(int enable) 69static int h3600_irda_set_power(struct device *dev, unsigned int state)
177{ 70{
178 assign_h3600_egpio(IPAQ_EGPIO_LCD_POWER, enable); 71 gpio_set_value(H3600_EGPIO_IR_ON, state);
72 return 0;
179} 73}
180 74
181static struct map_desc h3600_io_desc[] __initdata = { 75static void h3600_irda_set_speed(struct device *dev, unsigned int speed)
182 { /* static memory bank 2 CS#2 */
183 .virtual = H3600_BANK_2_VIRT,
184 .pfn = __phys_to_pfn(SA1100_CS2_PHYS),
185 .length = 0x02800000,
186 .type = MT_DEVICE
187 }, { /* static memory bank 4 CS#4 */
188 .virtual = H3600_BANK_4_VIRT,
189 .pfn = __phys_to_pfn(SA1100_CS4_PHYS),
190 .length = 0x00800000,
191 .type = MT_DEVICE
192 }, { /* EGPIO 0 CS#5 */
193 .virtual = H3600_EGPIO_VIRT,
194 .pfn = __phys_to_pfn(H3600_EGPIO_PHYS),
195 .length = 0x01000000,
196 .type = MT_DEVICE
197 }
198};
199
200/*
201 * Common map_io initialization
202 */
203
204static void __init h3xxx_map_io(void)
205{ 76{
206 sa1100_map_io(); 77 gpio_set_value(H3600_EGPIO_IR_FSEL, !(speed < 4000000));
207 iotable_init(h3600_io_desc, ARRAY_SIZE(h3600_io_desc));
208
209 sa1100_register_uart_fns(&h3600_port_fns);
210 sa1100_register_uart(0, 3); /* Common serial port */
211// sa1100_register_uart(1, 1); /* Microcontroller on 3100/3600 */
212
213 /* Ensure those pins are outputs and driving low */
214 PPDR |= PPC_TXD4 | PPC_SCLK | PPC_SFRM;
215 PPSR &= ~(PPC_TXD4 | PPC_SCLK | PPC_SFRM);
216
217 /* Configure suspend conditions */
218 PGSR = 0;
219 PWER = PWER_GPIO0 | PWER_RTC;
220 PCFR = PCFR_OPDE;
221 PSDR = 0;
222
223 sa1100fb_lcd_power = h3xxx_lcd_power;
224} 78}
225 79
226/************************* H3100 *************************/ 80static int h3600_irda_startup(struct device *dev)
227
228#ifdef CONFIG_SA1100_H3100
229
230#define H3100_EGPIO (*(volatile unsigned int *)H3600_EGPIO_VIRT)
231static unsigned int h3100_egpio = 0;
232
233static void h3100_control_egpio(enum ipaq_egpio_type x, int setp)
234{ 81{
235 unsigned int egpio = 0; 82 int err = gpio_request(H3600_EGPIO_IR_ON, "IrDA power");
236 long gpio = 0; 83 if (err)
237 unsigned long flags; 84 goto err1;
238 85 err = gpio_direction_output(H3600_EGPIO_IR_ON, 0);
239 switch (x) { 86 if (err)
240 case IPAQ_EGPIO_LCD_POWER: 87 goto err2;
241 egpio |= EGPIO_H3600_LCD_ON; 88 err = gpio_request(H3600_EGPIO_IR_FSEL, "IrDA fsel");
242 gpio |= GPIO_H3100_LCD_3V_ON; 89 if (err)
243 break; 90 goto err2;
244 case IPAQ_EGPIO_LCD_ENABLE: 91 err = gpio_direction_output(H3600_EGPIO_IR_FSEL, 0);
245 break; 92 if (err)
246 case IPAQ_EGPIO_CODEC_NRESET: 93 goto err3;
247 egpio |= EGPIO_H3600_CODEC_NRESET; 94 return 0;
248 break;
249 case IPAQ_EGPIO_AUDIO_ON:
250 gpio |= GPIO_H3100_AUD_PWR_ON
251 | GPIO_H3100_AUD_ON;
252 break;
253 case IPAQ_EGPIO_QMUTE:
254 gpio |= GPIO_H3100_QMUTE;
255 break;
256 case IPAQ_EGPIO_OPT_NVRAM_ON:
257 egpio |= EGPIO_H3600_OPT_NVRAM_ON;
258 break;
259 case IPAQ_EGPIO_OPT_ON:
260 egpio |= EGPIO_H3600_OPT_ON;
261 break;
262 case IPAQ_EGPIO_CARD_RESET:
263 egpio |= EGPIO_H3600_CARD_RESET;
264 break;
265 case IPAQ_EGPIO_OPT_RESET:
266 egpio |= EGPIO_H3600_OPT_RESET;
267 break;
268 case IPAQ_EGPIO_IR_ON:
269 gpio |= GPIO_H3100_IR_ON;
270 break;
271 case IPAQ_EGPIO_IR_FSEL:
272 gpio |= GPIO_H3100_IR_FSEL;
273 break;
274 case IPAQ_EGPIO_RS232_ON:
275 egpio |= EGPIO_H3600_RS232_ON;
276 break;
277 case IPAQ_EGPIO_VPP_ON:
278 egpio |= EGPIO_H3600_VPP_ON;
279 break;
280 }
281 95
282 if (egpio || gpio) { 96err3: gpio_free(H3600_EGPIO_IR_FSEL);
283 local_irq_save(flags); 97err2: gpio_free(H3600_EGPIO_IR_ON);
284 if (setp) { 98err1: return err;
285 h3100_egpio |= egpio;
286 GPSR = gpio;
287 } else {
288 h3100_egpio &= ~egpio;
289 GPCR = gpio;
290 }
291 H3100_EGPIO = h3100_egpio;
292 local_irq_restore(flags);
293 }
294} 99}
295 100
296#define H3100_DIRECT_EGPIO (GPIO_H3100_BT_ON \ 101static void h3600_irda_shutdown(struct device *dev)
297 | GPIO_H3100_GPIO3 \
298 | GPIO_H3100_QMUTE \
299 | GPIO_H3100_LCD_3V_ON \
300 | GPIO_H3100_AUD_ON \
301 | GPIO_H3100_AUD_PWR_ON \
302 | GPIO_H3100_IR_ON \
303 | GPIO_H3100_IR_FSEL)
304
305static void __init h3100_map_io(void)
306{ 102{
307 h3xxx_map_io(); 103 gpio_free(H3600_EGPIO_IR_ON);
308 104 gpio_free(H3600_EGPIO_IR_FSEL);
309 /* Initialize h3100-specific values here */
310 GPCR = 0x0fffffff; /* All outputs are set low by default */
311 GPDR = GPIO_H3600_COM_RTS | GPIO_H3600_L3_CLOCK |
312 GPIO_H3600_L3_MODE | GPIO_H3600_L3_DATA |
313 GPIO_H3600_CLK_SET1 | GPIO_H3600_CLK_SET0 |
314 H3100_DIRECT_EGPIO;
315
316 /* Older bootldrs put GPIO2-9 in alternate mode on the
317 assumption that they are used for video */
318 GAFR &= ~H3100_DIRECT_EGPIO;
319
320 H3100_EGPIO = h3100_egpio;
321 assign_h3600_egpio = h3100_control_egpio;
322} 105}
323 106
324MACHINE_START(H3100, "Compaq iPAQ H3100") 107static struct irda_platform_data h3600_irda_data = {
325 .phys_io = 0x80000000, 108 .set_power = h3600_irda_set_power,
326 .io_pg_offst = ((0xf8000000) >> 18) & 0xfffc, 109 .set_speed = h3600_irda_set_speed,
327 .boot_params = 0xc0000100, 110 .startup = h3600_irda_startup,
328 .map_io = h3100_map_io, 111 .shutdown = h3600_irda_shutdown,
329 .init_irq = sa1100_init_irq, 112};
330 .timer = &sa1100_timer,
331 .init_machine = h3xxx_mach_init,
332MACHINE_END
333
334#endif /* CONFIG_SA1100_H3100 */
335
336/************************* H3600 *************************/
337
338#ifdef CONFIG_SA1100_H3600
339
340#define H3600_EGPIO (*(volatile unsigned int *)H3600_EGPIO_VIRT)
341static unsigned int h3600_egpio = EGPIO_H3600_RS232_ON;
342
343static void h3600_control_egpio(enum ipaq_egpio_type x, int setp)
344{
345 unsigned int egpio = 0;
346 unsigned long flags;
347
348 switch (x) {
349 case IPAQ_EGPIO_LCD_POWER:
350 egpio |= EGPIO_H3600_LCD_ON |
351 EGPIO_H3600_LCD_PCI |
352 EGPIO_H3600_LCD_5V_ON |
353 EGPIO_H3600_LVDD_ON;
354 break;
355 case IPAQ_EGPIO_LCD_ENABLE:
356 break;
357 case IPAQ_EGPIO_CODEC_NRESET:
358 egpio |= EGPIO_H3600_CODEC_NRESET;
359 break;
360 case IPAQ_EGPIO_AUDIO_ON:
361 egpio |= EGPIO_H3600_AUD_AMP_ON |
362 EGPIO_H3600_AUD_PWR_ON;
363 break;
364 case IPAQ_EGPIO_QMUTE:
365 egpio |= EGPIO_H3600_QMUTE;
366 break;
367 case IPAQ_EGPIO_OPT_NVRAM_ON:
368 egpio |= EGPIO_H3600_OPT_NVRAM_ON;
369 break;
370 case IPAQ_EGPIO_OPT_ON:
371 egpio |= EGPIO_H3600_OPT_ON;
372 break;
373 case IPAQ_EGPIO_CARD_RESET:
374 egpio |= EGPIO_H3600_CARD_RESET;
375 break;
376 case IPAQ_EGPIO_OPT_RESET:
377 egpio |= EGPIO_H3600_OPT_RESET;
378 break;
379 case IPAQ_EGPIO_IR_ON:
380 egpio |= EGPIO_H3600_IR_ON;
381 break;
382 case IPAQ_EGPIO_IR_FSEL:
383 egpio |= EGPIO_H3600_IR_FSEL;
384 break;
385 case IPAQ_EGPIO_RS232_ON:
386 egpio |= EGPIO_H3600_RS232_ON;
387 break;
388 case IPAQ_EGPIO_VPP_ON:
389 egpio |= EGPIO_H3600_VPP_ON;
390 break;
391 }
392 113
393 if (egpio) { 114static struct gpio_default_state h3600_default_gpio[] = {
394 local_irq_save(flags); 115 { H3XXX_GPIO_COM_DCD, GPIO_MODE_IN, "COM DCD" },
395 if (setp) 116 { H3XXX_GPIO_COM_CTS, GPIO_MODE_IN, "COM CTS" },
396 h3600_egpio |= egpio; 117 { H3XXX_GPIO_COM_RTS, GPIO_MODE_OUT0, "COM RTS" },
397 else 118};
398 h3600_egpio &= ~egpio;
399 H3600_EGPIO = h3600_egpio;
400 local_irq_restore(flags);
401 }
402}
403 119
404static void __init h3600_map_io(void) 120static void __init h3600_mach_init(void)
405{ 121{
406 h3xxx_map_io(); 122 h3xxx_init_gpio(h3600_default_gpio, ARRAY_SIZE(h3600_default_gpio));
407 123 h3xxx_mach_init();
408 /* Initialize h3600-specific values here */ 124 sa11x0_register_irda(&h3600_irda_data);
409
410 GPCR = 0x0fffffff; /* All outputs are set low by default */
411 GPDR = GPIO_H3600_COM_RTS | GPIO_H3600_L3_CLOCK |
412 GPIO_H3600_L3_MODE | GPIO_H3600_L3_DATA |
413 GPIO_H3600_CLK_SET1 | GPIO_H3600_CLK_SET0 |
414 GPIO_LDD15 | GPIO_LDD14 | GPIO_LDD13 | GPIO_LDD12 |
415 GPIO_LDD11 | GPIO_LDD10 | GPIO_LDD9 | GPIO_LDD8;
416
417 H3600_EGPIO = h3600_egpio; /* Maintains across sleep? */
418 assign_h3600_egpio = h3600_control_egpio;
419} 125}
420 126
421MACHINE_START(H3600, "Compaq iPAQ H3600") 127MACHINE_START(H3600, "Compaq iPAQ H3600")
@@ -425,8 +131,6 @@ MACHINE_START(H3600, "Compaq iPAQ H3600")
425 .map_io = h3600_map_io, 131 .map_io = h3600_map_io,
426 .init_irq = sa1100_init_irq, 132 .init_irq = sa1100_init_irq,
427 .timer = &sa1100_timer, 133 .timer = &sa1100_timer,
428 .init_machine = h3xxx_mach_init, 134 .init_machine = h3600_mach_init,
429MACHINE_END 135MACHINE_END
430 136
431#endif /* CONFIG_SA1100_H3600 */
432
diff --git a/arch/arm/mach-sa1100/h3xxx.c b/arch/arm/mach-sa1100/h3xxx.c
new file mode 100644
index 000000000000..b0784c974c2d
--- /dev/null
+++ b/arch/arm/mach-sa1100/h3xxx.c
@@ -0,0 +1,313 @@
1/*
2 * Support for Compaq iPAQ H3100 and H3600 handheld computers (common code)
3 *
4 * Copyright (c) 2000,1 Compaq Computer Corporation. (Author: Jamey Hicks)
5 * Copyright (c) 2009 Dmitry Artamonow <mad_soft@inbox.ru>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10 *
11 */
12
13#include <linux/kernel.h>
14#include <linux/gpio.h>
15#include <linux/gpio_keys.h>
16#include <linux/input.h>
17#include <linux/mfd/htc-egpio.h>
18#include <linux/mtd/mtd.h>
19#include <linux/mtd/partitions.h>
20#include <linux/platform_device.h>
21#include <linux/serial_core.h>
22
23#include <asm/mach/flash.h>
24#include <asm/mach/map.h>
25#include <asm/mach/serial_sa1100.h>
26
27#include <mach/h3xxx.h>
28
29#include "generic.h"
30
31void h3xxx_init_gpio(struct gpio_default_state *s, size_t n)
32{
33 while (n--) {
34 const char *name = s->name;
35 int err;
36
37 if (!name)
38 name = "[init]";
39 err = gpio_request(s->gpio, name);
40 if (err) {
41 printk(KERN_ERR "gpio%u: unable to request: %d\n",
42 s->gpio, err);
43 continue;
44 }
45 if (s->mode >= 0) {
46 err = gpio_direction_output(s->gpio, s->mode);
47 } else {
48 err = gpio_direction_input(s->gpio);
49 }
50 if (err) {
51 printk(KERN_ERR "gpio%u: unable to set direction: %d\n",
52 s->gpio, err);
53 continue;
54 }
55 if (!s->name)
56 gpio_free(s->gpio);
57 s++;
58 }
59}
60
61
62/*
63 * H3xxx flash support
64 */
65static struct mtd_partition h3xxx_partitions[] = {
66 {
67 .name = "H3XXX boot firmware",
68 .size = 0x00040000,
69 .offset = 0,
70 .mask_flags = MTD_WRITEABLE, /* force read-only */
71 }, {
72 .name = "H3XXX rootfs",
73 .size = MTDPART_SIZ_FULL,
74 .offset = 0x00040000,
75 }
76};
77
78static void h3xxx_set_vpp(int vpp)
79{
80 gpio_set_value(H3XXX_EGPIO_VPP_ON, vpp);
81}
82
83static int h3xxx_flash_init(void)
84{
85 int err = gpio_request(H3XXX_EGPIO_VPP_ON, "Flash Vpp");
86 if (err) {
87 pr_err("%s: can't request H3XXX_EGPIO_VPP_ON\n", __func__);
88 return err;
89 }
90
91 err = gpio_direction_output(H3XXX_EGPIO_VPP_ON, 0);
92 if (err)
93 gpio_free(H3XXX_EGPIO_VPP_ON);
94
95 return err;
96}
97
98static void h3xxx_flash_exit(void)
99{
100 gpio_free(H3XXX_EGPIO_VPP_ON);
101}
102
103static struct flash_platform_data h3xxx_flash_data = {
104 .map_name = "cfi_probe",
105 .set_vpp = h3xxx_set_vpp,
106 .init = h3xxx_flash_init,
107 .exit = h3xxx_flash_exit,
108 .parts = h3xxx_partitions,
109 .nr_parts = ARRAY_SIZE(h3xxx_partitions),
110};
111
112static struct resource h3xxx_flash_resource = {
113 .start = SA1100_CS0_PHYS,
114 .end = SA1100_CS0_PHYS + SZ_32M - 1,
115 .flags = IORESOURCE_MEM,
116};
117
118
119/*
120 * H3xxx uart support
121 */
122static void h3xxx_uart_set_mctrl(struct uart_port *port, u_int mctrl)
123{
124 if (port->mapbase == _Ser3UTCR0) {
125 gpio_set_value(H3XXX_GPIO_COM_RTS, !(mctrl & TIOCM_RTS));
126 }
127}
128
129static u_int h3xxx_uart_get_mctrl(struct uart_port *port)
130{
131 u_int ret = TIOCM_CD | TIOCM_CTS | TIOCM_DSR;
132
133 if (port->mapbase == _Ser3UTCR0) {
134 /*
135 * DCD and CTS bits are inverted in GPLR by RS232 transceiver
136 */
137 if (gpio_get_value(H3XXX_GPIO_COM_DCD))
138 ret &= ~TIOCM_CD;
139 if (gpio_get_value(H3XXX_GPIO_COM_CTS))
140 ret &= ~TIOCM_CTS;
141 }
142
143 return ret;
144}
145
146static void h3xxx_uart_pm(struct uart_port *port, u_int state, u_int oldstate)
147{
148 if (port->mapbase == _Ser3UTCR0) {
149 if (!gpio_request(H3XXX_EGPIO_RS232_ON, "RS232 transceiver")) {
150 gpio_direction_output(H3XXX_EGPIO_RS232_ON, !state);
151 gpio_free(H3XXX_EGPIO_RS232_ON);
152 } else {
153 pr_err("%s: can't request H3XXX_EGPIO_RS232_ON\n",
154 __func__);
155 }
156 }
157}
158
159/*
160 * Enable/Disable wake up events for this serial port.
161 * Obviously, we only support this on the normal COM port.
162 */
163static int h3xxx_uart_set_wake(struct uart_port *port, u_int enable)
164{
165 int err = -EINVAL;
166
167 if (port->mapbase == _Ser3UTCR0) {
168 if (enable)
169 PWER |= PWER_GPIO23 | PWER_GPIO25; /* DCD and CTS */
170 else
171 PWER &= ~(PWER_GPIO23 | PWER_GPIO25); /* DCD and CTS */
172 err = 0;
173 }
174 return err;
175}
176
177static struct sa1100_port_fns h3xxx_port_fns __initdata = {
178 .set_mctrl = h3xxx_uart_set_mctrl,
179 .get_mctrl = h3xxx_uart_get_mctrl,
180 .pm = h3xxx_uart_pm,
181 .set_wake = h3xxx_uart_set_wake,
182};
183
184/*
185 * EGPIO
186 */
187
188static struct resource egpio_resources[] = {
189 [0] = {
190 .start = H3600_EGPIO_PHYS,
191 .end = H3600_EGPIO_PHYS + 0x4 - 1,
192 .flags = IORESOURCE_MEM,
193 },
194};
195
196static struct htc_egpio_chip egpio_chips[] = {
197 [0] = {
198 .reg_start = 0,
199 .gpio_base = H3XXX_EGPIO_BASE,
200 .num_gpios = 16,
201 .direction = HTC_EGPIO_OUTPUT,
202 .initial_values = 0x0080, /* H3XXX_EGPIO_RS232_ON */
203 },
204};
205
206static struct htc_egpio_platform_data egpio_info = {
207 .reg_width = 16,
208 .bus_width = 16,
209 .chip = egpio_chips,
210 .num_chips = ARRAY_SIZE(egpio_chips),
211};
212
213static struct platform_device h3xxx_egpio = {
214 .name = "htc-egpio",
215 .id = -1,
216 .resource = egpio_resources,
217 .num_resources = ARRAY_SIZE(egpio_resources),
218 .dev = {
219 .platform_data = &egpio_info,
220 },
221};
222
223/*
224 * GPIO keys
225 */
226
227static struct gpio_keys_button h3xxx_button_table[] = {
228 {
229 .code = KEY_POWER,
230 .gpio = H3XXX_GPIO_PWR_BUTTON,
231 .desc = "Power Button",
232 .active_low = 1,
233 .type = EV_KEY,
234 .wakeup = 1,
235 }, {
236 .code = KEY_ENTER,
237 .gpio = H3XXX_GPIO_ACTION_BUTTON,
238 .active_low = 1,
239 .desc = "Action button",
240 .type = EV_KEY,
241 .wakeup = 0,
242 },
243};
244
245static struct gpio_keys_platform_data h3xxx_keys_data = {
246 .buttons = h3xxx_button_table,
247 .nbuttons = ARRAY_SIZE(h3xxx_button_table),
248};
249
250static struct platform_device h3xxx_keys = {
251 .name = "gpio-keys",
252 .id = -1,
253 .dev = {
254 .platform_data = &h3xxx_keys_data,
255 },
256};
257
258static struct platform_device *h3xxx_devices[] = {
259 &h3xxx_egpio,
260 &h3xxx_keys,
261};
262
263void __init h3xxx_mach_init(void)
264{
265 sa1100_register_uart_fns(&h3xxx_port_fns);
266 sa11x0_register_mtd(&h3xxx_flash_data, &h3xxx_flash_resource, 1);
267 platform_add_devices(h3xxx_devices, ARRAY_SIZE(h3xxx_devices));
268}
269
270static struct map_desc h3600_io_desc[] __initdata = {
271 { /* static memory bank 2 CS#2 */
272 .virtual = H3600_BANK_2_VIRT,
273 .pfn = __phys_to_pfn(SA1100_CS2_PHYS),
274 .length = 0x02800000,
275 .type = MT_DEVICE
276 }, { /* static memory bank 4 CS#4 */
277 .virtual = H3600_BANK_4_VIRT,
278 .pfn = __phys_to_pfn(SA1100_CS4_PHYS),
279 .length = 0x00800000,
280 .type = MT_DEVICE
281 }, { /* EGPIO 0 CS#5 */
282 .virtual = H3600_EGPIO_VIRT,
283 .pfn = __phys_to_pfn(H3600_EGPIO_PHYS),
284 .length = 0x01000000,
285 .type = MT_DEVICE
286 }
287};
288
289/*
290 * Common map_io initialization
291 */
292
293void __init h3xxx_map_io(void)
294{
295 sa1100_map_io();
296 iotable_init(h3600_io_desc, ARRAY_SIZE(h3600_io_desc));
297
298 sa1100_register_uart(0, 3); /* Common serial port */
299// sa1100_register_uart(1, 1); /* Microcontroller on 3100/3600 */
300
301 /* Ensure those pins are outputs and driving low */
302 PPDR |= PPC_TXD4 | PPC_SCLK | PPC_SFRM;
303 PPSR &= ~(PPC_TXD4 | PPC_SCLK | PPC_SFRM);
304
305 /* Configure suspend conditions */
306 PGSR = 0;
307 PCFR = PCFR_OPDE;
308 PSDR = 0;
309
310 GPCR = 0x0fffffff; /* All outputs are set low by default */
311 GPDR = 0; /* Configure all GPIOs as input */
312}
313
diff --git a/arch/arm/mach-sa1100/hackkit.c b/arch/arm/mach-sa1100/hackkit.c
index e7056c0b562c..51568dfc8e97 100644
--- a/arch/arm/mach-sa1100/hackkit.c
+++ b/arch/arm/mach-sa1100/hackkit.c
@@ -187,7 +187,7 @@ static struct resource hackkit_flash_resource = {
187 187
188static void __init hackkit_init(void) 188static void __init hackkit_init(void)
189{ 189{
190 sa11x0_set_flash_data(&hackkit_flash_data, &hackkit_flash_resource, 1); 190 sa11x0_register_mtd(&hackkit_flash_data, &hackkit_flash_resource, 1);
191} 191}
192 192
193/********************************************************************** 193/**********************************************************************
diff --git a/arch/arm/mach-sa1100/include/mach/collie.h b/arch/arm/mach-sa1100/include/mach/collie.h
index 9efb569cdb60..71a0b3fdcc8c 100644
--- a/arch/arm/mach-sa1100/include/mach/collie.h
+++ b/arch/arm/mach-sa1100/include/mach/collie.h
@@ -25,29 +25,39 @@
25#define COLLIE_GPIO_VPEN (COLLIE_SCOOP_GPIO_BASE + 7) 25#define COLLIE_GPIO_VPEN (COLLIE_SCOOP_GPIO_BASE + 7)
26#define COLLIE_SCP_LB_VOL_CHG SCOOP_GPCR_PA19 26#define COLLIE_SCP_LB_VOL_CHG SCOOP_GPCR_PA19
27 27
28#define COLLIE_SCOOP_IO_DIR ( COLLIE_SCP_MUTE_L | COLLIE_SCP_MUTE_R | \ 28#define COLLIE_SCOOP_IO_DIR (COLLIE_SCP_MUTE_L | COLLIE_SCP_MUTE_R | \
29 COLLIE_SCP_5VON | COLLIE_SCP_AMP_ON | \ 29 COLLIE_SCP_5VON | COLLIE_SCP_AMP_ON | \
30 COLLIE_SCP_LB_VOL_CHG ) 30 COLLIE_SCP_LB_VOL_CHG)
31#define COLLIE_SCOOP_IO_OUT ( COLLIE_SCP_MUTE_L | COLLIE_SCP_MUTE_R ) 31#define COLLIE_SCOOP_IO_OUT (COLLIE_SCP_MUTE_L | COLLIE_SCP_MUTE_R)
32 32
33/* GPIOs for which the generic definition doesn't say much */ 33/* GPIOs for gpiolib */
34 34
35#define COLLIE_GPIO_ON_KEY GPIO_GPIO (0) 35#define COLLIE_GPIO_ON_KEY (0)
36#define COLLIE_GPIO_AC_IN GPIO_GPIO (1) 36#define COLLIE_GPIO_AC_IN (1)
37#define COLLIE_GPIO_SDIO_INT GPIO_GPIO (11) 37#define COLLIE_GPIO_SDIO_INT (11)
38#define COLLIE_GPIO_CF_IRQ GPIO_GPIO (14) 38#define COLLIE_GPIO_CF_IRQ (14)
39#define COLLIE_GPIO_nREMOCON_INT GPIO_GPIO (15) 39#define COLLIE_GPIO_nREMOCON_INT (15)
40#define COLLIE_GPIO_UCB1x00_RESET GPIO_GPIO (16) 40#define COLLIE_GPIO_UCB1x00_RESET (16)
41#define COLLIE_GPIO_nMIC_ON GPIO_GPIO (17) 41#define COLLIE_GPIO_nMIC_ON (17)
42#define COLLIE_GPIO_nREMOCON_ON GPIO_GPIO (18) 42#define COLLIE_GPIO_nREMOCON_ON (18)
43#define COLLIE_GPIO_CO GPIO_GPIO (20) 43#define COLLIE_GPIO_CO (20)
44#define COLLIE_GPIO_MCP_CLK GPIO_GPIO (21) 44#define COLLIE_GPIO_MCP_CLK (21)
45#define COLLIE_GPIO_CF_CD GPIO_GPIO (22) 45#define COLLIE_GPIO_CF_CD (22)
46#define COLLIE_GPIO_UCB1x00_IRQ GPIO_GPIO (23) 46#define COLLIE_GPIO_UCB1x00_IRQ (23)
47#define COLLIE_GPIO_WAKEUP GPIO_GPIO (24) 47#define COLLIE_GPIO_WAKEUP (24)
48#define COLLIE_GPIO_GA_INT GPIO_GPIO (25) 48#define COLLIE_GPIO_GA_INT (25)
49#define COLLIE_GPIO_MAIN_BAT_LOW GPIO_GPIO (26) 49#define COLLIE_GPIO_MAIN_BAT_LOW (26)
50 50
51/* GPIO definitions for direct register access */
52
53#define _COLLIE_GPIO_ON_KEY GPIO_GPIO(0)
54#define _COLLIE_GPIO_AC_IN GPIO_GPIO(1)
55#define _COLLIE_GPIO_nREMOCON_INT GPIO_GPIO(15)
56#define _COLLIE_GPIO_UCB1x00_RESET GPIO_GPIO(16)
57#define _COLLIE_GPIO_nMIC_ON GPIO_GPIO(17)
58#define _COLLIE_GPIO_nREMOCON_ON GPIO_GPIO(18)
59#define _COLLIE_GPIO_CO GPIO_GPIO(20)
60#define _COLLIE_GPIO_WAKEUP GPIO_GPIO(24)
51/* Interrupts */ 61/* Interrupts */
52 62
53#define COLLIE_IRQ_GPIO_ON_KEY IRQ_GPIO0 63#define COLLIE_IRQ_GPIO_ON_KEY IRQ_GPIO0
@@ -70,19 +80,20 @@
70#define COLLIE_LCM_IRQ_GPIO_nSD_WP IRQ_LOCOMO_GPIO14 80#define COLLIE_LCM_IRQ_GPIO_nSD_WP IRQ_LOCOMO_GPIO14
71 81
72/* GPIO's on the TC35143AF (Toshiba Analog Frontend) */ 82/* GPIO's on the TC35143AF (Toshiba Analog Frontend) */
73#define COLLIE_TC35143_GPIO_VERSION0 UCB_IO_0 /* GPIO0=Version */ 83#define COLLIE_TC35143_GPIO_BASE (GPIO_MAX + 13)
74#define COLLIE_TC35143_GPIO_TBL_CHK UCB_IO_1 /* GPIO1=TBL_CHK */ 84#define COLLIE_TC35143_GPIO_VERSION0 UCB_IO_0
75#define COLLIE_TC35143_GPIO_VPEN_ON UCB_IO_2 /* GPIO2=VPNE_ON */ 85#define COLLIE_TC35143_GPIO_TBL_CHK UCB_IO_1
76#define COLLIE_TC35143_GPIO_IR_ON UCB_IO_3 /* GPIO3=IR_ON */ 86#define COLLIE_TC35143_GPIO_VPEN_ON UCB_IO_2
77#define COLLIE_TC35143_GPIO_AMP_ON UCB_IO_4 /* GPIO4=AMP_ON */ 87#define COLLIE_TC35143_GPIO_IR_ON UCB_IO_3
78#define COLLIE_TC35143_GPIO_VERSION1 UCB_IO_5 /* GPIO5=Version */ 88#define COLLIE_TC35143_GPIO_AMP_ON UCB_IO_4
79#define COLLIE_TC35143_GPIO_FS8KLPF UCB_IO_5 /* GPIO5=fs 8k LPF */ 89#define COLLIE_TC35143_GPIO_VERSION1 UCB_IO_5
80#define COLLIE_TC35143_GPIO_BUZZER_BIAS UCB_IO_6 /* GPIO6=BUZZER BIAS */ 90#define COLLIE_TC35143_GPIO_FS8KLPF UCB_IO_5
81#define COLLIE_TC35143_GPIO_MBAT_ON UCB_IO_7 /* GPIO7=MBAT_ON */ 91#define COLLIE_TC35143_GPIO_BUZZER_BIAS UCB_IO_6
82#define COLLIE_TC35143_GPIO_BBAT_ON UCB_IO_8 /* GPIO8=BBAT_ON */ 92#define COLLIE_GPIO_MBAT_ON (COLLIE_TC35143_GPIO_BASE + 7)
83#define COLLIE_TC35143_GPIO_TMP_ON UCB_IO_9 /* GPIO9=TMP_ON */ 93#define COLLIE_GPIO_BBAT_ON (COLLIE_TC35143_GPIO_BASE + 8)
84#define COLLIE_TC35143_GPIO_IN ( UCB_IO_0 | UCB_IO_2 | UCB_IO_5 ) 94#define COLLIE_GPIO_TMP_ON (COLLIE_TC35143_GPIO_BASE + 9)
85#define COLLIE_TC35143_GPIO_OUT ( UCB_IO_1 | UCB_IO_3 | UCB_IO_4 | UCB_IO_6 | \ 95#define COLLIE_TC35143_GPIO_IN (UCB_IO_0 | UCB_IO_2 | UCB_IO_5)
86 UCB_IO_7 | UCB_IO_8 | UCB_IO_9 ) 96#define COLLIE_TC35143_GPIO_OUT (UCB_IO_1 | UCB_IO_3 | UCB_IO_4 \
97 | UCB_IO_6)
87 98
88#endif 99#endif
diff --git a/arch/arm/mach-sa1100/include/mach/gpio.h b/arch/arm/mach-sa1100/include/mach/gpio.h
index 582a0c92da53..7befc104e9a9 100644
--- a/arch/arm/mach-sa1100/include/mach/gpio.h
+++ b/arch/arm/mach-sa1100/include/mach/gpio.h
@@ -49,20 +49,9 @@ static inline void gpio_set_value(unsigned gpio, int value)
49 49
50#define gpio_cansleep __gpio_cansleep 50#define gpio_cansleep __gpio_cansleep
51 51
52static inline unsigned gpio_to_irq(unsigned gpio) 52#define gpio_to_irq(gpio) ((gpio < 11) ? (IRQ_GPIO0 + gpio) : \
53{ 53 (IRQ_GPIO11 - 11 + gpio))
54 if (gpio < 11) 54#define irq_to_gpio(irq) ((irq < IRQ_GPIO11_27) ? (irq - IRQ_GPIO0) : \
55 return IRQ_GPIO0 + gpio; 55 (irq - IRQ_GPIO11 + 11))
56 else
57 return IRQ_GPIO11 - 11 + gpio;
58}
59
60static inline unsigned irq_to_gpio(unsigned irq)
61{
62 if (irq < IRQ_GPIO11_27)
63 return irq - IRQ_GPIO0;
64 else
65 return irq - IRQ_GPIO11 + 11;
66}
67 56
68#endif 57#endif
diff --git a/arch/arm/mach-sa1100/include/mach/h3600.h b/arch/arm/mach-sa1100/include/mach/h3600.h
deleted file mode 100644
index 2827faa47421..000000000000
--- a/arch/arm/mach-sa1100/include/mach/h3600.h
+++ /dev/null
@@ -1,100 +0,0 @@
1/*
2 *
3 * Definitions for H3600 Handheld Computer
4 *
5 * Copyright 2000 Compaq Computer Corporation.
6 *
7 * Use consistent with the GNU GPL is permitted,
8 * provided that this copyright notice is
9 * preserved in its entirety in all copies and derived works.
10 *
11 * COMPAQ COMPUTER CORPORATION MAKES NO WARRANTIES, EXPRESSED OR IMPLIED,
12 * AS TO THE USEFULNESS OR CORRECTNESS OF THIS CODE OR ITS
13 * FITNESS FOR ANY PARTICULAR PURPOSE.
14 *
15 * Author: Jamey Hicks.
16 *
17 * History:
18 *
19 * 2001-10-?? Andrew Christian Added support for iPAQ H3800
20 *
21 */
22
23#ifndef _INCLUDE_H3600_H_
24#define _INCLUDE_H3600_H_
25
26typedef int __bitwise pm_request_t;
27
28#define PM_SUSPEND ((__force pm_request_t) 1) /* enter D1-D3 */
29#define PM_RESUME ((__force pm_request_t) 2) /* enter D0 */
30
31/* generalized support for H3xxx series Compaq Pocket PC's */
32#define machine_is_h3xxx() (machine_is_h3100() || machine_is_h3600())
33
34/* Physical memory regions corresponding to chip selects */
35#define H3600_EGPIO_PHYS (SA1100_CS5_PHYS + 0x01000000)
36#define H3600_BANK_2_PHYS SA1100_CS2_PHYS
37#define H3600_BANK_4_PHYS SA1100_CS4_PHYS
38
39/* Virtual memory regions corresponding to chip selects 2 & 4 (used on sleeves) */
40#define H3600_EGPIO_VIRT 0xf0000000
41#define H3600_BANK_2_VIRT 0xf1000000
42#define H3600_BANK_4_VIRT 0xf3800000
43
44/*
45 Machine-independent GPIO definitions
46 --- these are common across all current iPAQ platforms
47*/
48
49#define GPIO_H3600_NPOWER_BUTTON GPIO_GPIO (0) /* Also known as the "off button" */
50
51#define GPIO_H3600_PCMCIA_CD1 GPIO_GPIO (10)
52#define GPIO_H3600_PCMCIA_IRQ1 GPIO_GPIO (11)
53
54/* UDA1341 L3 Interface */
55#define GPIO_H3600_L3_DATA GPIO_GPIO (14)
56#define GPIO_H3600_L3_MODE GPIO_GPIO (15)
57#define GPIO_H3600_L3_CLOCK GPIO_GPIO (16)
58
59#define GPIO_H3600_PCMCIA_CD0 GPIO_GPIO (17)
60#define GPIO_H3600_SYS_CLK GPIO_GPIO (19)
61#define GPIO_H3600_PCMCIA_IRQ0 GPIO_GPIO (21)
62
63#define GPIO_H3600_COM_DCD GPIO_GPIO (23)
64#define GPIO_H3600_OPT_IRQ GPIO_GPIO (24)
65#define GPIO_H3600_COM_CTS GPIO_GPIO (25)
66#define GPIO_H3600_COM_RTS GPIO_GPIO (26)
67
68#define IRQ_GPIO_H3600_NPOWER_BUTTON IRQ_GPIO0
69#define IRQ_GPIO_H3600_PCMCIA_CD1 IRQ_GPIO10
70#define IRQ_GPIO_H3600_PCMCIA_IRQ1 IRQ_GPIO11
71#define IRQ_GPIO_H3600_PCMCIA_CD0 IRQ_GPIO17
72#define IRQ_GPIO_H3600_PCMCIA_IRQ0 IRQ_GPIO21
73#define IRQ_GPIO_H3600_COM_DCD IRQ_GPIO23
74#define IRQ_GPIO_H3600_OPT_IRQ IRQ_GPIO24
75#define IRQ_GPIO_H3600_COM_CTS IRQ_GPIO25
76
77
78#ifndef __ASSEMBLY__
79
80enum ipaq_egpio_type {
81 IPAQ_EGPIO_LCD_POWER, /* Power to the LCD panel */
82 IPAQ_EGPIO_CODEC_NRESET, /* Clear to reset the audio codec (remember to return high) */
83 IPAQ_EGPIO_AUDIO_ON, /* Audio power */
84 IPAQ_EGPIO_QMUTE, /* Audio muting */
85 IPAQ_EGPIO_OPT_NVRAM_ON, /* Non-volatile RAM on extension sleeves (SPI interface) */
86 IPAQ_EGPIO_OPT_ON, /* Power to extension sleeves */
87 IPAQ_EGPIO_CARD_RESET, /* Reset PCMCIA cards on extension sleeve (???) */
88 IPAQ_EGPIO_OPT_RESET, /* Reset option pack (???) */
89 IPAQ_EGPIO_IR_ON, /* IR sensor/emitter power */
90 IPAQ_EGPIO_IR_FSEL, /* IR speed selection 1->fast, 0->slow */
91 IPAQ_EGPIO_RS232_ON, /* Maxim RS232 chip power */
92 IPAQ_EGPIO_VPP_ON, /* Turn on power to flash programming */
93 IPAQ_EGPIO_LCD_ENABLE, /* Enable/disable LCD controller */
94};
95
96extern void (*assign_h3600_egpio)(enum ipaq_egpio_type x, int level);
97
98#endif /* ASSEMBLY */
99
100#endif /* _INCLUDE_H3600_H_ */
diff --git a/arch/arm/mach-sa1100/include/mach/h3600_gpio.h b/arch/arm/mach-sa1100/include/mach/h3600_gpio.h
deleted file mode 100644
index a36ca76d018b..000000000000
--- a/arch/arm/mach-sa1100/include/mach/h3600_gpio.h
+++ /dev/null
@@ -1,77 +0,0 @@
1/*
2 *
3 * Definitions for H3600 Handheld Computer
4 *
5 * Copyright 2000 Compaq Computer Corporation.
6 *
7 * Use consistent with the GNU GPL is permitted,
8 * provided that this copyright notice is
9 * preserved in its entirety in all copies and derived works.
10 *
11 * COMPAQ COMPUTER CORPORATION MAKES NO WARRANTIES, EXPRESSED OR IMPLIED,
12 * AS TO THE USEFULNESS OR CORRECTNESS OF THIS CODE OR ITS
13 * FITNESS FOR ANY PARTICULAR PURPOSE.
14 *
15 * Author: Jamey Hicks.
16 *
17 * History:
18 *
19 * 2001-10-?? Andrew Christian Added support for iPAQ H3800
20 *
21 */
22
23#ifndef _INCLUDE_H3600_GPIO_H_
24#define _INCLUDE_H3600_GPIO_H_
25
26/*
27 * GPIO lines that are common across ALL iPAQ models are in "h3600.h"
28 * This file contains machine-specific definitions
29 */
30
31#define GPIO_H3600_SUSPEND GPIO_GPIO (0)
32/* GPIO[2:9] used by LCD on H3600/3800, used as GPIO on H3100 */
33#define GPIO_H3100_BT_ON GPIO_GPIO (2)
34#define GPIO_H3100_GPIO3 GPIO_GPIO (3)
35#define GPIO_H3100_QMUTE GPIO_GPIO (4)
36#define GPIO_H3100_LCD_3V_ON GPIO_GPIO (5)
37#define GPIO_H3100_AUD_ON GPIO_GPIO (6)
38#define GPIO_H3100_AUD_PWR_ON GPIO_GPIO (7)
39#define GPIO_H3100_IR_ON GPIO_GPIO (8)
40#define GPIO_H3100_IR_FSEL GPIO_GPIO (9)
41
42/* for H3600, audio sample rate clock generator */
43#define GPIO_H3600_CLK_SET0 GPIO_GPIO (12)
44#define GPIO_H3600_CLK_SET1 GPIO_GPIO (13)
45
46#define GPIO_H3600_ACTION_BUTTON GPIO_GPIO (18)
47#define GPIO_H3600_SOFT_RESET GPIO_GPIO (20) /* Also known as BATT_FAULT */
48#define GPIO_H3600_OPT_LOCK GPIO_GPIO (22)
49#define GPIO_H3600_OPT_DET GPIO_GPIO (27)
50
51/****************************************************/
52
53#define IRQ_GPIO_H3600_ACTION_BUTTON IRQ_GPIO18
54#define IRQ_GPIO_H3600_OPT_DET IRQ_GPIO27
55
56/* H3100 / 3600 EGPIO pins */
57#define EGPIO_H3600_VPP_ON (1 << 0)
58#define EGPIO_H3600_CARD_RESET (1 << 1) /* reset the attached pcmcia/compactflash card. active high. */
59#define EGPIO_H3600_OPT_RESET (1 << 2) /* reset the attached option pack. active high. */
60#define EGPIO_H3600_CODEC_NRESET (1 << 3) /* reset the onboard UDA1341. active low. */
61#define EGPIO_H3600_OPT_NVRAM_ON (1 << 4) /* apply power to optionpack nvram, active high. */
62#define EGPIO_H3600_OPT_ON (1 << 5) /* full power to option pack. active high. */
63#define EGPIO_H3600_LCD_ON (1 << 6) /* enable 3.3V to LCD. active high. */
64#define EGPIO_H3600_RS232_ON (1 << 7) /* UART3 transceiver force on. Active high. */
65
66/* H3600 only EGPIO pins */
67#define EGPIO_H3600_LCD_PCI (1 << 8) /* LCD control IC enable. active high. */
68#define EGPIO_H3600_IR_ON (1 << 9) /* apply power to IR module. active high. */
69#define EGPIO_H3600_AUD_AMP_ON (1 << 10) /* apply power to audio power amp. active high. */
70#define EGPIO_H3600_AUD_PWR_ON (1 << 11) /* apply power to reset of audio circuit. active high. */
71#define EGPIO_H3600_QMUTE (1 << 12) /* mute control for onboard UDA1341. active high. */
72#define EGPIO_H3600_IR_FSEL (1 << 13) /* IR speed select: 1->fast, 0->slow */
73#define EGPIO_H3600_LCD_5V_ON (1 << 14) /* enable 5V to LCD. active high. */
74#define EGPIO_H3600_LVDD_ON (1 << 15) /* enable 9V and -6.5V to LCD. */
75
76
77#endif /* _INCLUDE_H3600_GPIO_H_ */
diff --git a/arch/arm/mach-sa1100/include/mach/h3xxx.h b/arch/arm/mach-sa1100/include/mach/h3xxx.h
new file mode 100644
index 000000000000..7d9df16f04a2
--- /dev/null
+++ b/arch/arm/mach-sa1100/include/mach/h3xxx.h
@@ -0,0 +1,94 @@
1/*
2 * Definitions for Compaq iPAQ H3100 and H3600 handheld computers
3 *
4 * (c) 2000 Compaq Computer Corporation. (Author: Jamey Hicks)
5 * (c) 2009 Dmitry Artamonow <mad_soft@inbox.ru>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10 *
11 */
12
13#ifndef _INCLUDE_H3XXX_H_
14#define _INCLUDE_H3XXX_H_
15
16/* Physical memory regions corresponding to chip selects */
17#define H3600_EGPIO_PHYS (SA1100_CS5_PHYS + 0x01000000)
18#define H3600_BANK_2_PHYS SA1100_CS2_PHYS
19#define H3600_BANK_4_PHYS SA1100_CS4_PHYS
20
21/* Virtual memory regions corresponding to chip selects 2 & 4 (used on sleeves) */
22#define H3600_EGPIO_VIRT 0xf0000000
23#define H3600_BANK_2_VIRT 0xf1000000
24#define H3600_BANK_4_VIRT 0xf3800000
25
26/*
27 * gpiolib numbers for all iPAQs
28 */
29#define H3XXX_GPIO_PWR_BUTTON 0
30#define H3XXX_GPIO_PCMCIA_CD1 10
31#define H3XXX_GPIO_PCMCIA_IRQ1 11
32#define H3XXX_GPIO_PCMCIA_CD0 17
33#define H3XXX_GPIO_ACTION_BUTTON 18
34#define H3XXX_GPIO_SYS_CLK 19
35#define H3XXX_GPIO_PCMCIA_IRQ0 21
36#define H3XXX_GPIO_COM_DCD 23
37#define H3XXX_GPIO_OPTION 24
38#define H3XXX_GPIO_COM_CTS 25
39#define H3XXX_GPIO_COM_RTS 26
40
41/* machine-specific gpios */
42
43#define H3100_GPIO_BT_ON 2
44#define H3100_GPIO_QMUTE 4
45#define H3100_GPIO_LCD_3V_ON 5
46#define H3100_GPIO_AUD_ON 6
47#define H3100_GPIO_AUD_PWR_ON 7
48#define H3100_GPIO_IR_ON 8
49#define H3100_GPIO_IR_FSEL 9
50
51#define H3600_GPIO_CLK_SET0 12 /* audio sample rate clock generator */
52#define H3600_GPIO_CLK_SET1 13
53#define H3600_GPIO_SOFT_RESET 20 /* also known as BATT_FAULT */
54#define H3600_GPIO_OPT_LOCK 22
55#define H3600_GPIO_OPT_DET 27
56
57
58/* H3100 / 3600 EGPIO pins */
59#define H3XXX_EGPIO_BASE (GPIO_MAX + 1)
60
61#define H3XXX_EGPIO_VPP_ON (H3XXX_EGPIO_BASE + 0)
62#define H3XXX_EGPIO_CARD_RESET (H3XXX_EGPIO_BASE + 1) /* reset the attached pcmcia/compactflash card. active high. */
63#define H3XXX_EGPIO_OPT_RESET (H3XXX_EGPIO_BASE + 2) /* reset the attached option pack. active high. */
64#define H3XXX_EGPIO_CODEC_NRESET (H3XXX_EGPIO_BASE + 3) /* reset the onboard UDA1341. active low. */
65#define H3XXX_EGPIO_OPT_NVRAM_ON (H3XXX_EGPIO_BASE + 4) /* apply power to optionpack nvram, active high. */
66#define H3XXX_EGPIO_OPT_ON (H3XXX_EGPIO_BASE + 5) /* full power to option pack. active high. */
67#define H3XXX_EGPIO_LCD_ON (H3XXX_EGPIO_BASE + 6) /* enable 3.3V to LCD. active high. */
68#define H3XXX_EGPIO_RS232_ON (H3XXX_EGPIO_BASE + 7) /* UART3 transceiver force on. Active high. */
69
70/* H3600 only EGPIO pins */
71#define H3600_EGPIO_LCD_PCI (H3XXX_EGPIO_BASE + 8) /* LCD control IC enable. active high. */
72#define H3600_EGPIO_IR_ON (H3XXX_EGPIO_BASE + 9) /* apply power to IR module. active high. */
73#define H3600_EGPIO_AUD_AMP_ON (H3XXX_EGPIO_BASE + 10) /* apply power to audio power amp. active high. */
74#define H3600_EGPIO_AUD_PWR_ON (H3XXX_EGPIO_BASE + 11) /* apply power to reset of audio circuit. active high. */
75#define H3600_EGPIO_QMUTE (H3XXX_EGPIO_BASE + 12) /* mute control for onboard UDA1341. active high. */
76#define H3600_EGPIO_IR_FSEL (H3XXX_EGPIO_BASE + 13) /* IR speed select: 1->fast, 0->slow */
77#define H3600_EGPIO_LCD_5V_ON (H3XXX_EGPIO_BASE + 14) /* enable 5V to LCD. active high. */
78#define H3600_EGPIO_LVDD_ON (H3XXX_EGPIO_BASE + 15) /* enable 9V and -6.5V to LCD. */
79
80struct gpio_default_state {
81 int gpio;
82 int mode;
83 const char *name;
84};
85
86#define GPIO_MODE_IN -1
87#define GPIO_MODE_OUT0 0
88#define GPIO_MODE_OUT1 1
89
90void h3xxx_init_gpio(struct gpio_default_state *s, size_t n);
91void __init h3xxx_map_io(void);
92void __init h3xxx_mach_init(void);
93
94#endif /* _INCLUDE_H3XXX_H_ */
diff --git a/arch/arm/mach-sa1100/include/mach/mcp.h b/arch/arm/mach-sa1100/include/mach/mcp.h
index fb8b09a57ad7..ed1a331508a7 100644
--- a/arch/arm/mach-sa1100/include/mach/mcp.h
+++ b/arch/arm/mach-sa1100/include/mach/mcp.h
@@ -16,6 +16,7 @@ struct mcp_plat_data {
16 u32 mccr0; 16 u32 mccr0;
17 u32 mccr1; 17 u32 mccr1;
18 unsigned int sclk_rate; 18 unsigned int sclk_rate;
19 int gpio_base;
19}; 20};
20 21
21#endif 22#endif
diff --git a/arch/arm/mach-sa1100/jornada720.c b/arch/arm/mach-sa1100/jornada720.c
index fd776bb666cd..13ebd2d99bfd 100644
--- a/arch/arm/mach-sa1100/jornada720.c
+++ b/arch/arm/mach-sa1100/jornada720.c
@@ -354,7 +354,7 @@ static struct resource jornada720_flash_resource = {
354 354
355static void __init jornada720_mach_init(void) 355static void __init jornada720_mach_init(void)
356{ 356{
357 sa11x0_set_flash_data(&jornada720_flash_data, &jornada720_flash_resource, 1); 357 sa11x0_register_mtd(&jornada720_flash_data, &jornada720_flash_resource, 1);
358} 358}
359 359
360MACHINE_START(JORNADA720, "HP Jornada 720") 360MACHINE_START(JORNADA720, "HP Jornada 720")
diff --git a/arch/arm/mach-sa1100/lart.c b/arch/arm/mach-sa1100/lart.c
index 1f940df0e5af..68069d6dc07a 100644
--- a/arch/arm/mach-sa1100/lart.c
+++ b/arch/arm/mach-sa1100/lart.c
@@ -28,7 +28,7 @@ static struct mcp_plat_data lart_mcp_data = {
28 28
29static void __init lart_init(void) 29static void __init lart_init(void)
30{ 30{
31 sa11x0_set_mcp_data(&lart_mcp_data); 31 sa11x0_register_mcp(&lart_mcp_data);
32} 32}
33 33
34static struct map_desc lart_io_desc[] __initdata = { 34static struct map_desc lart_io_desc[] __initdata = {
diff --git a/arch/arm/mach-sa1100/pleb.c b/arch/arm/mach-sa1100/pleb.c
index e1458bc1868e..1ccd6018d3a3 100644
--- a/arch/arm/mach-sa1100/pleb.c
+++ b/arch/arm/mach-sa1100/pleb.c
@@ -109,7 +109,7 @@ static struct flash_platform_data pleb_flash_data = {
109 109
110static void __init pleb_init(void) 110static void __init pleb_init(void)
111{ 111{
112 sa11x0_set_flash_data(&pleb_flash_data, pleb_flash_resources, 112 sa11x0_register_mtd(&pleb_flash_data, pleb_flash_resources,
113 ARRAY_SIZE(pleb_flash_resources)); 113 ARRAY_SIZE(pleb_flash_resources));
114 114
115 115
diff --git a/arch/arm/mach-sa1100/shannon.c b/arch/arm/mach-sa1100/shannon.c
index ddd917d1083d..85e82bb73d7e 100644
--- a/arch/arm/mach-sa1100/shannon.c
+++ b/arch/arm/mach-sa1100/shannon.c
@@ -59,8 +59,8 @@ static struct mcp_plat_data shannon_mcp_data = {
59 59
60static void __init shannon_init(void) 60static void __init shannon_init(void)
61{ 61{
62 sa11x0_set_flash_data(&shannon_flash_data, &shannon_flash_resource, 1); 62 sa11x0_register_mtd(&shannon_flash_data, &shannon_flash_resource, 1);
63 sa11x0_set_mcp_data(&shannon_mcp_data); 63 sa11x0_register_mcp(&shannon_mcp_data);
64} 64}
65 65
66static void __init shannon_map_io(void) 66static void __init shannon_map_io(void)
diff --git a/arch/arm/mach-sa1100/simpad.c b/arch/arm/mach-sa1100/simpad.c
index 3c74534f7fee..49cfd64663ac 100644
--- a/arch/arm/mach-sa1100/simpad.c
+++ b/arch/arm/mach-sa1100/simpad.c
@@ -166,9 +166,9 @@ static void __init simpad_map_io(void)
166 PCFR = 0; 166 PCFR = 0;
167 PSDR = 0; 167 PSDR = 0;
168 168
169 sa11x0_set_flash_data(&simpad_flash_data, simpad_flash_resources, 169 sa11x0_register_mtd(&simpad_flash_data, simpad_flash_resources,
170 ARRAY_SIZE(simpad_flash_resources)); 170 ARRAY_SIZE(simpad_flash_resources));
171 sa11x0_set_mcp_data(&simpad_mcp_data); 171 sa11x0_register_mcp(&simpad_mcp_data);
172} 172}
173 173
174static void simpad_power_off(void) 174static void simpad_power_off(void)