public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Stefan Agner <stefan@agner.ch>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v2 5/9] mx7: set soc environment according to exact SoC type
Date: Mon, 18 Jul 2016 19:19:05 -0700	[thread overview]
Message-ID: <97d789604cebb83ce1110e111d0cde08@agner.ch> (raw)
In-Reply-To: <20160719003625.GG7260@bill-the-cat>

On 2016-07-18 17:36, Tom Rini wrote:
> On Mon, Jul 18, 2016 at 03:21:39PM -0700, Stefan Agner wrote:
>> On 2016-07-18 15:19, Fabio Estevam wrote:
>> > On Wed, Jul 13, 2016 at 4:25 AM, Stefan Agner <stefan@agner.ch> wrote:
>> >> From: Stefan Agner <stefan.agner@toradex.com>
>> >>
>> >> This can be useful if the same U-Boot binary is used for boards
>> >> available with a i.MX 7Solo and i.MX 7Dual.
>> >>
>> >> Signed-off-by: Stefan Agner <stefan.agner@toradex.com>
>> >> Reviewed-by: Simon Glass <sjg@chromium.org>
>> >> ---
>> >>
>> >>  arch/arm/cpu/armv7/mx7/soc.c | 14 ++++++++++++++
>> >>  include/configs/mx7_common.h |  2 ++
>> >>  2 files changed, 16 insertions(+)
>> >>
>> >> diff --git a/arch/arm/cpu/armv7/mx7/soc.c b/arch/arm/cpu/armv7/mx7/soc.c
>> >> index ef46c92..dead1d3 100644
>> >> --- a/arch/arm/cpu/armv7/mx7/soc.c
>> >> +++ b/arch/arm/cpu/armv7/mx7/soc.c
>> >> @@ -248,6 +248,20 @@ int arch_cpu_init(void)
>> >>         return 0;
>> >>  }
>> >>
>> >> +#ifdef CONFIG_ARCH_MISC_INIT
>> >> +int arch_misc_init(void)
>> >> +{
>> >> +#ifdef CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG
>> >> +       if (is_mx7d())
>> >> +               setenv("soc", "imx7d");
>> >> +       else
>> >> +               setenv("soc", "imx7s");
>> >> +#endif
>> >> +
>> >> +       return 0;
>> >> +}
>> >> +#endif
>> >
>> > What about adding the following code in your board file?
>> >
>> > int board_late_init(void)
>> > {
>> > #ifdef CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG
>> >     if (is_mx7d())
>> >         setenv("board_rev", "MX7D");
>> >     else
>> >         setenv("board_rev", "MX7S");
>> > #endif
>> >
>> >     return 0;
>> > }
>> >
>> > This was the suggestion I got from Tom when I was doing runtime SoC
>> > detection for mx6cubox.
>>
>> I followed the runtime detection for Vybrid in:
>> arch/arm/cpu/armv7/vf610/generic.c
>>
>> But sure, doing it at board level would be possible too.
>>
>> Due to the similarity of i.MX 7Solo and 7Dual there will probably be
>> many board designs available in this two variants, hence I feel it would
>> be worthwhile to have it on arch level...
> 
> So, yeah, I may have said the wrong thing for cubox, maybe not.  I think
> that for the actual SoC (and 'soc') we should set that as high as we
> easily and _correctly_ can.  We set 'board_rev' today in the board

Can I take this as an Ack from your side Tom?

Also note that the current default for i.MX 7 is "mx7" which is not
useful to build the typically used (Linux) device tree file name. It
also seems that no i.MX 6/7 board uses ${soc} in its default
environment...

IMHO ${soc} should be the first part of the device tree file, which is
in this case imx7d- (and imx7s-...)

> files, and this makes sense to me, especially when used as the "board"
> part, eg:
> board/freescale/mx6ul_14x14_evk/mx6ul_14x14_evk.c: setenv("board_rev", "9X9");
> board/freescale/mx6ul_14x14_evk/mx6ul_14x14_evk.c: setenv("board_rev", "14X14")
> 
> We set 'board_rev' today in a number of board files and a quick review
> just now tells me that yes, we should have done that higher up.
> Probably.  Using the mx6cubox example, I see:
> static bool is_mx6q(void)
> {
>         if (is_cpu_type(MXC_CPU_MX6Q) || is_cpu_type(MXC_CPU_MX6D))
> 	                return true;
> 
> Can we move this to global code, check for each of the MX6 variants, MX7
> variants and always be returning what we return today?

What is board_rev commonly used for?

It sounds more board specific, so we certainly would have to have a way
to overwrite it on board level (e.g. if somebody has two MX6Q SKUs?)

--
Stefan

  reply	other threads:[~2016-07-19  2:19 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-13  7:25 [U-Boot] [PATCH v2 0/9] mx7: add Colibri iMX7S/iMX7D support Stefan Agner
2016-07-13  7:25 ` [U-Boot] [PATCH v2 1/9] dm: imx: serial: Support DTE mode when using driver model Stefan Agner
2016-07-13  7:25 ` [U-Boot] [PATCH v2 2/9] usb: move CONFIG_USB_EHCI_MX7 to Kconfig Stefan Agner
2016-07-13  7:25 ` [U-Boot] [PATCH v2 3/9] usb: ehci-mx6: configure power polarity in usb_power_config Stefan Agner
2016-07-13  7:25 ` [U-Boot] [PATCH v2 4/9] usb: ehci-mx6: introduce config for high active power pin Stefan Agner
2016-07-13 12:11   ` Otavio Salvador
2016-07-13 16:03     ` Stefan Agner
2016-07-13  7:25 ` [U-Boot] [PATCH v2 5/9] mx7: set soc environment according to exact SoC type Stefan Agner
2016-07-18 22:19   ` Fabio Estevam
2016-07-18 22:21     ` Stefan Agner
2016-07-19  0:36       ` Tom Rini
2016-07-19  2:19         ` Stefan Agner [this message]
2016-07-19 12:33           ` Tom Rini
2016-07-19 13:59         ` Stefano Babic
2016-07-19 14:06           ` Fabio Estevam
2016-07-19 14:21             ` Stefano Babic
2016-07-13  7:25 ` [U-Boot] [PATCH v2 6/9] mx7_common: Put display board info config into board file Stefan Agner
2016-07-13  7:25 ` [U-Boot] [PATCH v2 7/9] mx7_common: use Kconfig for ARMv7 non-secure mode Stefan Agner
2016-07-13  7:25 ` [U-Boot] [PATCH v2 8/9] imx_watchdog: add weak attribute to reset_cpu function Stefan Agner
2016-07-13  7:25 ` [U-Boot] [PATCH v2 9/9] colibri_imx7: add Colibri iMX7S/iMX7D module support Stefan Agner
2016-07-19 14:14   ` Stefano Babic
2016-07-19 16:05     ` Stefan Agner
2016-07-19 16:26       ` Stefano Babic
2016-07-18 20:59 ` [U-Boot] [PATCH v2 0/9] mx7: add Colibri iMX7S/iMX7D support Stefan Agner
2016-07-19 14:18   ` stefano
2016-07-19 16:09     ` Stefan Agner
2016-07-19 16:58       ` Stefano Babic

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=97d789604cebb83ce1110e111d0cde08@agner.ch \
    --to=stefan@agner.ch \
    --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