atheros[ar231x-eth]: update MAC and PHY reset method
[openwrt/staging/florian.git] / target / linux / atheros / patches-3.10 / 100-board.patch
index 28c93bee8bcc4c90200cb9bb6047e84101b53c9f..ab5e6bb50dd1da038f1b81c8761eadf7598af55e 100644 (file)
 +}
 --- /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
 +
 + * 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;
 +
 --- /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
 +
 +/* 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,
 +};
 +};
 +
 +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),
 +};
 +
 +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),
 +
 --- /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
 +
 +/* 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),