Skip to content

Commit 159c553

Browse files
jannaumarcan
authored andcommitted
kboot: Call dt_set_dcp_firmware() from dt_carveout_reserved_regions()
This avoids having duplicate calls for dcpext* on each mayor SoC variant. Fixes setting firmware versions for dcpext on t8103 and t8112. Signed-off-by: Janne Grunau <[email protected]>
1 parent 2abf2b1 commit 159c553

1 file changed

Lines changed: 35 additions & 38 deletions

File tree

src/kboot.c

Lines changed: 35 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -986,6 +986,37 @@ static int dt_device_set_reserved_mem(int node, dart_dev_t *dart, const char *na
986986
return 0;
987987
}
988988

989+
static int dt_set_dcp_firmware(const char *alias)
990+
{
991+
const char *path = fdt_get_alias(dt, alias);
992+
993+
if (!path)
994+
return 0;
995+
996+
int node = fdt_path_offset(dt, path);
997+
if (node < 0)
998+
return 0;
999+
1000+
if (firmware_set_fdt(dt, node, "apple,firmware-version", &os_firmware) < 0)
1001+
bail("FDT: Could not set apple,firmware-version for %s\n", path);
1002+
1003+
const struct fw_version_info *compat;
1004+
1005+
switch (os_firmware.version) {
1006+
case V12_4:
1007+
compat = &fw_versions[V12_3];
1008+
break;
1009+
default:
1010+
compat = &os_firmware;
1011+
break;
1012+
}
1013+
1014+
if (firmware_set_fdt(dt, node, "apple,firmware-compat", compat) < 0)
1015+
bail("FDT: Could not set apple,firmware-compat for %s\n", path);
1016+
1017+
return 0;
1018+
}
1019+
9891020
struct disp_mapping {
9901021
char region_adt[24];
9911022
char mem_fdt[24];
@@ -1013,6 +1044,10 @@ static int dt_carveout_reserved_regions(const char *dcp_alias, const char *disp_
10131044
if (!fdt_get_alias(dt, dcp_alias))
10141045
return 0;
10151046

1047+
ret = dt_set_dcp_firmware(dcp_alias);
1048+
if (ret)
1049+
return ret;
1050+
10161051
int node = adt_path_offset(adt, "/chosen/carveout-memory-map");
10171052
if (node < 0)
10181053
bail("ADT: '/chosen/carveout-memory-map' not found\n");
@@ -1268,37 +1303,6 @@ static struct disp_mapping dcpext_reserved_regions_t600x[MAX_DCPEXT][2] = {
12681303

12691304
#define ARRAY_SIZE(s) (sizeof(s) / sizeof((s)[0]))
12701305

1271-
static int dt_set_dcp_firmware(const char *alias)
1272-
{
1273-
const char *path = fdt_get_alias(dt, alias);
1274-
1275-
if (!path)
1276-
return 0;
1277-
1278-
int node = fdt_path_offset(dt, path);
1279-
if (node < 0)
1280-
return 0;
1281-
1282-
if (firmware_set_fdt(dt, node, "apple,firmware-version", &os_firmware) < 0)
1283-
bail("FDT: Could not set apple,firmware-version for %s\n", path);
1284-
1285-
const struct fw_version_info *compat;
1286-
1287-
switch (os_firmware.version) {
1288-
case V12_4:
1289-
compat = &fw_versions[V12_3];
1290-
break;
1291-
default:
1292-
compat = &os_firmware;
1293-
break;
1294-
}
1295-
1296-
if (firmware_set_fdt(dt, node, "apple,firmware-compat", compat) < 0)
1297-
bail("FDT: Could not set apple,firmware-compat for %s\n", path);
1298-
1299-
return 0;
1300-
}
1301-
13021306
static int dt_set_display(void)
13031307
{
13041308
/* lock dart-disp0 to prevent old software from resetting it */
@@ -1313,10 +1317,6 @@ static int dt_set_display(void)
13131317

13141318
int ret = 0;
13151319

1316-
ret = dt_set_dcp_firmware("dcp");
1317-
if (ret)
1318-
return ret;
1319-
13201320
if (!fdt_node_check_compatible(dt, 0, "apple,t8103")) {
13211321
ret = dt_carveout_reserved_regions("dcp", "disp0", "disp0_piodma",
13221322
disp_reserved_regions_t8103,
@@ -1348,9 +1348,6 @@ static int dt_set_display(void)
13481348
char dcpext_alias[16];
13491349

13501350
snprintf(dcpext_alias, sizeof(dcpext_alias), "dcpext%d", n);
1351-
ret = dt_set_dcp_firmware(dcpext_alias);
1352-
if (ret)
1353-
break;
13541351
ret = dt_carveout_reserved_regions(dcpext_alias, NULL, NULL,
13551352
dcpext_reserved_regions_t600x[n],
13561353
ARRAY_SIZE(dcpext_reserved_regions_t600x[n]));

0 commit comments

Comments
 (0)