Skip to contentSkip to conversation

net: ethoc: add write_hwaddr support

PATCH New Thomas Chou 2 participants 4 messages Apr 27, 2010 Network drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net: ethoc: add write_hwaddr support

---
 drivers/net/ethoc.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)
drivers/net/ethoc.c +3 -1
index b912e44..286fbe7 100644
@@ -215,13 +215,14 @@ static inline void ethoc_write_bd(struct eth_device *dev, int index,
 	ethoc_write(dev, offset + 4, bd->addr);
 }
 
-static inline void ethoc_set_mac_address(struct eth_device *dev)
+static int ethoc_set_mac_address(struct eth_device *dev)
 {
 	u8 *mac = dev->enetaddr;
 
 	ethoc_write(dev, MAC_ADDR0, (mac[2] << 24) | (mac[3] << 16) |
 		    (mac[4] << 8) | (mac[5] << 0));
 	ethoc_write(dev, MAC_ADDR1, (mac[0] << 8) | (mac[1] << 0));
+	return 0;
 }
 
 static inline void ethoc_ack_irq(struct eth_device *dev, u32 mask)
@@ -504,6 +505,7 @@ int ethoc_initialize(u8 dev_num, int base_addr)
 	dev->halt = ethoc_halt;
 	dev->send = ethoc_send;
 	dev->recv = ethoc_recv;
+	dev->write_hwaddr = ethoc_set_mac_address;
 	sprintf(dev->name, "%s-%hu", "ETHOC", dev_num);
 
 	eth_register(dev);
Signature · 1 line
1.6.6.1
#1 lore raw

PATCH v2 1/1 net: ethoc: add write_hwaddr support

---
v2 remove set mac address from init.

 drivers/net/ethoc.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)
drivers/net/ethoc.c +3 -3
index b912e44..34cc47f 100644
@@ -215,13 +215,14 @@ static inline void ethoc_write_bd(struct eth_device *dev, int index,
 	ethoc_write(dev, offset + 4, bd->addr);
 }
 
-static inline void ethoc_set_mac_address(struct eth_device *dev)
+static int ethoc_set_mac_address(struct eth_device *dev)
 {
 	u8 *mac = dev->enetaddr;
 
 	ethoc_write(dev, MAC_ADDR0, (mac[2] << 24) | (mac[3] << 16) |
 		    (mac[4] << 8) | (mac[5] << 0));
 	ethoc_write(dev, MAC_ADDR1, (mac[0] << 8) | (mac[1] << 0));
+	return 0;
 }
 
 static inline void ethoc_ack_irq(struct eth_device *dev, u32 mask)
@@ -308,8 +309,6 @@ static int ethoc_init(struct eth_device *dev, bd_t * bd)
 	struct ethoc *priv = (struct ethoc *)dev->priv;
 	printf("ethoc\n");
 
-	ethoc_set_mac_address(dev);
-
 	priv->num_tx = 1;
 	priv->num_rx = PKTBUFSRX;
 	ethoc_write(dev, TX_BD_NUM, priv->num_tx);
@@ -504,6 +503,7 @@ int ethoc_initialize(u8 dev_num, int base_addr)
 	dev->halt = ethoc_halt;
 	dev->send = ethoc_send;
 	dev->recv = ethoc_recv;
+	dev->write_hwaddr = ethoc_set_mac_address;
 	sprintf(dev->name, "%s-%hu", "ETHOC", dev_num);
 
 	eth_register(dev);
Signature · 1 line
1.6.6.1
Applied
#2 lore raw

PATCH v2 1/1 net: ethoc: add write_hwaddr support

Thomas,

Quoted 7 lines · Thomas Chou

---
v2 remove set mac address from init.

  drivers/net/ethoc.c |    6 +++---
  1 files changed, 3 insertions(+), 3 deletions(-)

Applied to net repo. Please ignore similar message about V1, V2 is the one that was applied.

regards,
Ben

Applied
#3 lore raw

PATCH 1/1 net: ethoc: add write_hwaddr support

In reply to Thomas Chou

Hi Thomas,

Quoted 27 lines · Thomas Chou
---
  drivers/net/ethoc.c |    4 +++-
  1 files changed, 3 insertions(+), 1 deletions(-)
drivers/net/ethoc.c +2 -1
index b912e44..286fbe7 100644
@@ -215,13 +215,14 @@ static inline void ethoc_write_bd(struct eth_device *dev, int index,
  	ethoc_write(dev, offset + 4, bd->addr);
  }
 
-static inline void ethoc_set_mac_address(struct eth_device *dev)
+static int ethoc_set_mac_address(struct eth_device *dev)
  {
  	u8 *mac = dev->enetaddr;
 
  	ethoc_write(dev, MAC_ADDR0, (mac[2]<<  24) | (mac[3]<<  16) |
  		    (mac[4]<<  8) | (mac[5]<<  0));
  	ethoc_write(dev, MAC_ADDR1, (mac[0]<<  8) | (mac[1]<<  0));
+	return 0;
  }
 
  static inline void ethoc_ack_irq(struct eth_device *dev, u32 mask)

drivers/net/ethoc.c int ethoc_initialize(u8 dev_num, int base_addr) · line 511

Quoted 7 lines
drivers/net/ethoc.c +1 -0
@@ -504,6 +505,7 @@ int ethoc_initialize(u8 dev_num, int base_addr)
  	dev->halt = ethoc_halt;
  	dev->send = ethoc_send;
  	dev->recv = ethoc_recv;
+	dev->write_hwaddr = ethoc_set_mac_address;
  	sprintf(dev->name, "%s-%hu", "ETHOC", dev_num);
 
  	eth_register(dev);

Applied to net repo.

thanks,
Ben