* [PATCH 1/2] net: ethernet: davinci_emac: Use MAC Address from Device Tree
@ 2023-09-06 9:51 Adam Ford
2023-09-06 9:51 ` [PATCH 2/2] arm: dts: am3517: Configure ethernet alias Adam Ford
2023-09-06 12:39 ` [PATCH 1/2] net: ethernet: davinci_emac: Use MAC Address from Device Tree Andrew Lunn
0 siblings, 2 replies; 8+ messages in thread
From: Adam Ford @ 2023-09-06 9:51 UTC (permalink / raw)
To: linux-omap
Cc: aford, Adam Ford, Benoît Cousson, Tony Lindgren, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Grygorii Strashko,
David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
devicetree, linux-kernel, netdev
Currently there is a device tree entry called "local-mac-address"
which can be filled by the bootloader or manually set.This is
useful when the user does not want to use the MAC address
programmed into the SoC.
Currently, the davinci_emac reads the MAC from the DT, copies
it from pdata->mac_addr to priv->mac_addr, then blindly overwrites
it by reading from registers in the SoC, and falls back to a
random MAC if it's still not valid. This completely ignores any
MAC address in the device tree.
In order to use the local-mac-address, check to see if the contents
of priv->mac_addr are valid before falling back to reading from the
SoC when the MAC address is not valid.
Signed-off-by: Adam Ford <aford173@gmail.com>
diff --git a/drivers/net/ethernet/ti/davinci_emac.c b/drivers/net/ethernet/ti/davinci_emac.c
index 2eb9d5a32588..994ddd756782 100644
--- a/drivers/net/ethernet/ti/davinci_emac.c
+++ b/drivers/net/ethernet/ti/davinci_emac.c
@@ -1934,18 +1934,20 @@ static int davinci_emac_probe(struct platform_device *pdev)
goto err_free_rxchan;
ndev->irq = rc;
- rc = davinci_emac_try_get_mac(pdev, res_ctrl ? 0 : 1, priv->mac_addr);
- if (!rc)
- eth_hw_addr_set(ndev, priv->mac_addr);
-
+ /* If the MAC address is not present, read the registers from the SoC */
if (!is_valid_ether_addr(priv->mac_addr)) {
- /* Use random MAC if still none obtained. */
- eth_hw_addr_random(ndev);
- memcpy(priv->mac_addr, ndev->dev_addr, ndev->addr_len);
- dev_warn(&pdev->dev, "using random MAC addr: %pM\n",
- priv->mac_addr);
+ rc = davinci_emac_try_get_mac(pdev, res_ctrl ? 0 : 1, priv->mac_addr);
+ if (!rc)
+ eth_hw_addr_set(ndev, priv->mac_addr);
+
+ if (!is_valid_ether_addr(priv->mac_addr)) {
+ /* Use random MAC if still none obtained. */
+ eth_hw_addr_random(ndev);
+ memcpy(priv->mac_addr, ndev->dev_addr, ndev->addr_len);
+ dev_warn(&pdev->dev, "using random MAC addr: %pM\n",
+ priv->mac_addr);
+ }
}
-
ndev->netdev_ops = &emac_netdev_ops;
ndev->ethtool_ops = ðtool_ops;
netif_napi_add(ndev, &priv->napi, emac_poll);
--
2.39.2
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 2/2] arm: dts: am3517: Configure ethernet alias
2023-09-06 9:51 [PATCH 1/2] net: ethernet: davinci_emac: Use MAC Address from Device Tree Adam Ford
@ 2023-09-06 9:51 ` Adam Ford
2023-09-28 2:29 ` Adam Ford
2023-09-06 12:39 ` [PATCH 1/2] net: ethernet: davinci_emac: Use MAC Address from Device Tree Andrew Lunn
1 sibling, 1 reply; 8+ messages in thread
From: Adam Ford @ 2023-09-06 9:51 UTC (permalink / raw)
To: linux-omap
Cc: aford, Adam Ford, Benoît Cousson, Tony Lindgren, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Grygorii Strashko,
David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
devicetree, linux-kernel, netdev
The AM3517 has one ethernet controller called davinci_emac.
Configuring the alias allows the MAC address to be passed
from the bootloader to Linux.
Signed-off-by: Adam Ford <aford173@gmail.com>
diff --git a/arch/arm/boot/dts/ti/omap/am3517.dtsi b/arch/arm/boot/dts/ti/omap/am3517.dtsi
index fbfc956f4e4d..77e58e686fb1 100644
--- a/arch/arm/boot/dts/ti/omap/am3517.dtsi
+++ b/arch/arm/boot/dts/ti/omap/am3517.dtsi
@@ -15,6 +15,7 @@ / {
aliases {
serial3 = &uart4;
can = &hecc;
+ ethernet = &davinci_emac;
};
cpus {
--
2.39.2
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH 1/2] net: ethernet: davinci_emac: Use MAC Address from Device Tree
2023-09-06 9:51 [PATCH 1/2] net: ethernet: davinci_emac: Use MAC Address from Device Tree Adam Ford
2023-09-06 9:51 ` [PATCH 2/2] arm: dts: am3517: Configure ethernet alias Adam Ford
@ 2023-09-06 12:39 ` Andrew Lunn
2023-10-11 12:53 ` Adam Ford
1 sibling, 1 reply; 8+ messages in thread
From: Andrew Lunn @ 2023-09-06 12:39 UTC (permalink / raw)
To: Adam Ford
Cc: linux-omap, aford, Benoît Cousson, Tony Lindgren,
Rob Herring, Krzysztof Kozlowski, Conor Dooley, Grygorii Strashko,
David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
devicetree, linux-kernel, netdev
On Wed, Sep 06, 2023 at 04:51:42AM -0500, Adam Ford wrote:
> Currently there is a device tree entry called "local-mac-address"
> which can be filled by the bootloader or manually set.This is
> useful when the user does not want to use the MAC address
> programmed into the SoC.
>
> Currently, the davinci_emac reads the MAC from the DT, copies
> it from pdata->mac_addr to priv->mac_addr, then blindly overwrites
> it by reading from registers in the SoC, and falls back to a
> random MAC if it's still not valid. This completely ignores any
> MAC address in the device tree.
>
> In order to use the local-mac-address, check to see if the contents
> of priv->mac_addr are valid before falling back to reading from the
> SoC when the MAC address is not valid.
>
> Signed-off-by: Adam Ford <aford173@gmail.com>
There is the potential for regressions here, since behaviour is being
changed. But i do think what you are doing make sense.
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Andrew
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 2/2] arm: dts: am3517: Configure ethernet alias
2023-09-06 9:51 ` [PATCH 2/2] arm: dts: am3517: Configure ethernet alias Adam Ford
@ 2023-09-28 2:29 ` Adam Ford
2023-10-07 7:06 ` Tony Lindgren
0 siblings, 1 reply; 8+ messages in thread
From: Adam Ford @ 2023-09-28 2:29 UTC (permalink / raw)
To: linux-omap
Cc: aford, Benoît Cousson, Tony Lindgren, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, devicetree, linux-kernel, netdev
On Wed, Sep 6, 2023 at 4:52 AM Adam Ford <aford173@gmail.com> wrote:
>
> The AM3517 has one ethernet controller called davinci_emac.
> Configuring the alias allows the MAC address to be passed
> from the bootloader to Linux.
Gentle nudge on this series
adam
>
> Signed-off-by: Adam Ford <aford173@gmail.com>
>
> diff --git a/arch/arm/boot/dts/ti/omap/am3517.dtsi b/arch/arm/boot/dts/ti/omap/am3517.dtsi
> index fbfc956f4e4d..77e58e686fb1 100644
> --- a/arch/arm/boot/dts/ti/omap/am3517.dtsi
> +++ b/arch/arm/boot/dts/ti/omap/am3517.dtsi
> @@ -15,6 +15,7 @@ / {
> aliases {
> serial3 = &uart4;
> can = &hecc;
> + ethernet = &davinci_emac;
> };
>
> cpus {
> --
> 2.39.2
>
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 2/2] arm: dts: am3517: Configure ethernet alias
2023-09-28 2:29 ` Adam Ford
@ 2023-10-07 7:06 ` Tony Lindgren
0 siblings, 0 replies; 8+ messages in thread
From: Tony Lindgren @ 2023-10-07 7:06 UTC (permalink / raw)
To: Adam Ford
Cc: linux-omap, aford, Benoît Cousson, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, devicetree, linux-kernel, netdev
* Adam Ford <aford173@gmail.com> [230928 02:29]:
> On Wed, Sep 6, 2023 at 4:52 AM Adam Ford <aford173@gmail.com> wrote:
> >
> > The AM3517 has one ethernet controller called davinci_emac.
> > Configuring the alias allows the MAC address to be passed
> > from the bootloader to Linux.
>
> Gentle nudge on this series
Picking the dts change into omap-for-v6.7/dt thanks.
Regards,
Tony
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 1/2] net: ethernet: davinci_emac: Use MAC Address from Device Tree
2023-09-06 12:39 ` [PATCH 1/2] net: ethernet: davinci_emac: Use MAC Address from Device Tree Andrew Lunn
@ 2023-10-11 12:53 ` Adam Ford
2023-10-11 15:00 ` Andrew Lunn
0 siblings, 1 reply; 8+ messages in thread
From: Adam Ford @ 2023-10-11 12:53 UTC (permalink / raw)
To: Andrew Lunn
Cc: linux-omap, aford, Benoît Cousson, Tony Lindgren,
Rob Herring, Krzysztof Kozlowski, Conor Dooley, Grygorii Strashko,
David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
devicetree, linux-kernel, netdev
On Wed, Sep 6, 2023 at 7:39 AM Andrew Lunn <andrew@lunn.ch> wrote:
>
> On Wed, Sep 06, 2023 at 04:51:42AM -0500, Adam Ford wrote:
> > Currently there is a device tree entry called "local-mac-address"
> > which can be filled by the bootloader or manually set.This is
> > useful when the user does not want to use the MAC address
> > programmed into the SoC.
> >
> > Currently, the davinci_emac reads the MAC from the DT, copies
> > it from pdata->mac_addr to priv->mac_addr, then blindly overwrites
> > it by reading from registers in the SoC, and falls back to a
> > random MAC if it's still not valid. This completely ignores any
> > MAC address in the device tree.
> >
> > In order to use the local-mac-address, check to see if the contents
> > of priv->mac_addr are valid before falling back to reading from the
> > SoC when the MAC address is not valid.
> >
> > Signed-off-by: Adam Ford <aford173@gmail.com>
>
> There is the potential for regressions here, since behaviour is being
> changed. But i do think what you are doing make sense.
>
> Reviewed-by: Andrew Lunn <andrew@lunn.ch>
I don't know who the right person is to ask, but is there any chance
this can be accepted?
adam
>
> Andrew
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 1/2] net: ethernet: davinci_emac: Use MAC Address from Device Tree
2023-10-11 12:53 ` Adam Ford
@ 2023-10-11 15:00 ` Andrew Lunn
2023-10-11 15:10 ` Adam Ford
0 siblings, 1 reply; 8+ messages in thread
From: Andrew Lunn @ 2023-10-11 15:00 UTC (permalink / raw)
To: Adam Ford
Cc: linux-omap, aford, Benoît Cousson, Tony Lindgren,
Rob Herring, Krzysztof Kozlowski, Conor Dooley, Grygorii Strashko,
David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
devicetree, linux-kernel, netdev
> I don't know who the right person is to ask, but is there any chance
> this can be accepted?
It did not help you did not make it clear who you want to merge the
patches. It is a good idea to use To: with the Maintainer you would
like to do the merge and Cc: for the others.
What is the state of patches? Has the other patch been merged? If
just the driver change is left, please repost is on its own, and
follow:
https://www.kernel.org/doc/html/latest/process/maintainer-netdev.html#netdev-faq
Andrew
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 1/2] net: ethernet: davinci_emac: Use MAC Address from Device Tree
2023-10-11 15:00 ` Andrew Lunn
@ 2023-10-11 15:10 ` Adam Ford
0 siblings, 0 replies; 8+ messages in thread
From: Adam Ford @ 2023-10-11 15:10 UTC (permalink / raw)
To: Andrew Lunn
Cc: linux-omap, aford, Benoît Cousson, Tony Lindgren,
Rob Herring, Krzysztof Kozlowski, Conor Dooley, Grygorii Strashko,
David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
devicetree, linux-kernel, netdev
On Wed, Oct 11, 2023 at 10:00 AM Andrew Lunn <andrew@lunn.ch> wrote:
>
> > I don't know who the right person is to ask, but is there any chance
> > this can be accepted?
>
> It did not help you did not make it clear who you want to merge the
> patches. It is a good idea to use To: with the Maintainer you would
> like to do the merge and Cc: for the others.
I use ./scripts/get_maintainer to generate a list of maintainers for
the respective patches, and they should have all been CC'd.
>
> What is the state of patches? Has the other patch been merged? If
> just the driver change is left, please repost is on its own, and
> follow:
The device tree part has been accepted by Tony into the OMAP tree.
I'll split the driver off, do a V2, and just fetch the maintainer of
the driver itself and CC netdev.
>
> https://www.kernel.org/doc/html/latest/process/maintainer-netdev.html#netdev-faq
>
Thanks!
adam
> Andrew
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2023-10-11 15:10 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-09-06 9:51 [PATCH 1/2] net: ethernet: davinci_emac: Use MAC Address from Device Tree Adam Ford
2023-09-06 9:51 ` [PATCH 2/2] arm: dts: am3517: Configure ethernet alias Adam Ford
2023-09-28 2:29 ` Adam Ford
2023-10-07 7:06 ` Tony Lindgren
2023-09-06 12:39 ` [PATCH 1/2] net: ethernet: davinci_emac: Use MAC Address from Device Tree Andrew Lunn
2023-10-11 12:53 ` Adam Ford
2023-10-11 15:00 ` Andrew Lunn
2023-10-11 15:10 ` Adam Ford
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).