diff options
author | Igor Grinberg <grinberg@compulab.co.il> | 2011-05-09 07:41:47 -0400 |
---|---|---|
committer | Eric Miao <eric.y.miao@gmail.com> | 2011-07-11 02:43:26 -0400 |
commit | 5a009df1f200efa49658b0e9c7ad056d59fbefe4 (patch) | |
tree | b5c0d936c1dce38ac66ad8f15af948fd51c3f7aa /arch/arm/mach-pxa/cm-x300.c | |
parent | 6c7b3ea52e345ab614edb91d3f0e9f3bb3713871 (diff) |
ARM: pxa/cm-x300: GPIO cleanup
use gpio_request_<one|array>() instead of multiple gpiolib calls
Signed-off-by: Igor Grinberg <grinberg@compulab.co.il>
Signed-off-by: Eric Miao <eric.y.miao@gmail.com>
Diffstat (limited to 'arch/arm/mach-pxa/cm-x300.c')
-rw-r--r-- | arch/arm/mach-pxa/cm-x300.c | 43 |
1 files changed, 20 insertions, 23 deletions
diff --git a/arch/arm/mach-pxa/cm-x300.c b/arch/arm/mach-pxa/cm-x300.c index 8a034872ac77..880df335a3e9 100644 --- a/arch/arm/mach-pxa/cm-x300.c +++ b/arch/arm/mach-pxa/cm-x300.c | |||
@@ -484,14 +484,14 @@ static int cm_x300_ulpi_phy_reset(void) | |||
484 | int err; | 484 | int err; |
485 | 485 | ||
486 | /* reset the PHY */ | 486 | /* reset the PHY */ |
487 | err = gpio_request(GPIO_ULPI_PHY_RST, "ulpi reset"); | 487 | err = gpio_request_one(GPIO_ULPI_PHY_RST, GPIOF_OUT_INIT_LOW, |
488 | "ulpi reset"); | ||
488 | if (err) { | 489 | if (err) { |
489 | pr_err("%s: failed to request ULPI reset GPIO: %d\n", | 490 | pr_err("%s: failed to request ULPI reset GPIO: %d\n", |
490 | __func__, err); | 491 | __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); |
@@ -768,39 +768,36 @@ static void __init cm_x300_init_da9030(void) | |||
768 | irq_set_irq_wake(IRQ_WAKEUP0, 1); | 768 | irq_set_irq_wake(IRQ_WAKEUP0, 1); |
769 | } | 769 | } |
770 | 770 | ||
771 | /* wi2wi gpio setting for system_rev >= 130 */ | ||
772 | static struct gpio cm_x300_wi2wi_gpios[] __initdata = { | ||
773 | { 71, GPIOF_OUT_INIT_HIGH, "wlan en" }, | ||
774 | { 70, GPIOF_OUT_INIT_HIGH, "bt reset" }, | ||
775 | }; | ||
776 | |||
771 | static void __init cm_x300_init_wi2wi(void) | 777 | static void __init cm_x300_init_wi2wi(void) |
772 | { | 778 | { |
773 | int bt_reset, wlan_en; | 779 | int bt_reset, wlan_en; |
774 | int err; | 780 | int err; |
775 | 781 | ||
776 | if (system_rev < 130) { | 782 | if (system_rev < 130) { |
777 | wlan_en = 77; | 783 | cm_x300_wi2wi_gpios[0].gpio = 77; /* wlan en */ |
778 | bt_reset = 78; | 784 | cm_x300_wi2wi_gpios[1].gpio = 78; /* bt reset */ |
779 | } else { | ||
780 | wlan_en = 71; | ||
781 | bt_reset = 70; | ||
782 | } | 785 | } |
783 | 786 | ||
784 | /* Libertas and CSR reset */ | 787 | /* Libertas and CSR reset */ |
785 | err = gpio_request(wlan_en, "wlan en"); | 788 | err = gpio_request_array(ARRAY_AND_SIZE(cm_x300_wi2wi_gpios)); |
786 | if (err) { | 789 | if (err) { |
787 | pr_err("CM-X300: failed to request wlan en gpio: %d\n", err); | 790 | pr_err("CM-X300: failed to request wifi/bt gpios: %d\n", err); |
788 | } else { | 791 | return; |
789 | gpio_direction_output(wlan_en, 1); | ||
790 | gpio_free(wlan_en); | ||
791 | } | 792 | } |
792 | 793 | ||
793 | err = gpio_request(bt_reset, "bt reset"); | 794 | udelay(10); |
794 | if (err) { | 795 | gpio_set_value(bt_reset, 0); |
795 | pr_err("CM-X300: failed to request bt reset gpio: %d\n", err); | 796 | udelay(10); |
796 | } else { | 797 | gpio_set_value(bt_reset, 1); |
797 | gpio_direction_output(bt_reset, 1); | 798 | |
798 | udelay(10); | 799 | gpio_free(wlan_en); |
799 | gpio_set_value(bt_reset, 0); | 800 | gpio_free(bt_reset); |
800 | udelay(10); | ||
801 | gpio_set_value(bt_reset, 1); | ||
802 | gpio_free(bt_reset); | ||
803 | } | ||
804 | } | 801 | } |
805 | 802 | ||
806 | /* MFP */ | 803 | /* MFP */ |