* [PATCH 1/2] tty/serial: at91: fix uart/usart selection for older products @ 2013-10-10 8:43 Nicolas Ferre 2013-10-10 8:43 ` [PATCH 2/2] tty/serial: at91: add a fallback option to determine uart/usart property Nicolas Ferre 2013-10-14 13:58 ` [PATCH 1/2] tty/serial: at91: fix uart/usart selection for older products Jean-Christophe PLAGNIOL-VILLARD 0 siblings, 2 replies; 11+ messages in thread From: Nicolas Ferre @ 2013-10-10 8:43 UTC (permalink / raw) To: Greg Kroah-Hartman, Josh Wu, Bo Shen, linux-arm-kernel, linux-serial Cc: Ludovic Desroches, Jean-Christophe PLAGNIOL-VILLARD, linux-kernel, Nicolas Ferre Since commit 055560b04a8cd063aea916fd083b7aec02c2adb8 (serial: at91: distinguish usart and uart) the older products which do not have a name field in their register map are unable to use their serial output. As the main console output is usually the serial interface (aka DBGU) it is pretty unfortunate. So, instead of failing during probe() we just silently configure the serial peripheral as an uart. It allows us to use these serial outputs. The proper solution is proposed in another patch. Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com> --- drivers/tty/serial/atmel_serial.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/drivers/tty/serial/atmel_serial.c b/drivers/tty/serial/atmel_serial.c index d067285..6b0f75e 100644 --- a/drivers/tty/serial/atmel_serial.c +++ b/drivers/tty/serial/atmel_serial.c @@ -1499,7 +1499,7 @@ static void atmel_set_ops(struct uart_port *port) /* * Get ip name usart or uart */ -static int atmel_get_ip_name(struct uart_port *port) +static void atmel_get_ip_name(struct uart_port *port) { struct atmel_uart_port *atmel_port = to_atmel_uart_port(port); int name = UART_GET_IP_NAME(port); @@ -1518,10 +1518,7 @@ static int atmel_get_ip_name(struct uart_port *port) atmel_port->is_usart = false; } else { dev_err(port->dev, "Not supported ip name, set to uart\n"); - return -EINVAL; } - - return 0; } /* @@ -2405,9 +2402,7 @@ static int atmel_serial_probe(struct platform_device *pdev) /* * Get port name of usart or uart */ - ret = atmel_get_ip_name(&port->uart); - if (ret < 0) - goto err_add_port; + atmel_get_ip_name(&port->uart); return 0; -- 1.8.2.2 ^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH 2/2] tty/serial: at91: add a fallback option to determine uart/usart property 2013-10-10 8:43 [PATCH 1/2] tty/serial: at91: fix uart/usart selection for older products Nicolas Ferre @ 2013-10-10 8:43 ` Nicolas Ferre 2013-10-12 15:00 ` Thomas Petazzoni 2013-10-14 13:59 ` Jean-Christophe PLAGNIOL-VILLARD 2013-10-14 13:58 ` [PATCH 1/2] tty/serial: at91: fix uart/usart selection for older products Jean-Christophe PLAGNIOL-VILLARD 1 sibling, 2 replies; 11+ messages in thread From: Nicolas Ferre @ 2013-10-10 8:43 UTC (permalink / raw) To: Greg Kroah-Hartman, Josh Wu, Bo Shen, linux-arm-kernel, linux-serial Cc: Ludovic Desroches, Jean-Christophe PLAGNIOL-VILLARD, linux-kernel, Nicolas Ferre On older SoC, the "name" field is not filled in the register map. Fix the way to figure out if the serial port is an uart or an usart for these older products (with corresponding properties). Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com> --- drivers/tty/serial/atmel_serial.c | 19 ++++++++++++++++++- include/linux/atmel_serial.h | 1 + 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/drivers/tty/serial/atmel_serial.c b/drivers/tty/serial/atmel_serial.c index 6b0f75e..c7d99af 100644 --- a/drivers/tty/serial/atmel_serial.c +++ b/drivers/tty/serial/atmel_serial.c @@ -99,6 +99,7 @@ static void atmel_stop_rx(struct uart_port *port); #define UART_PUT_RTOR(port,v) __raw_writel(v, (port)->membase + ATMEL_US_RTOR) #define UART_PUT_TTGR(port, v) __raw_writel(v, (port)->membase + ATMEL_US_TTGR) #define UART_GET_IP_NAME(port) __raw_readl((port)->membase + ATMEL_US_NAME) +#define UART_GET_IP_VERSION(port) __raw_readl((port)->membase + ATMEL_US_VERSION) /* PDC registers */ #define UART_PUT_PTCR(port,v) __raw_writel(v, (port)->membase + ATMEL_PDC_PTCR) @@ -1503,6 +1504,7 @@ static void atmel_get_ip_name(struct uart_port *port) { struct atmel_uart_port *atmel_port = to_atmel_uart_port(port); int name = UART_GET_IP_NAME(port); + u32 version; int usart, uart; /* usart and uart ascii */ usart = 0x55534152; @@ -1517,7 +1519,22 @@ static void atmel_get_ip_name(struct uart_port *port) dev_dbg(port->dev, "This is uart\n"); atmel_port->is_usart = false; } else { - dev_err(port->dev, "Not supported ip name, set to uart\n"); + /* fallback for older SoCs: use version field */ + version = UART_GET_IP_VERSION(port); + switch (version) { + case 0x302: + case 0x10213: + dev_dbg(port->dev, "This version is usart\n"); + atmel_port->is_usart = true; + break; + case 0x203: + case 0x10202: + dev_dbg(port->dev, "This version is uart\n"); + atmel_port->is_usart = false; + break; + default: + dev_err(port->dev, "Not supported ip name nor version, set to uart\n"); + } } } diff --git a/include/linux/atmel_serial.h b/include/linux/atmel_serial.h index be201ca..00beddf 100644 --- a/include/linux/atmel_serial.h +++ b/include/linux/atmel_serial.h @@ -125,5 +125,6 @@ #define ATMEL_US_IF 0x4c /* IrDA Filter Register */ #define ATMEL_US_NAME 0xf0 /* Ip Name */ +#define ATMEL_US_VERSION 0xfc /* Ip Version */ #endif -- 1.8.2.2 ^ permalink raw reply related [flat|nested] 11+ messages in thread
* Re: [PATCH 2/2] tty/serial: at91: add a fallback option to determine uart/usart property 2013-10-10 8:43 ` [PATCH 2/2] tty/serial: at91: add a fallback option to determine uart/usart property Nicolas Ferre @ 2013-10-12 15:00 ` Thomas Petazzoni 2013-10-14 13:59 ` Jean-Christophe PLAGNIOL-VILLARD 1 sibling, 0 replies; 11+ messages in thread From: Thomas Petazzoni @ 2013-10-12 15:00 UTC (permalink / raw) To: Nicolas Ferre Cc: Greg Kroah-Hartman, Josh Wu, Bo Shen, linux-arm-kernel, linux-serial, Ludovic Desroches, Jean-Christophe PLAGNIOL-VILLARD, linux-kernel Dear Nicolas Ferre, On Thu, 10 Oct 2013 10:43:32 +0200, Nicolas Ferre wrote: > On older SoC, the "name" field is not filled in the register map. > Fix the way to figure out if the serial port is an uart or an usart for these > older products (with corresponding properties). > > Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com> Tested-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com> On a Calao USB-A9263 board. Without this patch, 3.12-rc4 doesn't boot properly on this board, it 'hangs' while configuring the serial port. Best regards, Thomas -- Thomas Petazzoni, CTO, Free Electrons Embedded Linux, Kernel and Android engineering http://free-electrons.com ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 2/2] tty/serial: at91: add a fallback option to determine uart/usart property 2013-10-10 8:43 ` [PATCH 2/2] tty/serial: at91: add a fallback option to determine uart/usart property Nicolas Ferre 2013-10-12 15:00 ` Thomas Petazzoni @ 2013-10-14 13:59 ` Jean-Christophe PLAGNIOL-VILLARD 2013-10-15 9:19 ` Nicolas Ferre 1 sibling, 1 reply; 11+ messages in thread From: Jean-Christophe PLAGNIOL-VILLARD @ 2013-10-14 13:59 UTC (permalink / raw) To: Nicolas Ferre Cc: Bo Shen, Greg Kroah-Hartman, linux-kernel, Josh Wu, Ludovic Desroches, linux-serial, linux-arm-kernel On 10:43 Thu 10 Oct , Nicolas Ferre wrote: > On older SoC, the "name" field is not filled in the register map. > Fix the way to figure out if the serial port is an uart or an usart for these > older products (with corresponding properties). > > Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com> > --- > drivers/tty/serial/atmel_serial.c | 19 ++++++++++++++++++- > include/linux/atmel_serial.h | 1 + > 2 files changed, 19 insertions(+), 1 deletion(-) > > diff --git a/drivers/tty/serial/atmel_serial.c b/drivers/tty/serial/atmel_serial.c > index 6b0f75e..c7d99af 100644 > --- a/drivers/tty/serial/atmel_serial.c > +++ b/drivers/tty/serial/atmel_serial.c > @@ -99,6 +99,7 @@ static void atmel_stop_rx(struct uart_port *port); > #define UART_PUT_RTOR(port,v) __raw_writel(v, (port)->membase + ATMEL_US_RTOR) > #define UART_PUT_TTGR(port, v) __raw_writel(v, (port)->membase + ATMEL_US_TTGR) > #define UART_GET_IP_NAME(port) __raw_readl((port)->membase + ATMEL_US_NAME) > +#define UART_GET_IP_VERSION(port) __raw_readl((port)->membase + ATMEL_US_VERSION) > > /* PDC registers */ > #define UART_PUT_PTCR(port,v) __raw_writel(v, (port)->membase + ATMEL_PDC_PTCR) > @@ -1503,6 +1504,7 @@ static void atmel_get_ip_name(struct uart_port *port) > { > struct atmel_uart_port *atmel_port = to_atmel_uart_port(port); > int name = UART_GET_IP_NAME(port); > + u32 version; > int usart, uart; > /* usart and uart ascii */ > usart = 0x55534152; > @@ -1517,7 +1519,22 @@ static void atmel_get_ip_name(struct uart_port *port) > dev_dbg(port->dev, "This is uart\n"); > atmel_port->is_usart = false; > } else { > - dev_err(port->dev, "Not supported ip name, set to uart\n"); > + /* fallback for older SoCs: use version field */ > + version = UART_GET_IP_VERSION(port); > + switch (version) { > + case 0x302: > + case 0x10213: > + dev_dbg(port->dev, "This version is usart\n"); > + atmel_port->is_usart = true; > + break; > + case 0x203: > + case 0x10202: > + dev_dbg(port->dev, "This version is uart\n"); > + atmel_port->is_usart = false; > + break; > + default: > + dev_err(port->dev, "Not supported ip name nor version, set to uart\n"); it's not really an error a dev_warn is more oppropriate > + } > } > } > > diff --git a/include/linux/atmel_serial.h b/include/linux/atmel_serial.h > index be201ca..00beddf 100644 > --- a/include/linux/atmel_serial.h > +++ b/include/linux/atmel_serial.h > @@ -125,5 +125,6 @@ > #define ATMEL_US_IF 0x4c /* IrDA Filter Register */ > > #define ATMEL_US_NAME 0xf0 /* Ip Name */ > +#define ATMEL_US_VERSION 0xfc /* Ip Version */ > > #endif > -- > 1.8.2.2 > ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 2/2] tty/serial: at91: add a fallback option to determine uart/usart property 2013-10-14 13:59 ` Jean-Christophe PLAGNIOL-VILLARD @ 2013-10-15 9:19 ` Nicolas Ferre 2013-10-16 20:14 ` Greg Kroah-Hartman 0 siblings, 1 reply; 11+ messages in thread From: Nicolas Ferre @ 2013-10-15 9:19 UTC (permalink / raw) To: Jean-Christophe PLAGNIOL-VILLARD, Greg Kroah-Hartman Cc: Josh Wu, Bo Shen, linux-arm-kernel, linux-serial, Ludovic Desroches, linux-kernel On 14/10/2013 15:59, Jean-Christophe PLAGNIOL-VILLARD : > On 10:43 Thu 10 Oct , Nicolas Ferre wrote: >> On older SoC, the "name" field is not filled in the register map. >> Fix the way to figure out if the serial port is an uart or an usart for these >> older products (with corresponding properties). >> >> Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com> >> --- >> drivers/tty/serial/atmel_serial.c | 19 ++++++++++++++++++- >> include/linux/atmel_serial.h | 1 + >> 2 files changed, 19 insertions(+), 1 deletion(-) >> >> diff --git a/drivers/tty/serial/atmel_serial.c b/drivers/tty/serial/atmel_serial.c >> index 6b0f75e..c7d99af 100644 >> --- a/drivers/tty/serial/atmel_serial.c >> +++ b/drivers/tty/serial/atmel_serial.c >> @@ -99,6 +99,7 @@ static void atmel_stop_rx(struct uart_port *port); >> #define UART_PUT_RTOR(port,v) __raw_writel(v, (port)->membase + ATMEL_US_RTOR) >> #define UART_PUT_TTGR(port, v) __raw_writel(v, (port)->membase + ATMEL_US_TTGR) >> #define UART_GET_IP_NAME(port) __raw_readl((port)->membase + ATMEL_US_NAME) >> +#define UART_GET_IP_VERSION(port) __raw_readl((port)->membase + ATMEL_US_VERSION) >> >> /* PDC registers */ >> #define UART_PUT_PTCR(port,v) __raw_writel(v, (port)->membase + ATMEL_PDC_PTCR) >> @@ -1503,6 +1504,7 @@ static void atmel_get_ip_name(struct uart_port *port) >> { >> struct atmel_uart_port *atmel_port = to_atmel_uart_port(port); >> int name = UART_GET_IP_NAME(port); >> + u32 version; >> int usart, uart; >> /* usart and uart ascii */ >> usart = 0x55534152; >> @@ -1517,7 +1519,22 @@ static void atmel_get_ip_name(struct uart_port *port) >> dev_dbg(port->dev, "This is uart\n"); >> atmel_port->is_usart = false; >> } else { >> - dev_err(port->dev, "Not supported ip name, set to uart\n"); >> + /* fallback for older SoCs: use version field */ >> + version = UART_GET_IP_VERSION(port); >> + switch (version) { >> + case 0x302: >> + case 0x10213: >> + dev_dbg(port->dev, "This version is usart\n"); >> + atmel_port->is_usart = true; >> + break; >> + case 0x203: >> + case 0x10202: >> + dev_dbg(port->dev, "This version is uart\n"); >> + atmel_port->is_usart = false; >> + break; >> + default: >> + dev_err(port->dev, "Not supported ip name nor version, set to uart\n"); > > it's not really an error a dev_warn is more oppropriate As we are already in -rc5 and that these fixes are critical for at91 platforms, I will not re-spin another patch just for this. Moreover, I have the feeling that if we end up in this case, it means that we are in big troubles because the usart/uart included in the product triggering this log is not known (I recall that newer products do not have to hit these lines of code). With these 2 reasons, I prefer to keep my patch like it is. Greg, can you consider taking these two patches as regression fixes for 3.12 (with Tested-by tag from Thomas)? Thanks, bye, >> + } >> } >> } >> >> diff --git a/include/linux/atmel_serial.h b/include/linux/atmel_serial.h >> index be201ca..00beddf 100644 >> --- a/include/linux/atmel_serial.h >> +++ b/include/linux/atmel_serial.h >> @@ -125,5 +125,6 @@ >> #define ATMEL_US_IF 0x4c /* IrDA Filter Register */ >> >> #define ATMEL_US_NAME 0xf0 /* Ip Name */ >> +#define ATMEL_US_VERSION 0xfc /* Ip Version */ >> >> #endif >> -- >> 1.8.2.2 >> > > -- Nicolas Ferre ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 2/2] tty/serial: at91: add a fallback option to determine uart/usart property 2013-10-15 9:19 ` Nicolas Ferre @ 2013-10-16 20:14 ` Greg Kroah-Hartman 2013-10-17 8:16 ` Nicolas Ferre 0 siblings, 1 reply; 11+ messages in thread From: Greg Kroah-Hartman @ 2013-10-16 20:14 UTC (permalink / raw) To: Nicolas Ferre Cc: Jean-Christophe PLAGNIOL-VILLARD, Josh Wu, Bo Shen, linux-arm-kernel, linux-serial, Ludovic Desroches, linux-kernel On Tue, Oct 15, 2013 at 11:19:18AM +0200, Nicolas Ferre wrote: > On 14/10/2013 15:59, Jean-Christophe PLAGNIOL-VILLARD : > >On 10:43 Thu 10 Oct , Nicolas Ferre wrote: > >>On older SoC, the "name" field is not filled in the register map. > >>Fix the way to figure out if the serial port is an uart or an usart for these > >>older products (with corresponding properties). > >> > >>Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com> > >>--- > >> drivers/tty/serial/atmel_serial.c | 19 ++++++++++++++++++- > >> include/linux/atmel_serial.h | 1 + > >> 2 files changed, 19 insertions(+), 1 deletion(-) > >> > >>diff --git a/drivers/tty/serial/atmel_serial.c b/drivers/tty/serial/atmel_serial.c > >>index 6b0f75e..c7d99af 100644 > >>--- a/drivers/tty/serial/atmel_serial.c > >>+++ b/drivers/tty/serial/atmel_serial.c > >>@@ -99,6 +99,7 @@ static void atmel_stop_rx(struct uart_port *port); > >> #define UART_PUT_RTOR(port,v) __raw_writel(v, (port)->membase + ATMEL_US_RTOR) > >> #define UART_PUT_TTGR(port, v) __raw_writel(v, (port)->membase + ATMEL_US_TTGR) > >> #define UART_GET_IP_NAME(port) __raw_readl((port)->membase + ATMEL_US_NAME) > >>+#define UART_GET_IP_VERSION(port) __raw_readl((port)->membase + ATMEL_US_VERSION) > >> > >> /* PDC registers */ > >> #define UART_PUT_PTCR(port,v) __raw_writel(v, (port)->membase + ATMEL_PDC_PTCR) > >>@@ -1503,6 +1504,7 @@ static void atmel_get_ip_name(struct uart_port *port) > >> { > >> struct atmel_uart_port *atmel_port = to_atmel_uart_port(port); > >> int name = UART_GET_IP_NAME(port); > >>+ u32 version; > >> int usart, uart; > >> /* usart and uart ascii */ > >> usart = 0x55534152; > >>@@ -1517,7 +1519,22 @@ static void atmel_get_ip_name(struct uart_port *port) > >> dev_dbg(port->dev, "This is uart\n"); > >> atmel_port->is_usart = false; > >> } else { > >>- dev_err(port->dev, "Not supported ip name, set to uart\n"); > >>+ /* fallback for older SoCs: use version field */ > >>+ version = UART_GET_IP_VERSION(port); > >>+ switch (version) { > >>+ case 0x302: > >>+ case 0x10213: > >>+ dev_dbg(port->dev, "This version is usart\n"); > >>+ atmel_port->is_usart = true; > >>+ break; > >>+ case 0x203: > >>+ case 0x10202: > >>+ dev_dbg(port->dev, "This version is uart\n"); > >>+ atmel_port->is_usart = false; > >>+ break; > >>+ default: > >>+ dev_err(port->dev, "Not supported ip name nor version, set to uart\n"); > > > >it's not really an error a dev_warn is more oppropriate > > As we are already in -rc5 and that these fixes are critical for at91 > platforms, I will not re-spin another patch just for this. > > Moreover, I have the feeling that if we end up in this case, it > means that we are in big troubles because the usart/uart included in > the product triggering this log is not known (I recall that newer > products do not have to hit these lines of code). > > With these 2 reasons, I prefer to keep my patch like it is. > > Greg, can you consider taking these two patches as regression fixes > for 3.12 (with Tested-by tag from Thomas)? Is this really a regression from 3.11? What's the worry about waiting for 3.13-rc1, getting this correct, and then backporting them to the 3.12-stable trees? I'd prefer that, so, please clean this up properly and resend it, with the tested-by: lines and I'll queue them up for 3.13-rc1. thanks, greg k-h ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 2/2] tty/serial: at91: add a fallback option to determine uart/usart property 2013-10-16 20:14 ` Greg Kroah-Hartman @ 2013-10-17 8:16 ` Nicolas Ferre 2013-10-17 14:13 ` Greg Kroah-Hartman 0 siblings, 1 reply; 11+ messages in thread From: Nicolas Ferre @ 2013-10-17 8:16 UTC (permalink / raw) To: Greg Kroah-Hartman Cc: Jean-Christophe PLAGNIOL-VILLARD, Josh Wu, Bo Shen, linux-arm-kernel, linux-serial, Ludovic Desroches, linux-kernel On 16/10/2013 22:14, Greg Kroah-Hartman : > On Tue, Oct 15, 2013 at 11:19:18AM +0200, Nicolas Ferre wrote: >> On 14/10/2013 15:59, Jean-Christophe PLAGNIOL-VILLARD : >>> On 10:43 Thu 10 Oct , Nicolas Ferre wrote: >>>> On older SoC, the "name" field is not filled in the register map. >>>> Fix the way to figure out if the serial port is an uart or an usart for these >>>> older products (with corresponding properties). >>>> >>>> Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com> >>>> --- >>>> drivers/tty/serial/atmel_serial.c | 19 ++++++++++++++++++- >>>> include/linux/atmel_serial.h | 1 + >>>> 2 files changed, 19 insertions(+), 1 deletion(-) >>>> >>>> diff --git a/drivers/tty/serial/atmel_serial.c b/drivers/tty/serial/atmel_serial.c >>>> index 6b0f75e..c7d99af 100644 >>>> --- a/drivers/tty/serial/atmel_serial.c >>>> +++ b/drivers/tty/serial/atmel_serial.c >>>> @@ -99,6 +99,7 @@ static void atmel_stop_rx(struct uart_port *port); >>>> #define UART_PUT_RTOR(port,v) __raw_writel(v, (port)->membase + ATMEL_US_RTOR) >>>> #define UART_PUT_TTGR(port, v) __raw_writel(v, (port)->membase + ATMEL_US_TTGR) >>>> #define UART_GET_IP_NAME(port) __raw_readl((port)->membase + ATMEL_US_NAME) >>>> +#define UART_GET_IP_VERSION(port) __raw_readl((port)->membase + ATMEL_US_VERSION) >>>> >>>> /* PDC registers */ >>>> #define UART_PUT_PTCR(port,v) __raw_writel(v, (port)->membase + ATMEL_PDC_PTCR) >>>> @@ -1503,6 +1504,7 @@ static void atmel_get_ip_name(struct uart_port *port) >>>> { >>>> struct atmel_uart_port *atmel_port = to_atmel_uart_port(port); >>>> int name = UART_GET_IP_NAME(port); >>>> + u32 version; >>>> int usart, uart; >>>> /* usart and uart ascii */ >>>> usart = 0x55534152; >>>> @@ -1517,7 +1519,22 @@ static void atmel_get_ip_name(struct uart_port *port) >>>> dev_dbg(port->dev, "This is uart\n"); >>>> atmel_port->is_usart = false; >>>> } else { >>>> - dev_err(port->dev, "Not supported ip name, set to uart\n"); >>>> + /* fallback for older SoCs: use version field */ >>>> + version = UART_GET_IP_VERSION(port); >>>> + switch (version) { >>>> + case 0x302: >>>> + case 0x10213: >>>> + dev_dbg(port->dev, "This version is usart\n"); >>>> + atmel_port->is_usart = true; >>>> + break; >>>> + case 0x203: >>>> + case 0x10202: >>>> + dev_dbg(port->dev, "This version is uart\n"); >>>> + atmel_port->is_usart = false; >>>> + break; >>>> + default: >>>> + dev_err(port->dev, "Not supported ip name nor version, set to uart\n"); >>> >>> it's not really an error a dev_warn is more oppropriate >> >> As we are already in -rc5 and that these fixes are critical for at91 >> platforms, I will not re-spin another patch just for this. >> >> Moreover, I have the feeling that if we end up in this case, it >> means that we are in big troubles because the usart/uart included in >> the product triggering this log is not known (I recall that newer >> products do not have to hit these lines of code). >> >> With these 2 reasons, I prefer to keep my patch like it is. >> >> Greg, can you consider taking these two patches as regression fixes >> for 3.12 (with Tested-by tag from Thomas)? > > Is this really a regression from 3.11? Yes it is. Commit id that I am referring to in patch 1/2 (055560b04a8cd063aea916fd083b7aec02c2adb8) hit the mainline in 3.12-rc time-frame. > What's the worry about waiting > for 3.13-rc1, getting this correct, and then backporting them to the > 3.12-stable trees? It will break all older at91 in 3.12-final. Moreover, I do think that the actual patches are bringing an incorrect solution and I do not plan to have a better one (which one?) for 3.13... > I'd prefer that, so, please clean this up properly and resend it, with > the tested-by: lines and I'll queue them up for 3.13-rc1. I do not know what to cleanup. Anyway, tell me if you want that I resend the series of 2 patches with the "Tested-by" tag included. Bye, -- Nicolas Ferre ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 2/2] tty/serial: at91: add a fallback option to determine uart/usart property 2013-10-17 8:16 ` Nicolas Ferre @ 2013-10-17 14:13 ` Greg Kroah-Hartman 2013-10-17 15:33 ` Nicolas Ferre 0 siblings, 1 reply; 11+ messages in thread From: Greg Kroah-Hartman @ 2013-10-17 14:13 UTC (permalink / raw) To: Nicolas Ferre Cc: Jean-Christophe PLAGNIOL-VILLARD, Josh Wu, Bo Shen, linux-arm-kernel, linux-serial, Ludovic Desroches, linux-kernel On Thu, Oct 17, 2013 at 10:16:47AM +0200, Nicolas Ferre wrote: > On 16/10/2013 22:14, Greg Kroah-Hartman : > > On Tue, Oct 15, 2013 at 11:19:18AM +0200, Nicolas Ferre wrote: > >> On 14/10/2013 15:59, Jean-Christophe PLAGNIOL-VILLARD : > >>> On 10:43 Thu 10 Oct , Nicolas Ferre wrote: > >>>> On older SoC, the "name" field is not filled in the register map. > >>>> Fix the way to figure out if the serial port is an uart or an usart for these > >>>> older products (with corresponding properties). > >>>> > >>>> Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com> > >>>> --- > >>>> drivers/tty/serial/atmel_serial.c | 19 ++++++++++++++++++- > >>>> include/linux/atmel_serial.h | 1 + > >>>> 2 files changed, 19 insertions(+), 1 deletion(-) > >>>> > >>>> diff --git a/drivers/tty/serial/atmel_serial.c b/drivers/tty/serial/atmel_serial.c > >>>> index 6b0f75e..c7d99af 100644 > >>>> --- a/drivers/tty/serial/atmel_serial.c > >>>> +++ b/drivers/tty/serial/atmel_serial.c > >>>> @@ -99,6 +99,7 @@ static void atmel_stop_rx(struct uart_port *port); > >>>> #define UART_PUT_RTOR(port,v) __raw_writel(v, (port)->membase + ATMEL_US_RTOR) > >>>> #define UART_PUT_TTGR(port, v) __raw_writel(v, (port)->membase + ATMEL_US_TTGR) > >>>> #define UART_GET_IP_NAME(port) __raw_readl((port)->membase + ATMEL_US_NAME) > >>>> +#define UART_GET_IP_VERSION(port) __raw_readl((port)->membase + ATMEL_US_VERSION) > >>>> > >>>> /* PDC registers */ > >>>> #define UART_PUT_PTCR(port,v) __raw_writel(v, (port)->membase + ATMEL_PDC_PTCR) > >>>> @@ -1503,6 +1504,7 @@ static void atmel_get_ip_name(struct uart_port *port) > >>>> { > >>>> struct atmel_uart_port *atmel_port = to_atmel_uart_port(port); > >>>> int name = UART_GET_IP_NAME(port); > >>>> + u32 version; > >>>> int usart, uart; > >>>> /* usart and uart ascii */ > >>>> usart = 0x55534152; > >>>> @@ -1517,7 +1519,22 @@ static void atmel_get_ip_name(struct uart_port *port) > >>>> dev_dbg(port->dev, "This is uart\n"); > >>>> atmel_port->is_usart = false; > >>>> } else { > >>>> - dev_err(port->dev, "Not supported ip name, set to uart\n"); > >>>> + /* fallback for older SoCs: use version field */ > >>>> + version = UART_GET_IP_VERSION(port); > >>>> + switch (version) { > >>>> + case 0x302: > >>>> + case 0x10213: > >>>> + dev_dbg(port->dev, "This version is usart\n"); > >>>> + atmel_port->is_usart = true; > >>>> + break; > >>>> + case 0x203: > >>>> + case 0x10202: > >>>> + dev_dbg(port->dev, "This version is uart\n"); > >>>> + atmel_port->is_usart = false; > >>>> + break; > >>>> + default: > >>>> + dev_err(port->dev, "Not supported ip name nor version, set to uart\n"); > >>> > >>> it's not really an error a dev_warn is more oppropriate > >> > >> As we are already in -rc5 and that these fixes are critical for at91 > >> platforms, I will not re-spin another patch just for this. > >> > >> Moreover, I have the feeling that if we end up in this case, it > >> means that we are in big troubles because the usart/uart included in > >> the product triggering this log is not known (I recall that newer > >> products do not have to hit these lines of code). > >> > >> With these 2 reasons, I prefer to keep my patch like it is. > >> > >> Greg, can you consider taking these two patches as regression fixes > >> for 3.12 (with Tested-by tag from Thomas)? > > > > Is this really a regression from 3.11? > > Yes it is. Commit id that I am referring to in patch 1/2 > (055560b04a8cd063aea916fd083b7aec02c2adb8) hit the mainline in 3.12-rc > time-frame. Ok. > > What's the worry about waiting > > for 3.13-rc1, getting this correct, and then backporting them to the > > 3.12-stable trees? > > It will break all older at91 in 3.12-final. Moreover, I do think that > the actual patches are bringing an incorrect solution and I do not plan > to have a better one (which one?) for 3.13... > > > I'd prefer that, so, please clean this up properly and resend it, with > > the tested-by: lines and I'll queue them up for 3.13-rc1. > > I do not know what to cleanup. Anyway, tell me if you want that I resend > the series of 2 patches with the "Tested-by" tag included. I thought there was some dev_warn() changes that were asked for... Anyway, please resend them if you want me to take them for any tree as I no longer have them in my queue. thanks, greg k-h ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 2/2] tty/serial: at91: add a fallback option to determine uart/usart property 2013-10-17 14:13 ` Greg Kroah-Hartman @ 2013-10-17 15:33 ` Nicolas Ferre 0 siblings, 0 replies; 11+ messages in thread From: Nicolas Ferre @ 2013-10-17 15:33 UTC (permalink / raw) To: Greg Kroah-Hartman Cc: Jean-Christophe PLAGNIOL-VILLARD, Josh Wu, Bo Shen, linux-arm-kernel, linux-serial, Ludovic Desroches, linux-kernel On 17/10/2013 16:13, Greg Kroah-Hartman : > On Thu, Oct 17, 2013 at 10:16:47AM +0200, Nicolas Ferre wrote: >> On 16/10/2013 22:14, Greg Kroah-Hartman : >>> On Tue, Oct 15, 2013 at 11:19:18AM +0200, Nicolas Ferre wrote: >>>> On 14/10/2013 15:59, Jean-Christophe PLAGNIOL-VILLARD : >>>>> On 10:43 Thu 10 Oct , Nicolas Ferre wrote: >>>>>> On older SoC, the "name" field is not filled in the register map. >>>>>> Fix the way to figure out if the serial port is an uart or an usart for these >>>>>> older products (with corresponding properties). >>>>>> >>>>>> Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com> >>>>>> --- >>>>>> drivers/tty/serial/atmel_serial.c | 19 ++++++++++++++++++- >>>>>> include/linux/atmel_serial.h | 1 + >>>>>> 2 files changed, 19 insertions(+), 1 deletion(-) >>>>>> >>>>>> diff --git a/drivers/tty/serial/atmel_serial.c b/drivers/tty/serial/atmel_serial.c >>>>>> index 6b0f75e..c7d99af 100644 >>>>>> --- a/drivers/tty/serial/atmel_serial.c >>>>>> +++ b/drivers/tty/serial/atmel_serial.c >>>>>> @@ -99,6 +99,7 @@ static void atmel_stop_rx(struct uart_port *port); >>>>>> #define UART_PUT_RTOR(port,v) __raw_writel(v, (port)->membase + ATMEL_US_RTOR) >>>>>> #define UART_PUT_TTGR(port, v) __raw_writel(v, (port)->membase + ATMEL_US_TTGR) >>>>>> #define UART_GET_IP_NAME(port) __raw_readl((port)->membase + ATMEL_US_NAME) >>>>>> +#define UART_GET_IP_VERSION(port) __raw_readl((port)->membase + ATMEL_US_VERSION) >>>>>> >>>>>> /* PDC registers */ >>>>>> #define UART_PUT_PTCR(port,v) __raw_writel(v, (port)->membase + ATMEL_PDC_PTCR) >>>>>> @@ -1503,6 +1504,7 @@ static void atmel_get_ip_name(struct uart_port *port) >>>>>> { >>>>>> struct atmel_uart_port *atmel_port = to_atmel_uart_port(port); >>>>>> int name = UART_GET_IP_NAME(port); >>>>>> + u32 version; >>>>>> int usart, uart; >>>>>> /* usart and uart ascii */ >>>>>> usart = 0x55534152; >>>>>> @@ -1517,7 +1519,22 @@ static void atmel_get_ip_name(struct uart_port *port) >>>>>> dev_dbg(port->dev, "This is uart\n"); >>>>>> atmel_port->is_usart = false; >>>>>> } else { >>>>>> - dev_err(port->dev, "Not supported ip name, set to uart\n"); >>>>>> + /* fallback for older SoCs: use version field */ >>>>>> + version = UART_GET_IP_VERSION(port); >>>>>> + switch (version) { >>>>>> + case 0x302: >>>>>> + case 0x10213: >>>>>> + dev_dbg(port->dev, "This version is usart\n"); >>>>>> + atmel_port->is_usart = true; >>>>>> + break; >>>>>> + case 0x203: >>>>>> + case 0x10202: >>>>>> + dev_dbg(port->dev, "This version is uart\n"); >>>>>> + atmel_port->is_usart = false; >>>>>> + break; >>>>>> + default: >>>>>> + dev_err(port->dev, "Not supported ip name nor version, set to uart\n"); >>>>> >>>>> it's not really an error a dev_warn is more oppropriate >>>> >>>> As we are already in -rc5 and that these fixes are critical for at91 >>>> platforms, I will not re-spin another patch just for this. >>>> >>>> Moreover, I have the feeling that if we end up in this case, it >>>> means that we are in big troubles because the usart/uart included in >>>> the product triggering this log is not known (I recall that newer >>>> products do not have to hit these lines of code). >>>> >>>> With these 2 reasons, I prefer to keep my patch like it is. >>>> >>>> Greg, can you consider taking these two patches as regression fixes >>>> for 3.12 (with Tested-by tag from Thomas)? >>> >>> Is this really a regression from 3.11? >> >> Yes it is. Commit id that I am referring to in patch 1/2 >> (055560b04a8cd063aea916fd083b7aec02c2adb8) hit the mainline in 3.12-rc >> time-frame. > > Ok. > >>> What's the worry about waiting >>> for 3.13-rc1, getting this correct, and then backporting them to the >>> 3.12-stable trees? >> >> It will break all older at91 in 3.12-final. Moreover, I do think that >> the actual patches are bringing an incorrect solution and I do not plan >> to have a better one (which one?) for 3.13... >> >>> I'd prefer that, so, please clean this up properly and resend it, with >>> the tested-by: lines and I'll queue them up for 3.13-rc1. >> >> I do not know what to cleanup. Anyway, tell me if you want that I resend >> the series of 2 patches with the "Tested-by" tag included. > > I thought there was some dev_warn() changes that were asked for... Asked for, but I do not agree (my arguments above). > Anyway, please resend them if you want me to take them for any tree as I > no longer have them in my queue. Okay, I re-send you them right now. Thanks, bye, -- Nicolas Ferre ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 1/2] tty/serial: at91: fix uart/usart selection for older products 2013-10-10 8:43 [PATCH 1/2] tty/serial: at91: fix uart/usart selection for older products Nicolas Ferre 2013-10-10 8:43 ` [PATCH 2/2] tty/serial: at91: add a fallback option to determine uart/usart property Nicolas Ferre @ 2013-10-14 13:58 ` Jean-Christophe PLAGNIOL-VILLARD 2013-10-15 9:10 ` Nicolas Ferre 1 sibling, 1 reply; 11+ messages in thread From: Jean-Christophe PLAGNIOL-VILLARD @ 2013-10-14 13:58 UTC (permalink / raw) To: Nicolas Ferre Cc: Bo Shen, Greg Kroah-Hartman, linux-kernel, Josh Wu, Ludovic Desroches, linux-serial, linux-arm-kernel On 10:43 Thu 10 Oct , Nicolas Ferre wrote: > Since commit 055560b04a8cd063aea916fd083b7aec02c2adb8 (serial: at91: > distinguish usart and uart) the older products which do not have a > name field in their register map are unable to use their serial output. > As the main console output is usually the serial interface (aka DBGU) it > is pretty unfortunate. > So, instead of failing during probe() we just silently configure the serial > peripheral as an uart. It allows us to use these serial outputs. > The proper solution is proposed in another patch. > > Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com> > --- > drivers/tty/serial/atmel_serial.c | 9 ++------- > 1 file changed, 2 insertions(+), 7 deletions(-) > > diff --git a/drivers/tty/serial/atmel_serial.c b/drivers/tty/serial/atmel_serial.c > index d067285..6b0f75e 100644 > --- a/drivers/tty/serial/atmel_serial.c > +++ b/drivers/tty/serial/atmel_serial.c > @@ -1499,7 +1499,7 @@ static void atmel_set_ops(struct uart_port *port) > /* > * Get ip name usart or uart > */ > -static int atmel_get_ip_name(struct uart_port *port) > +static void atmel_get_ip_name(struct uart_port *port) > { > struct atmel_uart_port *atmel_port = to_atmel_uart_port(port); > int name = UART_GET_IP_NAME(port); > @@ -1518,10 +1518,7 @@ static int atmel_get_ip_name(struct uart_port *port) > atmel_port->is_usart = false; > } else { a dev_warn here maybe usefull to known when we will have a new ip name and not yet wupported Best Regards, J. > dev_err(port->dev, "Not supported ip name, set to uart\n"); > - return -EINVAL; > } > - > - return 0; > } > > /* > @@ -2405,9 +2402,7 @@ static int atmel_serial_probe(struct platform_device *pdev) > /* > * Get port name of usart or uart > */ > - ret = atmel_get_ip_name(&port->uart); > - if (ret < 0) > - goto err_add_port; > + atmel_get_ip_name(&port->uart); > > return 0; > > -- > 1.8.2.2 > ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 1/2] tty/serial: at91: fix uart/usart selection for older products 2013-10-14 13:58 ` [PATCH 1/2] tty/serial: at91: fix uart/usart selection for older products Jean-Christophe PLAGNIOL-VILLARD @ 2013-10-15 9:10 ` Nicolas Ferre 0 siblings, 0 replies; 11+ messages in thread From: Nicolas Ferre @ 2013-10-15 9:10 UTC (permalink / raw) To: Jean-Christophe PLAGNIOL-VILLARD Cc: Greg Kroah-Hartman, Josh Wu, Bo Shen, linux-arm-kernel, linux-serial, Ludovic Desroches, linux-kernel On 14/10/2013 15:58, Jean-Christophe PLAGNIOL-VILLARD : > On 10:43 Thu 10 Oct , Nicolas Ferre wrote: >> Since commit 055560b04a8cd063aea916fd083b7aec02c2adb8 (serial: at91: >> distinguish usart and uart) the older products which do not have a >> name field in their register map are unable to use their serial output. >> As the main console output is usually the serial interface (aka DBGU) it >> is pretty unfortunate. >> So, instead of failing during probe() we just silently configure the serial >> peripheral as an uart. It allows us to use these serial outputs. >> The proper solution is proposed in another patch. >> >> Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com> >> --- >> drivers/tty/serial/atmel_serial.c | 9 ++------- >> 1 file changed, 2 insertions(+), 7 deletions(-) >> >> diff --git a/drivers/tty/serial/atmel_serial.c b/drivers/tty/serial/atmel_serial.c >> index d067285..6b0f75e 100644 >> --- a/drivers/tty/serial/atmel_serial.c >> +++ b/drivers/tty/serial/atmel_serial.c >> @@ -1499,7 +1499,7 @@ static void atmel_set_ops(struct uart_port *port) >> /* >> * Get ip name usart or uart >> */ >> -static int atmel_get_ip_name(struct uart_port *port) >> +static void atmel_get_ip_name(struct uart_port *port) >> { >> struct atmel_uart_port *atmel_port = to_atmel_uart_port(port); >> int name = UART_GET_IP_NAME(port); >> @@ -1518,10 +1518,7 @@ static int atmel_get_ip_name(struct uart_port *port) >> atmel_port->is_usart = false; >> } else { > a dev_warn here maybe > > usefull to known when we will have a new ip name and not yet wupported No, not here: next patch is oveloading this if/else directive. >> dev_err(port->dev, "Not supported ip name, set to uart\n"); >> - return -EINVAL; >> } >> - >> - return 0; >> } >> >> /* >> @@ -2405,9 +2402,7 @@ static int atmel_serial_probe(struct platform_device *pdev) >> /* >> * Get port name of usart or uart >> */ >> - ret = atmel_get_ip_name(&port->uart); >> - if (ret < 0) >> - goto err_add_port; >> + atmel_get_ip_name(&port->uart); >> >> return 0; >> >> -- >> 1.8.2.2 >> > > -- Nicolas Ferre ^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2013-10-17 15:33 UTC | newest] Thread overview: 11+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2013-10-10 8:43 [PATCH 1/2] tty/serial: at91: fix uart/usart selection for older products Nicolas Ferre 2013-10-10 8:43 ` [PATCH 2/2] tty/serial: at91: add a fallback option to determine uart/usart property Nicolas Ferre 2013-10-12 15:00 ` Thomas Petazzoni 2013-10-14 13:59 ` Jean-Christophe PLAGNIOL-VILLARD 2013-10-15 9:19 ` Nicolas Ferre 2013-10-16 20:14 ` Greg Kroah-Hartman 2013-10-17 8:16 ` Nicolas Ferre 2013-10-17 14:13 ` Greg Kroah-Hartman 2013-10-17 15:33 ` Nicolas Ferre 2013-10-14 13:58 ` [PATCH 1/2] tty/serial: at91: fix uart/usart selection for older products Jean-Christophe PLAGNIOL-VILLARD 2013-10-15 9:10 ` 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).