Changeset 37539


Ignore:
Timestamp:
2013-07-25T22:29:05+02:00 (3 years ago)
Author:
blogic
Message:

lantiq: make macs loadable from mtd partitions

This is a really ugly hack but it will have to do until we copy the ramips patches to the lantiq tree

Signed-off-by: John Crispin <blogic@…>

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/target/linux/lantiq/patches-3.8/0037-owrt-lantiq-wifi-and-ethernet-eeprom-handling.patch

    r37258 r37539  
    2020 create mode 100644 arch/mips/lantiq/xway/rt_eep.c 
    2121 
    22 --- /dev/null 
    23 +++ b/arch/mips/include/asm/mach-lantiq/pci-ath-fixup.h 
     22Index: linux-3.8.13/arch/mips/include/asm/mach-lantiq/pci-ath-fixup.h 
     23=================================================================== 
     24--- /dev/null   1970-01-01 00:00:00.000000000 +0000 
     25+++ linux-3.8.13/arch/mips/include/asm/mach-lantiq/pci-ath-fixup.h      2013-07-25 20:47:01.531327796 +0200 
    2426@@ -0,0 +1,6 @@ 
    2527+#ifndef _PCI_ATH_FIXUP 
     
    2931+ 
    3032+#endif /* _PCI_ATH_FIXUP */ 
    31 --- a/arch/mips/include/asm/mach-lantiq/xway/lantiq_soc.h 
    32 +++ b/arch/mips/include/asm/mach-lantiq/xway/lantiq_soc.h 
    33 @@ -90,5 +90,8 @@ int xrx200_gphy_boot(struct device *dev, 
     33Index: linux-3.8.13/arch/mips/include/asm/mach-lantiq/xway/lantiq_soc.h 
     34=================================================================== 
     35--- linux-3.8.13.orig/arch/mips/include/asm/mach-lantiq/xway/lantiq_soc.h       2013-07-25 20:46:52.599327583 +0200 
     36+++ linux-3.8.13/arch/mips/include/asm/mach-lantiq/xway/lantiq_soc.h    2013-07-25 20:47:01.531327796 +0200 
     37@@ -90,5 +90,8 @@ 
    3438 extern void ltq_pmu_enable(unsigned int module); 
    3539 extern void ltq_pmu_disable(unsigned int module); 
     
    4044 #endif /* CONFIG_SOC_TYPE_XWAY */ 
    4145 #endif /* _LTQ_XWAY_H__ */ 
    42 --- a/arch/mips/lantiq/xway/Makefile 
    43 +++ b/arch/mips/lantiq/xway/Makefile 
     46Index: linux-3.8.13/arch/mips/lantiq/xway/Makefile 
     47=================================================================== 
     48--- linux-3.8.13.orig/arch/mips/lantiq/xway/Makefile    2013-07-25 20:47:01.371327792 +0200 
     49+++ linux-3.8.13/arch/mips/lantiq/xway/Makefile 2013-07-25 21:31:31.287391412 +0200 
    4450@@ -1,3 +1,6 @@ 
    4551 obj-y := prom.o sysctrl.o clk.o reset.o dma.o gptu.o dcdc.o 
     
    4955+ 
    5056 obj-$(CONFIG_XRX200_PHY_FW) += xrx200_phy_fw.o 
    51 --- /dev/null 
    52 +++ b/arch/mips/lantiq/xway/ath_eep.c 
     57Index: linux-3.8.13/arch/mips/lantiq/xway/ath_eep.c 
     58=================================================================== 
     59--- /dev/null   1970-01-01 00:00:00.000000000 +0000 
     60+++ linux-3.8.13/arch/mips/lantiq/xway/ath_eep.c        2013-07-25 20:47:01.535327796 +0200 
    5361@@ -0,0 +1,248 @@ 
    5462+/* 
     
    195203+       return platform_driver_probe(&ath9k_eeprom_driver, of_ath9k_eeprom_probe); 
    196204+} 
    197 +arch_initcall(of_ath9k_eeprom_init); 
     205+late_initcall(of_ath9k_eeprom_init); 
    198206+ 
    199207+ 
     
    300308+} 
    301309+device_initcall(of_ath5k_eeprom_init); 
    302 --- /dev/null 
    303 +++ b/arch/mips/lantiq/xway/eth_mac.c 
    304 @@ -0,0 +1,76 @@ 
     310Index: linux-3.8.13/arch/mips/lantiq/xway/eth_mac.c 
     311=================================================================== 
     312--- /dev/null   1970-01-01 00:00:00.000000000 +0000 
     313+++ linux-3.8.13/arch/mips/lantiq/xway/eth_mac.c        2013-07-25 21:28:37.743387278 +0200 
     314@@ -0,0 +1,98 @@ 
    305315+/* 
    306316+ *  Copyright (C) 2012 John Crispin <blogic@openwrt.org> 
     
    315325+#include <linux/of_platform.h> 
    316326+#include <linux/if_ether.h> 
     327+#include <linux/mtd/mtd.h> 
    317328+ 
    318329+static u8 eth_mac[6]; 
     
    333344+int __init of_eth_mac_probe(struct platform_device *pdev) 
    334345+{ 
    335 +       struct device_node *np = pdev->dev.of_node; 
     346+       struct device_node *np = pdev->dev.of_node, *mtd_np; 
    336347+       struct resource *mac_res; 
    337348+       void __iomem *mac; 
    338349+       u32 mac_inc = 0; 
     350+       phandle phandle; 
     351+       size_t flash_readlen; 
     352+       const __be32 *list; 
     353+       const char *part; 
     354+       struct mtd_info *the_mtd; 
     355+       int i; 
    339356+ 
    340357+       if (eth_mac_set) { 
     
    342359+               return -EINVAL; 
    343360+       } 
    344 +       mac_res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 
    345 + 
    346 +       if (!mac_res) { 
    347 +               dev_err(&pdev->dev, "failed to load mac\n"); 
    348 +               return -EINVAL; 
    349 +       } 
    350 +       if (resource_size(mac_res) != 6) { 
    351 +               dev_err(&pdev->dev, "mac has an invalid size\n"); 
    352 +               return -EINVAL; 
    353 +       } 
    354 +       mac = ioremap(mac_res->start, resource_size(mac_res)); 
    355 +       memcpy_fromio(eth_mac, mac, 6); 
    356 + 
     361+       if ((list = of_get_property(np, "ath,eep-mac", &i)) && i == 2 * 
     362+                       sizeof(*list) && (phandle = be32_to_cpup(list++)) && 
     363+                       (mtd_np = of_find_node_by_phandle(phandle)) && ((part = 
     364+                       of_get_property(mtd_np, "label", NULL)) || (part = 
     365+                       mtd_np->name)) && (the_mtd = get_mtd_device_nm(part)) 
     366+                       != ERR_PTR(-ENODEV)) { 
     367+               i = mtd_read(the_mtd, be32_to_cpup(list), 6, &flash_readlen, 
     368+                                       (void *) eth_mac); 
     369+               put_mtd_device(the_mtd); 
     370+               if ((sizeof(eth_mac) != flash_readlen) || i) { 
     371+                       dev_err(&pdev->dev, "failed to load eeprom from mtd\n"); 
     372+                       return -ENODEV; 
     373+               } 
     374+       } else { 
     375+               mac_res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 
     376+ 
     377+               if (!mac_res) { 
     378+                       dev_err(&pdev->dev, "failed to load mac\n"); 
     379+                       return -EINVAL; 
     380+               } 
     381+               if (resource_size(mac_res) != 6) { 
     382+                       dev_err(&pdev->dev, "mac has an invalid size\n"); 
     383+                       return -EINVAL; 
     384+               } 
     385+               mac = ioremap(mac_res->start, resource_size(mac_res)); 
     386+               memcpy_fromio(eth_mac, mac, 6); 
     387+ 
     388+       } 
    357389+       if (!of_property_read_u32(np, "mac-increment", &mac_inc)) 
    358390+               eth_mac[5] += mac_inc; 
     
    379411+} 
    380412+device_initcall(of_eth_mac_init); 
    381 --- /dev/null 
    382 +++ b/arch/mips/lantiq/xway/pci-ath-fixup.c 
     413Index: linux-3.8.13/arch/mips/lantiq/xway/pci-ath-fixup.c 
     414=================================================================== 
     415--- /dev/null   1970-01-01 00:00:00.000000000 +0000 
     416+++ linux-3.8.13/arch/mips/lantiq/xway/pci-ath-fixup.c  2013-07-25 20:47:01.535327796 +0200 
    383417@@ -0,0 +1,109 @@ 
    384418+/* 
     
    491525+       ath_num_fixups++; 
    492526+} 
    493 --- /dev/null 
    494 +++ b/arch/mips/lantiq/xway/rt_eep.c 
     527Index: linux-3.8.13/arch/mips/lantiq/xway/rt_eep.c 
     528=================================================================== 
     529--- /dev/null   1970-01-01 00:00:00.000000000 +0000 
     530+++ linux-3.8.13/arch/mips/lantiq/xway/rt_eep.c 2013-07-25 20:47:01.535327796 +0200 
    495531@@ -0,0 +1,60 @@ 
    496532+/* 
     
    554590+} 
    555591+device_initcall(of_ralink_eeprom_init); 
    556 --- a/drivers/net/ethernet/lantiq_etop.c 
    557 +++ b/drivers/net/ethernet/lantiq_etop.c 
    558 @@ -826,7 +826,8 @@ ltq_etop_init(struct net_device *dev) 
     592Index: linux-3.8.13/drivers/net/ethernet/lantiq_etop.c 
     593=================================================================== 
     594--- linux-3.8.13.orig/drivers/net/ethernet/lantiq_etop.c        2013-07-25 20:46:52.599327583 +0200 
     595+++ linux-3.8.13/drivers/net/ethernet/lantiq_etop.c     2013-07-25 20:47:01.535327796 +0200 
     596@@ -829,7 +829,8 @@ 
    559597  
    560598        ltq_etop_change_mtu(dev, 1500); 
     
    566604                pr_warn("etop: invalid MAC, using random\n"); 
    567605                random_ether_addr(mac.sa_data); 
    568 @@ -885,8 +886,7 @@ static const struct net_device_ops ltq_e 
     606@@ -888,8 +889,7 @@ 
    569607        .ndo_tx_timeout = ltq_etop_tx_timeout, 
    570608 }; 
     
    576614        struct net_device *dev; 
    577615        struct ltq_etop_priv *priv; 
    578 @@ -950,7 +950,9 @@ ltq_etop_probe(struct platform_device *p 
     616@@ -953,7 +953,9 @@ 
    579617        priv->tx_irq = irqres[0].start; 
    580618        priv->rx_irq = irqres[1].start; 
Note: See TracChangeset for help on using the changeset viewer.