uclient: update to Git HEAD (2024-04-18)
[openwrt/staging/blocktrron.git] / package / boot / uboot-mvebu / patches / 0004-arm-mvebu-clearfog-read-number-of-ddr-channels-from-.patch
1 From 1dbc6d3739869af38e6157cd8b9bc4314ca3c9fe Mon Sep 17 00:00:00 2001
2 From: Josua Mayer <josua@solid-run.com>
3 Date: Mon, 18 Jul 2022 20:04:54 +0300
4 Subject: [PATCH 1/2] arm: mvebu: clearfog: read number of ddr channels from
5 tlv data
6
7 Extend the existing tlv vendor extension used for ram size by one byte to
8 also store the number of ddr channels.
9 The length of the tlv entry can indicate whether the new information is
10 present. If not default to single channel.
11
12 Signed-off-by: Josua Mayer <josua@solid-run.com>
13 ---
14 board/solidrun/clearfog/clearfog.c | 14 +++++++++++++-
15 board/solidrun/common/tlv_data.c | 7 ++++++-
16 board/solidrun/common/tlv_data.h | 1 +
17 3 files changed, 20 insertions(+), 2 deletions(-)
18
19 diff --git a/board/solidrun/clearfog/clearfog.c b/board/solidrun/clearfog/clearfog.c
20 index 6edb4221551..4f4532b537e 100644
21 --- a/board/solidrun/clearfog/clearfog.c
22 +++ b/board/solidrun/clearfog/clearfog.c
23 @@ -36,7 +36,7 @@ DECLARE_GLOBAL_DATA_PTR;
24 #define BOARD_GPP_POL_LOW 0x0
25 #define BOARD_GPP_POL_MID 0x0
26
27 -static struct tlv_data cf_tlv_data;
28 +static struct tlv_data cf_tlv_data = { 0 };
29
30 static void cf_read_tlv_data(void)
31 {
32 @@ -168,6 +168,18 @@ struct mv_ddr_topology_map *mv_ddr_topology_map_get(void)
33 break;
34 }
35
36 + switch (cf_tlv_data.ram_channels) {
37 + default:
38 + case 1:
39 + for (uint8_t i = 0; i < 5; i++)
40 + ifp->as_bus_params[i].cs_bitmask = 0x1;
41 + break;
42 + case 2:
43 + for (uint8_t i = 0; i < 5; i++)
44 + ifp->as_bus_params[i].cs_bitmask = 0x3;
45 + break;
46 + }
47 +
48 /* Return the board topology as defined in the board code */
49 return &board_topology_map;
50 }
51 diff --git a/board/solidrun/common/tlv_data.c b/board/solidrun/common/tlv_data.c
52 index 11d6e4a1380..cf5824886c3 100644
53 --- a/board/solidrun/common/tlv_data.c
54 +++ b/board/solidrun/common/tlv_data.c
55 @@ -45,9 +45,14 @@ static void parse_tlv_vendor_ext(struct tlvinfo_tlv *tlv_entry,
56
57 if (val[4] != SR_TLV_CODE_RAM_SIZE)
58 return;
59 - if (tlv_entry->length != 6)
60 + if (tlv_entry->length < 6)
61 return;
62 td->ram_size = val[5];
63 +
64 + /* extension with additional data field for number of ddr channels */
65 + if (tlv_entry->length >= 7) {
66 + td->ram_channels = val[6];
67 + }
68 }
69
70 static void parse_tlv_data(u8 *eeprom, struct tlvinfo_header *hdr,
71 diff --git a/board/solidrun/common/tlv_data.h b/board/solidrun/common/tlv_data.h
72 index a1432e4b8e1..be3f782ac4a 100644
73 --- a/board/solidrun/common/tlv_data.h
74 +++ b/board/solidrun/common/tlv_data.h
75 @@ -10,6 +10,7 @@ struct tlv_data {
76 /* Store product name of both SOM and carrier */
77 char tlv_product_name[2][32];
78 unsigned int ram_size;
79 + uint8_t ram_channels;
80 };
81
82 void read_tlv_data(struct tlv_data *td);
83 --
84 2.35.3
85