diff options
Diffstat (limited to 'target/linux/atheros/patches-3.10/110-ar2313_ethernet.patch')
-rw-r--r-- | target/linux/atheros/patches-3.10/110-ar2313_ethernet.patch | 48 |
1 files changed, 30 insertions, 18 deletions
diff --git a/target/linux/atheros/patches-3.10/110-ar2313_ethernet.patch b/target/linux/atheros/patches-3.10/110-ar2313_ethernet.patch index 0e158d4..a9dcab2 100644 --- a/target/linux/atheros/patches-3.10/110-ar2313_ethernet.patch +++ b/target/linux/atheros/patches-3.10/110-ar2313_ethernet.patch @@ -33,7 +33,7 @@ +obj-$(CONFIG_NET_AR231X) += ar231x.o --- /dev/null +++ b/drivers/net/ethernet/atheros/ar231x/ar231x.c -@@ -0,0 +1,1246 @@ +@@ -0,0 +1,1250 @@ +/* + * ar231x.c: Linux driver for the Atheros AR231x Ethernet device. + * @@ -216,7 +216,7 @@ +#endif +}; + -+int ar231x_probe(struct platform_device *pdev) ++static int ar231x_probe(struct platform_device *pdev) +{ + struct net_device *dev; + struct ar231x_private *sp; @@ -266,17 +266,19 @@ + /** + * When there's only one MAC, PHY regs are typically on ENET0, + * even though the MAC might be on ENET1. -+ * Needto remap PHY regs separately in this case ++ * So remap PHY regs separately. + */ -+ if (ar_eth_base == sp->cfg->phy_base) -+ sp->phy_regs = sp->eth_regs; -+ else { -+ sp->phy_regs = ioremap_nocache(sp->cfg->phy_base, -+ sizeof(*sp->phy_regs)); -+ if (!sp->phy_regs) { -+ printk("Can't remap phy registers\n"); -+ return -ENXIO; -+ } ++ res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "eth0_mii"); ++ if (!res) { ++ res = platform_get_resource_byname(pdev, IORESOURCE_MEM, ++ "eth1_mii"); ++ if (!res) ++ return -ENODEV; ++ } ++ sp->phy_regs = ioremap_nocache(res->start, resource_size(res)); ++ if (!sp->phy_regs) { ++ printk("Can't remap phy registers\n"); ++ return -ENXIO; + } + + sp->dma_regs = ioremap_nocache(ar_eth_base + 0x1000, @@ -482,6 +484,8 @@ + iounmap((void *)sp->eth_regs); + if (sp->dma_regs) + iounmap((void *)sp->dma_regs); ++ if (sp->phy_regs) ++ iounmap((void *)sp->phy_regs); + + if (sp->rx_skb) { + for (j = 0; j < AR2313_DESCR_ENTRIES; j++) { @@ -1195,7 +1199,7 @@ +{ + struct net_device *const dev = bus->priv; + struct ar231x_private *sp = netdev_priv(dev); -+ volatile ETHERNET_STRUCT *ethernet = sp->phy_regs; ++ volatile MII *ethernet = sp->phy_regs; + + ethernet->mii_addr = MII_ADDR(phy_addr, regnum); + while (ethernet->mii_addr & MII_ADDR_BUSY) @@ -1208,7 +1212,7 @@ +{ + struct net_device *const dev = bus->priv; + struct ar231x_private *sp = netdev_priv(dev); -+ volatile ETHERNET_STRUCT *ethernet = sp->phy_regs; ++ volatile MII *ethernet = sp->phy_regs; + + while (ethernet->mii_addr & MII_ADDR_BUSY) + ; @@ -1282,7 +1286,7 @@ + --- /dev/null +++ b/drivers/net/ethernet/atheros/ar231x/ar231x.h -@@ -0,0 +1,287 @@ +@@ -0,0 +1,295 @@ +/* + * ar231x.h: Linux driver for the Atheros AR231x Ethernet device. + * @@ -1444,13 +1448,16 @@ + +/** + * New Combo structure for Both Eth0 AND eth1 ++ * ++ * Don't directly access MII related regs since phy chip could be actually ++ * connected to another ethernet block. + */ +typedef struct { + volatile unsigned int mac_control; /* 0x00 */ + volatile unsigned int mac_addr[2]; /* 0x04 - 0x08 */ + volatile unsigned int mcast_table[2]; /* 0x0c - 0x10 */ -+ volatile unsigned int mii_addr; /* 0x14 */ -+ volatile unsigned int mii_data; /* 0x18 */ ++ volatile unsigned int __mii_addr; /* 0x14 */ ++ volatile unsigned int __mii_data; /* 0x18 */ + volatile unsigned int flow_control; /* 0x1c */ + volatile unsigned int vlan_tag; /* 0x20 */ + volatile unsigned int pad[7]; /* 0x24 - 0x3c */ @@ -1458,6 +1465,11 @@ + +} ETHERNET_STRUCT; + ++typedef struct { ++ volatile unsigned int mii_addr; ++ volatile unsigned int mii_data; ++} MII; ++ +/******************************************************************** + * Interrupt controller + ********************************************************************/ @@ -1505,7 +1517,7 @@ + int version; + u32 mb[2]; + -+ volatile ETHERNET_STRUCT *phy_regs; ++ volatile MII *phy_regs; + volatile ETHERNET_STRUCT *eth_regs; + volatile DMA *dma_regs; + struct ar231x_eth *cfg; |