aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarek Vasut <marex@denx.de>2021-11-13 03:26:39 +0100
committerPatrice Chotard <patrice.chotard@foss.st.com>2021-11-30 16:43:28 +0100
commit525dd34535005ecde1cde7235c4d1d7329617248 (patch)
treef10c259940f9f2b3d9c2e65fd6eab56aa815607b
parent5e3e882cf2ef50fbad63493c7ade15b91e2ebc2c (diff)
downloadu-boot-525dd34535005ecde1cde7235c4d1d7329617248.zip
u-boot-525dd34535005ecde1cde7235c4d1d7329617248.tar.gz
u-boot-525dd34535005ecde1cde7235c4d1d7329617248.tar.bz2
ARM: stm32: Fix SoM and board coding strap GPIO handling on DHSOM
The variables retaining the strap values have to be initialized, always, make it so. Moreover, free the requested GPIO list at the end to avoid wasting memory. Signed-off-by: Marek Vasut <marex@denx.de> Cc: Patrice Chotard <patrice.chotard@foss.st.com> Cc: Patrick Delaunay <patrick.delaunay@foss.st.com> Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com> Reviewed-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
-rw-r--r--board/dhelectronics/dh_stm32mp1/board.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/board/dhelectronics/dh_stm32mp1/board.c b/board/dhelectronics/dh_stm32mp1/board.c
index a8402e2..f44afb0 100644
--- a/board/dhelectronics/dh_stm32mp1/board.c
+++ b/board/dhelectronics/dh_stm32mp1/board.c
@@ -212,34 +212,40 @@ static void board_get_coding_straps(void)
ofnode node;
int i, ret;
+ brdcode = 0;
+ ddr3code = 0;
+ somcode = 0;
+
node = ofnode_path("/config");
if (!ofnode_valid(node)) {
printf("%s: no /config node?\n", __func__);
return;
}
- brdcode = 0;
- ddr3code = 0;
- somcode = 0;
-
ret = gpio_request_list_by_name_nodev(node, "dh,som-coding-gpios",
gpio, ARRAY_SIZE(gpio),
GPIOD_IS_IN);
for (i = 0; i < ret; i++)
somcode |= !!dm_gpio_get_value(&(gpio[i])) << i;
+ gpio_free_list_nodev(gpio, ret);
+
ret = gpio_request_list_by_name_nodev(node, "dh,ddr3-coding-gpios",
gpio, ARRAY_SIZE(gpio),
GPIOD_IS_IN);
for (i = 0; i < ret; i++)
ddr3code |= !!dm_gpio_get_value(&(gpio[i])) << i;
+ gpio_free_list_nodev(gpio, ret);
+
ret = gpio_request_list_by_name_nodev(node, "dh,board-coding-gpios",
gpio, ARRAY_SIZE(gpio),
GPIOD_IS_IN);
for (i = 0; i < ret; i++)
brdcode |= !!dm_gpio_get_value(&(gpio[i])) << i;
+ gpio_free_list_nodev(gpio, ret);
+
printf("Code: SoM:rev=%d,ddr3=%d Board:rev=%d\n",
somcode, ddr3code, brdcode);
}