aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/atheros
diff options
context:
space:
mode:
authorFelix Fietkau <nbd@openwrt.org>2014-07-17 16:36:16 +0000
committerFelix Fietkau <nbd@openwrt.org>2014-07-17 16:36:16 +0000
commitd945d89a9cc109328d6f7cd97a1ec283f3c14348 (patch)
tree91ef554686670c45a60b045c0a973de7aefcac0d /target/linux/atheros
parent9a025dd5c6a1aa15df3ddc10fc7e951e55ecbd35 (diff)
downloadupstream-d945d89a9cc109328d6f7cd97a1ec283f3c14348.tar.gz
upstream-d945d89a9cc109328d6f7cd97a1ec283f3c14348.tar.bz2
upstream-d945d89a9cc109328d6f7cd97a1ec283f3c14348.zip
atheros[ar231x-eth]: update MAC and PHY reset method
Pass reset_set and reset_clear callback functions pointers via platform_data instead of reset register address. Signed-off-by: Sergey Ryazanov <ryazanov.s.a@gmail.com> git-svn-id: svn://svn.openwrt.org/openwrt/trunk@41689 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'target/linux/atheros')
-rw-r--r--target/linux/atheros/patches-3.10/100-board.patch49
-rw-r--r--target/linux/atheros/patches-3.10/110-ar2313_ethernet.patch24
-rw-r--r--target/linux/atheros/patches-3.10/220-enet_micrel_workaround.patch6
3 files changed, 54 insertions, 25 deletions
diff --git a/target/linux/atheros/patches-3.10/100-board.patch b/target/linux/atheros/patches-3.10/100-board.patch
index 28c93bee8b..ab5e6bb50d 100644
--- a/target/linux/atheros/patches-3.10/100-board.patch
+++ b/target/linux/atheros/patches-3.10/100-board.patch
@@ -388,7 +388,7 @@
+}
--- /dev/null
+++ b/arch/mips/include/asm/mach-ar231x/ar231x_platform.h
-@@ -0,0 +1,83 @@
+@@ -0,0 +1,84 @@
+#ifndef __AR531X_PLATFORM_H
+#define __AR531X_PLATFORM_H
+
@@ -463,7 +463,8 @@
+ * Platform device information for the Ethernet MAC
+ */
+struct ar231x_eth {
-+ u32 reset_base;
++ void (*reset_set)(u32);
++ void (*reset_clear)(u32);
+ u32 reset_mac;
+ u32 reset_phy;
+ u32 phy_base;
@@ -1549,7 +1550,7 @@
+
--- /dev/null
+++ b/arch/mips/ar231x/ar5312.c
-@@ -0,0 +1,582 @@
+@@ -0,0 +1,600 @@
+/*
+ * This file is subject to the terms and conditions of the GNU General Public
+ * License. See the file "COPYING" in the main directory of this archive
@@ -1799,6 +1800,22 @@
+
+/* end of gpiolib */
+
++static void ar5312_device_reset_set(u32 mask)
++{
++ u32 val;
++
++ val = ar231x_read_reg(AR531X_RESET);
++ ar231x_write_reg(AR531X_RESET, val | mask);
++}
++
++static void ar5312_device_reset_clear(u32 mask)
++{
++ u32 val;
++
++ val = ar231x_read_reg(AR531X_RESET);
++ ar231x_write_reg(AR531X_RESET, val & ~mask);
++}
++
+static struct physmap_flash_data ar5312_flash_data = {
+ .width = 2,
+};
@@ -1810,7 +1827,8 @@
+};
+
+static struct ar231x_eth ar5312_eth0_data = {
-+ .reset_base = AR531X_RESET,
++ .reset_set = ar5312_device_reset_set,
++ .reset_clear = ar5312_device_reset_clear,
+ .reset_mac = AR531X_RESET_ENET0,
+ .reset_phy = AR531X_RESET_EPHY0,
+ .phy_base = KSEG1ADDR(AR531X_ENET0),
@@ -1818,7 +1836,8 @@
+};
+
+static struct ar231x_eth ar5312_eth1_data = {
-+ .reset_base = AR531X_RESET,
++ .reset_set = ar5312_device_reset_set,
++ .reset_clear = ar5312_device_reset_clear,
+ .reset_mac = AR531X_RESET_ENET1,
+ .reset_phy = AR531X_RESET_EPHY1,
+ .phy_base = KSEG1ADDR(AR531X_ENET1),
@@ -2134,7 +2153,7 @@
+
--- /dev/null
+++ b/arch/mips/ar231x/ar2315.c
-@@ -0,0 +1,639 @@
+@@ -0,0 +1,655 @@
+/*
+ * This file is subject to the terms and conditions of the GNU General Public
+ * License. See the file "COPYING" in the main directory of this archive
@@ -2493,9 +2512,25 @@
+
+/* end of gpiolib */
+
++static void ar2315_device_reset_set(u32 mask)
++{
++ u32 val;
++
++ val = ar231x_read_reg(AR2315_RESET);
++ ar231x_write_reg(AR2315_RESET, val | mask);
++}
++
++static void ar2315_device_reset_clear(u32 mask)
++{
++ u32 val;
++
++ val = ar231x_read_reg(AR2315_RESET);
++ ar231x_write_reg(AR2315_RESET, val & ~mask);
++}
+
+static struct ar231x_eth ar2315_eth_data = {
-+ .reset_base = AR2315_RESET,
++ .reset_set = ar2315_device_reset_set,
++ .reset_clear = ar2315_device_reset_clear,
+ .reset_mac = AR2315_RESET_ENET0,
+ .reset_phy = AR2315_RESET_EPHY0,
+ .phy_base = KSEG1ADDR(AR2315_ENET0),
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 5532a5fb53..a0c411599d 100644
--- a/target/linux/atheros/patches-3.10/110-ar2313_ethernet.patch
+++ b/target/linux/atheros/patches-3.10/110-ar2313_ethernet.patch
@@ -32,7 +32,7 @@
+obj-$(CONFIG_NET_VENDOR_AR231X) += ar231x.o
--- /dev/null
+++ b/drivers/net/ethernet/ar231x/ar231x.c
-@@ -0,0 +1,1254 @@
+@@ -0,0 +1,1249 @@
+/*
+ * ar231x.c: Linux driver for the Atheros AR231x Ethernet device.
+ *
@@ -289,12 +289,6 @@
+ return -ENXIO;
+ }
+
-+ sp->int_regs = ioremap_nocache(virt_to_phys(sp->cfg->reset_base), 4);
-+ if (!sp->int_regs) {
-+ printk("Can't remap INTERRUPT registers\n");
-+ return -ENXIO;
-+ }
-+
+ strncpy(sp->name, "Atheros AR231x", sizeof(sp->name) - 1);
+ sp->name[sizeof(sp->name) - 1] = '\0';
+ memcpy(dev->dev_addr, sp->cfg->macaddr, 6);
@@ -609,13 +603,13 @@
+ unsigned int ethsal, ethsah;
+ unsigned int flags;
+
-+ *sp->int_regs |= sp->cfg->reset_mac;
++ sp->cfg->reset_set(sp->cfg->reset_mac);
+ mdelay(10);
-+ *sp->int_regs &= ~sp->cfg->reset_mac;
++ sp->cfg->reset_clear(sp->cfg->reset_mac);
+ mdelay(10);
-+ *sp->int_regs |= sp->cfg->reset_phy;
++ sp->cfg->reset_set(sp->cfg->reset_phy);
+ mdelay(10);
-+ *sp->int_regs &= ~sp->cfg->reset_phy;
++ sp->cfg->reset_clear(sp->cfg->reset_phy);
+ mdelay(10);
+
+ sp->dma_regs->bus_mode = (DMA_BUS_MODE_SWR);
@@ -1052,7 +1046,8 @@
+ sp->dma_regs->bus_mode = DMA_BUS_MODE_SWR;
+
+ /* place phy and MAC in reset */
-+ *sp->int_regs |= (sp->cfg->reset_mac | sp->cfg->reset_phy);
++ sp->cfg->reset_set(sp->cfg->reset_mac);
++ sp->cfg->reset_set(sp->cfg->reset_phy);
+
+ /* free buffers on tx ring */
+ for (j = 0; j < AR2313_DESCR_ENTRIES; j++) {
@@ -1076,7 +1071,7 @@
+ * the irq is gone forever ! When bond0 is made 'up' again,
+ * the ar231x_open () does not call request_irq (). Worse,
+ * the call to ar231x_halt() generates a WDOG reset due to
-+ * the write to 'sp->int_regs' and the box reboots.
++ * the write to reset register and the box reboots.
+ * Commenting this out is good since it allows the
+ * system to resume when bond0 is made up again.
+ */
@@ -1289,7 +1284,7 @@
+
--- /dev/null
+++ b/drivers/net/ethernet/ar231x/ar231x.h
-@@ -0,0 +1,288 @@
+@@ -0,0 +1,287 @@
+/*
+ * ar231x.h: Linux driver for the Atheros AR231x Ethernet device.
+ *
@@ -1515,7 +1510,6 @@
+ volatile ETHERNET_STRUCT *phy_regs;
+ volatile ETHERNET_STRUCT *eth_regs;
+ volatile DMA *dma_regs;
-+ volatile u32 *int_regs;
+ struct ar231x_eth *cfg;
+
+ spinlock_t lock; /* Serialise access to device */
diff --git a/target/linux/atheros/patches-3.10/220-enet_micrel_workaround.patch b/target/linux/atheros/patches-3.10/220-enet_micrel_workaround.patch
index 2cc31e1cd2..ada0a76b13 100644
--- a/target/linux/atheros/patches-3.10/220-enet_micrel_workaround.patch
+++ b/target/linux/atheros/patches-3.10/220-enet_micrel_workaround.patch
@@ -41,7 +41,7 @@
int ar231x_probe(struct platform_device *pdev)
{
struct net_device *dev;
-@@ -293,6 +320,23 @@ int ar231x_probe(struct platform_device
+@@ -287,6 +314,23 @@ int ar231x_probe(struct platform_device
mdiobus_register(sp->mii_bus);
@@ -65,7 +65,7 @@
if (ar231x_mdiobus_probe(dev) != 0) {
printk(KERN_ERR "%s: mdiobus_probe failed\n", dev->name);
rx_tasklet_cleanup(dev);
-@@ -349,8 +393,10 @@ static int ar231x_remove(struct platform
+@@ -343,8 +387,10 @@ static int ar231x_remove(struct platform
rx_tasklet_cleanup(dev);
ar231x_init_cleanup(dev);
unregister_netdev(dev);
@@ -78,7 +78,7 @@
kfree(dev);
return 0;
}
-@@ -1108,6 +1154,9 @@ static int ar231x_ioctl(struct net_devic
+@@ -1103,6 +1149,9 @@ static int ar231x_ioctl(struct net_devic
struct ar231x_private *sp = netdev_priv(dev);
int ret;