From: Bich HEMON <bich.hemon@st.com>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Rob Herring <robh+dt@kernel.org>,
Mark Rutland <mark.rutland@arm.com>,
Maxime Coquelin <mcoquelin.stm32@gmail.com>,
Alexandre TORGUE <alexandre.torgue@st.com>,
Jiri Slaby <jslaby@suse.com>,
"linux-serial@vger.kernel.org" <linux-serial@vger.kernel.org>,
"devicetree@vger.kernel.org" <devicetree@vger.kernel.org>,
"linux-arm-kernel@lists.infradead.org"
<linux-arm-kernel@lists.infradead.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Cc: Bich HEMON <bich.hemon@st.com>
Subject: [PATCH 2/9] serial: stm32: fix multi-ports management
Date: Thu, 13 Jul 2017 15:08:27 +0000 [thread overview]
Message-ID: <1499958494-19354-3-git-send-email-bich.hemon@st.com> (raw)
In-Reply-To: <1499958494-19354-1-git-send-email-bich.hemon@st.com>
From: Gerald Baeza <gerald.baeza@st.com>
Correct management of multi-ports. Each port has
its own last residue value and its own alias.
Signed-off-by: Gerald Baeza <gerald.baeza@st.com>
Signed-off-by: Bich Hemon <bich.hemon@st.com>
---
drivers/tty/serial/stm32-usart.c | 12 +++++++-----
drivers/tty/serial/stm32-usart.h | 1 +
2 files changed, 8 insertions(+), 5 deletions(-)
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;
};
--
1.9.1
next prev parent reply other threads:[~2017-07-13 15:08 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-07-13 15:08 [PATCH 0/9] Add support for STM32H7 serial Bich HEMON
2017-07-13 15:08 ` [PATCH 1/9] serial: stm32: fix copyright Bich HEMON
[not found] ` <1499958494-19354-1-git-send-email-bich.hemon-qxv4g6HH51o@public.gmane.org>
2017-07-13 15:08 ` [PATCH 3/9] serial: stm32: Increase maximum number of ports Bich HEMON
2017-07-13 15:08 ` [PATCH 9/9] serial: stm32: add fifo support Bich HEMON
2017-07-13 15:08 ` Bich HEMON [this message]
2017-07-13 15:08 ` [PATCH 5/9] serial: stm32: add RTS support Bich HEMON
2017-07-13 15:08 ` [PATCH 4/9] serial: stm32: fix pio transmit timeout Bich HEMON
2017-07-30 14:32 ` Greg Kroah-Hartman
2017-07-31 9:30 ` Bich HEMON
2017-07-13 15:08 ` [PATCH 6/9] serial: stm32: fix error handling in probe Bich HEMON
2017-07-13 15:08 ` [PATCH 7/9] dt-bindings: serial: add compatible for stm32h7 Bich HEMON
[not found] ` <1499958494-19354-8-git-send-email-bich.hemon-qxv4g6HH51o@public.gmane.org>
2017-07-17 18:46 ` Rob Herring
2017-07-13 15:08 ` [PATCH 8/9] serial: stm32: add wakeup mechanism Bich HEMON
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1499958494-19354-3-git-send-email-bich.hemon@st.com \
--to=bich.hemon@st.com \
--cc=alexandre.torgue@st.com \
--cc=devicetree@vger.kernel.org \
--cc=gregkh@linuxfoundation.org \
--cc=jslaby@suse.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-serial@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=mcoquelin.stm32@gmail.com \
--cc=robh+dt@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox