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 | 89 +++++++++++---------------------------------
1 files changed, 22 insertions(+), 67 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 714afe2..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,5 +1,4 @@
/* SPDX-License-Identifier: GPL-2.0 */
-
#include <osl.h>
#include <dhd_linux.h>
#include <linux/gpio.h>
@@ -19,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
@@ -63,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
@@ -128,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;
@@ -170,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;
@@ -269,8 +265,7 @@
.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];
@@ -313,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;
}
}
@@ -324,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;
}
@@ -379,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
@@ -401,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;
@@ -460,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