Changeset 38086


Ignore:
Timestamp:
2013-09-20T18:41:31+02:00 (4 years ago)
Author:
juhosg
Message:

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@…>

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/target/linux/ar71xx/files/arch/mips/ath79/mach-dir-505-a1.c

    r37703 r38086  
    3636#define DIR_505A1_ART_ADDRESS          0x1f010000 
    3737#define DIR_505A1_CALDATA_OFFSET       0x1000 
    38 #define DIR_505A1_LAN_MAC_ADDRESS      0x1f020004 
    39 #define DIR_505A1_WAN_MAC_ADDRESS      0x1f020016 
     38 
     39#define DIR_505A1_MAC_PART_ADDRESS      0x1f020000 
     40#define DIR_505A1_LAN_MAC_OFFSET        0x04 
     41#define DIR_505A1_WAN_MAC_OFFSET        0x16 
    4042 
    4143static struct gpio_led dir_505_a1_leds_gpio[] __initdata = { 
     
    6971}; 
    7072 
    71 static void __init dir_505_a1_read_ascii_mac(u8 *dest, unsigned int src_addr) 
    72 { 
    73         int ret; 
    74         u8 *src = (u8 *)KSEG1ADDR(src_addr); 
    75  
    76         ret = sscanf(src, "%02hhx:%02hhx:%02hhx:%02hhx:%02hhx:%02hhx", 
    77                         &dest[0], &dest[1], &dest[2], 
    78                         &dest[3], &dest[4], &dest[5]); 
    79  
    80         if (ret != ETH_ALEN) 
    81                 memset(dest, 0, ETH_ALEN); 
    82 } 
    83  
    8473static void __init dir_505_a1_setup(void) 
    8574{ 
    8675        u8 *art = (u8 *) KSEG1ADDR(DIR_505A1_ART_ADDRESS); 
     76        u8 *mac = (u8 *) KSEG1ADDR(DIR_505A1_MAC_PART_ADDRESS); 
    8777        u8 lan_mac[ETH_ALEN]; 
    8878        u8 wan_mac[ETH_ALEN]; 
     
    110100        ath79_register_usb(); 
    111101 
    112         dir_505_a1_read_ascii_mac(lan_mac, DIR_505A1_LAN_MAC_ADDRESS); 
    113         dir_505_a1_read_ascii_mac(wan_mac, DIR_505A1_WAN_MAC_ADDRESS); 
     102        ath79_parse_ascii_mac(mac + DIR_505A1_LAN_MAC_OFFSET, lan_mac); 
     103        ath79_parse_ascii_mac(mac + DIR_505A1_WAN_MAC_OFFSET, wan_mac); 
    114104 
    115105        ath79_init_mac(ath79_eth0_data.mac_addr, wan_mac, 0); 
Note: See TracChangeset for help on using the changeset viewer.