public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] [PATCH] dm: serial: Initialize serial console only when it wasn't already configured
@ 2018-01-25 17:24 Lukasz Majewski
  2018-01-26  9:56 ` Stefan Roese
  2018-02-02 22:47 ` Lukasz Majewski
  0 siblings, 2 replies; 3+ messages in thread
From: Lukasz Majewski @ 2018-01-25 17:24 UTC (permalink / raw)
  To: u-boot

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 avoiding re-initialization of
serial IP block (and execution of the same code twice).

I2C:   ready
DRAM:  1 GiB
ID:    unit type 0x4 rev 0x0

This patch is a follow up of following discussions:
http://patchwork.ozlabs.org/patch/820824/
http://patchwork.ozlabs.org/patch/830957/


Signed-off-by: Lukasz Majewski <lukma@denx.de>

---

 drivers/serial/serial-uclass.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/serial/serial-uclass.c b/drivers/serial/serial-uclass.c
index 2e5116f7ce..c345578b36 100644
--- a/drivers/serial/serial-uclass.c
+++ b/drivers/serial/serial-uclass.c
@@ -129,6 +129,9 @@ static void serial_find_console_or_panic(void)
 /* Called prior to relocation */
 int serial_init(void)
 {
+	if (gd->flags & GD_FLG_SERIAL_READY)
+		return 0;
+
 	serial_find_console_or_panic();
 	gd->flags |= GD_FLG_SERIAL_READY;
 
-- 
2.11.0

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [U-Boot] [PATCH] dm: serial: Initialize serial console only when it wasn't already configured
  2018-01-25 17:24 [U-Boot] [PATCH] dm: serial: Initialize serial console only when it wasn't already configured Lukasz Majewski
@ 2018-01-26  9:56 ` Stefan Roese
  2018-02-02 22:47 ` Lukasz Majewski
  1 sibling, 0 replies; 3+ messages in thread
From: Stefan Roese @ 2018-01-26  9:56 UTC (permalink / raw)
  To: u-boot

On 25.01.2018 18:24, 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 avoiding re-initialization of
> serial IP block (and execution of the same code twice).
> 
> I2C:   ready
> DRAM:  1 GiB
> ID:    unit type 0x4 rev 0x0
> 
> This patch is a follow up of following discussions:
> http://patchwork.ozlabs.org/patch/820824/
> http://patchwork.ozlabs.org/patch/830957/
> 
> 
> Signed-off-by: Lukasz Majewski <lukma@denx.de>

Reviewed-by: Stefan Roese <sr@denx.de>

Thanks,
Stefan

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [U-Boot] [PATCH] dm: serial: Initialize serial console only when it wasn't already configured
  2018-01-25 17:24 [U-Boot] [PATCH] dm: serial: Initialize serial console only when it wasn't already configured Lukasz Majewski
  2018-01-26  9:56 ` Stefan Roese
@ 2018-02-02 22:47 ` Lukasz Majewski
  1 sibling, 0 replies; 3+ messages in thread
From: Lukasz Majewski @ 2018-02-02 22:47 UTC (permalink / raw)
  To: u-boot

Dear All,

> 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 avoiding
> re-initialization of serial IP block (and execution of the same code
> twice).
> 
> I2C:   ready
> DRAM:  1 GiB
> ID:    unit type 0x4 rev 0x0
> 
> This patch is a follow up of following discussions:
> http://patchwork.ozlabs.org/patch/820824/
> http://patchwork.ozlabs.org/patch/830957/
> 
> 
> Signed-off-by: Lukasz Majewski <lukma@denx.de>

After some excessive testing it turned out that this patch is not
behaving as expected.

Please drop it. I will find another, better solution for this issue.

Sorry for trouble.

> 
> ---
> 
>  drivers/serial/serial-uclass.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/drivers/serial/serial-uclass.c
> b/drivers/serial/serial-uclass.c index 2e5116f7ce..c345578b36 100644
> --- a/drivers/serial/serial-uclass.c
> +++ b/drivers/serial/serial-uclass.c
> @@ -129,6 +129,9 @@ static void serial_find_console_or_panic(void)
>  /* Called prior to relocation */
>  int serial_init(void)
>  {
> +	if (gd->flags & GD_FLG_SERIAL_READY)
> +		return 0;
> +
>  	serial_find_console_or_panic();
>  	gd->flags |= GD_FLG_SERIAL_READY;
>  




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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 488 bytes
Desc: OpenPGP digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20180202/2bda7d32/attachment.sig>

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-02-02 22:47 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-01-25 17:24 [U-Boot] [PATCH] dm: serial: Initialize serial console only when it wasn't already configured Lukasz Majewski
2018-01-26  9:56 ` Stefan Roese
2018-02-02 22:47 ` Lukasz Majewski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox