All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] udoo_neo: fix udoo neo UNDEFINED
@ 2022-01-02 23:54 Tommaso Merciai
  2022-01-03  0:58 ` Fabio Estevam
  0 siblings, 1 reply; 2+ messages in thread
From: Tommaso Merciai @ 2022-01-02 23:54 UTC (permalink / raw)
  Cc: tomm.merciai, linuxfancy, Breno Lima, Francesco Montefoschi,
	Fabio Estevam, u-boot

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.

Signed-off-by: Tommaso Merciai <tomm.merciai@gmail.com>
---
Changes since v1
 - get_board_value declared as void
 - fix gd->board_type, re-initialized after spl

 board/udoo/neo/neo.c       | 12 ++++++------
 configs/udoo_neo_defconfig |  1 +
 2 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/board/udoo/neo/neo.c b/board/udoo/neo/neo.c
index 62f81fff68..808b727fb0 100644
--- a/board/udoo/neo/neo.c
+++ b/board/udoo/neo/neo.c
@@ -308,7 +308,7 @@ int board_init(void)
 	return 0;
 }
 
-static int get_board_value(void)
+static void get_board_value(void)
 {
 	int r184, r185;
 
@@ -333,12 +333,13 @@ static int get_board_value(void)
 	 * Extended           1        1
 	 */
 
-	return (r184 << 1) + r185;
+	gd->board_type = (r184 << 1) + r185;
 }
 
 int board_early_init_f(void)
 {
 	setup_iomux_uart();
+	get_board_value();
 
 	return 0;
 }
@@ -370,7 +371,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:
@@ -498,8 +499,6 @@ static void ccgr_init(void)
 
 static void spl_dram_init(void)
 {
-	int board = get_board_value();
-
 	struct mx6_ddr_sysinfo sysinfo = {
 		.dsize = 1, /* width of data bus: 1 = 32 bits */
 		.cs_density = 24,
@@ -516,7 +515,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
diff --git a/configs/udoo_neo_defconfig b/configs/udoo_neo_defconfig
index ca08de1bd4..eff33909d7 100644
--- a/configs/udoo_neo_defconfig
+++ b/configs/udoo_neo_defconfig
@@ -62,3 +62,4 @@ CONFIG_DM_USB=y
 CONFIG_USB_STORAGE=y
 CONFIG_MXC_UART=y
 CONFIG_IMX_THERMAL=y
+CONFIG_BOARD_TYPES=y
\ No newline at end of file
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH v2] udoo_neo: fix udoo neo UNDEFINED
  2022-01-02 23:54 [PATCH v2] udoo_neo: fix udoo neo UNDEFINED Tommaso Merciai
@ 2022-01-03  0:58 ` Fabio Estevam
  0 siblings, 0 replies; 2+ messages in thread
From: Fabio Estevam @ 2022-01-03  0:58 UTC (permalink / raw)
  To: Tommaso Merciai
  Cc: linux-fancy, Breno Lima, Francesco Montefoschi, U-Boot-Denx

Hi Tommaso,

On Sun, Jan 2, 2022 at 8:54 PM Tommaso Merciai <tomm.merciai@gmail.com> wrote:
>
> 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.
>
> Signed-off-by: Tommaso Merciai <tomm.merciai@gmail.com>

With this patch I get:

Board: UDOO Neo UNDEFINED

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-01-03  0:58 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-02 23:54 [PATCH v2] udoo_neo: fix udoo neo UNDEFINED Tommaso Merciai
2022-01-03  0:58 ` Fabio Estevam

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.