Commit fe414248 authored by Laurent Pinchart's avatar Laurent Pinchart Committed by Jeff Garzik

dm9000: Support MAC address setting through platform data.

The dm9000 driver reads the chip's MAC address from the attached EEPROM. When
no EEPROM is present, or when the MAC address is invalid, it falls back to
reading the address from the chip.

This patch lets platform code set the desired MAC address through platform
data.
Signed-off-by: default avatarLaurent Pinchart <laurentp@cse-semaphore.com>
Signed-off-by: default avatarJeff Garzik <jgarzik@redhat.com>
parent 9a5d3414
...@@ -1374,6 +1374,11 @@ dm9000_probe(struct platform_device *pdev) ...@@ -1374,6 +1374,11 @@ dm9000_probe(struct platform_device *pdev)
for (i = 0; i < 6; i += 2) for (i = 0; i < 6; i += 2)
dm9000_read_eeprom(db, i / 2, ndev->dev_addr+i); dm9000_read_eeprom(db, i / 2, ndev->dev_addr+i);
if (!is_valid_ether_addr(ndev->dev_addr) && pdata != NULL) {
mac_src = "platform data";
memcpy(ndev->dev_addr, pdata->dev_addr, 6);
}
if (!is_valid_ether_addr(ndev->dev_addr)) { if (!is_valid_ether_addr(ndev->dev_addr)) {
/* try reading from mac */ /* try reading from mac */
......
...@@ -27,6 +27,7 @@ ...@@ -27,6 +27,7 @@
struct dm9000_plat_data { struct dm9000_plat_data {
unsigned int flags; unsigned int flags;
unsigned char dev_addr[6];
/* allow replacement IO routines */ /* allow replacement IO routines */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment