aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-sa1100
diff options
context:
space:
mode:
Diffstat (limited to 'arch/arm/mach-sa1100')
-rw-r--r--arch/arm/mach-sa1100/h3600.c87
1 files changed, 81 insertions, 6 deletions
diff --git a/arch/arm/mach-sa1100/h3600.c b/arch/arm/mach-sa1100/h3600.c
index 429fdb051a35..5e6011ce36ee 100644
--- a/arch/arm/mach-sa1100/h3600.c
+++ b/arch/arm/mach-sa1100/h3600.c
@@ -111,12 +111,32 @@ static struct mtd_partition h3xxx_partitions[] = {
111 111
112static void h3xxx_set_vpp(int vpp) 112static void h3xxx_set_vpp(int vpp)
113{ 113{
114 assign_h3600_egpio(IPAQ_EGPIO_VPP_ON, vpp); 114 gpio_set_value(H3XXX_EGPIO_VPP_ON, vpp);
115}
116
117static int h3xxx_flash_init(void)
118{
119 int err = gpio_request(H3XXX_EGPIO_VPP_ON, "Flash Vpp");
120 if (err)
121 return err;
122
123 err = gpio_direction_output(H3XXX_EGPIO_VPP_ON, 0);
124 if (err)
125 gpio_free(H3XXX_EGPIO_VPP_ON);
126
127 return err;
128}
129
130static void h3xxx_flash_exit(void)
131{
132 gpio_free(H3XXX_EGPIO_VPP_ON);
115} 133}
116 134
117static struct flash_platform_data h3xxx_flash_data = { 135static struct flash_platform_data h3xxx_flash_data = {
118 .map_name = "cfi_probe", 136 .map_name = "cfi_probe",
119 .set_vpp = h3xxx_set_vpp, 137 .set_vpp = h3xxx_set_vpp,
138 .init = h3xxx_flash_init,
139 .exit = h3xxx_flash_exit,
120 .parts = h3xxx_partitions, 140 .parts = h3xxx_partitions,
121 .nr_parts = ARRAY_SIZE(h3xxx_partitions), 141 .nr_parts = ARRAY_SIZE(h3xxx_partitions),
122}; 142};
@@ -158,7 +178,10 @@ static u_int h3xxx_uart_get_mctrl(struct uart_port *port)
158static void h3xxx_uart_pm(struct uart_port *port, u_int state, u_int oldstate) 178static void h3xxx_uart_pm(struct uart_port *port, u_int state, u_int oldstate)
159{ 179{
160 if (port->mapbase == _Ser3UTCR0) 180 if (port->mapbase == _Ser3UTCR0)
161 assign_h3600_egpio(IPAQ_EGPIO_RS232_ON, !state); 181 if (!gpio_request(H3XXX_EGPIO_RS232_ON, "RS232 transceiver")) {
182 gpio_direction_output(H3XXX_EGPIO_RS232_ON, !state);
183 gpio_free(H3XXX_EGPIO_RS232_ON);
184 }
162} 185}
163 186
164/* 187/*
@@ -362,7 +385,11 @@ static void h3100_control_egpio(enum ipaq_egpio_type x, int setp)
362 */ 385 */
363static void h3100_lcd_power(int enable) 386static void h3100_lcd_power(int enable)
364{ 387{
365 assign_h3600_egpio(IPAQ_EGPIO_LCD_POWER, enable); 388 if (!gpio_request(H3XXX_EGPIO_LCD_ON, "LCD ON")) {
389 gpio_set_value(H3100_GPIO_LCD_3V_ON, enable);
390 gpio_direction_output(H3XXX_EGPIO_LCD_ON, enable);
391 gpio_free(H3XXX_EGPIO_LCD_ON);
392 }
366} 393}
367 394
368 395
@@ -412,6 +439,7 @@ static struct gpio_default_state h3100_default_gpio[] = {
412 { H3XXX_GPIO_COM_DCD, GPIO_MODE_IN, "COM DCD" }, 439 { H3XXX_GPIO_COM_DCD, GPIO_MODE_IN, "COM DCD" },
413 { H3XXX_GPIO_COM_CTS, GPIO_MODE_IN, "COM CTS" }, 440 { H3XXX_GPIO_COM_CTS, GPIO_MODE_IN, "COM CTS" },
414 { H3XXX_GPIO_COM_RTS, GPIO_MODE_OUT0, "COM RTS" }, 441 { H3XXX_GPIO_COM_RTS, GPIO_MODE_OUT0, "COM RTS" },
442 { H3100_GPIO_LCD_3V_ON, GPIO_MODE_OUT0, "LCD 3v" },
415}; 443};
416 444
417static void __init h3100_mach_init(void) 445static void __init h3100_mach_init(void)
@@ -506,7 +534,25 @@ static void h3600_control_egpio(enum ipaq_egpio_type x, int setp)
506 */ 534 */
507static void h3600_lcd_power(int enable) 535static void h3600_lcd_power(int enable)
508{ 536{
509 assign_h3600_egpio(IPAQ_EGPIO_LCD_POWER, enable); 537 if (gpio_request(H3XXX_EGPIO_LCD_ON, "LCD power"))
538 goto err1;
539 if (gpio_request(H3600_EGPIO_LCD_PCI, "LCD control"))
540 goto err2;
541 if (gpio_request(H3600_EGPIO_LCD_5V_ON, "LCD 5v"))
542 goto err3;
543 if (gpio_request(H3600_EGPIO_LVDD_ON, "LCD 9v/-6.5v"))
544 goto err4;
545
546 gpio_direction_output(H3XXX_EGPIO_LCD_ON, enable);
547 gpio_direction_output(H3600_EGPIO_LCD_PCI, enable);
548 gpio_direction_output(H3600_EGPIO_LCD_5V_ON, enable);
549 gpio_direction_output(H3600_EGPIO_LVDD_ON, enable);
550
551 gpio_free(H3600_EGPIO_LVDD_ON);
552err4: gpio_free(H3600_EGPIO_LCD_5V_ON);
553err3: gpio_free(H3600_EGPIO_LCD_PCI);
554err2: gpio_free(H3XXX_EGPIO_LCD_ON);
555err1: return;
510} 556}
511 557
512static void __init h3600_map_io(void) 558static void __init h3600_map_io(void)
@@ -531,18 +577,47 @@ static void __init h3600_map_io(void)
531 */ 577 */
532static int h3600_irda_set_power(struct device *dev, unsigned int state) 578static int h3600_irda_set_power(struct device *dev, unsigned int state)
533{ 579{
534 assign_h3600_egpio(IPAQ_EGPIO_IR_ON, state); 580 gpio_set_value(H3600_EGPIO_IR_ON, state);
535 return 0; 581 return 0;
536} 582}
537 583
538static void h3600_irda_set_speed(struct device *dev, unsigned int speed) 584static void h3600_irda_set_speed(struct device *dev, unsigned int speed)
539{ 585{
540 assign_h3600_egpio(IPAQ_EGPIO_IR_FSEL, !(speed < 4000000)); 586 gpio_set_value(H3600_EGPIO_IR_FSEL, !(speed < 4000000));
587}
588
589static int h3600_irda_startup(struct device *dev)
590{
591 int err = gpio_request(H3600_EGPIO_IR_ON, "IrDA power");
592 if (err)
593 goto err1;
594 err = gpio_direction_output(H3600_EGPIO_IR_ON, 0);
595 if (err)
596 goto err2;
597 err = gpio_request(H3600_EGPIO_IR_FSEL, "IrDA fsel");
598 if (err)
599 goto err2;
600 err = gpio_direction_output(H3600_EGPIO_IR_FSEL, 0);
601 if (err)
602 goto err3;
603 return 0;
604
605err3: gpio_free(H3600_EGPIO_IR_FSEL);
606err2: gpio_free(H3600_EGPIO_IR_ON);
607err1: return err;
608}
609
610static void h3600_irda_shutdown(struct device *dev)
611{
612 gpio_free(H3600_EGPIO_IR_ON);
613 gpio_free(H3600_EGPIO_IR_FSEL);
541} 614}
542 615
543static struct irda_platform_data h3600_irda_data = { 616static struct irda_platform_data h3600_irda_data = {
544 .set_power = h3600_irda_set_power, 617 .set_power = h3600_irda_set_power,
545 .set_speed = h3600_irda_set_speed, 618 .set_speed = h3600_irda_set_speed,
619 .startup = h3600_irda_startup,
620 .shutdown = h3600_irda_shutdown,
546}; 621};
547 622
548static struct gpio_default_state h3600_default_gpio[] = { 623static struct gpio_default_state h3600_default_gpio[] = {