* [PATCH 02/12] serial: ioremap warning fix for jsm driver.
2011-06-28 16:03 ` [PATCH 01/12] 8250_pci: add -ENODEV code for Intel EG20T PCH Greg Kroah-Hartman
@ 2011-06-28 16:03 ` Greg Kroah-Hartman
2011-06-28 16:03 ` [PATCH 03/12] ARM: SAMSUNG: serial: Fix on handling of one clock source for UART Greg Kroah-Hartman
` (9 subsequent siblings)
10 siblings, 0 replies; 16+ messages in thread
From: Greg Kroah-Hartman @ 2011-06-28 16:03 UTC (permalink / raw)
To: linux-serial; +Cc: Lennart Sorensen, Greg Kroah-Hartman
From: Lennart Sorensen <lsorense@csclub.uwaterloo.ca>
I saw a warning about ioremap from the jsm driver on a system which
looked like this:
resource map sanity check conflict: 0xe0200800 0xe02017ff 0xe0200800 0xe0200fff 0000:01:08.0
Turns out the warning is valid. The jsm driver has been asking to ioremap
0x1000 forever, but in fact only 8 port chips have 0x1000 bytes of memory.
4 port chips have 0x800 and 2 port chips have 0x400 according to the
data sheet. It makes more sense to map the size of the region rather
than a hard coded value. If you happen to have the region legitimately
mapped to a base address that is not 4K aligned, ioremap complains
otherwise.
Signed-off-by: Len Sorensen <lsorense@csclub.uwaterloo.ca>
Acked-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
---
drivers/tty/serial/jsm/jsm_driver.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/drivers/tty/serial/jsm/jsm_driver.c b/drivers/tty/serial/jsm/jsm_driver.c
index 18f5484..96da178 100644
--- a/drivers/tty/serial/jsm/jsm_driver.c
+++ b/drivers/tty/serial/jsm/jsm_driver.c
@@ -125,7 +125,7 @@ static int __devinit jsm_probe_one(struct pci_dev *pdev, const struct pci_device
brd->bd_uart_offset = 0x200;
brd->bd_dividend = 921600;
- brd->re_map_membase = ioremap(brd->membase, 0x1000);
+ brd->re_map_membase = ioremap(brd->membase, pci_resource_len(pdev, 0));
if (!brd->re_map_membase) {
dev_err(&pdev->dev,
"card has no PCI Memory resources, "
--
1.7.5.4
^ permalink raw reply related [flat|nested] 16+ messages in thread* [PATCH 03/12] ARM: SAMSUNG: serial: Fix on handling of one clock source for UART
2011-06-28 16:03 ` [PATCH 01/12] 8250_pci: add -ENODEV code for Intel EG20T PCH Greg Kroah-Hartman
2011-06-28 16:03 ` [PATCH 02/12] serial: ioremap warning fix for jsm driver Greg Kroah-Hartman
@ 2011-06-28 16:03 ` Greg Kroah-Hartman
2011-06-28 16:03 ` [PATCH 04/12] 8250_pci: Fix missing const from merges Greg Kroah-Hartman
` (8 subsequent siblings)
10 siblings, 0 replies; 16+ messages in thread
From: Greg Kroah-Hartman @ 2011-06-28 16:03 UTC (permalink / raw)
To: linux-serial; +Cc: Greg Kroah-Hartman, Kukjin Kim, stable, Boojin Kim
From: Boojin Kim <boojin.kim@samsung.com>
This patch fixes the way of comparison for handling of two or more
clock sources for UART.
For example, if just only one clock source is defined even though
there are two clock sources for UART, the serial driver does not
set proper clock up. Of course, it is problem.
So this patch changes the condition of comparison to avoid useless
setup clock and adds a flag 'NO_NEED_CHECK_CLKSRC' which means
selection of source clock is not required.
In addition, since the Exynos4210 has only one clock source for UART
this patch adds the flag into its common_init_uarts().
Signed-off-by: Boojin Kim <boojin.kim@samsung.com>
Signed-off-by: Kukjin Kim <kgene.kim@samsung.com>
Cc: stable <stable@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
---
arch/arm/mach-exynos4/init.c | 1 +
arch/arm/plat-samsung/include/plat/regs-serial.h | 2 ++
drivers/tty/serial/s5pv210.c | 4 ++--
3 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/arch/arm/mach-exynos4/init.c b/arch/arm/mach-exynos4/init.c
index cf91f50..a8a83e3 100644
--- a/arch/arm/mach-exynos4/init.c
+++ b/arch/arm/mach-exynos4/init.c
@@ -35,6 +35,7 @@ void __init exynos4_common_init_uarts(struct s3c2410_uartcfg *cfg, int no)
tcfg->clocks = exynos4_serial_clocks;
tcfg->clocks_size = ARRAY_SIZE(exynos4_serial_clocks);
}
+ tcfg->flags |= NO_NEED_CHECK_CLKSRC;
}
s3c24xx_init_uartdevs("s5pv210-uart", s5p_uart_resources, cfg, no);
diff --git a/arch/arm/plat-samsung/include/plat/regs-serial.h b/arch/arm/plat-samsung/include/plat/regs-serial.h
index c151c5f..116edfe 100644
--- a/arch/arm/plat-samsung/include/plat/regs-serial.h
+++ b/arch/arm/plat-samsung/include/plat/regs-serial.h
@@ -224,6 +224,8 @@
#define S5PV210_UFSTAT_RXMASK (255<<0)
#define S5PV210_UFSTAT_RXSHIFT (0)
+#define NO_NEED_CHECK_CLKSRC 1
+
#ifndef __ASSEMBLY__
/* struct s3c24xx_uart_clksrc
diff --git a/drivers/tty/serial/s5pv210.c b/drivers/tty/serial/s5pv210.c
index fb2619f..dd194dc 100644
--- a/drivers/tty/serial/s5pv210.c
+++ b/drivers/tty/serial/s5pv210.c
@@ -30,7 +30,7 @@ static int s5pv210_serial_setsource(struct uart_port *port,
struct s3c2410_uartcfg *cfg = port->dev->platform_data;
unsigned long ucon = rd_regl(port, S3C2410_UCON);
- if ((cfg->clocks_size) == 1)
+ if (cfg->flags & NO_NEED_CHECK_CLKSRC)
return 0;
if (strcmp(clk->name, "pclk") == 0)
@@ -55,7 +55,7 @@ static int s5pv210_serial_getsource(struct uart_port *port,
clk->divisor = 1;
- if ((cfg->clocks_size) == 1)
+ if (cfg->flags & NO_NEED_CHECK_CLKSRC)
return 0;
switch (ucon & S5PV210_UCON_CLKMASK) {
--
1.7.5.4
_______________________________________________
stable mailing list
stable@linux.kernel.org
http://linux.kernel.org/mailman/listinfo/stable
^ permalink raw reply related [flat|nested] 16+ messages in thread* [PATCH 04/12] 8250_pci: Fix missing const from merges
2011-06-28 16:03 ` [PATCH 01/12] 8250_pci: add -ENODEV code for Intel EG20T PCH Greg Kroah-Hartman
2011-06-28 16:03 ` [PATCH 02/12] serial: ioremap warning fix for jsm driver Greg Kroah-Hartman
2011-06-28 16:03 ` [PATCH 03/12] ARM: SAMSUNG: serial: Fix on handling of one clock source for UART Greg Kroah-Hartman
@ 2011-06-28 16:03 ` Greg Kroah-Hartman
2011-06-29 1:36 ` Guenter Roeck
2011-06-28 16:03 ` [PATCH 05/12] 8250: Fix capabilities when changing the port type Greg Kroah-Hartman
` (7 subsequent siblings)
10 siblings, 1 reply; 16+ messages in thread
From: Greg Kroah-Hartman @ 2011-06-28 16:03 UTC (permalink / raw)
To: linux-serial
Cc: Alan Cox, Alan Cox, Antony Pavlov, Borislav Petkov, Vasily Averin,
Guenter Roeck, Greg Kroah-Hartman
From: Alan Cox <alan@linux.jf.intel.com>
Signed-off-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Antony Pavlov <antony@niisi.msk.ru>
Signed-off-by: Borislav Petkov <bp@alien8.de>
Signed-off-by: Vasily Averin <vvs@sw.ru>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
---
drivers/tty/serial/8250_pci.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/drivers/tty/serial/8250_pci.c b/drivers/tty/serial/8250_pci.c
index d7dc513..f41b425 100644
--- a/drivers/tty/serial/8250_pci.c
+++ b/drivers/tty/serial/8250_pci.c
@@ -973,7 +973,7 @@ ce4100_serial_setup(struct serial_private *priv,
static int
pci_omegapci_setup(struct serial_private *priv,
- struct pciserial_board *board,
+ const struct pciserial_board *board,
struct uart_port *port, int idx)
{
return setup_port(priv, port, 2, idx * 8, 0);
--
1.7.5.4
^ permalink raw reply related [flat|nested] 16+ messages in thread* Re: [PATCH 04/12] 8250_pci: Fix missing const from merges
2011-06-28 16:03 ` [PATCH 04/12] 8250_pci: Fix missing const from merges Greg Kroah-Hartman
@ 2011-06-29 1:36 ` Guenter Roeck
2011-06-29 4:20 ` Greg KH
0 siblings, 1 reply; 16+ messages in thread
From: Guenter Roeck @ 2011-06-29 1:36 UTC (permalink / raw)
To: linux-serial
Cc: Alan Cox, Alan Cox, Antony Pavlov, Borislav Petkov, Vasily Averin,
Guenter Roeck, Greg Kroah-Hartman
At 09:03 AM 6/28/2011, Greg Kroah-Hartman wrote:
>From: Alan Cox <alan@linux.jf.intel.com>
>
>Signed-off-by: Alan Cox <alan@linux.intel.com>
>Signed-off-by: Antony Pavlov <antony@niisi.msk.ru>
>Signed-off-by: Borislav Petkov <bp@alien8.de>
>Signed-off-by: Vasily Averin <vvs@sw.ru>
>Signed-off-by: Guenter Roeck <linux@roeck-us.net>
>Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
I may be getting old, but I don't fully understand why I am in the
Sign-off path for this one ???
Guenter
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH 04/12] 8250_pci: Fix missing const from merges
2011-06-29 1:36 ` Guenter Roeck
@ 2011-06-29 4:20 ` Greg KH
2011-06-29 14:41 ` Guenter Roeck
0 siblings, 1 reply; 16+ messages in thread
From: Greg KH @ 2011-06-29 4:20 UTC (permalink / raw)
To: Guenter Roeck
Cc: linux-serial, Alan Cox, Alan Cox, Antony Pavlov, Borislav Petkov,
Vasily Averin, Guenter Roeck
On Tue, Jun 28, 2011 at 06:36:23PM -0700, Guenter Roeck wrote:
> At 09:03 AM 6/28/2011, Greg Kroah-Hartman wrote:
> >From: Alan Cox <alan@linux.jf.intel.com>
> >
> >Signed-off-by: Alan Cox <alan@linux.intel.com>
> >Signed-off-by: Antony Pavlov <antony@niisi.msk.ru>
> >Signed-off-by: Borislav Petkov <bp@alien8.de>
> >Signed-off-by: Vasily Averin <vvs@sw.ru>
> >Signed-off-by: Guenter Roeck <linux@roeck-us.net>
> >Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
>
> I may be getting old, but I don't fully understand why I am in the
> Sign-off path for this one ???
Because you sent me a patch that did this same thing, as did others, so
I merged them all together so everyone could get the credit.
greg k-h
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH 04/12] 8250_pci: Fix missing const from merges
2011-06-29 4:20 ` Greg KH
@ 2011-06-29 14:41 ` Guenter Roeck
0 siblings, 0 replies; 16+ messages in thread
From: Guenter Roeck @ 2011-06-29 14:41 UTC (permalink / raw)
To: Greg KH
Cc: linux-serial, Alan Cox, Alan Cox, Antony Pavlov, Borislav Petkov,
Vasily Averin, Guenter Roeck
At 09:20 PM 6/28/2011, Greg KH wrote:
>On Tue, Jun 28, 2011 at 06:36:23PM -0700, Guenter Roeck wrote:
> > At 09:03 AM 6/28/2011, Greg Kroah-Hartman wrote:
> > >From: Alan Cox <alan@linux.jf.intel.com>
> > >
> > >Signed-off-by: Alan Cox <alan@linux.intel.com>
> > >Signed-off-by: Antony Pavlov <antony@niisi.msk.ru>
> > >Signed-off-by: Borislav Petkov <bp@alien8.de>
> > >Signed-off-by: Vasily Averin <vvs@sw.ru>
> > >Signed-off-by: Guenter Roeck <linux@roeck-us.net>
> > >Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
> >
> > I may be getting old, but I don't fully understand why I am in the
> > Sign-off path for this one ???
>
>Because you sent me a patch that did this same thing, as did others, so
>I merged them all together so everyone could get the credit.
Ah yes, one of those. No need to do that for me, if it ever happens again.
Important is that the warning gets fixed.
Thanks,
Guenter
^ permalink raw reply [flat|nested] 16+ messages in thread
* [PATCH 05/12] 8250: Fix capabilities when changing the port type
2011-06-28 16:03 ` [PATCH 01/12] 8250_pci: add -ENODEV code for Intel EG20T PCH Greg Kroah-Hartman
` (2 preceding siblings ...)
2011-06-28 16:03 ` [PATCH 04/12] 8250_pci: Fix missing const from merges Greg Kroah-Hartman
@ 2011-06-28 16:03 ` Greg Kroah-Hartman
2011-06-28 16:03 ` [PATCH 06/12] TTY: ldisc, do not close until there are readers Greg Kroah-Hartman
` (6 subsequent siblings)
10 siblings, 0 replies; 16+ messages in thread
From: Greg Kroah-Hartman @ 2011-06-28 16:03 UTC (permalink / raw)
To: linux-serial; +Cc: leitao@linux.vnet.ibm.com, Michael Reed, Greg Kroah-Hartman
From: "leitao@linux.vnet.ibm.com" <leitao@linux.vnet.ibm.com>
When changing the port type, the capabilities flags should be changed
also, otherwise the capabilities will not correspond to the port type,
which make set_sleep() crash on rmmod.
This patch just assign the correct capabilites when the port changes.
Signed-off-by: Breno Leitao <leitao@linux.vnet.ibm.com>
CC: Michael Reed <mreed@linux.vnet.ibm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
---
drivers/tty/serial/8250.c | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/drivers/tty/serial/8250.c b/drivers/tty/serial/8250.c
index b40f7b9..b4129f5 100644
--- a/drivers/tty/serial/8250.c
+++ b/drivers/tty/serial/8250.c
@@ -3318,6 +3318,7 @@ void serial8250_unregister_port(int line)
uart->port.flags &= ~UPF_BOOT_AUTOCONF;
uart->port.type = PORT_UNKNOWN;
uart->port.dev = &serial8250_isa_devs->dev;
+ uart->capabilities = uart_config[uart->port.type].flags;
uart_add_one_port(&serial8250_reg, &uart->port);
} else {
uart->port.dev = NULL;
--
1.7.5.4
^ permalink raw reply related [flat|nested] 16+ messages in thread* [PATCH 06/12] TTY: ldisc, do not close until there are readers
2011-06-28 16:03 ` [PATCH 01/12] 8250_pci: add -ENODEV code for Intel EG20T PCH Greg Kroah-Hartman
` (3 preceding siblings ...)
2011-06-28 16:03 ` [PATCH 05/12] 8250: Fix capabilities when changing the port type Greg Kroah-Hartman
@ 2011-06-28 16:03 ` Greg Kroah-Hartman
2011-06-28 16:03 ` [PATCH 07/12] TTY: ntty, add one more sanity check Greg Kroah-Hartman
` (5 subsequent siblings)
10 siblings, 0 replies; 16+ messages in thread
From: Greg Kroah-Hartman @ 2011-06-28 16:03 UTC (permalink / raw)
To: linux-serial; +Cc: 39, Greg Kroah-Hartman, Jiri Slaby, 33, 34, 32
From: Jiri Slaby <jslaby@suse.cz>
We restored tty_ldisc_wait_idle in 100eeae2c5c (TTY: restore
tty_ldisc_wait_idle). We used it in the ldisc changing path to fix the
case where there are tasks in n_tty_read waiting for data and somebody
tries to change ldisc.
Similar to the case above, there may be also tasks waiting in
n_tty_read while hangup is performed. As 65b770468e98 (tty-ldisc: turn
ldisc user count into a proper refcount) removed the wait-until-idle
from all paths, hangup path won't wait for them to disappear either
now. So add it back even to the hangup path.
There is a difference, we need uninterruptible sleep as there is
obviously HUP signal pending. So tty_ldisc_wait_idle now sleeps
without possibility to be interrupted. This is what original
tty_ldisc_wait_idle did. After the wait idle reintroduction
(100eeae2c5c), we have had interruptible sleeps for the ldisc changing
path. But as there is a 5s timeout anyway, we don't allow it to be
interrupted from now on. It's not worth the added complexity of
deciding what kind of sleep we want.
Before 65b770468e98 tty_ldisc_release was called also from
tty_ldisc_release. It is called from tty_release, so I don't think we
need to restore that one.
This is nicely reproducible after constifying the timing when
drivers/tty/n_tty.c is patched as follows ("TTY: ntty, add one more
sanity check" patch is needed to actually see it explode):
%% -1548,6 +1549,7 @@ static int n_tty_open(struct tty_struct *tty)
/* These are ugly. Currently a malloc failure here can panic */
if (!tty->read_buf) {
+ msleep(100);
tty->read_buf = kzalloc(N_TTY_BUF_SIZE, GFP_KERNEL);
if (!tty->read_buf)
return -ENOMEM;
%% -1785,6 +1788,7 @@ do_it_again:
break;
}
timeout = schedule_timeout(timeout);
+ msleep(20);
continue;
}
__set_current_state(TASK_RUNNING);
===== With a process: =====
while (1) {
int fd = open(argv[1], O_RDWR);
read(fd, buf, sizeof(buf));
close(fd);
}
===== and its child: =====
setsid();
while (1) {
int fd = open(tty, O_RDWR|O_NOCTTY);
ioctl(fd, TIOCSCTTY, 1);
vhangup();
close(fd);
usleep(100 * (10 + random() % 1000));
}
===== EOF =====
References: https://bugzilla.novell.com/show_bug.cgi?id=693374
References: https://bugzilla.novell.com/show_bug.cgi?id=694509
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: stable <stable@kernel.org> [32, 33, 34, 39]
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
---
drivers/tty/tty_ldisc.c | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/drivers/tty/tty_ldisc.c b/drivers/tty/tty_ldisc.c
index 5d01d32..ef925d5 100644
--- a/drivers/tty/tty_ldisc.c
+++ b/drivers/tty/tty_ldisc.c
@@ -555,7 +555,7 @@ static void tty_ldisc_flush_works(struct tty_struct *tty)
static int tty_ldisc_wait_idle(struct tty_struct *tty)
{
int ret;
- ret = wait_event_interruptible_timeout(tty_ldisc_idle,
+ ret = wait_event_timeout(tty_ldisc_idle,
atomic_read(&tty->ldisc->users) == 1, 5 * HZ);
if (ret < 0)
return ret;
@@ -763,6 +763,8 @@ static int tty_ldisc_reinit(struct tty_struct *tty, int ldisc)
if (IS_ERR(ld))
return -1;
+ WARN_ON_ONCE(tty_ldisc_wait_idle(tty));
+
tty_ldisc_close(tty, tty->ldisc);
tty_ldisc_put(tty->ldisc);
tty->ldisc = NULL;
--
1.7.5.4
_______________________________________________
stable mailing list
stable@linux.kernel.org
http://linux.kernel.org/mailman/listinfo/stable
^ permalink raw reply related [flat|nested] 16+ messages in thread* [PATCH 07/12] TTY: ntty, add one more sanity check
2011-06-28 16:03 ` [PATCH 01/12] 8250_pci: add -ENODEV code for Intel EG20T PCH Greg Kroah-Hartman
` (4 preceding siblings ...)
2011-06-28 16:03 ` [PATCH 06/12] TTY: ldisc, do not close until there are readers Greg Kroah-Hartman
@ 2011-06-28 16:03 ` Greg Kroah-Hartman
2011-06-28 16:03 ` [PATCH 08/12] tty: n_gsm: Fixed logic to decode break signal from modem status Greg Kroah-Hartman
` (4 subsequent siblings)
10 siblings, 0 replies; 16+ messages in thread
From: Greg Kroah-Hartman @ 2011-06-28 16:03 UTC (permalink / raw)
To: linux-serial; +Cc: Jiri Slaby, Alan Cox, Greg Kroah-Hartman
From: Jiri Slaby <jslaby@suse.cz>
With the previous patch, we fixed another bug where read_buf was freed
while we still was in n_tty_read. We currently check whether read_buf
is NULL at the start of the function. Add one more check after we wake
up from waiting for input.
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
---
drivers/tty/n_tty.c | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/drivers/tty/n_tty.c b/drivers/tty/n_tty.c
index 0ad3288..c3954fb 100644
--- a/drivers/tty/n_tty.c
+++ b/drivers/tty/n_tty.c
@@ -1815,6 +1815,7 @@ do_it_again:
/* FIXME: does n_tty_set_room need locking ? */
n_tty_set_room(tty);
timeout = schedule_timeout(timeout);
+ BUG_ON(!tty->read_buf);
continue;
}
__set_current_state(TASK_RUNNING);
--
1.7.5.4
^ permalink raw reply related [flat|nested] 16+ messages in thread* [PATCH 08/12] tty: n_gsm: Fixed logic to decode break signal from modem status
2011-06-28 16:03 ` [PATCH 01/12] 8250_pci: add -ENODEV code for Intel EG20T PCH Greg Kroah-Hartman
` (5 preceding siblings ...)
2011-06-28 16:03 ` [PATCH 07/12] TTY: ntty, add one more sanity check Greg Kroah-Hartman
@ 2011-06-28 16:03 ` Greg Kroah-Hartman
2011-06-28 16:03 ` [PATCH 09/12] tty: n_gsm: improper skb_pull() use was leaking framed data Greg Kroah-Hartman
` (3 subsequent siblings)
10 siblings, 0 replies; 16+ messages in thread
From: Greg Kroah-Hartman @ 2011-06-28 16:03 UTC (permalink / raw)
To: linux-serial; +Cc: Russ Gorby, Greg Kroah-Hartman
From: Russ Gorby <russ.gorby@intel.com>
The modem status can be one or 2 octets and contains the V.24 signals
and in the 2 octet case also the break signal.
We were improperly decoding the break signal from the modem in the
2 octet case.
Signed-off-by: Russ Gorby <russ.gorby@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
---
drivers/tty/n_gsm.c | 23 ++++++++++++++++++-----
1 files changed, 18 insertions(+), 5 deletions(-)
diff --git a/drivers/tty/n_gsm.c b/drivers/tty/n_gsm.c
index 09e8c7d..7290394 100644
--- a/drivers/tty/n_gsm.c
+++ b/drivers/tty/n_gsm.c
@@ -984,10 +984,22 @@ static void gsm_control_reply(struct gsm_mux *gsm, int cmd, u8 *data,
*/
static void gsm_process_modem(struct tty_struct *tty, struct gsm_dlci *dlci,
- u32 modem)
+ u32 modem, int clen)
{
int mlines = 0;
- u8 brk = modem >> 6;
+ u8 brk = 0;
+
+ /* The modem status command can either contain one octet (v.24 signals)
+ or two octets (v.24 signals + break signals). The length field will
+ either be 2 or 3 respectively. This is specified in section
+ 5.4.6.3.7 of the 27.010 mux spec. */
+
+ if (clen == 2)
+ modem = modem & 0x7f;
+ else {
+ brk = modem & 0x7f;
+ modem = (modem >> 7) & 0x7f;
+ };
/* Flow control/ready to communicate */
if (modem & MDM_FC) {
@@ -1061,7 +1073,7 @@ static void gsm_control_modem(struct gsm_mux *gsm, u8 *data, int clen)
return;
}
tty = tty_port_tty_get(&dlci->port);
- gsm_process_modem(tty, dlci, modem);
+ gsm_process_modem(tty, dlci, modem, clen);
if (tty) {
tty_wakeup(tty);
tty_kref_put(tty);
@@ -1482,12 +1494,13 @@ static void gsm_dlci_begin_close(struct gsm_dlci *dlci)
* open we shovel the bits down it, if not we drop them.
*/
-static void gsm_dlci_data(struct gsm_dlci *dlci, u8 *data, int len)
+static void gsm_dlci_data(struct gsm_dlci *dlci, u8 *data, int clen)
{
/* krefs .. */
struct tty_port *port = &dlci->port;
struct tty_struct *tty = tty_port_tty_get(port);
unsigned int modem = 0;
+ int len = clen;
if (debug & 16)
pr_debug("%d bytes for tty %p\n", len, tty);
@@ -1507,7 +1520,7 @@ static void gsm_dlci_data(struct gsm_dlci *dlci, u8 *data, int len)
if (len == 0)
return;
}
- gsm_process_modem(tty, dlci, modem);
+ gsm_process_modem(tty, dlci, modem, clen);
/* Line state will go via DLCI 0 controls only */
case 1:
default:
--
1.7.5.4
^ permalink raw reply related [flat|nested] 16+ messages in thread* [PATCH 09/12] tty: n_gsm: improper skb_pull() use was leaking framed data
2011-06-28 16:03 ` [PATCH 01/12] 8250_pci: add -ENODEV code for Intel EG20T PCH Greg Kroah-Hartman
` (6 preceding siblings ...)
2011-06-28 16:03 ` [PATCH 08/12] tty: n_gsm: Fixed logic to decode break signal from modem status Greg Kroah-Hartman
@ 2011-06-28 16:03 ` Greg Kroah-Hartman
2011-06-28 16:03 ` [PATCH 10/12] amba pl011: workaround for uart registers lockup Greg Kroah-Hartman
` (2 subsequent siblings)
10 siblings, 0 replies; 16+ messages in thread
From: Greg Kroah-Hartman @ 2011-06-28 16:03 UTC (permalink / raw)
To: linux-serial; +Cc: Russ Gorby, Greg Kroah-Hartman
From: Russ Gorby <russ.gorby@intel.com>
gsm_dlci_data_output_framed() was doing:
memcpy(dp, skb_pull(dlci->skb, len), len);
The problem is skb_pull() returns the post-increment data ptr
so the first chunk of dlci->skb->data is leaked.
Signed-off-by: Russ Gorby <russ.gorby@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
---
drivers/tty/n_gsm.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/drivers/tty/n_gsm.c b/drivers/tty/n_gsm.c
index 7290394..19b4ae0 100644
--- a/drivers/tty/n_gsm.c
+++ b/drivers/tty/n_gsm.c
@@ -875,7 +875,8 @@ static int gsm_dlci_data_output_framed(struct gsm_mux *gsm,
*dp++ = last << 7 | first << 6 | 1; /* EA */
len--;
}
- memcpy(dp, skb_pull(dlci->skb, len), len);
+ memcpy(dp, dlci->skb->data, len);
+ skb_pull(dlci->skb, len);
__gsm_data_queue(dlci, msg);
if (last)
dlci->skb = NULL;
--
1.7.5.4
^ permalink raw reply related [flat|nested] 16+ messages in thread* [PATCH 10/12] amba pl011: workaround for uart registers lockup
2011-06-28 16:03 ` [PATCH 01/12] 8250_pci: add -ENODEV code for Intel EG20T PCH Greg Kroah-Hartman
` (7 preceding siblings ...)
2011-06-28 16:03 ` [PATCH 09/12] tty: n_gsm: improper skb_pull() use was leaking framed data Greg Kroah-Hartman
@ 2011-06-28 16:03 ` Greg Kroah-Hartman
2011-06-28 16:03 ` [PATCH 11/12] amba pl011: platform data for reg lockup and glitch v2 Greg Kroah-Hartman
2011-06-28 16:03 ` [PATCH 12/12] serial: bcm63xx_uart: fix irq storm after rx fifo overrun Greg Kroah-Hartman
10 siblings, 0 replies; 16+ messages in thread
From: Greg Kroah-Hartman @ 2011-06-28 16:03 UTC (permalink / raw)
To: linux-serial; +Cc: Shreshtha Kumar Sahu, Linus Walleij, Greg Kroah-Hartman
From: Shreshtha Kumar Sahu <shreshthakumar.sahu@stericsson.com>
This workaround aims to break the deadlock situation
which raises during continuous transfer of data for long
duration over uart with hardware flow control. It is
observed that CTS interrupt cannot be cleared in uart
interrupt register (ICR). Hence further transfer over
uart gets blocked.
It is seen that during such deadlock condition ICR
don't get cleared even on multiple write. This leads
pass_counter to decrease and finally reach zero. This
can be taken as trigger point to run this UART_BT_WA.
Workaround backups the register configuration, does soft
reset of UART using BIT-0 of PRCC_K_SOFTRST_SET/CLEAR
registers and restores the registers.
This patch also provides support for uart init and exit
function calls if present.
Signed-off-by: Shreshtha Kumar Sahu <shreshthakumar.sahu@stericsson.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
---
drivers/tty/serial/amba-pl011.c | 123 ++++++++++++++++++++++++++++++++++++++-
include/linux/amba/serial.h | 3 +
2 files changed, 125 insertions(+), 1 deletions(-)
diff --git a/drivers/tty/serial/amba-pl011.c b/drivers/tty/serial/amba-pl011.c
index 8dc0541..f5f6831 100644
--- a/drivers/tty/serial/amba-pl011.c
+++ b/drivers/tty/serial/amba-pl011.c
@@ -50,6 +50,7 @@
#include <linux/dmaengine.h>
#include <linux/dma-mapping.h>
#include <linux/scatterlist.h>
+#include <linux/delay.h>
#include <asm/io.h>
#include <asm/sizes.h>
@@ -65,6 +66,30 @@
#define UART_DR_ERROR (UART011_DR_OE|UART011_DR_BE|UART011_DR_PE|UART011_DR_FE)
#define UART_DUMMY_DR_RX (1 << 16)
+
+#define UART_WA_SAVE_NR 14
+
+static void pl011_lockup_wa(unsigned long data);
+static const u32 uart_wa_reg[UART_WA_SAVE_NR] = {
+ ST_UART011_DMAWM,
+ ST_UART011_TIMEOUT,
+ ST_UART011_LCRH_RX,
+ UART011_IBRD,
+ UART011_FBRD,
+ ST_UART011_LCRH_TX,
+ UART011_IFLS,
+ ST_UART011_XFCR,
+ ST_UART011_XON1,
+ ST_UART011_XON2,
+ ST_UART011_XOFF1,
+ ST_UART011_XOFF2,
+ UART011_CR,
+ UART011_IMSC
+};
+
+static u32 uart_wa_regdata[UART_WA_SAVE_NR];
+static DECLARE_TASKLET(pl011_lockup_tlet, pl011_lockup_wa, 0);
+
/* There is by now at least one vendor with differing details, so handle it */
struct vendor_data {
unsigned int ifls;
@@ -72,6 +97,7 @@ struct vendor_data {
unsigned int lcrh_tx;
unsigned int lcrh_rx;
bool oversampling;
+ bool interrupt_may_hang; /* vendor-specific */
bool dma_threshold;
};
@@ -90,9 +116,12 @@ static struct vendor_data vendor_st = {
.lcrh_tx = ST_UART011_LCRH_TX,
.lcrh_rx = ST_UART011_LCRH_RX,
.oversampling = true,
+ .interrupt_may_hang = true,
.dma_threshold = true,
};
+static struct uart_amba_port *amba_ports[UART_NR];
+
/* Deals with DMA transactions */
struct pl011_sgbuf {
@@ -132,6 +161,7 @@ struct uart_amba_port {
unsigned int lcrh_rx; /* vendor-specific */
bool autorts;
char type[12];
+ bool interrupt_may_hang; /* vendor-specific */
#ifdef CONFIG_DMA_ENGINE
/* DMA stuff */
bool using_tx_dma;
@@ -1008,6 +1038,68 @@ static inline bool pl011_dma_rx_running(struct uart_amba_port *uap)
#endif
+/*
+ * pl011_lockup_wa
+ * This workaround aims to break the deadlock situation
+ * when after long transfer over uart in hardware flow
+ * control, uart interrupt registers cannot be cleared.
+ * Hence uart transfer gets blocked.
+ *
+ * It is seen that during such deadlock condition ICR
+ * don't get cleared even on multiple write. This leads
+ * pass_counter to decrease and finally reach zero. This
+ * can be taken as trigger point to run this UART_BT_WA.
+ *
+ */
+static void pl011_lockup_wa(unsigned long data)
+{
+ struct uart_amba_port *uap = amba_ports[0];
+ void __iomem *base = uap->port.membase;
+ struct circ_buf *xmit = &uap->port.state->xmit;
+ struct tty_struct *tty = uap->port.state->port.tty;
+ int buf_empty_retries = 200;
+ int loop;
+
+ /* Stop HCI layer from submitting data for tx */
+ tty->hw_stopped = 1;
+ while (!uart_circ_empty(xmit)) {
+ if (buf_empty_retries-- == 0)
+ break;
+ udelay(100);
+ }
+
+ /* Backup registers */
+ for (loop = 0; loop < UART_WA_SAVE_NR; loop++)
+ uart_wa_regdata[loop] = readl(base + uart_wa_reg[loop]);
+
+ /* Disable UART so that FIFO data is flushed out */
+ writew(0x00, uap->port.membase + UART011_CR);
+
+ /* Soft reset UART module */
+ if (uap->port.dev->platform_data) {
+ struct amba_pl011_data *plat;
+
+ plat = uap->port.dev->platform_data;
+ if (plat->reset)
+ plat->reset();
+ }
+
+ /* Restore registers */
+ for (loop = 0; loop < UART_WA_SAVE_NR; loop++)
+ writew(uart_wa_regdata[loop] ,
+ uap->port.membase + uart_wa_reg[loop]);
+
+ /* Initialise the old status of the modem signals */
+ uap->old_status = readw(uap->port.membase + UART01x_FR) &
+ UART01x_FR_MODEM_ANY;
+
+ if (readl(base + UART011_MIS) & 0x2)
+ printk(KERN_EMERG "UART_BT_WA: ***FAILED***\n");
+
+ /* Start Tx/Rx */
+ tty->hw_stopped = 0;
+}
+
static void pl011_stop_tx(struct uart_port *port)
{
struct uart_amba_port *uap = (struct uart_amba_port *)port;
@@ -1158,8 +1250,11 @@ static irqreturn_t pl011_int(int irq, void *dev_id)
if (status & UART011_TXIS)
pl011_tx_chars(uap);
- if (pass_counter-- == 0)
+ if (pass_counter-- == 0) {
+ if (uap->interrupt_may_hang)
+ tasklet_schedule(&pl011_lockup_tlet);
break;
+ }
status = readw(uap->port.membase + UART011_MIS);
} while (status != 0);
@@ -1339,6 +1434,14 @@ static int pl011_startup(struct uart_port *port)
writew(uap->im, uap->port.membase + UART011_IMSC);
spin_unlock_irq(&uap->port.lock);
+ if (uap->port.dev->platform_data) {
+ struct amba_pl011_data *plat;
+
+ plat = uap->port.dev->platform_data;
+ if (plat->init)
+ plat->init();
+ }
+
return 0;
clk_dis:
@@ -1394,6 +1497,15 @@ static void pl011_shutdown(struct uart_port *port)
* Shut down the clock producer
*/
clk_disable(uap->clk);
+
+ if (uap->port.dev->platform_data) {
+ struct amba_pl011_data *plat;
+
+ plat = uap->port.dev->platform_data;
+ if (plat->exit)
+ plat->exit();
+ }
+
}
static void
@@ -1700,6 +1812,14 @@ static int __init pl011_console_setup(struct console *co, char *options)
if (!uap)
return -ENODEV;
+ if (uap->port.dev->platform_data) {
+ struct amba_pl011_data *plat;
+
+ plat = uap->port.dev->platform_data;
+ if (plat->init)
+ plat->init();
+ }
+
uap->port.uartclk = clk_get_rate(uap->clk);
if (options)
@@ -1774,6 +1894,7 @@ static int pl011_probe(struct amba_device *dev, const struct amba_id *id)
uap->lcrh_rx = vendor->lcrh_rx;
uap->lcrh_tx = vendor->lcrh_tx;
uap->fifosize = vendor->fifosize;
+ uap->interrupt_may_hang = vendor->interrupt_may_hang;
uap->port.dev = &dev->dev;
uap->port.mapbase = dev->res.start;
uap->port.membase = base;
diff --git a/include/linux/amba/serial.h b/include/linux/amba/serial.h
index 5479fdc..514ed45 100644
--- a/include/linux/amba/serial.h
+++ b/include/linux/amba/serial.h
@@ -201,6 +201,9 @@ struct amba_pl011_data {
bool (*dma_filter)(struct dma_chan *chan, void *filter_param);
void *dma_rx_param;
void *dma_tx_param;
+ void (*init) (void);
+ void (*exit) (void);
+ void (*reset) (void);
};
#endif
--
1.7.5.4
^ permalink raw reply related [flat|nested] 16+ messages in thread* [PATCH 11/12] amba pl011: platform data for reg lockup and glitch v2
2011-06-28 16:03 ` [PATCH 01/12] 8250_pci: add -ENODEV code for Intel EG20T PCH Greg Kroah-Hartman
` (8 preceding siblings ...)
2011-06-28 16:03 ` [PATCH 10/12] amba pl011: workaround for uart registers lockup Greg Kroah-Hartman
@ 2011-06-28 16:03 ` Greg Kroah-Hartman
2011-06-28 16:03 ` [PATCH 12/12] serial: bcm63xx_uart: fix irq storm after rx fifo overrun Greg Kroah-Hartman
10 siblings, 0 replies; 16+ messages in thread
From: Greg Kroah-Hartman @ 2011-06-28 16:03 UTC (permalink / raw)
To: linux-serial; +Cc: Shreshtha Kumar Sahu, Linus Walleij, Greg Kroah-Hartman
From: Shreshtha Kumar Sahu <shreshthakumar.sahu@stericsson.com>
This patch provides platform data for following
- uart reset function to assist uart register lockup workaround
- init/exit function to fix glitch in the tx pin in tty_open
when tty port0 is opened a glitch is seen in the tx line
of uart0. This happens in pl011_startup() when tx fifo
interrupt is provoked into asserting.
Now uart0 pins are enabled (alt function) only when init
is complete and turned back to gpio when closed.
Signed-off-by: Shreshtha Kumar Sahu <shreshthakumar.sahu@stericsson.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
---
arch/arm/mach-ux500/board-mop500-pins.c | 16 +++++++--
arch/arm/mach-ux500/board-mop500.c | 54 +++++++++++++++++++++++++++++++
2 files changed, 66 insertions(+), 4 deletions(-)
diff --git a/arch/arm/mach-ux500/board-mop500-pins.c b/arch/arm/mach-ux500/board-mop500-pins.c
index fd4cf1c..70cdbd6 100644
--- a/arch/arm/mach-ux500/board-mop500-pins.c
+++ b/arch/arm/mach-ux500/board-mop500-pins.c
@@ -110,10 +110,18 @@ static pin_cfg_t mop500_pins_common[] = {
GPIO168_KP_O0,
/* UART */
- GPIO0_U0_CTSn | PIN_INPUT_PULLUP,
- GPIO1_U0_RTSn | PIN_OUTPUT_HIGH,
- GPIO2_U0_RXD | PIN_INPUT_PULLUP,
- GPIO3_U0_TXD | PIN_OUTPUT_HIGH,
+ /* uart-0 pins gpio configuration should be
+ * kept intact to prevent glitch in tx line
+ * when tty dev is opened. Later these pins
+ * are configured to uart mop500_pins_uart0
+ *
+ * It will be replaced with uart configuration
+ * once the issue is solved.
+ */
+ GPIO0_GPIO | PIN_INPUT_PULLUP,
+ GPIO1_GPIO | PIN_OUTPUT_HIGH,
+ GPIO2_GPIO | PIN_INPUT_PULLUP,
+ GPIO3_GPIO | PIN_OUTPUT_HIGH,
GPIO29_U2_RXD | PIN_INPUT_PULLUP,
GPIO30_U2_TXD | PIN_OUTPUT_HIGH,
diff --git a/arch/arm/mach-ux500/board-mop500.c b/arch/arm/mach-ux500/board-mop500.c
index bb26f40..2a08c07 100644
--- a/arch/arm/mach-ux500/board-mop500.c
+++ b/arch/arm/mach-ux500/board-mop500.c
@@ -27,18 +27,21 @@
#include <linux/leds-lp5521.h>
#include <linux/input.h>
#include <linux/gpio_keys.h>
+#include <linux/delay.h>
#include <asm/mach-types.h>
#include <asm/mach/arch.h>
#include <plat/i2c.h>
#include <plat/ste_dma40.h>
+#include <plat/pincfg.h>
#include <mach/hardware.h>
#include <mach/setup.h>
#include <mach/devices.h>
#include <mach/irqs.h>
+#include "pins-db8500.h"
#include "ste-dma40-db8500.h"
#include "devices-db8500.h"
#include "board-mop500.h"
@@ -393,12 +396,63 @@ static struct stedma40_chan_cfg uart2_dma_cfg_tx = {
};
#endif
+
+static pin_cfg_t mop500_pins_uart0[] = {
+ GPIO0_U0_CTSn | PIN_INPUT_PULLUP,
+ GPIO1_U0_RTSn | PIN_OUTPUT_HIGH,
+ GPIO2_U0_RXD | PIN_INPUT_PULLUP,
+ GPIO3_U0_TXD | PIN_OUTPUT_HIGH,
+};
+
+#define PRCC_K_SOFTRST_SET 0x18
+#define PRCC_K_SOFTRST_CLEAR 0x1C
+static void ux500_uart0_reset(void)
+{
+ void __iomem *prcc_rst_set, *prcc_rst_clr;
+
+ prcc_rst_set = (void __iomem *)IO_ADDRESS(U8500_CLKRST1_BASE +
+ PRCC_K_SOFTRST_SET);
+ prcc_rst_clr = (void __iomem *)IO_ADDRESS(U8500_CLKRST1_BASE +
+ PRCC_K_SOFTRST_CLEAR);
+
+ /* Activate soft reset PRCC_K_SOFTRST_CLEAR */
+ writel((readl(prcc_rst_clr) | 0x1), prcc_rst_clr);
+ udelay(1);
+
+ /* Release soft reset PRCC_K_SOFTRST_SET */
+ writel((readl(prcc_rst_set) | 0x1), prcc_rst_set);
+ udelay(1);
+}
+
+static void ux500_uart0_init(void)
+{
+ int ret;
+
+ ret = nmk_config_pins(mop500_pins_uart0,
+ ARRAY_SIZE(mop500_pins_uart0));
+ if (ret < 0)
+ pr_err("pl011: uart pins_enable failed\n");
+}
+
+static void ux500_uart0_exit(void)
+{
+ int ret;
+
+ ret = nmk_config_pins_sleep(mop500_pins_uart0,
+ ARRAY_SIZE(mop500_pins_uart0));
+ if (ret < 0)
+ pr_err("pl011: uart pins_disable failed\n");
+}
+
static struct amba_pl011_data uart0_plat = {
#ifdef CONFIG_STE_DMA40
.dma_filter = stedma40_filter,
.dma_rx_param = &uart0_dma_cfg_rx,
.dma_tx_param = &uart0_dma_cfg_tx,
#endif
+ .init = ux500_uart0_init,
+ .exit = ux500_uart0_exit,
+ .reset = ux500_uart0_reset,
};
static struct amba_pl011_data uart1_plat = {
--
1.7.5.4
^ permalink raw reply related [flat|nested] 16+ messages in thread* [PATCH 12/12] serial: bcm63xx_uart: fix irq storm after rx fifo overrun.
2011-06-28 16:03 ` [PATCH 01/12] 8250_pci: add -ENODEV code for Intel EG20T PCH Greg Kroah-Hartman
` (9 preceding siblings ...)
2011-06-28 16:03 ` [PATCH 11/12] amba pl011: platform data for reg lockup and glitch v2 Greg Kroah-Hartman
@ 2011-06-28 16:03 ` Greg Kroah-Hartman
10 siblings, 0 replies; 16+ messages in thread
From: Greg Kroah-Hartman @ 2011-06-28 16:03 UTC (permalink / raw)
To: linux-serial; +Cc: Maxime Bizon, Greg Kroah-Hartman
From: Maxime Bizon <mbizon@freebox.fr>
RX fifo reset is required to clear irq.
Signed-off-by: Maxime Bizon <mbizon@freebox.fr>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
---
drivers/tty/serial/bcm63xx_uart.c | 18 ++++++++++++++----
1 files changed, 14 insertions(+), 4 deletions(-)
diff --git a/drivers/tty/serial/bcm63xx_uart.c b/drivers/tty/serial/bcm63xx_uart.c
index a1a0e55..c0b68b9 100644
--- a/drivers/tty/serial/bcm63xx_uart.c
+++ b/drivers/tty/serial/bcm63xx_uart.c
@@ -250,6 +250,20 @@ static void bcm_uart_do_rx(struct uart_port *port)
/* get overrun/fifo empty information from ier
* register */
iestat = bcm_uart_readl(port, UART_IR_REG);
+
+ if (unlikely(iestat & UART_IR_STAT(UART_IR_RXOVER))) {
+ unsigned int val;
+
+ /* fifo reset is required to clear
+ * interrupt */
+ val = bcm_uart_readl(port, UART_CTL_REG);
+ val |= UART_CTL_RSTRXFIFO_MASK;
+ bcm_uart_writel(port, val, UART_CTL_REG);
+
+ port->icount.overrun++;
+ tty_insert_flip_char(tty, 0, TTY_OVERRUN);
+ }
+
if (!(iestat & UART_IR_STAT(UART_IR_RXNOTEMPTY)))
break;
@@ -284,10 +298,6 @@ static void bcm_uart_do_rx(struct uart_port *port)
if (uart_handle_sysrq_char(port, c))
continue;
- if (unlikely(iestat & UART_IR_STAT(UART_IR_RXOVER))) {
- port->icount.overrun++;
- tty_insert_flip_char(tty, 0, TTY_OVERRUN);
- }
if ((cstat & port->ignore_status_mask) == 0)
tty_insert_flip_char(tty, c, flag);
--
1.7.5.4
^ permalink raw reply related [flat|nested] 16+ messages in thread