aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/usb/r8152.c
diff options
context:
space:
mode:
authorhayeswang <hayeswang@realtek.com>2014-02-18 08:49:01 -0500
committerDavid S. Miller <davem@davemloft.net>2014-02-18 16:40:01 -0500
commit8a91c8246a847a2435a7ef361bfcd4c2b5be4ea2 (patch)
treea93ecaafc241085de575c23097093d4dcbf53416 /drivers/net/usb/r8152.c
parentb97027233db74a24eb3aca693ed3f85461c7f440 (diff)
r8152: load the default MAC address
Except for RTL_VER_01, replace loading the MAC address from PLA_IDR with from PLA_BACKUP. The default MAC address may be modified by the other OS, so the PLA_IDR may be not the default MAC address. The data in the PLA_BACKUP address of the RTL_VER_01 may be destoryed, so load MAC address from PLA_IDR for RTL_VER_01. Signed-off-by: Hayes Wang <hayeswang@realtek.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/usb/r8152.c')
-rw-r--r--drivers/net/usb/r8152.c19
1 files changed, 17 insertions, 2 deletions
diff --git a/drivers/net/usb/r8152.c b/drivers/net/usb/r8152.c
index 4888e4f4dd8f..3847c3507624 100644
--- a/drivers/net/usb/r8152.c
+++ b/drivers/net/usb/r8152.c
@@ -889,11 +889,26 @@ int r8152_submit_rx(struct r8152 *tp, struct rx_agg *agg, gfp_t mem_flags);
889static inline void set_ethernet_addr(struct r8152 *tp) 889static inline void set_ethernet_addr(struct r8152 *tp)
890{ 890{
891 struct net_device *dev = tp->netdev; 891 struct net_device *dev = tp->netdev;
892 int ret;
892 u8 node_id[8] = {0}; 893 u8 node_id[8] = {0};
893 894
894 if (pla_ocp_read(tp, PLA_IDR, sizeof(node_id), node_id) < 0) 895 if (tp->version == RTL_VER_01)
896 ret = pla_ocp_read(tp, PLA_IDR, sizeof(node_id), node_id);
897 else
898 ret = pla_ocp_read(tp, PLA_BACKUP, sizeof(node_id), node_id);
899
900 if (ret < 0) {
895 netif_notice(tp, probe, dev, "inet addr fail\n"); 901 netif_notice(tp, probe, dev, "inet addr fail\n");
896 else { 902 } else {
903 if (tp->version != RTL_VER_01) {
904 ocp_write_byte(tp, MCU_TYPE_PLA, PLA_CRWECR,
905 CRWECR_CONFIG);
906 pla_ocp_write(tp, PLA_IDR, BYTE_EN_SIX_BYTES,
907 sizeof(node_id), node_id);
908 ocp_write_byte(tp, MCU_TYPE_PLA, PLA_CRWECR,
909 CRWECR_NORAML);
910 }
911
897 memcpy(dev->dev_addr, node_id, dev->addr_len); 912 memcpy(dev->dev_addr, node_id, dev->addr_len);
898 memcpy(dev->perm_addr, dev->dev_addr, dev->addr_len); 913 memcpy(dev->perm_addr, dev->dev_addr, dev->addr_len);
899 } 914 }