Skip to contentSkip to conversation

macb: add support for board specific get_ethaddr function

PATCH In review Hubert Feurstein 2 participants 4 messages Jun 16, 2011 – Jun 22, 2011

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 macb: add support for board specific get_ethaddr function

Cc Jean-Christophe PLAGNIOL-VILLARD <[email protected]>
---
 arch/arm/mach-at91/include/mach/board.h |    2 ++
 drivers/net/macb.c                      |    2 +-
 2 files changed, 3 insertions(+), 1 deletions(-)
arch/arm/mach-at91/include/mach/board.h +2 -0
index 89c1746..89caebb 100644
@@ -21,6 +21,7 @@
 #ifndef __ASM_ARCH_BOARD_H
 #define __ASM_ARCH_BOARD_H
 
+#include <net.h>
 #include <linux/mtd/mtd.h>
 
 void atmel_nand_load_image(void *dest, int size, int pagesize, int blocksize);
@@ -47,6 +48,7 @@ void at91_add_device_nand(struct atmel_nand_data *data);
 struct at91_ether_platform_data {
 	unsigned int flags;
 	int phy_addr;
+	int (*get_ethaddr)(struct eth_device*, unsigned char *adr);
 };
 
 void at91_add_device_eth(struct at91_ether_platform_data *data);
drivers/net/macb.c +1 -1
index df3b6af..bc6618b 100644
@@ -431,7 +431,7 @@ static int macb_probe(struct device_d *dev)
 	edev->send = macb_send;
 	edev->recv = macb_recv;
 	edev->halt = macb_halt;
-	edev->get_ethaddr = macb_get_ethaddr;
+	edev->get_ethaddr = pdata->get_ethaddr ? pdata->get_ethaddr : macb_get_ethaddr;
 	edev->set_ethaddr = macb_set_ethaddr;
 
 	macb->miidev.read = macb_phy_read;

--
1.7.4.1

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox

#1 lore raw
Quoted 20 lines · Hubert Feurstein
Cc Jean-Christophe PLAGNIOL-VILLARD <[email protected]>
---
 arch/arm/mach-at91/include/mach/board.h |    2 ++
 drivers/net/macb.c                      |    2 +-
 2 files changed, 3 insertions(+), 1 deletions(-)
arch/arm/mach-at91/include/mach/board.h +1 -0
index 89c1746..89caebb 100644
@@ -21,6 +21,7 @@
 #ifndef __ASM_ARCH_BOARD_H
 #define __ASM_ARCH_BOARD_H
 
+#include <net.h>
 #include <linux/mtd/mtd.h>
 
 void atmel_nand_load_image(void *dest, int size, int pagesize, int blocksize);

arch/arm/mach-at91/include/mach/board.h void at91_add_device_nand(struct atmel_nand_data *data); · line 51

Quoted 4 lines
arch/arm/mach-at91/include/mach/board.h +1 -0
@@ -47,6 +48,7 @@ void at91_add_device_nand(struct atmel_nand_data *data);
 struct at91_ether_platform_data {
 	unsigned int flags;
 	int phy_addr;
+	int (*get_ethaddr)(struct eth_device*, unsigned char *adr);

can we find a generic way?

Best Regards,
J.

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox

#2 lore raw

2011/6/21 Jean-Christophe PLAGNIOL-VILLARD <[email protected]>:

Quoted 6 lines

arch/arm/mach-at91/include/mach/board.h void at91_add_device_nand(struct atmel_nand_data *data); · line 51

Quoted 5 lines
arch/arm/mach-at91/include/mach/board.h +1 -0
@@ -47,6 +48,7 @@ void at91_add_device_nand(struct atmel_nand_data *data);
  struct at91_ether_platform_data {
       unsigned int flags;
       int phy_addr;
+     int (*get_ethaddr)(struct eth_device*, unsigned char *adr);

can we find a generic way?

a generic way would be to simply call 'dev_set_param(get_device_by_name("eth0"), "ethaddr", macbuffer)' somewhere after at91_add_device_eth(...) in your init. Then you don't need the callback at all to setup the mac-address.

Best Regards
Hubert

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox

#3 lore raw
Quoted 11 lines · Hubert Feurstein

2011/6/21 Jean-Christophe PLAGNIOL-VILLARD <[email protected]>:

Quoted 6 lines

arch/arm/mach-at91/include/mach/board.h void at91_add_device_nand(struct atmel_nand_data *data); · line 51

Quoted 5 lines
arch/arm/mach-at91/include/mach/board.h +1 -0
@@ -47,6 +48,7 @@ void at91_add_device_nand(struct atmel_nand_data *data);
  struct at91_ether_platform_data {
       unsigned int flags;
       int phy_addr;
+     int (*get_ethaddr)(struct eth_device*, unsigned char *adr);

can we find a generic way?

a generic way would be to simply call 'dev_set_param(get_device_by_name("eth0"), "ethaddr", macbuffer)' somewhere after at91_add_device_eth(...) in your init. Then you don't need the callback at all to setup the mac-address.

I more in mind an api to update the get/set_ethaddr without specific hookin each driver

Best Regards,
J.

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox