All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tom Rini <trini@konsulko.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [u-boot PATCH v3 7/8] ARM: k2g: setup PRU ethernet MAC addresses
Date: Wed, 8 Feb 2017 07:18:59 -0500	[thread overview]
Message-ID: <20170208121859.GM26129@bill-the-cat> (raw)
In-Reply-To: <5e9dda65-b1f0-bb0c-e785-0c2388979c48@ti.com>

On Wed, Feb 08, 2017 at 02:04:15PM +0200, Roger Quadros wrote:
> Hi,
> 
> On 08/02/17 13:51, Igor Grinberg wrote:
> > Hi Roger,
> > 
> > On 02/08/17 10:51, Roger Quadros wrote:
> >> Hi Igor,
> >>
> >> On 07/02/17 09:52, Igor Grinberg wrote:
> >>> Hi Roger,
> >>>
> >>> On 02/06/17 11:36, Roger Quadros wrote:
> >>>> PRU ethernet MAC address range is present in the
> >>>> board EEPROM. Parse it and setup eth?addr
> >>>> environment variables.
> >>>>
> >>>> Signed-off-by: Roger Quadros <rogerq@ti.com>
> >>>> Reviewed-by: Lokesh Vutla <lokeshvutla@ti.com>
> >>>> ---
> >>>>  board/ti/ks2_evm/board_k2g.c | 19 +++++++++++++++++++
> >>>>  1 file changed, 19 insertions(+)
> >>>>
> >>>> diff --git a/board/ti/ks2_evm/board_k2g.c b/board/ti/ks2_evm/board_k2g.c
> >>>> index 40edbaa..a738dd2 100644
> >>>> --- a/board/ti/ks2_evm/board_k2g.c
> >>>> +++ b/board/ti/ks2_evm/board_k2g.c
> >>>> @@ -12,6 +12,7 @@
> >>>>  #include <asm/arch/psc_defs.h>
> >>>>  #include <asm/arch/mmc_host_def.h>
> >>>>  #include "mux-k2g.h"
> >>>> +#include "../common/board_detect.h"
> >>>>  
> >>>>  #define SYS_CLK		24000000
> >>>>  
> >>>> @@ -149,6 +150,24 @@ int board_early_init_f(void)
> >>>>  }
> >>>>  #endif
> >>>>  
> >>>> +#ifdef CONFIG_BOARD_LATE_INIT
> >>>> +int board_late_init(void)
> >>>> +{
> >>>> +#if !defined(CONFIG_SPL_BUILD) && defined(CONFIG_TI_I2C_BOARD_DETECT)
> >>>> +	int rc;
> >>>> +
> >>>> +	rc = ti_i2c_eeprom_am_get(CONFIG_EEPROM_BUS_ADDRESS,
> >>>> +			CONFIG_EEPROM_CHIP_ADDRESS);
> >>>> +	if (rc)
> >>>> +		printf("ti_i2c_eeprom_init failed %d\n", rc);
> >>>> +
> >>>> +	board_ti_set_ethaddr(1);
> >>>
> >>> What if the MAC address has already been set in the environment?
> >>
> >> by whom?
> >> At least as of now nobody is setting ethadddr1 on the k2g-ice board.
> > 
> > Well, for example by user... and it is eth1addr.
> 
> OK, I understand now.
> > 
> >>
> >>> AFAIR, the MAC address in the environment has a higher precedence
> >>> than others.
> >>> May be I missed this, but I don't remember any discussion about changing
> >>> this assumption.
> >>> So, if the assumption is still correct, you shouldn't change the MAC in the env.
> >>
> >> I agree with you. I saw Olliver's "Retrieve MAC address from EEPROM" series.
> >> However, that may not apply to TI boards yet because:
> >> -the SoC's ethernet devices MAC addresses are stored in the SoC registers.
> >> -the PRU ethernet MAC addresses which this patch is setting are stored in
> >> EEPROM but they are not used at u-boot at all.
> >>
> >> I'm open to ideas if we can do what we're doing in a better way.
> > 
> > I think Tom's idea of a common function or may be a change to
> > eth_setenv_enetaddr_*() functions that will handle the precedence
> > is very sensible for such cases. 
> 
> Yes, this looks fine to me. Maybe there should be 2 functions? One which overrides
> and one which doesn't?

What's the usecase for the overrides one?  If the user wants to go back
to the stored ones, env default -f -a ; saveenv ; reset will do it.

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20170208/7b355e8d/attachment.sig>

  reply	other threads:[~2017-02-08 12:18 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-06  9:36 [U-Boot] [u-boot PATCH v3 0/8] am57xx-idk LCD and am571x-idk 6 port ethernet pinmux Roger Quadros
2017-02-06  9:36 ` [U-Boot] [u-boot PATCH v3 1/8] ARM: OMAP5+: GPIO: Add GPIO_TO_PIN() macro Roger Quadros
2017-02-06  9:36 ` [U-Boot] [u-boot PATCH v3 2/8] ti: common: board_detect: commodify ethaddr environment setting code Roger Quadros
2017-02-06  9:36 ` [U-Boot] [u-boot PATCH v3 3/8] board: ti: am571x-idk: Support 6 port Ethernet or 4 port Ethernet with LCD Roger Quadros
2017-02-06  9:36 ` [U-Boot] [u-boot PATCH v3 4/8] board: ti: am571x-idk: Update pinmux for ICSS2 Ethernet Roger Quadros
2017-02-06  9:36 ` [U-Boot] [u-boot PATCH v3 5/8] board: ti: am57xx-idk: Auto detect LCD Panel Roger Quadros
2017-02-06  9:36 ` [U-Boot] [u-boot PATCH v3 6/8] ARM: Use Kconfig for board EEPROM's I2C bus and chip address Roger Quadros
2017-02-07  0:45   ` Tom Rini
2017-02-07  3:13   ` Lokesh Vutla
2017-02-08  8:34     ` Roger Quadros
2017-02-06  9:36 ` [U-Boot] [u-boot PATCH v3 7/8] ARM: k2g: setup PRU ethernet MAC addresses Roger Quadros
2017-02-07  0:45   ` Tom Rini
2017-02-07  3:22   ` Lokesh Vutla
2017-02-08  8:35     ` Roger Quadros
2017-02-07  7:52   ` Igor Grinberg
2017-02-07 18:28     ` Tom Rini
2017-02-08 11:52       ` Igor Grinberg
2017-02-08  8:51     ` Roger Quadros
2017-02-08 11:51       ` Igor Grinberg
2017-02-08 12:04         ` Roger Quadros
2017-02-08 12:18           ` Tom Rini [this message]
2017-02-08 12:46             ` Roger Quadros
2017-02-08 12:50               ` Tom Rini
2017-02-06  9:36 ` [U-Boot] [u-boot PATCH v3 8/8] ti: common: board_detect: Rename EEPROM scratch start macro Roger Quadros

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=20170208121859.GM26129@bill-the-cat \
    --to=trini@konsulko.com \
    --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 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.