Skip to contentSkip to conversation

smsc95xx: Fix MAC address programming and some minor issues

PATCH New Wolfgang Grandegger 4 participants 11 messages Nov 15, 2011 – Nov 22, 2011 USB

lore
Share & tools
lore
#0 lore raw

v2 cover smsc95xx: Fix MAC address programming and some minor issues

Changes since v1:

- Use __get_unaligned_le16/32 as suggested by Mike Frysinger.
- Use format "%pM" to print ethernet address.
- Drop third patch as it is not really required/useful.

Wolfgang Grandegger (2):
smsc95xx: Fix MAC address programming
smsc95xx: Debug message cleanup

 drivers/usb/eth/smsc95xx.c |   16 ++++++----------
 1 files changed, 6 insertions(+), 10 deletions(-)
Signature · 1 line
1.7.4.1
#1 lore raw

PATCH v2 1/2 smsc95xx: Fix MAC address programming

Commit 79ad54400932d6484178a372fb3b659e3437473b broke MAC address programming in the SMSC95xx register set.

Cc Marek Vasut <[email protected]>
Cc Wolfgang Denk <[email protected]>
Cc Simon Glass <[email protected]>
Cc Mike Frysinger <[email protected]>
---
 drivers/usb/eth/smsc95xx.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)
drivers/usb/eth/smsc95xx.c +3 -3
index 7ee4f87..b5626e6 100644
@@ -20,6 +20,7 @@
  * MA 02111-1307 USA
  */
 
+#include <asm/unaligned.h>
 #include <common.h>
 #include <usb.h>
 #include <linux/mii.h>
@@ -372,13 +373,12 @@ static int smsc95xx_init_mac_address(struct eth_device *eth,
 static int smsc95xx_write_hwaddr(struct eth_device *eth)
 {
 	struct ueth_data *dev = (struct ueth_data *)eth->priv;
-	u32 addr_lo, addr_hi;
+	u32 addr_lo = __get_unaligned_le32(&eth->enetaddr[0]);
+	u32 addr_hi = __get_unaligned_le16(&eth->enetaddr[4]);
 	int ret;
 
 	/* set hardware address */
 	debug("** %s()\n", __func__);
-	addr_lo = cpu_to_le32(*eth->enetaddr);
-	addr_hi = cpu_to_le16(*((u16 *)(eth->enetaddr + 4)));
 	ret = smsc95xx_write_reg(dev, ADDRL, addr_lo);
 	if (ret < 0) {
 		debug("Failed to write ADDRL: %d\n", ret);
Signature · 1 line
1.7.4.1
#3 lore raw

PATCH v2 1/2 smsc95xx: Fix MAC address programming

In reply to Wolfgang Grandegger

Hi Wolfgang,

Quoted 25 lines · Wolfgang Grandegger

Commit 79ad54400932d6484178a372fb3b659e3437473b broke MAC address programming in the SMSC95xx register set.

Cc Marek Vasut <[email protected]>
Cc Wolfgang Denk <[email protected]>
Cc Simon Glass <[email protected]>
Cc Mike Frysinger <[email protected]>

---
?drivers/usb/eth/smsc95xx.c | ? ?6 +++---
?1 files changed, 3 insertions(+), 3 deletions(-)

drivers/usb/eth/smsc95xx.c +0 -0
index 7ee4f87..b5626e6 100644
@@ -20,6 +20,7 @@

?* MA 02111-1307 USA
?*/

+#include <asm/unaligned.h>
?#include <common.h>
?#include <usb.h>
?#include <linux/mii.h>

drivers/usb/eth/smsc95xx.c static int smsc95xx_init_mac_address(struct eth_device *eth, · line 377

Quoted 6 lines
drivers/usb/eth/smsc95xx.c +2 -1
@@ -372,13 +373,12 @@ static int smsc95xx_init_mac_address(struct eth_device *eth,
 ?static int smsc95xx_write_hwaddr(struct eth_device *eth)
 ?{
 ? ? ? ?struct ueth_data *dev = (struct ueth_data *)eth->priv;
- ? ? ? u32 addr_lo, addr_hi;
+ ? ? ? u32 addr_lo = __get_unaligned_le32(&eth->enetaddr[0]);
+ ? ? ? u32 addr_hi = __get_unaligned_le16(&eth->enetaddr[4]);

Would prefer that you leave the definitions alone, but it's not important.

Quoted 13 lines
drivers/usb/eth/smsc95xx.c +0 -0
 ? ? ? ?int ret;
 

? ? ? ?/* set hardware address */
? ? ? ?debug("** %s()\n", __func__);
- ? ? ? addr_lo = cpu_to_le32(*eth->enetaddr);
- ? ? ? addr_hi = cpu_to_le16(*((u16 *)(eth->enetaddr + 4))); ? ? ? ?ret = smsc95xx_write_reg(dev, ADDRL, addr_lo); ? ? ? ?if (ret < 0) {
? ? ? ? ? ? ? ?debug("Failed to write ADDRL: %d\n", ret); --
1.7.4.1

#4 lore raw

PATCH v2 1/2 smsc95xx: Fix MAC address programming

In reply to Wolfgang Grandegger
Quoted 9 lines · Wolfgang Grandegger

Commit 79ad54400932d6484178a372fb3b659e3437473b broke MAC address programming in the SMSC95xx register set.

Cc Marek Vasut <[email protected]>
Cc Wolfgang Denk <[email protected]>
Cc Simon Glass <[email protected]>
Cc Mike Frysinger <[email protected]>

---

Applied to u-boot-staging, sbabic at denx.de, thanks.

Best regards,
Stefano Babic

Signature · 5 lines
=====================================================================
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-0 Fax: +49-8142-66989-80  Email: office at denx.de
=====================================================================
#5 lore raw

PATCH v2 2/2 smsc95xx: Debug message cleanup

In reply to Wolfgang Grandegger
Cc Simon Glass <[email protected]>
Cc Mike Frysinger <[email protected]>
---
 drivers/usb/eth/smsc95xx.c |   10 +++-------
 1 files changed, 3 insertions(+), 7 deletions(-)
drivers/usb/eth/smsc95xx.c +3 -7
index b5626e6..2f63340 100644
@@ -380,18 +380,14 @@ static int smsc95xx_write_hwaddr(struct eth_device *eth)
 	/* set hardware address */
 	debug("** %s()\n", __func__);
 	ret = smsc95xx_write_reg(dev, ADDRL, addr_lo);
-	if (ret < 0) {
-		debug("Failed to write ADDRL: %d\n", ret);
+	if (ret < 0)
 		return ret;
-	}
 
 	ret = smsc95xx_write_reg(dev, ADDRH, addr_hi);
 	if (ret < 0)
 		return ret;
-	debug("MAC %02x:%02x:%02x:%02x:%02x:%02x\n",
-		eth->enetaddr[0], eth->enetaddr[1],
-		eth->enetaddr[2], eth->enetaddr[3],
-		eth->enetaddr[4], eth->enetaddr[5]);
+
+	debug("MAC %pM\n", eth->enetaddr);
 	dev->have_hwaddr = 1;
 	return 0;
 }
Signature · 1 line
1.7.4.1
#7 lore raw

PATCH v2 2/2 smsc95xx: Debug message cleanup

In reply to Wolfgang Grandegger
Quoted 6 lines · Wolfgang Grandegger
Cc Simon Glass <[email protected]>
Cc Mike Frysinger <[email protected]>

---
?drivers/usb/eth/smsc95xx.c | ? 10 +++-------
?1 files changed, 3 insertions(+), 7 deletions(-)

Quoted 31 lines
drivers/usb/eth/smsc95xx.c +0 -0
index b5626e6..2f63340 100644
@@ -380,18 +380,14 @@ static int smsc95xx_write_hwaddr(struct eth_device *eth)

? ? ? ?/* set hardware address */
? ? ? ?debug("** %s()\n", __func__);
? ? ? ?ret = smsc95xx_write_reg(dev, ADDRL, addr_lo);
- ? ? ? if (ret < 0) {
- ? ? ? ? ? ? ? debug("Failed to write ADDRL: %d\n", ret);
+ ? ? ? if (ret < 0)
? ? ? ? ? ? ? ?return ret;
- ? ? ? }

? ? ? ?ret = smsc95xx_write_reg(dev, ADDRH, addr_hi); ? ? ? ?if (ret < 0)
? ? ? ? ? ? ? ?return ret;
- ? ? ? debug("MAC %02x:%02x:%02x:%02x:%02x:%02x\n",
- ? ? ? ? ? ? ? eth->enetaddr[0], eth->enetaddr[1],
- ? ? ? ? ? ? ? eth->enetaddr[2], eth->enetaddr[3],
- ? ? ? ? ? ? ? eth->enetaddr[4], eth->enetaddr[5]); +
+ ? ? ? debug("MAC %pM\n", eth->enetaddr);
? ? ? ?dev->have_hwaddr = 1;
? ? ? ?return 0;
?}
--
1.7.4.1

#8 lore raw

PATCH v2 2/2 smsc95xx: Debug message cleanup

Hi Simon,

Quoted 9 lines · Simon Glass
Quoted 6 lines · Wolfgang Grandegger
Cc Simon Glass <[email protected]>
Cc Mike Frysinger <[email protected]>
---
 drivers/usb/eth/smsc95xx.c |   10 +++-------
 1 files changed, 3 insertions(+), 7 deletions(-)

Thanks. Who will take care of these patches? Do you know?

Wolfgang.

#9 lore raw

PATCH v2 2/2 smsc95xx: Debug message cleanup

Quoted 13 lines · Wolfgang Grandegger

Hi Simon,

Quoted 9 lines · Simon Glass
Quoted 6 lines · Wolfgang Grandegger
Cc Simon Glass <[email protected]>
Cc Mike Frysinger <[email protected]>
---
 drivers/usb/eth/smsc95xx.c |   10 +++-------
 1 files changed, 3 insertions(+), 7 deletions(-)
Quoted 8 lines

Thanks. Who will take care of these patches? Do you know?

Wolfgang.
_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot

Hi Wolfgang,

I have already merged your patches into u-boot-staging, sbabic at denx.de branch, and sent a pull request to Wolfgang (Denk).

Best regards,
Stefano Babic

Signature · 5 lines
=====================================================================
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-0 Fax: +49-8142-66989-80  Email: office at denx.de
=====================================================================
#10 lore raw

PATCH v2 2/2 smsc95xx: Debug message cleanup

In reply to Wolfgang Grandegger
Quoted 4 lines · Wolfgang Grandegger
Cc Simon Glass <[email protected]>
Cc Mike Frysinger <[email protected]>

---

Applied to u-boot-staging, sbabic at denx.de, thanks.

Best regards,
Stefano Babic

Signature · 5 lines
=====================================================================
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-0 Fax: +49-8142-66989-80  Email: office at denx.de
=====================================================================