From: Michael Walle Date: Wed, 11 Dec 2019 14:20:44 +0100 Subject: [PATCH v2] drivers: net: fsl_enetc: Pass on primary MAC address to Linux In-Reply-To: <3ffe8d32-658b-f624-eba7-deecf7c1b6cc@gmail.com> References: <20191210145539.28644-1-alexandru.marginean@nxp.com> <3ffe8d32-658b-f624-eba7-deecf7c1b6cc@gmail.com> Message-ID: List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit To: u-boot@lists.denx.de Am 2019-12-11 14:04, schrieb Alexandru Marginean: > On 12/10/2019 11:47 PM, Michael Walle wrote: >> Am 2019-12-10 15:55, schrieb Alex Marginean: >>> Passes on the primary address used by u-boot to Linux.  The code does >>> a DT >>> fix-up for ENETC PFs and sets the primary MAC address in IERB.  The >>> address >>> in IERB is restored on ENETC PCI functions at FLR. >> >> >> I don't get the reason why this is done in a proprietary way. What is >> the >> difference between any other network interface whose hardware address >> is >> set up in the generic u-boot code. > > By proprietary do you mean IERB? I meant the fdt fixups for mac-address/local-mac-address which is not handled in the generic u-boot code, see my previous mail. Because if it would, then there would be no need for the board specific code below (just the one function call actually). > Network cards normally have a ROM which comes preset from the factory > with default MAC addresses. At run-time drivers can use the default > address or replace it. The MAC address in IERB is the default MAC > address for ENETC interfaces at run-time, this address is available to > the driver/stack after issuing an FLR and in the absence of a DT node > for the PCI function. > We can pass MAC addresses to Linux through DT alone, but that's more > of a hassle if Linux decides to assign the PCI function to a guest or > user-space app. Using the IERB values doesn't require any fix-up for > guest DTs. Understood. > IERB is not actually a ROM though and we need U-Boot to set factory > MAC addresses into IERB some time before Linux boots. > >> Also, shouldn't write_hwaddr callback be implemented instead of the >> enetc_set_ierb_primary_mac()? > > OK, makes sense, I will move the code there. > -michael