Re: [U-Boot] [PATCH] serial: ns16550: Fix Debug UART initialization for AM335x

2016-11-11 Thread Simon Glass
Hi,

On 10 November 2016 at 04:00, Jacob Siverskog  wrote:
> Fixed the init sequence in debug_uart_init() to match the one in
> NS16550_init(). Without this I was unable to get debug UART working on
> AM335x. Based on a patch by Vasili Galka.
>
> Signed-off-by: Jacob Siverskog 
> ---
>  drivers/serial/ns16550.c | 13 +
>  1 file changed, 13 insertions(+)
>
> diff --git a/drivers/serial/ns16550.c b/drivers/serial/ns16550.c
> index 6e9b946..40fe246 100644
> --- a/drivers/serial/ns16550.c
> +++ b/drivers/serial/ns16550.c
> @@ -262,6 +262,11 @@ static inline void _debug_uart_init(void)
> baud_divisor = ns16550_calc_divisor(com_port, CONFIG_DEBUG_UART_CLOCK,
> CONFIG_BAUDRATE);
> serial_dout(&com_port->ier, CONFIG_SYS_NS16550_IER);
> +#if defined(CONFIG_OMAP) || defined(CONFIG_AM33XX) || \
> +   defined(CONFIG_TI81XX) || defined(CONFIG_AM43XX)
> +   serial_dout(&com_port->mdr1, 0x7);  /* mode select reset 
> TL16C750*/
> +#endif

This is generic code so we cannot have arch-specific #ifdefs here. You
could pass in a flags or tweaks value perhaps? That would need a
change to the function signature.

> +
> serial_dout(&com_port->mcr, UART_MCRVAL);
> serial_dout(&com_port->fcr, UART_FCRVAL);
>
> @@ -269,6 +274,14 @@ static inline void _debug_uart_init(void)
> serial_dout(&com_port->dll, baud_divisor & 0xff);
> serial_dout(&com_port->dlm, (baud_divisor >> 8) & 0xff);
> serial_dout(&com_port->lcr, UART_LCRVAL);
> +
> +#if defined(CONFIG_OMAP) || \
> +   defined(CONFIG_AM33XX) || defined(CONFIG_SOC_DA8XX) || \
> +   defined(CONFIG_TI81XX) || defined(CONFIG_AM43XX)
> +
> +   /* /16 is proper to hit 115200 with 48MHz */
> +   serial_dout(&com_port->mdr1, 0);
> +#endif /* CONFIG_OMAP */
>  }
>
>  static inline void _debug_uart_putc(int ch)
> --
> 2.10.2
>

Regards,
Simon
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH] serial: ns16550: Fix Debug UART initialization for AM335x

2016-11-10 Thread Jacob Siverskog
Fixed the init sequence in debug_uart_init() to match the one in
NS16550_init(). Without this I was unable to get debug UART working on
AM335x. Based on a patch by Vasili Galka.

Signed-off-by: Jacob Siverskog 
---
 drivers/serial/ns16550.c | 13 +
 1 file changed, 13 insertions(+)

diff --git a/drivers/serial/ns16550.c b/drivers/serial/ns16550.c
index 6e9b946..40fe246 100644
--- a/drivers/serial/ns16550.c
+++ b/drivers/serial/ns16550.c
@@ -262,6 +262,11 @@ static inline void _debug_uart_init(void)
baud_divisor = ns16550_calc_divisor(com_port, CONFIG_DEBUG_UART_CLOCK,
CONFIG_BAUDRATE);
serial_dout(&com_port->ier, CONFIG_SYS_NS16550_IER);
+#if defined(CONFIG_OMAP) || defined(CONFIG_AM33XX) || \
+   defined(CONFIG_TI81XX) || defined(CONFIG_AM43XX)
+   serial_dout(&com_port->mdr1, 0x7);  /* mode select reset TL16C750*/
+#endif
+
serial_dout(&com_port->mcr, UART_MCRVAL);
serial_dout(&com_port->fcr, UART_FCRVAL);
 
@@ -269,6 +274,14 @@ static inline void _debug_uart_init(void)
serial_dout(&com_port->dll, baud_divisor & 0xff);
serial_dout(&com_port->dlm, (baud_divisor >> 8) & 0xff);
serial_dout(&com_port->lcr, UART_LCRVAL);
+
+#if defined(CONFIG_OMAP) || \
+   defined(CONFIG_AM33XX) || defined(CONFIG_SOC_DA8XX) || \
+   defined(CONFIG_TI81XX) || defined(CONFIG_AM43XX)
+
+   /* /16 is proper to hit 115200 with 48MHz */
+   serial_dout(&com_port->mdr1, 0);
+#endif /* CONFIG_OMAP */
 }
 
 static inline void _debug_uart_putc(int ch)
-- 
2.10.2

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH] serial: ns16550: Fix Debug UART initialization for AM335x

2015-05-04 Thread Simon Glass
Hi Vasili,

On 4 May 2015 at 12:04, Vasili Galka  wrote:
> Fixed the init sequence in debug_uart_init() to match the one in
> NS16550_init(). Also, fixed the build by conditionally turning on some
> of the required code.
>
> Signed-off-by: Vasili Galka 
> ---
>  drivers/serial/ns16550.c | 20 +++-
>  1 file changed, 19 insertions(+), 1 deletion(-)

Can you please check that you are using the latest mainline?

>
> diff --git a/drivers/serial/ns16550.c b/drivers/serial/ns16550.c
> index 03beab5..7af6bd8 100644
> --- a/drivers/serial/ns16550.c
> +++ b/drivers/serial/ns16550.c
> @@ -54,7 +54,7 @@ DECLARE_GLOBAL_DATA_PTR;
>  #define CONFIG_SYS_NS16550_IER  0x00
>  #endif /* CONFIG_SYS_NS16550_IER */
>
> -#ifdef CONFIG_DM_SERIAL
> +#if defined(CONFIG_DM_SERIAL) || defined(CONFIG_DEBUG_UART_NS16550)
>
>  static inline void serial_out_shift(unsigned char *addr, int shift, int 
> value)
>  {
> @@ -85,6 +85,9 @@ static inline int serial_in_shift(unsigned char *addr, int 
> shift)
> return readb(addr);
>  #endif
>  }
> +#endif
> +
> +#if defined(CONFIG_DM_SERIAL)
>
>  static void ns16550_writeb(NS16550_t port, int offset, int value)
>  {
> @@ -255,6 +258,15 @@ void debug_uart_init(void)
> CONFIG_BAUDRATE);
>
> serial_out_shift(&com_port->ier, 0, CONFIG_SYS_NS16550_IER);
> +#if defined(CONFIG_OMAP) || defined(CONFIG_AM33XX) || \
> +   defined(CONFIG_TI81XX) || defined(CONFIG_AM43XX)
> +   serial_out_shift(&com_port->mdr1, 0, 0x7);  /* mode select reset 
> TL16C750*/
> +#endif
> +   serial_out_shift(&com_port->lcr, 0, UART_LCR_BKSE | UART_LCRVAL);
> +   serial_out_shift(&com_port->dll, 0, 0);
> +   serial_out_shift(&com_port->dlm, 0, 0);
> +   serial_out_shift(&com_port->lcr, 0, UART_LCRVAL);
> +
> serial_out_shift(&com_port->mcr, 0, UART_MCRVAL);
> serial_out_shift(&com_port->fcr, 0, UART_FCRVAL);
>
> @@ -262,6 +274,12 @@ void debug_uart_init(void)
> serial_out_shift(&com_port->dll, 0, baud_divisor & 0xff);
> serial_out_shift(&com_port->dlm, 0, (baud_divisor >> 8) & 0xff);
> serial_out_shift(&com_port->lcr, 0, UART_LCRVAL);
> +#if defined(CONFIG_OMAP) || \
> +   defined(CONFIG_AM33XX) || defined(CONFIG_SOC_DA8XX) || \
> +   defined(CONFIG_TI81XX) || defined(CONFIG_AM43XX)
> +   /* /16 is proper to hit 115200 with 48MHz */
> +   serial_out_shift(&com_port->mdr1, 0, 0);
> +#endif /* CONFIG_OMAP */
>  }
>
>  static inline void _debug_uart_putc(int ch)
> --
> 1.9.1
>

Regards,
Simon
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH] serial: ns16550: Fix Debug UART initialization for AM335x

2015-05-04 Thread Vasili Galka
Fixed the init sequence in debug_uart_init() to match the one in
NS16550_init(). Also, fixed the build by conditionally turning on some
of the required code.

Signed-off-by: Vasili Galka 
---
 drivers/serial/ns16550.c | 20 +++-
 1 file changed, 19 insertions(+), 1 deletion(-)

diff --git a/drivers/serial/ns16550.c b/drivers/serial/ns16550.c
index 03beab5..7af6bd8 100644
--- a/drivers/serial/ns16550.c
+++ b/drivers/serial/ns16550.c
@@ -54,7 +54,7 @@ DECLARE_GLOBAL_DATA_PTR;
 #define CONFIG_SYS_NS16550_IER  0x00
 #endif /* CONFIG_SYS_NS16550_IER */
 
-#ifdef CONFIG_DM_SERIAL
+#if defined(CONFIG_DM_SERIAL) || defined(CONFIG_DEBUG_UART_NS16550)
 
 static inline void serial_out_shift(unsigned char *addr, int shift, int value)
 {
@@ -85,6 +85,9 @@ static inline int serial_in_shift(unsigned char *addr, int 
shift)
return readb(addr);
 #endif
 }
+#endif
+
+#if defined(CONFIG_DM_SERIAL)
 
 static void ns16550_writeb(NS16550_t port, int offset, int value)
 {
@@ -255,6 +258,15 @@ void debug_uart_init(void)
CONFIG_BAUDRATE);
 
serial_out_shift(&com_port->ier, 0, CONFIG_SYS_NS16550_IER);
+#if defined(CONFIG_OMAP) || defined(CONFIG_AM33XX) || \
+   defined(CONFIG_TI81XX) || defined(CONFIG_AM43XX)
+   serial_out_shift(&com_port->mdr1, 0, 0x7);  /* mode select reset 
TL16C750*/
+#endif
+   serial_out_shift(&com_port->lcr, 0, UART_LCR_BKSE | UART_LCRVAL);
+   serial_out_shift(&com_port->dll, 0, 0);
+   serial_out_shift(&com_port->dlm, 0, 0);
+   serial_out_shift(&com_port->lcr, 0, UART_LCRVAL);
+
serial_out_shift(&com_port->mcr, 0, UART_MCRVAL);
serial_out_shift(&com_port->fcr, 0, UART_FCRVAL);
 
@@ -262,6 +274,12 @@ void debug_uart_init(void)
serial_out_shift(&com_port->dll, 0, baud_divisor & 0xff);
serial_out_shift(&com_port->dlm, 0, (baud_divisor >> 8) & 0xff);
serial_out_shift(&com_port->lcr, 0, UART_LCRVAL);
+#if defined(CONFIG_OMAP) || \
+   defined(CONFIG_AM33XX) || defined(CONFIG_SOC_DA8XX) || \
+   defined(CONFIG_TI81XX) || defined(CONFIG_AM43XX)
+   /* /16 is proper to hit 115200 with 48MHz */
+   serial_out_shift(&com_port->mdr1, 0, 0);
+#endif /* CONFIG_OMAP */
 }
 
 static inline void _debug_uart_putc(int ch)
-- 
1.9.1

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot