From patchwork Thu Jul 13 15:08:27 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bich HEMON X-Patchwork-Id: 107698 Delivered-To: patch@linaro.org Received: by 10.182.45.195 with SMTP id p3csp2391216obm; Thu, 13 Jul 2017 08:09:12 -0700 (PDT) X-Received: by 10.98.139.137 with SMTP id e9mr102036pfl.66.1499958552318; Thu, 13 Jul 2017 08:09:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1499958552; cv=none; d=google.com; s=arc-20160816; b=DOpFgshiNcDyfsNN0XqUU7CkXOjfZ0l6FFcOHFDrXTsuXCq00qRv9mpjmDsf2NI9bf dt8pcih0frC3k5DFtsjdjvfQPj6h29UdF95lvREsnQFiCVBQwrpr/xMe1F4HqGCwjtHH ugPM0daYgN41cUFGUYGYpFW0NiZlSNzJ/KPShGbZl7jQ5cTPqI7Izo66vWX7U1Xngn8X u2ATEAMmkZ5w5ldg4czO1eX3/DLg++Bi03c2VCYBHCVetP2vyIxg2g9Het/3aJ3/1rTI HeDUXeggy/2AIn+bqfvYCxPL+pbyKxYLpHEJt1DZ9/l7MYrQGdQ26O3zV4+b101LVnqv Wu3Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-transfer-encoding :content-language:accept-language:in-reply-to:references:message-id :date:thread-index:thread-topic:subject:cc:to:from :arc-authentication-results; bh=dltn1MLrSK6p1M0F13rz8GSBsO/2yO0hMgERo+WbSCE=; b=ATZfRvxXq7u/+vfDJWKRbYDOhaQYBFBBZatH+Jc0xZJaqkKcLSDHjd7PaIr+xAvFSI Tc/UjFHstcbX3iIEUpq5pWh0m6tD4oOM6fiVl82GEGwqwuX2kAuJbxUMKxvEst5fxS1O p7f9XlxDzXgyXiUPZ5Pfj/XGyNdUw3dnndRpuv3104qbtd/vHE8a7Vqvj36Pe0n5d1u5 i1k7TwW+9Dr/7hFCqkYVZWIwBUcDFSV7FsDRkfzb8LqKAEJlldM97lCIf1rhYMdTc+ZL jpZASoCausC+838MUgCw0+W+sHcesKh9uE2XHWb5TZjPf/uRUzCGVeB4dZrK27XBdSl4 /g8A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-serial-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-serial-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e68si4351301pfk.450.2017.07.13.08.09.12; Thu, 13 Jul 2017 08:09:12 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-serial-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-serial-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-serial-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752298AbdGMPJL convert rfc822-to-8bit (ORCPT + 3 others); Thu, 13 Jul 2017 11:09:11 -0400 Received: from mx07-00178001.pphosted.com ([62.209.51.94]:50135 "EHLO mx07-00178001.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751375AbdGMPJJ (ORCPT ); Thu, 13 Jul 2017 11:09:09 -0400 Received: from pps.filterd (m0046037.ppops.net [127.0.0.1]) by mx07-.pphosted.com (8.16.0.21/8.16.0.21) with SMTP id v6DF3jXP015126; Thu, 13 Jul 2017 17:08:28 +0200 Received: from beta.dmz-eu.st.com (beta.dmz-eu.st.com [164.129.1.35]) by mx07-.pphosted.com with ESMTP id 2bp9ergj7t-1 (version=TLSv1 cipher=ECDHE-RSA-AES256-SHA bits=256 verify=NOT); Thu, 13 Jul 2017 17:08:28 +0200 Received: from zeta.dmz-eu.st.com (zeta.dmz-eu.st.com [164.129.230.9]) by beta.dmz-eu.st.com (STMicroelectronics) with ESMTP id 29EA638; Thu, 13 Jul 2017 15:08:28 +0000 (GMT) Received: from Webmail-eu.st.com (sfhdag3node1.st.com [10.75.127.7]) by zeta.dmz-eu.st.com (STMicroelectronics) with ESMTP id 0582A250F; Thu, 13 Jul 2017 15:08:28 +0000 (GMT) Received: from SFHDAG3NODE1.st.com (10.75.127.7) by SFHDAG3NODE1.st.com (10.75.127.7) with Microsoft SMTP Server (TLS) id 15.0.1178.4; Thu, 13 Jul 2017 17:08:27 +0200 Received: from SFHDAG3NODE1.st.com ([fe80::1166:1abb:aad4:5f86]) by SFHDAG3NODE1.st.com ([fe80::1166:1abb:aad4:5f86%20]) with mapi id 15.00.1178.000; Thu, 13 Jul 2017 17:08:27 +0200 From: Bich HEMON To: Greg Kroah-Hartman , Rob Herring , Mark Rutland , Maxime Coquelin , Alexandre TORGUE , "Jiri Slaby" , "linux-serial@vger.kernel.org" , "devicetree@vger.kernel.org" , "linux-arm-kernel@lists.infradead.org" , "linux-kernel@vger.kernel.org" CC: Bich HEMON Subject: [PATCH 2/9] serial: stm32: fix multi-ports management Thread-Topic: [PATCH 2/9] serial: stm32: fix multi-ports management Thread-Index: AQHS++nhjXifljrXcUS0HxlQc4R+sA== Date: Thu, 13 Jul 2017 15:08:27 +0000 Message-ID: <1499958494-19354-3-git-send-email-bich.hemon@st.com> References: <1499958494-19354-1-git-send-email-bich.hemon@st.com> In-Reply-To: <1499958494-19354-1-git-send-email-bich.hemon@st.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-exchange-messagesentrepresentingtype: 1 x-ms-exchange-transport-fromentityheader: Hosted x-originating-ip: [10.75.127.49] MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2017-07-13_08:, , signatures=0 Sender: linux-serial-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-serial@vger.kernel.org From: Gerald Baeza Correct management of multi-ports. Each port has its own last residue value and its own alias. Signed-off-by: Gerald Baeza Signed-off-by: Bich Hemon --- drivers/tty/serial/stm32-usart.c | 12 +++++++----- drivers/tty/serial/stm32-usart.h | 1 + 2 files changed, 8 insertions(+), 5 deletions(-) -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-serial" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/tty/serial/stm32-usart.c b/drivers/tty/serial/stm32-usart.c index ebc49e4..a12d79c 100644 --- a/drivers/tty/serial/stm32-usart.c +++ b/drivers/tty/serial/stm32-usart.c @@ -111,14 +111,13 @@ static void stm32_receive_chars(struct uart_port *port, bool threaded) unsigned long c; u32 sr; char flag; - static int last_res = RX_BUF_L; if (port->irq_wake) pm_wakeup_event(tport->tty->dev, 0); - while (stm32_pending_rx(port, &sr, &last_res, threaded)) { + while (stm32_pending_rx(port, &sr, &stm32_port->last_res, threaded)) { sr |= USART_SR_DUMMY_RX; - c = stm32_get_char(port, &sr, &last_res); + c = stm32_get_char(port, &sr, &stm32_port->last_res); flag = TTY_NORMAL; port->icount.rx++; @@ -694,8 +693,10 @@ static struct stm32_port *stm32_of_get_stm32_port(struct platform_device *pdev) return NULL; id = of_alias_get_id(np, "serial"); - if (id < 0) - id = 0; + if (id < 0) { + dev_err(&pdev->dev, "failed to get alias id, errno %d\n", id); + return NULL; + } if (WARN_ON(id >= STM32_MAX_PORTS)) return NULL; @@ -703,6 +704,7 @@ static struct stm32_port *stm32_of_get_stm32_port(struct platform_device *pdev) stm32_ports[id].hw_flow_control = of_property_read_bool(np, "st,hw-flow-ctrl"); stm32_ports[id].port.line = id; + stm32_ports[id].last_res = RX_BUF_L; return &stm32_ports[id]; } diff --git a/drivers/tty/serial/stm32-usart.h b/drivers/tty/serial/stm32-usart.h index 0532b2f..65b4ffa 100644 --- a/drivers/tty/serial/stm32-usart.h +++ b/drivers/tty/serial/stm32-usart.h @@ -222,6 +222,7 @@ struct stm32_port { struct dma_chan *tx_ch; /* dma tx channel */ dma_addr_t tx_dma_buf; /* dma tx buffer bus address */ unsigned char *tx_buf; /* dma tx buffer cpu address */ + int last_res; bool tx_dma_busy; /* dma tx busy */ bool hw_flow_control; };