From: "Mark A. Greer" <mgreer@mvista.com>
To: linuxppc-dev <linuxppc-dev@lists.linuxppc.org>
Subject: linuxppc_2_4_devel patch for arch/ppc/kernel/gen550_dbg.c
Date: Thu, 05 Jun 2003 14:46:42 -0700 [thread overview]
Message-ID: <3EDFBA42.3050306@mvista.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 175 bytes --]
This patch add in the check to see if the UART already appears to be
initialized that is in arch/ppc/boot/common/ns16550.c.
Please apply if there are no objections.
Mark
--
[-- Attachment #2: gen550.patch --]
[-- Type: text/plain, Size: 2028 bytes --]
===== arch/ppc/kernel/gen550_dbg.c 1.3 vs edited =====
--- 1.3/arch/ppc/kernel/gen550_dbg.c Fri Apr 25 11:01:46 2003
+++ edited/arch/ppc/kernel/gen550_dbg.c Wed Jun 4 17:17:12 2003
@@ -57,6 +57,7 @@
unsigned long serial_init(int chan, void *ignored)
{
unsigned long com_port;
+ unsigned char lcr, dlm;
/* We need to find out which type io we're expecting. If it's
* 'SERIAL_IO_PORT', we get an offset from the isa_io_base.
@@ -79,22 +80,38 @@
/* How far apart the registers are. */
shift = rs_table[chan].iomem_reg_shift;
+
+ /* save the LCR */
+ lcr = serial_inb(com_port + (UART_LCR << shift));
/* Access baud rate */
- serial_outb(com_port + (UART_LCR << shift), 0x80);
+ serial_outb(com_port + (UART_LCR << shift), UART_LCR_DLAB);
+ dlm = serial_inb(com_port + (UART_DLM << shift));
- /* Input clock. */
- serial_outb(com_port + (UART_DLL << shift),
+ /*
+ * Test if serial port is unconfigured
+ * We assume that no-one uses less than 110 baud or
+ * less than 7 bits per character these days.
+ * -- paulus.
+ */
+ if ((dlm <= 4) && (lcr & 2)) {
+ /* port is configured, put the old LCR back */
+ serial_outb(com_port + (UART_LCR << shift), lcr);
+ }
+ else {
+ /* Input clock. */
+ serial_outb(com_port + (UART_DLL << shift),
(rs_table[chan].baud_base / SERIAL_BAUD) & 0xFF);
- serial_outb(com_port + (UART_DLM << shift),
- (rs_table[chan].baud_base / SERIAL_BAUD) >> 8);
- /* 8 data, 1 stop, no parity */
- serial_outb(com_port + (UART_LCR << shift), 0x03);
- /* RTS/DTR */
- serial_outb(com_port + (UART_MCR << shift), 0x03);
+ serial_outb(com_port + (UART_DLM << shift),
+ (rs_table[chan].baud_base / SERIAL_BAUD) >> 8);
+ /* 8 data, 1 stop, no parity */
+ serial_outb(com_port + (UART_LCR << shift), 0x03);
+ /* RTS/DTR */
+ serial_outb(com_port + (UART_MCR << shift), 0x03);
- /* Clear & enable FIFOs */
- serial_outb(com_port + (UART_FCR << shift), 0x07);
+ /* Clear & enable FIFOs */
+ serial_outb(com_port + (UART_FCR << shift), 0x07);
+ }
return (com_port);
}
next reply other threads:[~2003-06-05 21:46 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-06-05 21:46 Mark A. Greer [this message]
2003-06-05 22:25 ` linuxppc_2_4_devel patch for arch/ppc/kernel/gen550_dbg.c linas
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=3EDFBA42.3050306@mvista.com \
--to=mgreer@mvista.com \
--cc=linuxppc-dev@lists.linuxppc.org \
/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;
as well as URLs for NNTP newsgroup(s).