aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-sa1100/collie.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/arm/mach-sa1100/collie.c')
-rw-r--r--arch/arm/mach-sa1100/collie.c85
1 files changed, 77 insertions, 8 deletions
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}