From patchwork Mon Sep 12 09:47:33 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Genoud X-Patchwork-Id: 9326069 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 094F760839 for ; Mon, 12 Sep 2016 09:52:23 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EF1BE28A64 for ; Mon, 12 Sep 2016 09:52:22 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E3EA528CC2; Mon, 12 Sep 2016 09:52:22 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.1 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,FREEMAIL_FROM,RCVD_IN_DNSWL_MED,T_DKIM_INVALID autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 7CCEC28A64 for ; Mon, 12 Sep 2016 09:52:22 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.85_2 #1 (Red Hat Linux)) id 1bjNsV-0000M9-UX; Mon, 12 Sep 2016 09:50:15 +0000 Received: from mail-wm0-x241.google.com ([2a00:1450:400c:c09::241]) by bombadil.infradead.org with esmtps (Exim 4.85_2 #1 (Red Hat Linux)) id 1bjNqd-0006ea-Ex for linux-arm-kernel@lists.infradead.org; Mon, 12 Sep 2016 09:48:21 +0000 Received: by mail-wm0-x241.google.com with SMTP id a6so12788743wmc.2 for ; Mon, 12 Sep 2016 02:47:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=rMmb5hJnDe8Q6WvkqXh0HodudzTHAPyQ0bdNWu/taD4=; b=vR/zZiuaUDkmJ/iuS2rhuhxD042Yc9F5DDGqDR4vD1goQRt+d7ELAXOZF9uEzOdWu2 qDMYGCi+2H3VM4foLxsfjnKw8MlzcT3d1y1cEzoNADpxfFjAHFqAzVRj+5oOYdp6Q7fP OIxRCUyaN/cEQ0ogDHvufHnx9tYsNflVO+sZwsBJXvuWTYiNeXBNs/C3qSMef86OO4K5 gWQ5M3q26sM3dvHe9BreAlvPDCnpdGDETO+9qE2+6aF29O2QSAGQp8NbRimmLHcM0H+f sLOo55y7SFDtDtXPkk4Y/xKEfQGwi9pz0D00gx1mxRgLBJn8eas0UfRJtQNcxIPquE8N ZNWg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=rMmb5hJnDe8Q6WvkqXh0HodudzTHAPyQ0bdNWu/taD4=; b=V0ukOJODXuCUtfm/M+8H62a9veeLqA/jzND+mK0z5975Q1I1/lseMm0uOFuyWRmeuK 6zOrzq9/2TrL4TMgp2KxjPZpRmhT6/S6QBHyC2jTNPsMwNs2LL8mw8iNIvtQ91Ak3tgz HdRdPDSxG8wQHrSh2Z9vPMuXpCkHB6Zvvv8oMfGjS4SPJoFiEV3qsE/junpS/37libsL MDf1Eav7ECFk7b51sGyyowWT2sF2aUzxL+lBrPCMZMP+4gRrvt2zMjvyOQ7ppx7YeOy3 O21ZZRTObv18RxVEQAvIhHVJB9QYzm6p0gtffMLcQDFe5ygWnbREpl4WvUKtapwWbDce H4+Q== X-Gm-Message-State: AE9vXwNbDTqnhNSKNX8GojIlkDEa/VhCEAqr1XPgGjS6+h9K8XMTDMzWgmsjX+NkTHhvDg== X-Received: by 10.28.88.207 with SMTP id m198mr9209483wmb.79.1473673677346; Mon, 12 Sep 2016 02:47:57 -0700 (PDT) Received: from localhost ([46.227.18.67]) by smtp.gmail.com with ESMTPSA id q139sm16999358wmb.18.2016.09.12.02.47.56 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 12 Sep 2016 02:47:56 -0700 (PDT) From: Richard Genoud To: Cyrille Pitchen , Alexandre Belloni , Nicolas Ferre , Greg Kroah-Hartman Subject: [PATCHv2 3/3] tty/serial: at91: fix hardware handshake on SAM9x5 (without GPIOs) Date: Mon, 12 Sep 2016 11:47:33 +0200 Message-Id: <20160912094733.21501-4-richard.genoud@gmail.com> X-Mailer: git-send-email 2.10.0 In-Reply-To: <20160912094733.21501-1-richard.genoud@gmail.com> References: <20160912094733.21501-1-richard.genoud@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160912_024819_847702_7F508DA5 X-CRM114-Status: GOOD ( 13.89 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Richard Genoud , linux-serial@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Commit 1cf6e8fc8341 ("tty/serial: at91: fix RTS line management when hardware handshake is enabled") broke the hardware handshake on SAM9x5 platforms. On Atmel platforms, the USART can only handle the handware handshake (ATMEL_US_USMODE_HWHS) if FIFOs or PDC are used. Thus, ATMEL_US_USMODE_HWHS mode should only be used in this case. For SAM9x5, there's no FIFOs nor PDC for the USART, so the mode should be ATMEL_US_USMODE_NORMAL and the RTS pin should be controlled by the driver. NB: -stable is not Cced because it doesn't cleanly apply on 4.1+ Tested on SAM9G35-CM with and without DMA Signed-off-by: Richard Genoud Fixes: 1cf6e8fc8341 ("tty/serial: at91: fix RTS line management when hardware handshake is enabled") --- drivers/tty/serial/atmel_serial.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/drivers/tty/serial/atmel_serial.c b/drivers/tty/serial/atmel_serial.c index e9b4fbf88c2d..32154e7231ce 100644 --- a/drivers/tty/serial/atmel_serial.c +++ b/drivers/tty/serial/atmel_serial.c @@ -2130,15 +2130,19 @@ static void atmel_set_termios(struct uart_port *port, struct ktermios *termios, } else if ((termios->c_cflag & CRTSCTS) && !mctrl_gpio_use_rtscts(atmel_port->gpios)) { /* - * RS232 with hardware handshake (RTS/CTS) - * handled by the controller. + * Automatic hardware handshake (RTS/CTS) only work with + * FIFOs or PDC. + * Meaning that on SAM9x5 the controller can't handle + * the hardware handshake (no FIFOs nor PDC on these platforms). */ - if (atmel_use_dma_rx(port) && !atmel_use_fifo(port)) { - dev_info(port->dev, "not enabling hardware flow control because DMA is used"); - termios->c_cflag &= ~CRTSCTS; - } else { + if (atmel_use_pdc_rx(port) || atmel_use_fifo(port)) mode |= ATMEL_US_USMODE_HWHS; - } + else + /* + * The hardware handshake won't be handle by the + * controller but by the driver. + */ + mode |= ATMEL_US_USMODE_NORMAL; } else { /* RS232 without hadware handshake or controlled by GPIOs */ mode |= ATMEL_US_USMODE_NORMAL;