[U-Boot] [PATCH] imx: serial: Wait for ongoing transmission to finish before serial reset

Łukasz Majewski lukma at denx.de
Mon Oct 9 10:46:18 UTC 2017


Hi Simon,

> Hi Lukasz,
> 
> On 3 October 2017 at 03:16, Lukasz Majewski <lukma at denx.de> wrote:
>> It may happen that the MXC serial IP block is performing some ongoing
>> transmission (started at e.g. board_init()) when the "initr_serial" is
>> called.
>>
>> As a result the serial port IP block is reset, so transmitted data is
>> corrupted:
>>
>> I2C:   ready
>> DRAM:  1 GiB
>> jSS('HH��SL_SDHC: 04 rev 0x0
>>
>> This patch prevents from this situation, by waiting for transmission
>> complete bit set (UART Status Register 2 (UARTx_USR2), bit TXDC):
>>
>> I2C:   ready
>> DRAM:  1 GiB
>> ID:    unit type 0x4 rev 0x0
>>
>> Signed-off-by: Lukasz Majewski <lukma at denx.de>
>> ---
>>
>>   drivers/serial/serial_mxc.c | 7 +++++++
>>   1 file changed, 7 insertions(+)
> 
> Is it possible to use driver model to do this in a generic way for all
> serial drivers? The pending() method allows you to check if there are
> any characters in the output FIFO.

Please correct me if I'm wrong.

Do you mean to define pre_init() callback in serial-uclass.c file, which 
would utilize ->pending callback if available?

In that way we would have the generic facility for above check available 
on all platforms.


> 
> Regards,
> Simon
> 


-- 
Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de


More information about the U-Boot mailing list