From: Lukasz Majewski <lukma@denx.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v1 16/21] display5: net: Add function to read ethaddr from iMX6 fuses
Date: Wed, 16 May 2018 16:46:13 +0200 [thread overview]
Message-ID: <20180516164613.6d577eec@jawa> (raw)
In-Reply-To: <CANr=Z=azOdZbQ1dL1Wwj6zQuMzf8wDP4_FXg86fNU40Kmh+isA@mail.gmail.com>
Hi Joe,
> Hi Lukasz,
>
> On Fri, May 11, 2018 at 9:51 AM, Lukasz Majewski <lukma@denx.de>
> wrote:
> > Signed-off-by: Lukasz Majewski <lukma@denx.de>
> > ---
> >
> > board/liebherr/display5/display5.c | 21 +++++++++++++++++++++
> > 1 file changed, 21 insertions(+)
> >
> > diff --git a/board/liebherr/display5/display5.c
> > b/board/liebherr/display5/display5.c index 4bade476a5..a3deba216c
> > 100644 --- a/board/liebherr/display5/display5.c
> > +++ b/board/liebherr/display5/display5.c
> > @@ -254,6 +254,25 @@ static void setup_iomux_enet(void)
> > gpio_direction_input(IMX_GPIO_NR(1, 28)); /*INT#_GBE*/
> > }
> >
> > +static int setup_mac_from_fuse(void)
> > +{
> > + unsigned char enetaddr[6];
> > + int ret;
> > +
> > + ret = eth_env_get_enetaddr("ethaddr", enetaddr);
> > + if (ret) /* ethaddr is already set */
> > + return 0;
> > +
> > + imx_get_mac_from_fuse(0, enetaddr);
>
> Generally this should be registered as a read_rom_hwaddr handler.
This function seems like a generic approach for IMX SoC:
arch/arm/mach-imx/mac.c
On the other hand the fec_mxc.c driver seems to have such function:
.read_rom_hwaddr = fecmxc_read_rom_hwaddr,
(which latter on calls the above function).
To use this function in the automatic way I would need to enable DM_ETH
for this board.
>
> Then you won't be recreating the logic around what to do with it.
>
> > +
> > + if (is_valid_ethaddr(enetaddr)) {
> > + eth_env_set_enetaddr("ethaddr", enetaddr);
> > + return 0;
> > + }
> > +
> > + return 0;
> > +}
> > +
> > int board_eth_init(bd_t *bd)
> > {
> > struct phy_device *phydev;
> > @@ -268,6 +287,8 @@ int board_eth_init(bd_t *bd)
> > if (ret)
> > return ret;
> >
> > + setup_mac_from_fuse();
> > +
> > bus = fec_get_miibus(IMX_FEC_BASE, -1);
> > if (!bus)
> > return -ENODEV;
> > --
> > 2.11.0
> >
> > _______________________________________________
> > U-Boot mailing list
> > U-Boot at lists.denx.de
> > https://lists.denx.de/listinfo/u-boot
Best regards,
Lukasz Majewski
--
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 488 bytes
Desc: OpenPGP digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20180516/77201a8d/attachment.sig>
next prev parent reply other threads:[~2018-05-16 14:46 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-05-11 14:50 [U-Boot] [PATCH v1 00/21] This patch series brings in sync DISPLAY5 internal Lukasz Majewski
2018-05-11 14:50 ` [U-Boot] [PATCH v1 01/21] display5: factory: Add support for BOOT_FROM = FACTORY switch Lukasz Majewski
2018-05-11 14:51 ` [U-Boot] [PATCH v1 02/21] display5: config: factory: Setup IP config data according to LEG production setup Lukasz Majewski
2018-05-11 14:51 ` [U-Boot] [PATCH v1 03/21] display5: config: Add "factory" (1MiB) SPI-NOR partition in u-boot Lukasz Majewski
2018-05-11 14:51 ` [U-Boot] [PATCH v1 04/21] display5: config: Provide command to flash the whole SPI-NOR memory Lukasz Majewski
2018-05-11 14:51 ` [U-Boot] [PATCH v1 05/21] display5: spl: Check return code of the env_* functions Lukasz Majewski
2018-05-11 14:51 ` [U-Boot] [PATCH v1 06/21] display5: config: Reset the board when bootm fails Lukasz Majewski
2018-05-11 14:51 ` [U-Boot] [PATCH v1 07/21] display5: config: Remove support for Linux initramfs recovery image boot Lukasz Majewski
2018-05-11 14:51 ` [U-Boot] [PATCH v1 08/21] display5: config: Update SPI-NOR partition for larger swupdate-initramfs Lukasz Majewski
2018-05-11 14:51 ` [U-Boot] [PATCH v1 09/21] display5: config: factory: Extend mtdparts to support LEG factory partition Lukasz Majewski
2018-05-11 14:51 ` [U-Boot] [PATCH v1 10/21] display5: Support for the emergency PAD pressing Lukasz Majewski
2018-05-11 14:51 ` [U-Boot] [PATCH v1 11/21] display5: wdt: Enable WDT support (both SPL and u-boot) Lukasz Majewski
2018-05-11 14:51 ` [U-Boot] [PATCH v1 12/21] display5: config: Provide 'tftp_mmc_rootfs_bkp' command to write BACKUP rootfs Lukasz Majewski
2018-05-11 14:51 ` [U-Boot] [PATCH v1 13/21] display5: config: factory: Update BACKUP rootfs in factory mode Lukasz Majewski
2018-05-11 14:51 ` [U-Boot] [PATCH v1 14/21] display5: config: Update swupdate initramfs file name (now supporting ext4) Lukasz Majewski
2018-05-11 14:51 ` [U-Boot] [PATCH v1 15/21] display5: ddr: Enable support for DDR3 auto calibration Lukasz Majewski
2018-05-11 14:51 ` [U-Boot] [PATCH v1 16/21] display5: net: Add function to read ethaddr from iMX6 fuses Lukasz Majewski
2018-05-15 21:16 ` Joe Hershberger
2018-05-16 14:46 ` Lukasz Majewski [this message]
2018-05-16 16:14 ` Joe Hershberger
2018-05-11 14:51 ` [U-Boot] [PATCH v1 17/21] display5: config: Add cma=256M to command line arguments Lukasz Majewski
2018-05-11 14:51 ` [U-Boot] [PATCH v1 18/21] display5: config: Reduce rootfs2 (BACKUP) size from 1528M to 512M Lukasz Majewski
2018-05-11 14:51 ` [U-Boot] [PATCH v1 19/21] display5: display5_defconfig: Enable support for gpt command (CMD_GPT) in production u-boot Lukasz Majewski
2018-05-11 14:51 ` [U-Boot] [PATCH v1 20/21] display5: config: Add GPT verification and restoration code on SWUpdate entry Lukasz Majewski
2018-05-11 14:51 ` [U-Boot] [PATCH v1 21/21] display5: Add missing environment.h include to avoid warning Lukasz Majewski
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180516164613.6d577eec@jawa \
--to=lukma@denx.de \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox