public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Niklaus Giger <niklausgiger@gmx.ch>
To: u-boot@lists.denx.de
Subject: [U-Boot-Users] [PATCH] PPC440: Add flow control for serial port (Third try)
Date: Mon, 3 Dec 2007 14:17:12 +0100	[thread overview]
Message-ID: <200712031417.12417.niklausgiger@gmx.ch> (raw)

This has be layouten tested on our HCU5 PPC440EPx based board, where we
have only one serial port. Changes compared to my last try are:
- HW-flow control is off by default.
- returns the  correct state of the hwflow
- coding style corrected

Signed-off-by: Niklaus Giger <niklaus.giger@netstal.com>
---
 cpu/ppc4xx/serial.c |   25 +++++++++++++++++++++++++
 1 files changed, 25 insertions(+), 0 deletions(-)

diff --git a/cpu/ppc4xx/serial.c b/cpu/ppc4xx/serial.c
index 60712b1..8f36fef 100644
--- a/cpu/ppc4xx/serial.c
+++ b/cpu/ppc4xx/serial.c
@@ -490,6 +490,31 @@ 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)
+static int hwflow = 0; /* turned off by default */
+int hwflow_onoff(int on)
+{
+	switch(on) {
+	case 0:
+	default:
+		break; /* return current */
+	case 1:
+		/* The OUT2 bit may be written and read
+		 * but it provides no function
+		 */
+		out8(UART_BASE + UART_MCR, 0x0b);
+		hwflow = 1; /* turn on */
+		break;
+	case -1:
+		/* no modem control DTR RTS */
+		out8(UART_BASE + UART_MCR, 0x00);
+		hwflow = 0; /* turn off */
+		break;
+	}
+	return hwflow;
+}
+#endif
+
 /*
  * Minimal serial functions needed to use one of the SMC ports
  * as serial console interface.
-- 
1.5.2

             reply	other threads:[~2007-12-03 13:17 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-12-03 13:17 Niklaus Giger [this message]
2007-12-17 16:33 ` [U-Boot-Users] [PATCH] PPC440: Add flow control for serial port (Third try) Stefan Roese
2008-01-09 14:04   ` Stefan Roese

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200712031417.12417.niklausgiger@gmx.ch \
    --to=niklausgiger@gmx.ch \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox