
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