linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: John Tyner <jtyner@cs.ucr.edu>
To: <linuxppc-embedded@lists.linuxppc.org>
Subject: [PATCH] early serial init
Date: Thu, 11 Apr 2002 13:00:53 -0700 (PDT)	[thread overview]
Message-ID: <Pine.LNX.4.30.0204111259350.23686-100000@hill.cs.ucr.edu> (raw)


Here is a patch to setup the serial ports early. It works fine on our
walnut boards.

--- arch/ppc/platforms/walnut.c.orig	Thu Apr 11 12:55:55 2002
+++ arch/ppc/platforms/walnut.c	Thu Apr 11 12:58:35 2002
@@ -31,6 +31,7 @@
 #include <linux/blk.h>
 #include <linux/pci.h>
 #include <linux/rtc.h>
+#include <linux/serial.h>

 #include <asm/system.h>
 #include <asm/pci-bridge.h>
@@ -247,6 +248,11 @@
 void __init
 board_init(void)
 {
+	struct serial_struct serial_req;
+	bd_t *bip = (bd_t *) __res;
+	u32 chrcr;
+	int div;
+	ulong bb;
 #ifdef CONFIG_PPC_RTC
 	ppc_md.time_init = todc_time_init;
 	ppc_md.set_rtc_time = todc_set_rtc_time;
@@ -254,4 +260,40 @@
 	ppc_md.nvram_read_val = todc_direct_read_val;
 	ppc_md.nvram_write_val = todc_direct_write_val;
 #endif
+	chrcr = mfdcr(DCRN_CHCR0);
+	div = ((chrcr&0x3e)>>1)+1;
+	div *= 16;
+	bb = bip->bi_intfreq/div;
+
+	if( !(chrcr & CHR0_U0EC) ){
+		memset(&serial_req, 0, sizeof(serial_req));
+		serial_req.line       = 0;
+		serial_req.baud_base  = bb;
+		serial_req.port       = 0;
+		serial_req.irq        = UART0_INT;
+		serial_req.flags      = ASYNC_BOOT_AUTOCONF | ASYNC_SKIP_TEST;
+		serial_req.io_type    = SERIAL_IO_MEM;
+		serial_req.iomem_base = (u8 *)UART0_IO_BASE;
+		serial_req.iomem_reg_shift = 0;
+
+		if (early_serial_setup(&serial_req) != 0) {
+			printk("Early serial init of port 0 failed\n");
+		}
+	}
+
+	if( !(chrcr & CHR0_U1EC) ){
+		memset(&serial_req, 0, sizeof(serial_req));
+		serial_req.line       = 1;
+		serial_req.baud_base  = bb;
+		serial_req.port       = 1;
+		serial_req.irq        = UART1_INT;
+		serial_req.flags      = ASYNC_BOOT_AUTOCONF | ASYNC_SKIP_TEST;
+		serial_req.io_type    = SERIAL_IO_MEM;
+		serial_req.iomem_base = (u8 *)UART1_IO_BASE;
+		serial_req.iomem_reg_shift = 0;
+
+		if (early_serial_setup(&serial_req) != 0) {
+			printk("Early serial init of port 1 failed\n");
+		}
+	}
 }


** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/

             reply	other threads:[~2002-04-11 20:00 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-04-11 20:00 John Tyner [this message]
2002-04-11 14:20 ` [PATCH] early serial init Armin
2002-04-11 21:26   ` John Tyner
2002-04-11 14:53     ` Armin
2002-04-11 22:36       ` andrew may
2002-04-11 16:05         ` Armin
2002-04-11 23:18           ` andrew may
2002-04-11 22:43         ` Matthew Locke
2002-04-11 22:52           ` John Tyner
2002-04-11 22:54         ` Matthew Locke
2002-04-11 23:10         ` Tom Rini
2002-04-11 23:28           ` andrew may
2002-04-12  0:03             ` Tom Rini
2002-04-12  0:41               ` andrew may
2002-04-11 23:09       ` Tom Rini
2002-04-12  1:29         ` David Gibson

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=Pine.LNX.4.30.0204111259350.23686-100000@hill.cs.ucr.edu \
    --to=jtyner@cs.ucr.edu \
    --cc=linuxppc-embedded@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).