From patchwork Sat Feb 12 12:47:03 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: thomas.abraham@linaro.org X-Patchwork-Id: 133 Return-Path: Delivered-To: unknown Received: from imap.gmail.com (74.125.159.109) by localhost6.localdomain6 with IMAP4-SSL; 08 Jun 2011 14:40:15 -0000 Delivered-To: patches@linaro.org Received: by 10.147.124.5 with SMTP id b5cs261053yan; Sat, 12 Feb 2011 04:49:15 -0800 (PST) Received: by 10.42.176.7 with SMTP id bc7mr2124654icb.257.1297514955122; Sat, 12 Feb 2011 04:49:15 -0800 (PST) Received: from mailout3.samsung.com (mailout3.samsung.com [203.254.224.33]) by mx.google.com with ESMTP id c4si1223263ict.30.2011.02.12.04.49.14; Sat, 12 Feb 2011 04:49:15 -0800 (PST) Received-SPF: neutral (google.com: 203.254.224.33 is neither permitted nor denied by best guess record for domain of thomas.abraham@linaro.org) client-ip=203.254.224.33; Authentication-Results: mx.google.com; spf=neutral (google.com: 203.254.224.33 is neither permitted nor denied by best guess record for domain of thomas.abraham@linaro.org) smtp.mail=thomas.abraham@linaro.org Received: from epmmp2 (mailout3.samsung.com [203.254.224.33]) by mailout3.samsung.com (Oracle Communications Messaging Exchange Server 7u4-19.01 64bit (built Sep 7 2010)) with ESMTP id <0LGI00KSW8Y1U220@mailout3.samsung.com> for patches@linaro.org; Sat, 12 Feb 2011 21:49:13 +0900 (KST) Received: from localhost.localdomain ([107.108.73.37]) by mmp2.samsung.com (iPlanet Messaging Server 5.2 Patch 2 (built Jul 14 2004)) with ESMTPA id <0LGI00IEA8XP10@mmp2.samsung.com> for patches@linaro.org; Sat, 12 Feb 2011 21:49:13 +0900 (KST) Date: Sat, 12 Feb 2011 18:17:03 +0530 From: Thomas Abraham Subject: [PATCH 5/7] serial: samsung: Get console register defaults from device tree In-reply-to: <1297514825-10345-1-git-send-email-thomas.abraham@linaro.org> To: devicetree-discuss@lists.ozlabs.org Cc: kgene.kim@samsung.com, grant.likely@secretlab.ca, linaro-dev@lists.linaro.org, patches@linaro.org Message-id: <1297514825-10345-6-git-send-email-thomas.abraham@linaro.org> X-Mailer: git-send-email 1.6.6.rc2 Content-transfer-encoding: 7BIT References: <1297514825-10345-1-git-send-email-thomas.abraham@linaro.org> The uart ports are used as console and due to console_init, the uart ports are initialized prior to the uart driver's probe function is called. During this intialization stage, the driver obtains the default port register values from the platform data. This patch adds support for obtaining the default port register values from the device tree. The default values should be specified in the 'chosen' node of the device tree. Signed-off-by: Thomas Abraham --- drivers/tty/serial/samsung.c | 14 ++++++++++++++ 1 files changed, 14 insertions(+), 0 deletions(-) diff --git a/drivers/tty/serial/samsung.c b/drivers/tty/serial/samsung.c index 2335eda..66fece9 100644 --- a/drivers/tty/serial/samsung.c +++ b/drivers/tty/serial/samsung.c @@ -43,6 +43,7 @@ #include #include #include +#include #include @@ -1384,11 +1385,24 @@ static int s3c24xx_serial_init_ports(struct s3c24xx_uart_info **info) struct s3c24xx_uart_port *ptr = s3c24xx_serial_ports; struct platform_device **platdev_ptr; int i; + unsigned int *condefs , len; + struct s3c2410_uartcfg *cfg; dbg("s3c24xx_serial_init_ports: initialising ports...\n"); platdev_ptr = s3c24xx_uart_devs; + condefs = (u32 *)of_get_property(of_chosen, "console-defaults", &len); + if (condefs && (len / sizeof(unsigned int)) == 3) { + for (i = 0; i < CONFIG_SERIAL_SAMSUNG_UARTS; i++) { + cfg = s3c24xx_dev_to_cfg(&(*platdev_ptr)->dev); + cfg->ucon = be32_to_cpu(condefs[0]); + cfg->ulcon = be32_to_cpu(condefs[1]); + cfg->ufcon = be32_to_cpu(condefs[2]); + platdev_ptr++; + } + } + platdev_ptr = s3c24xx_uart_devs; for (i = 0; i < CONFIG_SERIAL_SAMSUNG_UARTS; i++, ptr++, platdev_ptr++) { s3c24xx_serial_init_port(ptr, info[i], *platdev_ptr); }