From 6be418e3e1a6e45af6b7575f2e41023c6f981ba7 Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Thu, 17 Jul 2014 16:36:16 +0000 Subject: 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 SVN-Revision: 41689 --- target/linux/atheros/patches-3.10/100-board.patch | 49 +++++++++++++++++++---- 1 file changed, 42 insertions(+), 7 deletions(-) (limited to 'target/linux/atheros/patches-3.10/100-board.patch') 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), -- cgit v1.2.3