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

Patrice CHOTARD patrice.chotard at st.com
Mon Mar 18 16:59:52 UTC 2019


Hi Marek

+Patrick

On 3/14/19 1:00 PM, Marek Vasut wrote:
> On 3/14/19 11:51 AM, Patrice Chotard wrote:
>> 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;
> 
> This should be in the driver , not board code.

Ok, Patrick Delaunay will rework the dwc2 gadget driver to be able to
retrieve device tree properties.
The series will be sent soon.

> 
>>  	/* Enable voltage level detector */
>>  	if (!(fdtdec_parse_phandle_with_args(blob, node, "usb33d-supply",
>>  					     NULL, 0, 0, &args))) {
>>
> 
> 

Thanks

Patrice


More information about the U-Boot mailing list