diff --git a/package/boot/uboot-envtools/files/ramips b/package/boot/uboot-envtools/files/ramips index ade55dd1cb..0c8e203b17 100644 --- a/package/boot/uboot-envtools/files/ramips +++ b/package/boot/uboot-envtools/files/ramips @@ -33,6 +33,7 @@ xiaomi,miwifi-nano|\ zbtlink,zbt-wg2626) ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x1000" "0x10000" ;; +linksys,ea7500-v2|\ xiaomi,mir3p|\ xiaomi,mir3g) ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x1000" "0x20000" diff --git a/package/kernel/gpio-nct5104d/src/gpio-nct5104d.c b/package/kernel/gpio-nct5104d/src/gpio-nct5104d.c index 8da7580562..8f180edd33 100644 --- a/package/kernel/gpio-nct5104d/src/gpio-nct5104d.c +++ b/package/kernel/gpio-nct5104d/src/gpio-nct5104d.c @@ -276,11 +276,7 @@ static int nct5104d_gpio_probe(struct platform_device *pdev) for (i = 0; i < data->nr_bank; i++) { struct nct5104d_gpio_bank *bank = &data->bank[i]; -#if LINUX_VERSION_CODE < KERNEL_VERSION(4,5,0) - bank->chip.dev = &pdev->dev; -#else bank->chip.parent = &pdev->dev; -#endif bank->data = data; err = gpiochip_add(&bank->chip); @@ -298,15 +294,7 @@ err_gpiochip: for (i = i - 1; i >= 0; i--) { struct nct5104d_gpio_bank *bank = &data->bank[i]; -#if LINUX_VERSION_CODE < KERNEL_VERSION(3,18,0) - int rm_err = gpiochip_remove(&bank->chip); - if (rm_err < 0) - dev_err(&pdev->dev, - "Failed to remove gpiochip %d: %d\n", - i, rm_err); -#else /* LINUX_VERSION_CODE < KERNEL_VERSION(3,18,0) */ gpiochip_remove (&bank->chip); -#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(3,18,0) */ } return err; @@ -320,17 +308,7 @@ static int nct5104d_gpio_remove(struct platform_device *pdev) for (i = 0; i < data->nr_bank; i++) { struct nct5104d_gpio_bank *bank = &data->bank[i]; -#if LINUX_VERSION_CODE < KERNEL_VERSION(3,18,0) - int err = gpiochip_remove(&bank->chip); - if (err) { - dev_err(&pdev->dev, - "Failed to remove GPIO gpiochip %d: %d\n", - i, err); - return err; - } -#else /* LINUX_VERSION_CODE < KERNEL_VERSION(3,18,0) */ gpiochip_remove (&bank->chip); -#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(3,18,0) */ } return 0; diff --git a/package/kernel/lantiq/ltq-adsl-mei/src/ifxmips_mei_interface.h b/package/kernel/lantiq/ltq-adsl-mei/src/ifxmips_mei_interface.h index dc9f1c241b..e5089c43a3 100644 --- a/package/kernel/lantiq/ltq-adsl-mei/src/ifxmips_mei_interface.h +++ b/package/kernel/lantiq/ltq-adsl-mei/src/ifxmips_mei_interface.h @@ -111,11 +111,7 @@ static inline long ugly_hack_sleep_on_timeout(wait_queue_head_t *q, long timeout) { unsigned long flags; -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,13,0)) wait_queue_entry_t wait; -#else - wait_queue_t wait; -#endif init_waitqueue_entry(&wait, current); @@ -523,9 +519,7 @@ typedef struct DSL_DEV_Device #define IFX_DFEIR 0 #define IFX_DYING_GASP 1 DSL_DEV_MeiDebug_t lop_debugwr; /* dying gasp */ -#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,0)) struct module *owner; -#endif } DSL_DEV_Device_t; /* ifx_adsl_device_t */ #define DSL_DEV_PRIVATE(dev) ((ifx_mei_device_private_t*)(dev->pPriv)) diff --git a/package/kernel/lantiq/ltq-atm/src/ifxmips_atm_vr9.c b/package/kernel/lantiq/ltq-atm/src/ifxmips_atm_vr9.c index 8638b12b4e..85f27156b5 100644 --- a/package/kernel/lantiq/ltq-atm/src/ifxmips_atm_vr9.c +++ b/package/kernel/lantiq/ltq-atm/src/ifxmips_atm_vr9.c @@ -60,7 +60,6 @@ static inline void vr9_reset_ppe(struct platform_device *pdev) { -#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,14,0) struct device *dev = &pdev->dev; struct reset_control *dsp; struct reset_control *dfe; @@ -97,7 +96,6 @@ static inline void vr9_reset_ppe(struct platform_device *pdev) udelay(1000); *PP32_SRST |= 0x000303CF; udelay(1000); -#endif } static inline int vr9_pp32_download_code(int pp32, u32 *code_src, unsigned int code_dword_len, u32 *data_src, unsigned int data_dword_len) diff --git a/package/kernel/lantiq/ltq-atm/src/ltq_atm.c b/package/kernel/lantiq/ltq-atm/src/ltq_atm.c index 267a515df6..f5dbfaae2d 100644 --- a/package/kernel/lantiq/ltq-atm/src/ltq_atm.c +++ b/package/kernel/lantiq/ltq-atm/src/ltq_atm.c @@ -1809,11 +1809,7 @@ static int ltq_atm_probe(struct platform_device *pdev) } /* register interrupt handler */ -#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,1,0) ret = request_irq(PPE_MAILBOX_IGU1_INT, mailbox_irq_handler, 0, "atm_mailbox_isr", &g_atm_priv_data); -#else - ret = request_irq(PPE_MAILBOX_IGU1_INT, mailbox_irq_handler, IRQF_DISABLED, "atm_mailbox_isr", &g_atm_priv_data); -#endif if ( ret ) { if ( ret == -EBUSY ) { pr_err("IRQ may be occupied by other driver, please reconfig to disable it.\n"); diff --git a/package/kernel/lantiq/ltq-deu/src/ifxmips_aes.c b/package/kernel/lantiq/ltq-deu/src/ifxmips_aes.c index 6c8d065d8b..76abfafb4e 100644 --- a/package/kernel/lantiq/ltq-deu/src/ifxmips_aes.c +++ b/package/kernel/lantiq/ltq-deu/src/ifxmips_aes.c @@ -895,18 +895,6 @@ int ifxdeu_init_aes (void) int ret = -ENOSYS; - -#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)) - if (!disable_multiblock) { - ifxdeu_aes_alg.cra_u.cipher.cia_max_nbytes = AES_BLOCK_SIZE; //(size_t)-1; - ifxdeu_aes_alg.cra_u.cipher.cia_req_align = 16; - ifxdeu_aes_alg.cra_u.cipher.cia_ecb = ifx_deu_aes_ecb; - ifxdeu_aes_alg.cra_u.cipher.cia_cbc = ifx_deu_aes_cbc; - ifxdeu_aes_alg.cra_u.cipher.cia_cfb = ifx_deu_aes_cfb; - ifxdeu_aes_alg.cra_u.cipher.cia_ofb = ifx_deu_aes_ofb; - } -#endif - if ((ret = crypto_register_alg(&ifxdeu_aes_alg))) goto aes_err; diff --git a/package/kernel/lantiq/ltq-deu/src/ifxmips_async_aes.c b/package/kernel/lantiq/ltq-deu/src/ifxmips_async_aes.c index 15e1485912..dcd059371f 100644 --- a/package/kernel/lantiq/ltq-deu/src/ifxmips_async_aes.c +++ b/package/kernel/lantiq/ltq-deu/src/ifxmips_async_aes.c @@ -100,11 +100,7 @@ extern char debug_level; static int disable_multiblock = 0; -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0) module_param(disable_multiblock, int, 0); -#else -MODULE_PARM_DESC(disable_multiblock, "Disable encryption of whole multiblock buffers"); -#endif static int disable_deudma = 1; diff --git a/package/kernel/lantiq/ltq-deu/src/ifxmips_async_des.c b/package/kernel/lantiq/ltq-deu/src/ifxmips_async_des.c index ea94c6460f..1523763ccd 100644 --- a/package/kernel/lantiq/ltq-deu/src/ifxmips_async_des.c +++ b/package/kernel/lantiq/ltq-deu/src/ifxmips_async_des.c @@ -117,11 +117,7 @@ struct des_ctx { static int disable_multiblock = 0; -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0) module_param(disable_multiblock, int, 0); -#else -MODULE_PARM_DESC(disable_multiblock, "Disable encryption of whole multiblock buffers"); -#endif static int disable_deudma = 1; @@ -893,16 +889,6 @@ int __init lqdeu_async_des_init (void) { int i, j, ret = -EINVAL; -#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)) - if (!disable_multiblock) { - ifxdeu_des_alg.cra_u.cipher.cia_max_nbytes = DES_BLOCK_SIZE; //(size_t)-1; - ifxdeu_des_alg.cra_u.cipher.cia_req_align = 16; - ifxdeu_des_alg.cra_u.cipher.cia_ecb = ifx_deu_des_ecb; - ifxdeu_des_alg.cra_u.cipher.cia_cbc = ifx_deu_des_cbc; - ifxdeu_des_alg.cra_u.cipher.cia_cfb = ifx_deu_des_cfb; - ifxdeu_des_alg.cra_u.cipher.cia_ofb = ifx_deu_des_ofb; - } -#endif for (i = 0; i < ARRAY_SIZE(des_drivers_alg); i++) { ret = crypto_register_alg(&des_drivers_alg[i].alg); //printk("driver: %s\n", des_drivers_alg[i].alg.cra_name); diff --git a/package/kernel/lantiq/ltq-deu/src/ifxmips_des.c b/package/kernel/lantiq/ltq-deu/src/ifxmips_des.c index beb67075ee..6d7d82fcb9 100644 --- a/package/kernel/lantiq/ltq-deu/src/ifxmips_des.c +++ b/package/kernel/lantiq/ltq-deu/src/ifxmips_des.c @@ -691,17 +691,6 @@ int ifxdeu_init_des (void) int ret = -ENOSYS; -#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)) - if (!disable_multiblock) { - ifxdeu_des_alg.cra_u.cipher.cia_max_nbytes = DES_BLOCK_SIZE; //(size_t)-1; - ifxdeu_des_alg.cra_u.cipher.cia_req_align = 16; - ifxdeu_des_alg.cra_u.cipher.cia_ecb = ifx_deu_des_ecb; - ifxdeu_des_alg.cra_u.cipher.cia_cbc = ifx_deu_des_cbc; - ifxdeu_des_alg.cra_u.cipher.cia_cfb = ifx_deu_des_cfb; - ifxdeu_des_alg.cra_u.cipher.cia_ofb = ifx_deu_des_ofb; - } -#endif - ret = crypto_register_alg(&ifxdeu_des_alg); if (ret < 0) goto des_err; diff --git a/package/kernel/lantiq/ltq-deu/src/ifxmips_deu.c b/package/kernel/lantiq/ltq-deu/src/ifxmips_deu.c index 05f168160b..3947b31a40 100644 --- a/package/kernel/lantiq/ltq-deu/src/ifxmips_deu.c +++ b/package/kernel/lantiq/ltq-deu/src/ifxmips_deu.c @@ -171,14 +171,8 @@ static int ltq_deu_remove(struct platform_device *pdev) int disable_multiblock = 0; -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0) module_param(disable_multiblock,int,0); -#else -//MODULE_PARM (disable_multiblock, "i"); -MODULE_PARM_DESC (disable_multiblock, - "Disable encryption of whole multiblock buffers."); -#endif static const struct of_device_id ltq_deu_match[] = { #ifdef CONFIG_DANUBE diff --git a/package/kernel/lantiq/ltq-deu/src/ifxmips_deu_dma.h b/package/kernel/lantiq/ltq-deu/src/ifxmips_deu_dma.h index b64d74776b..7a1b85f1d1 100644 --- a/package/kernel/lantiq/ltq-deu/src/ifxmips_deu_dma.h +++ b/package/kernel/lantiq/ltq-deu/src/ifxmips_deu_dma.h @@ -54,11 +54,7 @@ typedef struct ifx_deu_device { int recv_count; int packet_size; int packet_num; -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,13,0)) wait_queue_entry_t wait; -#else - wait_queue_t wait; -#endif } _ifx_deu_device; extern _ifx_deu_device ifx_deu[1]; diff --git a/package/kernel/lantiq/ltq-ptm/src/ifxmips_ptm_adsl.c b/package/kernel/lantiq/ltq-ptm/src/ifxmips_ptm_adsl.c index 186c848693..18c715a290 100644 --- a/package/kernel/lantiq/ltq-ptm/src/ifxmips_ptm_adsl.c +++ b/package/kernel/lantiq/ltq-ptm/src/ifxmips_ptm_adsl.c @@ -61,12 +61,8 @@ * Kernel Version Adaption * #################################### */ -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,11) #define MODULE_PARM_ARRAY(a, b) module_param_array(a, int, NULL, 0) #define MODULE_PARM(a, b) module_param(a, int, 0) -#else - #define MODULE_PARM_ARRAY(a, b) MODULE_PARM(a, b) -#endif @@ -130,9 +126,6 @@ static int ptm_stop(struct net_device *); static unsigned int ptm_poll(int, unsigned int); static int ptm_napi_poll(struct napi_struct *, int); static int ptm_hard_start_xmit(struct sk_buff *, struct net_device *); -#if (LINUX_VERSION_CODE < KERNEL_VERSION(4,10,0)) -static int ptm_change_mtu(struct net_device *, int); -#endif static int ptm_ioctl(struct net_device *, struct ifreq *, int); static void ptm_tx_timeout(struct net_device *); @@ -243,7 +236,6 @@ static INLINE void init_tables(void); static struct ptm_priv_data g_ptm_priv_data; -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,32) static struct net_device_ops g_ptm_netdev_ops = { .ndo_get_stats = ptm_get_stats, .ndo_open = ptm_open, @@ -251,13 +243,9 @@ static struct net_device_ops g_ptm_netdev_ops = { .ndo_start_xmit = ptm_hard_start_xmit, .ndo_validate_addr = eth_validate_addr, .ndo_set_mac_address = eth_mac_addr, -#if (LINUX_VERSION_CODE < KERNEL_VERSION(4,10,0)) - .ndo_change_mtu = ptm_change_mtu, -#endif .ndo_do_ioctl = ptm_ioctl, .ndo_tx_timeout = ptm_tx_timeout, }; -#endif static struct net_device *g_net_dev[2] = {0}; static char *g_net_dev_name[2] = {"dsl0", "dslfast0"}; @@ -291,10 +279,8 @@ static void ptm_setup(struct net_device *dev, int ndev) /* hook network operations */ dev->netdev_ops = &g_ptm_netdev_ops; -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,10,0)) /* Allow up to 1508 bytes, for RFC4638 */ dev->max_mtu = ETH_DATA_LEN + 8; -#endif netif_napi_add(dev, &g_ptm_priv_data.itf[ndev].napi, ptm_napi_poll, 25); dev->watchdog_timeo = ETH_WATCHDOG_TIMEOUT; @@ -415,11 +401,7 @@ static int ptm_hard_start_xmit(struct sk_buff *skb, struct net_device *dev) /* allocate descriptor */ desc_base = get_tx_desc(ndev, &f_full); if ( f_full ) { -#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,7,0) netif_trans_update(dev); -#else - dev->trans_start = jiffies; -#endif netif_stop_queue(dev); IFX_REG_W32_MASK(0, 1 << (ndev + 16), MBOX_IGU1_ISRC); @@ -453,11 +435,7 @@ static int ptm_hard_start_xmit(struct sk_buff *skb, struct net_device *dev) g_ptm_priv_data.itf[ndev].stats.tx_packets++; g_ptm_priv_data.itf[ndev].stats.tx_bytes += reg_desc.datalen; -#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,7,0) netif_trans_update(dev); -#else - dev->trans_start = jiffies; -#endif mailbox_signal(ndev, 1); adsl_led_flash(); @@ -469,16 +447,6 @@ PTM_HARD_START_XMIT_FAIL: g_ptm_priv_data.itf[ndev].stats.tx_dropped++; return NETDEV_TX_OK; } -#if (LINUX_VERSION_CODE < KERNEL_VERSION(4,10,0)) -static int ptm_change_mtu(struct net_device *dev, int mtu) -{ - /* Allow up to 1508 bytes, for RFC4638 */ - if (mtu < 68 || mtu > ETH_DATA_LEN + 8) - return -EINVAL; - dev->mtu = mtu; - return 0; -} -#endif static int ptm_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) { @@ -665,10 +633,6 @@ static INLINE int mailbox_rx_irq_handler(unsigned int ch) // return: < 0 - de skb->dev = g_net_dev[ndev]; skb->protocol = eth_type_trans(skb, skb->dev); -#if (LINUX_VERSION_CODE < KERNEL_VERSION(4,11,0)) - g_net_dev[ndev]->last_rx = jiffies; -#endif - netif_rx_ret = netif_receive_skb(skb); if ( netif_rx_ret != NET_RX_DROP ) { @@ -1513,11 +1477,7 @@ static int ltq_ptm_probe(struct platform_device *pdev) } /* register interrupt handler */ -#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,1,0) ret = request_irq(PPE_MAILBOX_IGU1_INT, mailbox_irq_handler, 0, "ptm_mailbox_isr", &g_ptm_priv_data); -#else - ret = request_irq(PPE_MAILBOX_IGU1_INT, mailbox_irq_handler, IRQF_DISABLED, "ptm_mailbox_isr", &g_ptm_priv_data); -#endif if ( ret ) { if ( ret == -EBUSY ) { err("IRQ may be occupied by other driver, please reconfig to disable it."); diff --git a/package/kernel/lantiq/ltq-ptm/src/ifxmips_ptm_vdsl.c b/package/kernel/lantiq/ltq-ptm/src/ifxmips_ptm_vdsl.c index 46a52e29d8..f77f475656 100644 --- a/package/kernel/lantiq/ltq-ptm/src/ifxmips_ptm_vdsl.c +++ b/package/kernel/lantiq/ltq-ptm/src/ifxmips_ptm_vdsl.c @@ -76,9 +76,6 @@ static int ptm_stop(struct net_device *); static unsigned int ptm_poll(int, unsigned int); static int ptm_napi_poll(struct napi_struct *, int); static int ptm_hard_start_xmit(struct sk_buff *, struct net_device *); -#if (LINUX_VERSION_CODE < KERNEL_VERSION(4,10,0)) -static int ptm_change_mtu(struct net_device *, int); -#endif static int ptm_ioctl(struct net_device *, struct ifreq *, int); static void ptm_tx_timeout(struct net_device *); @@ -119,9 +116,6 @@ static struct net_device_ops g_ptm_netdev_ops = { .ndo_start_xmit = ptm_hard_start_xmit, .ndo_validate_addr = eth_validate_addr, .ndo_set_mac_address = eth_mac_addr, -#if (LINUX_VERSION_CODE < KERNEL_VERSION(4,10,0)) - .ndo_change_mtu = ptm_change_mtu, -#endif .ndo_do_ioctl = ptm_ioctl, .ndo_tx_timeout = ptm_tx_timeout, }; @@ -147,10 +141,8 @@ static void ptm_setup(struct net_device *dev, int ndev) netif_carrier_off(dev); dev->netdev_ops = &g_ptm_netdev_ops; -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,10,0)) /* Allow up to 1508 bytes, for RFC4638 */ dev->max_mtu = ETH_DATA_LEN + 8; -#endif netif_napi_add(dev, &g_ptm_priv_data.itf[ndev].napi, ptm_napi_poll, 16); dev->watchdog_timeo = ETH_WATCHDOG_TIMEOUT; @@ -228,10 +220,6 @@ static unsigned int ptm_poll(int ndev, unsigned int work_to_do) skb->dev = g_net_dev[0]; skb->protocol = eth_type_trans(skb, skb->dev); -#if (LINUX_VERSION_CODE < KERNEL_VERSION(4,11,0)) - g_net_dev[0]->last_rx = jiffies; -#endif - netif_receive_skb(skb); g_ptm_priv_data.itf[0].stats.rx_packets++; @@ -301,11 +289,7 @@ static int ptm_hard_start_xmit(struct sk_buff *skb, struct net_device *dev) /* allocate descriptor */ desc_base = get_tx_desc(0, &f_full); if ( f_full ) { -#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,7,0) netif_trans_update(dev); -#else - dev->trans_start = jiffies; -#endif netif_stop_queue(dev); IFX_REG_W32_MASK(0, 1 << 17, MBOX_IGU1_ISRC); @@ -367,11 +351,7 @@ static int ptm_hard_start_xmit(struct sk_buff *skb, struct net_device *dev) wmb(); *(volatile unsigned int *)desc = *(unsigned int *)®_desc; -#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,7,0) netif_trans_update(dev); -#else - dev->trans_start = jiffies; -#endif return 0; @@ -382,17 +362,6 @@ PTM_HARD_START_XMIT_FAIL: return 0; } -#if (LINUX_VERSION_CODE < KERNEL_VERSION(4,10,0)) -static int ptm_change_mtu(struct net_device *dev, int mtu) -{ - /* Allow up to 1508 bytes, for RFC4638 */ - if (mtu < 68 || mtu > ETH_DATA_LEN + 8) - return -EINVAL; - dev->mtu = mtu; - return 0; -} -#endif - static int ptm_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) { ASSERT(dev == g_net_dev[0], "incorrect device"); @@ -1024,11 +993,7 @@ static int ltq_ptm_probe(struct platform_device *pdev) } /* register interrupt handler */ -#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,1,0) ret = request_irq(PPE_MAILBOX_IGU1_INT, mailbox_irq_handler, 0, "ptm_mailbox_isr", &g_ptm_priv_data); -#else - ret = request_irq(PPE_MAILBOX_IGU1_INT, mailbox_irq_handler, IRQF_DISABLED, "ptm_mailbox_isr", &g_ptm_priv_data); -#endif if ( ret ) { if ( ret == -EBUSY ) { err("IRQ may be occupied by other driver, please reconfig to disable it."); diff --git a/package/kernel/lantiq/ltq-ptm/src/ifxmips_ptm_vr9.c b/package/kernel/lantiq/ltq-ptm/src/ifxmips_ptm_vr9.c index cf0897b563..bf93437fb0 100644 --- a/package/kernel/lantiq/ltq-ptm/src/ifxmips_ptm_vr9.c +++ b/package/kernel/lantiq/ltq-ptm/src/ifxmips_ptm_vr9.c @@ -84,7 +84,6 @@ static inline void uninit_pmu(void) static inline void reset_ppe(struct platform_device *pdev) { -#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,14,0) struct device *dev = &pdev->dev; struct reset_control *dsp; struct reset_control *dfe; @@ -121,7 +120,6 @@ static inline void reset_ppe(struct platform_device *pdev) udelay(1000); *PP32_SRST |= 0x000303CF; udelay(1000); -#endif } static inline void init_pdma(void) diff --git a/package/kernel/leds-apu2/src/leds-apu2.c b/package/kernel/leds-apu2/src/leds-apu2.c index ff13b3cde1..ef125c8768 100644 --- a/package/kernel/leds-apu2/src/leds-apu2.c +++ b/package/kernel/leds-apu2/src/leds-apu2.c @@ -194,11 +194,7 @@ static int gpio_apu2_probe (struct platform_device *dev) } } -#if LINUX_VERSION_CODE < KERNEL_VERSION(4,5,0) - gpio_apu2_chip.dev = &dev->dev; -#else gpio_apu2_chip.parent = &dev->dev; -#endif ret = gpiochip_add (&gpio_apu2_chip); if (ret) { pr_err ("%s: adding gpiochip failed\n", DEVNAME); @@ -209,12 +205,7 @@ static int gpio_apu2_probe (struct platform_device *dev) static int gpio_apu2_remove (struct platform_device *dev) { -#if LINUX_VERSION_CODE < KERNEL_VERSION(3,18,0) - int ret; - ret = gpiochip_remove (&gpio_apu2_chip); -#else /* LINUX_VERSION_CODE < KERNEL_VERSION(3,18,0) */ gpiochip_remove (&gpio_apu2_chip); -#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(3,18,0) */ return 0; } diff --git a/package/kernel/rtc-rv5c386a/src/rtc.c b/package/kernel/rtc-rv5c386a/src/rtc.c index 96dc56eb36..0c00c41f96 100644 --- a/package/kernel/rtc-rv5c386a/src/rtc.c +++ b/package/kernel/rtc-rv5c386a/src/rtc.c @@ -57,9 +57,6 @@ #include #include -#if LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0) -#include -#endif #include #include diff --git a/package/network/services/hostapd/Makefile b/package/network/services/hostapd/Makefile index aa57d2121a..4fd285390e 100644 --- a/package/network/services/hostapd/Makefile +++ b/package/network/services/hostapd/Makefile @@ -7,7 +7,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=hostapd -PKG_RELEASE:=9 +PKG_RELEASE:=10 PKG_SOURCE_URL:=http://w1.fi/hostap.git PKG_SOURCE_PROTO:=git diff --git a/package/network/services/hostapd/patches/091-0001-wolfssl-Fix-compiler-warnings-on-size_t-printf-forma.patch b/package/network/services/hostapd/patches/091-0001-wolfssl-Fix-compiler-warnings-on-size_t-printf-forma.patch new file mode 100644 index 0000000000..464bcff0b5 --- /dev/null +++ b/package/network/services/hostapd/patches/091-0001-wolfssl-Fix-compiler-warnings-on-size_t-printf-forma.patch @@ -0,0 +1,31 @@ +From 6a28c4dbc102de3fed9db44637f47a10e7adfb78 Mon Sep 17 00:00:00 2001 +From: Jouni Malinen +Date: Sat, 16 May 2020 21:01:51 +0300 +Subject: [PATCH 1/3] wolfssl: Fix compiler warnings on size_t printf format + use + +Signed-off-by: Jouni Malinen +--- + src/crypto/tls_wolfssl.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +--- a/src/crypto/tls_wolfssl.c ++++ b/src/crypto/tls_wolfssl.c +@@ -1741,7 +1741,7 @@ struct wpabuf * tls_connection_encrypt(v + if (!conn) + return NULL; + +- wpa_printf(MSG_DEBUG, "SSL: encrypt: %ld bytes", wpabuf_len(in_data)); ++ wpa_printf(MSG_DEBUG, "SSL: encrypt: %zu bytes", wpabuf_len(in_data)); + + wolfssl_reset_out_data(&conn->output); + +@@ -1792,7 +1792,7 @@ struct wpabuf * tls_connection_decrypt(v + } + wpabuf_put(buf, res); + +- wpa_printf(MSG_DEBUG, "SSL: decrypt: %ld bytes", wpabuf_len(buf)); ++ wpa_printf(MSG_DEBUG, "SSL: decrypt: %zu bytes", wpabuf_len(buf)); + + return buf; + } diff --git a/package/network/services/hostapd/patches/091-0002-wolfssl-Fix-crypto_bignum_rand-implementation.patch b/package/network/services/hostapd/patches/091-0002-wolfssl-Fix-crypto_bignum_rand-implementation.patch new file mode 100644 index 0000000000..2464b63489 --- /dev/null +++ b/package/network/services/hostapd/patches/091-0002-wolfssl-Fix-crypto_bignum_rand-implementation.patch @@ -0,0 +1,49 @@ +From eb595b3e3ab531645a5bde71cf6385335b7a4b95 Mon Sep 17 00:00:00 2001 +From: Jouni Malinen +Date: Sat, 16 May 2020 21:02:17 +0300 +Subject: [PATCH 2/3] wolfssl: Fix crypto_bignum_rand() implementation + +The previous implementation used mp_rand_prime() to generate a random +value in range 0..m. That is insanely slow way of generating a random +value since mp_rand_prime() is for generating a random _prime_ which is +not what is needed here. Replace that implementation with generationg of +a random value in the requested range without doing any kind of prime +number checks or loops to reject values that are not primes. + +This speeds up SAE and EAP-pwd routines by couple of orders of +magnitude.. + +Signed-off-by: Jouni Malinen +--- + src/crypto/crypto_wolfssl.c | 12 +++++++----- + 1 file changed, 7 insertions(+), 5 deletions(-) + +--- a/src/crypto/crypto_wolfssl.c ++++ b/src/crypto/crypto_wolfssl.c +@@ -1084,19 +1084,21 @@ int crypto_bignum_rand(struct crypto_big + { + int ret = 0; + WC_RNG rng; ++ size_t len; ++ u8 *buf; + + if (TEST_FAIL()) + return -1; + if (wc_InitRng(&rng) != 0) + return -1; +- if (mp_rand_prime((mp_int *) r, +- (mp_count_bits((mp_int *) m) + 7) / 8 * 2, +- &rng, NULL) != 0) +- ret = -1; +- if (ret == 0 && ++ len = (mp_count_bits((mp_int *) m) + 7) / 8; ++ buf = os_malloc(len); ++ if (!buf || wc_RNG_GenerateBlock(&rng, buf, len) != 0 || ++ mp_read_unsigned_bin((mp_int *) r, buf, len) != MP_OKAY || + mp_mod((mp_int *) r, (mp_int *) m, (mp_int *) r) != 0) + ret = -1; + wc_FreeRng(&rng); ++ bin_clear_free(buf, len); + return ret; + } + diff --git a/package/network/services/hostapd/patches/091-0003-wolfssl-Do-not-hardcode-include-directory-in-wpa_sup.patch b/package/network/services/hostapd/patches/091-0003-wolfssl-Do-not-hardcode-include-directory-in-wpa_sup.patch new file mode 100644 index 0000000000..b15dccd7d1 --- /dev/null +++ b/package/network/services/hostapd/patches/091-0003-wolfssl-Do-not-hardcode-include-directory-in-wpa_sup.patch @@ -0,0 +1,26 @@ +From 79488da576aeeb9400e1742fab7f463eed0fa7a1 Mon Sep 17 00:00:00 2001 +From: Jouni Malinen +Date: Sat, 16 May 2020 21:07:45 +0300 +Subject: [PATCH 3/3] wolfssl: Do not hardcode include directory in + wpa_supplicant build + +This is not really appropriate for any kind of cross compilations and is +not really needed in general since system specific values can be set in +.config. + +Signed-off-by: Jouni Malinen +--- + wpa_supplicant/Makefile | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/wpa_supplicant/Makefile ++++ b/wpa_supplicant/Makefile +@@ -1086,7 +1086,7 @@ endif + + ifeq ($(CONFIG_TLS), wolfssl) + ifdef TLS_FUNCS +-CFLAGS += -DWOLFSSL_DER_LOAD -I/usr/local/include/wolfssl ++CFLAGS += -DWOLFSSL_DER_LOAD + OBJS += ../src/crypto/tls_wolfssl.o + endif + OBJS += ../src/crypto/crypto_wolfssl.o diff --git a/package/system/mtd/src/Makefile b/package/system/mtd/src/Makefile index 7f06996e19..e504a04478 100644 --- a/package/system/mtd/src/Makefile +++ b/package/system/mtd/src/Makefile @@ -14,7 +14,7 @@ obj.brcm = trx.o obj.bcm47xx = $(obj.brcm) obj.bcm53xx = $(obj.brcm) $(obj.seama) obj.bcm63xx = imagetag.o -obj.ramips = $(obj.seama) $(obj.tpl) $(obj.wrg) +obj.ramips = $(obj.seama) $(obj.tpl) $(obj.wrg) linksys_bootcount.o obj.mvebu = linksys_bootcount.o obj.kirkwood = linksys_bootcount.o obj.ipq806x = linksys_bootcount.o diff --git a/target/linux/ath79/dts/qca9558_ubnt_powerbeam-5ac-500.dts b/target/linux/ath79/dts/qca9558_ubnt_powerbeam-5ac-500.dts new file mode 100644 index 0000000000..c41b9e5423 --- /dev/null +++ b/target/linux/ath79/dts/qca9558_ubnt_powerbeam-5ac-500.dts @@ -0,0 +1,39 @@ +// SPDX-License-Identifier: GPL-2.0 +/dts-v1/; + +#include "qca955x_ubnt_xc.dtsi" + +/ { + compatible = "ubnt,powerbeam-5ac-500", "ubnt,xc", "qca,qca9558"; + model = "Ubiquiti PowerBeam 5AC 500"; + + keys { + compatible = "gpio-keys"; + + reset { + label = "Reset button"; + linux,code = ; + gpios = <&gpio 19 GPIO_ACTIVE_LOW>; + debounce-interval = <60>; + }; + }; +}; + +&mdio0 { + status = "okay"; + + phy-mask = <4>; + phy4: ethernet-phy@4 { + phy-mode = "sgmii"; + reg = <4>; + at803x-override-sgmii-link-check; + }; +}; + +ð0 { + status = "okay"; + + mtd-mac-address = <&art 0x0>; + phy-mode = "sgmii"; + phy-handle = <&phy4>; +}; diff --git a/target/linux/ath79/dts/qca955x_ubnt_xc.dtsi b/target/linux/ath79/dts/qca955x_ubnt_xc.dtsi new file mode 100644 index 0000000000..bd8ebaf040 --- /dev/null +++ b/target/linux/ath79/dts/qca955x_ubnt_xc.dtsi @@ -0,0 +1,67 @@ +// SPDX-License-Identifier: GPL-2.0 + +#include +#include + +#include "qca955x.dtsi" + +/ { + chosen { + bootargs = "console=ttyS0,115200n8"; + }; +}; + +&uart { + status = "okay"; +}; + +&pcie0 { + status = "okay"; +}; + +&spi { + status = "okay"; + num-cs = <1>; + + flash@0 { + compatible = "jedec,spi-nor"; + reg = <0>; + spi-max-frequency = <25000000>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "u-boot"; + reg = <0x000000 0x040000>; + read-only; + }; + + partition@40000 { + label = "u-boot-env"; + reg = <0x040000 0x010000>; + read-only; + }; + + partition@50000 { + compatible = "denx,uimage"; + label = "firmware"; + reg = <0x050000 0xf60000>; + }; + + partition@fb0000 { + label = "cfg"; + reg = <0xfb0000 0x040000>; + read-only; + }; + + art: partition@ff0000 { + label = "art"; + reg = <0xff0000 0x010000>; + read-only; + }; + }; + }; +}; diff --git a/target/linux/ath79/generic/base-files/etc/board.d/02_network b/target/linux/ath79/generic/base-files/etc/board.d/02_network index 9768e4e076..0b05868baf 100755 --- a/target/linux/ath79/generic/base-files/etc/board.d/02_network +++ b/target/linux/ath79/generic/base-files/etc/board.d/02_network @@ -53,6 +53,7 @@ ath79_setup_interfaces() ubnt,nanostation-loco-m|\ ubnt,nanostation-loco-m-xw|\ ubnt,picostation-m|\ + ubnt,powerbeam-5ac-500|\ ubnt,powerbeam-5ac-gen2|\ ubnt,rocket-m|\ ubnt,unifiac-lite|\ @@ -471,6 +472,7 @@ ath79_setup_macs() label_mac=$(cat /sys/class/ieee80211/phy0/macaddress) ;; ubnt,litebeam-ac-gen2|\ + ubnt,powerbeam-5ac-500|\ ubnt,powerbeam-5ac-gen2) label_mac=$(mtd_get_mac_binary art 0x5006) ;; diff --git a/target/linux/ath79/generic/base-files/etc/hotplug.d/firmware/11-ath10k-caldata b/target/linux/ath79/generic/base-files/etc/hotplug.d/firmware/11-ath10k-caldata index 336b0f3c8f..3ce95905b8 100644 --- a/target/linux/ath79/generic/base-files/etc/hotplug.d/firmware/11-ath10k-caldata +++ b/target/linux/ath79/generic/base-files/etc/hotplug.d/firmware/11-ath10k-caldata @@ -25,6 +25,7 @@ case "$FIRMWARE" in ubnt,nanobeam-ac|\ ubnt,nanostation-ac|\ ubnt,nanostation-ac-loco|\ + ubnt,powerbeam-5ac-500|\ ubnt,powerbeam-5ac-gen2|\ ubnt,unifiac-pro|\ yuncore,a770) diff --git a/target/linux/ath79/image/generic-ubnt.mk b/target/linux/ath79/image/generic-ubnt.mk index d056ab6783..577ae98624 100644 --- a/target/linux/ath79/image/generic-ubnt.mk +++ b/target/linux/ath79/image/generic-ubnt.mk @@ -69,6 +69,15 @@ define Device/ubnt-wa UBNT_VERSION := 8.5.0 endef +define Device/ubnt-xc + $(Device/ubnt) + IMAGE_SIZE := 15744k + UBNT_BOARD := XC + UBNT_CHIP := qca955x + UBNT_TYPE := XC + UBNT_VERSION := 8.5.0 +endef + define Device/ubnt-xm $(Device/ubnt) DEVICE_VARIANT := XM @@ -243,6 +252,15 @@ define Device/ubnt_picostation-m endef TARGET_DEVICES += ubnt_picostation-m +define Device/ubnt_powerbeam-5ac-500 + $(Device/ubnt-xc) + SOC := qca9558 + DEVICE_MODEL := PowerBeam 5AC + DEVICE_VARIANT := 500 + DEVICE_PACKAGES := kmod-ath10k-ct ath10k-firmware-qca988x-ct +endef +TARGET_DEVICES += ubnt_powerbeam-5ac-500 + define Device/ubnt_powerbeam-5ac-gen2 $(Device/ubnt-wa) DEVICE_MODEL := PowerBeam 5AC diff --git a/target/linux/bcm27xx/patches-5.4/950-0037-Add-dwc_otg-driver.patch b/target/linux/bcm27xx/patches-5.4/950-0037-Add-dwc_otg-driver.patch index a613aa6e60..3e2d74ed56 100644 --- a/target/linux/bcm27xx/patches-5.4/950-0037-Add-dwc_otg-driver.patch +++ b/target/linux/bcm27xx/patches-5.4/950-0037-Add-dwc_otg-driver.patch @@ -7658,7 +7658,7 @@ Signed-off-by: Jonathan Bell +} --- /dev/null +++ b/drivers/usb/host/dwc_common_port/dwc_common_linux.c -@@ -0,0 +1,1409 @@ +@@ -0,0 +1,1405 @@ +#include +#include +#include @@ -7703,11 +7703,7 @@ Signed-off-by: Jonathan Bell + +#include + -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,24) +# include -+#else -+# include -+#endif + +#include +#include @@ -15687,7 +15683,7 @@ Signed-off-by: Jonathan Bell +SEARCHENGINE = NO --- /dev/null +++ b/drivers/usb/host/dwc_otg/dummy_audio.c -@@ -0,0 +1,1574 @@ +@@ -0,0 +1,1570 @@ +/* + * zero.c -- Gadget Zero, for USB development + * @@ -15774,11 +15770,7 @@ Signed-off-by: Jonathan Bell +#include +#include + -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,21) +# include -+#else -+# include -+#endif + +#include + @@ -32906,7 +32898,7 @@ Signed-off-by: Jonathan Bell +#endif --- /dev/null +++ b/drivers/usb/host/dwc_otg/dwc_otg_driver.c -@@ -0,0 +1,1772 @@ +@@ -0,0 +1,1768 @@ +/* ========================================================================== + * $File: //dwh/usb_iip/dev/software/otg/linux/drivers/dwc_otg_driver.c $ + * $Revision: #92 $ @@ -33842,11 +33834,7 @@ Signed-off-by: Jonathan Bell +#if defined(LM_INTERFACE) || defined(PLATFORM_INTERFACE) + dev_dbg(&_dev->dev, "Calling set_irq_type\n"); + set_irq_type(devirq, -+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,30)) -+ IRQT_LOW -+#else + IRQ_TYPE_LEVEL_LOW -+#endif + ); +#endif +#endif /*IRQF_TRIGGER_LOW*/ @@ -36683,7 +36671,7 @@ Signed-off-by: Jonathan Bell +END(_dwc_otg_fiq_stub) --- /dev/null +++ b/drivers/usb/host/dwc_otg/dwc_otg_hcd.c -@@ -0,0 +1,4327 @@ +@@ -0,0 +1,4325 @@ + +/* ========================================================================== + * $File: //dwh/usb_iip/dev/software/otg/linux/drivers/dwc_otg_hcd.c $ @@ -37368,7 +37356,6 @@ Signed-off-by: Jonathan Bell + return retval; +} + -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,30) +int dwc_otg_hcd_endpoint_reset(dwc_otg_hcd_t * hcd, void *ep_handle) +{ + int retval = 0; @@ -37379,7 +37366,6 @@ Signed-off-by: Jonathan Bell + qh->data_toggle = DWC_OTG_HC_PID_DATA0; + return retval; +} -+#endif + +/** + * HCD Callback structure for handling mode switching. @@ -46207,7 +46193,7 @@ Signed-off-by: Jonathan Bell +#endif /* DWC_DEVICE_ONLY */ --- /dev/null +++ b/drivers/usb/host/dwc_otg/dwc_otg_hcd_linux.c -@@ -0,0 +1,1083 @@ +@@ -0,0 +1,1034 @@ + +/* ========================================================================== + * $File: //dwh/usb_iip/dev/software/otg/linux/drivers/dwc_otg_hcd_linux.c $ @@ -46265,18 +46251,10 @@ Signed-off-by: Jonathan Bell +#include +#endif +#include -+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,35) -+#include <../drivers/usb/core/hcd.h> -+#else +#include -+#endif +#include + -+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,30)) +#define USB_URB_EP_LINKING 1 -+#else -+#define USB_URB_EP_LINKING 0 -+#endif + +#include "dwc_otg_hcd_if.h" +#include "dwc_otg_dbg.h" @@ -46307,24 +46285,13 @@ Signed-off-by: Jonathan Bell +/** @{ */ +/* manage i/o requests, device state */ +static int dwc_otg_urb_enqueue(struct usb_hcd *hcd, -+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,28) -+ struct usb_host_endpoint *ep, -+#endif + struct urb *urb, gfp_t mem_flags); + -+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,30) -+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,28) -+static int dwc_otg_urb_dequeue(struct usb_hcd *hcd, struct urb *urb); -+#endif -+#else /* kernels at or post 2.6.30 */ +static int dwc_otg_urb_dequeue(struct usb_hcd *hcd, + struct urb *urb, int status); -+#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(2,6,30) */ + +static void endpoint_disable(struct usb_hcd *hcd, struct usb_host_endpoint *ep); -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,30) +static void endpoint_reset(struct usb_hcd *hcd, struct usb_host_endpoint *ep); -+#endif +static irqreturn_t dwc_otg_hcd_irq(struct usb_hcd *hcd); +extern int hcd_start(struct usb_hcd *hcd); +extern void hcd_stop(struct usb_hcd *hcd); @@ -46359,9 +46326,7 @@ Signed-off-by: Jonathan Bell + .urb_enqueue = dwc_otg_urb_enqueue, + .urb_dequeue = dwc_otg_urb_dequeue, + .endpoint_disable = endpoint_disable, -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,30) + .endpoint_reset = endpoint_reset, -+#endif + .get_frame_number = get_frame_number, + + .hub_status_data = hub_status_data, @@ -46583,11 +46548,7 @@ Signed-off-by: Jonathan Bell +#if USB_URB_EP_LINKING + usb_hcd_unlink_urb_from_ep(dwc_otg_hcd_to_hcd(hcd), urb); +#endif -+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,28) -+ usb_hcd_giveback_urb(dwc_otg_hcd_to_hcd(hcd), urb); -+#else + usb_hcd_giveback_urb(dwc_otg_hcd_to_hcd(hcd), urb, urb->status); -+#endif + } else { + new_entry->urb = urb; +#if USB_URB_EP_LINKING @@ -46787,14 +46748,10 @@ Signed-off-by: Jonathan Bell + * Allocate memory for the base HCD plus the DWC OTG HCD. + * Initialize the base HCD. + */ -+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,30) -+ hcd = usb_create_hcd(&dwc_otg_hc_driver, &_dev->dev, _dev->dev.bus_id); -+#else + hcd = usb_create_hcd(&dwc_otg_hc_driver, &_dev->dev, dev_name(&_dev->dev)); + hcd->has_tt = 1; +// hcd->uses_new_polling = 1; +// hcd->poll_rh = 0; -+#endif + if (!hcd) { + retval = -ENOMEM; + goto error1; @@ -46839,13 +46796,8 @@ Signed-off-by: Jonathan Bell +#endif + + hcd->self.otg_port = dwc_otg_hcd_otg_port(dwc_otg_hcd); -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,33) //don't support for LM(with 2.6.20.1 kernel) -+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,35) //version field absent later -+ hcd->self.otg_version = dwc_otg_get_otg_version(otg_dev->core_if); -+#endif + /* Don't support SG list at this point */ + hcd->self.sg_tablesize = 0; -+#endif + /* + * Finish generic HCD initialization and start the HCD. This function + * allocates the DMA buffer pool, registers the USB bus, requests the @@ -47007,15 +46959,10 @@ Signed-off-by: Jonathan Bell + * (URB). mem_flags indicates the type of memory allocation to use while + * processing this URB. */ +static int dwc_otg_urb_enqueue(struct usb_hcd *hcd, -+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,28) -+ struct usb_host_endpoint *ep, -+#endif + struct urb *urb, gfp_t mem_flags) +{ + int retval = 0; -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,28) + struct usb_host_endpoint *ep = urb->ep; -+#endif + dwc_irqflags_t irqflags; + void **ref_ep_hcpriv = &ep->hcpriv; + dwc_otg_hcd_t *dwc_otg_hcd = hcd_to_dwc_otg_hcd(hcd); @@ -47151,11 +47098,7 @@ Signed-off-by: Jonathan Bell + +/** Aborts/cancels a USB transfer request. Always returns 0 to indicate + * success. */ -+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,28) -+static int dwc_otg_urb_dequeue(struct usb_hcd *hcd, struct urb *urb) -+#else +static int dwc_otg_urb_dequeue(struct usb_hcd *hcd, struct urb *urb, int status) -+#endif +{ + dwc_irqflags_t flags; + dwc_otg_hcd_t *dwc_otg_hcd; @@ -47191,11 +47134,7 @@ Signed-off-by: Jonathan Bell + DWC_SPINUNLOCK_IRQRESTORE(dwc_otg_hcd->lock, flags); + + -+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,28) -+ usb_hcd_giveback_urb(hcd, urb); -+#else + usb_hcd_giveback_urb(hcd, urb, status); -+#endif + if (CHK_DEBUG_LEVEL(DBG_HCDV | DBG_HCD_URB)) { + DWC_PRINTF("Called usb_hcd_giveback_urb() \n"); + DWC_PRINTF(" 1urb->status = %d\n", urb->status); @@ -47225,7 +47164,6 @@ Signed-off-by: Jonathan Bell + ep->hcpriv = NULL; +} + -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,30) +/* Resets endpoint specific parameter values, in current version used to reset + * the data toggle(as a WA). This function can be called from usb_clear_halt routine */ +static void endpoint_reset(struct usb_hcd *hcd, struct usb_host_endpoint *ep) @@ -47241,7 +47179,6 @@ Signed-off-by: Jonathan Bell + } + DWC_SPINUNLOCK_IRQRESTORE(dwc_otg_hcd->lock, flags); +} -+#endif + +/** Handles host mode interrupts for the DWC_otg controller. Returns IRQ_NONE if + * there was no interrupt to handle. Returns IRQ_HANDLED if there was a valid @@ -48266,7 +48203,7 @@ Signed-off-by: Jonathan Bell +#endif /* DWC_DEVICE_ONLY */ --- /dev/null +++ b/drivers/usb/host/dwc_otg/dwc_otg_os_dep.h -@@ -0,0 +1,199 @@ +@@ -0,0 +1,170 @@ +#ifndef _DWC_OS_DEP_H_ +#define _DWC_OS_DEP_H_ + @@ -48299,25 +48236,11 @@ Signed-off-by: Jonathan Bell + +#include + -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20) +# include -+#endif + -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,21) +# include -+#else -+# include -+#endif + -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,24) +# include -+#else -+# include -+#endif -+ -+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20) -+# include -+#endif + +#ifdef PCI_INTERFACE +# include @@ -48328,19 +48251,12 @@ Signed-off-by: Jonathan Bell +# include +# include +# include -+# if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,30)) -+# include -+# include -+# include -+# include -+# else +/* in 2.6.31, at least, we seem to have lost the generic LM infrastructure - + here we assume that the machine architecture provides definitions + in its own header +*/ +# include +# include -+# endif +#endif + +#ifdef PLATFORM_INTERFACE @@ -48353,14 +48269,6 @@ Signed-off-by: Jonathan Bell +/** The OS page size */ +#define DWC_OS_PAGE_SIZE PAGE_SIZE + -+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,14) -+typedef int gfp_t; -+#endif -+ -+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,18) -+# define IRQF_SHARED SA_SHIRQ -+#endif -+ +typedef struct os_dependent { + /** Base address returned from ioremap() */ + void *base; @@ -56987,7 +56895,7 @@ Signed-off-by: Jonathan Bell +#endif /* DWC_HOST_ONLY */ --- /dev/null +++ b/drivers/usb/host/dwc_otg/dwc_otg_pcd_linux.c -@@ -0,0 +1,1262 @@ +@@ -0,0 +1,1176 @@ + /* ========================================================================== + * $File: //dwh/usb_iip/dev/software/otg/linux/drivers/dwc_otg_pcd_linux.c $ + * $Revision: #21 $ @@ -57231,67 +57139,6 @@ Signed-off-by: Jonathan Bell + kfree(req); +} + -+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,28) -+/** -+ * This function allocates an I/O buffer to be used for a transfer -+ * to/from the specified endpoint. -+ * -+ * @param usb_ep The endpoint to be used with with the request -+ * @param bytes The desired number of bytes for the buffer -+ * @param dma Pointer to the buffer's DMA address; must be valid -+ * @param gfp_flags the GFP_* flags to use. -+ * @return address of a new buffer or null is buffer could not be allocated. -+ */ -+static void *dwc_otg_pcd_alloc_buffer(struct usb_ep *usb_ep, unsigned bytes, -+ dma_addr_t * dma, gfp_t gfp_flags) -+{ -+ void *buf; -+ dwc_otg_pcd_t *pcd = 0; -+ -+ pcd = gadget_wrapper->pcd; -+ -+ DWC_DEBUGPL(DBG_PCDV, "%s(%p,%d,%p,%0x)\n", __func__, usb_ep, bytes, -+ dma, gfp_flags); -+ -+ /* Check dword alignment */ -+ if ((bytes & 0x3UL) != 0) { -+ DWC_WARN("%s() Buffer size is not a multiple of" -+ "DWORD size (%d)", __func__, bytes); -+ } -+ -+ buf = dma_alloc_coherent(NULL, bytes, dma, gfp_flags); -+ WARN_ON(!buf); -+ -+ /* Check dword alignment */ -+ if (((int)buf & 0x3UL) != 0) { -+ DWC_WARN("%s() Buffer is not DWORD aligned (%p)", -+ __func__, buf); -+ } -+ -+ return buf; -+} -+ -+/** -+ * This function frees an I/O buffer that was allocated by alloc_buffer. -+ * -+ * @param usb_ep the endpoint associated with the buffer -+ * @param buf address of the buffer -+ * @param dma The buffer's DMA address -+ * @param bytes The number of bytes of the buffer -+ */ -+static void dwc_otg_pcd_free_buffer(struct usb_ep *usb_ep, void *buf, -+ dma_addr_t dma, unsigned bytes) -+{ -+ dwc_otg_pcd_t *pcd = 0; -+ -+ pcd = gadget_wrapper->pcd; -+ -+ DWC_DEBUGPL(DBG_PCDV, "%s(%p,%0x,%d)\n", __func__, buf, dma, bytes); -+ -+ dma_free_coherent(NULL, bytes, buf, dma); -+} -+#endif -+ +/** + * This function is used to submit an I/O Request to an EP. + * @@ -57347,9 +57194,6 @@ Signed-off-by: Jonathan Bell + is_isoc_ep = 0; + else + is_isoc_ep = (ep->dwc_ep.type == DWC_OTG_EP_TYPE_ISOC) ? 1 : 0; -+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,28) -+ dma_addr = usb_req->dma; -+#else + if (GET_CORE_IF(pcd)->dma_enable) { + dwc_otg_device_t *otg_dev = gadget_wrapper->pcd->otg_dev; + struct device *dev = NULL; @@ -57366,7 +57210,6 @@ Signed-off-by: Jonathan Bell + DMA_FROM_DEVICE); + } + } -+#endif + +#ifdef DWC_UTE_PER_IO + if (is_isoc_ep == 1) { @@ -57449,8 +57292,6 @@ Signed-off-by: Jonathan Bell + return retval; +} + -+//#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,30)) -+#if 0 +/** + * ep_wedge: sets the halt feature and ignores clear requests + * @@ -57483,7 +57324,6 @@ Signed-off-by: Jonathan Bell + + return retval; +} -+#endif + +#ifdef DWC_EN_ISOC +/** @@ -57589,11 +57429,6 @@ Signed-off-by: Jonathan Bell + .alloc_request = dwc_otg_pcd_alloc_request, + .free_request = dwc_otg_pcd_free_request, + -+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,28) -+ .alloc_buffer = dwc_otg_pcd_alloc_buffer, -+ .free_buffer = dwc_otg_pcd_free_buffer, -+#endif -+ + .queue = ep_queue, + .dequeue = ep_dequeue, + @@ -57633,13 +57468,8 @@ Signed-off-by: Jonathan Bell + .alloc_request = dwc_otg_pcd_alloc_request, + .free_request = dwc_otg_pcd_free_request, + -+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,28) -+ .alloc_buffer = dwc_otg_pcd_alloc_buffer, -+ .free_buffer = dwc_otg_pcd_free_buffer, -+#else + /* .set_wedge = ep_wedge, */ + .set_wedge = NULL, /* uses set_halt instead */ -+#endif + + .queue = ep_queue, + .dequeue = ep_dequeue, @@ -57853,9 +57683,7 @@ Signed-off-by: Jonathan Bell + void *req_handle, int32_t status, uint32_t actual) +{ + struct usb_request *req = (struct usb_request *)req_handle; -+#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,27) + struct dwc_otg_pcd_ep *ep = NULL; -+#endif + + if (req && req->complete) { + switch (status) { @@ -57881,7 +57709,6 @@ Signed-off-by: Jonathan Bell + req->complete(ep_handle, req); + DWC_SPINLOCK(pcd->lock); + } -+#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,27) + ep = ep_from_handle(pcd, ep_handle); + if (GET_CORE_IF(pcd)->dma_enable) { + if (req->length != 0) { @@ -57896,7 +57723,6 @@ Signed-off-by: Jonathan Bell + DMA_TO_DEVICE: DMA_FROM_DEVICE); + } + } -+#endif + + return 0; +} @@ -58147,11 +57973,7 @@ Signed-off-by: Jonathan Bell + d->gadget.name = pcd_name; + d->pcd = otg_dev->pcd; + -+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,30) -+ strcpy(d->gadget.dev.bus_id, "gadget"); -+#else + dev_set_name(&d->gadget.dev, "%s", "gadget"); -+#endif + + d->gadget.dev.parent = &_dev->dev; + d->gadget.dev.release = dwc_otg_pcd_gadget_release; diff --git a/target/linux/bcm27xx/patches-5.4/950-0342-dwc_otg-Declare-DMA-capability-with-HCD_DMA-flag.patch b/target/linux/bcm27xx/patches-5.4/950-0342-dwc_otg-Declare-DMA-capability-with-HCD_DMA-flag.patch index 3307eacccf..afd72da286 100644 --- a/target/linux/bcm27xx/patches-5.4/950-0342-dwc_otg-Declare-DMA-capability-with-HCD_DMA-flag.patch +++ b/target/linux/bcm27xx/patches-5.4/950-0342-dwc_otg-Declare-DMA-capability-with-HCD_DMA-flag.patch @@ -16,7 +16,7 @@ Signed-off-by: Phil Elwell --- a/drivers/usb/host/dwc_otg/dwc_otg_hcd_linux.c +++ b/drivers/usb/host/dwc_otg/dwc_otg_hcd_linux.c -@@ -138,7 +138,7 @@ static struct hc_driver dwc_otg_hc_drive +@@ -119,7 +119,7 @@ static struct hc_driver dwc_otg_hc_drive .irq = dwc_otg_hcd_irq, diff --git a/target/linux/bcm27xx/patches-5.4/950-0363-dwc_otg-checking-the-urb-transfer_buffer-too-early-3.patch b/target/linux/bcm27xx/patches-5.4/950-0363-dwc_otg-checking-the-urb-transfer_buffer-too-early-3.patch index ee12a0f5db..3bc9abde27 100644 --- a/target/linux/bcm27xx/patches-5.4/950-0363-dwc_otg-checking-the-urb-transfer_buffer-too-early-3.patch +++ b/target/linux/bcm27xx/patches-5.4/950-0363-dwc_otg-checking-the-urb-transfer_buffer-too-early-3.patch @@ -32,7 +32,7 @@ Signed-off-by: Hui Wang --- a/drivers/usb/host/dwc_otg/dwc_otg_hcd_linux.c +++ b/drivers/usb/host/dwc_otg/dwc_otg_hcd_linux.c -@@ -821,10 +821,6 @@ static int dwc_otg_urb_enqueue(struct us +@@ -782,10 +782,6 @@ static int dwc_otg_urb_enqueue(struct us dump_urb_info(urb, "dwc_otg_urb_enqueue"); } #endif @@ -43,7 +43,7 @@ Signed-off-by: Hui Wang if ((usb_pipetype(urb->pipe) == PIPE_ISOCHRONOUS) || (usb_pipetype(urb->pipe) == PIPE_INTERRUPT)) { if (!dwc_otg_hcd_is_bandwidth_allocated -@@ -881,6 +877,13 @@ static int dwc_otg_urb_enqueue(struct us +@@ -842,6 +838,13 @@ static int dwc_otg_urb_enqueue(struct us &urb->transfer_dma, buf); } diff --git a/target/linux/bcm27xx/patches-5.4/950-0393-dwc_otg-constrain-endpoint-max-packet-and-transfer-s.patch b/target/linux/bcm27xx/patches-5.4/950-0393-dwc_otg-constrain-endpoint-max-packet-and-transfer-s.patch index 7e4a3f8b38..4de95a5449 100644 --- a/target/linux/bcm27xx/patches-5.4/950-0393-dwc_otg-constrain-endpoint-max-packet-and-transfer-s.patch +++ b/target/linux/bcm27xx/patches-5.4/950-0393-dwc_otg-constrain-endpoint-max-packet-and-transfer-s.patch @@ -23,7 +23,7 @@ Signed-off-by: Jonathan Bell --- a/drivers/usb/host/dwc_otg/dwc_otg_hcd.c +++ b/drivers/usb/host/dwc_otg/dwc_otg_hcd.c -@@ -1813,7 +1813,7 @@ int fiq_fsm_queue_split_transaction(dwc_ +@@ -1811,7 +1811,7 @@ int fiq_fsm_queue_split_transaction(dwc_ st->nr_errors = 0; st->hcchar_copy.d32 = 0; @@ -32,7 +32,7 @@ Signed-off-by: Jonathan Bell st->hcchar_copy.b.epdir = hc->ep_is_in; st->hcchar_copy.b.devaddr = hc->dev_addr; st->hcchar_copy.b.epnum = hc->ep_num; -@@ -1858,7 +1858,7 @@ int fiq_fsm_queue_split_transaction(dwc_ +@@ -1856,7 +1856,7 @@ int fiq_fsm_queue_split_transaction(dwc_ st->hctsiz_copy.b.pid = hc->data_pid_start; if (hc->ep_is_in || (hc->xfer_len > hc->max_packet)) { diff --git a/target/linux/bcm63xx/patches-5.4/327-irqchip-bcm6345-periph-clear-on-init.patch b/target/linux/bcm63xx/patches-5.4/327-irqchip-bcm6345-periph-clear-on-init.patch new file mode 100644 index 0000000000..a878b34b21 --- /dev/null +++ b/target/linux/bcm63xx/patches-5.4/327-irqchip-bcm6345-periph-clear-on-init.patch @@ -0,0 +1,12 @@ +--- a/drivers/irqchip/irq-bcm6345-periph.c ++++ b/drivers/irqchip/irq-bcm6345-periph.c +@@ -240,6 +240,9 @@ static int __init __bcm6345_periph_intc_ + /* route all interrupts to line 0 by default */ + if (i == 0) + block->mask_cache[w] = 0xffffffff; ++ ++ /* mask all interrupts */ ++ __raw_writel(0, block->en_reg[w]); + } + + irq_set_handler_data(block->parent_irq, data); diff --git a/target/linux/generic/files/drivers/mtd/mtdsplit/mtdsplit_uimage.c b/target/linux/generic/files/drivers/mtd/mtdsplit/mtdsplit_uimage.c index a6e50b5113..525ad8218b 100644 --- a/target/linux/generic/files/drivers/mtd/mtdsplit/mtdsplit_uimage.c +++ b/target/linux/generic/files/drivers/mtd/mtdsplit/mtdsplit_uimage.c @@ -245,19 +245,15 @@ mtdsplit_uimage_parse_generic(struct mtd_info *master, uimage_verify_default); } -#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 9, 0) static const struct of_device_id mtdsplit_uimage_of_match_table[] = { { .compatible = "denx,uimage" }, {}, }; -#endif static struct mtd_part_parser uimage_generic_parser = { .owner = THIS_MODULE, .name = "uimage-fw", -#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 9, 0) .of_match_table = mtdsplit_uimage_of_match_table, -#endif .parse_fn = mtdsplit_uimage_parse_generic, .type = MTD_PARSER_TYPE_FIRMWARE, }; @@ -312,19 +308,15 @@ mtdsplit_uimage_parse_netgear(struct mtd_info *master, uimage_verify_wndr3700); } -#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 9, 0) static const struct of_device_id mtdsplit_uimage_netgear_of_match_table[] = { { .compatible = "netgear,uimage" }, {}, }; -#endif static struct mtd_part_parser uimage_netgear_parser = { .owner = THIS_MODULE, .name = "netgear-fw", -#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 9, 0) .of_match_table = mtdsplit_uimage_netgear_of_match_table, -#endif .parse_fn = mtdsplit_uimage_parse_netgear, .type = MTD_PARSER_TYPE_FIRMWARE, }; @@ -364,19 +356,15 @@ mtdsplit_uimage_parse_edimax(struct mtd_info *master, uimage_find_edimax); } -#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 9, 0) static const struct of_device_id mtdsplit_uimage_edimax_of_match_table[] = { { .compatible = "edimax,uimage" }, {}, }; -#endif static struct mtd_part_parser uimage_edimax_parser = { .owner = THIS_MODULE, .name = "edimax-fw", -#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 9, 0) .of_match_table = mtdsplit_uimage_edimax_of_match_table, -#endif .parse_fn = mtdsplit_uimage_parse_edimax, .type = MTD_PARSER_TYPE_FIRMWARE, }; @@ -407,19 +395,15 @@ mtdsplit_uimage_parse_fonfxc(struct mtd_info *master, uimage_find_fonfxc); } -#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 9, 0) static const struct of_device_id mtdsplit_uimage_fonfxc_of_match_table[] = { { .compatible = "fonfxc,uimage" }, {}, }; -#endif static struct mtd_part_parser uimage_fonfxc_parser = { .owner = THIS_MODULE, .name = "fonfxc-fw", -#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 9, 0) .of_match_table = mtdsplit_uimage_fonfxc_of_match_table, -#endif .parse_fn = mtdsplit_uimage_parse_fonfxc, }; @@ -464,19 +448,15 @@ mtdsplit_uimage_parse_okli(struct mtd_info *master, uimage_verify_okli); } -#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 9, 0) static const struct of_device_id mtdsplit_uimage_okli_of_match_table[] = { { .compatible = "openwrt,okli" }, {}, }; -#endif static struct mtd_part_parser uimage_okli_parser = { .owner = THIS_MODULE, .name = "okli-fw", -#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 9, 0) .of_match_table = mtdsplit_uimage_okli_of_match_table, -#endif .parse_fn = mtdsplit_uimage_parse_okli, }; diff --git a/target/linux/generic/files/drivers/net/phy/b53/b53_priv.h b/target/linux/generic/files/drivers/net/phy/b53/b53_priv.h index a9296c9421..37c17aeb25 100644 --- a/target/linux/generic/files/drivers/net/phy/b53/b53_priv.h +++ b/target/linux/generic/files/drivers/net/phy/b53/b53_priv.h @@ -314,9 +314,8 @@ static inline int b53_write64(struct b53_device *dev, u8 page, u8 reg, #endif #include -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 1, 0)) #include -#endif + static inline int b53_switch_get_reset_gpio(struct b53_device *dev) { #ifdef CONFIG_BCM47XX @@ -331,11 +330,7 @@ static inline int b53_switch_get_reset_gpio(struct b53_device *dev) } #endif -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 1, 0)) return bcm47xx_nvram_gpio_pin("robo_reset"); -#else - return -ENOENT; -#endif } #endif diff --git a/target/linux/generic/files/drivers/net/phy/rtl8306.c b/target/linux/generic/files/drivers/net/phy/rtl8306.c index 6d09c1063c..31bc7589c4 100644 --- a/target/linux/generic/files/drivers/net/phy/rtl8306.c +++ b/target/linux/generic/files/drivers/net/phy/rtl8306.c @@ -1033,9 +1033,6 @@ rtl8306_read_status(struct phy_device *pdev) static struct phy_driver rtl8306_driver = { .name = "Realtek RTL8306S", -#if (LINUX_VERSION_CODE < KERNEL_VERSION(4,13,0)) - .flags = PHY_HAS_MAGICANEG, -#endif .phy_id = RTL8306_MAGIC, .phy_id_mask = 0xffffffff, .features = PHY_BASIC_FEATURES, diff --git a/target/linux/generic/files/drivers/net/phy/rtl8366_smi.c b/target/linux/generic/files/drivers/net/phy/rtl8366_smi.c index 2c4d53fc67..e8375e5147 100644 --- a/target/linux/generic/files/drivers/net/phy/rtl8366_smi.c +++ b/target/linux/generic/files/drivers/net/phy/rtl8366_smi.c @@ -1035,14 +1035,6 @@ static int rtl8366_smi_mii_init(struct rtl8366_smi *smi) dev_name(smi->parent)); smi->mii_bus->parent = smi->parent; smi->mii_bus->phy_mask = ~(0x1f); -#if LINUX_VERSION_CODE < KERNEL_VERSION(4,5,0) - { - int i; - smi->mii_bus->irq = smi->mii_irq; - for (i = 0; i < PHY_MAX_ADDR; i++) - smi->mii_irq[i] = PHY_POLL; - } -#endif #ifdef CONFIG_OF if (np) diff --git a/target/linux/generic/files/drivers/net/phy/swconfig.c b/target/linux/generic/files/drivers/net/phy/swconfig.c index e7da45d0f7..38fdab2d5c 100644 --- a/target/linux/generic/files/drivers/net/phy/swconfig.c +++ b/target/linux/generic/files/drivers/net/phy/swconfig.c @@ -594,12 +594,9 @@ swconfig_parse_ports(struct sk_buff *msg, struct nlattr *head, #if LINUX_VERSION_CODE >= KERNEL_VERSION(5,2,0) if (nla_parse_nested_deprecated(tb, SWITCH_PORT_ATTR_MAX, nla, port_policy, NULL)) -#elif LINUX_VERSION_CODE >= KERNEL_VERSION(4,12,0) - if (nla_parse_nested(tb, SWITCH_PORT_ATTR_MAX, nla, - port_policy, NULL)) #else if (nla_parse_nested(tb, SWITCH_PORT_ATTR_MAX, nla, - port_policy)) + port_policy, NULL)) #endif return -EINVAL; @@ -623,10 +620,8 @@ swconfig_parse_link(struct sk_buff *msg, struct nlattr *nla, #if LINUX_VERSION_CODE >= KERNEL_VERSION(5,2,0) if (nla_parse_nested_deprecated(tb, SWITCH_LINK_ATTR_MAX, nla, link_policy, NULL)) -#elif LINUX_VERSION_CODE >= KERNEL_VERSION(4,12,0) - if (nla_parse_nested(tb, SWITCH_LINK_ATTR_MAX, nla, link_policy, NULL)) #else - if (nla_parse_nested(tb, SWITCH_LINK_ATTR_MAX, nla, link_policy)) + if (nla_parse_nested(tb, SWITCH_LINK_ATTR_MAX, nla, link_policy, NULL)) #endif return -EINVAL; @@ -1110,9 +1105,6 @@ static struct genl_ops swconfig_ops[] = { }; static struct genl_family switch_fam = { -#if LINUX_VERSION_CODE < KERNEL_VERSION(4,10,0) - .id = GENL_ID_GENERATE, -#endif .name = "switch", .hdrsize = 0, .version = 1, @@ -1298,11 +1290,7 @@ swconfig_init(void) { INIT_LIST_HEAD(&swdevs); -#if LINUX_VERSION_CODE < KERNEL_VERSION(4,10,0) - return genl_register_family_with_ops(&switch_fam, swconfig_ops); -#else return genl_register_family(&switch_fam); -#endif } static void __exit diff --git a/target/linux/generic/files/drivers/platform/mikrotik/rb_hardconfig.c b/target/linux/generic/files/drivers/platform/mikrotik/rb_hardconfig.c index 26218d6a7d..93c731a5f0 100644 --- a/target/linux/generic/files/drivers/platform/mikrotik/rb_hardconfig.c +++ b/target/linux/generic/files/drivers/platform/mikrotik/rb_hardconfig.c @@ -36,7 +36,7 @@ #include "routerboot.h" -#define RB_HARDCONFIG_VER "0.02" +#define RB_HARDCONFIG_VER "0.03" #define RB_HC_PR_PFX "[rb_hardconfig] " /* ID values for hardware settings */ @@ -484,16 +484,18 @@ static int hc_wlan_data_unpack_lzor(const u8 *inbuf, size_t inlen, void *outbuf, size_t *outlen) { u16 rle_ofs, rle_len; - size_t templen; + const u32 *needle; u8 *tempbuf; + size_t templen, lzo_len; int ret; - templen = inlen + sizeof(hc_lzor_prefix); - if (templen > *outlen) + lzo_len = inlen + sizeof(hc_lzor_prefix); + if (lzo_len > *outlen) return -EFBIG; /* Temporary buffer same size as the outbuf */ - tempbuf = kmalloc(*outlen, GFP_KERNEL); + templen = *outlen; + tempbuf = kmalloc(templen, GFP_KERNEL); if (!outbuf) return -ENOMEM; @@ -501,41 +503,54 @@ static int hc_wlan_data_unpack_lzor(const u8 *inbuf, size_t inlen, memcpy(outbuf, hc_lzor_prefix, sizeof(hc_lzor_prefix)); memcpy(outbuf + sizeof(hc_lzor_prefix), inbuf, inlen); - /* LZO-decompress templen bytes of outbuf into the tempbuf */ - ret = lzo1x_decompress_safe(outbuf, templen, tempbuf, outlen); + /* LZO-decompress lzo_len bytes of outbuf into the tempbuf */ + ret = lzo1x_decompress_safe(outbuf, lzo_len, tempbuf, &templen); if (ret) { - pr_debug(RB_HC_PR_PFX "LZO decompression error (%d)\n", ret); - goto fail; + if (LZO_E_INPUT_NOT_CONSUMED == ret) { + /* + * It is assumed that because the LZO payload is embedded + * in a "root" RB_ID_WLAN_DATA tag, the tag length is aligned + * and the payload is padded at the end, which triggers a + * spurious error which we ignore here. + */ + pr_debug(RB_HC_PR_PFX "LZOR: LZO EOF before buffer end - this may be harmless\n"); + } else { + pr_debug(RB_HC_PR_PFX "LZOR: LZO decompression error (%d)\n", ret); + goto fail; + } } - templen = *outlen; /* * Post decompression we have a blob (possibly byproduct of the lzo * dictionary). We need to find RB_MAGIC_ERD. The magic number seems to * be 32bit-aligned in the decompression output. */ - - while (RB_MAGIC_ERD != *(u32 *)tempbuf) { - tempbuf += 4; - templen -= 4; - } + needle = (const u32 *)tempbuf; + while (RB_MAGIC_ERD != *needle++) { + if ((u8 *)needle >= tempbuf+templen) { + pr_debug(RB_HC_PR_PFX "LZOR: ERD magic not found\n"); + goto fail; + } + }; + templen -= (u8 *)needle - tempbuf; /* Past magic. Look for tag node */ - ret = routerboot_tag_find(tempbuf, templen, 0x1, &rle_ofs, &rle_len); + ret = routerboot_tag_find((u8 *)needle, templen, 0x1, &rle_ofs, &rle_len); if (ret) { - pr_debug(RB_HC_PR_PFX "RLE data not found\n"); + pr_debug(RB_HC_PR_PFX "LZOR: RLE data not found\n"); goto fail; } if (rle_len > templen) { - pr_debug(RB_HC_PR_PFX "Invalid RLE data length\n"); + pr_debug(RB_HC_PR_PFX "LZOR: Invalid RLE data length\n"); + ret = -EINVAL; goto fail; } - /* RLE-decode tempbuf back into the outbuf */ - ret = routerboot_rle_decode(tempbuf+rle_ofs, rle_len, outbuf, outlen); + /* RLE-decode tempbuf from needle back into the outbuf */ + ret = routerboot_rle_decode((u8 *)needle+rle_ofs, rle_len, outbuf, outlen); if (ret) - pr_debug(RB_HC_PR_PFX "RLE decoding error (%d)\n", ret); + pr_debug(RB_HC_PR_PFX "LZOR: RLE decoding error (%d)\n", ret); fail: kfree(tempbuf); diff --git a/target/linux/lantiq/patches-5.4/0001-MIPS-lantiq-add-pcie-driver.patch b/target/linux/lantiq/patches-5.4/0001-MIPS-lantiq-add-pcie-driver.patch index bcd928aea9..bd02f0a9f4 100644 --- a/target/linux/lantiq/patches-5.4/0001-MIPS-lantiq-add-pcie-driver.patch +++ b/target/linux/lantiq/patches-5.4/0001-MIPS-lantiq-add-pcie-driver.patch @@ -185,7 +185,7 @@ Signed-off-by: John Crispin } --- /dev/null +++ b/arch/mips/pci/ifxmips_pci_common.h -@@ -0,0 +1,57 @@ +@@ -0,0 +1,53 @@ +/****************************************************************************** +** +** FILE NAME : ifxmips_pci_common.h @@ -226,11 +226,7 @@ Signed-off-by: John Crispin + \ingroup IFX_PCI_COM + \brief PCI/PCIe bus driver common OS header file +*/ -+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24) -+#define IFX_PCI_CONST -+#else +#define IFX_PCI_CONST const -+#endif +#ifdef CONFIG_IFX_PCI +extern int ifx_pci_bios_map_irq(IFX_PCI_CONST struct pci_dev *dev, u8 slot, u8 pin); +extern int ifx_pci_bios_plat_dev_init(struct pci_dev *dev); @@ -1340,7 +1336,7 @@ Signed-off-by: John Crispin + --- /dev/null +++ b/arch/mips/pci/ifxmips_pcie.h -@@ -0,0 +1,135 @@ +@@ -0,0 +1,131 @@ +/****************************************************************************** +** +** FILE NAME : ifxmips_pcie.h @@ -1394,10 +1390,6 @@ Signed-off-by: John Crispin + spin_unlock_irqrestore(&(lock), flags); \ +} while (0) + -+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,18) -+#define IRQF_SHARED SA_SHIRQ -+#endif -+ +#define PCIE_MSG_MSI 0x00000001 +#define PCIE_MSG_ISR 0x00000002 +#define PCIE_MSG_FIXUP 0x00000004 @@ -4174,7 +4166,7 @@ Signed-off-by: John Crispin +EXPORT_SYMBOL(pcibios_1st_host_bus_nr); --- /dev/null +++ b/arch/mips/pci/pcie-lantiq.h -@@ -0,0 +1,1305 @@ +@@ -0,0 +1,1301 @@ +/****************************************************************************** +** +** FILE NAME : ifxmips_pcie_reg.h @@ -5185,10 +5177,6 @@ Signed-off-by: John Crispin + spin_unlock_irqrestore(&(lock), flags); \ +} while (0) + -+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,18) -+#define IRQF_SHARED SA_SHIRQ -+#endif -+ +#define PCIE_MSG_MSI 0x00000001 +#define PCIE_MSG_ISR 0x00000002 +#define PCIE_MSG_FIXUP 0x00000004 diff --git a/target/linux/ramips/dts/mt7620a_aigale_ai-br100.dts b/target/linux/ramips/dts/mt7620a_aigale_ai-br100.dts index a65654e78b..2afaf52fd7 100644 --- a/target/linux/ramips/dts/mt7620a_aigale_ai-br100.dts +++ b/target/linux/ramips/dts/mt7620a_aigale_ai-br100.dts @@ -106,6 +106,7 @@ ðernet { mtd-mac-address = <&factory 0x4>; + mediatek,portmap = "llllw"; }; diff --git a/target/linux/ramips/dts/mt7620a_alfa-network_ac1200rm.dts b/target/linux/ramips/dts/mt7620a_alfa-network_ac1200rm.dts index 95bd9b57da..329d78f481 100644 --- a/target/linux/ramips/dts/mt7620a_alfa-network_ac1200rm.dts +++ b/target/linux/ramips/dts/mt7620a_alfa-network_ac1200rm.dts @@ -80,10 +80,12 @@ }; ðernet { - mtd-mac-address = <&factory 0x28>; - mediatek,portmap = "llllw"; pinctrl-names = "default"; pinctrl-0 = <&ephy_pins>; + + mtd-mac-address = <&factory 0x28>; + + mediatek,portmap = "llllw"; }; &gpio1 { diff --git a/target/linux/ramips/dts/mt7620a_asus_rt-ac51u.dts b/target/linux/ramips/dts/mt7620a_asus_rt-ac51u.dts index ef74094bba..e3a76037d4 100644 --- a/target/linux/ramips/dts/mt7620a_asus_rt-ac51u.dts +++ b/target/linux/ramips/dts/mt7620a_asus_rt-ac51u.dts @@ -1,9 +1,6 @@ /dts-v1/; -#include "mt7620a.dtsi" - -#include -#include +#include "mt7620a_asus_rt-ac5x.dtsi" / { compatible = "asus,rt-ac51u", "ralink,mt7620a-soc"; @@ -36,93 +33,10 @@ gpios = <&gpio3 0 GPIO_ACTIVE_LOW>; }; }; - - keys { - compatible = "gpio-keys"; - - reset { - label = "reset"; - gpios = <&gpio0 1 GPIO_ACTIVE_LOW>; - linux,code = ; - }; - - wps { - label = "wps"; - gpios = <&gpio0 2 GPIO_ACTIVE_LOW>; - linux,code = ; - }; - }; -}; - -&spi0 { - status = "okay"; - - flash@0 { - compatible = "jedec,spi-nor"; - reg = <0>; - spi-max-frequency = <10000000>; - - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - partition@0 { - label = "u-boot"; - reg = <0x0 0x30000>; - read-only; - }; - - partition@30000 { - label = "u-boot-env"; - reg = <0x30000 0x10000>; - read-only; - }; - - factory: partition@40000 { - label = "factory"; - reg = <0x40000 0x10000>; - read-only; - }; - - partition@50000 { - compatible = "denx,uimage"; - label = "firmware"; - reg = <0x50000 0xfb0000>; - }; - }; - }; -}; - -&ehci { - status = "okay"; -}; - -&ohci { - status = "okay"; -}; - -&gpio0 { - enable-leds { - gpio-hog; - line-name = "enable-leds"; - output-low; - gpios = <10 GPIO_ACTIVE_HIGH>; - }; -}; - -&gpio3 { - status = "okay"; }; ðernet { - status = "okay"; mtd-mac-address = <&factory 0x4>; - mediatek,portmap = "wllll"; -}; - -&wmac { - ralink,mtd-eeprom = <&factory 0x0>; }; &state_default { @@ -132,10 +46,6 @@ }; }; -&pcie { - status = "okay"; -}; - &pcie0 { wifi@0,0 { reg = <0x0000 0 0 0 0>; diff --git a/target/linux/ramips/dts/mt7620a_asus_rt-ac54u.dts b/target/linux/ramips/dts/mt7620a_asus_rt-ac54u.dts new file mode 100644 index 0000000000..09e9b780de --- /dev/null +++ b/target/linux/ramips/dts/mt7620a_asus_rt-ac54u.dts @@ -0,0 +1,61 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT +/dts-v1/; + +#include "mt7620a_asus_rt-ac5x.dtsi" + +/ { + compatible = "asus,rt-ac54u", "ralink,mt7620a-soc"; + model = "Asus RT-AC54U"; + + aliases { + led-boot = &led_power; + led-failsafe = &led_power; + led-running = &led_power; + led-upgrade = &led_power; + }; + + leds { + compatible = "gpio-leds"; + + led_power: power { + label = "rt-ac54u:blue:power"; + gpios = <&gpio0 9 GPIO_ACTIVE_LOW>; + }; + + usb { + label = "rt-ac54u:blue:usb"; + gpios = <&gpio0 14 GPIO_ACTIVE_LOW>; + trigger-sources = <&ohci_port1>, <&ehci_port1>; + linux,default-trigger = "usbport"; + }; + + wifi2g { + label = "rt-ac54u:blue:wifi2g"; + gpios = <&gpio3 0 GPIO_ACTIVE_LOW>; + linux,default-trigger = "phy1tpt"; + }; + }; +}; + +ðernet { + mtd-mac-address = <&factory 0x22>; +}; + +&state_default { + gpio { + groups = "i2c", "wled", "uartf"; + function = "gpio"; + }; +}; + +&pcie0 { + wifi@0,0 { + reg = <0x0000 0 0 0 0>; + mediatek,mtd-eeprom = <&factory 0x8000>; + ieee80211-freq-limit = <5000000 6000000>; + + led { + led-sources = <2>; + }; + }; +}; diff --git a/target/linux/ramips/dts/mt7620a_asus_rt-ac5x.dtsi b/target/linux/ramips/dts/mt7620a_asus_rt-ac5x.dtsi new file mode 100644 index 0000000000..83a789f287 --- /dev/null +++ b/target/linux/ramips/dts/mt7620a_asus_rt-ac5x.dtsi @@ -0,0 +1,95 @@ +#include "mt7620a.dtsi" + +#include +#include + +/ { + keys { + compatible = "gpio-keys"; + + reset { + label = "reset"; + gpios = <&gpio0 1 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + + wps { + label = "wps"; + gpios = <&gpio0 2 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + }; +}; + +&spi0 { + status = "okay"; + + flash@0 { + compatible = "jedec,spi-nor"; + reg = <0>; + spi-max-frequency = <10000000>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "u-boot"; + reg = <0x0 0x30000>; + read-only; + }; + + partition@30000 { + label = "u-boot-env"; + reg = <0x30000 0x10000>; + read-only; + }; + + factory: partition@40000 { + label = "factory"; + reg = <0x40000 0x10000>; + read-only; + }; + + partition@50000 { + compatible = "denx,uimage"; + label = "firmware"; + reg = <0x50000 0xfb0000>; + }; + }; + }; +}; + +&ehci { + status = "okay"; +}; + +&ohci { + status = "okay"; +}; + +&gpio0 { + enable-leds { + gpio-hog; + line-name = "enable-leds"; + output-low; + gpios = <10 GPIO_ACTIVE_HIGH>; + }; +}; + +&gpio3 { + status = "okay"; +}; + +ðernet { + mediatek,portmap = "wllll"; +}; + +&wmac { + ralink,mtd-eeprom = <&factory 0x0>; +}; + +&pcie { + status = "okay"; +}; diff --git a/target/linux/ramips/dts/mt7620a_bdcom_wap2100-sk.dts b/target/linux/ramips/dts/mt7620a_bdcom_wap2100-sk.dts index 878c720c39..c9ecf78573 100644 --- a/target/linux/ramips/dts/mt7620a_bdcom_wap2100-sk.dts +++ b/target/linux/ramips/dts/mt7620a_bdcom_wap2100-sk.dts @@ -123,6 +123,7 @@ ðernet { mtd-mac-address = <&factory 0x4>; + mediatek,portmap = "llllw"; }; diff --git a/target/linux/ramips/dts/mt7620a_buffalo_whr-300hp2.dts b/target/linux/ramips/dts/mt7620a_buffalo_whr-300hp2.dts index c35abf241e..927a150743 100644 --- a/target/linux/ramips/dts/mt7620a_buffalo_whr-300hp2.dts +++ b/target/linux/ramips/dts/mt7620a_buffalo_whr-300hp2.dts @@ -140,7 +140,9 @@ ðernet { pinctrl-names = "default"; pinctrl-0 = <&ephy_pins>; + mtd-mac-address = <&factory 0x4>; + mediatek,portmap = "llllw"; }; diff --git a/target/linux/ramips/dts/mt7620a_buffalo_whr-600d.dts b/target/linux/ramips/dts/mt7620a_buffalo_whr-600d.dts index e95daf9b34..fd36f160a4 100644 --- a/target/linux/ramips/dts/mt7620a_buffalo_whr-600d.dts +++ b/target/linux/ramips/dts/mt7620a_buffalo_whr-600d.dts @@ -140,7 +140,9 @@ ðernet { pinctrl-names = "default"; pinctrl-0 = <&ephy_pins>; + mtd-mac-address = <&factory 0x4>; + mediatek,portmap = "llllw"; }; diff --git a/target/linux/ramips/dts/mt7620a_dlink_dir-810l.dts b/target/linux/ramips/dts/mt7620a_dlink_dir-810l.dts index 9e60b42f71..8f6bf971ec 100644 --- a/target/linux/ramips/dts/mt7620a_dlink_dir-810l.dts +++ b/target/linux/ramips/dts/mt7620a_dlink_dir-810l.dts @@ -126,6 +126,7 @@ ðernet { mtd-mac-address = <&factory 0x28>; + mediatek,portmap = "llllw"; }; diff --git a/target/linux/ramips/dts/mt7620a_dlink_dwr-118-a1.dts b/target/linux/ramips/dts/mt7620a_dlink_dwr-118-a1.dts index a01ef25bfa..17df95b374 100644 --- a/target/linux/ramips/dts/mt7620a_dlink_dwr-118-a1.dts +++ b/target/linux/ramips/dts/mt7620a_dlink_dwr-118-a1.dts @@ -155,7 +155,6 @@ }; ðernet { - status = "okay"; pinctrl-names = "default"; pinctrl-0 = <&rgmii1_pins &rgmii2_pins &mdio_pins>; diff --git a/target/linux/ramips/dts/mt7620a_dlink_dwr-118-a2.dts b/target/linux/ramips/dts/mt7620a_dlink_dwr-118-a2.dts index d795c06b50..c54c85c420 100644 --- a/target/linux/ramips/dts/mt7620a_dlink_dwr-118-a2.dts +++ b/target/linux/ramips/dts/mt7620a_dlink_dwr-118-a2.dts @@ -153,11 +153,11 @@ }; ðernet { - status = "okay"; - mediatek,portmap = "wllll"; pinctrl-names = "default"; pinctrl-0 = <&rgmii1_pins &mdio_pins>; + mediatek,portmap = "wllll"; + port@4 { status = "okay"; phy-handle = <&phy0>; diff --git a/target/linux/ramips/dts/mt7620a_dlink_dwr-960.dts b/target/linux/ramips/dts/mt7620a_dlink_dwr-960.dts index 71ed648d41..ee8a48a08d 100644 --- a/target/linux/ramips/dts/mt7620a_dlink_dwr-960.dts +++ b/target/linux/ramips/dts/mt7620a_dlink_dwr-960.dts @@ -91,10 +91,9 @@ }; ðernet { - status = "okay"; - pinctrl-names = "default"; pinctrl-0 = <&rgmii2_pins &mdio_pins>; + mediatek,portmap = "wllll"; port@5 { diff --git a/target/linux/ramips/dts/mt7620a_dovado_tiny-ac.dts b/target/linux/ramips/dts/mt7620a_dovado_tiny-ac.dts index ed98c605f8..6eab114fa5 100644 --- a/target/linux/ramips/dts/mt7620a_dovado_tiny-ac.dts +++ b/target/linux/ramips/dts/mt7620a_dovado_tiny-ac.dts @@ -112,9 +112,9 @@ }; ðernet { - status = "okay"; pinctrl-names = "default"; pinctrl-0 = <&rgmii1_pins &rgmii2_pins &mdio_pins>; + mediatek,portmap = "llllw"; port@4 { diff --git a/target/linux/ramips/dts/mt7620a_edimax_br-6478ac-v2.dts b/target/linux/ramips/dts/mt7620a_edimax_br-6478ac-v2.dts index 1c9ffc8dfc..977f0aa356 100644 --- a/target/linux/ramips/dts/mt7620a_edimax_br-6478ac-v2.dts +++ b/target/linux/ramips/dts/mt7620a_edimax_br-6478ac-v2.dts @@ -138,10 +138,11 @@ }; ðernet { - status = "okay"; - mtd-mac-address = <&factory 0x4>; pinctrl-names = "default"; pinctrl-0 = <&rgmii1_pins &rgmii2_pins &mdio_pins>; + + mtd-mac-address = <&factory 0x4>; + mediatek,portmap = "wllll"; port@5 { diff --git a/target/linux/ramips/dts/mt7620a_edimax_ew-7478apc.dts b/target/linux/ramips/dts/mt7620a_edimax_ew-7478apc.dts index d50a770968..966c47b465 100644 --- a/target/linux/ramips/dts/mt7620a_edimax_ew-7478apc.dts +++ b/target/linux/ramips/dts/mt7620a_edimax_ew-7478apc.dts @@ -123,10 +123,11 @@ }; ðernet { - status = "okay"; - mtd-mac-address = <&factory 0x4>; pinctrl-names = "default"; pinctrl-0 = <&rgmii1_pins &rgmii2_pins &mdio_pins>; + + mtd-mac-address = <&factory 0x4>; + mediatek,portmap = "wllll"; port@5 { diff --git a/target/linux/ramips/dts/mt7620a_edimax_ew-747x.dtsi b/target/linux/ramips/dts/mt7620a_edimax_ew-747x.dtsi index 11cf9bb291..4f2745286d 100644 --- a/target/linux/ramips/dts/mt7620a_edimax_ew-747x.dtsi +++ b/target/linux/ramips/dts/mt7620a_edimax_ew-747x.dtsi @@ -115,13 +115,11 @@ }; ðernet { - status = "okay"; - - mtd-mac-address = <&factory 0x4>; - pinctrl-names = "default"; pinctrl-0 = <&rgmii1_pins &mdio_pins &phy_reset_pins>; + mtd-mac-address = <&factory 0x4>; + mediatek,mdio-mode = <1>; phy-reset-gpios = <&gpio1 15 GPIO_ACTIVE_LOW>; diff --git a/target/linux/ramips/dts/mt7620a_engenius_esr600.dts b/target/linux/ramips/dts/mt7620a_engenius_esr600.dts index d7dbb1bfa4..92d9008c69 100644 --- a/target/linux/ramips/dts/mt7620a_engenius_esr600.dts +++ b/target/linux/ramips/dts/mt7620a_engenius_esr600.dts @@ -136,9 +136,9 @@ }; ðernet { - status = "okay"; pinctrl-names = "default"; pinctrl-0 = <&rgmii1_pins &mdio_pins>; + mtd-mac-address = <&iNIC_rf 0x4>; port@5 { diff --git a/target/linux/ramips/dts/mt7620a_glinet_gl-mt300a.dts b/target/linux/ramips/dts/mt7620a_glinet_gl-mt300a.dts index 6fad06d116..f414e3108c 100644 --- a/target/linux/ramips/dts/mt7620a_glinet_gl-mt300a.dts +++ b/target/linux/ramips/dts/mt7620a_glinet_gl-mt300a.dts @@ -138,6 +138,7 @@ ðernet { mtd-mac-address = <&factory 0x4000>; + mediatek,portmap = "wllll"; }; diff --git a/target/linux/ramips/dts/mt7620a_glinet_gl-mt300n.dts b/target/linux/ramips/dts/mt7620a_glinet_gl-mt300n.dts index 693a6bfa6f..281ba366f1 100644 --- a/target/linux/ramips/dts/mt7620a_glinet_gl-mt300n.dts +++ b/target/linux/ramips/dts/mt7620a_glinet_gl-mt300n.dts @@ -129,6 +129,7 @@ ðernet { mtd-mac-address = <&factory 0x4000>; + mediatek,portmap = "wllll"; }; diff --git a/target/linux/ramips/dts/mt7620a_glinet_gl-mt750.dts b/target/linux/ramips/dts/mt7620a_glinet_gl-mt750.dts index 4e9616367a..a772bca605 100644 --- a/target/linux/ramips/dts/mt7620a_glinet_gl-mt750.dts +++ b/target/linux/ramips/dts/mt7620a_glinet_gl-mt750.dts @@ -133,6 +133,7 @@ ðernet { mtd-mac-address = <&factory 0x4000>; + mediatek,portmap = "llllw"; }; diff --git a/target/linux/ramips/dts/mt7620a_head-weblink_hdrm200.dts b/target/linux/ramips/dts/mt7620a_head-weblink_hdrm200.dts index abc13ee7d0..e52a564213 100644 --- a/target/linux/ramips/dts/mt7620a_head-weblink_hdrm200.dts +++ b/target/linux/ramips/dts/mt7620a_head-weblink_hdrm200.dts @@ -122,12 +122,11 @@ }; ðernet { - status = "okay"; - - mtd-mac-address = <&factory 0x4>; pinctrl-names = "default"; pinctrl-0 = <&rgmii1_pins &rgmii2_pins &mdio_pins>; + mtd-mac-address = <&factory 0x4>; + port@4 { status = "okay"; phy-handle = <&phy4>; diff --git a/target/linux/ramips/dts/mt7620a_hiwifi_hc5861.dts b/target/linux/ramips/dts/mt7620a_hiwifi_hc5861.dts index 83a3a67ed0..8951044f63 100644 --- a/target/linux/ramips/dts/mt7620a_hiwifi_hc5861.dts +++ b/target/linux/ramips/dts/mt7620a_hiwifi_hc5861.dts @@ -71,10 +71,11 @@ }; ðernet { - status = "okay"; - mtd-mac-address = <&factory 0x4>; pinctrl-names = "default"; pinctrl-0 = <&rgmii1_pins &mdio_pins>; + + mtd-mac-address = <&factory 0x4>; + mediatek,portmap = "wllll"; port@5 { diff --git a/target/linux/ramips/dts/mt7620a_hiwifi_hc5x61.dtsi b/target/linux/ramips/dts/mt7620a_hiwifi_hc5x61.dtsi index e3494f9cb6..0676c6f84b 100644 --- a/target/linux/ramips/dts/mt7620a_hiwifi_hc5x61.dtsi +++ b/target/linux/ramips/dts/mt7620a_hiwifi_hc5x61.dtsi @@ -111,7 +111,9 @@ ðernet { pinctrl-names = "default"; pinctrl-0 = <&ephy_pins>; + mtd-mac-address = <&factory 0x4>; + mediatek,portmap = "wllll"; }; diff --git a/target/linux/ramips/dts/mt7620a_iodata_wn-ac1167gr.dts b/target/linux/ramips/dts/mt7620a_iodata_wn-ac1167gr.dts index 1cc59e4bb6..60a67c6eac 100644 --- a/target/linux/ramips/dts/mt7620a_iodata_wn-ac1167gr.dts +++ b/target/linux/ramips/dts/mt7620a_iodata_wn-ac1167gr.dts @@ -139,6 +139,7 @@ ðernet { pinctrl-names = "default"; pinctrl-0 = <&rgmii1_pins &mdio_pins>; + mtd-mac-address = <&factory 0x4>; port@5 { diff --git a/target/linux/ramips/dts/mt7620a_iodata_wn-ac733gr3.dts b/target/linux/ramips/dts/mt7620a_iodata_wn-ac733gr3.dts index 098aaa007f..02f620fbf3 100644 --- a/target/linux/ramips/dts/mt7620a_iodata_wn-ac733gr3.dts +++ b/target/linux/ramips/dts/mt7620a_iodata_wn-ac733gr3.dts @@ -147,6 +147,7 @@ ðernet { pinctrl-names = "default"; pinctrl-0 = <&rgmii1_pins>; + mtd-mac-address = <&factory 0x4>; port@5 { diff --git a/target/linux/ramips/dts/mt7620a_lava_lr-25g001.dts b/target/linux/ramips/dts/mt7620a_lava_lr-25g001.dts index c1406503eb..b05a7a89b4 100644 --- a/target/linux/ramips/dts/mt7620a_lava_lr-25g001.dts +++ b/target/linux/ramips/dts/mt7620a_lava_lr-25g001.dts @@ -110,7 +110,6 @@ }; ðernet { - status = "okay"; pinctrl-names = "default"; pinctrl-0 = <&rgmii1_pins &rgmii2_pins &mdio_pins>; diff --git a/target/linux/ramips/dts/mt7620a_lb-link_bl-w1200.dts b/target/linux/ramips/dts/mt7620a_lb-link_bl-w1200.dts index a55550d969..641b5ad7b1 100644 --- a/target/linux/ramips/dts/mt7620a_lb-link_bl-w1200.dts +++ b/target/linux/ramips/dts/mt7620a_lb-link_bl-w1200.dts @@ -93,11 +93,11 @@ }; ðernet { - status = "okay"; - - mtd-mac-address = <&factory 0x28>; pinctrl-names = "default"; pinctrl-0 = <&rgmii2_pins &mdio_pins>; + + mtd-mac-address = <&factory 0x28>; + mediatek,portmap = "wllll"; port@5 { diff --git a/target/linux/ramips/dts/mt7620a_lenovo_newifi-y1.dts b/target/linux/ramips/dts/mt7620a_lenovo_newifi-y1.dts index 2b98d6c55f..88c747e2d6 100644 --- a/target/linux/ramips/dts/mt7620a_lenovo_newifi-y1.dts +++ b/target/linux/ramips/dts/mt7620a_lenovo_newifi-y1.dts @@ -54,6 +54,8 @@ ðernet { pinctrl-names = "default"; pinctrl-0 = <&ephy_pins>; + mtd-mac-address = <&factory 0x28>; + mediatek,portmap = "llllw"; }; diff --git a/target/linux/ramips/dts/mt7620a_lenovo_newifi-y1s.dts b/target/linux/ramips/dts/mt7620a_lenovo_newifi-y1s.dts index de01b480e5..60cd501aeb 100644 --- a/target/linux/ramips/dts/mt7620a_lenovo_newifi-y1s.dts +++ b/target/linux/ramips/dts/mt7620a_lenovo_newifi-y1s.dts @@ -78,10 +78,11 @@ }; ðernet { - status = "okay"; - mtd-mac-address = <&factory 0x28>; pinctrl-names = "default"; pinctrl-0 = <&rgmii1_pins &rgmii2_pins &mdio_pins>; + + mtd-mac-address = <&factory 0x28>; + mediatek,portmap = "wllll"; port@4 { diff --git a/target/linux/ramips/dts/mt7620a_linksys_e1700.dts b/target/linux/ramips/dts/mt7620a_linksys_e1700.dts index ed74068c80..2eb3033b44 100644 --- a/target/linux/ramips/dts/mt7620a_linksys_e1700.dts +++ b/target/linux/ramips/dts/mt7620a_linksys_e1700.dts @@ -105,11 +105,11 @@ }; ðernet { - status = "okay"; - mtd-mac-address = <&factory 0x28>; pinctrl-names = "default"; pinctrl-0 = <&rgmii1_pins &rgmii2_pins &mdio_pins>; + mtd-mac-address = <&factory 0x28>; + port@5 { status = "okay"; mediatek,fixed-link = <1000 1 1 1>; diff --git a/target/linux/ramips/dts/mt7620a_microduino_microwrt.dts b/target/linux/ramips/dts/mt7620a_microduino_microwrt.dts index 037a8858f7..b432bcf9f1 100644 --- a/target/linux/ramips/dts/mt7620a_microduino_microwrt.dts +++ b/target/linux/ramips/dts/mt7620a_microduino_microwrt.dts @@ -89,7 +89,9 @@ ðernet { pinctrl-names = "default"; pinctrl-0 = <&ephy_pins>; + mtd-mac-address = <&factory 0x4>; + mediatek,portmap = "llllw"; }; diff --git a/target/linux/ramips/dts/mt7620a_netis_wf2770.dts b/target/linux/ramips/dts/mt7620a_netis_wf2770.dts new file mode 100644 index 0000000000..a0e9cfff10 --- /dev/null +++ b/target/linux/ramips/dts/mt7620a_netis_wf2770.dts @@ -0,0 +1,161 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT +/dts-v1/; + +#include "mt7620a.dtsi" + +#include +#include + +/ { + compatible = "netis,wf2770", "ralink,mt7620a-soc"; + model = "NETIS WF2770"; + + leds { + compatible = "gpio-leds"; + + wlan { + label = "wf2770:blue:wlan"; + gpios = <&gpio0 14 GPIO_ACTIVE_LOW>; + linux,default-trigger = "phy0tpt"; + }; + }; + + keys { + compatible = "gpio-keys"; + + reset { + label = "reset"; + gpios = <&gpio0 1 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + + wps { + label = "wps"; + gpios = <&gpio0 2 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + + rfkill { + label = "rfkill"; + gpios = <&gpio0 7 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + + led-toggle { + label = "led-toggle"; + gpios = <&gpio0 11 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + }; +}; + +&spi0 { + status = "okay"; + + flash@0 { + compatible = "jedec,spi-nor"; + reg = <0>; + spi-max-frequency = <50000000>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "u-boot"; + reg = <0x0 0x30000>; + read-only; + }; + + partition@30000 { + label = "config"; + reg = <0x30000 0x10000>; + read-only; + }; + + factory: partition@40000 { + label = "factory"; + reg = <0x40000 0x10000>; + read-only; + }; + + partition@50000 { + compatible = "denx,uimage"; + label = "firmware"; + reg = <0x50000 0xfb0000>; + }; + }; + }; +}; + +&state_default { + gpio { + groups = "i2c", "uartf"; + function = "gpio"; + }; +}; + +ðernet { + pinctrl-names = "default"; + pinctrl-0 = <&rgmii1_pins &mdio_pins>; + + mtd-mac-address = <&factory 0x4>; + + port@5 { + status = "okay"; + mediatek,fixed-link = <1000 1 1 1>; + phy-mode = "rgmii"; + }; + + mdio-bus { + status = "okay"; + + ethernet-phy@0 { + reg = <0>; + phy-mode = "rgmii"; + }; + + ethernet-phy@1 { + reg = <1>; + phy-mode = "rgmii"; + }; + + ethernet-phy@2 { + reg = <2>; + phy-mode = "rgmii"; + }; + + ethernet-phy@3 { + reg = <3>; + phy-mode = "rgmii"; + }; + + ethernet-phy@4 { + reg = <4>; + phy-mode = "rgmii"; + }; + + ethernet-phy@1f { + reg = <0x1f>; + phy-mode = "rgmii"; + }; + }; +}; + +&pcie { + status = "okay"; +}; + +&pcie0 { + wifi@0,0 { + compatible = "mediatek,mt76"; + reg = <0x0000 0 0 0 0>; + mediatek,mtd-eeprom = <&factory 0x8000>; + ieee80211-freq-limit = <5000000 6000000>; + }; +}; + +&wmac { + ralink,mtd-eeprom = <&factory 0x0>; +}; diff --git a/target/linux/ramips/dts/mt7620a_ohyeah_oy-0001.dts b/target/linux/ramips/dts/mt7620a_ohyeah_oy-0001.dts index 4a2006da07..9992bb8b01 100644 --- a/target/linux/ramips/dts/mt7620a_ohyeah_oy-0001.dts +++ b/target/linux/ramips/dts/mt7620a_ohyeah_oy-0001.dts @@ -103,7 +103,9 @@ ðernet { pinctrl-names = "default"; pinctrl-0 = <&ephy_pins>; + mtd-mac-address = <&factory 0x28>; + mediatek,portmap = "llllw"; }; diff --git a/target/linux/ramips/dts/mt7620a_phicomm_k2g.dts b/target/linux/ramips/dts/mt7620a_phicomm_k2g.dts index 382a1d7913..a878c43054 100644 --- a/target/linux/ramips/dts/mt7620a_phicomm_k2g.dts +++ b/target/linux/ramips/dts/mt7620a_phicomm_k2g.dts @@ -103,7 +103,9 @@ ðernet { pinctrl-names = "default"; pinctrl-0 = <&rgmii2_pins &mdio_pins>; + mtd-mac-address = <&factory 0x28>; + mediatek,portmap = "llllw"; port@5 { diff --git a/target/linux/ramips/dts/mt7620a_phicomm_psg1208.dts b/target/linux/ramips/dts/mt7620a_phicomm_psg1208.dts index 5ed0724259..a0c7fe91bc 100644 --- a/target/linux/ramips/dts/mt7620a_phicomm_psg1208.dts +++ b/target/linux/ramips/dts/mt7620a_phicomm_psg1208.dts @@ -99,7 +99,9 @@ ðernet { pinctrl-names = "default"; pinctrl-0 = <&ephy_pins>; + mtd-mac-address = <&factory 0x4>; + mediatek,portmap = "llllw"; }; diff --git a/target/linux/ramips/dts/mt7620a_phicomm_psg1218a.dts b/target/linux/ramips/dts/mt7620a_phicomm_psg1218a.dts index 0d9ef767c4..71cf56c554 100644 --- a/target/linux/ramips/dts/mt7620a_phicomm_psg1218a.dts +++ b/target/linux/ramips/dts/mt7620a_phicomm_psg1218a.dts @@ -44,7 +44,9 @@ ðernet { pinctrl-names = "default"; pinctrl-0 = <&ephy_pins>; + mtd-mac-address = <&factory 0x28>; + mediatek,portmap = "llllw"; }; diff --git a/target/linux/ramips/dts/mt7620a_phicomm_psg1218b.dts b/target/linux/ramips/dts/mt7620a_phicomm_psg1218b.dts index 7f9fea2b07..2932b5a3dc 100644 --- a/target/linux/ramips/dts/mt7620a_phicomm_psg1218b.dts +++ b/target/linux/ramips/dts/mt7620a_phicomm_psg1218b.dts @@ -44,6 +44,8 @@ ðernet { pinctrl-names = "default"; pinctrl-0 = <&ephy_pins>; + mtd-mac-address = <&factory 0x28>; + mediatek,portmap = "llllw"; }; diff --git a/target/linux/ramips/dts/mt7620a_planex_cs-qr10.dts b/target/linux/ramips/dts/mt7620a_planex_cs-qr10.dts index 4466c56fd4..77a48e8ec1 100644 --- a/target/linux/ramips/dts/mt7620a_planex_cs-qr10.dts +++ b/target/linux/ramips/dts/mt7620a_planex_cs-qr10.dts @@ -130,7 +130,9 @@ ðernet { pinctrl-names = "default"; pinctrl-0 = <&ephy_pins>; + mtd-mac-address = <&factory 0x4>; + mediatek,portmap = "llllw"; }; diff --git a/target/linux/ramips/dts/mt7620a_planex_db-wrt01.dts b/target/linux/ramips/dts/mt7620a_planex_db-wrt01.dts index c38d1e55dd..29b235d24c 100644 --- a/target/linux/ramips/dts/mt7620a_planex_db-wrt01.dts +++ b/target/linux/ramips/dts/mt7620a_planex_db-wrt01.dts @@ -90,7 +90,9 @@ ðernet { pinctrl-names = "default"; pinctrl-0 = <&ephy_pins>; + mtd-mac-address = <&factory 0x4>; + mediatek,portmap = "llllw"; }; diff --git a/target/linux/ramips/dts/mt7620a_planex_mzk-750dhp.dts b/target/linux/ramips/dts/mt7620a_planex_mzk-750dhp.dts index dde751901e..87a6f29944 100644 --- a/target/linux/ramips/dts/mt7620a_planex_mzk-750dhp.dts +++ b/target/linux/ramips/dts/mt7620a_planex_mzk-750dhp.dts @@ -110,7 +110,9 @@ ðernet { pinctrl-names = "default"; pinctrl-0 = <&ephy_pins>; + mtd-mac-address = <&factory 0x4>; + mediatek,portmap = "llllw"; }; diff --git a/target/linux/ramips/dts/mt7620a_planex_mzk-ex300np.dts b/target/linux/ramips/dts/mt7620a_planex_mzk-ex300np.dts index 6eb3e85f2c..05478f5960 100644 --- a/target/linux/ramips/dts/mt7620a_planex_mzk-ex300np.dts +++ b/target/linux/ramips/dts/mt7620a_planex_mzk-ex300np.dts @@ -130,7 +130,9 @@ ðernet { pinctrl-names = "default"; pinctrl-0 = <&ephy_pins>; + mtd-mac-address = <&factory 0x4>; + mediatek,portmap = "llllw"; }; diff --git a/target/linux/ramips/dts/mt7620a_planex_mzk-ex750np.dts b/target/linux/ramips/dts/mt7620a_planex_mzk-ex750np.dts index 13a3ecdf83..a5e44cff0b 100644 --- a/target/linux/ramips/dts/mt7620a_planex_mzk-ex750np.dts +++ b/target/linux/ramips/dts/mt7620a_planex_mzk-ex750np.dts @@ -135,7 +135,9 @@ ðernet { pinctrl-names = "default"; pinctrl-0 = <&ephy_pins>; + mtd-mac-address = <&factory 0x4>; + mediatek,portmap = "llllw"; }; diff --git a/target/linux/ramips/dts/mt7620a_ralink_mt7620a-evb.dts b/target/linux/ramips/dts/mt7620a_ralink_mt7620a-evb.dts index 4a3de47edb..fbdec1b5c5 100644 --- a/target/linux/ramips/dts/mt7620a_ralink_mt7620a-evb.dts +++ b/target/linux/ramips/dts/mt7620a_ralink_mt7620a-evb.dts @@ -74,9 +74,9 @@ }; ðernet { - status = "okay"; pinctrl-names = "default"; pinctrl-0 = <&rgmii1_pins &rgmii2_pins &mdio_pins>; + mediatek,portmap = "llllw"; port@4 { diff --git a/target/linux/ramips/dts/mt7620a_ralink_mt7620a-mt7530-evb.dts b/target/linux/ramips/dts/mt7620a_ralink_mt7620a-mt7530-evb.dts index 89c5aedcce..ba1d41545a 100644 --- a/target/linux/ramips/dts/mt7620a_ralink_mt7620a-mt7530-evb.dts +++ b/target/linux/ramips/dts/mt7620a_ralink_mt7620a-mt7530-evb.dts @@ -55,9 +55,9 @@ }; ðernet { - status = "okay"; pinctrl-names = "default"; pinctrl-0 = <&rgmii1_pins &rgmii2_pins &mdio_pins>; + mediatek,portmap = "llllw"; port@5 { diff --git a/target/linux/ramips/dts/mt7620a_ralink_mt7620a-mt7610e-evb.dts b/target/linux/ramips/dts/mt7620a_ralink_mt7620a-mt7610e-evb.dts index a589179121..0660047ead 100644 --- a/target/linux/ramips/dts/mt7620a_ralink_mt7620a-mt7610e-evb.dts +++ b/target/linux/ramips/dts/mt7620a_ralink_mt7620a-mt7610e-evb.dts @@ -71,9 +71,9 @@ }; ðernet { - status = "okay"; pinctrl-names = "default"; pinctrl-0 = <&ephy_pins>; + mediatek,portmap = "llllw"; }; diff --git a/target/linux/ramips/dts/mt7620a_ralink_mt7620a-v22sg-evb.dts b/target/linux/ramips/dts/mt7620a_ralink_mt7620a-v22sg-evb.dts index ee148dbde3..1baa3a7331 100644 --- a/target/linux/ramips/dts/mt7620a_ralink_mt7620a-v22sg-evb.dts +++ b/target/linux/ramips/dts/mt7620a_ralink_mt7620a-v22sg-evb.dts @@ -68,9 +68,9 @@ }; ðernet { - status = "okay"; pinctrl-names = "default"; pinctrl-0 = <&rgmii1_pins &rgmii2_pins &mdio_pins>; + mediatek,portmap = "llllw"; port@4 { diff --git a/target/linux/ramips/dts/mt7620a_sanlinking_d240.dts b/target/linux/ramips/dts/mt7620a_sanlinking_d240.dts index 52d4477f57..79649a5990 100644 --- a/target/linux/ramips/dts/mt7620a_sanlinking_d240.dts +++ b/target/linux/ramips/dts/mt7620a_sanlinking_d240.dts @@ -170,6 +170,7 @@ ðernet { mtd-mac-address = <&factory 0x4>; + mediatek,portmap = "wllll"; }; diff --git a/target/linux/ramips/dts/mt7620a_sercomm_na930.dts b/target/linux/ramips/dts/mt7620a_sercomm_na930.dts index 9313e6259f..e90f5a440b 100644 --- a/target/linux/ramips/dts/mt7620a_sercomm_na930.dts +++ b/target/linux/ramips/dts/mt7620a_sercomm_na930.dts @@ -139,9 +139,9 @@ }; ðernet { - status = "okay"; pinctrl-names = "default"; pinctrl-0 = <&rgmii1_pins &mdio_pins>; + mediatek,portmap = "llllw"; port@4 { diff --git a/target/linux/ramips/dts/mt7620a_tplink_archer-c2-v1.dts b/target/linux/ramips/dts/mt7620a_tplink_archer-c2-v1.dts index 9681964cd2..c0b2c1ae92 100644 --- a/target/linux/ramips/dts/mt7620a_tplink_archer-c2-v1.dts +++ b/target/linux/ramips/dts/mt7620a_tplink_archer-c2-v1.dts @@ -129,11 +129,11 @@ }; ðernet { - status = "okay"; - mtd-mac-address = <&rom 0xf100>; pinctrl-names = "default"; pinctrl-0 = <&rgmii1_pins &rgmii2_pins &mdio_pins>; + mtd-mac-address = <&rom 0xf100>; + port@5 { status = "okay"; mediatek,fixed-link = <1000 1 1 1>; diff --git a/target/linux/ramips/dts/mt7620a_tplink_archer.dtsi b/target/linux/ramips/dts/mt7620a_tplink_archer.dtsi index 74908e05aa..184627b9f4 100644 --- a/target/linux/ramips/dts/mt7620a_tplink_archer.dtsi +++ b/target/linux/ramips/dts/mt7620a_tplink_archer.dtsi @@ -91,7 +91,9 @@ ðernet { pinctrl-names = "default"; + mtd-mac-address = <&rom 0xf100>; + mediatek,portmap = "wllll"; }; diff --git a/target/linux/ramips/dts/mt7620a_xiaomi_miwifi-mini.dts b/target/linux/ramips/dts/mt7620a_xiaomi_miwifi-mini.dts index 3857c4a954..f3340b9f5e 100644 --- a/target/linux/ramips/dts/mt7620a_xiaomi_miwifi-mini.dts +++ b/target/linux/ramips/dts/mt7620a_xiaomi_miwifi-mini.dts @@ -130,7 +130,9 @@ ðernet { pinctrl-names = "default"; pinctrl-0 = <&ephy_pins>; + mtd-mac-address = <&factory 0x28>; + mediatek,portmap = "llllw"; }; diff --git a/target/linux/ramips/dts/mt7620a_youku_yk1.dts b/target/linux/ramips/dts/mt7620a_youku_yk1.dts index ee7bb37d2c..f14b70d407 100644 --- a/target/linux/ramips/dts/mt7620a_youku_yk1.dts +++ b/target/linux/ramips/dts/mt7620a_youku_yk1.dts @@ -119,7 +119,9 @@ ðernet { pinctrl-names = "default"; + mtd-mac-address = <&factory 0x4>; + mediatek,portmap = "llllw"; }; diff --git a/target/linux/ramips/dts/mt7620a_yukai_bocco.dts b/target/linux/ramips/dts/mt7620a_yukai_bocco.dts index e0a568f3b1..b05fb17197 100644 --- a/target/linux/ramips/dts/mt7620a_yukai_bocco.dts +++ b/target/linux/ramips/dts/mt7620a_yukai_bocco.dts @@ -149,7 +149,9 @@ ðernet { pinctrl-names = "default"; pinctrl-0 = <&ephy_pins>; + mtd-mac-address = <&factory 0x4>; + mediatek,portmap = "llllw"; }; diff --git a/target/linux/ramips/dts/mt7620a_zbtlink_zbt-ape522ii.dts b/target/linux/ramips/dts/mt7620a_zbtlink_zbt-ape522ii.dts index 959fce350e..4aa404542f 100644 --- a/target/linux/ramips/dts/mt7620a_zbtlink_zbt-ape522ii.dts +++ b/target/linux/ramips/dts/mt7620a_zbtlink_zbt-ape522ii.dts @@ -111,7 +111,9 @@ ðernet { pinctrl-names = "default"; pinctrl-0 = <&ephy_pins>; + mtd-mac-address = <&factory 0x4>; + mediatek,portmap = "wllll"; }; diff --git a/target/linux/ramips/dts/mt7620a_zbtlink_zbt-we826.dtsi b/target/linux/ramips/dts/mt7620a_zbtlink_zbt-we826.dtsi index 6cb67d40de..9ebd10bbb0 100644 --- a/target/linux/ramips/dts/mt7620a_zbtlink_zbt-we826.dtsi +++ b/target/linux/ramips/dts/mt7620a_zbtlink_zbt-we826.dtsi @@ -75,6 +75,7 @@ ðernet { mtd-mac-address = <&factory 0x4>; + mediatek,portmap = "wllll"; }; diff --git a/target/linux/ramips/dts/mt7620a_zte_q7.dts b/target/linux/ramips/dts/mt7620a_zte_q7.dts index 0303e3fe3e..6933a86f60 100644 --- a/target/linux/ramips/dts/mt7620a_zte_q7.dts +++ b/target/linux/ramips/dts/mt7620a_zte_q7.dts @@ -98,6 +98,7 @@ ðernet { mtd-mac-address = <&factory 0x4>; + mediatek,portmap = "wllll"; }; diff --git a/target/linux/ramips/dts/mt7620a_zyxel_keenetic-viva.dts b/target/linux/ramips/dts/mt7620a_zyxel_keenetic-viva.dts index 2f648a2700..c41d0a1c1d 100644 --- a/target/linux/ramips/dts/mt7620a_zyxel_keenetic-viva.dts +++ b/target/linux/ramips/dts/mt7620a_zyxel_keenetic-viva.dts @@ -136,9 +136,9 @@ }; ðernet { - status = "okay"; pinctrl-names = "default"; pinctrl-0 = <&rgmii2_pins &mdio_pins>; + mtd-mac-address = <&factory 0x00004>; port@4 { diff --git a/target/linux/ramips/dts/mt7620n_asus_rt-n12p.dts b/target/linux/ramips/dts/mt7620n_asus_rt-n12p.dts index e77615a9f5..5e610be862 100644 --- a/target/linux/ramips/dts/mt7620n_asus_rt-n12p.dts +++ b/target/linux/ramips/dts/mt7620n_asus_rt-n12p.dts @@ -109,6 +109,7 @@ ðernet { mtd-mac-address = <&factory 0x4>; + mediatek,portmap = "wllll"; }; diff --git a/target/linux/ramips/dts/mt7620n_asus_rt-n14u.dts b/target/linux/ramips/dts/mt7620n_asus_rt-n14u.dts index 423641d833..76f728ea65 100644 --- a/target/linux/ramips/dts/mt7620n_asus_rt-n14u.dts +++ b/target/linux/ramips/dts/mt7620n_asus_rt-n14u.dts @@ -122,6 +122,7 @@ ðernet { mtd-mac-address = <&factory 0x4>; + mediatek,portmap = "wllll"; }; diff --git a/target/linux/ramips/dts/mt7620n_buffalo_wmr-300.dts b/target/linux/ramips/dts/mt7620n_buffalo_wmr-300.dts index 986903b601..f84dda3bf8 100644 --- a/target/linux/ramips/dts/mt7620n_buffalo_wmr-300.dts +++ b/target/linux/ramips/dts/mt7620n_buffalo_wmr-300.dts @@ -98,6 +98,7 @@ ðernet { mtd-mac-address = <&factory 0x4>; + mediatek,portmap = "wllll"; }; diff --git a/target/linux/ramips/dts/mt7620n_dlink_dwr-116-a1.dts b/target/linux/ramips/dts/mt7620n_dlink_dwr-116-a1.dts index 1c45c8e8cc..3f75c763f7 100644 --- a/target/linux/ramips/dts/mt7620n_dlink_dwr-116-a1.dts +++ b/target/linux/ramips/dts/mt7620n_dlink_dwr-116-a1.dts @@ -105,7 +105,8 @@ }; ðernet { - mediatek,portmap = "llllw"; pinctrl-names = "default"; pinctrl-0 = <&ephy_pins>; + + mediatek,portmap = "llllw"; }; diff --git a/target/linux/ramips/dts/mt7620n_elecom_wrh-300cr.dts b/target/linux/ramips/dts/mt7620n_elecom_wrh-300cr.dts index deb16785a0..5a75e5ab96 100644 --- a/target/linux/ramips/dts/mt7620n_elecom_wrh-300cr.dts +++ b/target/linux/ramips/dts/mt7620n_elecom_wrh-300cr.dts @@ -119,6 +119,7 @@ ðernet { mtd-mac-address = <&factory 0x2e>; + mediatek,portmap = "llllw"; }; diff --git a/target/linux/ramips/dts/mt7620n_kingston_mlw221.dts b/target/linux/ramips/dts/mt7620n_kingston_mlw221.dts index 2e37fdd884..fbc751fb48 100644 --- a/target/linux/ramips/dts/mt7620n_kingston_mlw221.dts +++ b/target/linux/ramips/dts/mt7620n_kingston_mlw221.dts @@ -114,6 +114,7 @@ ðernet { mtd-mac-address = <&factory 0x4>; + mediatek,portmap = "wllll"; }; diff --git a/target/linux/ramips/dts/mt7620n_kingston_mlwg2.dts b/target/linux/ramips/dts/mt7620n_kingston_mlwg2.dts index 931f0500ba..a4bc5c71bc 100644 --- a/target/linux/ramips/dts/mt7620n_kingston_mlwg2.dts +++ b/target/linux/ramips/dts/mt7620n_kingston_mlwg2.dts @@ -114,6 +114,7 @@ ðernet { mtd-mac-address = <&factory 0x4>; + mediatek,portmap = "wllll"; }; diff --git a/target/linux/ramips/dts/mt7620n_nexx_wt3020.dtsi b/target/linux/ramips/dts/mt7620n_nexx_wt3020.dtsi index 09df87966e..9762472355 100644 --- a/target/linux/ramips/dts/mt7620n_nexx_wt3020.dtsi +++ b/target/linux/ramips/dts/mt7620n_nexx_wt3020.dtsi @@ -44,6 +44,7 @@ ðernet { mtd-mac-address = <&factory 0x4>; + mediatek,portmap = "wllll"; }; diff --git a/target/linux/ramips/dts/mt7620n_ravpower_wd03.dts b/target/linux/ramips/dts/mt7620n_ravpower_wd03.dts index 6d734bb836..f67f186be1 100644 --- a/target/linux/ramips/dts/mt7620n_ravpower_wd03.dts +++ b/target/linux/ramips/dts/mt7620n_ravpower_wd03.dts @@ -100,7 +100,6 @@ ðernet { mtd-mac-address = <&factory 0x4000>; - ralink,port-map = "wllll"; }; &wmac { diff --git a/target/linux/ramips/dts/mt7620n_vonets_var11n-300.dts b/target/linux/ramips/dts/mt7620n_vonets_var11n-300.dts index 09e2cf257d..135e048fca 100644 --- a/target/linux/ramips/dts/mt7620n_vonets_var11n-300.dts +++ b/target/linux/ramips/dts/mt7620n_vonets_var11n-300.dts @@ -82,6 +82,7 @@ ðernet { mtd-mac-address = <&factory 0x4>; + mediatek,portmap = "llllw"; }; diff --git a/target/linux/ramips/dts/mt7620n_wrtnode_wrtnode.dts b/target/linux/ramips/dts/mt7620n_wrtnode_wrtnode.dts index 2c905f7f6a..35dc933d99 100644 --- a/target/linux/ramips/dts/mt7620n_wrtnode_wrtnode.dts +++ b/target/linux/ramips/dts/mt7620n_wrtnode_wrtnode.dts @@ -87,6 +87,7 @@ ðernet { mtd-mac-address = <&factory 0x4>; + mediatek,portmap = "wllll"; }; diff --git a/target/linux/ramips/dts/mt7620n_zbtlink_zbt-cpe102.dts b/target/linux/ramips/dts/mt7620n_zbtlink_zbt-cpe102.dts index 341a231daf..eff3842a3e 100644 --- a/target/linux/ramips/dts/mt7620n_zbtlink_zbt-cpe102.dts +++ b/target/linux/ramips/dts/mt7620n_zbtlink_zbt-cpe102.dts @@ -110,6 +110,7 @@ ðernet { mtd-mac-address = <&factory 0x4>; + mediatek,portmap = "wllll"; }; diff --git a/target/linux/ramips/dts/mt7620n_zbtlink_zbt-wa05.dts b/target/linux/ramips/dts/mt7620n_zbtlink_zbt-wa05.dts index 9439b0c28e..7a111ffac5 100644 --- a/target/linux/ramips/dts/mt7620n_zbtlink_zbt-wa05.dts +++ b/target/linux/ramips/dts/mt7620n_zbtlink_zbt-wa05.dts @@ -114,6 +114,7 @@ ðernet { mtd-mac-address = <&factory 0x4>; + mediatek,portmap = "wllll"; }; diff --git a/target/linux/ramips/dts/mt7620n_zbtlink_zbt-we2026.dts b/target/linux/ramips/dts/mt7620n_zbtlink_zbt-we2026.dts index f293082e96..e5d3cc0a29 100644 --- a/target/linux/ramips/dts/mt7620n_zbtlink_zbt-we2026.dts +++ b/target/linux/ramips/dts/mt7620n_zbtlink_zbt-we2026.dts @@ -95,6 +95,7 @@ ðernet { mtd-mac-address = <&factory 0x4>; + mediatek,portmap = "wllll"; }; diff --git a/target/linux/ramips/dts/mt7620n_zbtlink_zbt-wr8305rt.dts b/target/linux/ramips/dts/mt7620n_zbtlink_zbt-wr8305rt.dts index ee31792ab0..675b42671b 100644 --- a/target/linux/ramips/dts/mt7620n_zbtlink_zbt-wr8305rt.dts +++ b/target/linux/ramips/dts/mt7620n_zbtlink_zbt-wr8305rt.dts @@ -107,7 +107,9 @@ ðernet { pinctrl-names = "default"; pinctrl-0 = <&ephy_pins>; + mtd-mac-address = <&factory 0x4>; + mediatek,portmap = "llllw"; }; diff --git a/target/linux/ramips/dts/mt7620n_zyxel_keenetic-omni-ii.dts b/target/linux/ramips/dts/mt7620n_zyxel_keenetic-omni-ii.dts index 7846bd995a..00af10b0c7 100644 --- a/target/linux/ramips/dts/mt7620n_zyxel_keenetic-omni-ii.dts +++ b/target/linux/ramips/dts/mt7620n_zyxel_keenetic-omni-ii.dts @@ -133,6 +133,7 @@ ðernet { mtd-mac-address = <&factory 0x4>; + mediatek,portmap = "wllll"; }; diff --git a/target/linux/ramips/dts/mt7620n_zyxel_keenetic-omni.dts b/target/linux/ramips/dts/mt7620n_zyxel_keenetic-omni.dts index 2e7a689e27..cbeabf4ec8 100644 --- a/target/linux/ramips/dts/mt7620n_zyxel_keenetic-omni.dts +++ b/target/linux/ramips/dts/mt7620n_zyxel_keenetic-omni.dts @@ -133,6 +133,7 @@ ðernet { mtd-mac-address = <&factory 0x4>; + mediatek,portmap = "llllw"; }; diff --git a/target/linux/ramips/dts/mt7621_linksys_ea7500-v2.dts b/target/linux/ramips/dts/mt7621_linksys_ea7500-v2.dts new file mode 100644 index 0000000000..ac13bdd369 --- /dev/null +++ b/target/linux/ramips/dts/mt7621_linksys_ea7500-v2.dts @@ -0,0 +1,207 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT +/dts-v1/; + +#include "mt7621.dtsi" + +#include +#include + +/ { + compatible = "linksys,ea7500-v2", "mediatek,mt7621-soc"; + model = "Linksys EA7500 v2"; + + aliases { + led-boot = &led_power; + led-failsafe = &led_power; + led-running = &led_power; + led-upgrade = &led_power; + }; + + chosen { + bootargs = "console=ttyS0,115200"; + }; + + leds { + compatible = "gpio-leds"; + + wan_green { + label = "ea7500-v2:green:wan"; + gpios = <&gpio 7 GPIO_ACTIVE_LOW>; + }; + + lan1_green { + label = "ea7500-v2:green:lan1"; + gpios = <&gpio 3 GPIO_ACTIVE_LOW>; + }; + + lan2_green { + label = "ea7500-v2:green:lan2"; + gpios = <&gpio 18 GPIO_ACTIVE_LOW>; + }; + + lan3_green { + label = "ea7500-v2:green:lan3"; + gpios = <&gpio 13 GPIO_ACTIVE_LOW>; + }; + + lan4_green { + label = "ea7500-v2:green:lan4"; + gpios = <&gpio 15 GPIO_ACTIVE_LOW>; + }; + + led_power: power { + label = "ea7500-v2:white:power"; + gpios = <&gpio 10 GPIO_ACTIVE_HIGH>; + }; + + wps { + label = "ea7500-v2:green:wps"; + gpios = <&gpio 5 GPIO_ACTIVE_HIGH>; + }; + }; + + keys { + compatible = "gpio-keys"; + + wps { + label = "wps"; + gpios = <&gpio 17 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + + reset { + label = "reset"; + gpios = <&gpio 12 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + }; +}; + +&nand { + status = "okay"; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "boot"; + reg = <0x0 0x80000>; + read-only; + }; + + partition@80000 { + label = "u_env"; + reg = <0x80000 0x40000>; + read-only; + }; + + factory: partition@c0000 { + label = "factory"; + reg = <0xc0000 0x40000>; + read-only; + }; + + partition@100000 { + label = "s_env"; + reg = <0x100000 0x40000>; + }; + + partition@140000 { + label = "devinfo"; + reg = <0x140000 0x40000>; + read-only; + }; + + partition@180000 { + label = "kernel"; + reg = <0x180000 0x400000>; + }; + + partition@580000 { + label = "ubi"; + reg = <0x580000 0x2400000>; + }; + + partition@2980000 { + label = "alt_kernel"; + reg = <0x2980000 0x400000>; + read-only; + }; + + partition@2d80000 { + label = "alt_rootfs"; + reg = <0x2d80000 0x2400000>; + read-only; + }; + + partition@5180000 { + label = "sysdiag"; + reg = <0x5180000 0x100000>; + read-only; + }; + + partition@5280000 { + label = "syscfg"; + reg = <0x5280000 0x2d00000>; + read-only; + }; + }; +}; + +&state_default { + gpio { + groups = "i2c", "uart2", "uart3", "jtag", "wdt"; + function = "gpio"; + }; +}; + +&pcie { + status = "okay"; +}; + +&pcie0 { + mt76@0,0 { + compatible = "mediatek,mt76"; + reg = <0x0000 0 0 0 0>; + mediatek,mtd-eeprom = <&factory 0x0000>; + }; +}; + +&pcie1 { + mt76@0,0 { + compatible = "mediatek,mt76"; + reg = <0x0000 0 0 0 0>; + mediatek,mtd-eeprom = <&factory 0x8000>; + }; +}; + +&switch0 { + ports { + port@0 { + status = "okay"; + label = "wan"; + }; + + port@1 { + status = "okay"; + label = "lan1"; + }; + + port@2 { + status = "okay"; + label = "lan2"; + }; + + port@3 { + status = "okay"; + label = "lan3"; + }; + + port@4 { + status = "okay"; + label = "lan4"; + }; + }; +}; diff --git a/target/linux/ramips/image/Makefile b/target/linux/ramips/image/Makefile index 4806226fd0..b00e6d8726 100644 --- a/target/linux/ramips/image/Makefile +++ b/target/linux/ramips/image/Makefile @@ -100,6 +100,12 @@ define Build/mkdlinkfw-factory mv $@.new $@ endef +define Build/netis-tail + echo -n $(1) >> $@ + echo -n $(UIMAGE_NAME)-yun | $(STAGING_DIR_HOST)/bin/mkhash md5 | \ + sed 's/../\\\\x&/g' | xargs echo -ne >> $@ +endef + define Build/poray-header $(STAGING_DIR_HOST)/bin/mkporayfw $(1) -f $@ -o $@.new mv $@.new $@ diff --git a/target/linux/ramips/image/mt7620.mk b/target/linux/ramips/image/mt7620.mk index ecfe76b350..844a0fd43e 100644 --- a/target/linux/ramips/image/mt7620.mk +++ b/target/linux/ramips/image/mt7620.mk @@ -86,6 +86,16 @@ define Device/asus_rt-ac51u endef TARGET_DEVICES += asus_rt-ac51u +define Device/asus_rt-ac54u + SOC := mt7620a + IMAGE_SIZE := 16064k + DEVICE_VENDOR := Asus + DEVICE_MODEL := RT-AC54U + DEVICE_PACKAGES := kmod-mt76x2 kmod-usb2 kmod-usb-ohci \ + kmod-usb-ledtrig-usbport +endef +TARGET_DEVICES += asus_rt-ac54u + define Device/asus_rt-n12p SOC := mt7620n IMAGE_SIZE := 16064k @@ -690,6 +700,17 @@ define Device/netgear_wn3000rp-v3 endef TARGET_DEVICES += netgear_wn3000rp-v3 +define Device/netis_wf2770 + SOC := mt7620a + IMAGE_SIZE := 16064k + UIMAGE_NAME := WF2770_0.0.00 + DEVICE_VENDOR := NETIS + DEVICE_MODEL := WF2770 + DEVICE_PACKAGES := kmod-mt76x0e + KERNEL_INITRAMFS := $(KERNEL_DTB) | netis-tail WF2770 | uImage lzma +endef +TARGET_DEVICES += netis_wf2770 + define Device/nexx_wt3020-4m SOC := mt7620n BLOCKSIZE := 4k diff --git a/target/linux/ramips/image/mt7621.mk b/target/linux/ramips/image/mt7621.mk index 8fdb3587d3..51d43e5bc4 100644 --- a/target/linux/ramips/image/mt7621.mk +++ b/target/linux/ramips/image/mt7621.mk @@ -81,12 +81,6 @@ define Build/iodata-mstc-header ) endef -define Build/netis-tail - echo -n $(1) >> $@ - echo -n $(UIMAGE_NAME)-yun | $(STAGING_DIR_HOST)/bin/mkhash md5 | \ - sed 's/../\\\\x&/g' | xargs echo -ne >> $@ -endef - define Build/ubnt-erx-factory-image if [ -e $(KDIR)/tmp/$(KERNEL_INITRAMFS_IMAGE) -a "$$(stat -c%s $@)" -lt "$(KERNEL_SIZE)" ]; then \ echo '21001:6' > $(1).compat; \ @@ -473,6 +467,24 @@ define Device/lenovo_newifi-d1 endef TARGET_DEVICES += lenovo_newifi-d1 +define Device/linksys_ea7500-v2 + $(Device/uimage-lzma-loader) + BLOCKSIZE := 128k + PAGESIZE := 2048 + KERNEL_SIZE := 4096k + IMAGE_SIZE := 36864k + DEVICE_VENDOR := Linksys + DEVICE_MODEL := EA7500 + DEVICE_VARIANT := v2 + DEVICE_PACKAGES := kmod-usb3 kmod-mt7615e wpad-basic uboot-envtools + UBINIZE_OPTS := -E 5 + IMAGES := sysupgrade.bin factory.bin + IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata | check-size + IMAGE/factory.bin := append-kernel | pad-to $$$$(KERNEL_SIZE) | \ + append-ubi | check-size | linksys-image type=EA7500v2 +endef +TARGET_DEVICES += linksys_ea7500-v2 + define Device/linksys_re6500 IMAGE_SIZE := 7872k DEVICE_VENDOR := Linksys diff --git a/target/linux/ramips/mt7620/base-files/etc/board.d/02_network b/target/linux/ramips/mt7620/base-files/etc/board.d/02_network index 3f306d8506..c1dbf8d71d 100755 --- a/target/linux/ramips/mt7620/base-files/etc/board.d/02_network +++ b/target/linux/ramips/mt7620/base-files/etc/board.d/02_network @@ -70,7 +70,8 @@ ramips_setup_interfaces() ucidef_add_switch "switch0" \ "1:lan" "2:lan" "3:lan" "4:lan" "6t@eth0" ;; - asus,rt-ac51u) + asus,rt-ac51u|\ + asus,rt-ac54u) ucidef_add_switch "switch0" \ "0:wan" "1:lan" "2:lan" "3:lan" "4:lan" "6t@eth0" ;; @@ -169,6 +170,7 @@ ramips_setup_interfaces() "1:lan:4" "2:lan:3" "4:lan:2" "5:lan:1" "0:wan" "6@eth0" ;; linksys,e1700|\ + netis,wf2770|\ ralink,mt7620a-mt7530-evb) ucidef_add_switch "switch0" ucidef_add_switch_attr "switch0" "enable" "false" @@ -270,6 +272,10 @@ ramips_setup_macs() wan_mac=$(mtd_get_mac_binary factory 0x2e) label_mac=$(mtd_get_mac_binary factory 0x4) ;; + asus,rt-ac54u) + wan_mac=$(mtd_get_mac_binary factory 0x28) + label_mac=$wan_mac + ;; dlink,dch-m225) lan_mac=$(mtd_get_mac_ascii factory lanmac) ;; @@ -333,6 +339,10 @@ ramips_setup_macs() linksys,e1700) wan_mac=$(mtd_get_mac_ascii config WAN_MAC_ADDR) ;; + netis,wf2770) + wan_mac=$(mtd_get_mac_binary factory 0x2e) + label_mac=$wan_mac + ;; tplink,archer-c2-v1|\ tplink,archer-c20-v1|\ tplink,archer-c20i|\ diff --git a/target/linux/ramips/mt7621/base-files/etc/board.d/01_leds b/target/linux/ramips/mt7621/base-files/etc/board.d/01_leds index cc114da4ee..e4052441a0 100755 --- a/target/linux/ramips/mt7621/base-files/etc/board.d/01_leds +++ b/target/linux/ramips/mt7621/base-files/etc/board.d/01_leds @@ -34,6 +34,13 @@ gnubee,gb-pc2) ucidef_set_led_netdev "lan1" "lan1" "$boardname:green:lan1" "lan1" ucidef_set_led_netdev "lan2" "lan2" "$boardname:green:lan2" "lan2" ;; +linksys,ea7500-v2) + ucidef_set_led_netdev "lan1" "lan1 link" "$boardname:green:lan1" "lan1" "link" + ucidef_set_led_netdev "lan2" "lan2 link" "$boardname:green:lan2" "lan2" "link" + ucidef_set_led_netdev "lan3" "lan3 link" "$boardname:green:lan3" "lan3" "link" + ucidef_set_led_netdev "lan4" "lan4 link" "$boardname:green:lan4" "lan4" "link" + ucidef_set_led_netdev "wan" "wan link" "$boardname:green:wan" "wan" "link" + ;; mikrotik,routerboard-m11g) ucidef_set_rssimon "wlan0" "200000" "1" ucidef_set_led_rssi "rssilow" "RSSILOW" "$boardname:green:rssi0" "wlan0" "1" "100" diff --git a/target/linux/ramips/mt7621/base-files/etc/board.d/02_network b/target/linux/ramips/mt7621/base-files/etc/board.d/02_network index 34be067085..7734c02d37 100755 --- a/target/linux/ramips/mt7621/base-files/etc/board.d/02_network +++ b/target/linux/ramips/mt7621/base-files/etc/board.d/02_network @@ -91,6 +91,11 @@ ramips_setup_macs() wan_mac=$(mtd_get_mac_ascii u-boot-env wanaddr) label_mac=$wan_mac ;; + linksys,ea7500-v2) + lan_mac=$(mtd_get_mac_ascii devinfo hw_mac_addr) + wan_mac=$lan_mac + label_mac=$lan_mac + ;; mikrotik,routerboard-750gr3|\ mikrotik,routerboard-m11g|\ mikrotik,routerboard-m33g) diff --git a/target/linux/ramips/mt7621/base-files/etc/hotplug.d/ieee80211/10_fix_wifi_mac b/target/linux/ramips/mt7621/base-files/etc/hotplug.d/ieee80211/10_fix_wifi_mac new file mode 100644 index 0000000000..e05078648b --- /dev/null +++ b/target/linux/ramips/mt7621/base-files/etc/hotplug.d/ieee80211/10_fix_wifi_mac @@ -0,0 +1,18 @@ +[ "$ACTION" == "add" ] || exit 0 + +PHYNBR=${DEVPATH##*/phy} + +[ -n $PHYNBR ] || exit 0 + +. /lib/functions.sh +. /lib/functions/system.sh + +board=$(board_name) + +case "$board" in + linksys,ea7500-v2) + hw_mac_addr=$(mtd_get_mac_ascii devinfo hw_mac_addr) + [ "$PHYNBR" = "0" ] && macaddr_add $hw_mac_addr 1 > /sys${DEVPATH}/macaddress + [ "$PHYNBR" = "1" ] && macaddr_add $hw_mac_addr 2 > /sys${DEVPATH}/macaddress + ;; +esac diff --git a/target/linux/ramips/mt7621/base-files/etc/init.d/bootcount b/target/linux/ramips/mt7621/base-files/etc/init.d/bootcount index b4d72abafc..e92912bbcc 100755 --- a/target/linux/ramips/mt7621/base-files/etc/init.d/bootcount +++ b/target/linux/ramips/mt7621/base-files/etc/init.d/bootcount @@ -8,6 +8,9 @@ boot() { [ -n "$(fw_printenv bootcount bootchanged 2>/dev/null)" ] &&\ echo -e "bootcount\nbootchanged\n" | /usr/sbin/fw_setenv -s - ;; + linksys,ea7500-v2) + mtd resetbc s_env || true + ;; samknows,whitebox-v8) fw_setenv bootcount 0 ;; diff --git a/target/linux/ramips/mt7621/base-files/lib/upgrade/platform.sh b/target/linux/ramips/mt7621/base-files/lib/upgrade/platform.sh index 864c59c8e5..824c2dfbdb 100755 --- a/target/linux/ramips/mt7621/base-files/lib/upgrade/platform.sh +++ b/target/linux/ramips/mt7621/base-files/lib/upgrade/platform.sh @@ -45,6 +45,7 @@ platform_do_upgrade() { asus,rt-ac65p|\ asus,rt-ac85p|\ hiwifi,hc5962|\ + linksys,ea7500-v2|\ netgear,r6220|\ netgear,r6260|\ netgear,r6350|\ diff --git a/tools/firmware-utils/src/mkfwimage.c b/tools/firmware-utils/src/mkfwimage.c index 9e6d8f5b9a..ff9011a0c4 100644 --- a/tools/firmware-utils/src/mkfwimage.c +++ b/tools/firmware-utils/src/mkfwimage.c @@ -137,6 +137,15 @@ struct fw_info fw_info[] = { }, .sign = true, }, + { + .name = "XC", + .fw_layout = { + .kern_start = 0x9f050000, + .kern_entry = 0x80002000, + .firmware_max_length= 0x00F60000, + }, + .sign = true, + }, { .name = "ACB-ISP", .fw_layout = {