All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH] net: smsc95xx: fix DM MAC address reading
@ 2016-09-15 18:53 Stephen Warren
  2016-09-15 19:20 ` Joe Hershberger
  2016-10-13 17:39 ` [U-Boot] " Joe Hershberger
  0 siblings, 2 replies; 7+ messages in thread
From: Stephen Warren @ 2016-09-15 18:53 UTC (permalink / raw)
  To: u-boot

From: Stephen Warren <swarren@nvidia.com>

eth-uclass.c expects DM-capable Ethernet adapters to implement ops->
read_rom_hwaddr(), or for some other mechanism to set pdata->enetaddr, or
for the user to set environment variable $usbethaddr. Without any of
these, it will refuse to initialize the device since no valid MAC address
is known. Implement this function for the smsc95xx driver.

With this feature implemented, there is no point smsc95xx_init_common()
re-reading the MAC address from ROM, so ifdef out this code when DM_ETH
is enabled.

This allows (at least) the built-in Ethernet on the NVIDIA Harmony board
to operate again.

Fixes: 0990fcb77219 ("net: smsc95xx: Add driver-model support")
Signed-off-by: Stephen Warren <swarren@nvidia.com>
---
 drivers/usb/eth/smsc95xx.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/drivers/usb/eth/smsc95xx.c b/drivers/usb/eth/smsc95xx.c
index 7d9abfda3be1..d4c8ea4a98aa 100644
--- a/drivers/usb/eth/smsc95xx.c
+++ b/drivers/usb/eth/smsc95xx.c
@@ -519,9 +519,11 @@ static int smsc95xx_init_common(struct usb_device *udev, struct ueth_data *dev,
 		debug("timeout waiting for PHY Reset\n");
 		return -ETIMEDOUT;
 	}
+#ifndef CONFIG_DM_ETH
 	if (!priv->have_hwaddr && smsc95xx_init_mac_address(enetaddr, udev) ==
 			0)
 		priv->have_hwaddr = 1;
+#endif
 	if (!priv->have_hwaddr) {
 		puts("Error: SMSC95xx: No MAC address set - set usbethaddr\n");
 		return -EADDRNOTAVAIL;
@@ -1022,6 +1024,19 @@ int smsc95xx_write_hwaddr(struct udevice *dev)
 	return smsc95xx_write_hwaddr_common(udev, priv, pdata->enetaddr);
 }
 
+int smsc95xx_read_rom_hwaddr(struct udevice *dev)
+{
+	struct usb_device *udev = dev_get_parent_priv(dev);
+	struct eth_pdata *pdata = dev_get_platdata(dev);
+	int ret;
+
+	ret = smsc95xx_init_mac_address(pdata->enetaddr, udev);
+	if (ret)
+		memset(pdata->enetaddr, 0, 6);
+
+	return 0;
+}
+
 static int smsc95xx_eth_probe(struct udevice *dev)
 {
 	struct smsc95xx_private *priv = dev_get_priv(dev);
@@ -1037,6 +1052,7 @@ static const struct eth_ops smsc95xx_eth_ops = {
 	.free_pkt = smsc95xx_free_pkt,
 	.stop	= smsc95xx_eth_stop,
 	.write_hwaddr = smsc95xx_write_hwaddr,
+	.read_rom_hwaddr = smsc95xx_read_rom_hwaddr,
 };
 
 U_BOOT_DRIVER(smsc95xx_eth) = {
-- 
2.9.3

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [U-Boot] [PATCH] net: smsc95xx: fix DM MAC address reading
  2016-09-15 18:53 [U-Boot] [PATCH] net: smsc95xx: fix DM MAC address reading Stephen Warren
@ 2016-09-15 19:20 ` Joe Hershberger
  2016-09-23 16:31   ` Stephen Warren
  2016-10-13 17:39 ` [U-Boot] " Joe Hershberger
  1 sibling, 1 reply; 7+ messages in thread
From: Joe Hershberger @ 2016-09-15 19:20 UTC (permalink / raw)
  To: u-boot

On Thu, Sep 15, 2016 at 1:53 PM, Stephen Warren <swarren@wwwdotorg.org> wrote:
> From: Stephen Warren <swarren@nvidia.com>
>
> eth-uclass.c expects DM-capable Ethernet adapters to implement ops->
> read_rom_hwaddr(), or for some other mechanism to set pdata->enetaddr, or
> for the user to set environment variable $usbethaddr. Without any of
> these, it will refuse to initialize the device since no valid MAC address
> is known. Implement this function for the smsc95xx driver.
>
> With this feature implemented, there is no point smsc95xx_init_common()
> re-reading the MAC address from ROM, so ifdef out this code when DM_ETH
> is enabled.
>
> This allows (at least) the built-in Ethernet on the NVIDIA Harmony board
> to operate again.
>
> Fixes: 0990fcb77219 ("net: smsc95xx: Add driver-model support")
> Signed-off-by: Stephen Warren <swarren@nvidia.com>

Acked-by: Joe Hershberger <joe.hershberger@ni.com>

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [U-Boot] [PATCH] net: smsc95xx: fix DM MAC address reading
  2016-09-15 19:20 ` Joe Hershberger
@ 2016-09-23 16:31   ` Stephen Warren
  2016-09-23 17:43     ` Joe Hershberger
  0 siblings, 1 reply; 7+ messages in thread
From: Stephen Warren @ 2016-09-23 16:31 UTC (permalink / raw)
  To: u-boot

On 09/15/2016 01:20 PM, Joe Hershberger wrote:
> On Thu, Sep 15, 2016 at 1:53 PM, Stephen Warren <swarren@wwwdotorg.org> wrote:
>> From: Stephen Warren <swarren@nvidia.com>
>>
>> eth-uclass.c expects DM-capable Ethernet adapters to implement ops->
>> read_rom_hwaddr(), or for some other mechanism to set pdata->enetaddr, or
>> for the user to set environment variable $usbethaddr. Without any of
>> these, it will refuse to initialize the device since no valid MAC address
>> is known. Implement this function for the smsc95xx driver.
>>
>> With this feature implemented, there is no point smsc95xx_init_common()
>> re-reading the MAC address from ROM, so ifdef out this code when DM_ETH
>> is enabled.
>>
>> This allows (at least) the built-in Ethernet on the NVIDIA Harmony board
>> to operate again.
>>
>> Fixes: 0990fcb77219 ("net: smsc95xx: Add driver-model support")
>> Signed-off-by: Stephen Warren <swarren@nvidia.com>
>
> Acked-by: Joe Hershberger <joe.hershberger@ni.com>

Joe, was that ack just so you remember you've reviewed this when you 
come to applying patches later, or was it a signal to someone else that 
they should apply it?

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [U-Boot] [PATCH] net: smsc95xx: fix DM MAC address reading
  2016-09-23 16:31   ` Stephen Warren
@ 2016-09-23 17:43     ` Joe Hershberger
  2016-10-10 16:07       ` Stephen Warren
  0 siblings, 1 reply; 7+ messages in thread
From: Joe Hershberger @ 2016-09-23 17:43 UTC (permalink / raw)
  To: u-boot

On Fri, Sep 23, 2016 at 11:31 AM, Stephen Warren <swarren@wwwdotorg.org> wrote:
> On 09/15/2016 01:20 PM, Joe Hershberger wrote:
>>
>> On Thu, Sep 15, 2016 at 1:53 PM, Stephen Warren <swarren@wwwdotorg.org>
>> wrote:
>>>
>>> From: Stephen Warren <swarren@nvidia.com>
>>>
>>> eth-uclass.c expects DM-capable Ethernet adapters to implement ops->
>>> read_rom_hwaddr(), or for some other mechanism to set pdata->enetaddr, or
>>> for the user to set environment variable $usbethaddr. Without any of
>>> these, it will refuse to initialize the device since no valid MAC address
>>> is known. Implement this function for the smsc95xx driver.
>>>
>>> With this feature implemented, there is no point smsc95xx_init_common()
>>> re-reading the MAC address from ROM, so ifdef out this code when DM_ETH
>>> is enabled.
>>>
>>> This allows (at least) the built-in Ethernet on the NVIDIA Harmony board
>>> to operate again.
>>>
>>> Fixes: 0990fcb77219 ("net: smsc95xx: Add driver-model support")
>>> Signed-off-by: Stephen Warren <swarren@nvidia.com>
>>
>>
>> Acked-by: Joe Hershberger <joe.hershberger@ni.com>
>
>
> Joe, was that ack just so you remember you've reviewed this when you come to
> applying patches later, or was it a signal to someone else that they should
> apply it?

No, I'll pull it in.

Cheers,
-Joe

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [U-Boot] [PATCH] net: smsc95xx: fix DM MAC address reading
  2016-09-23 17:43     ` Joe Hershberger
@ 2016-10-10 16:07       ` Stephen Warren
  2016-10-12  0:07         ` Joe Hershberger
  0 siblings, 1 reply; 7+ messages in thread
From: Stephen Warren @ 2016-10-10 16:07 UTC (permalink / raw)
  To: u-boot

On 09/23/2016 11:43 AM, Joe Hershberger wrote:
> On Fri, Sep 23, 2016 at 11:31 AM, Stephen Warren <swarren@wwwdotorg.org> wrote:
>> On 09/15/2016 01:20 PM, Joe Hershberger wrote:
>>>
>>> On Thu, Sep 15, 2016 at 1:53 PM, Stephen Warren <swarren@wwwdotorg.org>
>>> wrote:
>>>>
>>>> From: Stephen Warren <swarren@nvidia.com>
>>>>
>>>> eth-uclass.c expects DM-capable Ethernet adapters to implement ops->
>>>> read_rom_hwaddr(), or for some other mechanism to set pdata->enetaddr, or
>>>> for the user to set environment variable $usbethaddr. Without any of
>>>> these, it will refuse to initialize the device since no valid MAC address
>>>> is known. Implement this function for the smsc95xx driver.
>>>>
>>>> With this feature implemented, there is no point smsc95xx_init_common()
>>>> re-reading the MAC address from ROM, so ifdef out this code when DM_ETH
>>>> is enabled.
>>>>
>>>> This allows (at least) the built-in Ethernet on the NVIDIA Harmony board
>>>> to operate again.
>>>>
>>>> Fixes: 0990fcb77219 ("net: smsc95xx: Add driver-model support")
>>>> Signed-off-by: Stephen Warren <swarren@nvidia.com>
>>>
>>>
>>> Acked-by: Joe Hershberger <joe.hershberger@ni.com>
>>
>>
>> Joe, was that ack just so you remember you've reviewed this when you come to
>> applying patches later, or was it a signal to someone else that they should
>> apply it?
>
> No, I'll pull it in.

Joe, I can't find this applied anywhere yet.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [U-Boot] [PATCH] net: smsc95xx: fix DM MAC address reading
  2016-10-10 16:07       ` Stephen Warren
@ 2016-10-12  0:07         ` Joe Hershberger
  0 siblings, 0 replies; 7+ messages in thread
From: Joe Hershberger @ 2016-10-12  0:07 UTC (permalink / raw)
  To: u-boot

Hi Stephen,

On Mon, Oct 10, 2016 at 6:07 PM, Stephen Warren <swarren@wwwdotorg.org> wrote:
> On 09/23/2016 11:43 AM, Joe Hershberger wrote:
>>
>> On Fri, Sep 23, 2016 at 11:31 AM, Stephen Warren <swarren@wwwdotorg.org>
>> wrote:
>>>
>>> On 09/15/2016 01:20 PM, Joe Hershberger wrote:
>>>>
>>>>
>>>> On Thu, Sep 15, 2016 at 1:53 PM, Stephen Warren <swarren@wwwdotorg.org>
>>>> wrote:
>>>>>
>>>>>
>>>>> From: Stephen Warren <swarren@nvidia.com>
>>>>>
>>>>> eth-uclass.c expects DM-capable Ethernet adapters to implement ops->
>>>>> read_rom_hwaddr(), or for some other mechanism to set pdata->enetaddr,
>>>>> or
>>>>> for the user to set environment variable $usbethaddr. Without any of
>>>>> these, it will refuse to initialize the device since no valid MAC
>>>>> address
>>>>> is known. Implement this function for the smsc95xx driver.
>>>>>
>>>>> With this feature implemented, there is no point smsc95xx_init_common()
>>>>> re-reading the MAC address from ROM, so ifdef out this code when DM_ETH
>>>>> is enabled.
>>>>>
>>>>> This allows (at least) the built-in Ethernet on the NVIDIA Harmony
>>>>> board
>>>>> to operate again.
>>>>>
>>>>> Fixes: 0990fcb77219 ("net: smsc95xx: Add driver-model support")
>>>>> Signed-off-by: Stephen Warren <swarren@nvidia.com>
>>>>
>>>>
>>>>
>>>> Acked-by: Joe Hershberger <joe.hershberger@ni.com>
>>>
>>>
>>>
>>> Joe, was that ack just so you remember you've reviewed this when you come
>>> to
>>> applying patches later, or was it a signal to someone else that they
>>> should
>>> apply it?
>>
>>
>> No, I'll pull it in.
>
>
> Joe, I can't find this applied anywhere yet.

Sorry about that. I've got it and all other acked patches assigned to
me in a build test. Hopefully tomorrow I'll be able to send a pull
request, but it's a bit up in the since I've already seen some
warnings added by at least one of the patches. :/

-Joe

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [U-Boot] net: smsc95xx: fix DM MAC address reading
  2016-09-15 18:53 [U-Boot] [PATCH] net: smsc95xx: fix DM MAC address reading Stephen Warren
  2016-09-15 19:20 ` Joe Hershberger
@ 2016-10-13 17:39 ` Joe Hershberger
  1 sibling, 0 replies; 7+ messages in thread
From: Joe Hershberger @ 2016-10-13 17:39 UTC (permalink / raw)
  To: u-boot

Hi Stephen,

https://patchwork.ozlabs.org/patch/670537/ was applied to u-boot-net.git.

Thanks!
-Joe

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2016-10-13 17:39 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-09-15 18:53 [U-Boot] [PATCH] net: smsc95xx: fix DM MAC address reading Stephen Warren
2016-09-15 19:20 ` Joe Hershberger
2016-09-23 16:31   ` Stephen Warren
2016-09-23 17:43     ` Joe Hershberger
2016-10-10 16:07       ` Stephen Warren
2016-10-12  0:07         ` Joe Hershberger
2016-10-13 17:39 ` [U-Boot] " Joe Hershberger

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.