aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-pxa
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2011-07-25 15:38:42 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2011-07-25 15:38:42 -0400
commitae4c42e4e4d76d003f8ca551fe1aef93ff9a4b21 (patch)
tree2bff2e4f4456077e7d7c589c8c28824f12dfa21c /arch/arm/mach-pxa
parentdd58ecba48edf14be1a5f70120fcd3002277a74a (diff)
parentab2a0e0d135490729e384c1826d118f92e88cae8 (diff)
Merge branch 'next/cleanup' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/linux-arm-soc
* 'next/cleanup' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/linux-arm-soc: (133 commits) ARM: EXYNOS4: Change devname for FIMD clkdev ARM: S3C64XX: Cleanup mach/regs-fb.h from mach-s3c64xx ARM: S5PV210: Cleanup mach/regs-fb.h from mach-s5pv210 ARM: S5PC100: Cleanup mach/regs-fb.h from mach-s5pc100 ARM: S3C24XX: Use generic s3c_set_platdata for devices ARM: S3C64XX: Use generic s3c_set_platdata for OneNAND ARM: SAMSUNG: Use generic s3c_set_platdata for NAND ARM: SAMSUNG: Use generic s3c_set_platdata for USB OHCI ARM: SAMSUNG: Use generic s3c_set_platdata for HWMON ARM: SAMSUNG: Use generic s3c_set_platdata for FB ARM: SAMSUNG: Use generic s3c_set_platdata for TS ARM: S3C64XX: Add PWM backlight support on SMDK6410 ARM: S5P64X0: Add PWM backlight support on SMDK6450 ARM: S5P64X0: Add PWM backlight support on SMDK6440 ARM: S5PC100: Add PWM backlight support on SMDKC100 ARM: S5PV210: Add PWM backlight support on SMDKV210 ARM: EXYNOS4: Add PWM backlight support on SMDKC210 ARM: EXYNOS4: Add PWM backlight support on SMDKV310 ARM: SAMSUNG: Create a common infrastructure for PWM backlight support clocksource: convert 32-bit down counting clocksource on S5PV210/S5P64X0 ... Fix up trivial conflict in arch/arm/mach-imx/mach-scb9328.c
Diffstat (limited to 'arch/arm/mach-pxa')
-rw-r--r--arch/arm/mach-pxa/cm-x300.c58
-rw-r--r--arch/arm/mach-pxa/hx4700.c70
-rw-r--r--arch/arm/mach-pxa/include/mach/magician.h3
-rw-r--r--arch/arm/mach-pxa/magician.c57
-rw-r--r--arch/arm/mach-pxa/mioa701.c70
-rw-r--r--arch/arm/mach-pxa/saarb.c2
6 files changed, 87 insertions, 173 deletions
diff --git a/arch/arm/mach-pxa/cm-x300.c b/arch/arm/mach-pxa/cm-x300.c
index b2248e76ec8b..b199596f9c3d 100644
--- a/arch/arm/mach-pxa/cm-x300.c
+++ b/arch/arm/mach-pxa/cm-x300.c
@@ -12,6 +12,7 @@
12 * it under the terms of the GNU General Public License version 2 as 12 * it under the terms of the GNU General Public License version 2 as
13 * published by the Free Software Foundation. 13 * published by the Free Software Foundation.
14 */ 14 */
15#define pr_fmt(fmt) "%s: " fmt, __func__
15 16
16#include <linux/module.h> 17#include <linux/module.h>
17#include <linux/kernel.h> 18#include <linux/kernel.h>
@@ -161,10 +162,10 @@ static mfp_cfg_t cm_x3xx_mfp_cfg[] __initdata = {
161 GPIO99_GPIO, /* Ethernet IRQ */ 162 GPIO99_GPIO, /* Ethernet IRQ */
162 163
163 /* RTC GPIOs */ 164 /* RTC GPIOs */
164 GPIO95_GPIO, /* RTC CS */ 165 GPIO95_GPIO | MFP_LPM_DRIVE_HIGH, /* RTC CS */
165 GPIO96_GPIO, /* RTC WR */ 166 GPIO96_GPIO | MFP_LPM_DRIVE_HIGH, /* RTC WR */
166 GPIO97_GPIO, /* RTC RD */ 167 GPIO97_GPIO | MFP_LPM_DRIVE_HIGH, /* RTC RD */
167 GPIO98_GPIO, /* RTC IO */ 168 GPIO98_GPIO, /* RTC IO */
168 169
169 /* Standard I2C */ 170 /* Standard I2C */
170 GPIO21_I2C_SCL, 171 GPIO21_I2C_SCL,
@@ -484,14 +485,13 @@ static int cm_x300_ulpi_phy_reset(void)
484 int err; 485 int err;
485 486
486 /* reset the PHY */ 487 /* reset the PHY */
487 err = gpio_request(GPIO_ULPI_PHY_RST, "ulpi reset"); 488 err = gpio_request_one(GPIO_ULPI_PHY_RST, GPIOF_OUT_INIT_LOW,
489 "ulpi reset");
488 if (err) { 490 if (err) {
489 pr_err("%s: failed to request ULPI reset GPIO: %d\n", 491 pr_err("failed to request ULPI reset GPIO: %d\n", err);
490 __func__, err);
491 return err; 492 return err;
492 } 493 }
493 494
494 gpio_direction_output(GPIO_ULPI_PHY_RST, 0);
495 msleep(10); 495 msleep(10);
496 gpio_set_value(GPIO_ULPI_PHY_RST, 1); 496 gpio_set_value(GPIO_ULPI_PHY_RST, 1);
497 msleep(10); 497 msleep(10);
@@ -510,8 +510,7 @@ static inline int cm_x300_u2d_init(struct device *dev)
510 pout_clk = clk_get(NULL, "CLK_POUT"); 510 pout_clk = clk_get(NULL, "CLK_POUT");
511 if (IS_ERR(pout_clk)) { 511 if (IS_ERR(pout_clk)) {
512 err = PTR_ERR(pout_clk); 512 err = PTR_ERR(pout_clk);
513 pr_err("%s: failed to get CLK_POUT: %d\n", 513 pr_err("failed to get CLK_POUT: %d\n", err);
514 __func__, err);
515 return err; 514 return err;
516 } 515 }
517 clk_enable(pout_clk); 516 clk_enable(pout_clk);
@@ -768,39 +767,36 @@ static void __init cm_x300_init_da9030(void)
768 irq_set_irq_wake(IRQ_WAKEUP0, 1); 767 irq_set_irq_wake(IRQ_WAKEUP0, 1);
769} 768}
770 769
770/* wi2wi gpio setting for system_rev >= 130 */
771static struct gpio cm_x300_wi2wi_gpios[] __initdata = {
772 { 71, GPIOF_OUT_INIT_HIGH, "wlan en" },
773 { 70, GPIOF_OUT_INIT_HIGH, "bt reset" },
774};
775
771static void __init cm_x300_init_wi2wi(void) 776static void __init cm_x300_init_wi2wi(void)
772{ 777{
773 int bt_reset, wlan_en; 778 int bt_reset, wlan_en;
774 int err; 779 int err;
775 780
776 if (system_rev < 130) { 781 if (system_rev < 130) {
777 wlan_en = 77; 782 cm_x300_wi2wi_gpios[0].gpio = 77; /* wlan en */
778 bt_reset = 78; 783 cm_x300_wi2wi_gpios[1].gpio = 78; /* bt reset */
779 } else {
780 wlan_en = 71;
781 bt_reset = 70;
782 } 784 }
783 785
784 /* Libertas and CSR reset */ 786 /* Libertas and CSR reset */
785 err = gpio_request(wlan_en, "wlan en"); 787 err = gpio_request_array(ARRAY_AND_SIZE(cm_x300_wi2wi_gpios));
786 if (err) { 788 if (err) {
787 pr_err("CM-X300: failed to request wlan en gpio: %d\n", err); 789 pr_err("failed to request wifi/bt gpios: %d\n", err);
788 } else { 790 return;
789 gpio_direction_output(wlan_en, 1);
790 gpio_free(wlan_en);
791 } 791 }
792 792
793 err = gpio_request(bt_reset, "bt reset"); 793 udelay(10);
794 if (err) { 794 gpio_set_value(bt_reset, 0);
795 pr_err("CM-X300: failed to request bt reset gpio: %d\n", err); 795 udelay(10);
796 } else { 796 gpio_set_value(bt_reset, 1);
797 gpio_direction_output(bt_reset, 1); 797
798 udelay(10); 798 gpio_free(wlan_en);
799 gpio_set_value(bt_reset, 0); 799 gpio_free(bt_reset);
800 udelay(10);
801 gpio_set_value(bt_reset, 1);
802 gpio_free(bt_reset);
803 }
804} 800}
805 801
806/* MFP */ 802/* MFP */
diff --git a/arch/arm/mach-pxa/hx4700.c b/arch/arm/mach-pxa/hx4700.c
index f941a495a4a8..99960a1814e0 100644
--- a/arch/arm/mach-pxa/hx4700.c
+++ b/arch/arm/mach-pxa/hx4700.c
@@ -135,42 +135,6 @@ static unsigned long hx4700_pin_config[] __initdata = {
135 GPIO66_GPIO, /* nSDIO_IRQ */ 135 GPIO66_GPIO, /* nSDIO_IRQ */
136}; 136};
137 137
138#define HX4700_GPIO_IN(num, _desc) \
139 { .gpio = (num), .dir = 0, .desc = (_desc) }
140#define HX4700_GPIO_OUT(num, _init, _desc) \
141 { .gpio = (num), .dir = 1, .init = (_init), .desc = (_desc) }
142struct gpio_ress {
143 unsigned gpio : 8;
144 unsigned dir : 1;
145 unsigned init : 1;
146 char *desc;
147};
148
149static int hx4700_gpio_request(struct gpio_ress *gpios, int size)
150{
151 int i, rc = 0;
152 int gpio;
153 int dir;
154
155 for (i = 0; (!rc) && (i < size); i++) {
156 gpio = gpios[i].gpio;
157 dir = gpios[i].dir;
158 rc = gpio_request(gpio, gpios[i].desc);
159 if (rc) {
160 pr_err("Error requesting GPIO %d(%s) : %d\n",
161 gpio, gpios[i].desc, rc);
162 continue;
163 }
164 if (dir)
165 gpio_direction_output(gpio, gpios[i].init);
166 else
167 gpio_direction_input(gpio);
168 }
169 while ((rc) && (--i >= 0))
170 gpio_free(gpios[i].gpio);
171 return rc;
172}
173
174/* 138/*
175 * IRDA 139 * IRDA
176 */ 140 */
@@ -829,26 +793,30 @@ static struct platform_device *devices[] __initdata = {
829 &pcmcia, 793 &pcmcia,
830}; 794};
831 795
832static struct gpio_ress global_gpios[] = { 796static struct gpio global_gpios[] = {
833 HX4700_GPIO_IN(GPIO12_HX4700_ASIC3_IRQ, "ASIC3_IRQ"), 797 { GPIO12_HX4700_ASIC3_IRQ, GPIOF_IN, "ASIC3_IRQ" },
834 HX4700_GPIO_IN(GPIO13_HX4700_W3220_IRQ, "W3220_IRQ"), 798 { GPIO13_HX4700_W3220_IRQ, GPIOF_IN, "W3220_IRQ" },
835 HX4700_GPIO_IN(GPIO14_HX4700_nWLAN_IRQ, "WLAN_IRQ"), 799 { GPIO14_HX4700_nWLAN_IRQ, GPIOF_IN, "WLAN_IRQ" },
836 HX4700_GPIO_OUT(GPIO59_HX4700_LCD_PC1, 1, "LCD_PC1"), 800 { GPIO59_HX4700_LCD_PC1, GPIOF_OUT_INIT_HIGH, "LCD_PC1" },
837 HX4700_GPIO_OUT(GPIO62_HX4700_LCD_nRESET, 1, "LCD_RESET"), 801 { GPIO62_HX4700_LCD_nRESET, GPIOF_OUT_INIT_HIGH, "LCD_RESET" },
838 HX4700_GPIO_OUT(GPIO70_HX4700_LCD_SLIN1, 1, "LCD_SLIN1"), 802 { GPIO70_HX4700_LCD_SLIN1, GPIOF_OUT_INIT_HIGH, "LCD_SLIN1" },
839 HX4700_GPIO_OUT(GPIO84_HX4700_LCD_SQN, 1, "LCD_SQN"), 803 { GPIO84_HX4700_LCD_SQN, GPIOF_OUT_INIT_HIGH, "LCD_SQN" },
840 HX4700_GPIO_OUT(GPIO110_HX4700_LCD_LVDD_3V3_ON, 1, "LCD_LVDD"), 804 { GPIO110_HX4700_LCD_LVDD_3V3_ON, GPIOF_OUT_INIT_HIGH, "LCD_LVDD" },
841 HX4700_GPIO_OUT(GPIO111_HX4700_LCD_AVDD_3V3_ON, 1, "LCD_AVDD"), 805 { GPIO111_HX4700_LCD_AVDD_3V3_ON, GPIOF_OUT_INIT_HIGH, "LCD_AVDD" },
842 HX4700_GPIO_OUT(GPIO32_HX4700_RS232_ON, 1, "RS232_ON"), 806 { GPIO32_HX4700_RS232_ON, GPIOF_OUT_INIT_HIGH, "RS232_ON" },
843 HX4700_GPIO_OUT(GPIO71_HX4700_ASIC3_nRESET, 1, "ASIC3_nRESET"), 807 { GPIO71_HX4700_ASIC3_nRESET, GPIOF_OUT_INIT_HIGH, "ASIC3_nRESET" },
844 HX4700_GPIO_OUT(GPIO82_HX4700_EUART_RESET, 1, "EUART_RESET"), 808 { GPIO82_HX4700_EUART_RESET, GPIOF_OUT_INIT_HIGH, "EUART_RESET" },
845 HX4700_GPIO_OUT(GPIO105_HX4700_nIR_ON, 1, "nIR_EN"), 809 { GPIO105_HX4700_nIR_ON, GPIOF_OUT_INIT_HIGH, "nIR_EN" },
846}; 810};
847 811
848static void __init hx4700_init(void) 812static void __init hx4700_init(void)
849{ 813{
814 int ret;
815
850 pxa2xx_mfp_config(ARRAY_AND_SIZE(hx4700_pin_config)); 816 pxa2xx_mfp_config(ARRAY_AND_SIZE(hx4700_pin_config));
851 hx4700_gpio_request(ARRAY_AND_SIZE(global_gpios)); 817 ret = gpio_request_array(ARRAY_AND_SIZE(global_gpios));
818 if (ret)
819 pr_err ("hx4700: Failed to request GPIOs.\n");
852 820
853 pxa_set_ffuart_info(NULL); 821 pxa_set_ffuart_info(NULL);
854 pxa_set_btuart_info(NULL); 822 pxa_set_btuart_info(NULL);
diff --git a/arch/arm/mach-pxa/include/mach/magician.h b/arch/arm/mach-pxa/include/mach/magician.h
index 0a2efcf7947c..7cbfc5d3f9df 100644
--- a/arch/arm/mach-pxa/include/mach/magician.h
+++ b/arch/arm/mach-pxa/include/mach/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 <linux/gpio.h>
15#include <mach/irqs.h> 16#include <mach/irqs.h>
16 17
17/* 18/*
@@ -77,7 +78,7 @@
77 * CPLD EGPIOs 78 * CPLD EGPIOs
78 */ 79 */
79 80
80#define MAGICIAN_EGPIO_BASE 0x80 /* GPIO_BOARD_START */ 81#define MAGICIAN_EGPIO_BASE NR_BUILTIN_GPIO
81#define MAGICIAN_EGPIO(reg,bit) \ 82#define MAGICIAN_EGPIO(reg,bit) \
82 (MAGICIAN_EGPIO_BASE + 8*reg + bit) 83 (MAGICIAN_EGPIO_BASE + 8*reg + bit)
83 84
diff --git a/arch/arm/mach-pxa/magician.c b/arch/arm/mach-pxa/magician.c
index e1920572948a..0e42798942f7 100644
--- a/arch/arm/mach-pxa/magician.c
+++ b/arch/arm/mach-pxa/magician.c
@@ -344,22 +344,14 @@ static struct pxafb_mach_info samsung_info = {
344 * Backlight 344 * Backlight
345 */ 345 */
346 346
347static struct gpio magician_bl_gpios[] = {
348 { EGPIO_MAGICIAN_BL_POWER, GPIOF_DIR_OUT, "Backlight power" },
349 { EGPIO_MAGICIAN_BL_POWER2, GPIOF_DIR_OUT, "Backlight power 2" },
350};
351
347static int magician_backlight_init(struct device *dev) 352static int magician_backlight_init(struct device *dev)
348{ 353{
349 int ret; 354 return gpio_request_array(ARRAY_AND_SIZE(magician_bl_gpios));
350
351 ret = gpio_request(EGPIO_MAGICIAN_BL_POWER, "BL_POWER");
352 if (ret)
353 goto err;
354 ret = gpio_request(EGPIO_MAGICIAN_BL_POWER2, "BL_POWER2");
355 if (ret)
356 goto err2;
357 return 0;
358
359err2:
360 gpio_free(EGPIO_MAGICIAN_BL_POWER);
361err:
362 return ret;
363} 355}
364 356
365static int magician_backlight_notify(struct device *dev, int brightness) 357static int magician_backlight_notify(struct device *dev, int brightness)
@@ -376,8 +368,7 @@ static int magician_backlight_notify(struct device *dev, int brightness)
376 368
377static void magician_backlight_exit(struct device *dev) 369static void magician_backlight_exit(struct device *dev)
378{ 370{
379 gpio_free(EGPIO_MAGICIAN_BL_POWER); 371 gpio_free_array(ARRAY_AND_SIZE(magician_bl_gpios));
380 gpio_free(EGPIO_MAGICIAN_BL_POWER2);
381} 372}
382 373
383static struct platform_pwm_backlight_data backlight_data = { 374static struct platform_pwm_backlight_data backlight_data = {
@@ -712,16 +703,25 @@ static struct platform_device *devices[] __initdata = {
712 &leds_gpio, 703 &leds_gpio,
713}; 704};
714 705
706static struct gpio magician_global_gpios[] = {
707 { GPIO13_MAGICIAN_CPLD_IRQ, GPIOF_IN, "CPLD_IRQ" },
708 { GPIO107_MAGICIAN_DS1WM_IRQ, GPIOF_IN, "DS1WM_IRQ" },
709 { GPIO104_MAGICIAN_LCD_POWER_1, GPIOF_OUT_INIT_LOW, "LCD power 1" },
710 { GPIO105_MAGICIAN_LCD_POWER_2, GPIOF_OUT_INIT_LOW, "LCD power 2" },
711 { GPIO106_MAGICIAN_LCD_POWER_3, GPIOF_OUT_INIT_LOW, "LCD power 3" },
712 { GPIO83_MAGICIAN_nIR_EN, GPIOF_OUT_INIT_HIGH, "nIR_EN" },
713};
714
715static void __init magician_init(void) 715static void __init magician_init(void)
716{ 716{
717 void __iomem *cpld; 717 void __iomem *cpld;
718 int lcd_select; 718 int lcd_select;
719 int err; 719 int err;
720 720
721 gpio_request(GPIO13_MAGICIAN_CPLD_IRQ, "CPLD_IRQ");
722 gpio_request(GPIO107_MAGICIAN_DS1WM_IRQ, "DS1WM_IRQ");
723
724 pxa2xx_mfp_config(ARRAY_AND_SIZE(magician_pin_config)); 721 pxa2xx_mfp_config(ARRAY_AND_SIZE(magician_pin_config));
722 err = gpio_request_array(ARRAY_AND_SIZE(magician_global_gpios));
723 if (err)
724 pr_err("magician: Failed to request GPIOs: %d\n", err);
725 725
726 pxa_set_ffuart_info(NULL); 726 pxa_set_ffuart_info(NULL);
727 pxa_set_btuart_info(NULL); 727 pxa_set_btuart_info(NULL);
@@ -729,11 +729,7 @@ static void __init magician_init(void)
729 729
730 platform_add_devices(ARRAY_AND_SIZE(devices)); 730 platform_add_devices(ARRAY_AND_SIZE(devices));
731 731
732 err = gpio_request(GPIO83_MAGICIAN_nIR_EN, "nIR_EN"); 732 pxa_set_ficp_info(&magician_ficp_info);
733 if (!err) {
734 gpio_direction_output(GPIO83_MAGICIAN_nIR_EN, 1);
735 pxa_set_ficp_info(&magician_ficp_info);
736 }
737 pxa27x_set_i2c_power_info(NULL); 733 pxa27x_set_i2c_power_info(NULL);
738 pxa_set_i2c_info(&i2c_info); 734 pxa_set_i2c_info(&i2c_info);
739 pxa_set_mci_info(&magician_mci_info); 735 pxa_set_mci_info(&magician_mci_info);
@@ -747,16 +743,9 @@ static void __init magician_init(void)
747 system_rev = board_id & 0x7; 743 system_rev = board_id & 0x7;
748 lcd_select = board_id & 0x8; 744 lcd_select = board_id & 0x8;
749 pr_info("LCD type: %s\n", lcd_select ? "Samsung" : "Toppoly"); 745 pr_info("LCD type: %s\n", lcd_select ? "Samsung" : "Toppoly");
750 if (lcd_select && (system_rev < 3)) { 746 if (lcd_select && (system_rev < 3))
751 gpio_request(GPIO75_MAGICIAN_SAMSUNG_POWER, "SAMSUNG_POWER"); 747 gpio_request_one(GPIO75_MAGICIAN_SAMSUNG_POWER,
752 gpio_direction_output(GPIO75_MAGICIAN_SAMSUNG_POWER, 0); 748 GPIOF_OUT_INIT_LOW, "SAMSUNG_POWER");
753 }
754 gpio_request(GPIO104_MAGICIAN_LCD_POWER_1, "LCD_POWER_1");
755 gpio_request(GPIO105_MAGICIAN_LCD_POWER_2, "LCD_POWER_2");
756 gpio_request(GPIO106_MAGICIAN_LCD_POWER_3, "LCD_POWER_3");
757 gpio_direction_output(GPIO104_MAGICIAN_LCD_POWER_1, 0);
758 gpio_direction_output(GPIO105_MAGICIAN_LCD_POWER_2, 0);
759 gpio_direction_output(GPIO106_MAGICIAN_LCD_POWER_3, 0);
760 pxa_set_fb_info(NULL, lcd_select ? &samsung_info : &toppoly_info); 749 pxa_set_fb_info(NULL, lcd_select ? &samsung_info : &toppoly_info);
761 } else 750 } else
762 pr_err("LCD detection: CPLD mapping failed\n"); 751 pr_err("LCD detection: CPLD mapping failed\n");
diff --git a/arch/arm/mach-pxa/mioa701.c b/arch/arm/mach-pxa/mioa701.c
index e3470137c934..aa67637ae41d 100644
--- a/arch/arm/mach-pxa/mioa701.c
+++ b/arch/arm/mach-pxa/mioa701.c
@@ -177,50 +177,6 @@ static unsigned long mioa701_pin_config[] = {
177 MFP_CFG_OUT(GPIO116, AF0, DRIVE_HIGH), 177 MFP_CFG_OUT(GPIO116, AF0, DRIVE_HIGH),
178}; 178};
179 179
180#define MIO_GPIO_IN(num, _desc) \
181 { .gpio = (num), .dir = 0, .desc = (_desc) }
182#define MIO_GPIO_OUT(num, _init, _desc) \
183 { .gpio = (num), .dir = 1, .init = (_init), .desc = (_desc) }
184struct gpio_ress {
185 unsigned gpio : 8;
186 unsigned dir : 1;
187 unsigned init : 1;
188 char *desc;
189};
190
191static int mio_gpio_request(struct gpio_ress *gpios, int size)
192{
193 int i, rc = 0;
194 int gpio;
195 int dir;
196
197 for (i = 0; (!rc) && (i < size); i++) {
198 gpio = gpios[i].gpio;
199 dir = gpios[i].dir;
200 rc = gpio_request(gpio, gpios[i].desc);
201 if (rc) {
202 printk(KERN_ERR "Error requesting GPIO %d(%s) : %d\n",
203 gpio, gpios[i].desc, rc);
204 continue;
205 }
206 if (dir)
207 gpio_direction_output(gpio, gpios[i].init);
208 else
209 gpio_direction_input(gpio);
210 }
211 while ((rc) && (--i >= 0))
212 gpio_free(gpios[i].gpio);
213 return rc;
214}
215
216static void mio_gpio_free(struct gpio_ress *gpios, int size)
217{
218 int i;
219
220 for (i = 0; i < size; i++)
221 gpio_free(gpios[i].gpio);
222}
223
224/* LCD Screen and Backlight */ 180/* LCD Screen and Backlight */
225static struct platform_pwm_backlight_data mioa701_backlight_data = { 181static struct platform_pwm_backlight_data mioa701_backlight_data = {
226 .pwm_id = 0, 182 .pwm_id = 0,
@@ -346,16 +302,16 @@ irqreturn_t gsm_on_irq(int irq, void *p)
346 return IRQ_HANDLED; 302 return IRQ_HANDLED;
347} 303}
348 304
349struct gpio_ress gsm_gpios[] = { 305static struct gpio gsm_gpios[] = {
350 MIO_GPIO_IN(GPIO25_GSM_MOD_ON_STATE, "GSM state"), 306 { GPIO25_GSM_MOD_ON_STATE, GPIOF_IN, "GSM state" },
351 MIO_GPIO_IN(GPIO113_GSM_EVENT, "GSM event"), 307 { GPIO113_GSM_EVENT, GPIOF_IN, "GSM event" },
352}; 308};
353 309
354static int __init gsm_init(void) 310static int __init gsm_init(void)
355{ 311{
356 int rc; 312 int rc;
357 313
358 rc = mio_gpio_request(ARRAY_AND_SIZE(gsm_gpios)); 314 rc = gpio_request_array(ARRAY_AND_SIZE(gsm_gpios));
359 if (rc) 315 if (rc)
360 goto err_gpio; 316 goto err_gpio;
361 rc = request_irq(gpio_to_irq(GPIO25_GSM_MOD_ON_STATE), gsm_on_irq, 317 rc = request_irq(gpio_to_irq(GPIO25_GSM_MOD_ON_STATE), gsm_on_irq,
@@ -369,7 +325,7 @@ static int __init gsm_init(void)
369 325
370err_irq: 326err_irq:
371 printk(KERN_ERR "Mioa701: Can't request GSM_ON irq\n"); 327 printk(KERN_ERR "Mioa701: Can't request GSM_ON irq\n");
372 mio_gpio_free(ARRAY_AND_SIZE(gsm_gpios)); 328 gpio_free_array(ARRAY_AND_SIZE(gsm_gpios));
373err_gpio: 329err_gpio:
374 printk(KERN_ERR "Mioa701: gsm not available\n"); 330 printk(KERN_ERR "Mioa701: gsm not available\n");
375 return rc; 331 return rc;
@@ -378,7 +334,7 @@ err_gpio:
378static void gsm_exit(void) 334static void gsm_exit(void)
379{ 335{
380 free_irq(gpio_to_irq(GPIO25_GSM_MOD_ON_STATE), NULL); 336 free_irq(gpio_to_irq(GPIO25_GSM_MOD_ON_STATE), NULL);
381 mio_gpio_free(ARRAY_AND_SIZE(gsm_gpios)); 337 gpio_free_array(ARRAY_AND_SIZE(gsm_gpios));
382} 338}
383 339
384/* 340/*
@@ -749,14 +705,16 @@ static void mioa701_restart(char c, const char *cmd)
749 arm_machine_restart('s', cmd); 705 arm_machine_restart('s', cmd);
750} 706}
751 707
752static struct gpio_ress global_gpios[] = { 708static struct gpio global_gpios[] = {
753 MIO_GPIO_OUT(GPIO9_CHARGE_EN, 1, "Charger enable"), 709 { GPIO9_CHARGE_EN, GPIOF_OUT_INIT_HIGH, "Charger enable" },
754 MIO_GPIO_OUT(GPIO18_POWEROFF, 0, "Power Off"), 710 { GPIO18_POWEROFF, GPIOF_OUT_INIT_LOW, "Power Off" },
755 MIO_GPIO_OUT(GPIO87_LCD_POWER, 0, "LCD Power"), 711 { GPIO87_LCD_POWER, GPIOF_OUT_INIT_LOW, "LCD Power" },
756}; 712};
757 713
758static void __init mioa701_machine_init(void) 714static void __init mioa701_machine_init(void)
759{ 715{
716 int rc;
717
760 PSLR = 0xff100000; /* SYSDEL=125ms, PWRDEL=125ms, PSLR_SL_ROD=1 */ 718 PSLR = 0xff100000; /* SYSDEL=125ms, PWRDEL=125ms, PSLR_SL_ROD=1 */
761 PCFR = PCFR_DC_EN | PCFR_GPR_EN | PCFR_OPDE; 719 PCFR = PCFR_DC_EN | PCFR_GPR_EN | PCFR_OPDE;
762 RTTR = 32768 - 1; /* Reset crazy WinCE value */ 720 RTTR = 32768 - 1; /* Reset crazy WinCE value */
@@ -766,7 +724,9 @@ static void __init mioa701_machine_init(void)
766 pxa_set_ffuart_info(NULL); 724 pxa_set_ffuart_info(NULL);
767 pxa_set_btuart_info(NULL); 725 pxa_set_btuart_info(NULL);
768 pxa_set_stuart_info(NULL); 726 pxa_set_stuart_info(NULL);
769 mio_gpio_request(ARRAY_AND_SIZE(global_gpios)); 727 rc = gpio_request_array(ARRAY_AND_SIZE(global_gpios));
728 if (rc)
729 pr_err("MioA701: Failed to request GPIOs: %d", rc);
770 bootstrap_init(); 730 bootstrap_init();
771 pxa_set_fb_info(NULL, &mioa701_pxafb_info); 731 pxa_set_fb_info(NULL, &mioa701_pxafb_info);
772 pxa_set_mci_info(&mioa701_mci_info); 732 pxa_set_mci_info(&mioa701_mci_info);
diff --git a/arch/arm/mach-pxa/saarb.c b/arch/arm/mach-pxa/saarb.c
index 9322fe527c7f..e53a3334c944 100644
--- a/arch/arm/mach-pxa/saarb.c
+++ b/arch/arm/mach-pxa/saarb.c
@@ -104,7 +104,7 @@ static void __init saarb_init(void)
104 104
105MACHINE_START(SAARB, "PXA955 Handheld Platform (aka SAARB)") 105MACHINE_START(SAARB, "PXA955 Handheld Platform (aka SAARB)")
106 .boot_params = 0xa0000100, 106 .boot_params = 0xa0000100,
107 .map_io = pxa_map_io, 107 .map_io = pxa3xx_map_io,
108 .nr_irqs = SAARB_NR_IRQS, 108 .nr_irqs = SAARB_NR_IRQS,
109 .init_irq = pxa95x_init_irq, 109 .init_irq = pxa95x_init_irq,
110 .timer = &pxa_timer, 110 .timer = &pxa_timer,