u-boot.lists.denx.de archive mirror
 help / color / mirror / Atom feed
* [U-Boot] [PATCH] serial_mxc: Fix setup of UARTx_UFCR register
@ 2015-11-25 13:08 Maximilian Schwerin
  2016-01-03 14:23 ` Stefano Babic
  0 siblings, 1 reply; 2+ messages in thread
From: Maximilian Schwerin @ 2015-11-25 13:08 UTC (permalink / raw)
  To: u-boot

This patch writes the default values for TXTL and RXTL to UARTx_UFCR.
Without this patch some older kernel versions crash as UARTx_UFCR was
not always correctly initialized.

Signed-off-by: Maximilian Schwerin <maximilian.schwerin@tigris.de>
---
 drivers/serial/serial_mxc.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/drivers/serial/serial_mxc.c b/drivers/serial/serial_mxc.c
index d6cf1d8..51485c0 100644
--- a/drivers/serial/serial_mxc.c
+++ b/drivers/serial/serial_mxc.c
@@ -75,6 +75,7 @@
 #define  UCR4_DREN	 (1<<0)  /* Recv data ready interrupt enable */
 #define  UFCR_RXTL_SHF   0       /* Receiver trigger level shift */
 #define  UFCR_RFDIV      (7<<7)  /* Reference freq divider mask */
+#define  UFCR_RFDIV_SHF  7      /* Reference freq divider shift */
 #define  UFCR_TXTL_SHF   10      /* Transmitter trigger level shift */
 #define  USR1_PARITYERR  (1<<15) /* Parity error interrupt flag */
 #define  USR1_RTSS	 (1<<14) /* RTS pin status */
@@ -135,6 +136,10 @@
 
 DECLARE_GLOBAL_DATA_PTR;
 
+#define TXTL  2 /* reset default */
+#define RXTL  1 /* reset default */
+#define RFDIV 4 /* divide input clock by 2 */
+
 static void mxc_serial_setbrg(void)
 {
 	u32 clk = imx_get_uartclk();
@@ -142,7 +147,9 @@ static void mxc_serial_setbrg(void)
 	if (!gd->baudrate)
 		gd->baudrate = CONFIG_BAUDRATE;
 
-	__REG(UART_PHYS + UFCR) = 4 << 7; /* divide input clock by 2 */
+	__REG(UART_PHYS + UFCR) = (RFDIV << UFCR_RFDIV_SHF)
+		| (TXTL << UFCR_TXTL_SHF)
+		| (RXTL << UFCR_RXTL_SHF);
 	__REG(UART_PHYS + UBIR) = 0xf;
 	__REG(UART_PHYS + UBMR) = clk / (2 * gd->baudrate);
 
-- 
1.9.1

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 2815 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20151125/90968843/attachment.bin>

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

* [U-Boot] [PATCH] serial_mxc: Fix setup of UARTx_UFCR register
  2015-11-25 13:08 [U-Boot] [PATCH] serial_mxc: Fix setup of UARTx_UFCR register Maximilian Schwerin
@ 2016-01-03 14:23 ` Stefano Babic
  0 siblings, 0 replies; 2+ messages in thread
From: Stefano Babic @ 2016-01-03 14:23 UTC (permalink / raw)
  To: u-boot

On 25/11/2015 14:08, Maximilian Schwerin wrote:
> This patch writes the default values for TXTL and RXTL to UARTx_UFCR.
> Without this patch some older kernel versions crash as UARTx_UFCR was
> not always correctly initialized.
> 
> Signed-off-by: Maximilian Schwerin <maximilian.schwerin@tigris.de>
> ---


Applied to u-boot-imx, thanks!

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: sbabic at denx.de
=====================================================================

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

end of thread, other threads:[~2016-01-03 14:23 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-11-25 13:08 [U-Boot] [PATCH] serial_mxc: Fix setup of UARTx_UFCR register Maximilian Schwerin
2016-01-03 14:23 ` Stefano Babic

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).