* [PATCH v4 05/21] serial: omap: refactor receive_chars() into rdi/rlsi handlers
From: Felipe Balbi @ 2012-09-06 12:45 UTC (permalink / raw)
To: Greg KH
Cc: alan, Tony Lindgren, Kevin Hilman, Linux OMAP Mailing List,
Linux ARM Kernel Mailing List, linux-serial,
Linux Kernel Mailing List, Santosh Shilimkar, Shubhrajyoti Datta,
Sourav Poddar, Felipe Balbi
In-Reply-To: <1346935540-1792-1-git-send-email-balbi@ti.com>
receive_chars() was getting too big and too difficult
to follow. By splitting it into separate RDI and RSLI
handlers, we have smaller functions which are easy
to understand and only touch the pieces which they need
to touch.
Tested-by: Shubhrajyoti D <shubhrajyoti@ti.com>
Acked-by: Santosh Shilimkar <santosh.shilimkar@ti.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
---
drivers/tty/serial/omap-serial.c | 205 +++++++++++++++++++--------------------
1 file changed, 101 insertions(+), 104 deletions(-)
diff --git a/drivers/tty/serial/omap-serial.c b/drivers/tty/serial/omap-serial.c
index d5a08cb..9c0a4ae 100644
--- a/drivers/tty/serial/omap-serial.c
+++ b/drivers/tty/serial/omap-serial.c
@@ -196,74 +196,6 @@ static void serial_omap_stop_rx(struct uart_port *port)
pm_runtime_put_autosuspend(up->dev);
}
-static inline void receive_chars(struct uart_omap_port *up,
- unsigned int *status)
-{
- struct tty_struct *tty = up->port.state->port.tty;
- unsigned int flag, lsr = *status;
- unsigned char ch = 0;
- int max_count = 256;
-
- do {
- if (likely(lsr & UART_LSR_DR))
- ch = serial_in(up, UART_RX);
- flag = TTY_NORMAL;
- up->port.icount.rx++;
-
- if (unlikely(lsr & UART_LSR_BRK_ERROR_BITS)) {
- /*
- * For statistics only
- */
- if (lsr & UART_LSR_BI) {
- lsr &= ~(UART_LSR_FE | UART_LSR_PE);
- up->port.icount.brk++;
- /*
- * We do the SysRQ and SAK checking
- * here because otherwise the break
- * may get masked by ignore_status_mask
- * or read_status_mask.
- */
- if (uart_handle_break(&up->port))
- goto ignore_char;
- } else if (lsr & UART_LSR_PE) {
- up->port.icount.parity++;
- } else if (lsr & UART_LSR_FE) {
- up->port.icount.frame++;
- }
-
- if (lsr & UART_LSR_OE)
- up->port.icount.overrun++;
-
- /*
- * Mask off conditions which should be ignored.
- */
- lsr &= up->port.read_status_mask;
-
-#ifdef CONFIG_SERIAL_OMAP_CONSOLE
- if (up->port.line == up->port.cons->index) {
- /* Recover the break flag from console xmit */
- lsr |= up->lsr_break_flag;
- }
-#endif
- if (lsr & UART_LSR_BI)
- flag = TTY_BREAK;
- else if (lsr & UART_LSR_PE)
- flag = TTY_PARITY;
- else if (lsr & UART_LSR_FE)
- flag = TTY_FRAME;
- }
-
- if (uart_handle_sysrq_char(&up->port, ch))
- goto ignore_char;
- uart_insert_char(&up->port, lsr, UART_LSR_OE, ch, flag);
-ignore_char:
- lsr = serial_in(up, UART_LSR);
- } while ((lsr & (UART_LSR_DR | UART_LSR_BI)) && (max_count-- > 0));
- spin_unlock(&up->port.lock);
- tty_flip_buffer_push(tty);
- spin_lock(&up->port.lock);
-}
-
static void transmit_chars(struct uart_omap_port *up)
{
struct circ_buf *xmit = &up->port.state->xmit;
@@ -342,6 +274,68 @@ static unsigned int check_modem_status(struct uart_omap_port *up)
return status;
}
+static void serial_omap_rlsi(struct uart_omap_port *up, unsigned int lsr)
+{
+ unsigned int flag;
+
+ up->port.icount.rx++;
+ flag = TTY_NORMAL;
+
+ if (lsr & UART_LSR_BI) {
+ flag = TTY_BREAK;
+ lsr &= ~(UART_LSR_FE | UART_LSR_PE);
+ up->port.icount.brk++;
+ /*
+ * We do the SysRQ and SAK checking
+ * here because otherwise the break
+ * may get masked by ignore_status_mask
+ * or read_status_mask.
+ */
+ if (uart_handle_break(&up->port))
+ return;
+
+ }
+
+ if (lsr & UART_LSR_PE) {
+ flag = TTY_PARITY;
+ up->port.icount.parity++;
+ }
+
+ if (lsr & UART_LSR_FE) {
+ flag = TTY_FRAME;
+ up->port.icount.frame++;
+ }
+
+ if (lsr & UART_LSR_OE)
+ up->port.icount.overrun++;
+
+#ifdef CONFIG_SERIAL_OMAP_CONSOLE
+ if (up->port.line == up->port.cons->index) {
+ /* Recover the break flag from console xmit */
+ lsr |= up->lsr_break_flag;
+ }
+#endif
+ uart_insert_char(&up->port, lsr, UART_LSR_OE, 0, flag);
+}
+
+static void serial_omap_rdi(struct uart_omap_port *up, unsigned int lsr)
+{
+ unsigned char ch = 0;
+ unsigned int flag;
+
+ if (!(lsr & UART_LSR_DR))
+ return;
+
+ ch = serial_in(up, UART_RX);
+ flag = TTY_NORMAL;
+ up->port.icount.rx++;
+
+ if (uart_handle_sysrq_char(&up->port, ch))
+ return;
+
+ uart_insert_char(&up->port, lsr, UART_LSR_OE, ch, flag);
+}
+
/**
* serial_omap_irq() - This handles the interrupt from one port
* @irq: uart port irq number
@@ -350,54 +344,57 @@ static unsigned int check_modem_status(struct uart_omap_port *up)
static inline irqreturn_t serial_omap_irq(int irq, void *dev_id)
{
struct uart_omap_port *up = dev_id;
+ struct tty_struct *tty = up->port.state->port.tty;
unsigned int iir, lsr;
unsigned int type;
unsigned long flags;
irqreturn_t ret = IRQ_NONE;
+ int max_count = 256;
spin_lock_irqsave(&up->port.lock, flags);
pm_runtime_get_sync(up->dev);
- iir = serial_in(up, UART_IIR);
-again:
- if (iir & UART_IIR_NO_INT)
- goto out;
- ret = IRQ_HANDLED;
- lsr = serial_in(up, UART_LSR);
+ do {
+ iir = serial_in(up, UART_IIR);
+ if (iir & UART_IIR_NO_INT)
+ break;
- /* extract IRQ type from IIR register */
- type = iir & 0x3e;
+ ret = IRQ_HANDLED;
+ lsr = serial_in(up, UART_LSR);
- switch (type) {
- case UART_IIR_MSI:
- check_modem_status(up);
- break;
- case UART_IIR_THRI:
- if (lsr & UART_LSR_THRE)
- transmit_chars(up);
- break;
- case UART_IIR_RDI:
- if (lsr & UART_LSR_DR)
- receive_chars(up, &lsr);
- break;
- case UART_IIR_RLSI:
- if (lsr & UART_LSR_BRK_ERROR_BITS)
- receive_chars(up, &lsr);
- break;
- case UART_IIR_RX_TIMEOUT:
- receive_chars(up, &lsr);
- break;
- case UART_IIR_CTS_RTS_DSR:
- iir = serial_in(up, UART_IIR);
- goto again;
- case UART_IIR_XOFF:
- /* FALLTHROUGH */
- default:
- break;
- }
+ /* extract IRQ type from IIR register */
+ type = iir & 0x3e;
+
+ switch (type) {
+ case UART_IIR_MSI:
+ check_modem_status(up);
+ break;
+ case UART_IIR_THRI:
+ if (lsr & UART_LSR_THRE)
+ transmit_chars(up);
+ break;
+ case UART_IIR_RX_TIMEOUT:
+ /* FALLTHROUGH */
+ case UART_IIR_RDI:
+ serial_omap_rdi(up, lsr);
+ break;
+ case UART_IIR_RLSI:
+ serial_omap_rlsi(up, lsr);
+ break;
+ case UART_IIR_CTS_RTS_DSR:
+ /* simply try again */
+ break;
+ case UART_IIR_XOFF:
+ /* FALLTHROUGH */
+ default:
+ break;
+ }
+ } while (!(iir & UART_IIR_NO_INT) && max_count--);
-out:
spin_unlock_irqrestore(&up->port.lock, flags);
+
+ tty_flip_buffer_push(tty);
+
pm_runtime_mark_last_busy(up->dev);
pm_runtime_put_autosuspend(up->dev);
up->port_activity = jiffies;
--
1.7.12.rc3
^ permalink raw reply related
* [PATCH v4 06/21] serial: omap: move THRE check to transmit_chars()
From: Felipe Balbi @ 2012-09-06 12:45 UTC (permalink / raw)
To: Greg KH
Cc: Kevin Hilman, Tony Lindgren, Linux Kernel Mailing List,
Felipe Balbi, Santosh Shilimkar, linux-serial, Sourav Poddar,
Linux OMAP Mailing List, Shubhrajyoti Datta,
Linux ARM Kernel Mailing List, alan
In-Reply-To: <1346935540-1792-1-git-send-email-balbi@ti.com>
since all other IRQ types now do all necessary
checks inside their handlers, transmit_chars()
was the only one left expecting serial_omap_irq()
to check THRE for it. We can move THRE check to
transmit_chars() in order to make serial_omap_irq()
more uniform.
Tested-by: Shubhrajyoti D <shubhrajyoti@ti.com>
Acked-by: Santosh Shilimkar <santosh.shilimkar@ti.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
---
drivers/tty/serial/omap-serial.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/drivers/tty/serial/omap-serial.c b/drivers/tty/serial/omap-serial.c
index 9c0a4ae..d3fbb70 100644
--- a/drivers/tty/serial/omap-serial.c
+++ b/drivers/tty/serial/omap-serial.c
@@ -196,11 +196,14 @@ static void serial_omap_stop_rx(struct uart_port *port)
pm_runtime_put_autosuspend(up->dev);
}
-static void transmit_chars(struct uart_omap_port *up)
+static void transmit_chars(struct uart_omap_port *up, unsigned int lsr)
{
struct circ_buf *xmit = &up->port.state->xmit;
int count;
+ if (!(lsr & UART_LSR_THRE))
+ return;
+
if (up->port.x_char) {
serial_out(up, UART_TX, up->port.x_char);
up->port.icount.tx++;
@@ -370,8 +373,7 @@ static inline irqreturn_t serial_omap_irq(int irq, void *dev_id)
check_modem_status(up);
break;
case UART_IIR_THRI:
- if (lsr & UART_LSR_THRE)
- transmit_chars(up);
+ transmit_chars(up, lsr);
break;
case UART_IIR_RX_TIMEOUT:
/* FALLTHROUGH */
--
1.7.12.rc3
^ permalink raw reply related
* [PATCH v4 07/21] serial: omap: stick to put_autosuspend
From: Felipe Balbi @ 2012-09-06 12:45 UTC (permalink / raw)
To: Greg KH
Cc: alan, Tony Lindgren, Kevin Hilman, Linux OMAP Mailing List,
Linux ARM Kernel Mailing List, linux-serial,
Linux Kernel Mailing List, Santosh Shilimkar, Shubhrajyoti Datta,
Sourav Poddar, Felipe Balbi
In-Reply-To: <1346935540-1792-1-git-send-email-balbi@ti.com>
Everytime we're done using our TTY, we want
the pm timer to be reinitilized. By sticking
to pm_runtime_pm_autosuspend() we make sure
that this will always be the case.
The idea behind this patch is to make sure we
will always reinitialize the pm timer so that
we don't fall into a situation where pm_runtime_put()
expires right away (if timer was already about to
expire when we made the call to pm_runtime_put()).
While suspending right away wouldn't cause any
issues, reinitializing the pm timer can help us
avoiding unnecessary context save & restore
operations (which are somewhat expensive) if there's
another read/write/set_termios request coming right
after. IOW, we are trying to make sure UART is still
powered up while it's still under heavy usage.
Tested-by: Shubhrajyoti D <shubhrajyoti@ti.com>
Acked-by: Santosh Shilimkar <santosh.shilimkar@ti.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
---
drivers/tty/serial/omap-serial.c | 33 ++++++++++++++++++++++-----------
1 file changed, 22 insertions(+), 11 deletions(-)
diff --git a/drivers/tty/serial/omap-serial.c b/drivers/tty/serial/omap-serial.c
index d3fbb70..b2043df 100644
--- a/drivers/tty/serial/omap-serial.c
+++ b/drivers/tty/serial/omap-serial.c
@@ -165,7 +165,8 @@ static void serial_omap_enable_ms(struct uart_port *port)
pm_runtime_get_sync(up->dev);
up->ier |= UART_IER_MSI;
serial_out(up, UART_IER, up->ier);
- pm_runtime_put(up->dev);
+ pm_runtime_mark_last_busy(up->dev);
+ pm_runtime_put_autosuspend(up->dev);
}
static void serial_omap_stop_tx(struct uart_port *port)
@@ -415,7 +416,8 @@ static unsigned int serial_omap_tx_empty(struct uart_port *port)
spin_lock_irqsave(&up->port.lock, flags);
ret = serial_in(up, UART_LSR) & UART_LSR_TEMT ? TIOCSER_TEMT : 0;
spin_unlock_irqrestore(&up->port.lock, flags);
- pm_runtime_put(up->dev);
+ pm_runtime_mark_last_busy(up->dev);
+ pm_runtime_put_autosuspend(up->dev);
return ret;
}
@@ -427,7 +429,8 @@ static unsigned int serial_omap_get_mctrl(struct uart_port *port)
pm_runtime_get_sync(up->dev);
status = check_modem_status(up);
- pm_runtime_put(up->dev);
+ pm_runtime_mark_last_busy(up->dev);
+ pm_runtime_put_autosuspend(up->dev);
dev_dbg(up->port.dev, "serial_omap_get_mctrl+%d\n", up->port.line);
@@ -463,7 +466,8 @@ static void serial_omap_set_mctrl(struct uart_port *port, unsigned int mctrl)
up->mcr = serial_in(up, UART_MCR);
up->mcr |= mcr;
serial_out(up, UART_MCR, up->mcr);
- pm_runtime_put(up->dev);
+ pm_runtime_mark_last_busy(up->dev);
+ pm_runtime_put_autosuspend(up->dev);
if (gpio_is_valid(up->DTR_gpio) &&
!!(mctrl & TIOCM_DTR) != up->DTR_active) {
@@ -490,7 +494,8 @@ static void serial_omap_break_ctl(struct uart_port *port, int break_state)
up->lcr &= ~UART_LCR_SBC;
serial_out(up, UART_LCR, up->lcr);
spin_unlock_irqrestore(&up->port.lock, flags);
- pm_runtime_put(up->dev);
+ pm_runtime_mark_last_busy(up->dev);
+ pm_runtime_put_autosuspend(up->dev);
}
static int serial_omap_startup(struct uart_port *port)
@@ -588,7 +593,8 @@ static void serial_omap_shutdown(struct uart_port *port)
if (serial_in(up, UART_LSR) & UART_LSR_DR)
(void) serial_in(up, UART_RX);
- pm_runtime_put(up->dev);
+ pm_runtime_mark_last_busy(up->dev);
+ pm_runtime_put_autosuspend(up->dev);
free_irq(up->port.irq, up);
}
@@ -862,7 +868,8 @@ serial_omap_set_termios(struct uart_port *port, struct ktermios *termios,
serial_omap_configure_xonxoff(up, termios);
spin_unlock_irqrestore(&up->port.lock, flags);
- pm_runtime_put(up->dev);
+ pm_runtime_mark_last_busy(up->dev);
+ pm_runtime_put_autosuspend(up->dev);
dev_dbg(up->port.dev, "serial_omap_set_termios+%d\n", up->port.line);
}
@@ -893,7 +900,8 @@ serial_omap_pm(struct uart_port *port, unsigned int state,
pm_runtime_allow(up->dev);
}
- pm_runtime_put(up->dev);
+ pm_runtime_mark_last_busy(up->dev);
+ pm_runtime_put_autosuspend(up->dev);
}
static void serial_omap_release_port(struct uart_port *port)
@@ -975,7 +983,8 @@ static void serial_omap_poll_put_char(struct uart_port *port, unsigned char ch)
pm_runtime_get_sync(up->dev);
wait_for_xmitr(up);
serial_out(up, UART_TX, ch);
- pm_runtime_put(up->dev);
+ pm_runtime_mark_last_busy(up->dev);
+ pm_runtime_put_autosuspend(up->dev);
}
static int serial_omap_poll_get_char(struct uart_port *port)
@@ -989,7 +998,8 @@ static int serial_omap_poll_get_char(struct uart_port *port)
return NO_POLL_CHAR;
status = serial_in(up, UART_RX);
- pm_runtime_put(up->dev);
+ pm_runtime_mark_last_busy(up->dev);
+ pm_runtime_put_autosuspend(up->dev);
return status;
}
@@ -1340,7 +1350,8 @@ static int serial_omap_probe(struct platform_device *pdev)
if (ret != 0)
goto err_add_port;
- pm_runtime_put(&pdev->dev);
+ pm_runtime_mark_last_busy(up->dev);
+ pm_runtime_put_autosuspend(up->dev);
platform_set_drvdata(pdev, up);
return 0;
--
1.7.12.rc3
^ permalink raw reply related
* [PATCH v4 08/21] serial: omap: set dev->drvdata before enabling pm_runtime
From: Felipe Balbi @ 2012-09-06 12:45 UTC (permalink / raw)
To: Greg KH
Cc: alan, Tony Lindgren, Kevin Hilman, Linux OMAP Mailing List,
Linux ARM Kernel Mailing List, linux-serial,
Linux Kernel Mailing List, Santosh Shilimkar, Shubhrajyoti Datta,
Sourav Poddar, Felipe Balbi
In-Reply-To: <1346935540-1792-1-git-send-email-balbi@ti.com>
by the time we call our first pm_runtme_get_sync()
after enable pm_runtime, our resume method might
be called. To avoid problems, we must make sure
that our dev->drvdata is set correctly before
our resume method gets called.
Tested-by: Shubhrajyoti D <shubhrajyoti@ti.com>
Acked-by: Santosh Shilimkar <santosh.shilimkar@ti.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
---
drivers/tty/serial/omap-serial.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/tty/serial/omap-serial.c b/drivers/tty/serial/omap-serial.c
index b2043df..8a696a4 100644
--- a/drivers/tty/serial/omap-serial.c
+++ b/drivers/tty/serial/omap-serial.c
@@ -1333,6 +1333,7 @@ static int serial_omap_probe(struct platform_device *pdev)
serial_omap_uart_wq = create_singlethread_workqueue(up->name);
INIT_WORK(&up->qos_work, serial_omap_uart_qos_work);
+ platform_set_drvdata(pdev, up);
pm_runtime_use_autosuspend(&pdev->dev);
pm_runtime_set_autosuspend_delay(&pdev->dev,
omap_up_info->autosuspend_timeout);
@@ -1352,7 +1353,6 @@ static int serial_omap_probe(struct platform_device *pdev)
pm_runtime_mark_last_busy(up->dev);
pm_runtime_put_autosuspend(up->dev);
- platform_set_drvdata(pdev, up);
return 0;
err_add_port:
--
1.7.12.rc3
^ permalink raw reply related
* [PATCH v4 09/21] serial: omap: drop unnecessary check from remove
From: Felipe Balbi @ 2012-09-06 12:45 UTC (permalink / raw)
To: Greg KH
Cc: alan, Tony Lindgren, Kevin Hilman, Linux OMAP Mailing List,
Linux ARM Kernel Mailing List, linux-serial,
Linux Kernel Mailing List, Santosh Shilimkar, Shubhrajyoti Datta,
Sourav Poddar, Felipe Balbi
In-Reply-To: <1346935540-1792-1-git-send-email-balbi@ti.com>
if platform_get_drvdata() returns NULL, that's
quite a nasty bug on the driver which we want to
catch ASAP. Otherwise, that check is hugely
unneeded.
Tested-by: Shubhrajyoti D <shubhrajyoti@ti.com>
Acked-by: Santosh Shilimkar <santosh.shilimkar@ti.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
---
drivers/tty/serial/omap-serial.c | 9 +++------
1 file changed, 3 insertions(+), 6 deletions(-)
diff --git a/drivers/tty/serial/omap-serial.c b/drivers/tty/serial/omap-serial.c
index 8a696a4..c19d340 100644
--- a/drivers/tty/serial/omap-serial.c
+++ b/drivers/tty/serial/omap-serial.c
@@ -1369,13 +1369,10 @@ static int serial_omap_remove(struct platform_device *dev)
{
struct uart_omap_port *up = platform_get_drvdata(dev);
- if (up) {
- pm_runtime_disable(up->dev);
- uart_remove_one_port(&serial_omap_reg, &up->port);
- pm_qos_remove_request(&up->pm_qos_request);
- }
+ pm_runtime_disable(up->dev);
+ uart_remove_one_port(&serial_omap_reg, &up->port);
+ pm_qos_remove_request(&up->pm_qos_request);
- platform_set_drvdata(dev, NULL);
return 0;
}
--
1.7.12.rc3
^ permalink raw reply related
* [PATCH v4 12/21] serial: omap: fix sequence of pm_runtime_* calls.
From: Felipe Balbi @ 2012-09-06 12:45 UTC (permalink / raw)
To: Greg KH
Cc: alan, Tony Lindgren, Kevin Hilman, Linux OMAP Mailing List,
Linux ARM Kernel Mailing List, linux-serial,
Linux Kernel Mailing List, Santosh Shilimkar, Shubhrajyoti Datta,
Sourav Poddar, Ruchika Kharwar, Nishanth Menon, Felipe Balbi
In-Reply-To: <1346935540-1792-1-git-send-email-balbi@ti.com>
From: Ruchika Kharwar <ruchika@ti.com>
pm_runtime_enable() needs to be invoked before
pm_runtime_use_autosuspend(), and
pm_runtime_set_autosuspend_delay() functions.
Tested-by: Shubhrajyoti D <shubhrajyoti@ti.com>
Signed-off-by: Nishanth Menon <nm@ti.com>
Signed-off-by: Ruchika Kharwar <ruchika@ti.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
---
drivers/tty/serial/omap-serial.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/tty/serial/omap-serial.c b/drivers/tty/serial/omap-serial.c
index 99042b0..f5dcb5a 100644
--- a/drivers/tty/serial/omap-serial.c
+++ b/drivers/tty/serial/omap-serial.c
@@ -1333,12 +1333,12 @@ static int serial_omap_probe(struct platform_device *pdev)
INIT_WORK(&up->qos_work, serial_omap_uart_qos_work);
platform_set_drvdata(pdev, up);
+ pm_runtime_enable(&pdev->dev);
pm_runtime_use_autosuspend(&pdev->dev);
pm_runtime_set_autosuspend_delay(&pdev->dev,
omap_up_info->autosuspend_timeout);
pm_runtime_irq_safe(&pdev->dev);
- pm_runtime_enable(&pdev->dev);
pm_runtime_get_sync(&pdev->dev);
omap_serial_fill_features_erratas(up);
--
1.7.12.rc3
^ permalink raw reply related
* [PATCH v4 14/21] serial: omap: drop "inline" from IRQ handler prototype
From: Felipe Balbi @ 2012-09-06 12:45 UTC (permalink / raw)
To: Greg KH
Cc: alan, Tony Lindgren, Kevin Hilman, Linux OMAP Mailing List,
Linux ARM Kernel Mailing List, linux-serial,
Linux Kernel Mailing List, Santosh Shilimkar, Shubhrajyoti Datta,
Sourav Poddar, Felipe Balbi
In-Reply-To: <1346935540-1792-1-git-send-email-balbi@ti.com>
it makes no sense to mark our IRQ handler inline
since it's passed as a function pointer when
enabling the IRQ line.
Tested-by: Shubhrajyoti D <shubhrajyoti@ti.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
---
drivers/tty/serial/omap-serial.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/tty/serial/omap-serial.c b/drivers/tty/serial/omap-serial.c
index 9068260..d244163 100644
--- a/drivers/tty/serial/omap-serial.c
+++ b/drivers/tty/serial/omap-serial.c
@@ -345,7 +345,7 @@ static void serial_omap_rdi(struct uart_omap_port *up, unsigned int lsr)
* @irq: uart port irq number
* @dev_id: uart port info
*/
-static inline irqreturn_t serial_omap_irq(int irq, void *dev_id)
+static irqreturn_t serial_omap_irq(int irq, void *dev_id)
{
struct uart_omap_port *up = dev_id;
struct tty_struct *tty = up->port.state->port.tty;
--
1.7.12.rc3
^ permalink raw reply related
* [PATCH v4 15/21] serial: omap: unlock the port lock
From: Felipe Balbi @ 2012-09-06 12:45 UTC (permalink / raw)
To: Greg KH
Cc: alan, Tony Lindgren, Kevin Hilman, Linux OMAP Mailing List,
Linux ARM Kernel Mailing List, linux-serial,
Linux Kernel Mailing List, Santosh Shilimkar, Shubhrajyoti Datta,
Sourav Poddar, Ruchika Kharwar, Pavan Savoy, Vijay Badawadagi,
Felipe Balbi
In-Reply-To: <1346935540-1792-1-git-send-email-balbi@ti.com>
From: Ruchika Kharwar <ruchika@ti.com>
This patch unlocks the port lock before calling a serial_core API
and re-acquires the port lock after calling it.
This patch fixes a system freeze issue seen when the serial_core
API uart_write_wakeup() eventually attempts to acquire the port lock
already acquired by omap serial interrupt handler.
Tested-by: Shubhrajyoti D <shubhrajyoti@ti.com>
Signed-off-by: Ruchika Kharwar <ruchika@ti.com>
Signed-off-by: Pavan Savoy <pavan_savoy@ti.com>
Signed-off-by: Vijay Badawadagi <bvijay@ti.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
---
drivers/tty/serial/omap-serial.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/drivers/tty/serial/omap-serial.c b/drivers/tty/serial/omap-serial.c
index d244163..9e4419c 100644
--- a/drivers/tty/serial/omap-serial.c
+++ b/drivers/tty/serial/omap-serial.c
@@ -224,8 +224,11 @@ static void transmit_chars(struct uart_omap_port *up, unsigned int lsr)
break;
} while (--count > 0);
- if (uart_circ_chars_pending(xmit) < WAKEUP_CHARS)
+ if (uart_circ_chars_pending(xmit) < WAKEUP_CHARS) {
+ spin_unlock(&up->port.lock);
uart_write_wakeup(&up->port);
+ spin_lock(&up->port.lock);
+ }
if (uart_circ_empty(xmit))
serial_omap_stop_tx(&up->port);
--
1.7.12.rc3
^ permalink raw reply related
* [PATCH v4 16/21] serial: omap: implement set_wake
From: Felipe Balbi @ 2012-09-06 12:45 UTC (permalink / raw)
To: Greg KH
Cc: alan, Tony Lindgren, Kevin Hilman, Linux OMAP Mailing List,
Linux ARM Kernel Mailing List, linux-serial,
Linux Kernel Mailing List, Santosh Shilimkar, Shubhrajyoti Datta,
Sourav Poddar, Felipe Balbi
In-Reply-To: <1346935540-1792-1-git-send-email-balbi@ti.com>
This has been missing from OMAP UART driver
for quite a while and it's simple enough
to implement it.
Tested-by: Shubhrajyoti D <shubhrajyoti@ti.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
---
drivers/tty/serial/omap-serial.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/drivers/tty/serial/omap-serial.c b/drivers/tty/serial/omap-serial.c
index 9e4419c..7531147 100644
--- a/drivers/tty/serial/omap-serial.c
+++ b/drivers/tty/serial/omap-serial.c
@@ -875,6 +875,15 @@ serial_omap_set_termios(struct uart_port *port, struct ktermios *termios,
dev_dbg(up->port.dev, "serial_omap_set_termios+%d\n", up->port.line);
}
+static int serial_omap_set_wake(struct uart_port *port, unsigned int state)
+{
+ struct uart_omap_port *up = to_uart_omap_port(port);
+
+ serial_omap_enable_wakeup(up, state);
+
+ return 0;
+}
+
static void
serial_omap_pm(struct uart_port *port, unsigned int state,
unsigned int oldstate)
@@ -1129,6 +1138,7 @@ static struct uart_ops serial_omap_pops = {
.shutdown = serial_omap_shutdown,
.set_termios = serial_omap_set_termios,
.pm = serial_omap_pm,
+ .set_wake = serial_omap_set_wake,
.type = serial_omap_type,
.release_port = serial_omap_release_port,
.request_port = serial_omap_request_port,
--
1.7.12.rc3
^ permalink raw reply related
* [PATCH v4 17/21] serial: omap: make sure to put() on poll_get_char
From: Felipe Balbi @ 2012-09-06 12:45 UTC (permalink / raw)
To: Greg KH
Cc: alan, Tony Lindgren, Kevin Hilman, Linux OMAP Mailing List,
Linux ARM Kernel Mailing List, linux-serial,
Linux Kernel Mailing List, Santosh Shilimkar, Shubhrajyoti Datta,
Sourav Poddar, Felipe Balbi
In-Reply-To: <1346935540-1792-1-git-send-email-balbi@ti.com>
if we would reach serial_omap_get_char() while
Data Ready bit isn't set, we would return from
it without kicking our pm timer. This would mean
we would, eventually, have an unbalanced
pm_runtime_get on our device which would prevent
it from ever sleeping again.
Tested-by: Shubhrajyoti D <shubhrajyoti@ti.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
---
drivers/tty/serial/omap-serial.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/drivers/tty/serial/omap-serial.c b/drivers/tty/serial/omap-serial.c
index 7531147..6a58f4f 100644
--- a/drivers/tty/serial/omap-serial.c
+++ b/drivers/tty/serial/omap-serial.c
@@ -1005,12 +1005,17 @@ static int serial_omap_poll_get_char(struct uart_port *port)
pm_runtime_get_sync(up->dev);
status = serial_in(up, UART_LSR);
- if (!(status & UART_LSR_DR))
- return NO_POLL_CHAR;
+ if (!(status & UART_LSR_DR)) {
+ status = NO_POLL_CHAR;
+ goto out;
+ }
status = serial_in(up, UART_RX);
+
+out:
pm_runtime_mark_last_busy(up->dev);
pm_runtime_put_autosuspend(up->dev);
+
return status;
}
--
1.7.12.rc3
^ permalink raw reply related
* [PATCH v4 18/21] serial: omap: fix software flow control
From: Felipe Balbi @ 2012-09-06 12:45 UTC (permalink / raw)
To: Greg KH
Cc: alan, Tony Lindgren, Kevin Hilman, Linux OMAP Mailing List,
Linux ARM Kernel Mailing List, linux-serial,
Linux Kernel Mailing List, Santosh Shilimkar, Shubhrajyoti Datta,
Sourav Poddar, Vikram Pandita, stable, Felipe Balbi
In-Reply-To: <1346935540-1792-1-git-send-email-balbi@ti.com>
From: Vikram Pandita <vikram.pandita@ti.com>
Software flow control register bits were not defined correctly.
Also clarify the IXON and IXOFF logic to reflect what userspace wants.
Cc: stable@vger.kernel.org
Tested-by: Shubhrajyoti D <shubhrajyoti@ti.com>
Signed-off-by: Vikram Pandita <vikram.pandita@ti.com>
Signed-off-by: Shubhrajyoti D <shubhrajyoti@ti.com>
Acked-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
---
arch/arm/plat-omap/include/plat/omap-serial.h | 4 ++--
drivers/tty/serial/omap-serial.c | 12 ++++++------
2 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/arch/arm/plat-omap/include/plat/omap-serial.h b/arch/arm/plat-omap/include/plat/omap-serial.h
index 90d2d74..a79ed8b 100644
--- a/arch/arm/plat-omap/include/plat/omap-serial.h
+++ b/arch/arm/plat-omap/include/plat/omap-serial.h
@@ -42,10 +42,10 @@
#define OMAP_UART_WER_MOD_WKUP 0X7F
/* Enable XON/XOFF flow control on output */
-#define OMAP_UART_SW_TX 0x04
+#define OMAP_UART_SW_TX 0x8
/* Enable XON/XOFF flow control on input */
-#define OMAP_UART_SW_RX 0x04
+#define OMAP_UART_SW_RX 0x2
#define OMAP_UART_SYSC_RESET 0X07
#define OMAP_UART_TCR_TRIG 0X0F
diff --git a/drivers/tty/serial/omap-serial.c b/drivers/tty/serial/omap-serial.c
index 6a58f4f..1ba1f43 100644
--- a/drivers/tty/serial/omap-serial.c
+++ b/drivers/tty/serial/omap-serial.c
@@ -617,19 +617,19 @@ serial_omap_configure_xonxoff
/*
* IXON Flag:
- * Enable XON/XOFF flow control on output.
- * Transmit XON1, XOFF1
+ * Flow control for OMAP.TX
+ * OMAP.RX should listen for XON/XOFF
*/
if (termios->c_iflag & IXON)
- up->efr |= OMAP_UART_SW_TX;
+ up->efr |= OMAP_UART_SW_RX;
/*
* IXOFF Flag:
- * Enable XON/XOFF flow control on input.
- * Receiver compares XON1, XOFF1.
+ * Flow control for OMAP.RX
+ * OMAP.TX should send XON/XOFF
*/
if (termios->c_iflag & IXOFF)
- up->efr |= OMAP_UART_SW_RX;
+ up->efr |= OMAP_UART_SW_TX;
serial_out(up, UART_EFR, up->efr | UART_EFR_ECB);
serial_out(up, UART_LCR, UART_LCR_CONF_MODE_A);
--
1.7.12.rc3
^ permalink raw reply related
* [PATCH v4 19/21] serial: omap: remove unnecessary header and add a missing one
From: Felipe Balbi @ 2012-09-06 12:45 UTC (permalink / raw)
To: Greg KH
Cc: alan, Tony Lindgren, Kevin Hilman, Linux OMAP Mailing List,
Linux ARM Kernel Mailing List, linux-serial,
Linux Kernel Mailing List, Santosh Shilimkar, Shubhrajyoti Datta,
Sourav Poddar, Felipe Balbi
In-Reply-To: <1346935540-1792-1-git-send-email-balbi@ti.com>
this driver doesn't use any from <plat/dmtimer.h>, so
we can remove it without any problems.
This will, however cause a problem because omap-serial.c
was relying on indirect inclusion of <linux/platform_device.h>,
let's fix the issue by including <linux/platform_device.h>
on omap-serial.c as it should be.
Tested-by: Shubhrajyoti D <shubhrajyoti@ti.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
---
drivers/tty/serial/omap-serial.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/tty/serial/omap-serial.c b/drivers/tty/serial/omap-serial.c
index 1ba1f43..881b652 100644
--- a/drivers/tty/serial/omap-serial.c
+++ b/drivers/tty/serial/omap-serial.c
@@ -32,6 +32,7 @@
#include <linux/slab.h>
#include <linux/tty.h>
#include <linux/tty_flip.h>
+#include <linux/platform_device.h>
#include <linux/io.h>
#include <linux/clk.h>
#include <linux/serial_core.h>
@@ -40,7 +41,6 @@
#include <linux/of.h>
#include <linux/gpio.h>
-#include <plat/dmtimer.h>
#include <plat/omap-serial.h>
#define UART_BUILD_REVISION(x, y) (((x) << 8) | (y))
--
1.7.12.rc3
^ permalink raw reply related
* [PATCH v4 20/21] serial: omap: move uart_omap_port definition to C file
From: Felipe Balbi @ 2012-09-06 12:45 UTC (permalink / raw)
To: Greg KH
Cc: alan, Tony Lindgren, Kevin Hilman, Linux OMAP Mailing List,
Linux ARM Kernel Mailing List, linux-serial,
Linux Kernel Mailing List, Santosh Shilimkar, Shubhrajyoti Datta,
Sourav Poddar, Felipe Balbi
In-Reply-To: <1346935540-1792-1-git-send-email-balbi@ti.com>
nobody needs to access the uart_omap_port structure
other than omap-serial.c file. Let's move that
structure definition to the C source file in order
to prevent anyone from accessing our structure.
Tested-by: Shubhrajyoti D <shubhrajyoti@ti.com>
Acked-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
---
arch/arm/plat-omap/include/plat/omap-serial.h | 37 --------------------------
drivers/tty/serial/omap-serial.c | 38 +++++++++++++++++++++++++++
2 files changed, 38 insertions(+), 37 deletions(-)
diff --git a/arch/arm/plat-omap/include/plat/omap-serial.h b/arch/arm/plat-omap/include/plat/omap-serial.h
index a79ed8b..3c9fd3e 100644
--- a/arch/arm/plat-omap/include/plat/omap-serial.h
+++ b/arch/arm/plat-omap/include/plat/omap-serial.h
@@ -105,45 +105,8 @@ struct uart_omap_dma {
unsigned int rx_timeout;
};
-struct uart_omap_port {
- struct uart_port port;
- struct uart_omap_dma uart_dma;
- struct device *dev;
-
- unsigned char ier;
- unsigned char lcr;
- unsigned char mcr;
- unsigned char fcr;
- unsigned char efr;
- unsigned char dll;
- unsigned char dlh;
- unsigned char mdr1;
- unsigned char scr;
-
- int use_dma;
- /*
- * Some bits in registers are cleared on a read, so they must
- * be saved whenever the register is read but the bits will not
- * be immediately processed.
- */
- unsigned int lsr_break_flag;
- unsigned char msr_saved_flags;
- char name[20];
- unsigned long port_activity;
- u32 context_loss_cnt;
- u32 errata;
- u8 wakeups_enabled;
int DTR_gpio;
int DTR_inverted;
int DTR_active;
-
- struct pm_qos_request pm_qos_request;
- u32 latency;
- u32 calc_latency;
- struct work_struct qos_work;
-};
-
-#define to_uart_omap_port(p) ((container_of((p), struct uart_omap_port, port)))
-
#endif /* __OMAP_SERIAL_H__ */
diff --git a/drivers/tty/serial/omap-serial.c b/drivers/tty/serial/omap-serial.c
index 881b652..164c3c9 100644
--- a/drivers/tty/serial/omap-serial.c
+++ b/drivers/tty/serial/omap-serial.c
@@ -70,6 +70,44 @@
#define OMAP_UART_MVR_MAJ_SHIFT 8
#define OMAP_UART_MVR_MIN_MASK 0x3f
+struct uart_omap_port {
+ struct uart_port port;
+ struct uart_omap_dma uart_dma;
+ struct device *dev;
+
+ unsigned char ier;
+ unsigned char lcr;
+ unsigned char mcr;
+ unsigned char fcr;
+ unsigned char efr;
+ unsigned char dll;
+ unsigned char dlh;
+ unsigned char mdr1;
+ unsigned char scr;
+
+ int use_dma;
+ /*
+ * Some bits in registers are cleared on a read, so they must
+ * be saved whenever the register is read but the bits will not
+ * be immediately processed.
+ */
+ unsigned int lsr_break_flag;
+ unsigned char msr_saved_flags;
+ char name[20];
+ unsigned long port_activity;
+ u32 context_loss_cnt;
+ u32 errata;
+ u8 wakeups_enabled;
+ unsigned int irq_pending:1;
+
+ struct pm_qos_request pm_qos_request;
+ u32 latency;
+ u32 calc_latency;
+ struct work_struct qos_work;
+};
+
+#define to_uart_omap_port(p) ((container_of((p), struct uart_omap_port, port)))
+
static struct uart_omap_port *ui[OMAP_MAX_HSUART_PORTS];
/* Forward declaration of functions */
--
1.7.12.rc3
^ permalink raw reply related
* [PATCH v4 21/21] serial: omap: enable RX and TX FIFO usage
From: Felipe Balbi @ 2012-09-06 12:45 UTC (permalink / raw)
To: Greg KH
Cc: alan, Tony Lindgren, Kevin Hilman, Linux OMAP Mailing List,
Linux ARM Kernel Mailing List, linux-serial,
Linux Kernel Mailing List, Santosh Shilimkar, Shubhrajyoti Datta,
Sourav Poddar, Felipe Balbi
In-Reply-To: <1346935540-1792-1-git-send-email-balbi@ti.com>
enable RX FIFO for 16 characters and TX FIFO
for 16 spaces.
Tested-by: Shubhrajyoti D <shubhrajyoti@ti.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
---
drivers/tty/serial/omap-serial.c | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/drivers/tty/serial/omap-serial.c b/drivers/tty/serial/omap-serial.c
index 164c3c9..cfd2094 100644
--- a/drivers/tty/serial/omap-serial.c
+++ b/drivers/tty/serial/omap-serial.c
@@ -56,8 +56,8 @@
#define OMAP_UART_SCR_RX_TRIG_GRANU1_MASK (1 << 7)
/* FCR register bitmasks */
-#define OMAP_UART_FCR_RX_FIFO_TRIG_SHIFT 6
#define OMAP_UART_FCR_RX_FIFO_TRIG_MASK (0x3 << 6)
+#define OMAP_UART_FCR_TX_FIFO_TRIG_MASK (0x3 << 4)
/* MVR register bitmasks */
#define OMAP_UART_MVR_SCHEME_SHIFT 30
@@ -834,9 +834,13 @@ serial_omap_set_termios(struct uart_port *port, struct ktermios *termios,
up->scr |= OMAP_UART_SCR_RX_TRIG_GRANU1_MASK;
- /* Set receive FIFO threshold to 1 byte */
+ /* Set receive FIFO threshold to 16 characters and
+ * transmit FIFO threshold to 16 spaces
+ */
up->fcr &= ~OMAP_UART_FCR_RX_FIFO_TRIG_MASK;
- up->fcr |= (0x1 << OMAP_UART_FCR_RX_FIFO_TRIG_SHIFT);
+ up->fcr &= ~OMAP_UART_FCR_TX_FIFO_TRIG_MASK;
+ up->fcr |= UART_FCR6_R_TRIGGER_16 | UART_FCR6_T_TRIGGER_24 |
+ UART_FCR_ENABLE_FIFO;
serial_out(up, UART_FCR, up->fcr);
serial_out(up, UART_LCR, UART_LCR_CONF_MODE_B);
--
1.7.12.rc3
^ permalink raw reply related
* [PATCH v4 04/21] serial: omap: simplify IRQ handling
From: Felipe Balbi @ 2012-09-06 12:45 UTC (permalink / raw)
To: Greg KH
Cc: alan, Tony Lindgren, Kevin Hilman, Linux OMAP Mailing List,
Linux ARM Kernel Mailing List, linux-serial,
Linux Kernel Mailing List, Santosh Shilimkar, Shubhrajyoti Datta,
Sourav Poddar, Felipe Balbi
In-Reply-To: <1346935540-1792-1-git-send-email-balbi@ti.com>
quite a few changes here, though they are
pretty obvious. In summary we're making sure
to detect which interrupt type we need to
handle before calling the underlying interrupt
handling procedure.
Tested-by: Shubhrajyoti D <shubhrajyoti@ti.com>
Acked-by: Santosh Shilimkar <santosh.shilimkar@ti.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
---
drivers/tty/serial/omap-serial.c | 51 ++++++++++++++++++++++++++++++----------
1 file changed, 38 insertions(+), 13 deletions(-)
diff --git a/drivers/tty/serial/omap-serial.c b/drivers/tty/serial/omap-serial.c
index dd3971f..d5a08cb 100644
--- a/drivers/tty/serial/omap-serial.c
+++ b/drivers/tty/serial/omap-serial.c
@@ -351,33 +351,58 @@ static inline irqreturn_t serial_omap_irq(int irq, void *dev_id)
{
struct uart_omap_port *up = dev_id;
unsigned int iir, lsr;
+ unsigned int type;
unsigned long flags;
+ irqreturn_t ret = IRQ_NONE;
+ spin_lock_irqsave(&up->port.lock, flags);
pm_runtime_get_sync(up->dev);
iir = serial_in(up, UART_IIR);
- if (iir & UART_IIR_NO_INT) {
- pm_runtime_mark_last_busy(up->dev);
- pm_runtime_put_autosuspend(up->dev);
- return IRQ_NONE;
- }
+again:
+ if (iir & UART_IIR_NO_INT)
+ goto out;
- spin_lock_irqsave(&up->port.lock, flags);
+ ret = IRQ_HANDLED;
lsr = serial_in(up, UART_LSR);
- if (iir & UART_IIR_RLSI) {
+
+ /* extract IRQ type from IIR register */
+ type = iir & 0x3e;
+
+ switch (type) {
+ case UART_IIR_MSI:
+ check_modem_status(up);
+ break;
+ case UART_IIR_THRI:
+ if (lsr & UART_LSR_THRE)
+ transmit_chars(up);
+ break;
+ case UART_IIR_RDI:
if (lsr & UART_LSR_DR)
receive_chars(up, &lsr);
+ break;
+ case UART_IIR_RLSI:
+ if (lsr & UART_LSR_BRK_ERROR_BITS)
+ receive_chars(up, &lsr);
+ break;
+ case UART_IIR_RX_TIMEOUT:
+ receive_chars(up, &lsr);
+ break;
+ case UART_IIR_CTS_RTS_DSR:
+ iir = serial_in(up, UART_IIR);
+ goto again;
+ case UART_IIR_XOFF:
+ /* FALLTHROUGH */
+ default:
+ break;
}
- check_modem_status(up);
- if ((lsr & UART_LSR_THRE) && (iir & UART_IIR_THRI))
- transmit_chars(up);
-
+out:
spin_unlock_irqrestore(&up->port.lock, flags);
pm_runtime_mark_last_busy(up->dev);
pm_runtime_put_autosuspend(up->dev);
-
up->port_activity = jiffies;
- return IRQ_HANDLED;
+
+ return ret;
}
static unsigned int serial_omap_tx_empty(struct uart_port *port)
--
1.7.12.rc3
^ permalink raw reply related
* [PATCH v4 10/21] serial: omap: make sure to suspend device before remove
From: Felipe Balbi @ 2012-09-06 12:45 UTC (permalink / raw)
To: Greg KH
Cc: alan, Tony Lindgren, Kevin Hilman, Linux OMAP Mailing List,
Linux ARM Kernel Mailing List, linux-serial,
Linux Kernel Mailing List, Santosh Shilimkar, Shubhrajyoti Datta,
Sourav Poddar, Felipe Balbi
In-Reply-To: <1346935540-1792-1-git-send-email-balbi@ti.com>
before removing the driver, let's make sure
to force device into a suspended state in order
to conserve power.
Tested-by: Shubhrajyoti D <shubhrajyoti@ti.com>
Acked-by: Santosh Shilimkar <santosh.shilimkar@ti.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
---
drivers/tty/serial/omap-serial.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/tty/serial/omap-serial.c b/drivers/tty/serial/omap-serial.c
index c19d340..0ceca44 100644
--- a/drivers/tty/serial/omap-serial.c
+++ b/drivers/tty/serial/omap-serial.c
@@ -1369,6 +1369,7 @@ static int serial_omap_remove(struct platform_device *dev)
{
struct uart_omap_port *up = platform_get_drvdata(dev);
+ pm_runtime_put_sync(up->dev);
pm_runtime_disable(up->dev);
uart_remove_one_port(&serial_omap_reg, &up->port);
pm_qos_remove_request(&up->pm_qos_request);
--
1.7.12.rc3
^ permalink raw reply related
* [PATCH v4 11/21] serial: omap: don't save IRQ flags on hardirq
From: Felipe Balbi @ 2012-09-06 12:45 UTC (permalink / raw)
To: Greg KH
Cc: alan, Tony Lindgren, Kevin Hilman, Linux OMAP Mailing List,
Linux ARM Kernel Mailing List, linux-serial,
Linux Kernel Mailing List, Santosh Shilimkar, Shubhrajyoti Datta,
Sourav Poddar, Felipe Balbi
In-Reply-To: <1346935540-1792-1-git-send-email-balbi@ti.com>
When we're running our hardirq handler, there's
not need to disable IRQs with spin_lock_irqsave()
because IRQs are already disabled. It also makes
no difference if we save or not IRQ flags.
Switch over to simple spin_lock/spin_unlock and
drop the "flags" variable.
Tested-by: Shubhrajyoti D <shubhrajyoti@ti.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
---
drivers/tty/serial/omap-serial.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/drivers/tty/serial/omap-serial.c b/drivers/tty/serial/omap-serial.c
index 0ceca44..99042b0 100644
--- a/drivers/tty/serial/omap-serial.c
+++ b/drivers/tty/serial/omap-serial.c
@@ -351,11 +351,10 @@ static inline irqreturn_t serial_omap_irq(int irq, void *dev_id)
struct tty_struct *tty = up->port.state->port.tty;
unsigned int iir, lsr;
unsigned int type;
- unsigned long flags;
irqreturn_t ret = IRQ_NONE;
int max_count = 256;
- spin_lock_irqsave(&up->port.lock, flags);
+ spin_lock(&up->port.lock);
pm_runtime_get_sync(up->dev);
do {
@@ -394,7 +393,7 @@ static inline irqreturn_t serial_omap_irq(int irq, void *dev_id)
}
} while (!(iir & UART_IIR_NO_INT) && max_count--);
- spin_unlock_irqrestore(&up->port.lock, flags);
+ spin_unlock(&up->port.lock);
tty_flip_buffer_push(tty);
--
1.7.12.rc3
^ permalink raw reply related
* [PATCH v4 13/21] serial: omap: optimization with section annotations
From: Felipe Balbi @ 2012-09-06 12:45 UTC (permalink / raw)
To: Greg KH
Cc: alan, Tony Lindgren, Kevin Hilman, Linux OMAP Mailing List,
Linux ARM Kernel Mailing List, linux-serial,
Linux Kernel Mailing List, Santosh Shilimkar, Shubhrajyoti Datta,
Sourav Poddar, Felipe Balbi, Ruchika Kharwar
In-Reply-To: <1346935540-1792-1-git-send-email-balbi@ti.com>
Two functions:
omap_serial_fill_features_erratas() and
of_get_uart_port_info() are only called from probe().
Marking them as __devinit gives us another
oportunity to free some code after .init.text
is done.
Tested-by: Shubhrajyoti D <shubhrajyoti@ti.com>
Signed-off-by: Ruchika Kharwar <ruchika@ti.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
---
drivers/tty/serial/omap-serial.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/drivers/tty/serial/omap-serial.c b/drivers/tty/serial/omap-serial.c
index f5dcb5a..9068260 100644
--- a/drivers/tty/serial/omap-serial.c
+++ b/drivers/tty/serial/omap-serial.c
@@ -1168,7 +1168,7 @@ static int serial_omap_resume(struct device *dev)
}
#endif
-static void omap_serial_fill_features_erratas(struct uart_omap_port *up)
+static void __devinit omap_serial_fill_features_erratas(struct uart_omap_port *up)
{
u32 mvr, scheme;
u16 revision, major, minor;
@@ -1221,7 +1221,7 @@ static void omap_serial_fill_features_erratas(struct uart_omap_port *up)
}
}
-static struct omap_uart_port_info *of_get_uart_port_info(struct device *dev)
+static __devinit struct omap_uart_port_info *of_get_uart_port_info(struct device *dev)
{
struct omap_uart_port_info *omap_up_info;
@@ -1234,7 +1234,7 @@ static struct omap_uart_port_info *of_get_uart_port_info(struct device *dev)
return omap_up_info;
}
-static int serial_omap_probe(struct platform_device *pdev)
+static int __devinit serial_omap_probe(struct platform_device *pdev)
{
struct uart_omap_port *up;
struct resource *mem, *irq;
@@ -1364,7 +1364,7 @@ err_port_line:
return ret;
}
-static int serial_omap_remove(struct platform_device *dev)
+static int __devexit serial_omap_remove(struct platform_device *dev)
{
struct uart_omap_port *up = platform_get_drvdata(dev);
@@ -1508,7 +1508,7 @@ MODULE_DEVICE_TABLE(of, omap_serial_of_match);
static struct platform_driver serial_omap_driver = {
.probe = serial_omap_probe,
- .remove = serial_omap_remove,
+ .remove = __devexit_p(serial_omap_remove),
.driver = {
.name = DRIVER_NAME,
.pm = &serial_omap_dev_pm_ops,
--
1.7.12.rc3
^ permalink raw reply related
* [PATCH 1/2] serial: mxs-auart: fix the wrong setting order
From: Huang Shijie @ 2012-09-07 2:38 UTC (permalink / raw)
To: gregkh
Cc: alan, linux-serial, linux-kernel, shawn.guo, linux-arm-kernel,
Huang Shijie
After set the AUART_CTRL0_CLKGATE, the UART will gate all the clocks off.
So the following line will not take effect.
................................................................
writel(AUART_INTR_RXIEN | AUART_INTR_RTIEN | AUART_INTR_CTSMIEN,
u->membase + AUART_INTR_CLR);
................................................................
To fix this issue, the patch moves this gate-off line to
the end of setting registers.
Signed-off-by: Huang Shijie <shijie8@gmail.com>
---
drivers/tty/serial/mxs-auart.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/tty/serial/mxs-auart.c b/drivers/tty/serial/mxs-auart.c
index dafeef2..ea5f888 100644
--- a/drivers/tty/serial/mxs-auart.c
+++ b/drivers/tty/serial/mxs-auart.c
@@ -457,11 +457,11 @@ static void mxs_auart_shutdown(struct uart_port *u)
writel(AUART_CTRL2_UARTEN, u->membase + AUART_CTRL2_CLR);
- writel(AUART_CTRL0_CLKGATE, u->membase + AUART_CTRL0_SET);
-
writel(AUART_INTR_RXIEN | AUART_INTR_RTIEN | AUART_INTR_CTSMIEN,
u->membase + AUART_INTR_CLR);
+ writel(AUART_CTRL0_CLKGATE, u->membase + AUART_CTRL0_SET);
+
clk_disable_unprepare(s->clk);
}
--
1.7.4.4
^ permalink raw reply related
* [PATCH 2/2] serial: mxs-auart: put the device in mxs_auart_probe()
From: Huang Shijie @ 2012-09-07 2:38 UTC (permalink / raw)
To: gregkh
Cc: alan, linux-serial, linux-kernel, shawn.guo, linux-arm-kernel,
Huang Shijie
In-Reply-To: <1346985521-2248-1-git-send-email-shijie8@gmail.com>
We call the get_device() in the mxs_auart_probe().
For the balance of the reference count, we should put the
device in the mxs_auart_remove().
Signed-off-by: Huang Shijie <shijie8@gmail.com>
---
drivers/tty/serial/mxs-auart.c | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/drivers/tty/serial/mxs-auart.c b/drivers/tty/serial/mxs-auart.c
index ea5f888..6898413 100644
--- a/drivers/tty/serial/mxs-auart.c
+++ b/drivers/tty/serial/mxs-auart.c
@@ -796,6 +796,7 @@ static int __devexit mxs_auart_remove(struct platform_device *pdev)
auart_port[pdev->id] = NULL;
+ put_device(s->dev);
clk_put(s->clk);
free_irq(s->irq, s);
kfree(s);
--
1.7.4.4
^ permalink raw reply related
* Re: [PATCH v4 00/21] OMAP UART Patches
From: Greg KH @ 2012-09-06 16:18 UTC (permalink / raw)
To: Felipe Balbi
Cc: alan, Tony Lindgren, Kevin Hilman, Linux OMAP Mailing List,
Linux ARM Kernel Mailing List, linux-serial,
Linux Kernel Mailing List, Santosh Shilimkar, Shubhrajyoti Datta,
Sourav Poddar
In-Reply-To: <1346935540-1792-1-git-send-email-balbi@ti.com>
On Thu, Sep 06, 2012 at 03:45:19PM +0300, Felipe Balbi wrote:
> Hi guys,
>
> here's v4 of the omap uart patchset. No changes other than a rebase on top of
> Greg's tty-next branch and Tony's Acked-by being added to a couple patches
>
> Note: I'm resending the series with Vikram's Software Flow Control fix anyway
> as it can just be ignored if it's decided it needs to go into this merge
> window.
>
> Changes since v3:
> . Rebased on top of Greg's tty-next branch
> . Added Tony's Acked-by
Thanks for rebasing, all now applied.
greg k-h
^ permalink raw reply
* Re: [PATCH v6] tty: uartclk value from serial_core exposed to sysfs
From: Greg KH @ 2012-09-06 16:23 UTC (permalink / raw)
To: Tomas Hlavacek; +Cc: alan, linux-serial, linux-kernel, marek.vasut
In-Reply-To: <1346894238-12870-1-git-send-email-tmshlvck@gmail.com>
On Thu, Sep 06, 2012 at 03:17:18AM +0200, Tomas Hlavacek wrote:
> Added file /sys/devices/.../tty/ttySX/uartclk to allow reading
> uartclk value in struct uart_port in serial_core via sysfs.
>
> tty_register_device() has been generalized and refactored in order
> to add support for setting drvdata and attribute_group to the device.
>
> Signed-off-by: Tomas Hlavacek <tmshlvck@gmail.com>
Thanks, that worked, I've now applied this.
greg k-h
^ permalink raw reply
* Re: [PATCH v4 00/21] OMAP UART Patches
From: Felipe Balbi @ 2012-09-06 17:25 UTC (permalink / raw)
To: Greg KH
Cc: Felipe Balbi, alan, Tony Lindgren, Kevin Hilman,
Linux OMAP Mailing List, Linux ARM Kernel Mailing List,
linux-serial, Linux Kernel Mailing List, Santosh Shilimkar,
Shubhrajyoti Datta, Sourav Poddar
In-Reply-To: <20120906161835.GA7923@kroah.com>
[-- Attachment #1: Type: text/plain, Size: 680 bytes --]
On Thu, Sep 06, 2012 at 09:18:35AM -0700, Greg KH wrote:
> On Thu, Sep 06, 2012 at 03:45:19PM +0300, Felipe Balbi wrote:
> > Hi guys,
> >
> > here's v4 of the omap uart patchset. No changes other than a rebase on top of
> > Greg's tty-next branch and Tony's Acked-by being added to a couple patches
> >
> > Note: I'm resending the series with Vikram's Software Flow Control fix anyway
> > as it can just be ignored if it's decided it needs to go into this merge
> > window.
> >
> > Changes since v3:
> > . Rebased on top of Greg's tty-next branch
> > . Added Tony's Acked-by
>
> Thanks for rebasing, all now applied.
thank you, actually ;-)
--
balbi
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
^ permalink raw reply
* Re: [PATCH v6] uartclk value from serial_core exposed to sysfs
From: Jiri Slaby @ 2012-09-06 17:54 UTC (permalink / raw)
To: Tomas Hlavacek; +Cc: gregkh, alan, linux-serial, linux-kernel, marek.vasut
In-Reply-To: <1346894238-12870-1-git-send-email-tmshlvck@gmail.com>
On 09/06/2012 03:17 AM, Tomas Hlavacek wrote:
> @@ -2362,8 +2392,8 @@ int uart_add_one_port(struct uart_driver *drv, struct uart_port *uport)
> * Register the port whether it's detected or not. This allows
> * setserial to be used to alter this ports parameters.
> */
> - tty_dev = tty_port_register_device(port, drv->tty_driver, uport->line,
> - uport->dev);
> + tty_dev = tty_register_device_attr(drv->tty_driver, uport->line,
> + uport->dev, port, tty_dev_attr_groups);
This makes me believe you have not tested the change at all?
--
js
suse labs
^ permalink raw reply
* Re: [PATCH v6] uartclk value from serial_core exposed to sysfs
From: Tomas Hlavacek @ 2012-09-06 18:39 UTC (permalink / raw)
To: Jiri Slaby; +Cc: gregkh, alan, linux-serial, linux-kernel, marek.vasut
In-Reply-To: <5048E35F.5020304@suse.cz>
Hi Jiri,
On Thu, Sep 6, 2012 at 7:54 PM, Jiri Slaby <jslaby@suse.cz> wrote:
> On 09/06/2012 03:17 AM, Tomas Hlavacek wrote:
>> @@ -2362,8 +2392,8 @@ int uart_add_one_port(struct uart_driver *drv, struct uart_port *uport)
>> * Register the port whether it's detected or not. This allows
>> * setserial to be used to alter this ports parameters.
>> */
>> - tty_dev = tty_port_register_device(port, drv->tty_driver, uport->line,
>> - uport->dev);
>> + tty_dev = tty_register_device_attr(drv->tty_driver, uport->line,
>> + uport->dev, port, tty_dev_attr_groups);
>
> This makes me believe you have not tested the change at all?
Thanks! I can't believe I missed that. (And I actually tested that,
but I have to admit that it was not enough apparently.)
I will re-send the patch (after some additional testing and double-checking).
Tomas
^ permalink raw reply
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox