[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200309131010.GM3335@pengutronix.de>
Date: Mon, 9 Mar 2020 14:10:10 +0100
From: Sascha Hauer <s.hauer@...gutronix.de>
To: "Madalin Bucur (OSS)" <madalin.bucur@....nxp.com>
Cc: "davem@...emloft.net" <davem@...emloft.net>,
"netdev@...r.kernel.org" <netdev@...r.kernel.org>
Subject: Re: [PATCH net-next v3 2/3] fsl/fman: tolerate missing MAC address
in device tree
On Mon, Mar 09, 2020 at 10:17:36AM +0000, Madalin Bucur (OSS) wrote:
> > -----Original Message-----
> > From: Sascha Hauer <s.hauer@...gutronix.de>
> > Sent: Monday, March 9, 2020 8:47 AM
> > To: Madalin Bucur (OSS) <madalin.bucur@....nxp.com>
> > Cc: davem@...emloft.net; netdev@...r.kernel.org
> > Subject: Re: [PATCH net-next v3 2/3] fsl/fman: tolerate missing MAC
> > address in device tree
> >
> > On Thu, Mar 05, 2020 at 07:08:57PM +0200, Madalin Bucur wrote:
> > > Allow the initialization of the MAC to be performed even if the
> > > device tree does not provide a valid MAC address. Later a random
> > > MAC address should be assigned by the Ethernet driver.
> > >
> > > Signed-off-by: Sascha Hauer <s.hauer@...gutronix.de>
> > > Signed-off-by: Madalin Bucur <madalin.bucur@....nxp.com>
> > > ---
> > > drivers/net/ethernet/freescale/fman/fman_dtsec.c | 10 ++++------
> > > drivers/net/ethernet/freescale/fman/fman_memac.c | 10 ++++------
> > > drivers/net/ethernet/freescale/fman/fman_tgec.c | 10 ++++------
> > > drivers/net/ethernet/freescale/fman/mac.c | 13 ++++++-------
> > > 4 files changed, 18 insertions(+), 25 deletions(-)
> > >
> <snip>
> > > /* Get the MAC address */
> > > mac_addr = of_get_mac_address(mac_node);
> > > - if (IS_ERR(mac_addr)) {
> > > - dev_err(dev, "of_get_mac_address(%pOF) failed\n", mac_node);
> > > - err = -EINVAL;
> > > - goto _return_of_get_parent;
> > > - }
> > > - ether_addr_copy(mac_dev->addr, mac_addr);
> > > + if (IS_ERR(mac_addr))
> > > + dev_warn(dev, "of_get_mac_address(%pOF) failed\n", mac_node);
> >
> > Why this warning? There's nothing wrong with not providing the MAC in
> > the device tree.
> >
> > Sascha
>
> Actually, there is, most likely it's the result of misconfiguration so one
> must be made aware of it.
In my case it's not, that's why I wanted to allow random MACs in the
first place ;)
On our hardware the MAC addresses are stored in some flash in a special
format. There's no need to port parsing of that format into the
bootloader, the existing userspace code does that well and sets the
desired MAC addresses, but only if the devices do not fail during probe
due to the lack of valid MAC addresses.
Sascha
--
Pengutronix e.K. | |
Steuerwalder Str. 21 | http://www.pengutronix.de/ |
31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
Powered by blists - more mailing lists