* [PATCH 1/2] serial: atmel: trivial: clean the IP version decoding code
@ 2016-01-25 17:38 Nicolas Ferre
2016-01-25 17:38 ` [PATCH 2/2] serial: atmel: add support for new UART version Nicolas Ferre
0 siblings, 1 reply; 4+ messages in thread
From: Nicolas Ferre @ 2016-01-25 17:38 UTC (permalink / raw)
To: Greg Kroah-Hartman, linux-arm-kernel
Cc: linux-kernel, linux-serial, jslaby, davidm, Nicolas Ferre
No functional change is associated with this patch.
A driver property depends on the Atmel serial IP revision. This property
is the way the rx timeout is handled: by an hardware or software timer.
So, change this property name and setup code so that it's easier to understand
and more future proof as the distinction of USART vs. UART is blurrier on newer
SoCs.
Variable names and debug comments are also adapted to make this code more obvious.
Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com>
---
drivers/tty/serial/atmel_serial.c | 32 ++++++++++++++++----------------
1 file changed, 16 insertions(+), 16 deletions(-)
diff --git a/drivers/tty/serial/atmel_serial.c b/drivers/tty/serial/atmel_serial.c
index a809119dff45..de5d32c31179 100644
--- a/drivers/tty/serial/atmel_serial.c
+++ b/drivers/tty/serial/atmel_serial.c
@@ -159,8 +159,8 @@ struct atmel_uart_port {
u32 rts_high;
u32 rts_low;
bool ms_irq_enabled;
- bool is_usart; /* usart or uart */
- struct timer_list uart_timer; /* uart timer */
+ bool has_hw_timer;
+ struct timer_list uart_timer;
bool suspended;
unsigned int pending;
@@ -1710,19 +1710,19 @@ static void atmel_get_ip_name(struct uart_port *port)
struct atmel_uart_port *atmel_port = to_atmel_uart_port(port);
int name = atmel_uart_readl(port, ATMEL_US_NAME);
u32 version;
- int usart, uart;
- /* usart and uart ascii */
- usart = 0x55534152;
- uart = 0x44424755;
+ u32 usart, dbgu_uart;
+ /* ASCII decoding for IP version */
+ usart = 0x55534152; /* USAR(T) */
+ dbgu_uart = 0x44424755; /* DBGU */
- atmel_port->is_usart = false;
+ atmel_port->has_hw_timer = false;
if (name == usart) {
- dev_dbg(port->dev, "This is usart\n");
- atmel_port->is_usart = true;
- } else if (name == uart) {
- dev_dbg(port->dev, "This is uart\n");
- atmel_port->is_usart = false;
+ dev_dbg(port->dev, "Usart with hw timer\n");
+ atmel_port->has_hw_timer = true;
+ } else if (name == dbgu_uart) {
+ dev_dbg(port->dev, "Dbgu or uart without hw timer\n");
+ atmel_port->has_hw_timer = false;
} else {
/* fallback for older SoCs: use version field */
version = atmel_uart_readl(port, ATMEL_US_VERSION);
@@ -1730,12 +1730,12 @@ static void atmel_get_ip_name(struct uart_port *port)
case 0x302:
case 0x10213:
dev_dbg(port->dev, "This version is usart\n");
- atmel_port->is_usart = true;
+ atmel_port->has_hw_timer = true;
break;
case 0x203:
case 0x10202:
dev_dbg(port->dev, "This version is uart\n");
- atmel_port->is_usart = false;
+ atmel_port->has_hw_timer = false;
break;
default:
dev_err(port->dev, "Not supported ip name nor version, set to uart\n");
@@ -1835,7 +1835,7 @@ static int atmel_startup(struct uart_port *port)
if (atmel_use_pdc_rx(port)) {
/* set UART timeout */
- if (!atmel_port->is_usart) {
+ if (!atmel_port->has_hw_timer) {
mod_timer(&atmel_port->uart_timer,
jiffies + uart_poll_timeout(port));
/* set USART timeout */
@@ -1850,7 +1850,7 @@ static int atmel_startup(struct uart_port *port)
atmel_uart_writel(port, ATMEL_PDC_PTCR, ATMEL_PDC_RXTEN);
} else if (atmel_use_dma_rx(port)) {
/* set UART timeout */
- if (!atmel_port->is_usart) {
+ if (!atmel_port->has_hw_timer) {
mod_timer(&atmel_port->uart_timer,
jiffies + uart_poll_timeout(port));
/* set USART timeout */
--
2.1.3
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 2/2] serial: atmel: add support for new UART version
2016-01-25 17:38 [PATCH 1/2] serial: atmel: trivial: clean the IP version decoding code Nicolas Ferre
@ 2016-01-25 17:38 ` Nicolas Ferre
2016-01-25 18:34 ` kbuild test robot
0 siblings, 1 reply; 4+ messages in thread
From: Nicolas Ferre @ 2016-01-25 17:38 UTC (permalink / raw)
To: Greg Kroah-Hartman, linux-arm-kernel
Cc: linux-kernel, linux-serial, jslaby, davidm, Nicolas Ferre
Starting with sama5d2, the new UART revision has an hardware timer. So, add it
to the IP detection code and set the "has_hw_timer" property for it.
Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com>
Reported-by: David Mosberger <davidm@egauge.net>
---
drivers/tty/serial/atmel_serial.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/tty/serial/atmel_serial.c b/drivers/tty/serial/atmel_serial.c
index de5d32c31179..fab135824679 100644
--- a/drivers/tty/serial/atmel_serial.c
+++ b/drivers/tty/serial/atmel_serial.c
@@ -1714,11 +1714,12 @@ static void atmel_get_ip_name(struct uart_port *port)
/* ASCII decoding for IP version */
usart = 0x55534152; /* USAR(T) */
dbgu_uart = 0x44424755; /* DBGU */
+ new_uart = 0x55415254; /* UART */
atmel_port->has_hw_timer = false;
- if (name == usart) {
- dev_dbg(port->dev, "Usart with hw timer\n");
+ if (name == usart || name == new_uart) {
+ dev_dbg(port->dev, "Usart or uart with hw timer\n");
atmel_port->has_hw_timer = true;
} else if (name == dbgu_uart) {
dev_dbg(port->dev, "Dbgu or uart without hw timer\n");
--
2.1.3
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH 2/2] serial: atmel: add support for new UART version
2016-01-25 17:38 ` [PATCH 2/2] serial: atmel: add support for new UART version Nicolas Ferre
@ 2016-01-25 18:34 ` kbuild test robot
2016-01-26 10:25 ` Nicolas Ferre
0 siblings, 1 reply; 4+ messages in thread
From: kbuild test robot @ 2016-01-25 18:34 UTC (permalink / raw)
To: Nicolas Ferre
Cc: kbuild-all, Greg Kroah-Hartman, linux-arm-kernel, linux-kernel,
linux-serial, jslaby, davidm, Nicolas Ferre
[-- Attachment #1: Type: text/plain, Size: 1513 bytes --]
Hi Nicolas,
[auto build test ERROR on usb/usb-testing]
[also build test ERROR on v4.5-rc1 next-20160125]
[if your patch is applied to the wrong git tree, please drop us a note to help improving the system]
url: https://github.com/0day-ci/linux/commits/Nicolas-Ferre/serial-atmel-trivial-clean-the-IP-version-decoding-code/20160126-014116
base: https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git usb-testing
config: i386-allmodconfig (attached as .config)
reproduce:
# save the attached .config to linux build tree
make ARCH=i386
All errors (new ones prefixed by >>):
drivers/tty/serial/atmel_serial.c: In function 'atmel_get_ip_name':
>> drivers/tty/serial/atmel_serial.c:1717:2: error: 'new_uart' undeclared (first use in this function)
new_uart = 0x55415254; /* UART */
^
drivers/tty/serial/atmel_serial.c:1717:2: note: each undeclared identifier is reported only once for each function it appears in
vim +/new_uart +1717 drivers/tty/serial/atmel_serial.c
1711 int name = atmel_uart_readl(port, ATMEL_US_NAME);
1712 u32 version;
1713 u32 usart, dbgu_uart;
1714 /* ASCII decoding for IP version */
1715 usart = 0x55534152; /* USAR(T) */
1716 dbgu_uart = 0x44424755; /* DBGU */
> 1717 new_uart = 0x55415254; /* UART */
1718
1719 atmel_port->has_hw_timer = false;
1720
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
[-- Attachment #2: .config.gz --]
[-- Type: application/octet-stream, Size: 53452 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 2/2] serial: atmel: add support for new UART version
2016-01-25 18:34 ` kbuild test robot
@ 2016-01-26 10:25 ` Nicolas Ferre
0 siblings, 0 replies; 4+ messages in thread
From: Nicolas Ferre @ 2016-01-26 10:25 UTC (permalink / raw)
To: kbuild test robot, Greg Kroah-Hartman
Cc: kbuild-all, linux-arm-kernel, linux-kernel, linux-serial, jslaby,
davidm
Le 25/01/2016 19:34, kbuild test robot a écrit :
> Hi Nicolas,
>
> [auto build test ERROR on usb/usb-testing]
> [also build test ERROR on v4.5-rc1 next-20160125]
> [if your patch is applied to the wrong git tree, please drop us a note to help improving the system]
>
> url: https://github.com/0day-ci/linux/commits/Nicolas-Ferre/serial-atmel-trivial-clean-the-IP-version-decoding-code/20160126-014116
> base: https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git usb-testing
> config: i386-allmodconfig (attached as .config)
> reproduce:
> # save the attached .config to linux build tree
> make ARCH=i386
>
> All errors (new ones prefixed by >>):
>
> drivers/tty/serial/atmel_serial.c: In function 'atmel_get_ip_name':
>>> drivers/tty/serial/atmel_serial.c:1717:2: error: 'new_uart' undeclared (first use in this function)
Sorry for this dumb error and the associated noise!
I send a v2 immediately.
> new_uart = 0x55415254; /* UART */
> ^
> drivers/tty/serial/atmel_serial.c:1717:2: note: each undeclared identifier is reported only once for each function it appears in
>
> vim +/new_uart +1717 drivers/tty/serial/atmel_serial.c
>
> 1711 int name = atmel_uart_readl(port, ATMEL_US_NAME);
> 1712 u32 version;
> 1713 u32 usart, dbgu_uart;
> 1714 /* ASCII decoding for IP version */
> 1715 usart = 0x55534152; /* USAR(T) */
> 1716 dbgu_uart = 0x44424755; /* DBGU */
>> 1717 new_uart = 0x55415254; /* UART */
> 1718
> 1719 atmel_port->has_hw_timer = false;
> 1720
>
> ---
> 0-DAY kernel test infrastructure Open Source Technology Center
> https://lists.01.org/pipermail/kbuild-all Intel Corporation
>
--
Nicolas Ferre
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2016-01-26 10:25 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-01-25 17:38 [PATCH 1/2] serial: atmel: trivial: clean the IP version decoding code Nicolas Ferre
2016-01-25 17:38 ` [PATCH 2/2] serial: atmel: add support for new UART version Nicolas Ferre
2016-01-25 18:34 ` kbuild test robot
2016-01-26 10:25 ` Nicolas Ferre
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).