From 7a648256b20c493c99757fe1d248daf7954647bc Mon Sep 17 00:00:00 2001 From: Robert Jarzmik Date: Mon, 6 Jul 2009 22:16:42 +0200 Subject: [ARM] pxa: factor pxamci gpio handling Several boards use always the same pattern with pxamci : request gpio, request irq for that gpio to detect MMC card insertion, request gpio for read-only mode detection, etc ... Now that pxamci provides platform_data to describe simple gpio management of the MMC external controls, use it. Signed-off-by: Robert Jarzmik Acked-by: Mike Rapoport Acked-by: Philipp Zabel Acked-by: Dmitry Eremin-Solenikov Cc: rpurdie@rpsys.net Cc: drwyrm@gmail.com Cc: sakoman@gmail.com Cc: marek.vasut@gmail.com Cc: s.hauer@pengutronix.de Signed-off-by: Eric Miao --- arch/arm/mach-pxa/palmld.c | 80 +++------------------------------------------- 1 file changed, 4 insertions(+), 76 deletions(-) (limited to 'arch/arm/mach-pxa/palmld.c') diff --git a/arch/arm/mach-pxa/palmld.c b/arch/arm/mach-pxa/palmld.c index 169fcc18154..445749198cd 100644 --- a/arch/arm/mach-pxa/palmld.c +++ b/arch/arm/mach-pxa/palmld.c @@ -143,83 +143,11 @@ static unsigned long palmld_pin_config[] __initdata = { /****************************************************************************** * SD/MMC card controller ******************************************************************************/ -static int palmld_mci_init(struct device *dev, irq_handler_t palmld_detect_int, - void *data) -{ - int err = 0; - - /* Setup an interrupt for detecting card insert/remove events */ - err = gpio_request(GPIO_NR_PALMLD_SD_DETECT_N, "SD IRQ"); - if (err) - goto err; - err = gpio_direction_input(GPIO_NR_PALMLD_SD_DETECT_N); - if (err) - goto err2; - err = request_irq(gpio_to_irq(GPIO_NR_PALMLD_SD_DETECT_N), - palmld_detect_int, IRQF_DISABLED | IRQF_SAMPLE_RANDOM | - IRQF_TRIGGER_FALLING | IRQF_TRIGGER_RISING, - "SD/MMC card detect", data); - if (err) { - printk(KERN_ERR "%s: cannot request SD/MMC card detect IRQ\n", - __func__); - goto err2; - } - - err = gpio_request(GPIO_NR_PALMLD_SD_POWER, "SD_POWER"); - if (err) - goto err3; - err = gpio_direction_output(GPIO_NR_PALMLD_SD_POWER, 0); - if (err) - goto err4; - - err = gpio_request(GPIO_NR_PALMLD_SD_READONLY, "SD_READONLY"); - if (err) - goto err4; - err = gpio_direction_input(GPIO_NR_PALMLD_SD_READONLY); - if (err) - goto err5; - - printk(KERN_DEBUG "%s: irq registered\n", __func__); - - return 0; - -err5: - gpio_free(GPIO_NR_PALMLD_SD_READONLY); -err4: - gpio_free(GPIO_NR_PALMLD_SD_POWER); -err3: - free_irq(gpio_to_irq(GPIO_NR_PALMLD_SD_DETECT_N), data); -err2: - gpio_free(GPIO_NR_PALMLD_SD_DETECT_N); -err: - return err; -} - -static void palmld_mci_exit(struct device *dev, void *data) -{ - gpio_free(GPIO_NR_PALMLD_SD_READONLY); - gpio_free(GPIO_NR_PALMLD_SD_POWER); - free_irq(gpio_to_irq(GPIO_NR_PALMLD_SD_DETECT_N), data); - gpio_free(GPIO_NR_PALMLD_SD_DETECT_N); -} - -static void palmld_mci_power(struct device *dev, unsigned int vdd) -{ - struct pxamci_platform_data *p_d = dev->platform_data; - gpio_set_value(GPIO_NR_PALMLD_SD_POWER, p_d->ocr_mask & (1 << vdd)); -} - -static int palmld_mci_get_ro(struct device *dev) -{ - return gpio_get_value(GPIO_NR_PALMLD_SD_READONLY); -} - static struct pxamci_platform_data palmld_mci_platform_data = { - .ocr_mask = MMC_VDD_32_33 | MMC_VDD_33_34, - .setpower = palmld_mci_power, - .get_ro = palmld_mci_get_ro, - .init = palmld_mci_init, - .exit = palmld_mci_exit, + .ocr_mask = MMC_VDD_32_33 | MMC_VDD_33_34, + .gpio_card_detect = GPIO_NR_PALMLD_SD_DETECT_N, + .gpio_card_ro = GPIO_NR_PALMLD_SD_READONLY, + .gpio_power = GPIO_NR_PALMLD_SD_POWER, }; /****************************************************************************** -- cgit v1.2.3 From 9845b6b15cf03ae3f473c39a13f2454abad50e09 Mon Sep 17 00:00:00 2001 From: Marek Vasut Date: Thu, 16 Jul 2009 19:38:41 +0200 Subject: [ARM] pxa/palm: add detect_delay to mmc for PalmTX,T5,LD Signed-off-by: Marek Vasut Signed-off-by: Eric Miao --- arch/arm/mach-pxa/palmld.c | 1 + 1 file changed, 1 insertion(+) (limited to 'arch/arm/mach-pxa/palmld.c') diff --git a/arch/arm/mach-pxa/palmld.c b/arch/arm/mach-pxa/palmld.c index 445749198cd..08c599b49d8 100644 --- a/arch/arm/mach-pxa/palmld.c +++ b/arch/arm/mach-pxa/palmld.c @@ -148,6 +148,7 @@ static struct pxamci_platform_data palmld_mci_platform_data = { .gpio_card_detect = GPIO_NR_PALMLD_SD_DETECT_N, .gpio_card_ro = GPIO_NR_PALMLD_SD_READONLY, .gpio_power = GPIO_NR_PALMLD_SD_POWER, + .detect_delay = 20, }; /****************************************************************************** -- cgit v1.2.3 From d7c307cfe76ae0c0493fbdac417ef6e30221f61b Mon Sep 17 00:00:00 2001 From: Marek Vasut Date: Fri, 17 Jul 2009 19:46:58 +0200 Subject: [ARM] pxa/palm: Add NOR flash support for PalmLD Signed-off-by: Marek Vasut Signed-off-by: Eric Miao --- arch/arm/mach-pxa/palmld.c | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) (limited to 'arch/arm/mach-pxa/palmld.c') diff --git a/arch/arm/mach-pxa/palmld.c b/arch/arm/mach-pxa/palmld.c index 08c599b49d8..b3ae8b958ad 100644 --- a/arch/arm/mach-pxa/palmld.c +++ b/arch/arm/mach-pxa/palmld.c @@ -25,6 +25,9 @@ #include #include #include +#include +#include +#include #include #include @@ -140,6 +143,42 @@ static unsigned long palmld_pin_config[] __initdata = { GPIO13_GPIO, /* earphone detect */ }; +/****************************************************************************** + * NOR Flash + ******************************************************************************/ +static struct mtd_partition palmld_partitions[] = { + { + .name = "Flash", + .offset = 0x00000000, + .size = MTDPART_SIZ_FULL, + .mask_flags = 0 + } +}; + +static struct physmap_flash_data palmld_flash_data[] = { + { + .width = 2, /* bankwidth in bytes */ + .parts = palmld_partitions, + .nr_parts = ARRAY_SIZE(palmld_partitions) + } +}; + +static struct resource palmld_flash_resource = { + .start = PXA_CS0_PHYS, + .end = PXA_CS0_PHYS + SZ_4M - 1, + .flags = IORESOURCE_MEM, +}; + +static struct platform_device palmld_flash = { + .name = "physmap-flash", + .id = 0, + .resource = &palmld_flash_resource, + .num_resources = 1, + .dev = { + .platform_data = palmld_flash_data, + }, +}; + /****************************************************************************** * SD/MMC card controller ******************************************************************************/ @@ -489,6 +528,7 @@ static struct platform_device *devices[] __initdata = { &power_supply, &palmld_asoc, &palmld_hdd, + &palmld_flash, }; static struct map_desc palmld_io_desc[] __initdata = { -- cgit v1.2.3 From c4bd01727380ce666aba987b3d7c0e838cb99bbe Mon Sep 17 00:00:00 2001 From: Marek Vasut Date: Fri, 17 Jul 2009 12:50:43 +0200 Subject: [ARM] pxa: add gpio_pwdown(_inverted) into pxaficp_ir.c and convert PXA-based devices to gpio_pwdown where possible. Signed-off-by: Marek Vasut Signed-off-by: Eric Miao --- arch/arm/mach-pxa/palmld.c | 30 ++---------------------------- 1 file changed, 2 insertions(+), 28 deletions(-) (limited to 'arch/arm/mach-pxa/palmld.c') diff --git a/arch/arm/mach-pxa/palmld.c b/arch/arm/mach-pxa/palmld.c index b3ae8b958ad..1ad029dd443 100644 --- a/arch/arm/mach-pxa/palmld.c +++ b/arch/arm/mach-pxa/palmld.c @@ -304,35 +304,9 @@ static struct platform_device palmld_backlight = { /****************************************************************************** * IrDA ******************************************************************************/ -static int palmld_irda_startup(struct device *dev) -{ - int err; - err = gpio_request(GPIO_NR_PALMLD_IR_DISABLE, "IR DISABLE"); - if (err) - goto err; - err = gpio_direction_output(GPIO_NR_PALMLD_IR_DISABLE, 1); - if (err) - gpio_free(GPIO_NR_PALMLD_IR_DISABLE); -err: - return err; -} - -static void palmld_irda_shutdown(struct device *dev) -{ - gpio_free(GPIO_NR_PALMLD_IR_DISABLE); -} - -static void palmld_irda_transceiver_mode(struct device *dev, int mode) -{ - gpio_set_value(GPIO_NR_PALMLD_IR_DISABLE, mode & IR_OFF); - pxa2xx_transceiver_mode(dev, mode); -} - static struct pxaficp_platform_data palmld_ficp_platform_data = { - .startup = palmld_irda_startup, - .shutdown = palmld_irda_shutdown, - .transceiver_cap = IR_SIRMODE | IR_FIRMODE | IR_OFF, - .transceiver_mode = palmld_irda_transceiver_mode, + .gpio_pwdown = GPIO_NR_PALMLD_IR_DISABLE, + .transceiver_cap = IR_SIRMODE | IR_OFF, }; /****************************************************************************** -- cgit v1.2.3