From: Niklaus Giger Date: Mon, 3 Dec 2007 10:48:54 +0100 Subject: [U-Boot-Users] [PATCH] resubmit: PPC440: Add flow control for serial port In-Reply-To: <200711302057.17414.sr@denx.de> References: <200711301439.25140.niklausgiger@gmx.ch> <200711302057.17414.sr@denx.de> Message-ID: <200712031048.54727.niklausgiger@gmx.ch> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de 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 --- 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