All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] toradex: tdx-cfg-block: add new 8gb apalis-imx8
@ 2022-05-09 16:58 Philippe Schenker
  2022-05-09 16:58 ` [PATCH 2/2] board: apalis-imx8: add new 8gb product variant Philippe Schenker
                   ` (3 more replies)
  0 siblings, 4 replies; 9+ messages in thread
From: Philippe Schenker @ 2022-05-09 16:58 UTC (permalink / raw)
  To: Marcel Ziswiler, u-boot
  Cc: Philippe Schenker, Francesco Dolcini, Denys Drozdov, Simon Glass

From: Philippe Schenker <philippe.schenker@toradex.com>

0067: Apalis iMX8 QuadMax 8GB Wi-Fi / BT IT

This module is identical to its 4GB counterpart
0037: Apalis iMX8 QuadMax 4GB Wi-Fi / BT IT
except for the RAM size.

Signed-off-by: Philippe Schenker <philippe.schenker@toradex.com>
Reviewed-by: Francesco Dolcini <francesco.dolcini@toradex.com>
---

 board/toradex/common/tdx-cfg-block.c | 18 ++++++++++++++++--
 board/toradex/common/tdx-cfg-block.h |  1 +
 2 files changed, 17 insertions(+), 2 deletions(-)

diff --git a/board/toradex/common/tdx-cfg-block.c b/board/toradex/common/tdx-cfg-block.c
index 9c87289ae9..6c8cf4592d 100644
--- a/board/toradex/common/tdx-cfg-block.c
+++ b/board/toradex/common/tdx-cfg-block.c
@@ -144,6 +144,7 @@ const char * const toradex_modules[] = {
 	[64] = "Verdin iMX8M Plus Quad 2GB Wi-Fi / BT IT",
 	[65] = "Verdin iMX8M Plus QuadLite 1GB IT",
 	[66] = "Verdin iMX8M Plus Quad 8GB Wi-Fi / BT",
+	[67] = "Apalis iMX8 QuadMax 8GB Wi-Fi / BT IT",
 };
 
 const char * const toradex_carrier_boards[] = {
@@ -359,6 +360,7 @@ static int get_cfgblock_interactive(void)
 	char *soc;
 	char it = 'n';
 	char wb = 'n';
+	char mem8g = 'n';
 	int len = 0;
 
 	/* Unknown module by default */
@@ -377,6 +379,14 @@ static int get_cfgblock_interactive(void)
 	sprintf(message, "Does the module have Wi-Fi / Bluetooth? [y/N] ");
 	len = cli_readline(message);
 	wb = console_buffer[0];
+
+#if defined(CONFIG_TARGET_APALIS_IMX8)
+	if ((wb == 'y' || wb == 'Y') && (it == 'y' || it == 'Y')) {
+		sprintf(message, "Does your module have 8GB of RAM? [y/N] ");
+		len = cli_readline(message);
+		mem8g = console_buffer[0];
+	}
+#endif
 #endif
 
 	soc = env_get("soc");
@@ -430,8 +440,12 @@ static int get_cfgblock_interactive(void)
 		tdx_hw_tag.prodid = COLIBRI_IMX7S;
 	else if (is_cpu_type(MXC_CPU_IMX8QM)) {
 		if (it == 'y' || it == 'Y') {
-			if (wb == 'y' || wb == 'Y')
-				tdx_hw_tag.prodid = APALIS_IMX8QM_WIFI_BT_IT;
+			if (wb == 'y' || wb == 'Y') {
+				if (mem8g == 'y' || mem8g == 'Y')
+					tdx_hw_tag.prodid = APALIS_IMX8QM_8GB_WIFI_BT_IT;
+				else
+					tdx_hw_tag.prodid = APALIS_IMX8QM_WIFI_BT_IT;
+			}
 			else
 				tdx_hw_tag.prodid = APALIS_IMX8QM_IT;
 		} else {
diff --git a/board/toradex/common/tdx-cfg-block.h b/board/toradex/common/tdx-cfg-block.h
index ddcf699748..43e662e41d 100644
--- a/board/toradex/common/tdx-cfg-block.h
+++ b/board/toradex/common/tdx-cfg-block.h
@@ -87,6 +87,7 @@ enum {
 	VERDIN_IMX8MPQ_2GB_WIFI_BT_IT,
 	VERDIN_IMX8MPQL_IT, /* 65 */
 	VERDIN_IMX8MPQ_8GB_WIFI_BT,
+	APALIS_IMX8QM_8GB_WIFI_BT_IT,
 };
 
 enum {
-- 
2.35.1


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

* [PATCH 2/2] board: apalis-imx8: add new 8gb product variant
  2022-05-09 16:58 [PATCH 1/2] toradex: tdx-cfg-block: add new 8gb apalis-imx8 Philippe Schenker
@ 2022-05-09 16:58 ` Philippe Schenker
  2022-05-10 15:39   ` Marcel Ziswiler
                     ` (2 more replies)
  2022-05-10 15:38 ` [PATCH 1/2] toradex: tdx-cfg-block: add new 8gb apalis-imx8 Marcel Ziswiler
                   ` (2 subsequent siblings)
  3 siblings, 3 replies; 9+ messages in thread
From: Philippe Schenker @ 2022-05-09 16:58 UTC (permalink / raw)
  To: Marcel Ziswiler, u-boot; +Cc: Philippe Schenker, Francesco Dolcini

From: Philippe Schenker <philippe.schenker@toradex.com>

Add the new Apalis iMX8 product variant

0067: Apalis iMX8 QuadMax 8GB Wi-Fi / BT IT

the only difference to the product

0037 Apalis iMX8 QuadMax 4GB Wi-Fi / BT IT

is the 8gb of RAM. Toradex strategy to choose the correct RAM timing in
SCFW is by fuses in the user area telling which RAM timing to load.

This commit makes use of this information to set the correct size of
the RAM and therefore distinguish between the new 0067 and 0037 product

Signed-off-by: Philippe Schenker <philippe.schenker@toradex.com>
Reviewed-by: Francesco Dolcini <francesco.dolcini@toradex.com>

---

 board/toradex/apalis-imx8/apalis-imx8.c | 81 +++++++++++++++++++++++--
 1 file changed, 77 insertions(+), 4 deletions(-)

diff --git a/board/toradex/apalis-imx8/apalis-imx8.c b/board/toradex/apalis-imx8/apalis-imx8.c
index 04877fcd94..408198843f 100644
--- a/board/toradex/apalis-imx8/apalis-imx8.c
+++ b/board/toradex/apalis-imx8/apalis-imx8.c
@@ -18,6 +18,7 @@
 #include <env.h>
 #include <errno.h>
 #include <linux/libfdt.h>
+#include <linux/bitops.h>
 
 #include "../common/tdx-cfg-block.h"
 
@@ -28,22 +29,75 @@ DECLARE_GLOBAL_DATA_PTR;
 			 (SC_PAD_28FDSOI_DSE_DV_HIGH << PADRING_DSE_SHIFT) | \
 			 (SC_PAD_28FDSOI_PS_PU << PADRING_PULL_SHIFT))
 
+#define TDX_USER_FUSE_BLOCK1_A	276
+#define TDX_USER_FUSE_BLOCK1_B	277
+#define TDX_USER_FUSE_BLOCK2_A	278
+#define TDX_USER_FUSE_BLOCK2_B	279
+
 static iomux_cfg_t uart1_pads[] = {
 	SC_P_UART1_RX | MUX_PAD_CTRL(UART_PAD_CTRL),
 	SC_P_UART1_TX | MUX_PAD_CTRL(UART_PAD_CTRL),
 };
 
+struct tdx_user_fuses {
+	u16 pid4;
+	u16 vers;
+	u8 ramid;
+};
+
 static void setup_iomux_uart(void)
 {
 	imx8_iomux_setup_multiple_pads(uart1_pads, ARRAY_SIZE(uart1_pads));
 }
 
+static uint32_t do_get_tdx_user_fuse(int a, int b)
+{
+	sc_err_t sciErr;
+	u32 val_a = 0;
+	u32 val_b = 0;
+
+	sciErr = sc_misc_otp_fuse_read(-1, a, &val_a);
+	if (sciErr != SC_ERR_NONE) {
+		printf("Error reading out user fuse %d\n", a);
+		return 0;
+	}
+
+	sciErr = sc_misc_otp_fuse_read(-1, b, &val_b);
+	if (sciErr != SC_ERR_NONE) {
+		printf("Error reading out user fuse %d\n", b);
+		return 0;
+	}
+
+	return ((val_a & 0xffff) << 16) | (val_b & 0xffff);
+}
+
+static void get_tdx_user_fuse(struct tdx_user_fuses *tdxuserfuse)
+{
+	u32 fuse_block;
+
+	fuse_block = do_get_tdx_user_fuse(TDX_USER_FUSE_BLOCK2_A,
+					  TDX_USER_FUSE_BLOCK2_B);
+
+	/*
+	 * Fuse block 2 acts as a backup area, if this reads 0 we want to
+	 * use fuse block 1
+	 */
+	if (fuse_block == 0)
+		fuse_block = do_get_tdx_user_fuse(TDX_USER_FUSE_BLOCK1_A,
+						  TDX_USER_FUSE_BLOCK1_B);
+
+	tdxuserfuse->pid4 = (fuse_block >> 18) & GENMASK(13, 0);
+	tdxuserfuse->vers = (fuse_block >> 4) & GENMASK(13, 0);
+	tdxuserfuse->ramid = fuse_block & GENMASK(3, 0);
+}
+
 void board_mem_get_layout(u64 *phys_sdram_1_start,
 			  u64 *phys_sdram_1_size,
 			  u64 *phys_sdram_2_start,
 			  u64 *phys_sdram_2_size)
 {
 	u32 is_quadplus = 0, val = 0;
+	struct tdx_user_fuses tdxramfuses;
 	sc_err_t scierr = sc_misc_otp_fuse_read(-1, 6, &val);
 
 	if (scierr == SC_ERR_NONE) {
@@ -51,14 +105,33 @@ void board_mem_get_layout(u64 *phys_sdram_1_start,
 		is_quadplus = ((val >> 4) & 0x3) != 0x0;
 	}
 
+	get_tdx_user_fuse(&tdxramfuses);
+
 	*phys_sdram_1_start = PHYS_SDRAM_1;
 	*phys_sdram_1_size = PHYS_SDRAM_1_SIZE;
 	*phys_sdram_2_start = PHYS_SDRAM_2;
-	if (is_quadplus)
-		/* Our QP based SKUs only have 2 GB RAM (PHYS_SDRAM_1_SIZE) */
+
+	switch (tdxramfuses.ramid) {
+	case 1:
+		*phys_sdram_2_size = SZ_2G;
+		break;
+	case 2:
 		*phys_sdram_2_size = 0x0UL;
-	else
-		*phys_sdram_2_size = PHYS_SDRAM_2_SIZE;
+		break;
+	case 3:
+		*phys_sdram_2_size = SZ_2G;
+		break;
+	case 4:
+		*phys_sdram_2_size = SZ_4G + SZ_2G;
+		break;
+	default:
+		if (is_quadplus)
+			/* Our QP based SKUs only have 2 GB RAM (PHYS_SDRAM_1_SIZE) */
+			*phys_sdram_2_size = 0x0UL;
+		else
+			*phys_sdram_2_size = PHYS_SDRAM_2_SIZE;
+		break;
+	}
 }
 
 int board_early_init_f(void)
-- 
2.35.1


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

* Re: [PATCH 1/2] toradex: tdx-cfg-block: add new 8gb apalis-imx8
  2022-05-09 16:58 [PATCH 1/2] toradex: tdx-cfg-block: add new 8gb apalis-imx8 Philippe Schenker
  2022-05-09 16:58 ` [PATCH 2/2] board: apalis-imx8: add new 8gb product variant Philippe Schenker
@ 2022-05-10 15:38 ` Marcel Ziswiler
  2022-05-25  8:12 ` Marcel Ziswiler
  2022-06-15 11:11 ` sbabic
  3 siblings, 0 replies; 9+ messages in thread
From: Marcel Ziswiler @ 2022-05-10 15:38 UTC (permalink / raw)
  To: dev, u-boot; +Cc: Philippe Schenker, sjg, Francesco Dolcini, Denys Drozdov

On Mon, 2022-05-09 at 18:58 +0200, Philippe Schenker wrote:
> From: Philippe Schenker <philippe.schenker@toradex.com>
> 
> 0067: Apalis iMX8 QuadMax 8GB Wi-Fi / BT IT
> 
> This module is identical to its 4GB counterpart
> 0037: Apalis iMX8 QuadMax 4GB Wi-Fi / BT IT
> except for the RAM size.
> 
> Signed-off-by: Philippe Schenker <philippe.schenker@toradex.com>
> Reviewed-by: Francesco Dolcini <francesco.dolcini@toradex.com>

Acked-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>

> ---
> 
>  board/toradex/common/tdx-cfg-block.c | 18 ++++++++++++++++--
>  board/toradex/common/tdx-cfg-block.h |  1 +
>  2 files changed, 17 insertions(+), 2 deletions(-)
> 
> diff --git a/board/toradex/common/tdx-cfg-block.c b/board/toradex/common/tdx-cfg-block.c
> index 9c87289ae9..6c8cf4592d 100644
> --- a/board/toradex/common/tdx-cfg-block.c
> +++ b/board/toradex/common/tdx-cfg-block.c
> @@ -144,6 +144,7 @@ const char * const toradex_modules[] = {
>         [64] = "Verdin iMX8M Plus Quad 2GB Wi-Fi / BT IT",
>         [65] = "Verdin iMX8M Plus QuadLite 1GB IT",
>         [66] = "Verdin iMX8M Plus Quad 8GB Wi-Fi / BT",
> +       [67] = "Apalis iMX8 QuadMax 8GB Wi-Fi / BT IT",
>  };
>  
>  const char * const toradex_carrier_boards[] = {
> @@ -359,6 +360,7 @@ static int get_cfgblock_interactive(void)
>         char *soc;
>         char it = 'n';
>         char wb = 'n';
> +       char mem8g = 'n';
>         int len = 0;
>  
>         /* Unknown module by default */
> @@ -377,6 +379,14 @@ static int get_cfgblock_interactive(void)
>         sprintf(message, "Does the module have Wi-Fi / Bluetooth? [y/N] ");
>         len = cli_readline(message);
>         wb = console_buffer[0];
> +
> +#if defined(CONFIG_TARGET_APALIS_IMX8)
> +       if ((wb == 'y' || wb == 'Y') && (it == 'y' || it == 'Y')) {
> +               sprintf(message, "Does your module have 8GB of RAM? [y/N] ");
> +               len = cli_readline(message);
> +               mem8g = console_buffer[0];
> +       }
> +#endif
>  #endif
>  
>         soc = env_get("soc");
> @@ -430,8 +440,12 @@ static int get_cfgblock_interactive(void)
>                 tdx_hw_tag.prodid = COLIBRI_IMX7S;
>         else if (is_cpu_type(MXC_CPU_IMX8QM)) {
>                 if (it == 'y' || it == 'Y') {
> -                       if (wb == 'y' || wb == 'Y')
> -                               tdx_hw_tag.prodid = APALIS_IMX8QM_WIFI_BT_IT;
> +                       if (wb == 'y' || wb == 'Y') {
> +                               if (mem8g == 'y' || mem8g == 'Y')
> +                                       tdx_hw_tag.prodid = APALIS_IMX8QM_8GB_WIFI_BT_IT;
> +                               else
> +                                       tdx_hw_tag.prodid = APALIS_IMX8QM_WIFI_BT_IT;
> +                       }
>                         else
>                                 tdx_hw_tag.prodid = APALIS_IMX8QM_IT;
>                 } else {
> diff --git a/board/toradex/common/tdx-cfg-block.h b/board/toradex/common/tdx-cfg-block.h
> index ddcf699748..43e662e41d 100644
> --- a/board/toradex/common/tdx-cfg-block.h
> +++ b/board/toradex/common/tdx-cfg-block.h
> @@ -87,6 +87,7 @@ enum {
>         VERDIN_IMX8MPQ_2GB_WIFI_BT_IT,
>         VERDIN_IMX8MPQL_IT, /* 65 */
>         VERDIN_IMX8MPQ_8GB_WIFI_BT,
> +       APALIS_IMX8QM_8GB_WIFI_BT_IT,
>  };
>  
>  enum {

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

* Re: [PATCH 2/2] board: apalis-imx8: add new 8gb product variant
  2022-05-09 16:58 ` [PATCH 2/2] board: apalis-imx8: add new 8gb product variant Philippe Schenker
@ 2022-05-10 15:39   ` Marcel Ziswiler
  2022-05-25  8:12   ` Marcel Ziswiler
  2022-06-15 11:11   ` sbabic
  2 siblings, 0 replies; 9+ messages in thread
From: Marcel Ziswiler @ 2022-05-10 15:39 UTC (permalink / raw)
  To: dev, u-boot; +Cc: Philippe Schenker, Francesco Dolcini

On Mon, 2022-05-09 at 18:58 +0200, Philippe Schenker wrote:
> From: Philippe Schenker <philippe.schenker@toradex.com>
> 
> Add the new Apalis iMX8 product variant
> 
> 0067: Apalis iMX8 QuadMax 8GB Wi-Fi / BT IT
> 
> the only difference to the product
> 
> 0037 Apalis iMX8 QuadMax 4GB Wi-Fi / BT IT
> 
> is the 8gb of RAM. Toradex strategy to choose the correct RAM timing in
> SCFW is by fuses in the user area telling which RAM timing to load.
> 
> This commit makes use of this information to set the correct size of
> the RAM and therefore distinguish between the new 0067 and 0037 product
> 
> Signed-off-by: Philippe Schenker <philippe.schenker@toradex.com>
> Reviewed-by: Francesco Dolcini <francesco.dolcini@toradex.com>

Acked-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>

> ---
> 
>  board/toradex/apalis-imx8/apalis-imx8.c | 81 +++++++++++++++++++++++--
>  1 file changed, 77 insertions(+), 4 deletions(-)
> 
> diff --git a/board/toradex/apalis-imx8/apalis-imx8.c b/board/toradex/apalis-imx8/apalis-imx8.c
> index 04877fcd94..408198843f 100644
> --- a/board/toradex/apalis-imx8/apalis-imx8.c
> +++ b/board/toradex/apalis-imx8/apalis-imx8.c
> @@ -18,6 +18,7 @@
>  #include <env.h>
>  #include <errno.h>
>  #include <linux/libfdt.h>
> +#include <linux/bitops.h>
>  
>  #include "../common/tdx-cfg-block.h"
>  
> @@ -28,22 +29,75 @@ DECLARE_GLOBAL_DATA_PTR;
>                          (SC_PAD_28FDSOI_DSE_DV_HIGH << PADRING_DSE_SHIFT) | \
>                          (SC_PAD_28FDSOI_PS_PU << PADRING_PULL_SHIFT))
>  
> +#define TDX_USER_FUSE_BLOCK1_A 276
> +#define TDX_USER_FUSE_BLOCK1_B 277
> +#define TDX_USER_FUSE_BLOCK2_A 278
> +#define TDX_USER_FUSE_BLOCK2_B 279
> +
>  static iomux_cfg_t uart1_pads[] = {
>         SC_P_UART1_RX | MUX_PAD_CTRL(UART_PAD_CTRL),
>         SC_P_UART1_TX | MUX_PAD_CTRL(UART_PAD_CTRL),
>  };
>  
> +struct tdx_user_fuses {
> +       u16 pid4;
> +       u16 vers;
> +       u8 ramid;
> +};
> +
>  static void setup_iomux_uart(void)
>  {
>         imx8_iomux_setup_multiple_pads(uart1_pads, ARRAY_SIZE(uart1_pads));
>  }
>  
> +static uint32_t do_get_tdx_user_fuse(int a, int b)
> +{
> +       sc_err_t sciErr;
> +       u32 val_a = 0;
> +       u32 val_b = 0;
> +
> +       sciErr = sc_misc_otp_fuse_read(-1, a, &val_a);
> +       if (sciErr != SC_ERR_NONE) {
> +               printf("Error reading out user fuse %d\n", a);
> +               return 0;
> +       }
> +
> +       sciErr = sc_misc_otp_fuse_read(-1, b, &val_b);
> +       if (sciErr != SC_ERR_NONE) {
> +               printf("Error reading out user fuse %d\n", b);
> +               return 0;
> +       }
> +
> +       return ((val_a & 0xffff) << 16) | (val_b & 0xffff);
> +}
> +
> +static void get_tdx_user_fuse(struct tdx_user_fuses *tdxuserfuse)
> +{
> +       u32 fuse_block;
> +
> +       fuse_block = do_get_tdx_user_fuse(TDX_USER_FUSE_BLOCK2_A,
> +                                         TDX_USER_FUSE_BLOCK2_B);
> +
> +       /*
> +        * Fuse block 2 acts as a backup area, if this reads 0 we want to
> +        * use fuse block 1
> +        */
> +       if (fuse_block == 0)
> +               fuse_block = do_get_tdx_user_fuse(TDX_USER_FUSE_BLOCK1_A,
> +                                                 TDX_USER_FUSE_BLOCK1_B);
> +
> +       tdxuserfuse->pid4 = (fuse_block >> 18) & GENMASK(13, 0);
> +       tdxuserfuse->vers = (fuse_block >> 4) & GENMASK(13, 0);
> +       tdxuserfuse->ramid = fuse_block & GENMASK(3, 0);
> +}
> +
>  void board_mem_get_layout(u64 *phys_sdram_1_start,
>                           u64 *phys_sdram_1_size,
>                           u64 *phys_sdram_2_start,
>                           u64 *phys_sdram_2_size)
>  {
>         u32 is_quadplus = 0, val = 0;
> +       struct tdx_user_fuses tdxramfuses;
>         sc_err_t scierr = sc_misc_otp_fuse_read(-1, 6, &val);
>  
>         if (scierr == SC_ERR_NONE) {
> @@ -51,14 +105,33 @@ void board_mem_get_layout(u64 *phys_sdram_1_start,
>                 is_quadplus = ((val >> 4) & 0x3) != 0x0;
>         }
>  
> +       get_tdx_user_fuse(&tdxramfuses);
> +
>         *phys_sdram_1_start = PHYS_SDRAM_1;
>         *phys_sdram_1_size = PHYS_SDRAM_1_SIZE;
>         *phys_sdram_2_start = PHYS_SDRAM_2;
> -       if (is_quadplus)
> -               /* Our QP based SKUs only have 2 GB RAM (PHYS_SDRAM_1_SIZE) */
> +
> +       switch (tdxramfuses.ramid) {
> +       case 1:
> +               *phys_sdram_2_size = SZ_2G;
> +               break;
> +       case 2:
>                 *phys_sdram_2_size = 0x0UL;
> -       else
> -               *phys_sdram_2_size = PHYS_SDRAM_2_SIZE;
> +               break;
> +       case 3:
> +               *phys_sdram_2_size = SZ_2G;
> +               break;
> +       case 4:
> +               *phys_sdram_2_size = SZ_4G + SZ_2G;
> +               break;
> +       default:
> +               if (is_quadplus)
> +                       /* Our QP based SKUs only have 2 GB RAM (PHYS_SDRAM_1_SIZE) */
> +                       *phys_sdram_2_size = 0x0UL;
> +               else
> +                       *phys_sdram_2_size = PHYS_SDRAM_2_SIZE;
> +               break;
> +       }
>  }
>  
>  int board_early_init_f(void)

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

* Re: [PATCH 1/2] toradex: tdx-cfg-block: add new 8gb apalis-imx8
  2022-05-09 16:58 [PATCH 1/2] toradex: tdx-cfg-block: add new 8gb apalis-imx8 Philippe Schenker
  2022-05-09 16:58 ` [PATCH 2/2] board: apalis-imx8: add new 8gb product variant Philippe Schenker
  2022-05-10 15:38 ` [PATCH 1/2] toradex: tdx-cfg-block: add new 8gb apalis-imx8 Marcel Ziswiler
@ 2022-05-25  8:12 ` Marcel Ziswiler
  2022-05-25  8:40   ` Stefano Babic
  2022-06-15 11:11 ` sbabic
  3 siblings, 1 reply; 9+ messages in thread
From: Marcel Ziswiler @ 2022-05-25  8:12 UTC (permalink / raw)
  To: u-boot, sbabic; +Cc: Philippe Schenker, sjg, Francesco Dolcini, Denys Drozdov

Hi Stefano

On Mon, 2022-05-09 at 18:58 +0200, Philippe Schenker wrote:
> From: Philippe Schenker <philippe.schenker@toradex.com>
> 
> 0067: Apalis iMX8 QuadMax 8GB Wi-Fi / BT IT
> 
> This module is identical to its 4GB counterpart
> 0037: Apalis iMX8 QuadMax 4GB Wi-Fi / BT IT
> except for the RAM size.
> 
> Signed-off-by: Philippe Schenker <philippe.schenker@toradex.com>
> Reviewed-by: Francesco Dolcini <francesco.dolcini@toradex.com>

Those two patches are currently still missing. Could you please apply them as well? Thanks!

Cheers

Marcel

> ---
> 
>  board/toradex/common/tdx-cfg-block.c | 18 ++++++++++++++++--
>  board/toradex/common/tdx-cfg-block.h |  1 +
>  2 files changed, 17 insertions(+), 2 deletions(-)
> 
> diff --git a/board/toradex/common/tdx-cfg-block.c b/board/toradex/common/tdx-cfg-block.c
> index 9c87289ae9..6c8cf4592d 100644
> --- a/board/toradex/common/tdx-cfg-block.c
> +++ b/board/toradex/common/tdx-cfg-block.c
> @@ -144,6 +144,7 @@ const char * const toradex_modules[] = {
>         [64] = "Verdin iMX8M Plus Quad 2GB Wi-Fi / BT IT",
>         [65] = "Verdin iMX8M Plus QuadLite 1GB IT",
>         [66] = "Verdin iMX8M Plus Quad 8GB Wi-Fi / BT",
> +       [67] = "Apalis iMX8 QuadMax 8GB Wi-Fi / BT IT",
>  };
>  
>  const char * const toradex_carrier_boards[] = {
> @@ -359,6 +360,7 @@ static int get_cfgblock_interactive(void)
>         char *soc;
>         char it = 'n';
>         char wb = 'n';
> +       char mem8g = 'n';
>         int len = 0;
>  
>         /* Unknown module by default */
> @@ -377,6 +379,14 @@ static int get_cfgblock_interactive(void)
>         sprintf(message, "Does the module have Wi-Fi / Bluetooth? [y/N] ");
>         len = cli_readline(message);
>         wb = console_buffer[0];
> +
> +#if defined(CONFIG_TARGET_APALIS_IMX8)
> +       if ((wb == 'y' || wb == 'Y') && (it == 'y' || it == 'Y')) {
> +               sprintf(message, "Does your module have 8GB of RAM? [y/N] ");
> +               len = cli_readline(message);
> +               mem8g = console_buffer[0];
> +       }
> +#endif
>  #endif
>  
>         soc = env_get("soc");
> @@ -430,8 +440,12 @@ static int get_cfgblock_interactive(void)
>                 tdx_hw_tag.prodid = COLIBRI_IMX7S;
>         else if (is_cpu_type(MXC_CPU_IMX8QM)) {
>                 if (it == 'y' || it == 'Y') {
> -                       if (wb == 'y' || wb == 'Y')
> -                               tdx_hw_tag.prodid = APALIS_IMX8QM_WIFI_BT_IT;
> +                       if (wb == 'y' || wb == 'Y') {
> +                               if (mem8g == 'y' || mem8g == 'Y')
> +                                       tdx_hw_tag.prodid = APALIS_IMX8QM_8GB_WIFI_BT_IT;
> +                               else
> +                                       tdx_hw_tag.prodid = APALIS_IMX8QM_WIFI_BT_IT;
> +                       }
>                         else
>                                 tdx_hw_tag.prodid = APALIS_IMX8QM_IT;
>                 } else {
> diff --git a/board/toradex/common/tdx-cfg-block.h b/board/toradex/common/tdx-cfg-block.h
> index ddcf699748..43e662e41d 100644
> --- a/board/toradex/common/tdx-cfg-block.h
> +++ b/board/toradex/common/tdx-cfg-block.h
> @@ -87,6 +87,7 @@ enum {
>         VERDIN_IMX8MPQ_2GB_WIFI_BT_IT,
>         VERDIN_IMX8MPQL_IT, /* 65 */
>         VERDIN_IMX8MPQ_8GB_WIFI_BT,
> +       APALIS_IMX8QM_8GB_WIFI_BT_IT,
>  };
>  
>  enum {

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

* Re: [PATCH 2/2] board: apalis-imx8: add new 8gb product variant
  2022-05-09 16:58 ` [PATCH 2/2] board: apalis-imx8: add new 8gb product variant Philippe Schenker
  2022-05-10 15:39   ` Marcel Ziswiler
@ 2022-05-25  8:12   ` Marcel Ziswiler
  2022-06-15 11:11   ` sbabic
  2 siblings, 0 replies; 9+ messages in thread
From: Marcel Ziswiler @ 2022-05-25  8:12 UTC (permalink / raw)
  To: u-boot, sbabic; +Cc: Philippe Schenker, Francesco Dolcini

Hi Stefano

On Mon, 2022-05-09 at 18:58 +0200, Philippe Schenker wrote:
> From: Philippe Schenker <philippe.schenker@toradex.com>
> 
> Add the new Apalis iMX8 product variant
> 
> 0067: Apalis iMX8 QuadMax 8GB Wi-Fi / BT IT
> 
> the only difference to the product
> 
> 0037 Apalis iMX8 QuadMax 4GB Wi-Fi / BT IT
> 
> is the 8gb of RAM. Toradex strategy to choose the correct RAM timing in
> SCFW is by fuses in the user area telling which RAM timing to load.
> 
> This commit makes use of this information to set the correct size of
> the RAM and therefore distinguish between the new 0067 and 0037 product
> 
> Signed-off-by: Philippe Schenker <philippe.schenker@toradex.com>
> Reviewed-by: Francesco Dolcini <francesco.dolcini@toradex.com>

Those two patches are currently still missing. Could you please apply them as well? Thanks!

Cheers

Marcel


> ---
> 
>  board/toradex/apalis-imx8/apalis-imx8.c | 81 +++++++++++++++++++++++--
>  1 file changed, 77 insertions(+), 4 deletions(-)
> 
> diff --git a/board/toradex/apalis-imx8/apalis-imx8.c b/board/toradex/apalis-imx8/apalis-imx8.c
> index 04877fcd94..408198843f 100644
> --- a/board/toradex/apalis-imx8/apalis-imx8.c
> +++ b/board/toradex/apalis-imx8/apalis-imx8.c
> @@ -18,6 +18,7 @@
>  #include <env.h>
>  #include <errno.h>
>  #include <linux/libfdt.h>
> +#include <linux/bitops.h>
>  
>  #include "../common/tdx-cfg-block.h"
>  
> @@ -28,22 +29,75 @@ DECLARE_GLOBAL_DATA_PTR;
>                          (SC_PAD_28FDSOI_DSE_DV_HIGH << PADRING_DSE_SHIFT) | \
>                          (SC_PAD_28FDSOI_PS_PU << PADRING_PULL_SHIFT))
>  
> +#define TDX_USER_FUSE_BLOCK1_A 276
> +#define TDX_USER_FUSE_BLOCK1_B 277
> +#define TDX_USER_FUSE_BLOCK2_A 278
> +#define TDX_USER_FUSE_BLOCK2_B 279
> +
>  static iomux_cfg_t uart1_pads[] = {
>         SC_P_UART1_RX | MUX_PAD_CTRL(UART_PAD_CTRL),
>         SC_P_UART1_TX | MUX_PAD_CTRL(UART_PAD_CTRL),
>  };
>  
> +struct tdx_user_fuses {
> +       u16 pid4;
> +       u16 vers;
> +       u8 ramid;
> +};
> +
>  static void setup_iomux_uart(void)
>  {
>         imx8_iomux_setup_multiple_pads(uart1_pads, ARRAY_SIZE(uart1_pads));
>  }
>  
> +static uint32_t do_get_tdx_user_fuse(int a, int b)
> +{
> +       sc_err_t sciErr;
> +       u32 val_a = 0;
> +       u32 val_b = 0;
> +
> +       sciErr = sc_misc_otp_fuse_read(-1, a, &val_a);
> +       if (sciErr != SC_ERR_NONE) {
> +               printf("Error reading out user fuse %d\n", a);
> +               return 0;
> +       }
> +
> +       sciErr = sc_misc_otp_fuse_read(-1, b, &val_b);
> +       if (sciErr != SC_ERR_NONE) {
> +               printf("Error reading out user fuse %d\n", b);
> +               return 0;
> +       }
> +
> +       return ((val_a & 0xffff) << 16) | (val_b & 0xffff);
> +}
> +
> +static void get_tdx_user_fuse(struct tdx_user_fuses *tdxuserfuse)
> +{
> +       u32 fuse_block;
> +
> +       fuse_block = do_get_tdx_user_fuse(TDX_USER_FUSE_BLOCK2_A,
> +                                         TDX_USER_FUSE_BLOCK2_B);
> +
> +       /*
> +        * Fuse block 2 acts as a backup area, if this reads 0 we want to
> +        * use fuse block 1
> +        */
> +       if (fuse_block == 0)
> +               fuse_block = do_get_tdx_user_fuse(TDX_USER_FUSE_BLOCK1_A,
> +                                                 TDX_USER_FUSE_BLOCK1_B);
> +
> +       tdxuserfuse->pid4 = (fuse_block >> 18) & GENMASK(13, 0);
> +       tdxuserfuse->vers = (fuse_block >> 4) & GENMASK(13, 0);
> +       tdxuserfuse->ramid = fuse_block & GENMASK(3, 0);
> +}
> +
>  void board_mem_get_layout(u64 *phys_sdram_1_start,
>                           u64 *phys_sdram_1_size,
>                           u64 *phys_sdram_2_start,
>                           u64 *phys_sdram_2_size)
>  {
>         u32 is_quadplus = 0, val = 0;
> +       struct tdx_user_fuses tdxramfuses;
>         sc_err_t scierr = sc_misc_otp_fuse_read(-1, 6, &val);
>  
>         if (scierr == SC_ERR_NONE) {
> @@ -51,14 +105,33 @@ void board_mem_get_layout(u64 *phys_sdram_1_start,
>                 is_quadplus = ((val >> 4) & 0x3) != 0x0;
>         }
>  
> +       get_tdx_user_fuse(&tdxramfuses);
> +
>         *phys_sdram_1_start = PHYS_SDRAM_1;
>         *phys_sdram_1_size = PHYS_SDRAM_1_SIZE;
>         *phys_sdram_2_start = PHYS_SDRAM_2;
> -       if (is_quadplus)
> -               /* Our QP based SKUs only have 2 GB RAM (PHYS_SDRAM_1_SIZE) */
> +
> +       switch (tdxramfuses.ramid) {
> +       case 1:
> +               *phys_sdram_2_size = SZ_2G;
> +               break;
> +       case 2:
>                 *phys_sdram_2_size = 0x0UL;
> -       else
> -               *phys_sdram_2_size = PHYS_SDRAM_2_SIZE;
> +               break;
> +       case 3:
> +               *phys_sdram_2_size = SZ_2G;
> +               break;
> +       case 4:
> +               *phys_sdram_2_size = SZ_4G + SZ_2G;
> +               break;
> +       default:
> +               if (is_quadplus)
> +                       /* Our QP based SKUs only have 2 GB RAM (PHYS_SDRAM_1_SIZE) */
> +                       *phys_sdram_2_size = 0x0UL;
> +               else
> +                       *phys_sdram_2_size = PHYS_SDRAM_2_SIZE;
> +               break;
> +       }
>  }
>  
>  int board_early_init_f(void)

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

* Re: [PATCH 1/2] toradex: tdx-cfg-block: add new 8gb apalis-imx8
  2022-05-25  8:12 ` Marcel Ziswiler
@ 2022-05-25  8:40   ` Stefano Babic
  0 siblings, 0 replies; 9+ messages in thread
From: Stefano Babic @ 2022-05-25  8:40 UTC (permalink / raw)
  To: Marcel Ziswiler, u-boot, sbabic
  Cc: Philippe Schenker, sjg, Francesco Dolcini, Denys Drozdov

Hi Marcel, Philippe,

On 25.05.22 10:12, Marcel Ziswiler wrote:
> Hi Stefano
> 
> On Mon, 2022-05-09 at 18:58 +0200, Philippe Schenker wrote:
>> From: Philippe Schenker <philippe.schenker@toradex.com>
>>
>> 0067: Apalis iMX8 QuadMax 8GB Wi-Fi / BT IT
>>
>> This module is identical to its 4GB counterpart
>> 0037: Apalis iMX8 QuadMax 4GB Wi-Fi / BT IT
>> except for the RAM size.
>>
>> Signed-off-by: Philippe Schenker <philippe.schenker@toradex.com>
>> Reviewed-by: Francesco Dolcini <francesco.dolcini@toradex.com>
> 
> Those two patches are currently still missing. Could you please apply them as well? Thanks!

Yes, I solved the long backlog, quite "recent" patches were out of my sight.

Marked them for the release, I plan another PR before release.

Regards,
Stefano

> 
> Cheers
> 
> Marcel
> 
>> ---
>>
>>   board/toradex/common/tdx-cfg-block.c | 18 ++++++++++++++++--
>>   board/toradex/common/tdx-cfg-block.h |  1 +
>>   2 files changed, 17 insertions(+), 2 deletions(-)
>>
>> diff --git a/board/toradex/common/tdx-cfg-block.c b/board/toradex/common/tdx-cfg-block.c
>> index 9c87289ae9..6c8cf4592d 100644
>> --- a/board/toradex/common/tdx-cfg-block.c
>> +++ b/board/toradex/common/tdx-cfg-block.c
>> @@ -144,6 +144,7 @@ const char * const toradex_modules[] = {
>>          [64] = "Verdin iMX8M Plus Quad 2GB Wi-Fi / BT IT",
>>          [65] = "Verdin iMX8M Plus QuadLite 1GB IT",
>>          [66] = "Verdin iMX8M Plus Quad 8GB Wi-Fi / BT",
>> +       [67] = "Apalis iMX8 QuadMax 8GB Wi-Fi / BT IT",
>>   };
>>   
>>   const char * const toradex_carrier_boards[] = {
>> @@ -359,6 +360,7 @@ static int get_cfgblock_interactive(void)
>>          char *soc;
>>          char it = 'n';
>>          char wb = 'n';
>> +       char mem8g = 'n';
>>          int len = 0;
>>   
>>          /* Unknown module by default */
>> @@ -377,6 +379,14 @@ static int get_cfgblock_interactive(void)
>>          sprintf(message, "Does the module have Wi-Fi / Bluetooth? [y/N] ");
>>          len = cli_readline(message);
>>          wb = console_buffer[0];
>> +
>> +#if defined(CONFIG_TARGET_APALIS_IMX8)
>> +       if ((wb == 'y' || wb == 'Y') && (it == 'y' || it == 'Y')) {
>> +               sprintf(message, "Does your module have 8GB of RAM? [y/N] ");
>> +               len = cli_readline(message);
>> +               mem8g = console_buffer[0];
>> +       }
>> +#endif
>>   #endif
>>   
>>          soc = env_get("soc");
>> @@ -430,8 +440,12 @@ static int get_cfgblock_interactive(void)
>>                  tdx_hw_tag.prodid = COLIBRI_IMX7S;
>>          else if (is_cpu_type(MXC_CPU_IMX8QM)) {
>>                  if (it == 'y' || it == 'Y') {
>> -                       if (wb == 'y' || wb == 'Y')
>> -                               tdx_hw_tag.prodid = APALIS_IMX8QM_WIFI_BT_IT;
>> +                       if (wb == 'y' || wb == 'Y') {
>> +                               if (mem8g == 'y' || mem8g == 'Y')
>> +                                       tdx_hw_tag.prodid = APALIS_IMX8QM_8GB_WIFI_BT_IT;
>> +                               else
>> +                                       tdx_hw_tag.prodid = APALIS_IMX8QM_WIFI_BT_IT;
>> +                       }
>>                          else
>>                                  tdx_hw_tag.prodid = APALIS_IMX8QM_IT;
>>                  } else {
>> diff --git a/board/toradex/common/tdx-cfg-block.h b/board/toradex/common/tdx-cfg-block.h
>> index ddcf699748..43e662e41d 100644
>> --- a/board/toradex/common/tdx-cfg-block.h
>> +++ b/board/toradex/common/tdx-cfg-block.h
>> @@ -87,6 +87,7 @@ enum {
>>          VERDIN_IMX8MPQ_2GB_WIFI_BT_IT,
>>          VERDIN_IMX8MPQL_IT, /* 65 */
>>          VERDIN_IMX8MPQ_8GB_WIFI_BT,
>> +       APALIS_IMX8QM_8GB_WIFI_BT_IT,
>>   };
>>   
>>   enum {


-- 
=====================================================================
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic@denx.de
=====================================================================

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

* [PATCH 1/2] toradex: tdx-cfg-block: add new 8gb apalis-imx8
  2022-05-09 16:58 [PATCH 1/2] toradex: tdx-cfg-block: add new 8gb apalis-imx8 Philippe Schenker
                   ` (2 preceding siblings ...)
  2022-05-25  8:12 ` Marcel Ziswiler
@ 2022-06-15 11:11 ` sbabic
  3 siblings, 0 replies; 9+ messages in thread
From: sbabic @ 2022-06-15 11:11 UTC (permalink / raw)
  To: Philippe Schenker, u-boot

> From: Philippe Schenker <philippe.schenker@toradex.com>
> 0067: Apalis iMX8 QuadMax 8GB Wi-Fi / BT IT
> This module is identical to its 4GB counterpart
> 0037: Apalis iMX8 QuadMax 4GB Wi-Fi / BT IT
> except for the RAM size.
> Signed-off-by: Philippe Schenker <philippe.schenker@toradex.com>
> Reviewed-by: Francesco Dolcini <francesco.dolcini@toradex.com>
> Acked-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Applied to u-boot-imx, master, thanks !

Best regards,
Stefano Babic

-- 
=====================================================================
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic@denx.de
=====================================================================

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

* [PATCH 2/2] board: apalis-imx8: add new 8gb product variant
  2022-05-09 16:58 ` [PATCH 2/2] board: apalis-imx8: add new 8gb product variant Philippe Schenker
  2022-05-10 15:39   ` Marcel Ziswiler
  2022-05-25  8:12   ` Marcel Ziswiler
@ 2022-06-15 11:11   ` sbabic
  2 siblings, 0 replies; 9+ messages in thread
From: sbabic @ 2022-06-15 11:11 UTC (permalink / raw)
  To: Philippe Schenker, u-boot

> From: Philippe Schenker <philippe.schenker@toradex.com>
> Add the new Apalis iMX8 product variant
> 0067: Apalis iMX8 QuadMax 8GB Wi-Fi / BT IT
> the only difference to the product
> 0037 Apalis iMX8 QuadMax 4GB Wi-Fi / BT IT
> is the 8gb of RAM. Toradex strategy to choose the correct RAM timing in
> SCFW is by fuses in the user area telling which RAM timing to load.
> This commit makes use of this information to set the correct size of
> the RAM and therefore distinguish between the new 0067 and 0037 product
> Signed-off-by: Philippe Schenker <philippe.schenker@toradex.com>
> Reviewed-by: Francesco Dolcini <francesco.dolcini@toradex.com>
> Acked-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Applied to u-boot-imx, master, thanks !

Best regards,
Stefano Babic

-- 
=====================================================================
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic@denx.de
=====================================================================

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

end of thread, other threads:[~2022-06-15 11:12 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-09 16:58 [PATCH 1/2] toradex: tdx-cfg-block: add new 8gb apalis-imx8 Philippe Schenker
2022-05-09 16:58 ` [PATCH 2/2] board: apalis-imx8: add new 8gb product variant Philippe Schenker
2022-05-10 15:39   ` Marcel Ziswiler
2022-05-25  8:12   ` Marcel Ziswiler
2022-06-15 11:11   ` sbabic
2022-05-10 15:38 ` [PATCH 1/2] toradex: tdx-cfg-block: add new 8gb apalis-imx8 Marcel Ziswiler
2022-05-25  8:12 ` Marcel Ziswiler
2022-05-25  8:40   ` Stefano Babic
2022-06-15 11:11 ` sbabic

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.