aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-pxa
diff options
context:
space:
mode:
authorMarek Vasut <marek.vasut@gmail.com>2010-07-26 17:24:44 -0400
committerEric Miao <eric.y.miao@gmail.com>2010-08-05 02:32:44 -0400
commitb0240bf4d4fac099e067c206234aed4528d70ca9 (patch)
treec091a006f45f549142d2c91ea7c010cbc3f138ed /arch/arm/mach-pxa
parent773108401d883a97dc624acf8c20f71e50a9a28a (diff)
[ARM] pxa/balloon3: Machine file cleanup
Logically separate parts of the file that are handled by one particular driver. Signed-off-by: Marek Vasut <marek.vasut@gmail.com>
Diffstat (limited to 'arch/arm/mach-pxa')
-rw-r--r--arch/arm/mach-pxa/balloon3.c225
1 files changed, 126 insertions, 99 deletions
diff --git a/arch/arm/mach-pxa/balloon3.c b/arch/arm/mach-pxa/balloon3.c
index f3b5ace815e5..8adb87a03674 100644
--- a/arch/arm/mach-pxa/balloon3.c
+++ b/arch/arm/mach-pxa/balloon3.c
@@ -51,87 +51,27 @@
51#include "generic.h" 51#include "generic.h"
52#include "devices.h" 52#include "devices.h"
53 53
54static unsigned long balloon3_irq_enabled; 54/******************************************************************************
55 55 * Pin configuration
56static unsigned long balloon3_features_present = 56 ******************************************************************************/
57 (1 << BALLOON3_FEATURE_OHCI) | (1 << BALLOON3_FEATURE_CF) | 57static unsigned long balloon3_pin_config[] __initdata = {
58 (1 << BALLOON3_FEATURE_AUDIO) | 58 /* Select BTUART 'COM1/ttyS0' as IO option for pins 42/43/44/45 */
59 (1 << BALLOON3_FEATURE_TOPPOLY); 59 GPIO42_BTUART_RXD,
60 60 GPIO43_BTUART_TXD,
61int balloon3_has(enum balloon3_features feature) 61 GPIO44_BTUART_CTS,
62{ 62 GPIO45_BTUART_RTS,
63 return (balloon3_features_present & (1 << feature)) ? 1 : 0;
64}
65EXPORT_SYMBOL_GPL(balloon3_has);
66
67int __init parse_balloon3_features(char *arg)
68{
69 if (!arg)
70 return 0;
71
72 return strict_strtoul(arg, 0, &balloon3_features_present);
73}
74early_param("balloon3_features", parse_balloon3_features);
75
76static void balloon3_mask_irq(unsigned int irq)
77{
78 int balloon3_irq = (irq - BALLOON3_IRQ(0));
79 balloon3_irq_enabled &= ~(1 << balloon3_irq);
80 __raw_writel(~balloon3_irq_enabled, BALLOON3_INT_CONTROL_REG);
81}
82 63
83static void balloon3_unmask_irq(unsigned int irq) 64 /* Wakeup GPIO */
84{ 65 GPIO1_GPIO | WAKEUP_ON_EDGE_BOTH,
85 int balloon3_irq = (irq - BALLOON3_IRQ(0));
86 balloon3_irq_enabled |= (1 << balloon3_irq);
87 __raw_writel(~balloon3_irq_enabled, BALLOON3_INT_CONTROL_REG);
88}
89 66
90static struct irq_chip balloon3_irq_chip = { 67 /* NAND & IDLE LED GPIOs */
91 .name = "FPGA", 68 GPIO9_GPIO,
92 .ack = balloon3_mask_irq, 69 GPIO10_GPIO,
93 .mask = balloon3_mask_irq,
94 .unmask = balloon3_unmask_irq,
95}; 70};
96 71
97static void balloon3_irq_handler(unsigned int irq, struct irq_desc *desc) 72/******************************************************************************
98{ 73 * Audio and Touchscreen
99 unsigned long pending = __raw_readl(BALLOON3_INT_CONTROL_REG) & 74 ******************************************************************************/
100 balloon3_irq_enabled;
101
102 do {
103 /* clear useless edge notification */
104 if (desc->chip->ack)
105 desc->chip->ack(BALLOON3_AUX_NIRQ);
106 while (pending) {
107 irq = BALLOON3_IRQ(0) + __ffs(pending);
108 generic_handle_irq(irq);
109 pending &= pending - 1;
110 }
111 pending = __raw_readl(BALLOON3_INT_CONTROL_REG) &
112 balloon3_irq_enabled;
113 } while (pending);
114}
115
116static void __init balloon3_init_irq(void)
117{
118 int irq;
119
120 pxa27x_init_irq();
121 /* setup extra Balloon3 irqs */
122 for (irq = BALLOON3_IRQ(0); irq <= BALLOON3_IRQ(7); irq++) {
123 set_irq_chip(irq, &balloon3_irq_chip);
124 set_irq_handler(irq, handle_level_irq);
125 set_irq_flags(irq, IRQF_VALID | IRQF_PROBE);
126 }
127
128 set_irq_chained_handler(BALLOON3_AUX_NIRQ, balloon3_irq_handler);
129 set_irq_type(BALLOON3_AUX_NIRQ, IRQ_TYPE_EDGE_FALLING);
130
131 pr_debug("%s: chained handler installed - irq %d automatically "
132 "enabled\n", __func__, BALLOON3_AUX_NIRQ);
133}
134
135static unsigned long balloon3_ac97_pin_config[] = { 75static unsigned long balloon3_ac97_pin_config[] = {
136 GPIO28_AC97_BITCLK, 76 GPIO28_AC97_BITCLK,
137 GPIO29_AC97_SDATA_IN_0, 77 GPIO29_AC97_SDATA_IN_0,
@@ -140,19 +80,16 @@ static unsigned long balloon3_ac97_pin_config[] = {
140 GPIO113_AC97_nRESET, 80 GPIO113_AC97_nRESET,
141}; 81};
142 82
83/******************************************************************************
84 * Framebuffer
85 ******************************************************************************/
86
143static void balloon3_backlight_power(int on) 87static void balloon3_backlight_power(int on)
144{ 88{
145 pr_debug("%s: power is %s\n", __func__, on ? "on" : "off"); 89 pr_debug("%s: power is %s\n", __func__, on ? "on" : "off");
146 gpio_set_value(BALLOON3_GPIO_RUN_BACKLIGHT, on); 90 gpio_set_value(BALLOON3_GPIO_RUN_BACKLIGHT, on);
147} 91}
148 92
149static unsigned long balloon3_lcd_pin_config[] = {
150 /* LCD - 16bpp Active TFT */
151 GPIOxx_LCD_TFT_16BPP,
152
153 GPIO99_GPIO, /* Backlight */
154};
155
156static struct pxafb_mode_info balloon3_lcd_modes[] = { 93static struct pxafb_mode_info balloon3_lcd_modes[] = {
157 { 94 {
158 .pixclock = 38000, 95 .pixclock = 38000,
@@ -176,6 +113,9 @@ static struct pxafb_mach_info balloon3_pxafb_info = {
176 .pxafb_backlight_power = balloon3_backlight_power, 113 .pxafb_backlight_power = balloon3_backlight_power,
177}; 114};
178 115
116/******************************************************************************
117 * SD/MMC card controller
118 ******************************************************************************/
179static unsigned long balloon3_mmc_pin_config[] = { 119static unsigned long balloon3_mmc_pin_config[] = {
180 GPIO32_MMC_CLK, 120 GPIO32_MMC_CLK,
181 GPIO92_MMC_DAT_0, 121 GPIO92_MMC_DAT_0,
@@ -203,6 +143,9 @@ static struct pxamci_platform_data balloon3_mci_platform_data = {
203 .setpower = balloon3_mci_setpower, 143 .setpower = balloon3_mci_setpower,
204}; 144};
205 145
146/******************************************************************************
147 * USB Gadget
148 ******************************************************************************/
206static int balloon3_udc_is_connected(void) 149static int balloon3_udc_is_connected(void)
207{ 150{
208 pr_debug("%s: udc connected\n", __func__); 151 pr_debug("%s: udc connected\n", __func__);
@@ -228,10 +171,16 @@ static struct pxa2xx_udc_mach_info balloon3_udc_info = {
228 .udc_command = balloon3_udc_command, 171 .udc_command = balloon3_udc_command,
229}; 172};
230 173
174/******************************************************************************
175 * IrDA
176 ******************************************************************************/
231static struct pxaficp_platform_data balloon3_ficp_platform_data = { 177static struct pxaficp_platform_data balloon3_ficp_platform_data = {
232 .transceiver_cap = IR_SIRMODE | IR_FIRMODE | IR_OFF, 178 .transceiver_cap = IR_SIRMODE | IR_FIRMODE | IR_OFF,
233}; 179};
234 180
181/******************************************************************************
182 * USB Host
183 ******************************************************************************/
235static unsigned long balloon3_ohci_pin_config[] = { 184static unsigned long balloon3_ohci_pin_config[] = {
236 GPIO88_USBH1_PWR, 185 GPIO88_USBH1_PWR,
237 GPIO89_USBH1_PEN, 186 GPIO89_USBH1_PEN,
@@ -242,21 +191,9 @@ static struct pxaohci_platform_data balloon3_ohci_platform_data = {
242 .flags = ENABLE_PORT_ALL | POWER_CONTROL_LOW | POWER_SENSE_LOW, 191 .flags = ENABLE_PORT_ALL | POWER_CONTROL_LOW | POWER_SENSE_LOW,
243}; 192};
244 193
245static unsigned long balloon3_pin_config[] __initdata = { 194/******************************************************************************
246 /* Select BTUART 'COM1/ttyS0' as IO option for pins 42/43/44/45 */ 195 * LED
247 GPIO42_BTUART_RXD, 196 ******************************************************************************/
248 GPIO43_BTUART_TXD,
249 GPIO44_BTUART_CTS,
250 GPIO45_BTUART_RTS,
251
252 /* Wakeup GPIO */
253 GPIO1_GPIO | WAKEUP_ON_EDGE_BOTH,
254
255 /* NAND & IDLE LED GPIOs */
256 GPIO9_GPIO,
257 GPIO10_GPIO,
258};
259
260static struct gpio_led balloon3_gpio_leds[] = { 197static struct gpio_led balloon3_gpio_leds[] = {
261 { 198 {
262 .name = "balloon3:green:idle", 199 .name = "balloon3:green:idle",
@@ -285,6 +222,96 @@ static struct platform_device balloon3led_device = {
285 }, 222 },
286}; 223};
287 224
225/******************************************************************************
226 * Compatibility: Parameter parsing
227 ******************************************************************************/
228static unsigned long balloon3_irq_enabled;
229
230static unsigned long balloon3_features_present =
231 (1 << BALLOON3_FEATURE_OHCI) | (1 << BALLOON3_FEATURE_CF) |
232 (1 << BALLOON3_FEATURE_AUDIO) |
233 (1 << BALLOON3_FEATURE_TOPPOLY);
234
235int balloon3_has(enum balloon3_features feature)
236{
237 return (balloon3_features_present & (1 << feature)) ? 1 : 0;
238}
239EXPORT_SYMBOL_GPL(balloon3_has);
240
241int __init parse_balloon3_features(char *arg)
242{
243 if (!arg)
244 return 0;
245
246 return strict_strtoul(arg, 0, &balloon3_features_present);
247}
248early_param("balloon3_features", parse_balloon3_features);
249
250/******************************************************************************
251 * FPGA IRQ
252 ******************************************************************************/
253static void balloon3_mask_irq(unsigned int irq)
254{
255 int balloon3_irq = (irq - BALLOON3_IRQ(0));
256 balloon3_irq_enabled &= ~(1 << balloon3_irq);
257 __raw_writel(~balloon3_irq_enabled, BALLOON3_INT_CONTROL_REG);
258}
259
260static void balloon3_unmask_irq(unsigned int irq)
261{
262 int balloon3_irq = (irq - BALLOON3_IRQ(0));
263 balloon3_irq_enabled |= (1 << balloon3_irq);
264 __raw_writel(~balloon3_irq_enabled, BALLOON3_INT_CONTROL_REG);
265}
266
267static struct irq_chip balloon3_irq_chip = {
268 .name = "FPGA",
269 .ack = balloon3_mask_irq,
270 .mask = balloon3_mask_irq,
271 .unmask = balloon3_unmask_irq,
272};
273
274static void balloon3_irq_handler(unsigned int irq, struct irq_desc *desc)
275{
276 unsigned long pending = __raw_readl(BALLOON3_INT_CONTROL_REG) &
277 balloon3_irq_enabled;
278
279 do {
280 /* clear useless edge notification */
281 if (desc->chip->ack)
282 desc->chip->ack(BALLOON3_AUX_NIRQ);
283 while (pending) {
284 irq = BALLOON3_IRQ(0) + __ffs(pending);
285 generic_handle_irq(irq);
286 pending &= pending - 1;
287 }
288 pending = __raw_readl(BALLOON3_INT_CONTROL_REG) &
289 balloon3_irq_enabled;
290 } while (pending);
291}
292
293static void __init balloon3_init_irq(void)
294{
295 int irq;
296
297 pxa27x_init_irq();
298 /* setup extra Balloon3 irqs */
299 for (irq = BALLOON3_IRQ(0); irq <= BALLOON3_IRQ(7); irq++) {
300 set_irq_chip(irq, &balloon3_irq_chip);
301 set_irq_handler(irq, handle_level_irq);
302 set_irq_flags(irq, IRQF_VALID | IRQF_PROBE);
303 }
304
305 set_irq_chained_handler(BALLOON3_AUX_NIRQ, balloon3_irq_handler);
306 set_irq_type(BALLOON3_AUX_NIRQ, IRQ_TYPE_EDGE_FALLING);
307
308 pr_debug("%s: chained handler installed - irq %d automatically "
309 "enabled\n", __func__, BALLOON3_AUX_NIRQ);
310}
311
312/******************************************************************************
313 * Machine init
314 ******************************************************************************/
288static void __init balloon3_init(void) 315static void __init balloon3_init(void)
289{ 316{
290 pr_info("Initialising Balloon3\n"); 317 pr_info("Initialising Balloon3\n");