From patchwork Tue Jul 18 10:59:43 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= X-Patchwork-Id: 790152 Return-Path: X-Original-To: incoming-imx@patchwork.ozlabs.org Delivered-To: patchwork-incoming-imx@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.infradead.org (client-ip=65.50.211.133; helo=bombadil.infradead.org; envelope-from=linux-arm-kernel-bounces+incoming-imx=patchwork.ozlabs.org@lists.infradead.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="h4ra9lKv"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=infradead.org header.i=@infradead.org header.b="GsR7Ij5B"; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3xBcgY43qbz9s3T for ; Tue, 18 Jul 2017 21:02:17 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=dvTHoopcp9yfiiCEwRn2j6iVC9Bng1NY3vLBj+eLMrw=; b=h4ra9lKvf9grbF C+BRTLMocHqj+Zyj2eHWuWUhV4UkdVTXTrxZUXzHe6mxeLhjDOOjXNQp0zzQdCMzJiBn+cenD2Zgk W3Nf9+BV25dc6c+B0VPsnRVaFkAJVyF1ckVjT87NX1+CCe+WkOLMWabKFTzzZJsRkWik5zypwZcKf Avz2TtOX2O4n2MdGosxFBZbGlmC/fapvD3BAEEkikV7P/VN5hQOEiDASrzJqpOAU9lPP+wBq8f1PE qWbDqvN7lM1AIwjAgCHkC7O6mePVdBSadzNymoJ99vqknIPa6od6ce3W59DfK69bEhk4XkGAlMwMw TuCaMOP3GZYWjyu1PCHA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1dXQGc-0002qf-6g; Tue, 18 Jul 2017 11:02:14 +0000 Received: from merlin.infradead.org ([2001:8b0:10b:1231::1]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1dXQFf-0001uE-Qu for linux-arm-kernel@bombadil.infradead.org; Tue, 18 Jul 2017 11:01:16 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.20170209; h=Content-Transfer-Encoding:Content-Type: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender :Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=V9fHasUPCLJku4iTiOHWmLFEMokV5eTGhOaPCigYZ2A=; b=GsR7Ij5B4rGkJwZnNW1J/PrLhM B8vxfqNofa196Zq6AtbsifH4RaM+fsF8ZoLTL4ttzTXwrCAyTFlal2uSeD57NAfYghHtHz8QoZFkc 80ExEYuR4RvxzIRDgcu4ZsDJKRtqXpNDvODdmLwr7lB7Mob3zzYEVYXe0DdrsXRKnH3KrAWMpPDII Mghp3TrKOgLFiXoiYucKOcxEX62fiIpwkzjFABfx2JzZPwBjKgHLmiLgflMvwE15iU3KqsWfJ4Vus UA7dXLB2M81g0xdYCWIGKpG/GZfZ+w2Rk6fYLqzgMMCgx2BdtJjhusPr1YT6TOyuDS9QjmHtZKwp9 CEpuQHmA==; Received: from metis.ext.pengutronix.de ([2001:67c:670:201:290:27ff:fe1d:cc33]) by merlin.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1dXQEo-00031Q-2r for linux-arm-kernel@lists.infradead.org; Tue, 18 Jul 2017 11:00:23 +0000 Received: from dude.hi.pengutronix.de ([2001:67c:670:100:1d::7]) by metis.ext.pengutronix.de with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1dXQEN-0007e8-RI; Tue, 18 Jul 2017 12:59:55 +0200 Received: from ukl by dude.hi.pengutronix.de with local (Exim 4.89) (envelope-from ) id 1dXQEN-00074O-Dv; Tue, 18 Jul 2017 12:59:55 +0200 From: =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig?= To: linux-serial@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH v4 4/9] serial: atmel: Use common rs485 device tree parsing function Date: Tue, 18 Jul 2017 12:59:43 +0200 Message-Id: <20170718105948.21986-5-u.kleine-koenig@pengutronix.de> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170718105948.21986-1-u.kleine-koenig@pengutronix.de> References: <20170718105948.21986-1-u.kleine-koenig@pengutronix.de> MIME-Version: 1.0 X-SA-Exim-Connect-IP: 2001:67c:670:100:1d::7 X-SA-Exim-Mail-From: ukl@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-arm-kernel@lists.infradead.org X-Spam-Note: CRM114 invocation failed X-Spam-Score: -1.9 (-) X-Spam-Report: SpamAssassin version 3.4.1 on merlin.infradead.org summary: Content analysis details: (-1.9 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RP_MATCHES_RCVD Envelope sender domain matches handover relay domain -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Richard Genoud , devicetree@vger.kernel.org, Sascha Hauer , Alexandre Belloni , kernel@pengutronix.de Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+incoming-imx=patchwork.ozlabs.org@lists.infradead.org List-Id: linux-imx-kernel.lists.patchwork.ozlabs.org From: Sascha Hauer We just got a common helper for parsing the rs485 specific device tree properties. Use it and drop the open coded parser. Note that there is a small difference between the removed and the now used implementation: The former cleared flags to 0 if rs485-rts-delay was given, the common helper clears SER_RS485_RX_DURING_TX and SER_RS485_ENABLED only but always which makes more sense. Signed-off-by: Sascha Hauer [ukleinek: point out semantic change in commit log] Acked-by: Nicolas Ferre Acked-by: Richard Genoud Signed-off-by: Uwe Kleine-König --- drivers/tty/serial/atmel_serial.c | 25 +------------------------ 1 file changed, 1 insertion(+), 24 deletions(-) diff --git a/drivers/tty/serial/atmel_serial.c b/drivers/tty/serial/atmel_serial.c index 7551cab438ff..04e55f010894 100644 --- a/drivers/tty/serial/atmel_serial.c +++ b/drivers/tty/serial/atmel_serial.c @@ -1667,29 +1667,6 @@ static void atmel_init_property(struct atmel_uart_port *atmel_port, } } -static void atmel_init_rs485(struct uart_port *port, - struct platform_device *pdev) -{ - struct device_node *np = pdev->dev.of_node; - - struct serial_rs485 *rs485conf = &port->rs485; - u32 rs485_delay[2]; - - /* rs485 properties */ - if (of_property_read_u32_array(np, "rs485-rts-delay", - rs485_delay, 2) == 0) { - rs485conf->delay_rts_before_send = rs485_delay[0]; - rs485conf->delay_rts_after_send = rs485_delay[1]; - rs485conf->flags = 0; - } - - if (of_get_property(np, "rs485-rx-during-tx", NULL)) - rs485conf->flags |= SER_RS485_RX_DURING_TX; - - if (of_get_property(np, "linux,rs485-enabled-at-boot-time", NULL)) - rs485conf->flags |= SER_RS485_ENABLED; -} - static void atmel_set_ops(struct uart_port *port) { struct atmel_uart_port *atmel_port = to_atmel_uart_port(port); @@ -2373,7 +2350,7 @@ static int atmel_init_port(struct atmel_uart_port *atmel_port, atmel_init_property(atmel_port, pdev); atmel_set_ops(port); - atmel_init_rs485(port, pdev); + of_get_rs485_mode(pdev->dev.of_node, &port->rs485); port->iotype = UPIO_MEM; port->flags = UPF_BOOT_AUTOCONF | UPF_IOREMAP;