Linux-Samsung-soc Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH v2] serial: samsung: Re-factors UART IRQ resource for various Samsung SoC
       [not found] <CGME20200628071932epcas5p175059c085421a95de76202767bd132cf@epcas5p1.samsung.com>
@ 2020-06-28  7:00 ` Tamseel Shams
  2020-06-29  8:35   ` Krzysztof Kozlowski
  0 siblings, 1 reply; 3+ messages in thread
From: Tamseel Shams @ 2020-06-28  7:00 UTC (permalink / raw)
  To: kgene, krzk, gregkh, jslaby
  Cc: linux-arm-kernel, linux-samsung-soc, linux-serial, linux-kernel,
	alim.akhtar, Tamseel Shams

In few older Samsung SoCs like s3c2410, s3c2412
and s3c2440, UART IP is having 2 interrupt lines.
However, in other SoCs like s3c6400, s5pv210,
exynos5433, and exynos4210 UART is having only 1
interrupt line. Due to this, "platform_get_irq(platdev, 1)"
call in the driver gives the following warning:
"IRQ index 1 not found" on recent platforms.

This patch re-factors the IRQ resources handling for
each platform and hence fixing the above warnings seen
on some platforms.

Signed-off-by: Tamseel Shams <m.shams@samsung.com>
---
Removed the RFC tag and using 'platform_get_irq_optional'
instead of 'platform_get_irq' as per comment received from
Robin Murphy.

 drivers/tty/serial/samsung_tty.c | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/drivers/tty/serial/samsung_tty.c b/drivers/tty/serial/samsung_tty.c
index 6ef614d8648c..60554f42e208 100644
--- a/drivers/tty/serial/samsung_tty.c
+++ b/drivers/tty/serial/samsung_tty.c
@@ -60,6 +60,7 @@ struct s3c24xx_uart_info {
 	char			*name;
 	unsigned int		type;
 	unsigned int		fifosize;
+	unsigned int		irq_cnt;
 	unsigned long		rx_fifomask;
 	unsigned long		rx_fifoshift;
 	unsigned long		rx_fifofull;
@@ -1908,10 +1909,13 @@ static int s3c24xx_serial_init_port(struct s3c24xx_uart_port *ourport,
 	else {
 		port->irq = ret;
 		ourport->rx_irq = ret;
-		ourport->tx_irq = ret + 1;
+		if (ourport->info->irq_cnt == 1)
+			ourport->tx_irq = ret;
+		else
+			ourport->tx_irq = ret + 1;
 	}
 
-	ret = platform_get_irq(platdev, 1);
+	ret = platform_get_irq_optional(platdev, 1);
 	if (ret > 0)
 		ourport->tx_irq = ret;
 	/*
@@ -2387,6 +2391,7 @@ static struct s3c24xx_serial_drv_data s3c2410_serial_drv_data = {
 		.name		= "Samsung S3C2410 UART",
 		.type		= PORT_S3C2410,
 		.fifosize	= 16,
+		.irq_cnt	= 2,
 		.rx_fifomask	= S3C2410_UFSTAT_RXMASK,
 		.rx_fifoshift	= S3C2410_UFSTAT_RXSHIFT,
 		.rx_fifofull	= S3C2410_UFSTAT_RXFULL,
@@ -2414,6 +2419,7 @@ static struct s3c24xx_serial_drv_data s3c2412_serial_drv_data = {
 		.name		= "Samsung S3C2412 UART",
 		.type		= PORT_S3C2412,
 		.fifosize	= 64,
+		.irq_cnt	= 2,
 		.has_divslot	= 1,
 		.rx_fifomask	= S3C2440_UFSTAT_RXMASK,
 		.rx_fifoshift	= S3C2440_UFSTAT_RXSHIFT,
@@ -2443,6 +2449,7 @@ static struct s3c24xx_serial_drv_data s3c2440_serial_drv_data = {
 		.name		= "Samsung S3C2440 UART",
 		.type		= PORT_S3C2440,
 		.fifosize	= 64,
+		.irq_cnt	= 2,
 		.has_divslot	= 1,
 		.rx_fifomask	= S3C2440_UFSTAT_RXMASK,
 		.rx_fifoshift	= S3C2440_UFSTAT_RXSHIFT,
@@ -2471,6 +2478,7 @@ static struct s3c24xx_serial_drv_data s3c6400_serial_drv_data = {
 		.name		= "Samsung S3C6400 UART",
 		.type		= PORT_S3C6400,
 		.fifosize	= 64,
+		.irq_cnt	= 1,
 		.has_divslot	= 1,
 		.rx_fifomask	= S3C2440_UFSTAT_RXMASK,
 		.rx_fifoshift	= S3C2440_UFSTAT_RXSHIFT,
@@ -2498,6 +2506,7 @@ static struct s3c24xx_serial_drv_data s5pv210_serial_drv_data = {
 	.info = &(struct s3c24xx_uart_info) {
 		.name		= "Samsung S5PV210 UART",
 		.type		= PORT_S3C6400,
+		.irq_cnt	= 1,
 		.has_divslot	= 1,
 		.rx_fifomask	= S5PV210_UFSTAT_RXMASK,
 		.rx_fifoshift	= S5PV210_UFSTAT_RXSHIFT,
@@ -2526,6 +2535,7 @@ static struct s3c24xx_serial_drv_data s5pv210_serial_drv_data = {
 	.info = &(struct s3c24xx_uart_info) {			\
 		.name		= "Samsung Exynos UART",	\
 		.type		= PORT_S3C6400,			\
+		.irq_cnt	= 1,				\
 		.has_divslot	= 1,				\
 		.rx_fifomask	= S5PV210_UFSTAT_RXMASK,	\
 		.rx_fifoshift	= S5PV210_UFSTAT_RXSHIFT,	\
-- 
2.17.1


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v2] serial: samsung: Re-factors UART IRQ resource for various Samsung SoC
  2020-06-28  7:00 ` [PATCH v2] serial: samsung: Re-factors UART IRQ resource for various Samsung SoC Tamseel Shams
@ 2020-06-29  8:35   ` Krzysztof Kozlowski
  2020-07-04 14:25     ` M Tamseel Shams
  0 siblings, 1 reply; 3+ messages in thread
From: Krzysztof Kozlowski @ 2020-06-29  8:35 UTC (permalink / raw)
  To: Tamseel Shams
  Cc: kgene, gregkh, jslaby, linux-arm-kernel, linux-samsung-soc,
	linux-serial, linux-kernel, alim.akhtar

On Sun, Jun 28, 2020 at 12:30:07PM +0530, Tamseel Shams wrote:
> In few older Samsung SoCs like s3c2410, s3c2412
> and s3c2440, UART IP is having 2 interrupt lines.
> However, in other SoCs like s3c6400, s5pv210,
> exynos5433, and exynos4210 UART is having only 1
> interrupt line. Due to this, "platform_get_irq(platdev, 1)"
> call in the driver gives the following warning:
> "IRQ index 1 not found" on recent platforms.
> 
> This patch re-factors the IRQ resources handling for
> each platform and hence fixing the above warnings seen
> on some platforms.
> 
> Signed-off-by: Tamseel Shams <m.shams@samsung.com>
> ---
> Removed the RFC tag and using 'platform_get_irq_optional'
> instead of 'platform_get_irq' as per comment received from
> Robin Murphy.
> 
>  drivers/tty/serial/samsung_tty.c | 14 ++++++++++++--
>  1 file changed, 12 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/tty/serial/samsung_tty.c b/drivers/tty/serial/samsung_tty.c
> index 6ef614d8648c..60554f42e208 100644
> --- a/drivers/tty/serial/samsung_tty.c
> +++ b/drivers/tty/serial/samsung_tty.c
> @@ -60,6 +60,7 @@ struct s3c24xx_uart_info {
>  	char			*name;
>  	unsigned int		type;
>  	unsigned int		fifosize;
> +	unsigned int		irq_cnt;

No, it's duplicating the logic.

The driver already checks whether SoC has two or one interrupt line with
s3c24xx_serial_has_interrupt_mask() so there is no point to have two of
such methods.

Instead unify it please. Probably entire
s3c24xx_serial_has_interrupt_mask() and s3c24xx_serial_type() should be
removed and switched into *serial_drv_data.

Best regards,
Krzysztof

^ permalink raw reply	[flat|nested] 3+ messages in thread

* RE: [PATCH v2] serial: samsung: Re-factors UART IRQ resource for various Samsung SoC
  2020-06-29  8:35   ` Krzysztof Kozlowski
@ 2020-07-04 14:25     ` M Tamseel Shams
  0 siblings, 0 replies; 3+ messages in thread
From: M Tamseel Shams @ 2020-07-04 14:25 UTC (permalink / raw)
  To: 'Krzysztof Kozlowski'
  Cc: kgene, gregkh, jslaby, linux-arm-kernel, linux-samsung-soc,
	linux-serial, linux-kernel, alim.akhtar

> On Sun, Jun 28, 2020 at 12:30:07PM +0530, Tamseel Shams wrote:
> > In few older Samsung SoCs like s3c2410, s3c2412 and s3c2440, UART IP
> > is having 2 interrupt lines.
> > However, in other SoCs like s3c6400, s5pv210, exynos5433, and
> > exynos4210 UART is having only 1 interrupt line. Due to this,
> > "platform_get_irq(platdev, 1)"
> > call in the driver gives the following warning:
> > "IRQ index 1 not found" on recent platforms.
> >
> > This patch re-factors the IRQ resources handling for each platform and
> > hence fixing the above warnings seen on some platforms.
> >
> > Signed-off-by: Tamseel Shams <m.shams@samsung.com>
> > ---
> > Removed the RFC tag and using 'platform_get_irq_optional'
> > instead of 'platform_get_irq' as per comment received from Robin
> > Murphy.
> >
> >  drivers/tty/serial/samsung_tty.c | 14 ++++++++++++--
> >  1 file changed, 12 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/tty/serial/samsung_tty.c
> > b/drivers/tty/serial/samsung_tty.c
> > index 6ef614d8648c..60554f42e208 100644
> > --- a/drivers/tty/serial/samsung_tty.c
> > +++ b/drivers/tty/serial/samsung_tty.c
> > @@ -60,6 +60,7 @@ struct s3c24xx_uart_info {
> >  	char			*name;
> >  	unsigned int		type;
> >  	unsigned int		fifosize;
> > +	unsigned int		irq_cnt;
> 
> No, it's duplicating the logic.
> 
> The driver already checks whether SoC has two or one interrupt line with
> s3c24xx_serial_has_interrupt_mask() so there is no point to have two of such
> methods.
> 
> Instead unify it please. Probably entire
> s3c24xx_serial_has_interrupt_mask() and s3c24xx_serial_type() should be
> removed and switched into *serial_drv_data.
> 
> Best regards,
> Krzysztof

Hi Krzysztof,
Thanks for letting me know about duplication of logic.
I will remove my logic of checking of number of interrupt line
and replace it with check using s3c24xx_serial_has_interrupt_mask().

I will come up with another patch regarding the suggestion of removal 
of the two functions s3c24xx_serial_has_interrupt_mask() and 
s3c24xx_serial_type() and moving it to *serial_drv_data.

Thanks & Regards,
Tamseel


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, back to index

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <CGME20200628071932epcas5p175059c085421a95de76202767bd132cf@epcas5p1.samsung.com>
2020-06-28  7:00 ` [PATCH v2] serial: samsung: Re-factors UART IRQ resource for various Samsung SoC Tamseel Shams
2020-06-29  8:35   ` Krzysztof Kozlowski
2020-07-04 14:25     ` M Tamseel Shams

Linux-Samsung-soc Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-samsung-soc/0 linux-samsung-soc/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-samsung-soc linux-samsung-soc/ https://lore.kernel.org/linux-samsung-soc \
		linux-samsung-soc@vger.kernel.org
	public-inbox-index linux-samsung-soc

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-samsung-soc


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git