aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-pxa/cm-x300.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/arm/mach-pxa/cm-x300.c')
-rw-r--r--arch/arm/mach-pxa/cm-x300.c59
1 files changed, 27 insertions, 32 deletions
diff --git a/arch/arm/mach-pxa/cm-x300.c b/arch/arm/mach-pxa/cm-x300.c
index b2248e76ec8..3814e124329 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,34 @@ 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;
774 int err; 778 int err;
775 779
776 if (system_rev < 130) { 780 if (system_rev < 130) {
777 wlan_en = 77; 781 cm_x300_wi2wi_gpios[0].gpio = 77; /* wlan en */
778 bt_reset = 78; 782 cm_x300_wi2wi_gpios[1].gpio = 78; /* bt reset */
779 } else {
780 wlan_en = 71;
781 bt_reset = 70;
782 } 783 }
783 784
784 /* Libertas and CSR reset */ 785 /* Libertas and CSR reset */
785 err = gpio_request(wlan_en, "wlan en"); 786 err = gpio_request_array(ARRAY_AND_SIZE(cm_x300_wi2wi_gpios));
786 if (err) { 787 if (err) {
787 pr_err("CM-X300: failed to request wlan en gpio: %d\n", err); 788 pr_err("failed to request wifi/bt gpios: %d\n", err);
788 } else { 789 return;
789 gpio_direction_output(wlan_en, 1);
790 gpio_free(wlan_en);
791 } 790 }
792 791
793 err = gpio_request(bt_reset, "bt reset"); 792 udelay(10);
794 if (err) { 793 gpio_set_value(cm_x300_wi2wi_gpios[1].gpio, 0);
795 pr_err("CM-X300: failed to request bt reset gpio: %d\n", err); 794 udelay(10);
796 } else { 795 gpio_set_value(cm_x300_wi2wi_gpios[1].gpio, 1);
797 gpio_direction_output(bt_reset, 1); 796
798 udelay(10); 797 gpio_free_array(ARRAY_AND_SIZE(cm_x300_wi2wi_gpios));
799 gpio_set_value(bt_reset, 0);
800 udelay(10);
801 gpio_set_value(bt_reset, 1);
802 gpio_free(bt_reset);
803 }
804} 798}
805 799
806/* MFP */ 800/* MFP */
@@ -859,6 +853,7 @@ MACHINE_START(CM_X300, "CM-X300 module")
859 .boot_params = 0xa0000100, 853 .boot_params = 0xa0000100,
860 .map_io = pxa3xx_map_io, 854 .map_io = pxa3xx_map_io,
861 .init_irq = pxa3xx_init_irq, 855 .init_irq = pxa3xx_init_irq,
856 .handle_irq = pxa3xx_handle_irq,
862 .timer = &pxa_timer, 857 .timer = &pxa_timer,
863 .init_machine = cm_x300_init, 858 .init_machine = cm_x300_init,
864 .fixup = cm_x300_fixup, 859 .fixup = cm_x300_fixup,