old mode 100644new mode 100755| .. | .. |
|---|
| 42 | 42 | #else |
|---|
| 43 | 43 | #include <dhd_plat.h> |
|---|
| 44 | 44 | #endif /* CONFIG_WIFI_CONTROL_FUNC */ |
|---|
| 45 | +#ifdef BCMDBUS |
|---|
| 46 | +#include <dbus.h> |
|---|
| 47 | +#endif |
|---|
| 45 | 48 | #ifdef CONFIG_DTS |
|---|
| 46 | 49 | #include<linux/regulator/consumer.h> |
|---|
| 47 | 50 | #include<linux/of_gpio.h> |
|---|
| 48 | 51 | #endif /* CONFIG_DTS */ |
|---|
| 49 | 52 | |
|---|
| 50 | | -#if defined(CUSTOMER_HW) || defined(BCMDHD_PLATDEV) |
|---|
| 53 | +#if defined(CUSTOMER_HW) |
|---|
| 51 | 54 | extern int dhd_wlan_init_plat_data(wifi_adapter_info_t *adapter); |
|---|
| 52 | 55 | extern void dhd_wlan_deinit_plat_data(wifi_adapter_info_t *adapter); |
|---|
| 53 | 56 | #endif /* CUSTOMER_HW */ |
|---|
| .. | .. |
|---|
| 85 | 88 | #pragma GCC diagnostic ignored "-Wmissing-field-initializers" |
|---|
| 86 | 89 | #endif |
|---|
| 87 | 90 | struct resource dhd_wlan_resources = {0}; |
|---|
| 88 | | -extern struct wifi_platform_data dhd_wlan_control; |
|---|
| 91 | +struct wifi_platform_data dhd_wlan_control = {0}; |
|---|
| 89 | 92 | #if defined(STRICT_GCC_WARNINGS) && defined(__GNUC__) |
|---|
| 90 | 93 | #pragma GCC diagnostic pop |
|---|
| 91 | 94 | #endif |
|---|
| .. | .. |
|---|
| 167 | 170 | return NULL; |
|---|
| 168 | 171 | plat_data = adapter->wifi_plat_data; |
|---|
| 169 | 172 | if (plat_data->mem_prealloc) { |
|---|
| 170 | | -#if defined(BCMDHD_MDRIVER) && !defined(DHD_STATIC_IN_DRIVER) |
|---|
| 173 | +#ifdef BCMDHD_MDRIVER |
|---|
| 171 | 174 | alloc_ptr = plat_data->mem_prealloc(adapter->bus_type, adapter->index, section, size); |
|---|
| 172 | 175 | #else |
|---|
| 173 | 176 | alloc_ptr = plat_data->mem_prealloc(section, size); |
|---|
| .. | .. |
|---|
| 378 | 381 | adapter->wifi_plat_data = (void *)&dhd_wlan_control; |
|---|
| 379 | 382 | #endif |
|---|
| 380 | 383 | |
|---|
| 381 | | -#ifdef BCMDHD_PLATDEV |
|---|
| 382 | | - adapter->pdev = pdev; |
|---|
| 383 | | - wifi_plat_dev_probe_ret = dhd_wlan_init_plat_data(adapter); |
|---|
| 384 | | - if (!wifi_plat_dev_probe_ret) |
|---|
| 385 | | - wifi_plat_dev_probe_ret = dhd_wifi_platform_load(); |
|---|
| 386 | | - return wifi_plat_dev_probe_ret; |
|---|
| 387 | | -#endif |
|---|
| 388 | | - |
|---|
| 389 | 384 | resource = platform_get_resource_byname(pdev, IORESOURCE_IRQ, "bcmdhd_wlan_irq"); |
|---|
| 390 | 385 | if (resource == NULL) |
|---|
| 391 | 386 | resource = platform_get_resource_byname(pdev, IORESOURCE_IRQ, "bcm4329_wlan_irq"); |
|---|
| .. | .. |
|---|
| 457 | 452 | #ifdef CONFIG_DTS |
|---|
| 458 | 453 | regulator_put(wifi_regulator); |
|---|
| 459 | 454 | #endif /* CONFIG_DTS */ |
|---|
| 460 | | -#ifdef BCMDHD_PLATDEV |
|---|
| 461 | | - dhd_wlan_deinit_plat_data(adapter); |
|---|
| 462 | | -#endif |
|---|
| 463 | 455 | return 0; |
|---|
| 464 | 456 | } |
|---|
| 465 | 457 | |
|---|
| .. | .. |
|---|
| 577 | 569 | return -ENOMEM; |
|---|
| 578 | 570 | } |
|---|
| 579 | 571 | adapter->name = "DHD generic adapter"; |
|---|
| 572 | + adapter->index = -1; |
|---|
| 573 | +#if defined(BCMDHD_MDRIVER) && !defined(DHD_STATIC_IN_DRIVER) |
|---|
| 574 | +#ifdef BCMSDIO |
|---|
| 580 | 575 | adapter->index = 0; |
|---|
| 576 | +#elif defined(BCMPCIE) |
|---|
| 577 | + adapter->index = 1; |
|---|
| 578 | +#elif defined(BCMDBUS) |
|---|
| 579 | + adapter->index = 2; |
|---|
| 580 | +#endif |
|---|
| 581 | +#endif |
|---|
| 581 | 582 | adapter->bus_type = -1; |
|---|
| 582 | 583 | adapter->bus_num = -1; |
|---|
| 583 | 584 | adapter->slot_num = -1; |
|---|
| .. | .. |
|---|
| 770 | 771 | err = dhd_bus_register(); |
|---|
| 771 | 772 | } else { |
|---|
| 772 | 773 | #ifdef DHD_SUPPORT_HDM |
|---|
| 773 | | - if (dhd_download_fw_on_driverload || hdm_trigger_init) |
|---|
| 774 | + if (dhd_download_fw_on_driverload || hdm_trigger_init) { |
|---|
| 774 | 775 | #else |
|---|
| 775 | | - if (dhd_download_fw_on_driverload) |
|---|
| 776 | + if (dhd_download_fw_on_driverload) { |
|---|
| 776 | 777 | #endif /* DHD_SUPPORT_HDM */ |
|---|
| 777 | | - { |
|---|
| 778 | 778 | /* power up all adapters */ |
|---|
| 779 | 779 | for (i = 0; i < dhd_wifi_platdata->num_adapters; i++) { |
|---|
| 780 | 780 | int retry = POWERUP_MAX_RETRY; |
|---|
| .. | .. |
|---|
| 896 | 896 | for (i = 0; i < dhd_wifi_platdata->num_adapters; i++) { |
|---|
| 897 | 897 | bool chip_up = FALSE; |
|---|
| 898 | 898 | int retry = POWERUP_MAX_RETRY; |
|---|
| 899 | | -#ifndef DHD_INSMOD_NOWAIT |
|---|
| 900 | 899 | struct semaphore dhd_chipup_sem; |
|---|
| 901 | | -#endif |
|---|
| 902 | 900 | |
|---|
| 903 | 901 | adapter = &dhd_wifi_platdata->adapters[i]; |
|---|
| 904 | 902 | |
|---|
| .. | .. |
|---|
| 909 | 907 | adapter->bus_type, adapter->bus_num, adapter->slot_num)); |
|---|
| 910 | 908 | |
|---|
| 911 | 909 | do { |
|---|
| 912 | | -#ifdef DHD_INSMOD_NOWAIT |
|---|
| 913 | | - err = wifi_platform_set_power(adapter, TRUE, WIFI_TURNON_DELAY); |
|---|
| 914 | | - if (err) { |
|---|
| 915 | | - DHD_ERROR(("%s: wifi pwr on error ! \n", __FUNCTION__)); |
|---|
| 916 | | - wifi_platform_set_power(adapter, FALSE, WIFI_TURNOFF_DELAY); |
|---|
| 917 | | - continue; |
|---|
| 918 | | - } else { |
|---|
| 919 | | - wifi_platform_bus_enumerate(adapter, TRUE); |
|---|
| 920 | | - chip_up = TRUE; |
|---|
| 921 | | - break; |
|---|
| 922 | | - } |
|---|
| 923 | | -#else |
|---|
| 924 | 910 | sema_init(&dhd_chipup_sem, 0); |
|---|
| 925 | 911 | err = dhd_bus_reg_sdio_notify(&dhd_chipup_sem); |
|---|
| 926 | 912 | if (err) { |
|---|
| .. | .. |
|---|
| 949 | 935 | dhd_bus_unreg_sdio_notify(); |
|---|
| 950 | 936 | wifi_platform_set_power(adapter, FALSE, WIFI_TURNOFF_DELAY); |
|---|
| 951 | 937 | wifi_platform_bus_enumerate(adapter, FALSE); |
|---|
| 952 | | -#endif |
|---|
| 953 | 938 | } while (retry--); |
|---|
| 954 | 939 | |
|---|
| 955 | 940 | if (!chip_up) { |
|---|
| .. | .. |
|---|
| 966 | 951 | goto fail; |
|---|
| 967 | 952 | } |
|---|
| 968 | 953 | |
|---|
| 969 | | -#ifndef DHD_INSMOD_NOWAIT |
|---|
| 970 | 954 | /* |
|---|
| 971 | 955 | * Wait till MMC sdio_register_driver callback called and made driver attach. |
|---|
| 972 | 956 | * It's needed to make sync up exit from dhd insmod and |
|---|
| .. | .. |
|---|
| 978 | 962 | dhd_bus_unregister(); |
|---|
| 979 | 963 | goto fail; |
|---|
| 980 | 964 | } |
|---|
| 981 | | -#endif |
|---|
| 982 | 965 | |
|---|
| 983 | 966 | return err; |
|---|
| 984 | 967 | |
|---|
| .. | .. |
|---|
| 1011 | 994 | wifi_adapter_info_t *adapter; |
|---|
| 1012 | 995 | s32 timeout = -1; |
|---|
| 1013 | 996 | int i; |
|---|
| 997 | + enum wifi_adapter_status wait_status; |
|---|
| 1014 | 998 | #endif |
|---|
| 1015 | 999 | |
|---|
| 1016 | 1000 | #if !defined(DHD_PRELOAD) |
|---|
| .. | .. |
|---|
| 1019 | 1003 | adapter = &dhd_wifi_platdata->adapters[i]; |
|---|
| 1020 | 1004 | wifi_platform_set_power(adapter, FALSE, 0); |
|---|
| 1021 | 1005 | if (err) { |
|---|
| 1022 | | - DHD_ERROR(("failed to wifi_platform_set_power off %s\n", adapter->name)); |
|---|
| 1006 | + DHD_ERROR(("failed to wifi_platform_set_power on %s\n", adapter->name)); |
|---|
| 1023 | 1007 | goto exit; |
|---|
| 1024 | 1008 | } |
|---|
| 1025 | 1009 | } |
|---|
| .. | .. |
|---|
| 1046 | 1030 | DHD_ERROR(("failed to wifi_platform_set_power on %s\n", adapter->name)); |
|---|
| 1047 | 1031 | goto fail; |
|---|
| 1048 | 1032 | } |
|---|
| 1033 | + if (dhd_download_fw_on_driverload) |
|---|
| 1034 | + wait_status = WIFI_STATUS_ATTACH; |
|---|
| 1035 | + else |
|---|
| 1036 | + wait_status = WIFI_STATUS_DETTACH; |
|---|
| 1049 | 1037 | timeout = wait_event_interruptible_timeout(adapter->status_event, |
|---|
| 1050 | | - wifi_get_adapter_status(adapter, WIFI_STATUS_NET_ATTACHED), |
|---|
| 1038 | + wifi_get_adapter_status(adapter, wait_status), |
|---|
| 1051 | 1039 | msecs_to_jiffies(DHD_REGISTRATION_TIMEOUT)); |
|---|
| 1052 | 1040 | if (timeout <= 0) { |
|---|
| 1053 | 1041 | err = -1; |
|---|
| .. | .. |
|---|
| 1079 | 1067 | } |
|---|
| 1080 | 1068 | #endif /* BCMDBUS */ |
|---|
| 1081 | 1069 | |
|---|
| 1082 | | -static int dhd_wifi_platform_load() |
|---|
| 1070 | +static int dhd_wifi_platform_load(void) |
|---|
| 1083 | 1071 | { |
|---|
| 1084 | 1072 | int err = 0; |
|---|
| 1085 | 1073 | printf("%s: Enter\n", __FUNCTION__); |
|---|