Skip to content

Commit

Permalink
dm9000: Support MAC address setting through platform data.
Browse files Browse the repository at this point in the history
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: Laurent Pinchart <laurentp@cse-semaphore.com>
Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
  • Loading branch information
Laurent Pinchart authored and Jeff Garzik committed Aug 7, 2008
1 parent 9a5d341 commit fe41424
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
5 changes: 5 additions & 0 deletions drivers/net/dm9000.c
Original file line number Diff line number Diff line change
Expand Up @@ -1374,6 +1374,11 @@ dm9000_probe(struct platform_device *pdev)
for (i = 0; i < 6; i += 2)
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)) {
/* try reading from mac */

Expand Down
1 change: 1 addition & 0 deletions include/linux/dm9000.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@

struct dm9000_plat_data {
unsigned int flags;
unsigned char dev_addr[6];

/* allow replacement IO routines */

Expand Down

0 comments on commit fe41424

Please sign in to comment.