smsc95xx: Fix MAC address programming and some minor issues
cover smsc95xx: Fix MAC address programming and some minor issues
Wolfgang Grandegger (3):
smsc95xx: Fix MAC address programming
smsc95xx: in smsc95xx_set_multicast write to reg
smsc95xx: remove an unecessary debug messages
drivers/usb/eth/smsc95xx.c | 16 +++++++++------- 1 files changed, 9 insertions(+), 7 deletions(-)
Signature · 1 line
1.7.4.1
PATCH 1/3 smsc95xx: Fix MAC address programming
Commit 79ad54400932d6484178a372fb3b659e3437473b broke the MAC address programming. Fix this by using the method from Linux' smsc95xx_set_mac_address().
--- drivers/usb/eth/smsc95xx.c | 7 ++++--- 1 files changed, 4 insertions(+), 3 deletions(-)
drivers/usb/eth/smsc95xx.c +4 -3
@@ -372,13 +372,14 @@ 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 = eth->enetaddr[0 ] | eth->enetaddr[1 ] <<8 | + eth->enetaddr[2 ] <<16 | eth->enetaddr[3 ] <<24 ; +u32 addr_hi = eth->enetaddr[4 ] | eth->enetaddr[5 ] <<8 ;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
PATCH 1/3 smsc95xx: Fix MAC address programming
Quoted 23 lines
Commit
79ad54400932d6484178a372fb3b659e3437473bbroke the MAC address programming. Fix this by using the method from Linux'smsc95xx_set_mac_address().Signed-off-by Wolfgang Grandegger <[email protected]>Cc Marek Vasut <[email protected]>Cc Simon Glass <[email protected]>--- drivers/usb/eth/smsc95xx.c | 7 ++++--- 1 files changed, 4 insertions(+), 3 deletions(-)drivers/usb/eth/smsc95xx.c +3
-1@@ -372,13 +372,14 @@ 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 = eth->enetaddr[0 ] | eth->enetaddr[1 ] <<8 | + eth->enetaddr[2 ] <<16 | eth->enetaddr[3 ] <<24 ; +u32 addr_hi = eth->enetaddr[4 ] | eth->enetaddr[5 ] <<8 ;
drivers/usb/eth/smsc95xx.c static int smsc95xx_init_mac_address(struct · line 385
Quoted 10 lines
drivers/usb/eth/smsc95xx.c +1
-2int 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);
Hey,
didn't Mike Frysinger send similar patch yesterday? Also, do you have the hardware? If so, that's good, we know you can provide tested fix.
Mike, are you good with using this fix instead or can you two negotiate?
M
PATCH 1/3 smsc95xx: Fix MAC address programming
Quoted 36 lines · Marek Vasut
Quoted 23 lines
Commit
79ad54400932d6484178a372fb3b659e3437473bbroke the MAC address programming. Fix this by using the method from Linux'smsc95xx_set_mac_address().Signed-off-by Wolfgang Grandegger <[email protected]>Cc Marek Vasut <[email protected]>Cc Simon Glass <[email protected]>--- drivers/usb/eth/smsc95xx.c | 7 ++++--- 1 files changed, 4 insertions(+), 3 deletions(-)drivers/usb/eth/smsc95xx.c +3
-1@@ -372,13 +372,14 @@ 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 = eth->enetaddr[0 ] | eth->enetaddr[1 ] <<8 | + eth->enetaddr[2 ] <<16 | eth->enetaddr[3 ] <<24 ; +u32 addr_hi = eth->enetaddr[4 ] | eth->enetaddr[5 ] <<8 ;drivers/usb/eth/smsc95xx.c static int smsc95xx_init_mac_address(struct · line 385
Quoted 10 lines
drivers/usb/eth/smsc95xx.c +1
-2int 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);Hey,
Quoted 1 line
didn't Mike Frysinger send similar patch yesterday? Also, do you have the
Ah, I obviously missed that.
Quoted 1 line
hardware? If so, that's good, we know you can provide tested fix.
Well, yes, I know somebody who has smsc95xx hardware ;-).
Quoted 1 line
Mike, are you good with using this fix instead or can you two negotiate?
Let's await Mike's answer (now on CC as well). I need to re-send the series anyway due to a stupid typo.
Wolfgang
PATCH 1/3 smsc95xx: Fix MAC address programming
Quoted 27 lines · On Friday 11 November 2011 07:33:00 Wolfgang Grandegger wrote:
Quoted 17 lines · Marek Vasut
Quoted 17 lines
Commit
79ad54400932d6484178a372fb3b659e3437473bbroke the MAC address programming. Fix this by using the method from Linux'smsc95xx_set_mac_address().drivers/usb/eth/smsc95xx.c +3
-1-u32 addr_lo, addr_hi; +u32 addr_lo = eth->enetaddr[0 ] | eth->enetaddr[1 ] <<8 | + eth->enetaddr[2 ] <<16 | eth->enetaddr[3 ] <<24 ; +u32 addr_hi = eth->enetaddr[4 ] | eth->enetaddr[5 ] <<8 ;int ret;/* set hardware address */ debug ("** %s()\n" , __func__);Quoted 6 lines
drivers/usb/eth/smsc95xx.c static int smsc95xx_init_mac_address(struct eth_device *eth, · line 382
Quoted 4 lines
drivers/usb/eth/smsc95xx.c +1
-2- addr_lo =cpu_to_le32 (*eth->enetaddr); - addr_hi =cpu_to_le16 (*((u16 *)(eth->enetaddr +4 ))); +didn't Mike Frysinger send similar patch yesterday? Also, do you have the
Ah, I obviously missed that.
Quoted 8 lines
Quoted 1 line
hardware? If so, that's good, we know you can provide tested fix.
Well, yes, I know somebody who has smsc95xx hardware ;-).
Quoted 1 line
Mike, are you good with using this fix instead or can you two negotiate?
Let's await Mike's answer (now on CC as well). I need to re-send the series anyway due to a stupid typo.
mine might take a little longer due to wrangling with wolfgang. i'd suggest we go with your patch (although i have feedback on it).
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
Url : http://lists.denx.de/pipermail/u-boot/attachments/20111111/8f9764e6/attachment.pgp
PATCH 1/3 smsc95xx: Fix MAC address programming
Quoted 32 lines · Mike Frysinger
Quoted 31 lines · On Friday 11 November 2011 07:33:00 Wolfgang Grandegger wrote:
Quoted 17 lines · Marek Vasut
Quoted 17 lines
Commit
79ad54400932d6484178a372fb3b659e3437473bbroke the MAC address programming. Fix this by using the method from Linux'smsc95xx_set_mac_address().drivers/usb/eth/smsc95xx.c +3
-1-u32 addr_lo, addr_hi; +u32 addr_lo = eth->enetaddr[0 ] | eth->enetaddr[1 ] <<8 | + eth->enetaddr[2 ] <<16 | eth->enetaddr[3 ] <<24 ; +u32 addr_hi = eth->enetaddr[4 ] | eth->enetaddr[5 ] <<8 ;int ret;/* set hardware address */ debug ("** %s()\n" , __func__);Quoted 6 lines
drivers/usb/eth/smsc95xx.c static int smsc95xx_init_mac_address(struct eth_device *eth, · line 382
Quoted 4 lines
drivers/usb/eth/smsc95xx.c +1
-2- addr_lo =cpu_to_le32 (*eth->enetaddr); - addr_hi =cpu_to_le16 (*((u16 *)(eth->enetaddr +4 ))); +didn't Mike Frysinger send similar patch yesterday? Also, do you have the
Ah, I obviously missed that.
Quoted 1 line
hardware? If so, that's good, we know you can provide tested fix.
Well, yes, I know somebody who has smsc95xx hardware ;-).
Quoted 8 lines
Quoted 4 lines
Quoted 1 line
Mike, are you good with using this fix instead or can you two negotiate?
Let's await Mike's answer (now on CC as well). I need to re-send the series anyway due to a stupid typo.
mine might take a little longer due to wrangling with wolfgang. i'd suggest we go with your patch (although i have feedback on it).
-mike
Well, I have no problem with your patch if it fixes the same issue correctly... and preparing and testing a new patch series takes time. I will simply add my "Tested-by" when I have feedback and we then can drop my other patches.
Wolfgang.
PATCH 1/3 smsc95xx: Fix MAC address programming
Quoted 8 lines · On Monday 14 November 2011 03:25:37 Wolfgang Grandegger wrote:
Quoted 2 lines · Mike Frysinger
mine might take a little longer due to wrangling with wolfgang. i'd suggest we go with your patch (although i have feedback on it).
Well, I have no problem with your patch if it fixes the same issue correctly... and preparing and testing a new patch series takes time. I will simply add my "Tested-by" when I have feedback and we then can drop my other patches.
let's not go with the one i submitted earlier. tweak your patches with the feedback posted and we'll go with those.
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
Url : http://lists.denx.de/pipermail/u-boot/attachments/20111114/d32c6d25/attachment.pgp
PATCH 1/3 smsc95xx: Fix MAC address programming
Quoted 5 lines · Mike Frysinger
Quoted 4 lines · On Monday 14 November 2011 03:25:37 Wolfgang Grandegger wrote:
Quoted 2 lines · Mike Frysinger
mine might take a little longer due to wrangling with wolfgang. i'd suggest we go with your patch (although i have feedback on it).
Quoted 7 lines
Quoted 4 lines
Well, I have no problem with your patch if it fixes the same issue correctly... and preparing and testing a new patch series takes time. I will simply add my "Tested-by" when I have feedback and we then can drop my other patches.
let's not go with the one i submitted earlier. tweak your patches with the feedback posted and we'll go with those.
OK, just sent v2.
Wolfgang.
PATCH 1/3 smsc95xx: Fix MAC address programming
In reply to Wolfgang Grandeggerdrivers/usb/eth/smsc95xx.c static int smsc95xx_init_mac_address(struct eth_device *eth, · line 377
Quoted 11 lines · On Friday 11 November 2011 05:59:56 Wolfgang Grandegger wrote:
Commit
79ad54400932d6484178a372fb3b659e3437473bbroke the MAC address programming. Fix this by using the method from Linux'smsc95xx_set_mac_address().drivers/usb/eth/smsc95xx.c +3
-1-u32 addr_lo, addr_hi; +u32 addr_lo = eth->enetaddr[0 ] | eth->enetaddr[1 ] <<8 | + eth->enetaddr[2 ] <<16 | eth->enetaddr[3 ] <<24 ; +u32 addr_hi = eth->enetaddr[4 ] | eth->enetaddr[5 ] <<8 ;
please use:
#include <asm/unaligned.h> u32 addr_lo = __get_unaligned_le32(ð->enetaddr[0]); u32 addr_hi = __get_unaligned_le16(ð->enetaddr[4]);
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
Url : http://lists.denx.de/pipermail/u-boot/attachments/20111111/1228de54/attachment.pgp
PATCH 1/3 smsc95xx: Fix MAC address programming
In reply to Wolfgang GrandeggerQuoted 3 lines · On Friday 11 November 2011 05:59:56 Wolfgang Grandegger wrote:
Commit
79ad54400932d6484178a372fb3b659e3437473bbroke the MAC address programming. Fix this by using the method from Linux'smsc95xx_set_mac_address().
oh, and while you're here, test out this fix:
- 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);
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
Url : http://lists.denx.de/pipermail/u-boot/attachments/20111111/c34a3d49/attachment.pgp
PATCH 2/3 smsc95xx: in smsc95xx_set_multicast write to reg
In reply to Wolfgang GrandeggerThe write to the mac_cr register was missing. This usually not cause an issue before, since the next function writing the register's shadow copy into the register would do it as a side effect.
--- drivers/usb/eth/smsc95xx.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-)
drivers/usb/eth/smsc95xx.c +2 -0
@@ -428,6 +428,8 @@ static void smsc95xx_set_multicast(struct ueth_data *dev) {/* No multicast in u-boot */ dev->mac_cr &= ~(MAC_CR_PRMS_ |MAC_CR_MCPAS_ |MAC_CR_HPFILT_ ); + +smsc95xx_write_reg (dev,MAC_CR , dev->mac_cr); }/* starts the TX path */
Signature · 1 line
1.7.4.1
PATCH 2/3 smsc95xx: in smsc95xx_set_multicast write to reg
Hi Wolfgang,
Quoted 17 lines · Wolfgang Grandegger
The write to the
mac_crregister was missing. This usually not cause an issue before, since the next function writing the register's shadow copy into the register would do it as a side effect.Signed-off-by Wolfgang Grandegger <[email protected]>Cc Simon Glass <[email protected]>---
?drivers/usb/eth/smsc95xx.c | ? ?2 ++
?1 files changed, 2 insertions(+), 0 deletions(-)drivers/usb/eth/smsc95xx.c +0
-0@@ -428,6 +428,8 @@ static void smsc95xx_set_multicast(struct ueth_data *dev) ?{
Quoted 4 lines
? ? ? ?/* No multicast in u-boot */
? ? ? ?dev->mac_cr &= ~(MAC_CR_PRMS_ |MAC_CR_MCPAS_|MAC_CR_HPFILT_); +
+ ? ? ?smsc95xx_write_reg(dev, MAC_CR, dev->mac_cr);
It seems a bit odd - what problem does your addition actually fix? At present both smsc95xx_start_tx_path() and smsc95xx_start_rx_path() write to this register, so it will be written three times in quick succession. If there are no other callers to smsc95xx_set_multicast() outside init, then perhaps we should just write it once in init, after calling the three functions?
Regards,
Simon
Quoted 7 lines
?}
?/* starts the TX path */
--
1.7.4.1
PATCH 2/3 smsc95xx: in smsc95xx_set_multicast write to reg
Hi Simon,
Quoted 23 lines · Simon Glass
Hi Wolfgang,
Quoted 20 lines · Wolfgang Grandegger
The write to the
mac_crregister was missing. This usually not cause an issue before, since the next function writing the register's shadow copy into the register would do it as a side effect.Signed-off-by Wolfgang Grandegger <[email protected]>Cc Simon Glass <[email protected]>--- drivers/usb/eth/smsc95xx.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-)drivers/usb/eth/smsc95xx.c +1
-0@@ -428,6 +428,8 @@ static void smsc95xx_set_multicast(struct ueth_data *dev) {/* No multicast in u-boot */ dev->mac_cr &= ~(MAC_CR_PRMS_ |MAC_CR_MCPAS_ |MAC_CR_HPFILT_ ); +
Quoted 8 lines
drivers/usb/eth/smsc95xx.c static void smsc95xx_set_multicast(struct ueth_data *dev) · line 432
Quoted 1 line
drivers/usb/eth/smsc95xx.c +1
-0+smsc95xx_write_reg (dev,MAC_CR , dev->mac_cr);It seems a bit odd - what problem does your addition actually fix? At present both
smsc95xx_start_tx_path()andsmsc95xx_start_rx_path()write to this register, so it will be written three times in quick succession. If there are no other callers tosmsc95xx_set_multicast()outside init, then perhaps we should just write it once in init, after calling the three functions?
The name "set_multicast" associated to me that the relevant register is really set. But from the functional poit of few, it is not necessary. Well, it's a minor issue and maybe not worth fixing. So, let's drop this patch.
Wolfgang.
PATCH 2/3 smsc95xx: in smsc95xx_set_multicast write to reg
Hi Wolfgang,
Quoted 35 lines · Wolfgang Grandegger
Hi Simon,
Quoted 23 lines · Simon Glass
Hi Wolfgang,
Quoted 20 lines · Wolfgang Grandegger
The write to the
mac_crregister was missing. This usually not cause an issue before, since the next function writing the register's shadow copy into the register would do it as a side effect.Signed-off-by Wolfgang Grandegger <[email protected]>Cc Simon Glass <[email protected]>---
?drivers/usb/eth/smsc95xx.c | ? ?2 ++
?1 files changed, 2 insertions(+), 0 deletions(-)drivers/usb/eth/smsc95xx.c +0
-0@@ -428,6 +428,8 @@ static void smsc95xx_set_multicast(struct ueth_data *dev) ?{? ? ? ?/* No multicast in u-boot */
? ? ? ?dev->mac_cr &= ~(MAC_CR_PRMS_ |MAC_CR_MCPAS_|MAC_CR_HPFILT_); +Quoted 8 lines
Quoted 1 line
+ ? ? ?
smsc95xx_write_reg(dev, MAC_CR, dev->mac_cr);It seems a bit odd - what problem does your addition actually fix? At present both
smsc95xx_start_tx_path()andsmsc95xx_start_rx_path()write to this register, so it will be written three times in quick succession. If there are no other callers tosmsc95xx_set_multicast()outside init, then perhaps we should just write it once in init, after calling the three functions?
Quoted 2 lines
The name "
set_multicast" associated to me that the relevant register is really set.
Yes, although it is a static function.
Quoted 3 lines
But from the functional poit of few, it is not necessary. Well, it's a minor issue and maybe not worth fixing. So, let's drop this patch.
If you like, although I agree a clean-up would be useful here.
Regards,
Simon
Quoted 3 lines
Wolfgang.
PATCH 3/3 smsc95xx: remove an unecessary debug messages
In reply to Wolfgang Grandegger--- drivers/usb/eth/smsc95xx.c | 7 +++---- 1 files changed, 3 insertions(+), 4 deletions(-)
drivers/usb/eth/smsc95xx.c +3 -4
@@ -380,15 +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); + ret =smsc95xx_write_reg (dev,ADDRL , adddr_lo); +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],
Signature · 1 line
1.7.4.1
PATCH 3/3 smsc95xx: remove an unecessary debug messages
Hi Wolfgang,
Quoted 14 lines · Wolfgang Grandegger
Signed-off-by Wolfgang Grandegger <[email protected]>Cc Simon Glass <[email protected]>---
?drivers/usb/eth/smsc95xx.c | ? ?7 +++----
?1 files changed, 3 insertions(+), 4 deletions(-)drivers/usb/eth/smsc95xx.c +0
-0@@ -380,15 +380,14 @@ static int smsc95xx_write_hwaddr(struct eth_device *eth)? ? ? ?/* set hardware address */
? ? ? ?debug("** %s()\n",__func__);
Quoted 4 lines
- ? ? ? ret =
smsc95xx_write_reg(dev, ADDRL, addr_lo);
- ? ? ? if (ret < 0) {
- ? ? ? ? ? ? ?debug("Failed to write ADDRL: %d\n", ret);
+ ? ? ? ret =smsc95xx_write_reg(dev, ADDRL, adddr_lo);
addr_lo?
Quoted 8 lines
+ ? ? ? if (ret < 0)
? ? ? ? ? ? ? ?return ret;
- ? ? ? }? ? ? ?ret =
smsc95xx_write_reg(dev, ADDRH, addr_hi); ? ? ? ?if (ret < 0)
? ? ? ? ? ? ? ?return ret;
+
Since you are adding a blank line here, you need to fix the line below :-) See Mike's email...
Quoted 7 lines
? ? ? ?debug("MAC %02x:%02x:%02x:%02x:%02x:%02x\n", ? ? ? ? ? ? ? ?eth->enetaddr[0], eth->enetaddr[1], ? ? ? ? ? ? ? ?eth->enetaddr[2], eth->enetaddr[3], --
1.7.4.1
Regards,
Simon
PATCH 3/3 smsc95xx: remove an unecessary debug messages
Quoted 17 lines · Simon Glass
Hi Wolfgang,
Quoted 14 lines · Wolfgang Grandegger
Signed-off-by Wolfgang Grandegger <[email protected]>Cc Simon Glass <[email protected]>--- drivers/usb/eth/smsc95xx.c | 7 +++---- 1 files changed, 3 insertions(+), 4 deletions(-)drivers/usb/eth/smsc95xx.c +0
-0@@ -380,15 +380,14 @@ static int smsc95xx_write_hwaddr(struct eth_device *eth)/* set hardware address */ debug ("** %s()\n" , __func__);
Quoted 6 lines
drivers/usb/eth/smsc95xx.c static int smsc95xx_write_hwaddr(struct eth_device *eth) · line 383
Quoted 4 lines
drivers/usb/eth/smsc95xx.c +1
-3- ret =smsc95xx_write_reg (dev,ADDRL , addr_lo); -if (ret <0 ) { -debug ("Failed to write ADDRL: %d\n" , ret); + ret =smsc95xx_write_reg (dev,ADDRL , adddr_lo);
addr_lo?
Oh yeah, sneaked in somehow, sorry ... I'm now focusing on Mike's patch fixing the same issue. Hope to have some feedback later today.
Wolfgang.