udoo_neo: fix udoo neo UNDEFINED
PATCH 1/1 udoo_neo: fix udoo neo UNDEFINED
get_board_value function fails to get the right board configuration on second time that is call. This patch move get_board_value function at spl level, once is call, store the right configuration into gd static variable gd->board_type and fix the previous error. get_board_value is now call only one time.
--- board/udoo/neo/neo.c | 77 +++++++++++++++++++------------------- configs/udoo_neo_defconfig | 1 + 2 files changed, 40 insertions(+), 38 deletions(-)
board/udoo/neo/neo.c +39 -38
@@ -235,13 +235,6 @@ static iomux_v3_cfg_t const phy_control_pads[] = { MUX_PAD_CTRL(ENET_CLK_PAD_CTRL), }; -static iomux_v3_cfg_t const board_recognition_pads[] = { -/*Connected to R184*/ -MX6_PAD_NAND_READY_B__GPIO4_IO_13 |BOARD_DETECT_PAD_CFG , -/*Connected to R185*/ -MX6_PAD_NAND_ALE__GPIO4_IO_0 |BOARD_DETECT_PAD_CFG , -}; -static iomux_v3_cfg_t const wdog_b_pad = {MX6_PAD_GPIO1_IO13__GPIO1_IO_13 |MUX_PAD_CTRL (WDOG_PAD_CTRL ), };
@@ -308,34 +301,6 @@ int board_init(void)return 0 ; } -static int get_board_value (void ) -{ -int r184, r185; - -imx_iomux_v3_setup_multiple_pads (board_recognition_pads, -ARRAY_SIZE (board_recognition_pads)); - -gpio_request (IMX_GPIO_NR (4 ,13 ),"r184" ); -gpio_request (IMX_GPIO_NR (4 ,0 ),"r185" ); -gpio_direction_input (IMX_GPIO_NR (4 ,13 )); -gpio_direction_input (IMX_GPIO_NR (4 ,0 )); - - r184 =gpio_get_value (IMX_GPIO_NR (4 ,13 )); - r185 =gpio_get_value (IMX_GPIO_NR (4 ,0 )); - -/* -* Machine selection - -* Machine r184, r185 -* --------------------------------- -* Basic 0 0 -* Basic Ks 0 1 -* Full 1 0 -* Extended 1 1 -*/ - -return (r184 <<1 ) + r185; -} -int board_early_init_f (void ) {setup_iomux_uart ();
@@ -370,7 +335,7 @@ int board_mmc_init(struct bd_info *bis)static char *board_string (void ) { -switch (get_board_value ()) { +switch (gd->board_type) {case UDOO_NEO_TYPE_BASIC :return "BASIC" ;case UDOO_NEO_TYPE_BASIC_KS :
@@ -403,6 +368,13 @@ int board_late_init(void)#include <linux/libfdt.h> #include <asm/arch/mx6-ddr.h> +static iomux_v3_cfg_t const board_recognition_pads[] = { +/*Connected to R184*/ +MX6_PAD_NAND_READY_B__GPIO4_IO_13 |BOARD_DETECT_PAD_CFG , +/*Connected to R185*/ +MX6_PAD_NAND_ALE__GPIO4_IO_0 |BOARD_DETECT_PAD_CFG , +}; +static const struct mx6sx_iomux_ddr_regs mx6_ddr_ioregs = { .dram_dqm0 =0x00000028 , .dram_dqm1 =0x00000028 ,
@@ -482,6 +454,34 @@ static struct mx6_ddr3_cfg neo_basic_mem_ddr = { .trasmin = 3500, }; +static int get_board_value (void ) +{ +int r184, r185; + +imx_iomux_v3_setup_multiple_pads (board_recognition_pads, +ARRAY_SIZE (board_recognition_pads)); + +gpio_request (IMX_GPIO_NR (4 ,13 ),"r184" ); +gpio_request (IMX_GPIO_NR (4 ,0 ),"r185" ); +gpio_direction_input (IMX_GPIO_NR (4 ,13 )); +gpio_direction_input (IMX_GPIO_NR (4 ,0 )); + + r184 =gpio_get_value (IMX_GPIO_NR (4 ,13 )); + r185 =gpio_get_value (IMX_GPIO_NR (4 ,0 )); + +/* +* Machine selection - +* Machine r184, r185 +* --------------------------------- +* Basic 0 0 +* Basic Ks 0 1 +* Full 1 0 +* Extended 1 1 +*/ + +return (r184 <<1 ) + r185; +} +static void ccgr_init (void ) {struct mxc_ccm_reg *ccm = (struct mxc_ccm_reg *)CCM_BASE_ADDR ;
@@ -498,7 +498,7 @@ static void ccgr_init(void)static void spl_dram_init (void ) { -int board =get_board_value (); + gd->board_type =get_board_value ();struct mx6_ddr_sysinfo sysinfo = { .dsize =1 ,/* width of data bus: 1 = 32 bits */
@@ -516,7 +516,8 @@ 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_type ==UDOO_NEO_TYPE_BASIC || + gd->board_type ==UDOO_NEO_TYPE_BASIC_KS )mx6_dram_cfg (&sysinfo, &neo_basic_mmcd_calib, &neo_basic_mem_ddr);else
configs/udoo_neo_defconfig +1 -0
@@ -62,3 +62,4 @@ CONFIG_DM_USB=y CONFIG_USB_STORAGE=y CONFIG_MXC_UART=y CONFIG_IMX_THERMAL=y +CONFIG_BOARD_TYPES=y
Signature · 1 line
2.25.1
Hi Tommaso,
Quoted 8 lines · Tommaso Merciai
get_board_valuefunction fails to get the right board configuration on second time that is call. This patch moveget_board_valuefunction at spl level, once is call, store the right configuration into gd static variablegd->board_typeand fix the previous error.get_board_valueis now call only one time.Signed-off-by Tommaso Merciai <[email protected]>
I tested your patch on my udoo neo full, but it reports "BASIC" now:
U-Boot SPL 2022.01-rc4-00031-gc5c4ced998e3-dirty (Jan 02 2022 - 16:22:05 -0300) Trying to boot from MMC1
U-Boot 2022.01-rc4-00031-gc5c4ced998e3-dirty (Jan 02 2022 - 16:22:05 -0300)
CPU: Freescale i.MX6SX rev1.2 996 MHz (running at 792 MHz) CPU: Extended Commercial temperature grade (-20C to 105C) at 59C Reset cause: WDOG Model: UDOO Neo Basic Board: UDOO Neo BASIC I2C: ready DRAM: 1 GiB
(The size is correctly detected as 'full' though')
Quoted 28 lines · Fabio Estevam
Hi Tommaso,
Quoted 8 lines · Tommaso Merciai
get_board_valuefunction fails to get the right board configuration on second time that is call. This patch moveget_board_valuefunction at spl level, once is call, store the right configuration into gd static variablegd->board_typeand fix the previous error.get_board_valueis now call only one time.Signed-off-by Tommaso Merciai <[email protected]>I tested your patch on my udoo neo full, but it reports "BASIC" now:
U-Boot SPL 2022.01-rc4-00031-gc5c4ced998e3-dirty (Jan 02 2022 - 16:22:05 -0300) Trying to boot from MMC1
U-Boot 2022.01-rc4-00031-gc5c4ced998e3-dirty (Jan 02 2022 - 16:22:05 -0300)
CPU: Freescale i.MX6SX rev1.2 996 MHz (running at 792 MHz) CPU: Extended Commercial temperature grade (-20C to 105C) at 59C Reset cause: WDOG Model: UDOO Neo Basic Board: UDOO Neo BASIC I2C: ready DRAM: 1 GiB
Quoted 1 line
(The size is correctly detected as 'full' though')
Hi Fabio,
Thanks for your test. I'll investigate on the reason and let you know.
Tommaso Merciai
Quoted 28 lines · Fabio Estevam
Hi Tommaso,
Quoted 8 lines · Tommaso Merciai
get_board_valuefunction fails to get the right board configuration on second time that is call. This patch moveget_board_valuefunction at spl level, once is call, store the right configuration into gd static variablegd->board_typeand fix the previous error.get_board_valueis now call only one time.Signed-off-by Tommaso Merciai <[email protected]>I tested your patch on my udoo neo full, but it reports "BASIC" now:
U-Boot SPL 2022.01-rc4-00031-gc5c4ced998e3-dirty (Jan 02 2022 - 16:22:05 -0300) Trying to boot from MMC1
U-Boot 2022.01-rc4-00031-gc5c4ced998e3-dirty (Jan 02 2022 - 16:22:05 -0300)
CPU: Freescale i.MX6SX rev1.2 996 MHz (running at 792 MHz) CPU: Extended Commercial temperature grade (-20C to 105C) at 59C Reset cause: WDOG Model: UDOO Neo Basic Board: UDOO Neo BASIC I2C: ready DRAM: 1 GiB
Quoted 1 line
(The size is correctly detected as 'full' though')
Hi Fabio,
Sent v2, I think this issue is fixed. Can you test it please. The ploblem is that after spl, gd->board_type is re-initialized. Using get_board_value inside board_early_init_f seems solve.
Let me know.
Thanks,
Tommaso Merciai