rtl8189fs-openipc: add support for Ingenic T31 to wlan driver

pull/961/head
gtxaspec 2023-08-18 06:58:29 -07:00
parent 011fe1a9ab
commit 062497a41b
4 changed files with 90 additions and 0 deletions

View File

@ -107,6 +107,8 @@ BR2_PACKAGE_INGENIC_ATBM603X_SDIO_T31=y
BR2_PACKAGE_INGENIC_ATBM603X_SDIO_T31_MMC0=y
BR2_PACKAGE_INGENIC_ATBM603X_SDIO_T31_MMC1=y
# BR2_PACKAGE_RTL8188EU is not set
BR2_PACKAGE_RTL8189FS_OPENIPC=y
BR2_PACKAGE_RTL8189FS_OPENIPC_INGENIC=y
# Motors
BR2_PACKAGE_INGENIC_MOTORS_T31=y

View File

@ -0,0 +1,75 @@
--- a/platform/platform_ingenic_sdio.c 1969-12-31 16:00:00.000000000 -0800
+++ b/platform/platform_ingenic_sdio.c 2023-08-17 23:00:32.781683075 -0700
@@ -0,0 +1,59 @@
+#include <linux/mmc/host.h>
+#include <linux/fs.h>
+#include <linux/wlan_plat.h>
+#include <asm/uaccess.h>
+#include <linux/platform_device.h>
+#include <linux/regulator/consumer.h>
+#include <linux/gpio.h>
+#include <linux/wakelock.h>
+#include <linux/err.h>
+#include <linux/delay.h>
+#include <mach/jzmmc.h>
+#include <linux/bcm_pm_core.h>
+
+#include <gpio.h>
+#include <soc/gpio.h>
+
+#define GPIO_WIFI_WAKEUP GPIO_PC(17)
+#define GPIO_WIFI_RST_N GPIO_PC(16)
+#define SDIO_WIFI_POWER GPIO_PB(25)
+#define WLAN_SDIO_INDEX 1
+
+/* static int wl_pw_en = 0; */
+extern void rtc32k_enable(void);
+extern void rtc32k_disable(void);
+
+void wlan_pw_en_enable(void)
+{
+}
+
+void wlan_pw_en_disable(void)
+{
+}
+
+
+/*
+ On T31 devices, we call jzmmc_manual_detect() to force a re-scan SDIO card on the mmc bus
+*/
+int platform_wifi_power_on(void)
+{
+
+ /* gpio_request(SDIO_WIFI_POWER, "sdio_wifi_power_on");
+ gpio_direction_output(SDIO_WIFI_POWER, 1);
+ printk("wlan power on\n");
+ msleep(10); */
+
+ jzmmc_manual_detect(WLAN_SDIO_INDEX, 1);
+ printk("jzmmc manual detect complete\n");
+
+ return 0;
+}
+
+int platform_wifi_power_off(void)
+{
+ /* gpio_free(SDIO_WIFI_POWER);
+ gpio_direction_output(SDIO_WIFI_POWER, 0);
+ printk("wlan power off\n"); */
+ printk("wlan power off called\n");
+ return 0;
+}
--- a/Makefile 2023-08-17 23:28:30.921779207 -0700
+++ b/Makefile 2023-08-17 23:28:10.009147387 -0700
@@ -250,7 +250,8 @@
EXTRA_CFLAGS += -I$(src)/platform
-_PLATFORM_FILES := platform/platform_ops.o
+#_PLATFORM_FILES := platform/platform_ops.o
+_PLATFORM_FILES := platform/platform_ingenic_sdio.o
EXTRA_CFLAGS += -I$(src)/hal/btc

View File

@ -8,3 +8,12 @@ config BR2_PACKAGE_RTL8189FS_OPENIPC
comment "rtl8189fs needs a Linux kernel to be built"
depends on !BR2_LINUX_KERNEL
if BR2_PACKAGE_RTL8189FS_OPENIPC
config BR2_PACKAGE_RTL8189FS_OPENIPC_INGENIC
bool "rtl8189fs_openipc_ingenic"
default n
help
Certain Ingenic T31 devices require the driver to manually force a re-scan of the sdio bus after the GPIO is enabled for WLAN to function, select to enable support.
endif

View File

@ -20,5 +20,9 @@ RTL8189FS_OPENIPC_MODULE_MAKE_OPTS = CONFIG_RTL8189FS=m \
KVER=$(LINUX_VERSION_PROBED) \
KSRC=$(LINUX_DIR)
ifeq ($(BR2_PACKAGE_RTL8189FS_OPENIPC_INGENIC),y)
RTL8189FS_OPENIPC_PATCHES += 0002-ingenic_sdio.patch
endif
$(eval $(kernel-module))
$(eval $(generic-package))