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 checks for a status property in the serial node and ignores
the port if it is set to "disabled".
Signed-off-by: Josh Boyer <[EMAIL PROTECTED]>
---
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_available(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_available(np))
+ return -1;
+
/* get clock freq. if present */
clk = of_get_property(np, "clock-frequency", NULL);
if (clk && *clk)
_______________________________________________
Linuxppc-dev mailing list
[email protected]
https://ozlabs.org/mailman/listinfo/linuxppc-dev