diff --git a/br-ext-chip-ingenic/configs/t31_ultimate_defconfig b/br-ext-chip-ingenic/configs/t31_ultimate_defconfig index a9af4f3b..b28d499c 100644 --- a/br-ext-chip-ingenic/configs/t31_ultimate_defconfig +++ b/br-ext-chip-ingenic/configs/t31_ultimate_defconfig @@ -103,6 +103,9 @@ BR2_PACKAGE_WPA_SUPPLICANT_NL80211=y BR2_PACKAGE_WPA_SUPPLICANT_PASSPHRASE=y BR2_PACKAGE_LINUX_FIRMWARE_OPENIPC=y BR2_PACKAGE_LINUX_FIRMWARE_OPENIPC_MEDIATEK_MT7601U=y +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 # WIREGUARD diff --git a/general/overlay/etc/wireless b/general/overlay/etc/wireless index d164951c..9a6b200d 100755 --- a/general/overlay/etc/wireless +++ b/general/overlay/etc/wireless @@ -104,4 +104,42 @@ if [ "$1" = "l716-t31-camhi" ]; then exit 0 fi +# T31 ATBM603X on SDIO bus mmc0 +if [ "$1" = "atbm603x-t31-mmc0" ]; then + # PB10 in wifi mmc1 is in the pull-down state by default, it needs to be set to a high-impedance state + devmem 0x10011128 32 0x400 + # set wifi mmc1 clk drive capability to 8mA + devmem 0x10011134 32 0x20000 + + # "insert" the bus mmc0 device + if [ "$(cat /sys/devices/platform/jzmmc_v1.2.0/present)" = "N" ]; then + echo "INSERT" > /sys/devices/platform/jzmmc_v1.2.0/present + sleep 1 + fi + + cp /usr/share/atbm603x_conf/atbm_txpwer_dcxo_cfg.txt /tmp + cp /usr/share/atbm603x_conf/set_rate_power.txt /tmp + # note, let this run on the background because if the firmware fails to load, it'll stall the OS startup + modprobe atbm603x_wifi_sdi0 + exit 0 +fi + +# T31 ATBM603X on SDIO bus mmc1 +if [ "$1" = "atbm603x-t31-mmc1" ]; then + # not sure what this does, but it's copied from the stock fw + devmem 0x10011110 32 0x6e094800 + + # "insert" the bus mmc1 device + if [ "$(cat /sys/devices/platform/jzmmc_v1.2.1/present)" = "N" ]; then + echo "INSERT" > /sys/devices/platform/jzmmc_v1.2.1/present + sleep 1 + fi + + cp /usr/share/atbm603x_conf/atbm_txpwer_dcxo_cfg.txt /tmp + cp /usr/share/atbm603x_conf/set_rate_power.txt /tmp + # note, let this run on the background because if the firmware fails to load, it'll stall the OS startup + modprobe atbm603x_wifi_sdi1 + exit 0 +fi + exit 1 diff --git a/general/package/Config.in b/general/package/Config.in index 92638df1..ac514377 100644 --- a/general/package/Config.in +++ b/general/package/Config.in @@ -31,6 +31,7 @@ source "$BR2_EXTERNAL_GENERAL_PATH/package/hisilicon-osdrv-hi3516ev200/Config.in source "$BR2_EXTERNAL_GENERAL_PATH/package/hisilicon-osdrv-hi3519v101/Config.in" source "$BR2_EXTERNAL_GENERAL_PATH/package/hisilicon-osdrv-hi3536dv100/Config.in" source "$BR2_EXTERNAL_GENERAL_PATH/package/i2c-telemetry/Config.in" +source "$BR2_EXTERNAL_GENERAL_PATH/package/ingenic-atbm603x-sdio-t31/Config.in" source "$BR2_EXTERNAL_GENERAL_PATH/package/ingenic-opensdk/Config.in" source "$BR2_EXTERNAL_GENERAL_PATH/package/ingenic-osdrv-t20/Config.in" source "$BR2_EXTERNAL_GENERAL_PATH/package/ingenic-osdrv-t21/Config.in" diff --git a/general/package/ingenic-atbm603x-sdio-t31/Config.in b/general/package/ingenic-atbm603x-sdio-t31/Config.in new file mode 100644 index 00000000..c39ae54f --- /dev/null +++ b/general/package/ingenic-atbm603x-sdio-t31/Config.in @@ -0,0 +1,24 @@ +config BR2_PACKAGE_INGENIC_ATBM603X_SDIO_T31 + bool "ingenic-atbm603x-sdio-t31" + help + ingenic-atbm603x-sdio-t31 - Ingenic kernel module for the ATBM603X, on SDIO bus. + +comment "ATBM603X needs a Linux kernel to be built" + depends on !BR2_PACKAGE_INGENIC_OSDRV_T31 + + +if BR2_PACKAGE_INGENIC_ATBM603X_SDIO_T31 + +config BR2_PACKAGE_INGENIC_ATBM603X_SDIO_T31_MMC0 + bool "ingenic-atbm603x-sdio-t31-mmc0" + default y + help + ingenic-atbm603x-sdio-t31-mmc0 - Provide the driver that loads on bus MMC0. + +config BR2_PACKAGE_INGENIC_ATBM603X_SDIO_T31_MMC1 + bool "ingenic-atbm603x-sdio-t31-mmc1" + default y + help + ingenic-atbm603x-sdio-t31-mmc1 - Provide the driver that loads on bus MMC1. + +endif diff --git a/general/package/ingenic-atbm603x-sdio-t31/files/atbm603x_wifi_sdi0.ko b/general/package/ingenic-atbm603x-sdio-t31/files/atbm603x_wifi_sdi0.ko new file mode 100644 index 00000000..f4504fd2 Binary files /dev/null and b/general/package/ingenic-atbm603x-sdio-t31/files/atbm603x_wifi_sdi0.ko differ diff --git a/general/package/ingenic-atbm603x-sdio-t31/files/atbm603x_wifi_sdi1.ko b/general/package/ingenic-atbm603x-sdio-t31/files/atbm603x_wifi_sdi1.ko new file mode 100644 index 00000000..45db18c3 Binary files /dev/null and b/general/package/ingenic-atbm603x-sdio-t31/files/atbm603x_wifi_sdi1.ko differ diff --git a/general/package/ingenic-atbm603x-sdio-t31/files/atbm_txpwer_dcxo_cfg.txt b/general/package/ingenic-atbm603x-sdio-t31/files/atbm_txpwer_dcxo_cfg.txt new file mode 100644 index 00000000..a92b4657 --- /dev/null +++ b/general/package/ingenic-atbm603x-sdio-t31/files/atbm_txpwer_dcxo_cfg.txt @@ -0,0 +1,3 @@ +delta_gain1:-1 delta_gain2:-1 delta_gain3:-1 dcxo:-1 +b_delta_gain1:10 b_delta_gain2:12 b_delta_gain3:15 +gn_delta_gain1:10 gn_delta_gain2:8 gn_delta_gain3:12 \ No newline at end of file diff --git a/general/package/ingenic-atbm603x-sdio-t31/files/set_rate_power.txt b/general/package/ingenic-atbm603x-sdio-t31/files/set_rate_power.txt new file mode 100644 index 00000000..28fc5cbe --- /dev/null +++ b/general/package/ingenic-atbm603x-sdio-t31/files/set_rate_power.txt @@ -0,0 +1,11 @@ +b_1M_2M=0 +b_5_5M_11M=0 +g_6M_n_6_5M=0 +g_9M=0 +g_12M_n_13M=0 +g_18M_n_19_5M=0 +g_24M_n_26M=0 +g_36M_n_39M=0 +g_48M_n_52M=0 +g_54M_n_58_5M=0 +n_65M=2 \ No newline at end of file diff --git a/general/package/ingenic-atbm603x-sdio-t31/ingenic-atbm603x-sdio-t31.mk b/general/package/ingenic-atbm603x-sdio-t31/ingenic-atbm603x-sdio-t31.mk new file mode 100644 index 00000000..29fff02d --- /dev/null +++ b/general/package/ingenic-atbm603x-sdio-t31/ingenic-atbm603x-sdio-t31.mk @@ -0,0 +1,24 @@ +################################################################################ +# +# ingenic-atbm603x-sdio-t31 +# +################################################################################ + +INGENIC_ATBM603X_SDIO_T31_VERSION = +INGENIC_ATBM603X_SDIO_T31_SITE = +INGENIC_ATBM603X_SDIO_T31_LICENSE = GPL-2.0 +INGENIC_ATBM603X_SDIO_T31_LICENSE_FILES = LICENSE + +define INGENIC_ATBM603X_SDIO_T31_INSTALL_TARGET_CMDS + $(INSTALL) -m 755 -d $(TARGET_DIR)/lib/modules/3.10.14__isvp_swan_1.0__/extra + $(INSTALL) -m 755 -d $(TARGET_DIR)/usr/share/atbm603x_conf + $(INSTALL) -m 644 -t $(TARGET_DIR)/usr/share/atbm603x_conf $(INGENIC_ATBM603X_SDIO_T31_PKGDIR)/files/*.txt + + $(if $(BR2_PACKAGE_INGENIC_ATBM603X_SDIO_T31_MMC0),\ + $(INSTALL) -m 644 -t $(TARGET_DIR)/lib/modules/3.10.14__isvp_swan_1.0__/extra $(INGENIC_ATBM603X_SDIO_T31_PKGDIR)/files/atbm603x_wifi_sdi0.ko) + + $(if $(BR2_PACKAGE_INGENIC_ATBM603X_SDIO_T31_MMC1),\ + $(INSTALL) -m 644 -t $(TARGET_DIR)/lib/modules/3.10.14__isvp_swan_1.0__/extra $(INGENIC_ATBM603X_SDIO_T31_PKGDIR)/files/atbm603x_wifi_sdi1.ko) +endef + +$(eval $(generic-package))