From 70e357f8426c54e1500ac4fdb6b1172df16d8b93 Mon Sep 17 00:00:00 2001 From: Philipp Zabel Date: Wed, 9 Apr 2008 19:22:57 +0100 Subject: [ARM] 4948/1: magician: use htc-egpio to drive the GPIO/IRQ expander CPLD needed for power management (audio, BT, charging, GSM, LCD, SD), GSM, flash and SD operation and audio routing. Signed-off-by: Philipp Zabel Signed-off-by: Russell King --- arch/arm/configs/magician_defconfig | 1 + arch/arm/mach-pxa/magician.c | 60 ++++++++++++++++++++++++++++++++++++- 2 files changed, 60 insertions(+), 1 deletion(-) (limited to 'arch') diff --git a/arch/arm/configs/magician_defconfig b/arch/arm/configs/magician_defconfig index 703d741..76960c7 100644 --- a/arch/arm/configs/magician_defconfig +++ b/arch/arm/configs/magician_defconfig @@ -712,6 +712,7 @@ CONFIG_SSB_POSSIBLE=y # Multifunction device drivers # # CONFIG_MFD_SM501 is not set +CONFIG_HTC_EGPIO=y # # Multimedia devices diff --git a/arch/arm/mach-pxa/magician.c b/arch/arm/mach-pxa/magician.c index 0160cd8..3b7e8ba 100644 --- a/arch/arm/mach-pxa/magician.c +++ b/arch/arm/mach-pxa/magician.c @@ -18,6 +18,7 @@ #include #include #include +#include #include #include #include @@ -84,6 +85,62 @@ static struct platform_device gpio_keys = { .id = -1, }; + +/* + * EGPIO (Xilinx CPLD) + * + * 7 32-bit aligned 8-bit registers: 3x output, 1x irq, 3x input + */ + +static struct resource egpio_resources[] = { + [0] = { + .start = PXA_CS3_PHYS, + .end = PXA_CS3_PHYS + 0x20, + .flags = IORESOURCE_MEM, + }, + [1] = { + .start = gpio_to_irq(GPIO13_MAGICIAN_CPLD_IRQ), + .end = gpio_to_irq(GPIO13_MAGICIAN_CPLD_IRQ), + .flags = IORESOURCE_IRQ, + }, +}; + +static struct htc_egpio_chip egpio_chips[] = { + [0] = { + .reg_start = 0, + .gpio_base = MAGICIAN_EGPIO(0, 0), + .num_gpios = 24, + .direction = HTC_EGPIO_OUTPUT, + .initial_values = 0x40, /* EGPIO_MAGICIAN_GSM_RESET */ + }, + [1] = { + .reg_start = 4, + .gpio_base = MAGICIAN_EGPIO(4, 0), + .num_gpios = 24, + .direction = HTC_EGPIO_INPUT, + }, +}; + +static struct htc_egpio_platform_data egpio_info = { + .reg_width = 8, + .bus_width = 32, + .irq_base = IRQ_BOARD_START, + .num_irqs = 4, + .ack_register = 3, + .chip = egpio_chips, + .num_chips = ARRAY_SIZE(egpio_chips), +}; + +static struct platform_device egpio = { + .name = "htc-egpio", + .id = -1, + .resource = egpio_resources, + .num_resources = ARRAY_SIZE(egpio_resources), + .dev = { + .platform_data = &egpio_info, + }, +}; + /* * LCD - Toppoly TD028STEB1 */ @@ -182,8 +239,8 @@ static struct physmap_flash_data strataflash_data = { static struct platform_device strataflash = { .name = "physmap-flash", .id = -1, - .num_resources = 1, .resource = &strataflash_resource, + .num_resources = 1, .dev = { .platform_data = &strataflash_data, }, @@ -195,6 +252,7 @@ static struct platform_device strataflash = { static struct platform_device *devices[] __initdata = { &gpio_keys, + &egpio, &backlight, &strataflash, }; -- cgit v1.1