aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/ar71xx/files/arch/mips
diff options
context:
space:
mode:
authorGabor Juhos <juhosg@openwrt.org>2013-09-20 16:41:31 +0000
committerGabor Juhos <juhosg@openwrt.org>2013-09-20 16:41:31 +0000
commit40776d159d415709f91dc60136e13e2401f6111b (patch)
tree0faf81a5e7374a32c73187895c1bc595b966b462 /target/linux/ar71xx/files/arch/mips
parentcba7f6c2620ae9a8e2225567964fc9f445a6c859 (diff)
downloadmaster-187ad058-40776d159d415709f91dc60136e13e2401f6111b.tar.gz
master-187ad058-40776d159d415709f91dc60136e13e2401f6111b.tar.bz2
master-187ad058-40776d159d415709f91dc60136e13e2401f6111b.zip
ar71xx: dir-505-a1: use ath79_parse_ascii_mac helper
Remove the local MAC address parser function and use the generic one instead. Signed-off-by: Gabor Juhos <juhosg@openwrt.org> git-svn-id: svn://svn.openwrt.org/openwrt/trunk@38086 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'target/linux/ar71xx/files/arch/mips')
-rw-r--r--target/linux/ar71xx/files/arch/mips/ath79/mach-dir-505-a1.c24
1 files changed, 7 insertions, 17 deletions
diff --git a/target/linux/ar71xx/files/arch/mips/ath79/mach-dir-505-a1.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-dir-505-a1.c
index 651bb7687e..d3914659ef 100644
--- a/target/linux/ar71xx/files/arch/mips/ath79/mach-dir-505-a1.c
+++ b/target/linux/ar71xx/files/arch/mips/ath79/mach-dir-505-a1.c
@@ -35,8 +35,10 @@
#define DIR_505A1_ART_ADDRESS 0x1f010000
#define DIR_505A1_CALDATA_OFFSET 0x1000
-#define DIR_505A1_LAN_MAC_ADDRESS 0x1f020004
-#define DIR_505A1_WAN_MAC_ADDRESS 0x1f020016
+
+#define DIR_505A1_MAC_PART_ADDRESS 0x1f020000
+#define DIR_505A1_LAN_MAC_OFFSET 0x04
+#define DIR_505A1_WAN_MAC_OFFSET 0x16
static struct gpio_led dir_505_a1_leds_gpio[] __initdata = {
{
@@ -68,22 +70,10 @@ static struct gpio_keys_button dir_505_a1_gpio_keys[] __initdata = {
}
};
-static void __init dir_505_a1_read_ascii_mac(u8 *dest, unsigned int src_addr)
-{
- int ret;
- u8 *src = (u8 *)KSEG1ADDR(src_addr);
-
- ret = sscanf(src, "%02hhx:%02hhx:%02hhx:%02hhx:%02hhx:%02hhx",
- &dest[0], &dest[1], &dest[2],
- &dest[3], &dest[4], &dest[5]);
-
- if (ret != ETH_ALEN)
- memset(dest, 0, ETH_ALEN);
-}
-
static void __init dir_505_a1_setup(void)
{
u8 *art = (u8 *) KSEG1ADDR(DIR_505A1_ART_ADDRESS);
+ u8 *mac = (u8 *) KSEG1ADDR(DIR_505A1_MAC_PART_ADDRESS);
u8 lan_mac[ETH_ALEN];
u8 wan_mac[ETH_ALEN];
@@ -109,8 +99,8 @@ static void __init dir_505_a1_setup(void)
ath79_register_usb();
- dir_505_a1_read_ascii_mac(lan_mac, DIR_505A1_LAN_MAC_ADDRESS);
- dir_505_a1_read_ascii_mac(wan_mac, DIR_505A1_WAN_MAC_ADDRESS);
+ ath79_parse_ascii_mac(mac + DIR_505A1_LAN_MAC_OFFSET, lan_mac);
+ ath79_parse_ascii_mac(mac + DIR_505A1_WAN_MAC_OFFSET, wan_mac);
ath79_init_mac(ath79_eth0_data.mac_addr, wan_mac, 0);
ath79_init_mac(ath79_eth1_data.mac_addr, lan_mac, 0);