[U-Boot-Users] [PATCH] resubmit: PPC440: Add flow control for serial port
Niklaus Giger
niklausgiger at gmx.ch
Mon Dec 3 10:48:54 CET 2007
Sorry for my mistake in my first submission..
This has been tested on our HCU5 PPC440EPx based board, where we
have only one serial port.
Signed-off-by: Niklaus Giger <niklaus.giger at netstal.com>
---
cpu/ppc4xx/serial.c | 20 ++++++++++++++++++++
1 files changed, 20 insertions(+), 0 deletions(-)
diff --git a/cpu/ppc4xx/serial.c b/cpu/ppc4xx/serial.c
index 60712b1..4cba836 100644
--- a/cpu/ppc4xx/serial.c
+++ b/cpu/ppc4xx/serial.c
@@ -490,6 +490,21 @@ static void serial_divs (int baudrate, unsigned long *pudiv,
}
#endif /* defined(CONFIG_440) && !defined(CFG_EXT_SERIAL_CLK) */
+#if defined(CONFIG_CMD_HWFLOW) && defined(CONFIG_440) && !defined(CONFIG_SERIAL_MULTI)
+int hwflow_onoff(int flow_on)
+{
+ if (flow_on == 1) {
+ out8(UART_BASE + UART_MCR, 0x0b); /* The OUT2 bit may be written and read
+ but it provides no function */
+ }
+ else
+ {
+ out8(UART_BASE + UART_MCR, 0x00); /* no modem control DTR RTS */
+ }
+ return 0;
+}
+#endif
+
/*
* Minimal serial functions needed to use one of the SMC ports
* as serial console interface.
@@ -548,7 +563,12 @@ int serial_init(void)
out8(UART_BASE + UART_DLM, bdiv >> 8); /* set baudrate divisor */
out8(UART_BASE + UART_LCR, 0x03); /* clear DLAB; set 8 bits, no parity */
out8(UART_BASE + UART_FCR, 0x00); /* disable FIFO */
+#ifdef CONFIG_CMD_HWFLOW
+ out8(UART_BASE + UART_MCR, 0x0b); /* The OUT2 bit may be written and read
+ but it provides no function */
+#else
out8(UART_BASE + UART_MCR, 0x00); /* no modem control DTR RTS */
+#endif
val = in8(UART_BASE + UART_LSR); /* clear line status */
val = in8(UART_BASE + UART_RBR); /* read receive buffer */
out8(UART_BASE + UART_SCR, 0x00); /* set scratchpad */
--
1.5.2
More information about the U-Boot
mailing list