diff options
Diffstat (limited to 'arch/arm/mach-sa1100/collie.c')
-rw-r--r-- | arch/arm/mach-sa1100/collie.c | 89 |
1 files changed, 81 insertions, 8 deletions
diff --git a/arch/arm/mach-sa1100/collie.c b/arch/arm/mach-sa1100/collie.c index bbf2ebcc3066..5d5f330c5d94 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[] = { | |||
56 | static struct scoop_config collie_scoop_setup = { | 57 | static 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 | ||
61 | struct platform_device colliescoop_device = { | 63 | struct platform_device colliescoop_device = { |
@@ -85,6 +87,70 @@ static struct scoop_pcmcia_config collie_pcmcia_config = { | |||
85 | static struct mcp_plat_data collie_mcp_data = { | 87 | static 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 | */ | ||
96 | static 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 | |||
108 | err_gpio_in: | ||
109 | gpio_free(COLLIE_GPIO_AC_IN); | ||
110 | err_gpio_req: | ||
111 | return ret; | ||
112 | } | ||
113 | |||
114 | static void collie_power_exit(struct device *dev) | ||
115 | { | ||
116 | gpio_free(COLLIE_GPIO_AC_IN); | ||
117 | } | ||
118 | |||
119 | static int collie_power_ac_online(void) | ||
120 | { | ||
121 | return gpio_get_value(COLLIE_GPIO_AC_IN) == 2; | ||
122 | } | ||
123 | |||
124 | static char *collie_ac_supplied_to[] = { | ||
125 | "main-battery", | ||
126 | "backup-battery", | ||
127 | }; | ||
128 | |||
129 | static 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 | |||
137 | static 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 | |||
148 | static 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 |
@@ -168,6 +234,10 @@ static struct resource locomo_resources[] = { | |||
168 | }, | 234 | }, |
169 | }; | 235 | }; |
170 | 236 | ||
237 | static struct locomo_platform_data locomo_info = { | ||
238 | .irq_base = IRQ_BOARD_START, | ||
239 | }; | ||
240 | |||
171 | struct platform_device collie_locomo_device = { | 241 | struct platform_device collie_locomo_device = { |
172 | .name = "locomo", | 242 | .name = "locomo", |
173 | .id = 0, | 243 | .id = 0, |
@@ -178,6 +248,7 @@ struct platform_device collie_locomo_device = { | |||
178 | static struct platform_device *devices[] __initdata = { | 248 | static struct platform_device *devices[] __initdata = { |
179 | &collie_locomo_device, | 249 | &collie_locomo_device, |
180 | &colliescoop_device, | 250 | &colliescoop_device, |
251 | &collie_power_device, | ||
181 | }; | 252 | }; |
182 | 253 | ||
183 | static struct mtd_partition collie_partitions[] = { | 254 | static struct mtd_partition collie_partitions[] = { |
@@ -248,22 +319,24 @@ static void __init collie_init(void) | |||
248 | GPDR = GPIO_LDD8 | GPIO_LDD9 | GPIO_LDD10 | GPIO_LDD11 | GPIO_LDD12 | | 319 | GPDR = GPIO_LDD8 | GPIO_LDD9 | GPIO_LDD10 | GPIO_LDD11 | GPIO_LDD12 | |
249 | GPIO_LDD13 | GPIO_LDD14 | GPIO_LDD15 | GPIO_SSP_TXD | | 320 | GPIO_LDD13 | GPIO_LDD14 | GPIO_LDD15 | GPIO_SSP_TXD | |
250 | GPIO_SSP_SCLK | GPIO_SSP_SFRM | GPIO_SDLC_SCLK | | 321 | GPIO_SSP_SCLK | GPIO_SSP_SFRM | GPIO_SDLC_SCLK | |
251 | COLLIE_GPIO_UCB1x00_RESET | COLLIE_GPIO_nMIC_ON | | 322 | _COLLIE_GPIO_UCB1x00_RESET | _COLLIE_GPIO_nMIC_ON | |
252 | COLLIE_GPIO_nREMOCON_ON | GPIO_32_768kHz; | 323 | _COLLIE_GPIO_nREMOCON_ON | GPIO_32_768kHz; |
253 | 324 | ||
254 | PPDR = PPC_LDD0 | PPC_LDD1 | PPC_LDD2 | PPC_LDD3 | PPC_LDD4 | PPC_LDD5 | | 325 | 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 | | 326 | 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; | 327 | PPC_TXD1 | PPC_TXD2 | PPC_TXD3 | PPC_TXD4 | PPC_SCLK | PPC_SFRM; |
257 | 328 | ||
258 | PWER = COLLIE_GPIO_AC_IN | COLLIE_GPIO_CO | COLLIE_GPIO_ON_KEY | | 329 | PWER = _COLLIE_GPIO_AC_IN | _COLLIE_GPIO_CO | _COLLIE_GPIO_ON_KEY | |
259 | COLLIE_GPIO_WAKEUP | COLLIE_GPIO_nREMOCON_INT | PWER_RTC; | 330 | _COLLIE_GPIO_WAKEUP | _COLLIE_GPIO_nREMOCON_INT | PWER_RTC; |
260 | 331 | ||
261 | PGSR = COLLIE_GPIO_nREMOCON_ON; | 332 | PGSR = _COLLIE_GPIO_nREMOCON_ON; |
262 | 333 | ||
263 | PSDR = PPC_RXD1 | PPC_RXD2 | PPC_RXD3 | PPC_RXD4; | 334 | PSDR = PPC_RXD1 | PPC_RXD2 | PPC_RXD3 | PPC_RXD4; |
264 | 335 | ||
265 | PCFR = PCFR_OPDE; | 336 | PCFR = PCFR_OPDE; |
266 | 337 | ||
338 | GPSR |= _COLLIE_GPIO_UCB1x00_RESET; | ||
339 | |||
267 | 340 | ||
268 | platform_scoop_config = &collie_pcmcia_config; | 341 | platform_scoop_config = &collie_pcmcia_config; |
269 | 342 | ||
@@ -272,9 +345,9 @@ static void __init collie_init(void) | |||
272 | printk(KERN_WARNING "collie: Unable to register LoCoMo device\n"); | 345 | printk(KERN_WARNING "collie: Unable to register LoCoMo device\n"); |
273 | } | 346 | } |
274 | 347 | ||
275 | sa11x0_set_flash_data(&collie_flash_data, collie_flash_resources, | 348 | sa11x0_register_mtd(&collie_flash_data, collie_flash_resources, |
276 | ARRAY_SIZE(collie_flash_resources)); | 349 | ARRAY_SIZE(collie_flash_resources)); |
277 | sa11x0_set_mcp_data(&collie_mcp_data); | 350 | sa11x0_register_mcp(&collie_mcp_data); |
278 | 351 | ||
279 | sharpsl_save_param(); | 352 | sharpsl_save_param(); |
280 | } | 353 | } |