| .. | .. |
|---|
| 1 | | -/* SPDX-License-Identifier: GPL-2.0 */ |
|---|
| 2 | 1 | /* |
|---|
| 3 | 2 | * Customer code to add GPIO control during WLAN start/stop |
|---|
| 4 | 3 | * |
|---|
| 5 | | - * Copyright (C) 1999-2019, Broadcom Corporation |
|---|
| 6 | | - * |
|---|
| 4 | + * Portions of this code are copyright (c) 2022 Cypress Semiconductor Corporation |
|---|
| 5 | + * |
|---|
| 6 | + * Copyright (C) 1999-2017, Broadcom Corporation |
|---|
| 7 | + * |
|---|
| 7 | 8 | * Unless you and Broadcom execute a separate written software license |
|---|
| 8 | 9 | * agreement governing use of this software, this software is licensed to you |
|---|
| 9 | 10 | * under the terms of the GNU General Public License version 2 (the "GPL"), |
|---|
| 10 | 11 | * available at http://www.broadcom.com/licenses/GPLv2.php, with the |
|---|
| 11 | 12 | * following added to such license: |
|---|
| 12 | | - * |
|---|
| 13 | + * |
|---|
| 13 | 14 | * As a special exception, the copyright holders of this software give you |
|---|
| 14 | 15 | * permission to link this software with independent modules, and to copy and |
|---|
| 15 | 16 | * distribute the resulting executable under terms of your choice, provided that |
|---|
| .. | .. |
|---|
| 17 | 18 | * the license of that module. An independent module is a module which is not |
|---|
| 18 | 19 | * derived from this software. The special exception does not apply to any |
|---|
| 19 | 20 | * modifications of the software. |
|---|
| 20 | | - * |
|---|
| 21 | + * |
|---|
| 21 | 22 | * Notwithstanding the above, under no circumstances may you combine this |
|---|
| 22 | 23 | * software in any way with any other Broadcom software provided under a license |
|---|
| 23 | 24 | * other than the GPL, without Broadcom's express prior written consent. |
|---|
| .. | .. |
|---|
| 25 | 26 | * |
|---|
| 26 | 27 | * <<Broadcom-WL-IPTag/Open:>> |
|---|
| 27 | 28 | * |
|---|
| 28 | | - * $Id: dhd_custom_gpio.c 586390 2015-09-15 10:34:19Z $ |
|---|
| 29 | + * $Id: dhd_custom_gpio.c 691191 2017-03-21 07:09:04Z $ |
|---|
| 29 | 30 | */ |
|---|
| 30 | 31 | |
|---|
| 31 | 32 | #include <typedefs.h> |
|---|
| .. | .. |
|---|
| 39 | 40 | #include <wlioctl.h> |
|---|
| 40 | 41 | #if defined(WL_WIRELESS_EXT) |
|---|
| 41 | 42 | #include <wl_iw.h> |
|---|
| 42 | | -#endif |
|---|
| 43 | +#endif // endif |
|---|
| 43 | 44 | |
|---|
| 44 | 45 | #define WL_ERROR(x) printf x |
|---|
| 45 | 46 | #define WL_TRACE(x) |
|---|
| 46 | 47 | |
|---|
| 47 | | -#if defined(CUSTOMER_HW2) |
|---|
| 48 | | - |
|---|
| 49 | | - |
|---|
| 50 | | -#endif |
|---|
| 51 | | - |
|---|
| 52 | | -#if defined(OOB_INTR_ONLY) |
|---|
| 48 | +#if defined(OOB_INTR_ONLY) || defined(BCMSPI_ANDROID) |
|---|
| 53 | 49 | |
|---|
| 54 | 50 | #if defined(BCMLXSDMMC) |
|---|
| 55 | 51 | extern int sdioh_mmc_irq(int irq); |
|---|
| 56 | 52 | #endif /* (BCMLXSDMMC) */ |
|---|
| 57 | | - |
|---|
| 58 | | -#if defined(CUSTOMER_HW3) |
|---|
| 59 | | -#include <mach/gpio.h> |
|---|
| 60 | | -#endif |
|---|
| 61 | 53 | |
|---|
| 62 | 54 | /* Customer specific Host GPIO defintion */ |
|---|
| 63 | 55 | static int dhd_oob_gpio_num = -1; |
|---|
| .. | .. |
|---|
| 80 | 72 | { |
|---|
| 81 | 73 | int host_oob_irq = 0; |
|---|
| 82 | 74 | |
|---|
| 83 | | -#if defined(CUSTOMER_HW2) |
|---|
| 75 | +#if defined(CUSTOMER_HW2) || defined(BOARD_HIKEY) |
|---|
| 84 | 76 | host_oob_irq = wifi_platform_get_irq_number(adapter, irq_flags_ptr); |
|---|
| 85 | 77 | |
|---|
| 86 | 78 | #else |
|---|
| .. | .. |
|---|
| 99 | 91 | WL_ERROR(("%s: customer specific Host GPIO number is (%d)\n", |
|---|
| 100 | 92 | __FUNCTION__, dhd_oob_gpio_num)); |
|---|
| 101 | 93 | |
|---|
| 102 | | -#if defined CUSTOMER_HW3 |
|---|
| 103 | | - gpio_request(dhd_oob_gpio_num, "oob irq"); |
|---|
| 104 | | - host_oob_irq = gpio_to_irq(dhd_oob_gpio_num); |
|---|
| 105 | | - gpio_direction_input(dhd_oob_gpio_num); |
|---|
| 106 | | -#endif |
|---|
| 107 | | -#endif |
|---|
| 94 | +#endif // endif |
|---|
| 108 | 95 | |
|---|
| 109 | 96 | return (host_oob_irq); |
|---|
| 110 | 97 | } |
|---|
| 111 | | -#endif |
|---|
| 98 | +#endif /* defined(OOB_INTR_ONLY) || defined(BCMSPI_ANDROID) */ |
|---|
| 112 | 99 | |
|---|
| 113 | 100 | /* Customer function to control hw specific wlan gpios */ |
|---|
| 114 | 101 | int |
|---|
| .. | .. |
|---|
| 131 | 118 | return -EINVAL; |
|---|
| 132 | 119 | |
|---|
| 133 | 120 | /* Customer access to MAC address stored outside of DHD driver */ |
|---|
| 134 | | -#if defined(CUSTOMER_HW2) && (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 35)) |
|---|
| 121 | +#if (defined(CUSTOMER_HW2) || defined(BOARD_HIKEY)) && (LINUX_VERSION_CODE >= \ |
|---|
| 122 | + KERNEL_VERSION(2, 6, 35)) |
|---|
| 135 | 123 | ret = wifi_platform_get_mac_addr(adapter, buf); |
|---|
| 136 | | -#endif |
|---|
| 124 | +#endif // endif |
|---|
| 137 | 125 | |
|---|
| 138 | 126 | #ifdef EXAMPLE_GET_MAC |
|---|
| 139 | 127 | /* EXAMPLE code */ |
|---|
| .. | .. |
|---|
| 146 | 134 | return ret; |
|---|
| 147 | 135 | } |
|---|
| 148 | 136 | #endif /* GET_CUSTOM_MAC_ENABLE */ |
|---|
| 149 | | - |
|---|
| 150 | | -#if !defined(WL_WIRELESS_EXT) |
|---|
| 151 | | -struct cntry_locales_custom { |
|---|
| 152 | | - char iso_abbrev[WLC_CNTRY_BUF_SZ]; /* ISO 3166-1 country abbreviation */ |
|---|
| 153 | | - char custom_locale[WLC_CNTRY_BUF_SZ]; /* Custom firmware locale */ |
|---|
| 154 | | - int32 custom_locale_rev; /* Custom local revisin default -1 */ |
|---|
| 155 | | -}; |
|---|
| 156 | | -#endif /* WL_WIRELESS_EXT */ |
|---|
| 157 | 137 | |
|---|
| 158 | 138 | /* Customized Locale table : OPTIONAL feature */ |
|---|
| 159 | 139 | const struct cntry_locales_custom translate_custom_table[] = { |
|---|
| .. | .. |
|---|
| 202 | 182 | {"TR", "TR", 0}, |
|---|
| 203 | 183 | {"NO", "NO", 0}, |
|---|
| 204 | 184 | #endif /* EXMAPLE_TABLE */ |
|---|
| 205 | | -#if defined(CUSTOMER_HW2) |
|---|
| 185 | +#if (defined(CUSTOMER_HW2) || defined(BOARD_HIKEY)) |
|---|
| 206 | 186 | #if defined(BCM4335_CHIP) |
|---|
| 207 | 187 | {"", "XZ", 11}, /* Universal if Country code is unknown or empty */ |
|---|
| 208 | | -#endif |
|---|
| 188 | +#endif // endif |
|---|
| 209 | 189 | {"AE", "AE", 1}, |
|---|
| 210 | 190 | {"AR", "AR", 1}, |
|---|
| 211 | 191 | {"AT", "AT", 1}, |
|---|
| .. | .. |
|---|
| 259 | 239 | {"PS", "XZ", 11}, /* Universal if Country code is PALESTINIAN TERRITORY, OCCUPIED */ |
|---|
| 260 | 240 | {"TL", "XZ", 11}, /* Universal if Country code is TIMOR-LESTE (EAST TIMOR) */ |
|---|
| 261 | 241 | {"MH", "XZ", 11}, /* Universal if Country code is MARSHALL ISLANDS */ |
|---|
| 262 | | -#ifdef BCM4330_CHIP |
|---|
| 263 | | - {"RU", "RU", 1}, |
|---|
| 264 | | - {"US", "US", 5} |
|---|
| 265 | | -#endif |
|---|
| 266 | | -#endif |
|---|
| 242 | +#endif // endif |
|---|
| 267 | 243 | }; |
|---|
| 268 | | - |
|---|
| 269 | 244 | |
|---|
| 270 | 245 | /* Customized Locale convertor |
|---|
| 271 | 246 | * input : ISO 3166-1 country abbreviation |
|---|
| .. | .. |
|---|
| 273 | 248 | */ |
|---|
| 274 | 249 | #ifdef CUSTOM_COUNTRY_CODE |
|---|
| 275 | 250 | void get_customized_country_code(void *adapter, char *country_iso_code, |
|---|
| 276 | | - wl_country_t *cspec, u32 flags) |
|---|
| 251 | + wl_country_t *cspec, u32 flags) |
|---|
| 277 | 252 | #else |
|---|
| 278 | 253 | void get_customized_country_code(void *adapter, char *country_iso_code, wl_country_t *cspec) |
|---|
| 279 | 254 | #endif /* CUSTOM_COUNTRY_CODE */ |
|---|
| 280 | 255 | { |
|---|
| 281 | | -#if defined(CUSTOMER_HW2) && (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 39)) |
|---|
| 256 | +#if defined(OEM_ANDROID) |
|---|
| 257 | +#if (defined(CUSTOMER_HW2) || defined(BOARD_HIKEY)) && (LINUX_VERSION_CODE >= \ |
|---|
| 258 | + KERNEL_VERSION(2, 6, 39)) |
|---|
| 282 | 259 | |
|---|
| 283 | 260 | struct cntry_locales_custom *cloc_ptr; |
|---|
| 284 | 261 | |
|---|
| 285 | 262 | if (!cspec) |
|---|
| 286 | 263 | return; |
|---|
| 287 | 264 | #ifdef CUSTOM_COUNTRY_CODE |
|---|
| 288 | | - cloc_ptr = wifi_platform_get_country_code(adapter, country_iso_code, |
|---|
| 289 | | - flags); |
|---|
| 265 | + cloc_ptr = wifi_platform_get_country_code(adapter, country_iso_code, flags); |
|---|
| 290 | 266 | #else |
|---|
| 291 | 267 | cloc_ptr = wifi_platform_get_country_code(adapter, country_iso_code); |
|---|
| 292 | 268 | #endif /* CUSTOM_COUNTRY_CODE */ |
|---|
| 269 | + |
|---|
| 293 | 270 | if (cloc_ptr) { |
|---|
| 294 | 271 | strlcpy(cspec->ccode, cloc_ptr->custom_locale, WLC_CNTRY_BUF_SZ); |
|---|
| 295 | 272 | cspec->rev = cloc_ptr->custom_locale_rev; |
|---|
| .. | .. |
|---|
| 320 | 297 | cspec->rev = translate_custom_table[0].custom_locale_rev; |
|---|
| 321 | 298 | #endif /* EXMAPLE_TABLE */ |
|---|
| 322 | 299 | return; |
|---|
| 323 | | -#endif /* defined(CUSTOMER_HW2) && (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 36)) */ |
|---|
| 300 | +#endif /* (defined(CUSTOMER_HW2) || defined(BOARD_HIKEY)) && |
|---|
| 301 | + * (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 36)) |
|---|
| 302 | + */ |
|---|
| 303 | +#endif /* OEM_ANDROID */ |
|---|
| 324 | 304 | } |
|---|