aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-pxa/palmld.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/arm/mach-pxa/palmld.c')
-rw-r--r--arch/arm/mach-pxa/palmld.c143
1 files changed, 43 insertions, 100 deletions
diff --git a/arch/arm/mach-pxa/palmld.c b/arch/arm/mach-pxa/palmld.c
index 169fcc18154e..1ad029dd4438 100644
--- a/arch/arm/mach-pxa/palmld.c
+++ b/arch/arm/mach-pxa/palmld.c
@@ -25,6 +25,9 @@
25#include <linux/wm97xx_batt.h> 25#include <linux/wm97xx_batt.h>
26#include <linux/power_supply.h> 26#include <linux/power_supply.h>
27#include <linux/sysdev.h> 27#include <linux/sysdev.h>
28#include <linux/mtd/mtd.h>
29#include <linux/mtd/partitions.h>
30#include <linux/mtd/physmap.h>
28 31
29#include <asm/mach-types.h> 32#include <asm/mach-types.h>
30#include <asm/mach/arch.h> 33#include <asm/mach/arch.h>
@@ -141,85 +144,50 @@ static unsigned long palmld_pin_config[] __initdata = {
141}; 144};
142 145
143/****************************************************************************** 146/******************************************************************************
144 * SD/MMC card controller 147 * NOR Flash
145 ******************************************************************************/ 148 ******************************************************************************/
146static int palmld_mci_init(struct device *dev, irq_handler_t palmld_detect_int, 149static struct mtd_partition palmld_partitions[] = {
147 void *data) 150 {
148{ 151 .name = "Flash",
149 int err = 0; 152 .offset = 0x00000000,
150 153 .size = MTDPART_SIZ_FULL,
151 /* Setup an interrupt for detecting card insert/remove events */ 154 .mask_flags = 0
152 err = gpio_request(GPIO_NR_PALMLD_SD_DETECT_N, "SD IRQ");
153 if (err)
154 goto err;
155 err = gpio_direction_input(GPIO_NR_PALMLD_SD_DETECT_N);
156 if (err)
157 goto err2;
158 err = request_irq(gpio_to_irq(GPIO_NR_PALMLD_SD_DETECT_N),
159 palmld_detect_int, IRQF_DISABLED | IRQF_SAMPLE_RANDOM |
160 IRQF_TRIGGER_FALLING | IRQF_TRIGGER_RISING,
161 "SD/MMC card detect", data);
162 if (err) {
163 printk(KERN_ERR "%s: cannot request SD/MMC card detect IRQ\n",
164 __func__);
165 goto err2;
166 } 155 }
156};
167 157
168 err = gpio_request(GPIO_NR_PALMLD_SD_POWER, "SD_POWER"); 158static struct physmap_flash_data palmld_flash_data[] = {
169 if (err) 159 {
170 goto err3; 160 .width = 2, /* bankwidth in bytes */
171 err = gpio_direction_output(GPIO_NR_PALMLD_SD_POWER, 0); 161 .parts = palmld_partitions,
172 if (err) 162 .nr_parts = ARRAY_SIZE(palmld_partitions)
173 goto err4; 163 }
174 164};
175 err = gpio_request(GPIO_NR_PALMLD_SD_READONLY, "SD_READONLY");
176 if (err)
177 goto err4;
178 err = gpio_direction_input(GPIO_NR_PALMLD_SD_READONLY);
179 if (err)
180 goto err5;
181
182 printk(KERN_DEBUG "%s: irq registered\n", __func__);
183
184 return 0;
185
186err5:
187 gpio_free(GPIO_NR_PALMLD_SD_READONLY);
188err4:
189 gpio_free(GPIO_NR_PALMLD_SD_POWER);
190err3:
191 free_irq(gpio_to_irq(GPIO_NR_PALMLD_SD_DETECT_N), data);
192err2:
193 gpio_free(GPIO_NR_PALMLD_SD_DETECT_N);
194err:
195 return err;
196}
197
198static void palmld_mci_exit(struct device *dev, void *data)
199{
200 gpio_free(GPIO_NR_PALMLD_SD_READONLY);
201 gpio_free(GPIO_NR_PALMLD_SD_POWER);
202 free_irq(gpio_to_irq(GPIO_NR_PALMLD_SD_DETECT_N), data);
203 gpio_free(GPIO_NR_PALMLD_SD_DETECT_N);
204}
205 165
206static void palmld_mci_power(struct device *dev, unsigned int vdd) 166static struct resource palmld_flash_resource = {
207{ 167 .start = PXA_CS0_PHYS,
208 struct pxamci_platform_data *p_d = dev->platform_data; 168 .end = PXA_CS0_PHYS + SZ_4M - 1,
209 gpio_set_value(GPIO_NR_PALMLD_SD_POWER, p_d->ocr_mask & (1 << vdd)); 169 .flags = IORESOURCE_MEM,
210} 170};
211 171
212static int palmld_mci_get_ro(struct device *dev) 172static struct platform_device palmld_flash = {
213{ 173 .name = "physmap-flash",
214 return gpio_get_value(GPIO_NR_PALMLD_SD_READONLY); 174 .id = 0,
215} 175 .resource = &palmld_flash_resource,
176 .num_resources = 1,
177 .dev = {
178 .platform_data = palmld_flash_data,
179 },
180};
216 181
182/******************************************************************************
183 * SD/MMC card controller
184 ******************************************************************************/
217static struct pxamci_platform_data palmld_mci_platform_data = { 185static struct pxamci_platform_data palmld_mci_platform_data = {
218 .ocr_mask = MMC_VDD_32_33 | MMC_VDD_33_34, 186 .ocr_mask = MMC_VDD_32_33 | MMC_VDD_33_34,
219 .setpower = palmld_mci_power, 187 .gpio_card_detect = GPIO_NR_PALMLD_SD_DETECT_N,
220 .get_ro = palmld_mci_get_ro, 188 .gpio_card_ro = GPIO_NR_PALMLD_SD_READONLY,
221 .init = palmld_mci_init, 189 .gpio_power = GPIO_NR_PALMLD_SD_POWER,
222 .exit = palmld_mci_exit, 190 .detect_delay = 20,
223}; 191};
224 192
225/****************************************************************************** 193/******************************************************************************
@@ -336,35 +304,9 @@ static struct platform_device palmld_backlight = {
336/****************************************************************************** 304/******************************************************************************
337 * IrDA 305 * IrDA
338 ******************************************************************************/ 306 ******************************************************************************/
339static int palmld_irda_startup(struct device *dev)
340{
341 int err;
342 err = gpio_request(GPIO_NR_PALMLD_IR_DISABLE, "IR DISABLE");
343 if (err)
344 goto err;
345 err = gpio_direction_output(GPIO_NR_PALMLD_IR_DISABLE, 1);
346 if (err)
347 gpio_free(GPIO_NR_PALMLD_IR_DISABLE);
348err:
349 return err;
350}
351
352static void palmld_irda_shutdown(struct device *dev)
353{
354 gpio_free(GPIO_NR_PALMLD_IR_DISABLE);
355}
356
357static void palmld_irda_transceiver_mode(struct device *dev, int mode)
358{
359 gpio_set_value(GPIO_NR_PALMLD_IR_DISABLE, mode & IR_OFF);
360 pxa2xx_transceiver_mode(dev, mode);
361}
362
363static struct pxaficp_platform_data palmld_ficp_platform_data = { 307static struct pxaficp_platform_data palmld_ficp_platform_data = {
364 .startup = palmld_irda_startup, 308 .gpio_pwdown = GPIO_NR_PALMLD_IR_DISABLE,
365 .shutdown = palmld_irda_shutdown, 309 .transceiver_cap = IR_SIRMODE | IR_OFF,
366 .transceiver_cap = IR_SIRMODE | IR_FIRMODE | IR_OFF,
367 .transceiver_mode = palmld_irda_transceiver_mode,
368}; 310};
369 311
370/****************************************************************************** 312/******************************************************************************
@@ -560,6 +502,7 @@ static struct platform_device *devices[] __initdata = {
560 &power_supply, 502 &power_supply,
561 &palmld_asoc, 503 &palmld_asoc,
562 &palmld_hdd, 504 &palmld_hdd,
505 &palmld_flash,
563}; 506};
564 507
565static struct map_desc palmld_io_desc[] __initdata = { 508static struct map_desc palmld_io_desc[] __initdata = {