diff options
author | Philipp Zabel <philipp.zabel@gmail.com> | 2008-04-09 14:22:57 -0400 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2008-04-19 06:29:07 -0400 |
commit | 70e357f8426c54e1500ac4fdb6b1172df16d8b93 (patch) | |
tree | 37b8d927ed21561a5f103bba83188e7bf60a17c9 | |
parent | a1635b8fe59de2c5223cda5ca8397b875c901904 (diff) |
[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 <philipp.zabel@gmail.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
-rw-r--r-- | arch/arm/configs/magician_defconfig | 1 | ||||
-rw-r--r-- | arch/arm/mach-pxa/magician.c | 60 | ||||
-rw-r--r-- | include/asm-arm/arch-pxa/irqs.h | 3 | ||||
-rw-r--r-- | include/asm-arm/arch-pxa/magician.h | 53 |
4 files changed, 115 insertions, 2 deletions
diff --git a/arch/arm/configs/magician_defconfig b/arch/arm/configs/magician_defconfig index 703d741f5a23..76960c71d890 100644 --- a/arch/arm/configs/magician_defconfig +++ b/arch/arm/configs/magician_defconfig | |||
@@ -712,6 +712,7 @@ CONFIG_SSB_POSSIBLE=y | |||
712 | # Multifunction device drivers | 712 | # Multifunction device drivers |
713 | # | 713 | # |
714 | # CONFIG_MFD_SM501 is not set | 714 | # CONFIG_MFD_SM501 is not set |
715 | CONFIG_HTC_EGPIO=y | ||
715 | 716 | ||
716 | # | 717 | # |
717 | # Multimedia devices | 718 | # Multimedia devices |
diff --git a/arch/arm/mach-pxa/magician.c b/arch/arm/mach-pxa/magician.c index 0160cd8f6c65..3b7e8bac7344 100644 --- a/arch/arm/mach-pxa/magician.c +++ b/arch/arm/mach-pxa/magician.c | |||
@@ -18,6 +18,7 @@ | |||
18 | #include <linux/platform_device.h> | 18 | #include <linux/platform_device.h> |
19 | #include <linux/gpio_keys.h> | 19 | #include <linux/gpio_keys.h> |
20 | #include <linux/input.h> | 20 | #include <linux/input.h> |
21 | #include <linux/mfd/htc-egpio.h> | ||
21 | #include <linux/mtd/mtd.h> | 22 | #include <linux/mtd/mtd.h> |
22 | #include <linux/mtd/map.h> | 23 | #include <linux/mtd/map.h> |
23 | #include <linux/mtd/physmap.h> | 24 | #include <linux/mtd/physmap.h> |
@@ -84,6 +85,62 @@ static struct platform_device gpio_keys = { | |||
84 | .id = -1, | 85 | .id = -1, |
85 | }; | 86 | }; |
86 | 87 | ||
88 | |||
89 | /* | ||
90 | * EGPIO (Xilinx CPLD) | ||
91 | * | ||
92 | * 7 32-bit aligned 8-bit registers: 3x output, 1x irq, 3x input | ||
93 | */ | ||
94 | |||
95 | static struct resource egpio_resources[] = { | ||
96 | [0] = { | ||
97 | .start = PXA_CS3_PHYS, | ||
98 | .end = PXA_CS3_PHYS + 0x20, | ||
99 | .flags = IORESOURCE_MEM, | ||
100 | }, | ||
101 | [1] = { | ||
102 | .start = gpio_to_irq(GPIO13_MAGICIAN_CPLD_IRQ), | ||
103 | .end = gpio_to_irq(GPIO13_MAGICIAN_CPLD_IRQ), | ||
104 | .flags = IORESOURCE_IRQ, | ||
105 | }, | ||
106 | }; | ||
107 | |||
108 | static struct htc_egpio_chip egpio_chips[] = { | ||
109 | [0] = { | ||
110 | .reg_start = 0, | ||
111 | .gpio_base = MAGICIAN_EGPIO(0, 0), | ||
112 | .num_gpios = 24, | ||
113 | .direction = HTC_EGPIO_OUTPUT, | ||
114 | .initial_values = 0x40, /* EGPIO_MAGICIAN_GSM_RESET */ | ||
115 | }, | ||
116 | [1] = { | ||
117 | .reg_start = 4, | ||
118 | .gpio_base = MAGICIAN_EGPIO(4, 0), | ||
119 | .num_gpios = 24, | ||
120 | .direction = HTC_EGPIO_INPUT, | ||
121 | }, | ||
122 | }; | ||
123 | |||
124 | static struct htc_egpio_platform_data egpio_info = { | ||
125 | .reg_width = 8, | ||
126 | .bus_width = 32, | ||
127 | .irq_base = IRQ_BOARD_START, | ||
128 | .num_irqs = 4, | ||
129 | .ack_register = 3, | ||
130 | .chip = egpio_chips, | ||
131 | .num_chips = ARRAY_SIZE(egpio_chips), | ||
132 | }; | ||
133 | |||
134 | static struct platform_device egpio = { | ||
135 | .name = "htc-egpio", | ||
136 | .id = -1, | ||
137 | .resource = egpio_resources, | ||
138 | .num_resources = ARRAY_SIZE(egpio_resources), | ||
139 | .dev = { | ||
140 | .platform_data = &egpio_info, | ||
141 | }, | ||
142 | }; | ||
143 | |||
87 | /* | 144 | /* |
88 | * LCD - Toppoly TD028STEB1 | 145 | * LCD - Toppoly TD028STEB1 |
89 | */ | 146 | */ |
@@ -182,8 +239,8 @@ static struct physmap_flash_data strataflash_data = { | |||
182 | static struct platform_device strataflash = { | 239 | static struct platform_device strataflash = { |
183 | .name = "physmap-flash", | 240 | .name = "physmap-flash", |
184 | .id = -1, | 241 | .id = -1, |
185 | .num_resources = 1, | ||
186 | .resource = &strataflash_resource, | 242 | .resource = &strataflash_resource, |
243 | .num_resources = 1, | ||
187 | .dev = { | 244 | .dev = { |
188 | .platform_data = &strataflash_data, | 245 | .platform_data = &strataflash_data, |
189 | }, | 246 | }, |
@@ -195,6 +252,7 @@ static struct platform_device strataflash = { | |||
195 | 252 | ||
196 | static struct platform_device *devices[] __initdata = { | 253 | static struct platform_device *devices[] __initdata = { |
197 | &gpio_keys, | 254 | &gpio_keys, |
255 | &egpio, | ||
198 | &backlight, | 256 | &backlight, |
199 | &strataflash, | 257 | &strataflash, |
200 | }; | 258 | }; |
diff --git a/include/asm-arm/arch-pxa/irqs.h b/include/asm-arm/arch-pxa/irqs.h index c562b972a4a6..50c77eacbd5e 100644 --- a/include/asm-arm/arch-pxa/irqs.h +++ b/include/asm-arm/arch-pxa/irqs.h | |||
@@ -181,7 +181,8 @@ | |||
181 | #elif defined(CONFIG_ARCH_LUBBOCK) || \ | 181 | #elif defined(CONFIG_ARCH_LUBBOCK) || \ |
182 | defined(CONFIG_MACH_LOGICPD_PXA270) || \ | 182 | defined(CONFIG_MACH_LOGICPD_PXA270) || \ |
183 | defined(CONFIG_MACH_MAINSTONE) || \ | 183 | defined(CONFIG_MACH_MAINSTONE) || \ |
184 | defined(CONFIG_MACH_PCM027) | 184 | defined(CONFIG_MACH_PCM027) || \ |
185 | defined(CONFIG_MACH_MAGICIAN) | ||
185 | #define NR_IRQS (IRQ_BOARD_END) | 186 | #define NR_IRQS (IRQ_BOARD_END) |
186 | #else | 187 | #else |
187 | #define NR_IRQS (IRQ_BOARD_START) | 188 | #define NR_IRQS (IRQ_BOARD_START) |
diff --git a/include/asm-arm/arch-pxa/magician.h b/include/asm-arm/arch-pxa/magician.h index 13762e80bf54..216921db9d63 100644 --- a/include/asm-arm/arch-pxa/magician.h +++ b/include/asm-arm/arch-pxa/magician.h | |||
@@ -12,6 +12,7 @@ | |||
12 | #ifndef _MAGICIAN_H_ | 12 | #ifndef _MAGICIAN_H_ |
13 | #define _MAGICIAN_H_ | 13 | #define _MAGICIAN_H_ |
14 | 14 | ||
15 | #include <asm/arch/irqs.h> | ||
15 | #include <asm/arch/pxa2xx-gpio.h> | 16 | #include <asm/arch/pxa2xx-gpio.h> |
16 | 17 | ||
17 | /* | 18 | /* |
@@ -108,4 +109,56 @@ | |||
108 | #define GPIO119_MAGICIAN_UNKNOWN_MD (119 | GPIO_OUT) | 109 | #define GPIO119_MAGICIAN_UNKNOWN_MD (119 | GPIO_OUT) |
109 | #define GPIO120_MAGICIAN_UNKNOWN_MD (120 | GPIO_OUT) | 110 | #define GPIO120_MAGICIAN_UNKNOWN_MD (120 | GPIO_OUT) |
110 | 111 | ||
112 | /* | ||
113 | * CPLD IRQs | ||
114 | */ | ||
115 | |||
116 | #define IRQ_MAGICIAN_SD (IRQ_BOARD_START + 0) | ||
117 | #define IRQ_MAGICIAN_EP (IRQ_BOARD_START + 1) | ||
118 | #define IRQ_MAGICIAN_BT (IRQ_BOARD_START + 2) | ||
119 | #define IRQ_MAGICIAN_AC (IRQ_BOARD_START + 3) | ||
120 | |||
121 | /* | ||
122 | * CPLD EGPIOs | ||
123 | */ | ||
124 | |||
125 | #define MAGICIAN_EGPIO_BASE 0x80 /* GPIO_BOARD_START */ | ||
126 | #define MAGICIAN_EGPIO(reg,bit) \ | ||
127 | (MAGICIAN_EGPIO_BASE + 8*reg + bit) | ||
128 | |||
129 | /* output */ | ||
130 | |||
131 | #define EGPIO_MAGICIAN_TOPPOLY_POWER MAGICIAN_EGPIO(0, 2) | ||
132 | #define EGPIO_MAGICIAN_LED_POWER MAGICIAN_EGPIO(0, 5) | ||
133 | #define EGPIO_MAGICIAN_GSM_RESET MAGICIAN_EGPIO(0, 6) | ||
134 | #define EGPIO_MAGICIAN_LCD_POWER MAGICIAN_EGPIO(0, 7) | ||
135 | #define EGPIO_MAGICIAN_SPK_POWER MAGICIAN_EGPIO(1, 0) | ||
136 | #define EGPIO_MAGICIAN_EP_POWER MAGICIAN_EGPIO(1, 1) | ||
137 | #define EGPIO_MAGICIAN_IN_SEL0 MAGICIAN_EGPIO(1, 2) | ||
138 | #define EGPIO_MAGICIAN_IN_SEL1 MAGICIAN_EGPIO(1, 3) | ||
139 | #define EGPIO_MAGICIAN_MIC_POWER MAGICIAN_EGPIO(1, 4) | ||
140 | #define EGPIO_MAGICIAN_CODEC_RESET MAGICIAN_EGPIO(1, 5) | ||
141 | #define EGPIO_MAGICIAN_CODEC_POWER MAGICIAN_EGPIO(1, 6) | ||
142 | #define EGPIO_MAGICIAN_BL_POWER MAGICIAN_EGPIO(1, 7) | ||
143 | #define EGPIO_MAGICIAN_SD_POWER MAGICIAN_EGPIO(2, 0) | ||
144 | #define EGPIO_MAGICIAN_CARKIT_MIC MAGICIAN_EGPIO(2, 1) | ||
145 | #define EGPIO_MAGICIAN_UNKNOWN_WAVEDEV_DLL MAGICIAN_EGPIO(2, 2) | ||
146 | #define EGPIO_MAGICIAN_FLASH_VPP MAGICIAN_EGPIO(2, 3) | ||
147 | #define EGPIO_MAGICIAN_BL_POWER2 MAGICIAN_EGPIO(2, 4) | ||
148 | #define EGPIO_MAGICIAN_CHARGE_EN MAGICIAN_EGPIO(2, 5) | ||
149 | #define EGPIO_MAGICIAN_GSM_POWER MAGICIAN_EGPIO(2, 7) | ||
150 | |||
151 | /* input */ | ||
152 | |||
153 | #define EGPIO_MAGICIAN_CABLE_STATE_AC MAGICIAN_EGPIO(4, 0) | ||
154 | #define EGPIO_MAGICIAN_CABLE_STATE_USB MAGICIAN_EGPIO(4, 1) | ||
155 | |||
156 | #define EGPIO_MAGICIAN_BOARD_ID0 MAGICIAN_EGPIO(5, 0) | ||
157 | #define EGPIO_MAGICIAN_BOARD_ID1 MAGICIAN_EGPIO(5, 1) | ||
158 | #define EGPIO_MAGICIAN_BOARD_ID2 MAGICIAN_EGPIO(5, 2) | ||
159 | #define EGPIO_MAGICIAN_LCD_SELECT MAGICIAN_EGPIO(5, 3) | ||
160 | #define EGPIO_MAGICIAN_nSD_READONLY MAGICIAN_EGPIO(5, 4) | ||
161 | |||
162 | #define EGPIO_MAGICIAN_EP_INSERT MAGICIAN_EGPIO(6, 1) | ||
163 | |||
111 | #endif /* _MAGICIAN_H_ */ | 164 | #endif /* _MAGICIAN_H_ */ |