On 03/10/2017 11:16, Lukasz Majewski 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 <[email protected]>
> ---
>
> drivers/serial/serial_mxc.c | 7 +++++++
> 1 file changed, 7 insertions(+)
>
> diff --git a/drivers/serial/serial_mxc.c b/drivers/serial/serial_mxc.c
> index cce80a8..ef4eb12 100644
> --- a/drivers/serial/serial_mxc.c
> +++ b/drivers/serial/serial_mxc.c
> @@ -141,6 +141,13 @@ struct mxc_uart {
>
> static void _mxc_serial_init(struct mxc_uart *base)
> {
> + /*
> + * Wait for any ongoing transmission to finish - for example
> + * from pre-relocation enabled UART
> + */
> + while (!(readl(&base->sr2) & USR2_TXDC))
> + ;
Yes, the same is in kernel, too.
Reviewed-by: Stefano Babic <[email protected]>
Best regards,
Stefano Babic
--
=====================================================================
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: [email protected]
=====================================================================
_______________________________________________
U-Boot mailing list
[email protected]
https://lists.denx.de/listinfo/u-boot