Skip to contentSkip to conversation

arm: mvebu: clearfog: support additional ddr

PATCH In review Josua Mayer 2 participants 7 messages Oct 8, 2023 – Oct 16, 2023

lore
Share & tools
lore
#0 lore raw

cover arm: mvebu: clearfog: support additional ddr

This series adds support for additional memory configuration that were been produced in the past - most notably
a dual-channel configuration with two 512MB modules.

Josua Mayer (2):
arm: mvebu: clearfog: read number of ddr channels from tlv data
arm: mvebu: clearfog: support 512MB memory size from tlv eeprom

 board/solidrun/clearfog/clearfog.c | 17 ++++++++++++++++-
 board/solidrun/common/tlv_data.c   |  7 ++++++-
 board/solidrun/common/tlv_data.h   |  1 +
 3 files changed, 23 insertions(+), 2 deletions(-)
Signature · 1 line
2.35.3
#1 lore raw

PATCH 1/2 arm: mvebu: clearfog: read number of ddr channels from tlv data

Extend the existing tlv vendor extension used for ram size by one byte to also store the number of ddr channels.
The length of the tlv entry can indicate whether the new information is present. If not default to single channel.

---
 board/solidrun/clearfog/clearfog.c | 14 +++++++++++++-
 board/solidrun/common/tlv_data.c   |  7 ++++++-
 board/solidrun/common/tlv_data.h   |  1 +
 3 files changed, 20 insertions(+), 2 deletions(-)
board/solidrun/clearfog/clearfog.c +13 -1
index 6edb4221551..4f4532b537e 100644
@@ -36,7 +36,7 @@ DECLARE_GLOBAL_DATA_PTR;
 #define BOARD_GPP_POL_LOW	0x0
 #define BOARD_GPP_POL_MID	0x0
 
-static struct tlv_data cf_tlv_data;
+static struct tlv_data cf_tlv_data = { 0 };
 
 static void cf_read_tlv_data(void)
 {
@@ -168,6 +168,18 @@ struct mv_ddr_topology_map *mv_ddr_topology_map_get(void)
 		break;
 	}
 
+	switch (cf_tlv_data.ram_channels) {
+	default:
+	case 1:
+		for (uint8_t i = 0; i < 5; i++)
+			ifp->as_bus_params[i].cs_bitmask = 0x1;
+		break;
+	case 2:
+		for (uint8_t i = 0; i < 5; i++)
+			ifp->as_bus_params[i].cs_bitmask = 0x3;
+		break;
+	}
+
 	/* Return the board topology as defined in the board code */
 	return &board_topology_map;
 }
board/solidrun/common/tlv_data.c +6 -1
index 11d6e4a1380..cf5824886c3 100644
@@ -45,9 +45,14 @@ static void parse_tlv_vendor_ext(struct tlvinfo_tlv *tlv_entry,
 
 	if (val[4] != SR_TLV_CODE_RAM_SIZE)
 		return;
-	if (tlv_entry->length != 6)
+	if (tlv_entry->length < 6)
 		return;
 	td->ram_size = val[5];
+
+	/* extension with additional data field for number of ddr channels */
+	if (tlv_entry->length >= 7) {
+		td->ram_channels = val[6];
+	}
 }
 
 static void parse_tlv_data(u8 *eeprom, struct tlvinfo_header *hdr,
board/solidrun/common/tlv_data.h +1 -0
index a1432e4b8e1..be3f782ac4a 100644
@@ -10,6 +10,7 @@ struct tlv_data {
 	/* Store product name of both SOM and carrier */
 	char tlv_product_name[2][32];
 	unsigned int ram_size;
+	uint8_t ram_channels;
 };
 
 void read_tlv_data(struct tlv_data *td);
Signature · 1 line
2.35.3
Reviewed-by on v1 1/2
#2 lore raw

Re: [PATCH 1/2] arm: mvebu: clearfog: read number of ddr channels from tlv data

Quoted 6 lines · Josua Mayer

Extend the existing tlv vendor extension used for ram size by one byte to also store the number of ddr channels.
The length of the tlv entry can indicate whether the new information is present. If not default to single channel.

Thanks,
Stefan

Quoted 63 lines
---
  board/solidrun/clearfog/clearfog.c | 14 +++++++++++++-
  board/solidrun/common/tlv_data.c   |  7 ++++++-
  board/solidrun/common/tlv_data.h   |  1 +
  3 files changed, 20 insertions(+), 2 deletions(-)
board/solidrun/clearfog/clearfog.c +13 -1
index 6edb4221551..4f4532b537e 100644
@@ -36,7 +36,7 @@ DECLARE_GLOBAL_DATA_PTR;
  #define BOARD_GPP_POL_LOW	0x0
  #define BOARD_GPP_POL_MID	0x0
 
-static struct tlv_data cf_tlv_data;
+static struct tlv_data cf_tlv_data = { 0 };
 
  static void cf_read_tlv_data(void)
  {
@@ -168,6 +168,18 @@ struct mv_ddr_topology_map *mv_ddr_topology_map_get(void)
  		break;
  	}
 
+	switch (cf_tlv_data.ram_channels) {
+	default:
+	case 1:
+		for (uint8_t i = 0; i < 5; i++)
+			ifp->as_bus_params[i].cs_bitmask = 0x1;
+		break;
+	case 2:
+		for (uint8_t i = 0; i < 5; i++)
+			ifp->as_bus_params[i].cs_bitmask = 0x3;
+		break;
+	}
+
  	/* Return the board topology as defined in the board code */
  	return &board_topology_map;
  }
board/solidrun/common/tlv_data.c +6 -1
index 11d6e4a1380..cf5824886c3 100644
@@ -45,9 +45,14 @@ static void parse_tlv_vendor_ext(struct tlvinfo_tlv *tlv_entry,
 
  	if (val[4] != SR_TLV_CODE_RAM_SIZE)
  		return;
-	if (tlv_entry->length != 6)
+	if (tlv_entry->length < 6)
  		return;
  	td->ram_size = val[5];
+
+	/* extension with additional data field for number of ddr channels */
+	if (tlv_entry->length >= 7) {
+		td->ram_channels = val[6];
+	}
  }
 
  static void parse_tlv_data(u8 *eeprom, struct tlvinfo_header *hdr,
board/solidrun/common/tlv_data.h +0 -0
index a1432e4b8e1..be3f782ac4a 100644

board/solidrun/common/tlv_data.h struct tlv_data { · line 16

Quoted 7 lines
board/solidrun/common/tlv_data.h +1 -0
@@ -10,6 +10,7 @@ struct tlv_data {
  	/* Store product name of both SOM and carrier */
  	char tlv_product_name[2][32];
  	unsigned int ram_size;
+	uint8_t ram_channels;
  };
 
  void read_tlv_data(struct tlv_data *td);

Viele Grüße,
Stefan Roese

Signature · 3 lines
DENX Software Engineering GmbH,      Managing Director: Erika Unter
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-51 Fax: (+49)-8142-66989-80 Email: [email protected]
#3 lore raw

Re: [PATCH 1/2] arm: mvebu: clearfog: read number of ddr channels from tlv data

Quoted 9 lines · Stefan Roese
Quoted 6 lines · Josua Mayer

Extend the existing tlv vendor extension used for ram size by one byte to also store the number of ddr channels.
The length of the tlv entry can indicate whether the new information is present. If not default to single channel.

Applied to u-boot-marvell/master

Thanks,
Stefan

Quoted 65 lines

Thanks,
Stefan

Quoted 62 lines

---
  board/solidrun/clearfog/clearfog.c | 14 +++++++++++++- board/solidrun/common/tlv_data.c   |  7 ++++++- board/solidrun/common/tlv_data.h   |  1 +

  3 files changed, 20 insertions(+), 2 deletions(-)
board/solidrun/clearfog/clearfog.c +13 -1
index 6edb4221551..4f4532b537e 100644
@@ -36,7 +36,7 @@ DECLARE_GLOBAL_DATA_PTR;
   #define BOARD_GPP_POL_LOW    0x0
   #define BOARD_GPP_POL_MID    0x0
-static struct tlv_data cf_tlv_data;
+static struct tlv_data cf_tlv_data = { 0 };
   static void cf_read_tlv_data(void)
   {
@@ -168,6 +168,18 @@ struct mv_ddr_topology_map 
 *mv_ddr_topology_map_get(void)
           break;
       }
+    switch (cf_tlv_data.ram_channels) {
+    default:
+    case 1:
+        for (uint8_t i = 0; i < 5; i++)
+            ifp->as_bus_params[i].cs_bitmask = 0x1;
+        break;
+    case 2:
+        for (uint8_t i = 0; i < 5; i++)
+            ifp->as_bus_params[i].cs_bitmask = 0x3;
+        break;
+    }
+
       /* Return the board topology as defined in the board code */
       return &board_topology_map;
   }
board/solidrun/common/tlv_data.c +3 -1
index 11d6e4a1380..cf5824886c3 100644
@@ -45,9 +45,14 @@ static void parse_tlv_vendor_ext(struct tlvinfo_tlv 
 *tlv_entry,
       if (val[4] != SR_TLV_CODE_RAM_SIZE)
           return;
-    if (tlv_entry->length != 6)
+    if (tlv_entry->length < 6)
           return;
       td->ram_size = val[5];
+
+    /* extension with additional data field for number of ddr 

channels */
+    if (tlv_entry->length >= 7) {
+        td->ram_channels = val[6];
+    }
  }
  static void parse_tlv_data(u8 *eeprom, struct tlvinfo_header *hdr,

board/solidrun/common/tlv_data.h +0 -0
index a1432e4b8e1..be3f782ac4a 100644
@@ -10,6 +10,7 @@ struct tlv_data {
       /* Store product name of both SOM and carrier */
Quoted 9 lines

board/solidrun/common/tlv_data.h struct tlv_data { · line 16

Quoted 5 lines
board/solidrun/common/tlv_data.h +1 -0
       char tlv_product_name[2][32];
       unsigned int ram_size;
+    uint8_t ram_channels;
   };
   void read_tlv_data(struct tlv_data *td);

Viele Grüße,
Stefan Roese

Viele Grüße,
Stefan Roese

Signature · 3 lines
DENX Software Engineering GmbH,      Managing Director: Erika Unter
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-51 Fax: (+49)-8142-66989-80 Email: [email protected]
#4 lore raw

PATCH 2/2 arm: mvebu: clearfog: support 512MB memory size from tlv eeprom

In reply to Josua Mayer

Handle 2GBit memory size value "2" from tlv eeprom on ddr initialisation, to support SoMs with 512MB ddr memory.

---
 board/solidrun/clearfog/clearfog.c | 3 +++
 1 file changed, 3 insertions(+)
board/solidrun/clearfog/clearfog.c +3 -0
index 4f4532b537e..6fa2fe5fe3e 100644
@@ -159,6 +159,9 @@ struct mv_ddr_topology_map *mv_ddr_topology_map_get(void)
 	cf_read_tlv_data();
 
 	switch (cf_tlv_data.ram_size) {
+	case 2:
+		ifp->memory_size = MV_DDR_DIE_CAP_2GBIT;
+		break;
 	case 4:
 	default:
 		ifp->memory_size = MV_DDR_DIE_CAP_4GBIT;
Signature · 1 line
2.35.3
Reviewed-by on v1 2/2
#5 lore raw

Re: [PATCH 2/2] arm: mvebu: clearfog: support 512MB memory size from tlv eeprom

Quoted 4 lines · Josua Mayer

Handle 2GBit memory size value "2" from tlv eeprom on ddr initialisation, to support SoMs with 512MB ddr memory.

Thanks,
Stefan

Quoted 9 lines
---
  board/solidrun/clearfog/clearfog.c | 3 +++
  1 file changed, 3 insertions(+)
board/solidrun/clearfog/clearfog.c +0 -0
index 4f4532b537e..6fa2fe5fe3e 100644

board/solidrun/clearfog/clearfog.c struct mv_ddr_topology_map *mv_ddr_topology_map_get(void) · line 167

Quoted 9 lines
board/solidrun/clearfog/clearfog.c +3 -0
@@ -159,6 +159,9 @@ struct mv_ddr_topology_map *mv_ddr_topology_map_get(void)
  	cf_read_tlv_data();
 
  	switch (cf_tlv_data.ram_size) {
+	case 2:
+		ifp->memory_size = MV_DDR_DIE_CAP_2GBIT;
+		break;
  	case 4:
  	default:
  		ifp->memory_size = MV_DDR_DIE_CAP_4GBIT;

Viele Grüße,
Stefan Roese

Signature · 3 lines
DENX Software Engineering GmbH,      Managing Director: Erika Unter
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-51 Fax: (+49)-8142-66989-80 Email: [email protected]
#6 lore raw

Re: [PATCH 2/2] arm: mvebu: clearfog: support 512MB memory size from tlv eeprom

Quoted 7 lines · Stefan Roese
Quoted 4 lines · Josua Mayer

Handle 2GBit memory size value "2" from tlv eeprom on ddr initialisation, to support SoMs with 512MB ddr memory.

Applied to u-boot-marvell/master

Thanks,
Stefan

Quoted 16 lines

Thanks,
Stefan

Quoted 13 lines

---
  board/solidrun/clearfog/clearfog.c | 3 +++

  1 file changed, 3 insertions(+)
board/solidrun/clearfog/clearfog.c +1 -0
index 4f4532b537e..6fa2fe5fe3e 100644
@@ -159,6 +159,9 @@ struct mv_ddr_topology_map 
 *mv_ddr_topology_map_get(void)
       cf_read_tlv_data();
       switch (cf_tlv_data.ram_size) {
+    case 2:
Quoted 9 lines
Quoted 5 lines
board/solidrun/clearfog/clearfog.c +2 -0
+        ifp->memory_size = MV_DDR_DIE_CAP_2GBIT;
+        break;

      case 4:
      default:
          ifp->memory_size = MV_DDR_DIE_CAP_4GBIT;

Viele Grüße,
Stefan Roese

Viele Grüße,
Stefan Roese

Signature · 3 lines
DENX Software Engineering GmbH,      Managing Director: Erika Unter
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-51 Fax: (+49)-8142-66989-80 Email: [email protected]