diff options
Diffstat (limited to 'drivers/net/ethernet/xilinx/xilinx_emaclite.c')
-rw-r--r-- | drivers/net/ethernet/xilinx/xilinx_emaclite.c | 41 |
1 files changed, 18 insertions, 23 deletions
diff --git a/drivers/net/ethernet/xilinx/xilinx_emaclite.c b/drivers/net/ethernet/xilinx/xilinx_emaclite.c index 4c619ea5189f..74234a51c851 100644 --- a/drivers/net/ethernet/xilinx/xilinx_emaclite.c +++ b/drivers/net/ethernet/xilinx/xilinx_emaclite.c | |||
@@ -31,7 +31,7 @@ | |||
31 | #define DRIVER_NAME "xilinx_emaclite" | 31 | #define DRIVER_NAME "xilinx_emaclite" |
32 | 32 | ||
33 | /* Register offsets for the EmacLite Core */ | 33 | /* Register offsets for the EmacLite Core */ |
34 | #define XEL_TXBUFF_OFFSET 0x0 /* Transmit Buffer */ | 34 | #define XEL_TXBUFF_OFFSET 0x0 /* Transmit Buffer */ |
35 | #define XEL_MDIOADDR_OFFSET 0x07E4 /* MDIO Address Register */ | 35 | #define XEL_MDIOADDR_OFFSET 0x07E4 /* MDIO Address Register */ |
36 | #define XEL_MDIOWR_OFFSET 0x07E8 /* MDIO Write Data Register */ | 36 | #define XEL_MDIOWR_OFFSET 0x07E8 /* MDIO Write Data Register */ |
37 | #define XEL_MDIORD_OFFSET 0x07EC /* MDIO Read Data Register */ | 37 | #define XEL_MDIORD_OFFSET 0x07EC /* MDIO Read Data Register */ |
@@ -63,13 +63,13 @@ | |||
63 | #define XEL_MDIOCTRL_MDIOEN_MASK 0x00000008 /* MDIO Enable */ | 63 | #define XEL_MDIOCTRL_MDIOEN_MASK 0x00000008 /* MDIO Enable */ |
64 | 64 | ||
65 | /* Global Interrupt Enable Register (GIER) Bit Masks */ | 65 | /* Global Interrupt Enable Register (GIER) Bit Masks */ |
66 | #define XEL_GIER_GIE_MASK 0x80000000 /* Global Enable */ | 66 | #define XEL_GIER_GIE_MASK 0x80000000 /* Global Enable */ |
67 | 67 | ||
68 | /* Transmit Status Register (TSR) Bit Masks */ | 68 | /* Transmit Status Register (TSR) Bit Masks */ |
69 | #define XEL_TSR_XMIT_BUSY_MASK 0x00000001 /* Tx complete */ | 69 | #define XEL_TSR_XMIT_BUSY_MASK 0x00000001 /* Tx complete */ |
70 | #define XEL_TSR_PROGRAM_MASK 0x00000002 /* Program the MAC address */ | 70 | #define XEL_TSR_PROGRAM_MASK 0x00000002 /* Program the MAC address */ |
71 | #define XEL_TSR_XMIT_IE_MASK 0x00000008 /* Tx interrupt enable bit */ | 71 | #define XEL_TSR_XMIT_IE_MASK 0x00000008 /* Tx interrupt enable bit */ |
72 | #define XEL_TSR_XMIT_ACTIVE_MASK 0x80000000 /* Buffer is active, SW bit | 72 | #define XEL_TSR_XMIT_ACTIVE_MASK 0x80000000 /* Buffer is active, SW bit |
73 | * only. This is not documented | 73 | * only. This is not documented |
74 | * in the HW spec */ | 74 | * in the HW spec */ |
75 | 75 | ||
@@ -77,21 +77,21 @@ | |||
77 | #define XEL_TSR_PROG_MAC_ADDR (XEL_TSR_XMIT_BUSY_MASK | XEL_TSR_PROGRAM_MASK) | 77 | #define XEL_TSR_PROG_MAC_ADDR (XEL_TSR_XMIT_BUSY_MASK | XEL_TSR_PROGRAM_MASK) |
78 | 78 | ||
79 | /* Receive Status Register (RSR) */ | 79 | /* Receive Status Register (RSR) */ |
80 | #define XEL_RSR_RECV_DONE_MASK 0x00000001 /* Rx complete */ | 80 | #define XEL_RSR_RECV_DONE_MASK 0x00000001 /* Rx complete */ |
81 | #define XEL_RSR_RECV_IE_MASK 0x00000008 /* Rx interrupt enable bit */ | 81 | #define XEL_RSR_RECV_IE_MASK 0x00000008 /* Rx interrupt enable bit */ |
82 | 82 | ||
83 | /* Transmit Packet Length Register (TPLR) */ | 83 | /* Transmit Packet Length Register (TPLR) */ |
84 | #define XEL_TPLR_LENGTH_MASK 0x0000FFFF /* Tx packet length */ | 84 | #define XEL_TPLR_LENGTH_MASK 0x0000FFFF /* Tx packet length */ |
85 | 85 | ||
86 | /* Receive Packet Length Register (RPLR) */ | 86 | /* Receive Packet Length Register (RPLR) */ |
87 | #define XEL_RPLR_LENGTH_MASK 0x0000FFFF /* Rx packet length */ | 87 | #define XEL_RPLR_LENGTH_MASK 0x0000FFFF /* Rx packet length */ |
88 | 88 | ||
89 | #define XEL_HEADER_OFFSET 12 /* Offset to length field */ | 89 | #define XEL_HEADER_OFFSET 12 /* Offset to length field */ |
90 | #define XEL_HEADER_SHIFT 16 /* Shift value for length */ | 90 | #define XEL_HEADER_SHIFT 16 /* Shift value for length */ |
91 | 91 | ||
92 | /* General Ethernet Definitions */ | 92 | /* General Ethernet Definitions */ |
93 | #define XEL_ARP_PACKET_SIZE 28 /* Max ARP packet size */ | 93 | #define XEL_ARP_PACKET_SIZE 28 /* Max ARP packet size */ |
94 | #define XEL_HEADER_IP_LENGTH_OFFSET 16 /* IP Length Offset */ | 94 | #define XEL_HEADER_IP_LENGTH_OFFSET 16 /* IP Length Offset */ |
95 | 95 | ||
96 | 96 | ||
97 | 97 | ||
@@ -1075,14 +1075,9 @@ static int xemaclite_send(struct sk_buff *orig_skb, struct net_device *dev) | |||
1075 | * This function un maps the IO region of the Emaclite device and frees the net | 1075 | * This function un maps the IO region of the Emaclite device and frees the net |
1076 | * device. | 1076 | * device. |
1077 | */ | 1077 | */ |
1078 | static void xemaclite_remove_ndev(struct net_device *ndev, | 1078 | static void xemaclite_remove_ndev(struct net_device *ndev) |
1079 | struct platform_device *pdev) | ||
1080 | { | 1079 | { |
1081 | if (ndev) { | 1080 | if (ndev) { |
1082 | struct net_local *lp = netdev_priv(ndev); | ||
1083 | |||
1084 | if (lp->base_addr) | ||
1085 | devm_iounmap(&pdev->dev, lp->base_addr); | ||
1086 | free_netdev(ndev); | 1081 | free_netdev(ndev); |
1087 | } | 1082 | } |
1088 | } | 1083 | } |
@@ -1177,7 +1172,7 @@ static int xemaclite_of_probe(struct platform_device *ofdev) | |||
1177 | 1172 | ||
1178 | if (mac_address) | 1173 | if (mac_address) |
1179 | /* Set the MAC address. */ | 1174 | /* Set the MAC address. */ |
1180 | memcpy(ndev->dev_addr, mac_address, 6); | 1175 | memcpy(ndev->dev_addr, mac_address, ETH_ALEN); |
1181 | else | 1176 | else |
1182 | dev_warn(dev, "No MAC address found\n"); | 1177 | dev_warn(dev, "No MAC address found\n"); |
1183 | 1178 | ||
@@ -1214,7 +1209,7 @@ static int xemaclite_of_probe(struct platform_device *ofdev) | |||
1214 | return 0; | 1209 | return 0; |
1215 | 1210 | ||
1216 | error: | 1211 | error: |
1217 | xemaclite_remove_ndev(ndev, ofdev); | 1212 | xemaclite_remove_ndev(ndev); |
1218 | return rc; | 1213 | return rc; |
1219 | } | 1214 | } |
1220 | 1215 | ||
@@ -1248,7 +1243,7 @@ static int xemaclite_of_remove(struct platform_device *of_dev) | |||
1248 | of_node_put(lp->phy_node); | 1243 | of_node_put(lp->phy_node); |
1249 | lp->phy_node = NULL; | 1244 | lp->phy_node = NULL; |
1250 | 1245 | ||
1251 | xemaclite_remove_ndev(ndev, of_dev); | 1246 | xemaclite_remove_ndev(ndev); |
1252 | 1247 | ||
1253 | return 0; | 1248 | return 0; |
1254 | } | 1249 | } |