From patchwork Thu Jun 26 11:24:34 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomasz Figa X-Patchwork-Id: 4427241 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id C447A9F319 for ; Thu, 26 Jun 2014 11:27:58 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id E758C2038F for ; Thu, 26 Jun 2014 11:27:57 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 21D5E20379 for ; Thu, 26 Jun 2014 11:27:57 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1X07oe-0001sr-2D; Thu, 26 Jun 2014 11:26:08 +0000 Received: from mailout4.w1.samsung.com ([210.118.77.14]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1X07o1-0001TS-5l for linux-arm-kernel@lists.infradead.org; Thu, 26 Jun 2014 11:25:31 +0000 Received: from eucpsbgm2.samsung.com (unknown [203.254.199.245]) by mailout4.w1.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0N7R00N34X1K4680@mailout4.w1.samsung.com> for linux-arm-kernel@lists.infradead.org; Thu, 26 Jun 2014 12:24:57 +0100 (BST) X-AuditID: cbfec7f5-b7f626d000004b39-a3-53ac03107785 Received: from eusync1.samsung.com ( [203.254.199.211]) by eucpsbgm2.samsung.com (EUCPMTA) with SMTP id 2E.3E.19257.0130CA35; Thu, 26 Jun 2014 12:25:04 +0100 (BST) Received: from AMDC1227.digital.local ([106.116.147.199]) by eusync1.samsung.com (Oracle Communications Messaging Server 7u4-23.01(7.0.4.23.0) 64bit (built Aug 10 2011)) with ESMTPA id <0N7R007JKX1N6Z90@eusync1.samsung.com>; Thu, 26 Jun 2014 12:25:04 +0100 (BST) From: Tomasz Figa To: linux-samsung-soc@vger.kernel.org Subject: [PATCH 2/3] serial: samsung: Consider DT alias when probing ports Date: Thu, 26 Jun 2014 13:24:34 +0200 Message-id: <1403781875-5425-3-git-send-email-t.figa@samsung.com> X-Mailer: git-send-email 1.9.3 In-reply-to: <1403781875-5425-1-git-send-email-t.figa@samsung.com> References: <1403781875-5425-1-git-send-email-t.figa@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrCLMWRmVeSWpSXmKPExsVy+t/xy7oCzGuCDV6t4rKYf+Qcq8Wj+Y+Z LZoXr2ez+Px7F6tF74KrbBabHl9jtbi8aw6bxYzz+5gszizuZbe4fZnXYu2Ru+wWS69fZLJo 3XuE3WL9jNcsFqt2/WF04PdYM28No0dLcw+bx6LvWR47Z91l99i0qpPNY//cNewem5fUe/Rt WcXocWbBEXaPz5vkAriiuGxSUnMyy1KL9O0SuDIOfLjEXHCQt+LajbvsDYxruLsYOTkkBEwk tq+YxARhi0lcuLeeDcQWEljKKHFnWloXIxeQ3ccksePfShaQBJuAmsTnhkdgRSICqhKf2xaw gxQxC0xmkdjV+YcdJCEs4CVxeNkpsCIWoKI5V26CNfMKOEq8ev+VGWKbnETvtjdgNqeAk8Tq o7NYITY7StzYcIBpAiPvAkaGVYyiqaXJBcVJ6blGesWJucWleel6yfm5mxghIf11B+PSY1aH GAU4GJV4eE+ErQ4WYk0sK67MPcQowcGsJMIr8hsoxJuSWFmVWpQfX1Sak1p8iJGJg1OqgZHx z6I1BtePcB9t3fVTY+6vEy27F3C05Rn0L8+awNuzdvezwj+9asd2pBw0nXdz8oRTArc1Fig2 iPaHi0Zvv8W0dKtsyKuNbFKZF5x3Tv0kcflJ9OlQeyZrf2GlFdkX9rbEntNkqDvtWtV5/IPP 3atdu5afKVQLvhMQy79UW9t586Z11xbp8vIrsRRnJBpqMRcVJwIAtEhbW0cCAAA= X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140626_042529_404712_FD665DC1 X-CRM114-Status: GOOD ( 10.95 ) X-Spam-Score: -5.0 (-----) Cc: Mark Rutland , devicetree@vger.kernel.org, Kukjin Kim , Russell King - ARM Linux , Greg Kroah-Hartman , Tomasz Figa , linux-kernel@vger.kernel.org, Daniel Drake , Rob Herring , linux-serial@vger.kernel.org, Tomasz Figa , Jiri Slaby , linux-arm-kernel@lists.infradead.org, Marek Szyprowski X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Current driver code relies on probe order of particular samsung-uart instances, which makes it impossible to get proper initialization of ports when not all ports are available on board, not even saying of deterministic device naming. This patch fixes this on DT-enabled systems by using DT aliases for ports as instance ID, if specified, or falling back to legacy method otherwise to provide backwards compatibility. Signed-off-by: Tomasz Figa --- drivers/tty/serial/samsung.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/drivers/tty/serial/samsung.c b/drivers/tty/serial/samsung.c index c1d3ebd..a9bf024 100644 --- a/drivers/tty/serial/samsung.c +++ b/drivers/tty/serial/samsung.c @@ -1275,11 +1275,18 @@ static inline struct s3c24xx_serial_drv_data *s3c24xx_get_driver_data( static int s3c24xx_serial_probe(struct platform_device *pdev) { struct s3c24xx_uart_port *ourport; + int index = probe_index; int ret; - dbg("s3c24xx_serial_probe(%p) %d\n", pdev, probe_index); + if (pdev->dev.of_node) { + ret = of_alias_get_id(pdev->dev.of_node, "serial"); + if (ret >= 0) + index = ret; + } + + dbg("s3c24xx_serial_probe(%p) %d\n", pdev, index); - ourport = &s3c24xx_serial_ports[probe_index]; + ourport = &s3c24xx_serial_ports[index]; ourport->drv_data = s3c24xx_get_driver_data(pdev); if (!ourport->drv_data) { @@ -1295,7 +1302,7 @@ static int s3c24xx_serial_probe(struct platform_device *pdev) ourport->port.fifosize = (ourport->info->fifosize) ? ourport->info->fifosize : - ourport->drv_data->fifosize[probe_index]; + ourport->drv_data->fifosize[index]; probe_index++;