[PATCH 7/7] serial: samsung: Get default port register settings from device tree

Thomas Abraham thomas.abraham at linaro.org
Sat Feb 12 23:47:05 EST 2011


The default uart port register settings are obtained from the platform data.
In addition to that, this patch adds support for obtaining the default uart port
register values from the uart node in device tree.

Signed-off-by: Thomas Abraham <thomas.abraham at linaro.org>
---
 drivers/tty/serial/samsung.c |   13 +++++++++++++
 1 files changed, 13 insertions(+), 0 deletions(-)

diff --git a/drivers/tty/serial/samsung.c b/drivers/tty/serial/samsung.c
index 66fece9..dda1d52 100644
--- a/drivers/tty/serial/samsung.c
+++ b/drivers/tty/serial/samsung.c
@@ -1148,9 +1148,22 @@ int s3c24xx_serial_probe(struct platform_device *dev,
 {
 	struct s3c24xx_uart_port *ourport;
 	int ret;
+	unsigned int len, *regdef;
+	struct s3c2410_uartcfg *cfg;
 
 	dbg("s3c24xx_serial_probe(%p, %p) %d\n", dev, info, probe_index);
 
+	if (dev->dev.of_node) {
+		regdef = (u32 *)of_get_property(dev->dev.of_node,
+					"reg-defaults", &len);
+		if (regdef && (len / sizeof(unsigned int)) == 3) {
+			cfg = s3c24xx_dev_to_cfg(&dev->dev);
+			cfg->ucon = be32_to_cpu(regdef[0]);
+			cfg->ulcon = be32_to_cpu(regdef[1]);
+			cfg->ufcon = be32_to_cpu(regdef[2]);
+		}
+	}
+
 	ourport = &s3c24xx_serial_ports[probe_index];
 	probe_index++;
 
-- 
1.6.6.rc2



More information about the devicetree-discuss mailing list