temp revert rk change
[firefly-linux-kernel-4.4.55.git] / arch / arm / mach-tegra / board-stingray-wifi.c
index 5c37461b09e3b5e405643762f107502ed15422d7..755e044f5d41e44a47e2c58769aa929303cb5e19 100644 (file)
@@ -21,7 +21,6 @@
 #include "gpio-names.h"
 
 #define STINGRAY_WLAN_IRQ      TEGRA_GPIO_PU5
-#define STINGRAY_WLAN_PWR      TEGRA_GPIO_PU4
 #define STINGRAY_WLAN_RST      TEGRA_GPIO_PU2
 
 #define ATAG_STINGRAY_MAC      0x57464d41
@@ -158,7 +157,7 @@ static int stingray_wifi_power(int on)
        pr_debug("%s: %d\n", __func__, on);
 
        mdelay(100);
-       gpio_set_value(STINGRAY_WLAN_PWR, on);
+       change_power_brcm_4329(on);
        mdelay(100);
        gpio_set_value(STINGRAY_WLAN_RST, on);
        mdelay(200);
@@ -218,12 +217,51 @@ static int stingray_wifi_get_mac_addr(unsigned char *buf)
        return 0;
 }
 
+/* Customized Locale table : OPTIONAL feature */
+#define WLC_CNTRY_BUF_SZ       4
+typedef struct cntry_locales_custom {
+       char iso_abbrev[WLC_CNTRY_BUF_SZ];
+       char custom_locale[WLC_CNTRY_BUF_SZ];
+       int  custom_locale_rev;
+} cntry_locales_custom_t;
+
+static cntry_locales_custom_t stingray_wifi_translate_custom_table[] = {
+/* Table should be filled out based on custom platform regulatory requirement */
+       {"US", "US", 69}, /* input ISO "US" to : US regrev 69 */
+       {"CA", "US", 69}, /* input ISO "CA" to : US regrev 69 */
+       {"EU", "EU",  5}, /* input ISO "EU" to : EU regrev 05 */
+       {"FR", "EU",  5},
+       {"DE", "EU",  5},
+       {"IR", "EU",  5},
+       {"UK", "EU",  5}, /* input ISO "UK" to : EU regrev 05 */
+       {"KR", "XY",  3},
+       {"AU", "XY",  3},
+       {"CN", "XY",  3}, /* input ISO "CN" to : XY regrev 03 */
+       {"TW", "XY",  3},
+       {"AR", "XY",  3},
+};
+
+static void *stingray_wifi_get_country_code(char *ccode)
+{
+       int size = ARRAY_SIZE(stingray_wifi_translate_custom_table);
+       int i;
+
+       if (!ccode)
+               return NULL;
+
+       for (i = 0; i < size; i++)
+               if (strcmp(ccode, stingray_wifi_translate_custom_table[i].iso_abbrev) == 0)
+                       return &stingray_wifi_translate_custom_table[i];
+       return NULL;
+}
+
 static struct wifi_platform_data stingray_wifi_control = {
        .set_power      = stingray_wifi_power,
        .set_reset      = stingray_wifi_reset,
        .set_carddetect = stingray_wifi_set_carddetect,
        .mem_prealloc   = stingray_wifi_mem_prealloc,
        .get_mac_addr   = stingray_wifi_get_mac_addr,
+       .get_country_code = stingray_wifi_get_country_code,
 };
 
 static struct platform_device stingray_wifi_device = {
@@ -238,10 +276,6 @@ static struct platform_device stingray_wifi_device = {
 
 static void __init stingray_wlan_gpio(void)
 {
-       tegra_gpio_enable(STINGRAY_WLAN_PWR);
-       gpio_request(STINGRAY_WLAN_PWR, "wlan_pwr");
-       gpio_direction_output(STINGRAY_WLAN_PWR, 0);
-
        tegra_gpio_enable(STINGRAY_WLAN_RST);
        gpio_request(STINGRAY_WLAN_RST, "wlan_rst");
        gpio_direction_output(STINGRAY_WLAN_RST, 0);