The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Benjamin Herrenschmidt <benh@kernel.crashing.org>
To: Andrew Morton <akpm@osdl.org>
Cc: Linus Torvalds <torvalds@osdl.org>,
	Linux Kernel list <linux-kernel@vger.kernel.org>
Subject: [PATCH] ppc64: Cleanup console detection
Date: Tue, 26 Oct 2004 11:19:00 +1000	[thread overview]
Message-ID: <1098753540.17905.8.camel@gaston> (raw)

Hi !

This patch removes some leftover code that was in #if 0 in the console autodetect
code. It also adds passing of the default serial speed as console options when
it is available from Open Firmware.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>

Index: linux-work/arch/ppc64/kernel/setup.c
===================================================================
--- linux-work.orig/arch/ppc64/kernel/setup.c	2004-10-25 21:58:12.000000000 +1000
+++ linux-work/arch/ppc64/kernel/setup.c	2004-10-26 11:18:05.630004280 +1000
@@ -786,12 +786,11 @@
 #ifdef CONFIG_PPC_MULTIPLATFORM
 static int __init set_preferred_console(void)
 {
-	struct device_node *prom_stdout;
+	struct device_node *prom_stdout = NULL;
 	char *name;
+	u32 *spd;
 	int offset = 0;
-#if  0
-	phandle *stdout_ph;
-#endif
+
 	DBG(" -> set_preferred_console()\n");
 
 	/* The user has requested a console so this is already set up. */
@@ -805,20 +804,7 @@
 		return -ENODEV;
 	}
 	/* We are getting a weird phandle from OF ... */
-#if 0
-	stdout_ph = (phandle *)get_property(of_chosen, "linux,stdout-package", NULL);
-	if (stdout_ph == NULL) {
-		DBG(" no linux,stdout-package !\n");
-		return -ENODEV;
-	}
-	prom_stdout = of_find_node_by_phandle(*stdout_ph);
-	if (!prom_stdout) {
-		DBG(" can't find stdout package for phandle 0x%x !\n", *stdout_ph);
-		return -ENODEV;
-	}
-#endif
 	/* ... So use the full path instead */
-#if 1
 	name = (char *)get_property(of_chosen, "linux,stdout-path", NULL);
 	if (name == NULL) {
 		DBG(" no linux,stdout-path !\n");
@@ -829,7 +815,6 @@
 		DBG(" can't find stdout package %s !\n", name);
 		return -ENODEV;
 	}	
-#endif
 	DBG("stdout is %s\n", prom_stdout->full_name);
 
 	name = (char *)get_property(prom_stdout, "name", NULL);
@@ -837,8 +822,12 @@
 		DBG(" stdout package has no name !\n");
 		goto not_found;
 	}
+	spd = (u32 *)get_property(prom_stdout, "current-speed", NULL);
 
-	if (strcmp(name, "serial") == 0) {
+	if (0)
+		;
+#ifdef CONFIG_SERIAL_8250_CONSOLE
+	else if (strcmp(name, "serial") == 0) {
 		int i;
 		u32 *reg = (u32 *)get_property(prom_stdout, "reg", &i);
 		if (i > 8) {
@@ -861,6 +850,7 @@
 			}
 		}
 	}
+#endif /* CONFIG_SERIAL_8250_CONSOLE */
 #ifdef CONFIG_PPC_PSERIES
 	else if (strcmp(name, "vty") == 0) {
  		u32 *reg = (u32 *)get_property(prom_stdout, "reg", NULL);
@@ -890,17 +880,24 @@
  		}
 	}
 #endif /* CONFIG_PPC_PSERIES */
+#ifdef CONFIG_SERIAL_PMACZILOG_CONSOLE
 	else if (strcmp(name, "ch-a") == 0)
 		offset = 0;
 	else if (strcmp(name, "ch-b") == 0)
 		offset = 1;
+#endif /* CONFIG_SERIAL_PMACZILOG_CONSOLE */
 	else
 		goto not_found;
 	of_node_put(prom_stdout);
 
 	DBG("Found serial console at ttyS%d\n", offset);
 
-	return add_preferred_console("ttyS", offset, NULL);
+	if (spd) {
+		char opt[16];
+		sprintf(opt, "%d", *spd);
+		return add_preferred_console("ttyS", offset, opt);
+	} else
+		return add_preferred_console("ttyS", offset, NULL);
 
  not_found:
 	DBG("No preferred console found !\n");



                 reply	other threads:[~2004-10-26  1:44 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=1098753540.17905.8.camel@gaston \
    --to=benh@kernel.crashing.org \
    --cc=akpm@osdl.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=torvalds@osdl.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