diff options
Diffstat (limited to 'drivers/net/wireless/bcmdhd/dhd_custom_gpio.c')
-rw-r--r-- | drivers/net/wireless/bcmdhd/dhd_custom_gpio.c | 170 |
1 files changed, 93 insertions, 77 deletions
diff --git a/drivers/net/wireless/bcmdhd/dhd_custom_gpio.c b/drivers/net/wireless/bcmdhd/dhd_custom_gpio.c index ba833b3..46a13f8 100644 --- a/drivers/net/wireless/bcmdhd/dhd_custom_gpio.c +++ b/drivers/net/wireless/bcmdhd/dhd_custom_gpio.c @@ -1,6 +1,6 @@ /* * Customer code to add GPIO control during WLAN start/stop -* Copyright (C) 1999-2012, Broadcom Corporation +* Copyright (C) 1999-2014, Broadcom Corporation * * Unless you and Broadcom execute a separate written software license * agreement governing use of this software, this software is licensed to you @@ -20,16 +20,16 @@ * software in any way with any other Broadcom software provided under a license * other than the GPL, without Broadcom's express prior written consent. * -* $Id: dhd_custom_gpio.c 353280 2012-08-26 04:33:17Z $ +* $Id: dhd_custom_gpio.c 447089 2014-01-08 04:05:58Z $ */ #include <typedefs.h> #include <linuxver.h> #include <osl.h> #include <bcmutils.h> - #include <dngl_stats.h> #include <dhd.h> +#include <dhd_linux.h> #include <wlioctl.h> #include <wl_iw.h> @@ -37,22 +37,12 @@ #define WL_ERROR(x) printf x #define WL_TRACE(x) -#ifdef CUSTOMER_HW -extern void bcm_wlan_power_off(int); -extern void bcm_wlan_power_on(int); -#endif /* CUSTOMER_HW */ #if defined(CUSTOMER_HW2) || defined(CUSTOMER_HW4) -#ifdef CONFIG_WIFI_CONTROL_FUNC -int wifi_set_power(int on, unsigned long msec); -int wifi_get_irq_number(unsigned long *irq_flags_ptr); -int wifi_get_mac_addr(unsigned char *buf); -void *wifi_get_country_code(char *ccode); -#else -int wifi_set_power(int on, unsigned long msec) { return -1; } -int wifi_get_irq_number(unsigned long *irq_flags_ptr) { return -1; } -int wifi_get_mac_addr(unsigned char *buf) { return -1; } -void *wifi_get_country_code(char *ccode) { return NULL; } -#endif /* CONFIG_WIFI_CONTROL_FUNC */ + +#if defined(PLATFORM_MPS) +int __attribute__ ((weak)) wifi_get_fw_nv_path(char *fw, char *nv) { return 0;}; +#endif + #endif /* CUSTOMER_HW2 || CUSTOMER_HW4 */ #if defined(OOB_INTR_ONLY) || defined(BCMSPI_ANDROID) @@ -61,7 +51,7 @@ void *wifi_get_country_code(char *ccode) { return NULL; } extern int sdioh_mmc_irq(int irq); #endif /* (BCMLXSDMMC) */ -#ifdef CUSTOMER_HW3 +#if defined(CUSTOMER_HW3) || defined(PLATFORM_MPS) #include <mach/gpio.h> #endif @@ -82,12 +72,12 @@ MODULE_PARM_DESC(dhd_oob_gpio_num, "DHD oob gpio number"); * Broadcom provides just reference settings as example. * */ -int dhd_customer_oob_irq_map(unsigned long *irq_flags_ptr) +int dhd_customer_oob_irq_map(void *adapter, unsigned long *irq_flags_ptr) { int host_oob_irq = 0; -#if defined(CUSTOMER_HW2) || defined(CUSTOMER_HW4) - host_oob_irq = wifi_get_irq_number(irq_flags_ptr); +#if (defined(CUSTOMER_HW2) || defined(CUSTOMER_HW4)) && !defined(PLATFORM_MPS) + host_oob_irq = wifi_platform_get_irq_number(adapter, irq_flags_ptr); #else #if defined(CUSTOM_OOB_GPIO_NUM) @@ -105,13 +95,11 @@ int dhd_customer_oob_irq_map(unsigned long *irq_flags_ptr) WL_ERROR(("%s: customer specific Host GPIO number is (%d)\n", __FUNCTION__, dhd_oob_gpio_num)); -#if defined CUSTOMER_HW - host_oob_irq = MSM_GPIO_TO_INT(dhd_oob_gpio_num); -#elif defined CUSTOMER_HW3 +#if defined CUSTOMER_HW3 || defined(PLATFORM_MPS) gpio_request(dhd_oob_gpio_num, "oob irq"); host_oob_irq = gpio_to_irq(dhd_oob_gpio_num); gpio_direction_input(dhd_oob_gpio_num); -#endif /* CUSTOMER_HW */ +#endif /* defined CUSTOMER_HW3 || defined(PLATFORM_MPS) */ #endif /* CUSTOMER_HW2 || CUSTOMER_HW4 */ return (host_oob_irq); @@ -119,58 +107,18 @@ int dhd_customer_oob_irq_map(unsigned long *irq_flags_ptr) #endif /* defined(OOB_INTR_ONLY) || defined(BCMSPI_ANDROID) */ /* Customer function to control hw specific wlan gpios */ -void -dhd_customer_gpio_wlan_ctrl(int onoff) +int +dhd_customer_gpio_wlan_ctrl(void *adapter, int onoff) { - switch (onoff) { - case WLAN_RESET_OFF: - WL_TRACE(("%s: call customer specific GPIO to insert WLAN RESET\n", - __FUNCTION__)); -#ifdef CUSTOMER_HW - bcm_wlan_power_off(2); -#endif /* CUSTOMER_HW */ -#if defined(CUSTOMER_HW2) || defined(CUSTOMER_HW4) - wifi_set_power(0, 0); -#endif - WL_ERROR(("=========== WLAN placed in RESET ========\n")); - break; - - case WLAN_RESET_ON: - WL_TRACE(("%s: callc customer specific GPIO to remove WLAN RESET\n", - __FUNCTION__)); -#ifdef CUSTOMER_HW - bcm_wlan_power_on(2); -#endif /* CUSTOMER_HW */ -#if defined(CUSTOMER_HW2) || defined(CUSTOMER_HW4) - wifi_set_power(1, 0); -#endif - WL_ERROR(("=========== WLAN going back to live ========\n")); - break; - - case WLAN_POWER_OFF: - WL_TRACE(("%s: call customer specific GPIO to turn off WL_REG_ON\n", - __FUNCTION__)); -#ifdef CUSTOMER_HW - bcm_wlan_power_off(1); -#endif /* CUSTOMER_HW */ - break; - - case WLAN_POWER_ON: - WL_TRACE(("%s: call customer specific GPIO to turn on WL_REG_ON\n", - __FUNCTION__)); -#ifdef CUSTOMER_HW - bcm_wlan_power_on(1); - /* Lets customer power to get stable */ - OSL_DELAY(200); -#endif /* CUSTOMER_HW */ - break; - } + int err = 0; + + return err; } #ifdef GET_CUSTOM_MAC_ENABLE /* Function to get custom MAC address */ int -dhd_custom_get_mac_address(unsigned char *buf) +dhd_custom_get_mac_address(void *adapter, unsigned char *buf) { int ret = 0; @@ -180,7 +128,7 @@ dhd_custom_get_mac_address(unsigned char *buf) /* Customer access to MAC address stored outside of DHD driver */ #if defined(CUSTOMER_HW2) && (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 35)) - ret = wifi_get_mac_addr(buf); + ret = wifi_platform_get_mac_addr(adapter, buf); #endif #ifdef EXAMPLE_GET_MAC @@ -195,7 +143,7 @@ dhd_custom_get_mac_address(unsigned char *buf) } #endif /* GET_CUSTOM_MAC_ENABLE */ -#ifndef CUSTOMER_HW4 +#if !defined(CUSTOMER_HW4) || defined(PLATFORM_MPS) /* Customized Locale table : OPTIONAL feature */ const struct cntry_locales_custom translate_custom_table[] = { /* Table should be filled out based on custom platform regulatory requirement */ @@ -243,6 +191,74 @@ const struct cntry_locales_custom translate_custom_table[] = { {"TR", "TR", 0}, {"NO", "NO", 0}, #endif /* EXMAPLE_TABLE */ +#if defined(CUSTOMER_HW2) +#if defined(BCM4334_CHIP) || defined(BCM4335_CHIP) + {"", "XZ", 11}, /* Universal if Country code is unknown or empty */ +#endif + {"AE", "AE", 1}, + {"AR", "AR", 1}, + {"AT", "AT", 1}, + {"AU", "AU", 2}, + {"BE", "BE", 1}, + {"BG", "BG", 1}, + {"BN", "BN", 1}, + {"CA", "CA", 2}, + {"CH", "CH", 1}, + {"CY", "CY", 1}, + {"CZ", "CZ", 1}, + {"DE", "DE", 3}, + {"DK", "DK", 1}, + {"EE", "EE", 1}, + {"ES", "ES", 1}, + {"FI", "FI", 1}, + {"FR", "FR", 1}, + {"GB", "GB", 1}, + {"GR", "GR", 1}, + {"HR", "HR", 1}, + {"HU", "HU", 1}, + {"IE", "IE", 1}, + {"IS", "IS", 1}, + {"IT", "IT", 1}, + {"ID", "ID", 1}, + {"JP", "JP", 8}, + {"KR", "KR", 24}, + {"KW", "KW", 1}, + {"LI", "LI", 1}, + {"LT", "LT", 1}, + {"LU", "LU", 1}, + {"LV", "LV", 1}, + {"MA", "MA", 1}, + {"MT", "MT", 1}, + {"MX", "MX", 1}, + {"NL", "NL", 1}, + {"NO", "NO", 1}, + {"PL", "PL", 1}, + {"PT", "PT", 1}, + {"PY", "PY", 1}, + {"RO", "RO", 1}, + {"SE", "SE", 1}, + {"SI", "SI", 1}, + {"SK", "SK", 1}, + {"TR", "TR", 7}, + {"TW", "TW", 1}, + {"IR", "XZ", 11}, /* Universal if Country code is IRAN, (ISLAMIC REPUBLIC OF) */ + {"SD", "XZ", 11}, /* Universal if Country code is SUDAN */ + {"SY", "XZ", 11}, /* Universal if Country code is SYRIAN ARAB REPUBLIC */ + {"GL", "XZ", 11}, /* Universal if Country code is GREENLAND */ + {"PS", "XZ", 11}, /* Universal if Country code is PALESTINIAN TERRITORY, OCCUPIED */ + {"TL", "XZ", 11}, /* Universal if Country code is TIMOR-LESTE (EAST TIMOR) */ + {"MH", "XZ", 11}, /* Universal if Country code is MARSHALL ISLANDS */ +#ifdef BCM4334_CHIP + {"US", "US", 0} + {"RU", "RU", 5}, + {"SG", "SG", 4}, + {"US", "US", 46} +#endif +#ifdef BCM4330_CHIP + {"RU", "RU", 1}, + {"US", "US", 5} +#endif +#endif /* CUSTOMER_HW2 */ }; @@ -250,7 +266,7 @@ const struct cntry_locales_custom translate_custom_table[] = { * input : ISO 3166-1 country abbreviation * output: customized cspec */ -void get_customized_country_code(char *country_iso_code, wl_country_t *cspec) +void get_customized_country_code(void *adapter, char *country_iso_code, wl_country_t *cspec) { #if defined(CUSTOMER_HW2) && (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 39)) @@ -259,7 +275,7 @@ void get_customized_country_code(char *country_iso_code, wl_country_t *cspec) if (!cspec) return; - cloc_ptr = wifi_get_country_code(country_iso_code); + cloc_ptr = wifi_platform_get_country_code(adapter, country_iso_code); if (cloc_ptr) { strlcpy(cspec->ccode, cloc_ptr->custom_locale, WLC_CNTRY_BUF_SZ); cspec->rev = cloc_ptr->custom_locale_rev; @@ -292,4 +308,4 @@ void get_customized_country_code(char *country_iso_code, wl_country_t *cspec) return; #endif /* defined(CUSTOMER_HW2) && (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 36)) */ } -#endif /* CUSTOMER_HW4 */ +#endif /* !CUSTOMER_HW4 */ |