mirror of https://github.com/hak5/openwrt.git
atheros[ar231x-eth]: pass phys address of I/O memory via platform res
Signed-off-by: Sergey Ryazanov <ryazanov.s.a@gmail.com> SVN-Revision: 41697lede-17.01
parent
a145d0410b
commit
9041410017
|
@ -1805,7 +1805,7 @@
|
||||||
+ .reset_clear = ar5312_device_reset_clear,
|
+ .reset_clear = ar5312_device_reset_clear,
|
||||||
+ .reset_mac = AR531X_RESET_ENET0,
|
+ .reset_mac = AR531X_RESET_ENET0,
|
||||||
+ .reset_phy = AR531X_RESET_EPHY0,
|
+ .reset_phy = AR531X_RESET_EPHY0,
|
||||||
+ .phy_base = KSEG1ADDR(AR531X_ENET0),
|
+ .phy_base = AR531X_ENET0,
|
||||||
+ .config = &ar231x_board,
|
+ .config = &ar231x_board,
|
||||||
+};
|
+};
|
||||||
+
|
+
|
||||||
|
@ -1814,7 +1814,7 @@
|
||||||
+ .reset_clear = ar5312_device_reset_clear,
|
+ .reset_clear = ar5312_device_reset_clear,
|
||||||
+ .reset_mac = AR531X_RESET_ENET1,
|
+ .reset_mac = AR531X_RESET_ENET1,
|
||||||
+ .reset_phy = AR531X_RESET_EPHY1,
|
+ .reset_phy = AR531X_RESET_EPHY1,
|
||||||
+ .phy_base = KSEG1ADDR(AR531X_ENET1),
|
+ .phy_base = AR531X_ENET1,
|
||||||
+ .config = &ar231x_board,
|
+ .config = &ar231x_board,
|
||||||
+};
|
+};
|
||||||
+
|
+
|
||||||
|
@ -1936,12 +1936,12 @@
|
||||||
+ switch (ar231x_devtype) {
|
+ switch (ar231x_devtype) {
|
||||||
+ case DEV_TYPE_AR5312:
|
+ case DEV_TYPE_AR5312:
|
||||||
+ ar5312_eth0_data.macaddr = config->enet0_mac;
|
+ ar5312_eth0_data.macaddr = config->enet0_mac;
|
||||||
+ ar231x_add_ethernet(0, KSEG1ADDR(AR531X_ENET0),
|
+ ar231x_add_ethernet(0, AR531X_ENET0, AR5312_IRQ_ENET0_INTRS,
|
||||||
+ AR5312_IRQ_ENET0_INTRS, &ar5312_eth0_data);
|
+ &ar5312_eth0_data);
|
||||||
+
|
+
|
||||||
+ ar5312_eth1_data.macaddr = config->enet1_mac;
|
+ ar5312_eth1_data.macaddr = config->enet1_mac;
|
||||||
+ ar231x_add_ethernet(1, KSEG1ADDR(AR531X_ENET1),
|
+ ar231x_add_ethernet(1, AR531X_ENET1, AR5312_IRQ_ENET1_INTRS,
|
||||||
+ AR5312_IRQ_ENET1_INTRS, &ar5312_eth1_data);
|
+ &ar5312_eth1_data);
|
||||||
+
|
+
|
||||||
+ if (!ar231x_board.radio)
|
+ if (!ar231x_board.radio)
|
||||||
+ return 0;
|
+ return 0;
|
||||||
|
@ -1960,7 +1960,7 @@
|
||||||
+ ar5312_eth1_data.phy_base = ar5312_eth0_data.phy_base;
|
+ ar5312_eth1_data.phy_base = ar5312_eth0_data.phy_base;
|
||||||
+ ar5312_eth1_data.reset_phy = ar5312_eth0_data.reset_phy;
|
+ ar5312_eth1_data.reset_phy = ar5312_eth0_data.reset_phy;
|
||||||
+ ar5312_eth1_data.macaddr = config->enet0_mac;
|
+ ar5312_eth1_data.macaddr = config->enet0_mac;
|
||||||
+ ar231x_add_ethernet(0, KSEG1ADDR(AR531X_ENET1),
|
+ ar231x_add_ethernet(0, AR531X_ENET1,
|
||||||
+ AR5312_IRQ_ENET1_INTRS, &ar5312_eth1_data);
|
+ AR5312_IRQ_ENET1_INTRS, &ar5312_eth1_data);
|
||||||
+
|
+
|
||||||
+ if (!ar231x_board.radio)
|
+ if (!ar231x_board.radio)
|
||||||
|
@ -2409,7 +2409,7 @@
|
||||||
+ .reset_clear = ar2315_device_reset_clear,
|
+ .reset_clear = ar2315_device_reset_clear,
|
||||||
+ .reset_mac = AR2315_RESET_ENET0,
|
+ .reset_mac = AR2315_RESET_ENET0,
|
||||||
+ .reset_phy = AR2315_RESET_EPHY0,
|
+ .reset_phy = AR2315_RESET_EPHY0,
|
||||||
+ .phy_base = KSEG1ADDR(AR2315_ENET0),
|
+ .phy_base = AR2315_ENET0,
|
||||||
+ .config = &ar231x_board,
|
+ .config = &ar231x_board,
|
||||||
+};
|
+};
|
||||||
+
|
+
|
||||||
|
@ -2523,8 +2523,8 @@
|
||||||
+ ar2315_init_gpio_leds();
|
+ ar2315_init_gpio_leds();
|
||||||
+ platform_device_register(&ar2315_wdt);
|
+ platform_device_register(&ar2315_wdt);
|
||||||
+ platform_device_register(&ar2315_spiflash);
|
+ platform_device_register(&ar2315_spiflash);
|
||||||
+ ar231x_add_ethernet(0, KSEG1ADDR(AR2315_ENET0), AR2315_IRQ_ENET0_INTRS,
|
+ ar231x_add_ethernet(0, AR2315_ENET0, AR2315_IRQ_ENET0_INTRS,
|
||||||
+ &ar2315_eth_data);
|
+ &ar2315_eth_data);
|
||||||
+ ar231x_add_wmac(0, AR2315_WLAN0, AR2315_IRQ_WLAN0_INTRS);
|
+ ar231x_add_wmac(0, AR2315_WLAN0, AR2315_IRQ_WLAN0_INTRS);
|
||||||
+
|
+
|
||||||
+ return 0;
|
+ return 0;
|
||||||
|
|
|
@ -33,7 +33,7 @@
|
||||||
+obj-$(CONFIG_NET_AR231X) += ar231x.o
|
+obj-$(CONFIG_NET_AR231X) += ar231x.o
|
||||||
--- /dev/null
|
--- /dev/null
|
||||||
+++ b/drivers/net/ethernet/atheros/ar231x/ar231x.c
|
+++ b/drivers/net/ethernet/atheros/ar231x/ar231x.c
|
||||||
@@ -0,0 +1,1249 @@
|
@@ -0,0 +1,1246 @@
|
||||||
+/*
|
+/*
|
||||||
+ * ar231x.c: Linux driver for the Atheros AR231x Ethernet device.
|
+ * ar231x.c: Linux driver for the Atheros AR231x Ethernet device.
|
||||||
+ *
|
+ *
|
||||||
|
@ -257,8 +257,7 @@
|
||||||
+ tasklet_init(&sp->rx_tasklet, rx_tasklet_func, (unsigned long) dev);
|
+ tasklet_init(&sp->rx_tasklet, rx_tasklet_func, (unsigned long) dev);
|
||||||
+ tasklet_disable(&sp->rx_tasklet);
|
+ tasklet_disable(&sp->rx_tasklet);
|
||||||
+
|
+
|
||||||
+ sp->eth_regs = ioremap_nocache(virt_to_phys(ar_eth_base),
|
+ sp->eth_regs = ioremap_nocache(ar_eth_base, sizeof(*sp->eth_regs));
|
||||||
+ sizeof(*sp->eth_regs));
|
|
||||||
+ if (!sp->eth_regs) {
|
+ if (!sp->eth_regs) {
|
||||||
+ printk("Can't remap eth registers\n");
|
+ printk("Can't remap eth registers\n");
|
||||||
+ return -ENXIO;
|
+ return -ENXIO;
|
||||||
|
@ -269,26 +268,24 @@
|
||||||
+ * even though the MAC might be on ENET1.
|
+ * even though the MAC might be on ENET1.
|
||||||
+ * Needto remap PHY regs separately in this case
|
+ * Needto remap PHY regs separately in this case
|
||||||
+ */
|
+ */
|
||||||
+ if (virt_to_phys(ar_eth_base) == virt_to_phys(sp->phy_regs))
|
+ if (ar_eth_base == sp->cfg->phy_base)
|
||||||
+ sp->phy_regs = sp->eth_regs;
|
+ sp->phy_regs = sp->eth_regs;
|
||||||
+ else {
|
+ else {
|
||||||
+ sp->phy_regs =
|
+ sp->phy_regs = ioremap_nocache(sp->cfg->phy_base,
|
||||||
+ ioremap_nocache(virt_to_phys(sp->cfg->phy_base),
|
+ sizeof(*sp->phy_regs));
|
||||||
+ sizeof(*sp->phy_regs));
|
|
||||||
+ if (!sp->phy_regs) {
|
+ if (!sp->phy_regs) {
|
||||||
+ printk("Can't remap phy registers\n");
|
+ printk("Can't remap phy registers\n");
|
||||||
+ return -ENXIO;
|
+ return -ENXIO;
|
||||||
+ }
|
+ }
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
+ sp->dma_regs =
|
+ sp->dma_regs = ioremap_nocache(ar_eth_base + 0x1000,
|
||||||
+ ioremap_nocache(virt_to_phys(ar_eth_base + 0x1000),
|
+ sizeof(*sp->dma_regs));
|
||||||
+ sizeof(*sp->dma_regs));
|
|
||||||
+ dev->base_addr = (unsigned int) sp->dma_regs;
|
|
||||||
+ if (!sp->dma_regs) {
|
+ if (!sp->dma_regs) {
|
||||||
+ printk("Can't remap DMA registers\n");
|
+ printk("Can't remap DMA registers\n");
|
||||||
+ return -ENXIO;
|
+ return -ENXIO;
|
||||||
+ }
|
+ }
|
||||||
|
+ dev->base_addr = ar_eth_base + 0x1000;
|
||||||
+
|
+
|
||||||
+ strncpy(sp->name, "Atheros AR231x", sizeof(sp->name) - 1);
|
+ strncpy(sp->name, "Atheros AR231x", sizeof(sp->name) - 1);
|
||||||
+ sp->name[sizeof(sp->name) - 1] = '\0';
|
+ sp->name[sizeof(sp->name) - 1] = '\0';
|
||||||
|
|
|
@ -41,7 +41,7 @@
|
||||||
int ar231x_probe(struct platform_device *pdev)
|
int ar231x_probe(struct platform_device *pdev)
|
||||||
{
|
{
|
||||||
struct net_device *dev;
|
struct net_device *dev;
|
||||||
@@ -287,6 +314,23 @@ int ar231x_probe(struct platform_device
|
@@ -284,6 +311,23 @@ int ar231x_probe(struct platform_device
|
||||||
|
|
||||||
mdiobus_register(sp->mii_bus);
|
mdiobus_register(sp->mii_bus);
|
||||||
|
|
||||||
|
@ -65,7 +65,7 @@
|
||||||
if (ar231x_mdiobus_probe(dev) != 0) {
|
if (ar231x_mdiobus_probe(dev) != 0) {
|
||||||
printk(KERN_ERR "%s: mdiobus_probe failed\n", dev->name);
|
printk(KERN_ERR "%s: mdiobus_probe failed\n", dev->name);
|
||||||
rx_tasklet_cleanup(dev);
|
rx_tasklet_cleanup(dev);
|
||||||
@@ -343,8 +387,10 @@ static int ar231x_remove(struct platform
|
@@ -340,8 +384,10 @@ static int ar231x_remove(struct platform
|
||||||
rx_tasklet_cleanup(dev);
|
rx_tasklet_cleanup(dev);
|
||||||
ar231x_init_cleanup(dev);
|
ar231x_init_cleanup(dev);
|
||||||
unregister_netdev(dev);
|
unregister_netdev(dev);
|
||||||
|
@ -78,7 +78,7 @@
|
||||||
kfree(dev);
|
kfree(dev);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -1103,6 +1149,9 @@ static int ar231x_ioctl(struct net_devic
|
@@ -1100,6 +1146,9 @@ static int ar231x_ioctl(struct net_devic
|
||||||
struct ar231x_private *sp = netdev_priv(dev);
|
struct ar231x_private *sp = netdev_priv(dev);
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue