Commit 9d01c45e9e9ae6d05bea8229f3d1672034a74187
Committed by
Afzal Mohammed
1 parent
701fba9eeb
Exists in
master
board-am335xevm: add platform support for wlan and bluetooth
* Add pin muxing for wlan and bluetooth * Initialize mmc2 for working with the wl12xx COM module * Enable wlan and bluetooth Signed-off-by: Eyal Reizer <eyalr@ti.com>
Showing 1 changed file with 121 additions and 0 deletions Side-by-side Diff
arch/arm/mach-omap2/board-am335xevm.c
... | ... | @@ -25,6 +25,7 @@ |
25 | 25 | #include <linux/platform_device.h> |
26 | 26 | #include <linux/clk.h> |
27 | 27 | #include <linux/err.h> |
28 | +#include <linux/wl12xx.h> | |
28 | 29 | |
29 | 30 | /* LCD controller is similar to DA850 */ |
30 | 31 | #include <video/da8xx-fb.h> |
... | ... | @@ -571,6 +572,42 @@ |
571 | 572 | {NULL, 0}, |
572 | 573 | }; |
573 | 574 | |
575 | +#define AM335XEVM_WLAN_PMENA_GPIO GPIO_TO_PIN(1, 30) | |
576 | +#define AM335XEVM_WLAN_IRQ_GPIO GPIO_TO_PIN(3, 17) | |
577 | +#define AM335XEVM_BT_ENABLE_GPIO GPIO_TO_PIN(1, 31) | |
578 | + | |
579 | +struct wl12xx_platform_data am335xevm_wlan_data __initdata = { | |
580 | + .irq = OMAP_GPIO_IRQ(AM335XEVM_WLAN_IRQ_GPIO), | |
581 | + .board_ref_clock = WL12XX_REFCLOCK_26, /* 26 MHz */ | |
582 | + .board_tcxo_clock = WL12XX_REFCLOCK_26, /* 26 MHz */ | |
583 | +}; | |
584 | + | |
585 | +/* Module pin mux for wlan and bluetooth */ | |
586 | +static struct pinmux_config mmc2_wl12xx_pin_mux[] = { | |
587 | + {"gpmc_a1.mmc2_dat0", OMAP_MUX_MODE3 | AM33XX_PIN_INPUT_PULLUP}, | |
588 | + {"gpmc_a2.mmc2_dat1", OMAP_MUX_MODE3 | AM33XX_PIN_INPUT_PULLUP}, | |
589 | + {"gpmc_a3.mmc2_dat2", OMAP_MUX_MODE3 | AM33XX_PIN_INPUT_PULLUP}, | |
590 | + {"gpmc_ben1.mmc2_dat3", OMAP_MUX_MODE3 | AM33XX_PIN_INPUT_PULLUP}, | |
591 | + {"gpmc_csn3.mmc2_cmd", OMAP_MUX_MODE3 | AM33XX_PIN_INPUT_PULLUP}, | |
592 | + {"gpmc_clk.mmc2_clk", OMAP_MUX_MODE3 | AM33XX_PIN_INPUT_PULLUP}, | |
593 | + {NULL, 0}, | |
594 | +}; | |
595 | + | |
596 | +static struct pinmux_config uart1_wl12xx_pin_mux[] = { | |
597 | + {"uart1_ctsn.uart1_ctsn", OMAP_MUX_MODE0 | AM33XX_PIN_OUTPUT}, | |
598 | + {"uart1_rtsn.uart1_rtsn", OMAP_MUX_MODE0 | AM33XX_PIN_INPUT}, | |
599 | + {"uart1_rxd.uart1_rxd", OMAP_MUX_MODE0 | AM33XX_PIN_INPUT_PULLUP}, | |
600 | + {"uart1_txd.uart1_txd", OMAP_MUX_MODE0 | AM33XX_PULL_ENBL}, | |
601 | + {NULL, 0}, | |
602 | +}; | |
603 | + | |
604 | +static struct pinmux_config wl12xx_pin_mux[] = { | |
605 | + {"gpmc_csn1.gpio1_30", OMAP_MUX_MODE7 | AM33XX_PIN_OUTPUT}, | |
606 | + {"mcasp0_ahclkr.gpio3_17", OMAP_MUX_MODE7 | AM33XX_PIN_INPUT}, | |
607 | + {"gpmc_csn2.gpio1_31", OMAP_MUX_MODE7 | AM33XX_PIN_OUTPUT}, | |
608 | + {NULL, 0}, | |
609 | + }; | |
610 | + | |
574 | 611 | static int backlight_enable = false; |
575 | 612 | |
576 | 613 | static void enable_ecap0(int evm_id, int profile) |
... | ... | @@ -828,6 +865,87 @@ |
828 | 865 | return; |
829 | 866 | } |
830 | 867 | |
868 | +static void mmc2_wl12xx_init(int evm_id, int profile) | |
869 | +{ | |
870 | + setup_pin_mux(mmc2_wl12xx_pin_mux); | |
871 | + | |
872 | + am335x_mmc[1].mmc = 3; | |
873 | + am335x_mmc[1].name = "wl1271"; | |
874 | + am335x_mmc[1].caps = MMC_CAP_4_BIT_DATA | MMC_CAP_POWER_OFF_CARD | |
875 | + | MMC_PM_KEEP_POWER; | |
876 | + am335x_mmc[1].nonremovable = true; | |
877 | + am335x_mmc[1].gpio_cd = -EINVAL; | |
878 | + am335x_mmc[1].gpio_wp = -EINVAL; | |
879 | + am335x_mmc[1].ocr_mask = MMC_VDD_32_33 | MMC_VDD_33_34; /* 3V3 */ | |
880 | + | |
881 | + /* mmc will be initialized when mmc0_init is called */ | |
882 | + return; | |
883 | +} | |
884 | + | |
885 | +static void uart1_wl12xx_init(int evm_id, int profile) | |
886 | +{ | |
887 | + setup_pin_mux(uart1_wl12xx_pin_mux); | |
888 | +} | |
889 | + | |
890 | +static void wl12xx_bluetooth_enable(void) | |
891 | +{ | |
892 | + int status = gpio_request(AM335XEVM_BT_ENABLE_GPIO, "bt_en\n"); | |
893 | + if (status < 0) | |
894 | + pr_err("Failed to request gpio for bt_enable"); | |
895 | + | |
896 | + pr_info("Enable bluetooth...\n"); | |
897 | + gpio_direction_output(AM335XEVM_BT_ENABLE_GPIO, 0); | |
898 | + msleep(1); | |
899 | + gpio_set_value(AM335XEVM_BT_ENABLE_GPIO, 1); | |
900 | +} | |
901 | + | |
902 | +static int wl12xx_set_power(struct device *dev, int slot, int on, int vdd) | |
903 | +{ | |
904 | + if (on) | |
905 | + gpio_set_value(AM335XEVM_WLAN_PMENA_GPIO, 1); | |
906 | + else | |
907 | + gpio_set_value(AM335XEVM_WLAN_PMENA_GPIO, 0); | |
908 | + | |
909 | + return 0; | |
910 | +} | |
911 | + | |
912 | +static void wl12xx_init(int evm_id, int profile) | |
913 | +{ | |
914 | + struct device *dev; | |
915 | + struct omap_mmc_platform_data *pdata; | |
916 | + int ret; | |
917 | + | |
918 | + wl12xx_bluetooth_enable(); | |
919 | + | |
920 | + if (wl12xx_set_platform_data(&am335xevm_wlan_data)) | |
921 | + pr_err("error setting wl12xx data\n"); | |
922 | + | |
923 | + dev = am335x_mmc[1].dev; | |
924 | + if (!dev) { | |
925 | + pr_err("wl12xx mmc device initialization failed\n"); | |
926 | + goto out; | |
927 | + } | |
928 | + | |
929 | + pdata = dev->platform_data; | |
930 | + if (!pdata) { | |
931 | + pr_err("Platfrom data of wl12xx device not set\n"); | |
932 | + goto out; | |
933 | + } | |
934 | + | |
935 | + ret = gpio_request_one(AM335XEVM_WLAN_PMENA_GPIO, GPIOF_OUT_INIT_LOW, | |
936 | + "wlan_en"); | |
937 | + if (ret) { | |
938 | + pr_err("Error requesting wlan enable gpio: %d\n", ret); | |
939 | + goto out; | |
940 | + } | |
941 | + | |
942 | + setup_pin_mux(wl12xx_pin_mux); | |
943 | + | |
944 | + pdata->slots[0].set_power = wl12xx_set_power; | |
945 | +out: | |
946 | + return; | |
947 | +} | |
948 | + | |
831 | 949 | static void mmc0_init(int evm_id, int profile) |
832 | 950 | { |
833 | 951 | setup_pin_mux(mmc0_pin_mux); |
834 | 952 | |
... | ... | @@ -891,9 +1009,12 @@ |
891 | 1009 | {mcasp1_init, DEV_ON_DGHTR_BRD, (PROFILE_0 | PROFILE_3) }, |
892 | 1010 | {mmc1_init, DEV_ON_DGHTR_BRD, PROFILE_2}, |
893 | 1011 | {mmc2_init, DEV_ON_DGHTR_BRD, PROFILE_4}, |
1012 | + {mmc2_wl12xx_init, DEV_ON_BASEBOARD, (PROFILE_ALL & ~PROFILE_4)}, | |
894 | 1013 | {mmc0_init, DEV_ON_BASEBOARD, (PROFILE_ALL & ~PROFILE_5)}, |
895 | 1014 | {mmc0_no_cd_init, DEV_ON_BASEBOARD, PROFILE_5}, |
896 | 1015 | {spi0_init, DEV_ON_DGHTR_BRD, PROFILE_2}, |
1016 | + {uart1_wl12xx_init, DEV_ON_BASEBOARD, PROFILE_ALL}, | |
1017 | + {wl12xx_init, DEV_ON_BASEBOARD, (PROFILE_ALL & ~PROFILE_4)}, | |
897 | 1018 | {NULL, 0, 0}, |
898 | 1019 | }; |
899 | 1020 |