From b22da3d8526a935aa31e086e63f60ff3246cb61c Mon Sep 17 00:00:00 2001
From: hc <hc@nodka.com>
Date: Sat, 09 Dec 2023 07:24:11 +0000
Subject: [PATCH] add stmac read mac form eeprom
---
kernel/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/dhd_gpio.c | 115 +++++++++++++--------------------------------------------
1 files changed, 27 insertions(+), 88 deletions(-)
diff --git a/kernel/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/dhd_gpio.c b/kernel/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/dhd_gpio.c
old mode 100644
new mode 100755
index fe3ef3b..05b735f
--- a/kernel/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/dhd_gpio.c
+++ b/kernel/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/dhd_gpio.c
@@ -1,14 +1,7 @@
/* SPDX-License-Identifier: GPL-2.0 */
-
#include <osl.h>
#include <dhd_linux.h>
#include <linux/gpio.h>
-#ifdef BCMDHD_DTS
-#include <linux/of_gpio.h>
-#endif
-#ifdef BCMDHD_PLATDEV
-#include <linux/platform_device.h>
-#endif
#ifdef CUSTOMER_HW_ROCKCHIP
#include <linux/rfkill-wlan.h>
#endif
@@ -25,7 +18,7 @@
extern int dhd_static_buf_init(void);
extern void dhd_static_buf_exit(void);
#endif /* DHD_STATIC_IN_DRIVER */
-#if defined(BCMDHD_MDRIVER) && !defined(DHD_STATIC_IN_DRIVER)
+#ifdef BCMDHD_MDRIVER
extern void *dhd_wlan_mem_prealloc(uint bus_type, int index,
int section, unsigned long size);
#else
@@ -40,7 +33,7 @@
#ifdef BCMDHD_DTS
/* This is sample code in dts file.
-bcmdhd_wlan {
+bcmdhd {
compatible = "android,bcmdhd_wlan";
gpio_wl_reg_on = <&gpio GPIOH_4 GPIO_ACTIVE_HIGH>;
gpio_wl_host_wake = <&gpio GPIOZ_15 GPIO_ACTIVE_HIGH>;
@@ -69,7 +62,7 @@
#ifdef CUSTOMER_HW_ROCKCHIP
rockchip_wifi_power(1);
#ifdef BCMPCIE
-// rk_pcie_power_on_atu_fixup();
+ //rk_pcie_power_on_atu_fixup();
#endif
#endif
#ifdef BUS_POWER_RESTORE
@@ -134,14 +127,12 @@
return err;
}
-static int
-dhd_wlan_set_reset(int onoff)
+static int dhd_wlan_set_reset(int onoff)
{
return 0;
}
-static int
-dhd_wlan_set_carddetect(int present)
+static int dhd_wlan_set_carddetect(int present)
{
int err = 0;
@@ -165,7 +156,7 @@
err = sdhci_force_presence_change(&sdmmc_channel, 0);
#endif /* CUSTOMER_HW_PLATFORM */
#ifdef CUSTOMER_HW_ROCKCHIP
- rockchip_wifi_set_carddetect(0);
+ rockchip_wifi_set_carddetect(0);
#endif
#elif defined(BCMPCIE)
printf("======== Card detection to remove PCIE card! ========\n");
@@ -176,8 +167,7 @@
return err;
}
-static int
-dhd_wlan_get_mac_addr(unsigned char *buf, int ifidx)
+static int dhd_wlan_get_mac_addr(unsigned char *buf, int ifidx)
{
int err = 0;
@@ -275,17 +265,16 @@
.get_country_code = dhd_wlan_get_country_code,
};
-static int
-dhd_wlan_init_gpio(wifi_adapter_info_t *adapter)
+int dhd_wlan_init_gpio(wifi_adapter_info_t *adapter)
{
#ifdef BCMDHD_DTS
char wlan_node[32];
struct device_node *root_node = NULL;
#endif
int err = 0;
- int gpio_wl_reg_on = -1;
+ int gpio_wl_reg_on;
#ifdef CUSTOMER_OOB
- int gpio_wl_host_wake = -1;
+ int gpio_wl_host_wake;
int host_oob_irq = -1;
uint host_oob_irq_flags = 0;
#ifdef CUSTOMER_HW_ROCKCHIP
@@ -299,19 +288,9 @@
* WL_REG_ON and WL_HOST_WAKE.
*/
#ifdef BCMDHD_DTS
-#ifdef BCMDHD_PLATDEV
- if (adapter->pdev) {
- root_node = adapter->pdev->dev.of_node;
- strcpy(wlan_node, root_node->name);
- } else {
- printf("%s: adapter->pdev is NULL\n", __FUNCTION__);
- return -1;
- }
-#else
strcpy(wlan_node, DHD_DT_COMPAT_ENTRY);
- root_node = of_find_compatible_node(NULL, NULL, wlan_node);
-#endif
printf("======== Get GPIO from DTS(%s) ========\n", wlan_node);
+ root_node = of_find_compatible_node(NULL, NULL, wlan_node);
if (root_node) {
gpio_wl_reg_on = of_get_named_gpio(root_node, GPIO_WL_REG_ON_PROPNAME, 0);
#ifdef CUSTOMER_OOB
@@ -329,8 +308,8 @@
if (gpio_wl_reg_on >= 0) {
err = gpio_request(gpio_wl_reg_on, "WL_REG_ON");
if (err < 0) {
- printf("%s: gpio_request(%d) for WL_REG_ON failed %d\n",
- __FUNCTION__, gpio_wl_reg_on, err);
+ printf("%s: gpio_request(%d) for WL_REG_ON failed\n",
+ __FUNCTION__, gpio_wl_reg_on);
gpio_wl_reg_on = -1;
}
}
@@ -340,22 +319,22 @@
if (gpio_wl_host_wake >= 0) {
err = gpio_request(gpio_wl_host_wake, "bcmdhd");
if (err < 0) {
- printf("%s: gpio_request(%d) for WL_HOST_WAKE failed %d\n",
- __FUNCTION__, gpio_wl_host_wake, err);
+ printf("%s: gpio_request(%d) for WL_HOST_WAKE failed\n",
+ __FUNCTION__, gpio_wl_host_wake);
return -1;
}
adapter->gpio_wl_host_wake = gpio_wl_host_wake;
err = gpio_direction_input(gpio_wl_host_wake);
if (err < 0) {
- printf("%s: gpio_direction_input(%d) for WL_HOST_WAKE failed %d\n",
- __FUNCTION__, gpio_wl_host_wake, err);
+ printf("%s: gpio_direction_input(%d) for WL_HOST_WAKE failed\n",
+ __FUNCTION__, gpio_wl_host_wake);
gpio_free(gpio_wl_host_wake);
return -1;
}
host_oob_irq = gpio_to_irq(gpio_wl_host_wake);
if (host_oob_irq < 0) {
- printf("%s: gpio_to_irq(%d) for WL_HOST_WAKE failed %d\n",
- __FUNCTION__, gpio_wl_host_wake, host_oob_irq);
+ printf("%s: gpio_to_irq(%d) for WL_HOST_WAKE failed\n",
+ __FUNCTION__, gpio_wl_host_wake);
gpio_free(gpio_wl_host_wake);
return -1;
}
@@ -395,8 +374,7 @@
return 0;
}
-static void
-dhd_wlan_deinit_gpio(wifi_adapter_info_t *adapter)
+static void dhd_wlan_deinit_gpio(wifi_adapter_info_t *adapter)
{
int gpio_wl_reg_on = adapter->gpio_wl_reg_on;
#ifdef CUSTOMER_OOB
@@ -417,53 +395,14 @@
#endif /* CUSTOMER_OOB */
}
-#if defined(BCMDHD_MDRIVER)
-static void
-dhd_wlan_init_adapter(wifi_adapter_info_t *adapter)
-{
-#ifdef ADAPTER_IDX
- if (ADAPTER_IDX == 0) {
- adapter->bus_num = 1;
- adapter->slot_num = 1;
- } else if (ADAPTER_IDX == 1) {
- adapter->bus_num = 2;
- adapter->slot_num = 1;
- }
- adapter->index = ADAPTER_IDX;
-#ifdef BCMSDIO
- adapter->bus_type = SDIO_BUS;
-#elif defined(BCMPCIE)
- adapter->bus_type = PCI_BUS;
-#elif defined(BCMDBUS)
- adapter->bus_type = USB_BUS;
-#endif
- printf("bus_type=%d, bus_num=%d, slot_num=%d\n",
- adapter->bus_type, adapter->bus_num, adapter->slot_num);
-#endif /* ADAPTER_IDX */
-
-#ifdef DHD_STATIC_IN_DRIVER
- adapter->index = 0;
-#elif !defined(ADAPTER_IDX)
-#ifdef BCMSDIO
- adapter->index = 0;
-#elif defined(BCMPCIE)
- adapter->index = 1;
-#elif defined(BCMDBUS)
- adapter->index = 2;
-#endif
-#endif /* DHD_STATIC_IN_DRIVER */
-}
-#endif /* BCMDHD_MDRIVER */
-
-int
-dhd_wlan_init_plat_data(wifi_adapter_info_t *adapter)
+int dhd_wlan_init_plat_data(wifi_adapter_info_t *adapter)
{
int err = 0;
-#ifdef BCMDHD_MDRIVER
- dhd_wlan_init_adapter(adapter);
-#endif /* BCMDHD_MDRIVER */
-
+ printf("======== %s ========\n", __FUNCTION__);
+ if (adapter->index == -1) {
+ adapter->index = 0;
+ }
err = dhd_wlan_init_gpio(adapter);
if (err)
goto exit;
@@ -476,9 +415,9 @@
return err;
}
-void
-dhd_wlan_deinit_plat_data(wifi_adapter_info_t *adapter)
+void dhd_wlan_deinit_plat_data(wifi_adapter_info_t *adapter)
{
+ printf("======== %s ========\n", __FUNCTION__);
#ifdef DHD_STATIC_IN_DRIVER
dhd_static_buf_exit();
#endif
--
Gitblit v1.6.2