]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
arm: mvebu: clearfog: read number of ddr channels from tlv data
authorJosua Mayer <josua@solid-run.com>
Sun, 8 Oct 2023 14:58:03 +0000 (16:58 +0200)
committerStefan Roese <sr@denx.de>
Mon, 16 Oct 2023 12:00:45 +0000 (14:00 +0200)
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.

Signed-off-by: Josua Mayer <josua@solid-run.com>
Reviewed-by: Stefan Roese <sr@denx.de>
board/solidrun/clearfog/clearfog.c
board/solidrun/common/tlv_data.c
board/solidrun/common/tlv_data.h

index 6edb4221551143bb201321d2caa8eab922cccfe7..4f4532b537e56353f4c772b61307e8c4b6d17e79 100644 (file)
@@ -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;
 }
index 11d6e4a13807c2393856a2b757de554424921e12..cf5824886c37d873c2ff39c35a3053120b076130 100644 (file)
@@ -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,
index a1432e4b8e1d44576dd3d372387a2506c972d2c3..be3f782ac4acf84d0370e22408990838bb147a1a 100644 (file)
@@ -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);