old mode 100644new mode 100755| .. | .. |
|---|
| 1 | 1 | /* SPDX-License-Identifier: GPL-2.0 */ |
|---|
| 2 | | - |
|---|
| 3 | 2 | #include <osl.h> |
|---|
| 4 | 3 | #include <dhd_linux.h> |
|---|
| 5 | 4 | #include <linux/gpio.h> |
|---|
| .. | .. |
|---|
| 19 | 18 | extern int dhd_static_buf_init(void); |
|---|
| 20 | 19 | extern void dhd_static_buf_exit(void); |
|---|
| 21 | 20 | #endif /* DHD_STATIC_IN_DRIVER */ |
|---|
| 22 | | -#if defined(BCMDHD_MDRIVER) && !defined(DHD_STATIC_IN_DRIVER) |
|---|
| 21 | +#ifdef BCMDHD_MDRIVER |
|---|
| 23 | 22 | extern void *dhd_wlan_mem_prealloc(uint bus_type, int index, |
|---|
| 24 | 23 | int section, unsigned long size); |
|---|
| 25 | 24 | #else |
|---|
| .. | .. |
|---|
| 63 | 62 | #ifdef CUSTOMER_HW_ROCKCHIP |
|---|
| 64 | 63 | rockchip_wifi_power(1); |
|---|
| 65 | 64 | #ifdef BCMPCIE |
|---|
| 66 | | -// rk_pcie_power_on_atu_fixup(); |
|---|
| 65 | + //rk_pcie_power_on_atu_fixup(); |
|---|
| 67 | 66 | #endif |
|---|
| 68 | 67 | #endif |
|---|
| 69 | 68 | #ifdef BUS_POWER_RESTORE |
|---|
| .. | .. |
|---|
| 128 | 127 | return err; |
|---|
| 129 | 128 | } |
|---|
| 130 | 129 | |
|---|
| 131 | | -static int |
|---|
| 132 | | -dhd_wlan_set_reset(int onoff) |
|---|
| 130 | +static int dhd_wlan_set_reset(int onoff) |
|---|
| 133 | 131 | { |
|---|
| 134 | 132 | return 0; |
|---|
| 135 | 133 | } |
|---|
| 136 | 134 | |
|---|
| 137 | | -static int |
|---|
| 138 | | -dhd_wlan_set_carddetect(int present) |
|---|
| 135 | +static int dhd_wlan_set_carddetect(int present) |
|---|
| 139 | 136 | { |
|---|
| 140 | 137 | int err = 0; |
|---|
| 141 | 138 | |
|---|
| .. | .. |
|---|
| 170 | 167 | return err; |
|---|
| 171 | 168 | } |
|---|
| 172 | 169 | |
|---|
| 173 | | -static int |
|---|
| 174 | | -dhd_wlan_get_mac_addr(unsigned char *buf, int ifidx) |
|---|
| 170 | +static int dhd_wlan_get_mac_addr(unsigned char *buf, int ifidx) |
|---|
| 175 | 171 | { |
|---|
| 176 | 172 | int err = 0; |
|---|
| 177 | 173 | |
|---|
| .. | .. |
|---|
| 269 | 265 | .get_country_code = dhd_wlan_get_country_code, |
|---|
| 270 | 266 | }; |
|---|
| 271 | 267 | |
|---|
| 272 | | -static int |
|---|
| 273 | | -dhd_wlan_init_gpio(wifi_adapter_info_t *adapter) |
|---|
| 268 | +int dhd_wlan_init_gpio(wifi_adapter_info_t *adapter) |
|---|
| 274 | 269 | { |
|---|
| 275 | 270 | #ifdef BCMDHD_DTS |
|---|
| 276 | 271 | char wlan_node[32]; |
|---|
| .. | .. |
|---|
| 313 | 308 | if (gpio_wl_reg_on >= 0) { |
|---|
| 314 | 309 | err = gpio_request(gpio_wl_reg_on, "WL_REG_ON"); |
|---|
| 315 | 310 | if (err < 0) { |
|---|
| 316 | | - printf("%s: gpio_request(%d) for WL_REG_ON failed %d\n", |
|---|
| 317 | | - __FUNCTION__, gpio_wl_reg_on, err); |
|---|
| 311 | + printf("%s: gpio_request(%d) for WL_REG_ON failed\n", |
|---|
| 312 | + __FUNCTION__, gpio_wl_reg_on); |
|---|
| 318 | 313 | gpio_wl_reg_on = -1; |
|---|
| 319 | 314 | } |
|---|
| 320 | 315 | } |
|---|
| .. | .. |
|---|
| 324 | 319 | if (gpio_wl_host_wake >= 0) { |
|---|
| 325 | 320 | err = gpio_request(gpio_wl_host_wake, "bcmdhd"); |
|---|
| 326 | 321 | if (err < 0) { |
|---|
| 327 | | - printf("%s: gpio_request(%d) for WL_HOST_WAKE failed %d\n", |
|---|
| 328 | | - __FUNCTION__, gpio_wl_host_wake, err); |
|---|
| 322 | + printf("%s: gpio_request(%d) for WL_HOST_WAKE failed\n", |
|---|
| 323 | + __FUNCTION__, gpio_wl_host_wake); |
|---|
| 329 | 324 | return -1; |
|---|
| 330 | 325 | } |
|---|
| 331 | 326 | adapter->gpio_wl_host_wake = gpio_wl_host_wake; |
|---|
| 332 | 327 | err = gpio_direction_input(gpio_wl_host_wake); |
|---|
| 333 | 328 | if (err < 0) { |
|---|
| 334 | | - printf("%s: gpio_direction_input(%d) for WL_HOST_WAKE failed %d\n", |
|---|
| 335 | | - __FUNCTION__, gpio_wl_host_wake, err); |
|---|
| 329 | + printf("%s: gpio_direction_input(%d) for WL_HOST_WAKE failed\n", |
|---|
| 330 | + __FUNCTION__, gpio_wl_host_wake); |
|---|
| 336 | 331 | gpio_free(gpio_wl_host_wake); |
|---|
| 337 | 332 | return -1; |
|---|
| 338 | 333 | } |
|---|
| 339 | 334 | host_oob_irq = gpio_to_irq(gpio_wl_host_wake); |
|---|
| 340 | 335 | if (host_oob_irq < 0) { |
|---|
| 341 | | - printf("%s: gpio_to_irq(%d) for WL_HOST_WAKE failed %d\n", |
|---|
| 342 | | - __FUNCTION__, gpio_wl_host_wake, host_oob_irq); |
|---|
| 336 | + printf("%s: gpio_to_irq(%d) for WL_HOST_WAKE failed\n", |
|---|
| 337 | + __FUNCTION__, gpio_wl_host_wake); |
|---|
| 343 | 338 | gpio_free(gpio_wl_host_wake); |
|---|
| 344 | 339 | return -1; |
|---|
| 345 | 340 | } |
|---|
| .. | .. |
|---|
| 379 | 374 | return 0; |
|---|
| 380 | 375 | } |
|---|
| 381 | 376 | |
|---|
| 382 | | -static void |
|---|
| 383 | | -dhd_wlan_deinit_gpio(wifi_adapter_info_t *adapter) |
|---|
| 377 | +static void dhd_wlan_deinit_gpio(wifi_adapter_info_t *adapter) |
|---|
| 384 | 378 | { |
|---|
| 385 | 379 | int gpio_wl_reg_on = adapter->gpio_wl_reg_on; |
|---|
| 386 | 380 | #ifdef CUSTOMER_OOB |
|---|
| .. | .. |
|---|
| 401 | 395 | #endif /* CUSTOMER_OOB */ |
|---|
| 402 | 396 | } |
|---|
| 403 | 397 | |
|---|
| 404 | | -#if defined(BCMDHD_MDRIVER) |
|---|
| 405 | | -static void |
|---|
| 406 | | -dhd_wlan_init_adapter(wifi_adapter_info_t *adapter) |
|---|
| 407 | | -{ |
|---|
| 408 | | -#ifdef ADAPTER_IDX |
|---|
| 409 | | - if (ADAPTER_IDX == 0) { |
|---|
| 410 | | - adapter->bus_num = 1; |
|---|
| 411 | | - adapter->slot_num = 1; |
|---|
| 412 | | - } else if (ADAPTER_IDX == 1) { |
|---|
| 413 | | - adapter->bus_num = 2; |
|---|
| 414 | | - adapter->slot_num = 1; |
|---|
| 415 | | - } |
|---|
| 416 | | - adapter->index = ADAPTER_IDX; |
|---|
| 417 | | -#ifdef BCMSDIO |
|---|
| 418 | | - adapter->bus_type = SDIO_BUS; |
|---|
| 419 | | -#elif defined(BCMPCIE) |
|---|
| 420 | | - adapter->bus_type = PCI_BUS; |
|---|
| 421 | | -#elif defined(BCMDBUS) |
|---|
| 422 | | - adapter->bus_type = USB_BUS; |
|---|
| 423 | | -#endif |
|---|
| 424 | | - printf("bus_type=%d, bus_num=%d, slot_num=%d\n", |
|---|
| 425 | | - adapter->bus_type, adapter->bus_num, adapter->slot_num); |
|---|
| 426 | | -#endif /* ADAPTER_IDX */ |
|---|
| 427 | | - |
|---|
| 428 | | -#ifdef DHD_STATIC_IN_DRIVER |
|---|
| 429 | | - adapter->index = 0; |
|---|
| 430 | | -#elif !defined(ADAPTER_IDX) |
|---|
| 431 | | -#ifdef BCMSDIO |
|---|
| 432 | | - adapter->index = 0; |
|---|
| 433 | | -#elif defined(BCMPCIE) |
|---|
| 434 | | - adapter->index = 1; |
|---|
| 435 | | -#elif defined(BCMDBUS) |
|---|
| 436 | | - adapter->index = 2; |
|---|
| 437 | | -#endif |
|---|
| 438 | | -#endif /* DHD_STATIC_IN_DRIVER */ |
|---|
| 439 | | -} |
|---|
| 440 | | -#endif /* BCMDHD_MDRIVER */ |
|---|
| 441 | | - |
|---|
| 442 | | -int |
|---|
| 443 | | -dhd_wlan_init_plat_data(wifi_adapter_info_t *adapter) |
|---|
| 398 | +int dhd_wlan_init_plat_data(wifi_adapter_info_t *adapter) |
|---|
| 444 | 399 | { |
|---|
| 445 | 400 | int err = 0; |
|---|
| 446 | 401 | |
|---|
| 447 | | -#ifdef BCMDHD_MDRIVER |
|---|
| 448 | | - dhd_wlan_init_adapter(adapter); |
|---|
| 449 | | -#endif /* BCMDHD_MDRIVER */ |
|---|
| 450 | | - |
|---|
| 402 | + printf("======== %s ========\n", __FUNCTION__); |
|---|
| 403 | + if (adapter->index == -1) { |
|---|
| 404 | + adapter->index = 0; |
|---|
| 405 | + } |
|---|
| 451 | 406 | err = dhd_wlan_init_gpio(adapter); |
|---|
| 452 | 407 | if (err) |
|---|
| 453 | 408 | goto exit; |
|---|
| .. | .. |
|---|
| 460 | 415 | return err; |
|---|
| 461 | 416 | } |
|---|
| 462 | 417 | |
|---|
| 463 | | -void |
|---|
| 464 | | -dhd_wlan_deinit_plat_data(wifi_adapter_info_t *adapter) |
|---|
| 418 | +void dhd_wlan_deinit_plat_data(wifi_adapter_info_t *adapter) |
|---|
| 465 | 419 | { |
|---|
| 420 | + printf("======== %s ========\n", __FUNCTION__); |
|---|
| 466 | 421 | #ifdef DHD_STATIC_IN_DRIVER |
|---|
| 467 | 422 | dhd_static_buf_exit(); |
|---|
| 468 | 423 | #endif |
|---|