From patchwork Tue Jul 18 10:59:44 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: 790174 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="Grnqv4pv"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=infradead.org header.i=@infradead.org header.b="dt1gpt5E"; 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 3xBczT6v1fz9s72 for ; Tue, 18 Jul 2017 21:16:05 +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=ZCDQNwyWVyY25hu5Tz6gGPIZ/j6y/bYGEe9AyWcPFlo=; b=Grnqv4pviWg4cl MPDcG5+daEHy3z3xwD5pH5OBLZ7t04yIMF7LmbkwNElLCfPmJXjSwTnPYm5rle83OIWnFs9nAjPzq +gtV6UsJ0ACB/uAK08rCYs9ZiHABylZs97kyIwEUTd7ah3aDaXXb+KE8VfnP4uiP20vGzAg21e6u3 rumBbiuNziiJFP3yeQTyaSUY4mTT40/ANzWMh+vU9k6WDXIS09RDxoi3WcrVl5gox/nS5DQonLvb/ mT7Gx+A5vVevbsBDTfOwg7dgjGLjMDus6NKZJ1OdqZh0CjHQDcvK3bF2itl1AIo8SFOlBUHIaIyau O2AiWfNviWauDxqcOb7Q==; 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 1dXQTx-0001Uv-Al; Tue, 18 Jul 2017 11:16:01 +0000 Received: from casper.infradead.org ([2001:8b0:10b:1236::1]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1dXQTL-0000VO-17 for linux-arm-kernel@bombadil.infradead.org; Tue, 18 Jul 2017 11:15:23 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.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=yaOKPQcSJT9JPKi4FNESnzAa2JBuIwUbRll/diGzE6o=; b=dt1gpt5E3Tws463vjIxOXYgkYm L/TPT8AnFt1Mn7RSM4z5rG9iBmM/HdHdO7eSEA/+QiMX2EQKkWAO7+jkPb1Zp1tetIQ9ihNX6XqTI d2aBBGCHdTQ507ljd5XHiP14oJbPA50Xwb7ns5d0d6L7fcNBp7pMR576ewTcuR+4jr/XREioXJHwG S57z4S6r8YJ/eNzddagezTEEkuJWNDyQ2wkeqc2Vfsi59LtdXAMY8Ua74HR4ImohVibwOsYDFnIG8 cFh7Qm84toHHdWiKYwtRJvCZHOjJM4DBCXcyAy3FQAweyMU8lPFfpfZHoAslAW96Ur1onOT8VFo4r 1y4vEZhQ==; Received: from metis.ext.pengutronix.de ([2001:67c:670:201:290:27ff:fe1d:cc33]) by casper.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1dXQEp-0002e4-E0 for linux-arm-kernel@lists.infradead.org; Tue, 18 Jul 2017 11:00:28 +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-0007eF-S1; 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-00074X-G6; 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 5/9] serial: fsl_lpuart: Use common rs485 device tree parsing function Date: Tue, 18 Jul 2017 12:59:44 +0200 Message-Id: <20170718105948.21986-6-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-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170718_120023_547384_9C67B1FE X-CRM114-Status: GOOD ( 15.43 ) X-Spam-Score: -1.9 (-) X-Spam-Report: SpamAssassin version 3.4.1 on casper.infradead.org summary: Content analysis details: (-1.9 points, 5.0 required) 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: Fabio Estevam , devicetree@vger.kernel.org, Sascha Hauer , Shawn Guo , 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. As a side effect this adds support for parsing rs485-rts-delay and rs485-rx-during-tx. As the driver doesn't support this though, probing fails if these are defined. Signed-off-by: Sascha Hauer Signed-off-by: Uwe Kleine-König --- drivers/tty/serial/fsl_lpuart.c | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/drivers/tty/serial/fsl_lpuart.c b/drivers/tty/serial/fsl_lpuart.c index 4becfbf35c4c..cac81b143abe 100644 --- a/drivers/tty/serial/fsl_lpuart.c +++ b/drivers/tty/serial/fsl_lpuart.c @@ -2161,6 +2161,24 @@ static int lpuart_probe(struct platform_device *pdev) return ret; } + of_get_rs485_mode(np, &sport->port.rs485); + + if (sport->port.rs485.flags & SER_RS485_RX_DURING_TX) { + dev_err(&pdev->dev, "driver doesn't support RX during TX\n"); + return -ENOSYS; + } + + if (sport->port.rs485.delay_rts_before_send || + sport->port.rs485.delay_rts_after_send) { + dev_err(&pdev->dev, "driver doesn't support RTS delays\n"); + return -ENOSYS; + } + + if (sport->port.rs485.flags & SER_RS485_ENABLED) { + sport->port.rs485.flags |= SER_RS485_RTS_ON_SEND; + writeb(UARTMODEM_TXRTSE, sport->port.membase + UARTMODEM); + } + sport->dma_tx_chan = dma_request_slave_channel(sport->port.dev, "tx"); if (!sport->dma_tx_chan) dev_info(sport->port.dev, "DMA tx channel request failed, " @@ -2171,12 +2189,6 @@ static int lpuart_probe(struct platform_device *pdev) dev_info(sport->port.dev, "DMA rx channel request failed, " "operating without rx DMA\n"); - if (of_property_read_bool(np, "linux,rs485-enabled-at-boot-time")) { - sport->port.rs485.flags |= SER_RS485_ENABLED; - sport->port.rs485.flags |= SER_RS485_RTS_ON_SEND; - writeb(UARTMODEM_TXRTSE, sport->port.membase + UARTMODEM); - } - return 0; }