[U-Boot] [RESEND][PATCH v1 3/4] board: stm32mp1: Add tx_fifo_sz_array support

Patrice Chotard patrice.chotard at st.com
Thu Mar 14 10:51:13 UTC 2019


Allows to use an array of tx-fifo-size defined in device tree
as following:
   g-tx-fifo-size = <128 128 64 64 64 64 32 32>;

Signed-off-by: Patrice Chotard <patrice.chotard at st.com>
---

 board/st/stm32mp1/stm32mp1.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/board/st/stm32mp1/stm32mp1.c b/board/st/stm32mp1/stm32mp1.c
index 54feca0ecff5..81c080ff3199 100644
--- a/board/st/stm32mp1/stm32mp1.c
+++ b/board/st/stm32mp1/stm32mp1.c
@@ -42,6 +42,7 @@ int board_usb_init(int index, enum usb_init_type init)
 	int node;
 	int phy_provider;
 	int ret;
+	int count;
 
 	/* find the usb otg node */
 	node = fdt_node_offset_by_compatible(blob, -1, "snps,dwc2");
@@ -138,8 +139,14 @@ int board_usb_init(int index, enum usb_init_type init)
 						     "g-rx-fifo-size", 0);
 	stm32mp_otg_data.np_tx_fifo_sz = fdtdec_get_int(blob, node,
 							"g-np-tx-fifo-size", 0);
-	stm32mp_otg_data.tx_fifo_sz = fdtdec_get_int(blob, node,
-						     "g-tx-fifo-size", 0);
+
+	count = fdtdec_get_int_array_count(blob, node, "g-tx-fifo-size",
+			&stm32mp_otg_data.tx_fifo_sz_array[DWC2_SIZE_OFFS],
+			ARRAY_SIZE(stm32mp_otg_data.tx_fifo_sz_array));
+
+	if (count != -FDT_ERR_NOTFOUND)
+		stm32mp_otg_data.tx_fifo_sz_array[DWC2_SIZE_NB_OFFS] = count;
+
 	/* Enable voltage level detector */
 	if (!(fdtdec_parse_phandle_with_args(blob, node, "usb33d-supply",
 					     NULL, 0, 0, &args))) {
-- 
1.9.1



More information about the U-Boot mailing list