From 83bafa8ab0d929ca90cff251308185db1643cff6 Mon Sep 17 00:00:00 2001 From: coolsnowwolf Date: Wed, 16 Jan 2019 12:30:37 +0800 Subject: [PATCH] fix sbr-ac1750 MAC address and 5G --- .../etc/hotplug.d/firmware/10-ath9k-eeprom | 2 +- .../etc/hotplug.d/firmware/11-ath10k-caldata | 2 +- .../lib/preinit/05_set_iface_mac_ar71xx | 6 +++++ .../files/arch/mips/ath79/mach-sbr-ac1750.c | 26 +++++++------------ target/linux/ar71xx/image/nand.mk | 5 ++-- 5 files changed, 21 insertions(+), 20 deletions(-) diff --git a/target/linux/ar71xx/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom b/target/linux/ar71xx/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom index 95df764e4..52c9f29c0 100644 --- a/target/linux/ar71xx/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom +++ b/target/linux/ar71xx/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom @@ -85,7 +85,7 @@ case "$FIRMWARE" in ;; sbr-ac1750) ath9k_eeprom_extract "art" 4096 2048 - ath9k_patch_firmware_mac$(mtd_get_mac_binary art 0) + ath9k_patch_firmware_mac $(macaddr_add $(cat /sys/class/net/eth0/address) +1) ;; mr18) . /lib/upgrade/nand.sh diff --git a/target/linux/ar71xx/base-files/etc/hotplug.d/firmware/11-ath10k-caldata b/target/linux/ar71xx/base-files/etc/hotplug.d/firmware/11-ath10k-caldata index d48cca6d6..10138d434 100644 --- a/target/linux/ar71xx/base-files/etc/hotplug.d/firmware/11-ath10k-caldata +++ b/target/linux/ar71xx/base-files/etc/hotplug.d/firmware/11-ath10k-caldata @@ -136,7 +136,7 @@ case "$FIRMWARE" in ;; sbr-ac1750) ath10kcal_extract "art" 20480 2116 - ath10kcal_patch_mac $(mtd_get_mac_binary art 18) + ath10kcal_patch_mac_crc $(macaddr_add $(cat /sys/class/net/eth1/address) +1) ;; epg5000|\ esr1750) diff --git a/target/linux/ar71xx/base-files/lib/preinit/05_set_iface_mac_ar71xx b/target/linux/ar71xx/base-files/lib/preinit/05_set_iface_mac_ar71xx index dc69970c8..3cd9f2d45 100644 --- a/target/linux/ar71xx/base-files/lib/preinit/05_set_iface_mac_ar71xx +++ b/target/linux/ar71xx/base-files/lib/preinit/05_set_iface_mac_ar71xx @@ -58,6 +58,12 @@ preinit_set_mac_address() { wrt160nl) fetch_mac_from_mtd nvram lan_hwaddr wan_hwaddr ;; + sbr-ac1750) + mac_lan=$(mtd_get_mac_binary ft 0) + [ -n "$mac_lan" ] && ifconfig eth1 hw ether "$mac_lan" + mac_wan=$(mtd_get_mac_binary ft 4) + [ -n "$mac_wan" ] && ifconfig eth0 hw ether "$mac_wan" + ;; esac } diff --git a/target/linux/ar71xx/files/arch/mips/ath79/mach-sbr-ac1750.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-sbr-ac1750.c index fd421245a..7da7a04ff 100644 --- a/target/linux/ar71xx/files/arch/mips/ath79/mach-sbr-ac1750.c +++ b/target/linux/ar71xx/files/arch/mips/ath79/mach-sbr-ac1750.c @@ -65,7 +65,6 @@ #define SBR_AC1750_EXT_WDT_TIMEOUT_MS 200 #define SBR_AC1750_GPIO_EXT_WDT 18 -#define SBR_AC1750_HANG_UP 9 static struct timer_list gpio_wdt_timer; @@ -128,10 +127,10 @@ static struct ar8327_pad_cfg sbr_ac1750_qca8337_pad0_cfg = { }; static struct ar8327_led_cfg sbr_ac1750_ar8327_led_cfg = { - .led_ctrl0 = 0xcc35cc35, - .led_ctrl1 = 0xca35ca35, - .led_ctrl2 = 0xc935c935, - .led_ctrl3 = 0x3ffff00, + .led_ctrl0 = 0x0000cc35, + .led_ctrl1 = 0x0000ca35, + .led_ctrl2 = 0x0000c935, + .led_ctrl3 = 0x03ffff00, .open_drain = true, }; @@ -179,28 +178,23 @@ static void gpio_wdt_toggle(unsigned long gpio) jiffies + msecs_to_jiffies(SBR_AC1750_EXT_WDT_TIMEOUT_MS)); } -static void __init_watchdog(int gpio_wdt){ +static void init_sbr_ac1750_wdt(int gpio_wdt){ if (gpio_wdt >= 0) { gpio_request_one(gpio_wdt, GPIOF_OUT_INIT_HIGH, "watchdog"); + gpio_set_value(gpio_wdt, 0); + ndelay(1000); + gpio_set_value(gpio_wdt, 1); setup_timer(&gpio_wdt_timer, gpio_wdt_toggle, gpio_wdt); gpio_wdt_toggle(gpio_wdt); } } -static void exit_watchdog(void){ - - gpio_request_one(SBR_AC1750_GPIO_EXT_WDT, GPIOF_OUT_INIT_HIGH, "WATCHDOG EXIT"); - gpio_set_value(SBR_AC1750_GPIO_EXT_WDT, 0); - ndelay(1000); - gpio_set_value(SBR_AC1750_GPIO_EXT_WDT, 1); -} - static void __init sbr_ac1750_setup(void) { u8 *art = (u8 *) KSEG1ADDR(0x1fff0000); - exit_watchdog(); - __init_watchdog(SBR_AC1750_GPIO_EXT_WDT); + + init_sbr_ac1750_wdt(SBR_AC1750_GPIO_EXT_WDT); ath79_register_leds_gpio(-1, ARRAY_SIZE(sbr_ac1750_leds_gpio), sbr_ac1750_leds_gpio); diff --git a/target/linux/ar71xx/image/nand.mk b/target/linux/ar71xx/image/nand.mk index 34878ab6e..12b16ab6d 100644 --- a/target/linux/ar71xx/image/nand.mk +++ b/target/linux/ar71xx/image/nand.mk @@ -45,6 +45,7 @@ define Device/sbr-ac1750 BOARDNAME := SBR-AC1750 IMAGE_SIZE := 95m KERNEL_SIZE := 4096k + ROOTFS1_SIZE := 8192k BLOCKSIZE := 128k PAGESIZE := 2048 UBINIZE_OPTS := -E 5 @@ -52,8 +53,8 @@ define Device/sbr-ac1750 MTDPARTS := ar934x-nfc:1m(u-boot)ro,1m(u-boot-env)ro,4m(kernel),95m(ubi),1m(scfgmgr),4m(openwrt),1m(ft),2m(PKI),1m@0x6d00000(art)ro IMAGES := sysupgrade.tar kernel1.bin rootfs1.bin KERNEL := kernel-bin | patch-cmdline | lzma | uImage lzma - IMAGE/kernel1.bin := append-kernel | check-size $$$$(KERNEL_SIZE) - IMAGE/rootfs1.bin := append-ubi | check-size $$$$(IMAGE_SIZE) + IMAGE/kernel1.bin := append-kernel | pad-to $$$$(KERNEL_SIZE) | check-size $$$$(KERNEL_SIZE) + IMAGE/rootfs1.bin := append-ubi | pad-to $$$$(ROOTFS1_SIZE) | check-size $$$$(IMAGE_SIZE) IMAGE/sysupgrade.tar := sysupgrade-tar | append-metadata endef TARGET_DEVICES += sbr-ac1750