linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Josh Boyer <jwboyer@linux.vnet.ibm.com>
To: arnd@arndb.de
Cc: sfr@canb.auug.org.au, davem@davemloft.net, linuxppc-dev@ozlabs.org
Subject: [PATCH 2/2][POWERPC] Ignore disabled serial ports
Date: Sat, 23 Feb 2008 16:00:50 -0600	[thread overview]
Message-ID: <20080223160050.4c8e7c68@zod.rchland.ibm.com> (raw)
In-Reply-To: <20080223155823.2c85d829@zod.rchland.ibm.com>

Some SoC chips have multiple serial ports on board.  The usability of these
ports can rely on various factors, ranging from pin sharing to unpopulated
connectors.  This uses the new of_device_is_disabled function to check for
and ignore disabled UARTs.

Signed-off-by: Josh Boyer <jwboyer@linux.vnet.ibm.com>

---
 arch/powerpc/kernel/legacy_serial.c |    4 ++++
 drivers/serial/of_serial.c          |    5 +++++
 2 files changed, 9 insertions(+)

--- linux-2.6.orig/drivers/serial/of_serial.c
+++ linux-2.6/drivers/serial/of_serial.c
@@ -72,6 +72,11 @@ static int __devinit of_platform_serial_
 	int port_type;
 	int ret;
 
+	if (of_device_is_disabled(ofdev->node)) {
+		dev_info(&ofdev->dev, "Disabled serial port.  Ignored\n");
+		return -ENODEV;
+	}
+
 	if (of_find_property(ofdev->node, "used-by-rtas", NULL))
 		return -EBUSY;
 
--- linux-2.6.orig/arch/powerpc/kernel/legacy_serial.c
+++ linux-2.6/arch/powerpc/kernel/legacy_serial.c
@@ -54,6 +54,10 @@ static int __init add_legacy_port(struct
 	u32 clock = BASE_BAUD * 16;
 	int index;
 
+	/* Check the status property if present.  Ignore disabled devices */
+	if (of_device_is_disabled(np))
+		return -1;
+
 	/* get clock freq. if present */
 	clk = of_get_property(np, "clock-frequency", NULL);
 	if (clk && *clk)

  reply	other threads:[~2008-02-23 22:01 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-02-23 21:58 [PATCH 1/2][OF] Add of_device_is_disabled function Josh Boyer
2008-02-23 22:00 ` Josh Boyer [this message]
2008-02-24  0:59 ` Josh Boyer
2008-02-24  2:23   ` [PATCH][OF] Add of_device_is_available function Josh Boyer
2008-02-26  9:04     ` Paul Mackerras
2008-02-26 21:34       ` David Miller
2008-02-26 21:45         ` Benjamin Herrenschmidt
2008-02-26 22:44           ` David Miller
2008-02-26 22:58             ` Benjamin Herrenschmidt
2008-02-26 23:53             ` Josh Boyer
2008-02-24  2:45   ` [PATCH 1/2][OF] Add of_device_is_disabled function David Miller
2008-02-24 20:12   ` Nathan Lynch

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=20080223160050.4c8e7c68@zod.rchland.ibm.com \
    --to=jwboyer@linux.vnet.ibm.com \
    --cc=arnd@arndb.de \
    --cc=davem@davemloft.net \
    --cc=linuxppc-dev@ozlabs.org \
    --cc=sfr@canb.auug.org.au \
    /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).