All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tommaso Merciai <tomm.merciai@gmail.com>
To: Peter Robinson <pbrobinson@gmail.com>
Cc: Fabio Estevam <festevam@gmail.com>, Tom Rini <trini@konsulko.com>,
	Stefano Babic <sbabic@denx.de>, Simon Glass <sjg@chromium.org>,
	Breno Lima <breno.lima@nxp.com>,
	Francesco Montefoschi <francesco.montefoschi@udoo.org>,
	U-Boot-Denx <u-boot@lists.denx.de>,
	linux-fancy <linuxfancy@googlegroups.com>
Subject: Re: help on udoo_neo power up on mainline uboot
Date: Sun, 2 Jan 2022 00:22:50 +0100	[thread overview]
Message-ID: <20220101232250.GA14454@tom-desktop> (raw)
In-Reply-To: <CALeDE9PxKQ5nJmf1OvTqjTH4ZyRpO04igWruKvmhOaB8jdZSwA@mail.gmail.com>

On Thu, Dec 30, 2021 at 02:20:07PM +0000, Peter Robinson wrote:
> On Thu, Dec 30, 2021 at 2:12 PM Fabio Estevam <festevam@gmail.com> wrote:
> >
> > Hi Peter,
> >
> > On Thu, Dec 30, 2021 at 11:08 AM Peter Robinson <pbrobinson@gmail.com> wrote:
> >
> > > That works for my Full board. Interestingly in my playing I had got to
> > > similar and had wondered about whether the checkboard function was
> > > needed.
> > >
> > > One minor query on the above is it worth assigning the board_string
> > > return to a local variable rather than called the function twice?
> > > Either way feel free to add my RB/TB or let me know if you want me to
> > > send a patch.
> > > Reviewed-by: Peter Robinson <pbrobinson@gmail.com>
> > > Tested-by: Peter Robinson <pbrobinson@gmail.com>
> >
> > Thanks for testing. I can send a formal patch after your series gets applied.
> 
> Actually, doing a full boot I get
> ERROR: invalid device tree
> Found EFI removable media binary efi/boot/bootarm.efi
> 1929216 bytes read in 92 ms (20 MiB/s)
> libfdt fdt_check_header(): FDT_ERR_BADMAGIC
> 
> And if I interrupt boot and do printenv I get fdtfile=undefined so
> while it fixes the detection and printing of the actual model it seems
> it's too load for the device tree file logic, which now why I remember
> I was looking at the show_board_info function above, the
> board_late_init seems to late for the DT logic.
> 
> P

Hi Peter, Fabio,
What do you think about this solution:

First create new static entry in gd:

+++ b/include/asm-generic/global_data.h
@@ -459,6 +459,7 @@ struct global_data {
         */
        char *smbios_version;
 #endif
+       int board_cfg;
 };
 #ifndef DO_DEPS_ONLY
 static_assert(sizeof(struct global_data) == GD_SIZE);

I know maybe is not a clean solution but we can work on it.
After, I store inside this variable the configuration
calling get_board_value() function from spl:

 static void spl_dram_init(void)
 {
-       int board = get_board_value();
+       gd->board_cfg = get_board_value();

        struct mx6_ddr_sysinfo sysinfo = {
                .dsize = 1, /* width of data bus: 1 = 32 bits */
@@ -471,7 +400,7 @@ static void spl_dram_init(void)
        };

        mx6sx_dram_iocfg(32, &mx6_ddr_ioregs, &mx6_grp_ioregs);
-       if (board == UDOO_NEO_TYPE_BASIC || board == UDOO_NEO_TYPE_BASIC_KS)
+       if (gd->board_cfg == UDOO_NEO_TYPE_BASIC || gd->board_cfg == UDOO_NEO_TYPE_BASIC_KS)
                mx6_dram_cfg(&sysinfo, &neo_basic_mmcd_calib,
                             &neo_basic_mem_ddr);


Then I use gd->board_cfg in board_string function:

 static char *board_string(void)
 {
-       switch (get_board_value()) {
+       switch (gd->board_cfg) {
        case UDOO_NEO_TYPE_BASIC:
                return "BASIC";
        case UDOO_NEO_TYPE_BASIC_KS:

On full boot I get the right environment variable for fdtfile, and the
right strings on Model and Board print:

fdtfile=imx6sx-udoo-neo-basic.dtb

Environment size: 4338/8188 bytes
=>
U-Boot SPL 2022.01-rc4-00030-gb3f84a939f-dirty (Jan 02 2022 - 00:01:42 +0100)
DEBUG FUNC = get_board_value, LINE = 274, r184 = 0
DEBUG FUNC = get_board_value, LINE = 275, r184 = 0
Trying to boot from MMC1


U-Boot 2022.01-rc4-00030-gb3f84a939f-dirty (Jan 02 2022 - 00:01:42 +0100)

CPU:   Freescale i.MX6SX rev1.2 996 MHz (running at 792 MHz)
CPU:   Extended Commercial temperature grade (-20C to 105C) at 44C
Reset cause: POR
Model: UDOO Neo Basic
Board: UDOO Neo BASIC
DRAM:  512 MiB
MMC:   FSL_SDHC: 1, FSL_SDHC: 2
Loading Environment from MMC... OK
In:    serial
Out:   serial
Err:   serial
Net:   eth0: ethernet@2188000 [PRIME]
Hit any key to stop autoboot:  0


What do you think about this solution?
Let me know.

Thanks,
Tommaso

  reply	other threads:[~2022-01-01 23:23 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-28 16:52 help on udoo_neo power up on mainline uboot Tommaso Merciai
2021-12-28 19:17 ` Fabio Estevam
2021-12-28 21:49   ` Tommaso Merciai
2021-12-29 20:33   ` Tommaso Merciai
2021-12-29 20:51     ` Fabio Estevam
2021-12-29 21:06       ` Fabio Estevam
2021-12-29 21:14         ` Peter Robinson
2021-12-29 21:51           ` Fabio Estevam
2021-12-29 23:16             ` Peter Robinson
2021-12-29 23:21               ` Fabio Estevam
2021-12-29 22:08       ` Tommaso Merciai
2021-12-29 22:38         ` Fabio Estevam
2021-12-29 23:07           ` Fabio Estevam
2021-12-29 23:27             ` Tommaso Merciai
2021-12-30 14:08             ` Peter Robinson
2021-12-30 14:12               ` Fabio Estevam
2021-12-30 14:20                 ` Peter Robinson
2022-01-01 23:22                   ` Tommaso Merciai [this message]
2022-01-02  1:24                     ` Fabio Estevam
2022-01-02 17:14                       ` Tommaso Merciai
2022-01-02 17:36                         ` Fabio Estevam
2022-01-02 18:29                           ` Tommaso Merciai

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=20220101232250.GA14454@tom-desktop \
    --to=tomm.merciai@gmail.com \
    --cc=breno.lima@nxp.com \
    --cc=festevam@gmail.com \
    --cc=francesco.montefoschi@udoo.org \
    --cc=linuxfancy@googlegroups.com \
    --cc=pbrobinson@gmail.com \
    --cc=sbabic@denx.de \
    --cc=sjg@chromium.org \
    --cc=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.