From: Grant Likely <glikely@gmail.com>
To: linux-ppc-embedded <linuxppc-embedded@ozlabs.org>
Subject: [PATCH] Allow ns16550.c to get base baud from rs_table instead of BAUD_BASE
Date: Tue, 23 Aug 2005 16:47:02 -0600 [thread overview]
Message-ID: <20050823224702.GA3864@siegfried.thelikelysolution.ca> (raw)
[PATCH] Allow ns16550.c to get base baud from rs_table instead of BAUD_BASE
REPOST: fixed formating problems in original patch
Modifies serial_init to get base baud rate from the rs_table entry instead
of BAUD_BASE. Will default back to BAUD_BASE if base_baud is not set.
This patch eliminates duplication between the SERIAL_PORT_DFNS macro and
BAUD_BASE. Without the patch, if a port set the baud rate in
SERIAL_PORT_DFNS, but did not update BASE_BAUD, the BASE_BAUD value
would still be used.
Rather; serial_init() should look first in SERIAL_PORT_DFNS and use
BASE_BAUD as a backup.
Signed-off-by: Grant Likely <grant.likely@gdcanada.com>
---
arch/ppc/boot/common/ns16550.c | 11 +++++++++--
1 files changed, 9 insertions(+), 2 deletions(-)
8ef971164affa27492e0f4abe73baf9b438575db
diff --git a/arch/ppc/boot/common/ns16550.c b/arch/ppc/boot/common/ns16550.c
--- a/arch/ppc/boot/common/ns16550.c
+++ b/arch/ppc/boot/common/ns16550.c
@@ -25,6 +25,7 @@ unsigned long serial_init(int chan, void
{
unsigned long com_port;
unsigned char lcr, dlm;
+ unsigned long baud_base;
/* 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.
@@ -43,6 +44,12 @@ unsigned long serial_init(int chan, void
/* How far apart the registers are. */
shift = rs_table[chan].iomem_reg_shift;
+ baud_base = rs_table[chan].baud_base;
+#if defined(BASE_BAUD)
+ if (!baud_base)
+ baud_base = BASE_BAUD;
+#endif
+
/* save the LCR */
lcr = inb(com_port + (UART_LCR << shift));
@@ -62,9 +69,9 @@ unsigned long serial_init(int chan, void
else {
/* Input clock. */
outb(com_port + (UART_DLL << shift),
- (BASE_BAUD / SERIAL_BAUD) & 0xFF);
+ (baud_base / SERIAL_BAUD) & 0xFF);
outb(com_port + (UART_DLM << shift),
- (BASE_BAUD / SERIAL_BAUD) >> 8);
+ (baud_base / SERIAL_BAUD) >> 8);
/* 8 data, 1 stop, no parity */
outb(com_port + (UART_LCR << shift), 0x03);
/* RTS/DTR */
next reply other threads:[~2005-08-23 22:50 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-08-23 22:47 Grant Likely [this message]
2005-08-24 18:35 ` [PATCH] Allow ns16550.c to get base baud from rs_table instead of BAUD_BASE Tom Rini
2005-08-24 21:35 ` Grant Likely
2005-08-24 21:47 ` Tom Rini
2005-08-24 22:17 ` Grant Likely
-- strict thread matches above, loose matches on Subject: below --
2005-08-23 22:07 Grant Likely
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=20050823224702.GA3864@siegfried.thelikelysolution.ca \
--to=glikely@gmail.com \
--cc=linuxppc-embedded@ozlabs.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).