]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
[ARM] 4948/1: magician: use htc-egpio to drive the GPIO/IRQ expander CPLD
authorPhilipp Zabel <philipp.zabel@gmail.com>
Wed, 9 Apr 2008 18:22:57 +0000 (19:22 +0100)
committerRussell King <rmk+kernel@arm.linux.org.uk>
Sat, 19 Apr 2008 10:29:07 +0000 (11:29 +0100)
needed for power management (audio, BT, charging, GSM, LCD, SD), GSM, flash and SD operation and audio routing.

Signed-off-by: Philipp Zabel <philipp.zabel@gmail.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
arch/arm/configs/magician_defconfig
arch/arm/mach-pxa/magician.c
include/asm-arm/arch-pxa/irqs.h
include/asm-arm/arch-pxa/magician.h

index 703d741f5a23409d536ccb8f5b27be2ff3776a80..76960c71d8906ea3d53fddb5869eafd58aa6f106 100644 (file)
@@ -712,6 +712,7 @@ CONFIG_SSB_POSSIBLE=y
 # Multifunction device drivers
 #
 # CONFIG_MFD_SM501 is not set
+CONFIG_HTC_EGPIO=y
 
 #
 # Multimedia devices
index 0160cd8f6c653eac614e966b1fff19856083edc9..3b7e8bac7344706672740b34cc2c58b703d58c33 100644 (file)
@@ -18,6 +18,7 @@
 #include <linux/platform_device.h>
 #include <linux/gpio_keys.h>
 #include <linux/input.h>
+#include <linux/mfd/htc-egpio.h>
 #include <linux/mtd/mtd.h>
 #include <linux/mtd/map.h>
 #include <linux/mtd/physmap.h>
@@ -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,
 };
index c562b972a4a69c00f4f567cfef7029f0cc15892a..50c77eacbd5e435526ff36d1a5027181cfe19672 100644 (file)
 #elif defined(CONFIG_ARCH_LUBBOCK) || \
       defined(CONFIG_MACH_LOGICPD_PXA270) || \
       defined(CONFIG_MACH_MAINSTONE) || \
-      defined(CONFIG_MACH_PCM027)
+      defined(CONFIG_MACH_PCM027) || \
+      defined(CONFIG_MACH_MAGICIAN)
 #define NR_IRQS                        (IRQ_BOARD_END)
 #else
 #define NR_IRQS                        (IRQ_BOARD_START)
index 13762e80bf5474cd230236a9085d63933eaecde4..216921db9d6304dc04e127a72ad9bf54ac420eee 100644 (file)
@@ -12,6 +12,7 @@
 #ifndef _MAGICIAN_H_
 #define _MAGICIAN_H_
 
+#include <asm/arch/irqs.h>
 #include <asm/arch/pxa2xx-gpio.h>
 
 /*
 #define GPIO119_MAGICIAN_UNKNOWN_MD            (119 | GPIO_OUT)
 #define GPIO120_MAGICIAN_UNKNOWN_MD            (120 | GPIO_OUT)
 
+/*
+ * CPLD IRQs
+ */
+
+#define IRQ_MAGICIAN_SD                (IRQ_BOARD_START + 0)
+#define IRQ_MAGICIAN_EP                (IRQ_BOARD_START + 1)
+#define IRQ_MAGICIAN_BT                (IRQ_BOARD_START + 2)
+#define IRQ_MAGICIAN_AC                (IRQ_BOARD_START + 3)
+
+/*
+ * CPLD EGPIOs
+ */
+
+#define MAGICIAN_EGPIO_BASE                    0x80 /* GPIO_BOARD_START */
+#define MAGICIAN_EGPIO(reg,bit) \
+       (MAGICIAN_EGPIO_BASE + 8*reg + bit)
+
+/* output */
+
+#define EGPIO_MAGICIAN_TOPPOLY_POWER           MAGICIAN_EGPIO(0, 2)
+#define EGPIO_MAGICIAN_LED_POWER               MAGICIAN_EGPIO(0, 5)
+#define EGPIO_MAGICIAN_GSM_RESET               MAGICIAN_EGPIO(0, 6)
+#define EGPIO_MAGICIAN_LCD_POWER               MAGICIAN_EGPIO(0, 7)
+#define EGPIO_MAGICIAN_SPK_POWER               MAGICIAN_EGPIO(1, 0)
+#define EGPIO_MAGICIAN_EP_POWER                        MAGICIAN_EGPIO(1, 1)
+#define EGPIO_MAGICIAN_IN_SEL0                 MAGICIAN_EGPIO(1, 2)
+#define EGPIO_MAGICIAN_IN_SEL1                 MAGICIAN_EGPIO(1, 3)
+#define EGPIO_MAGICIAN_MIC_POWER               MAGICIAN_EGPIO(1, 4)
+#define EGPIO_MAGICIAN_CODEC_RESET             MAGICIAN_EGPIO(1, 5)
+#define EGPIO_MAGICIAN_CODEC_POWER             MAGICIAN_EGPIO(1, 6)
+#define EGPIO_MAGICIAN_BL_POWER                        MAGICIAN_EGPIO(1, 7)
+#define EGPIO_MAGICIAN_SD_POWER                        MAGICIAN_EGPIO(2, 0)
+#define EGPIO_MAGICIAN_CARKIT_MIC              MAGICIAN_EGPIO(2, 1)
+#define EGPIO_MAGICIAN_UNKNOWN_WAVEDEV_DLL     MAGICIAN_EGPIO(2, 2)
+#define EGPIO_MAGICIAN_FLASH_VPP               MAGICIAN_EGPIO(2, 3)
+#define EGPIO_MAGICIAN_BL_POWER2               MAGICIAN_EGPIO(2, 4)
+#define EGPIO_MAGICIAN_CHARGE_EN               MAGICIAN_EGPIO(2, 5)
+#define EGPIO_MAGICIAN_GSM_POWER               MAGICIAN_EGPIO(2, 7)
+
+/* input */
+
+#define EGPIO_MAGICIAN_CABLE_STATE_AC          MAGICIAN_EGPIO(4, 0)
+#define EGPIO_MAGICIAN_CABLE_STATE_USB         MAGICIAN_EGPIO(4, 1)
+
+#define EGPIO_MAGICIAN_BOARD_ID0               MAGICIAN_EGPIO(5, 0)
+#define EGPIO_MAGICIAN_BOARD_ID1               MAGICIAN_EGPIO(5, 1)
+#define EGPIO_MAGICIAN_BOARD_ID2               MAGICIAN_EGPIO(5, 2)
+#define EGPIO_MAGICIAN_LCD_SELECT              MAGICIAN_EGPIO(5, 3)
+#define EGPIO_MAGICIAN_nSD_READONLY            MAGICIAN_EGPIO(5, 4)
+
+#define EGPIO_MAGICIAN_EP_INSERT               MAGICIAN_EGPIO(6, 1)
+
 #endif /* _MAGICIAN_H_ */