From: Felipe Balbi <hidden> Date: 2012-08-23 10:37:11
Hi guys,
here's v3 and hopefully final version of this series. A whole bunch of new
patches added but the good thing is that now I had another engineer's help to
test, so he's got his Tested-by in all patches.
Changes since v2:
. Added a bunch of new patches
. Fixed a problem where we would always return IRQ_NONE even though we
handled IRQ
Changes since v1:
. improved commit log on patch 9/13 (formerly 10/13)
. removed patch 2/13
. added a new patch switching from spin_lock_irqsave() to spin_lock and
spin_unlock_irqrestore to spin_unlock
Alan, if you prefer in pull request form, here it is:
The following changes since commit d9875690d9b89a866022ff49e3fcea892345ad92:
Linux 3.6-rc2 (2012-08-16 14:51:24 -0700)
are available in the git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/balbi/usb.git uart
for you to fetch changes up to a29230f14d8466c9b8c25171715378bf52189453:
serial: omap: enable RX and TX FIFO usage (2012-08-23 09:25:16 +0300)
----------------------------------------------------------------
Felipe Balbi (20):
serial: omap: define and use to_uart_omap_port()
serial: omap: define helpers for pdata function pointers
serial: omap: don't access the platform_device
serial: omap: drop DMA support
serial: add OMAP-specific defines
serial: omap: simplify IRQ handling
serial: omap: refactor receive_chars() into rdi/rlsi handlers
serial: omap: move THRE check to transmit_chars()
serial: omap: stick to put_autosuspend
serial: omap: set dev->drvdata before enabling pm_runtime
serial: omap: drop unnecessary check from remove
serial: omap: make sure to suspend device before remove
serial: omap: don't save IRQ flags on hardirq
serial: omap: optimization with section annotations
serial: omap: drop "inline" from IRQ handler prototype
serial: omap: implement set_wake
serial: omap: make sure to put() on poll_get_char
serial: omap: remove unnecessary header and add a missing one
serial: omap: move uart_omap_port definition to C file
serial: omap: enable RX and TX FIFO usage
Ruchika Kharwar (2):
serial: omap: fix sequence of pm_runtime_* calls.
serial: omap: unlock the port lock
Vikram Pandita (1):
serial: omap: fix software flow control
arch/arm/mach-omap2/serial.c | 15 +-
arch/arm/plat-omap/include/plat/omap-serial.h | 47 +-
drivers/tty/serial/omap-serial.c | 808 ++++++++++----------------
include/linux/serial_reg.h | 4 +
4 files changed, 330 insertions(+), 544 deletions(-)
--
1.7.12.rc3
From: Felipe Balbi <hidden> Date: 2012-08-23 10:37:18
this patch is in preparation to a few other changes
which will align on the prototype for function
pointers passed through pdata.
It also helps cleaning up the driver a little by
agregating checks for pdata in a single location.
Tested-by: Shubhrajyoti D <redacted>
Acked-by: Santosh Shilimkar <redacted>
Signed-off-by: Felipe Balbi <redacted>
---
drivers/tty/serial/omap-serial.c | 66 ++++++++++++++++++++++++++++------------
1 file changed, 47 insertions(+), 19 deletions(-)
From: Felipe Balbi <hidden> Date: 2012-08-23 10:37:30
The current support is known to be broken and
a later patch will come re-adding it using
dma engine API.
Tested-by: Shubhrajyoti D <redacted>
Acked-by: Santosh Shilimkar <redacted>
Signed-off-by: Felipe Balbi <redacted>
---
drivers/tty/serial/omap-serial.c | 330 ++-------------------------------------
1 file changed, 12 insertions(+), 318 deletions(-)
@@ -605,20 +505,6 @@ static int serial_omap_startup(struct uart_port *port)spin_unlock_irqrestore(&up->port.lock,flags);up->msr_saved_flags=0;-if(up->use_dma){-free_page((unsignedlong)up->port.state->xmit.buf);-up->port.state->xmit.buf=dma_alloc_coherent(NULL,-UART_XMIT_SIZE,-(dma_addr_t*)&(up->uart_dma.tx_buf_dma_phys),-0);-init_timer(&(up->uart_dma.rx_timer));-up->uart_dma.rx_timer.function=serial_omap_rxdma_poll;-up->uart_dma.rx_timer.data=up->port.line;-/* Currently the buffer size is 4KB. Can increase it */-up->uart_dma.rx_buf=dma_alloc_coherent(NULL,-up->uart_dma.rx_buf_size,-(dma_addr_t*)&(up->uart_dma.rx_buf_dma_phys),0);-}/**Finally,enableinterrupts.Note:Modemstatusinterrupts*aresetviaset_termios(),whichwillbeoccurringimminently
From: Felipe Balbi <hidden> Date: 2012-08-23 10:37:45
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 <redacted>
Acked-by: Santosh Shilimkar <redacted>
Signed-off-by: Felipe Balbi <redacted>
---
drivers/tty/serial/omap-serial.c | 33 ++++++++++++++++++++++-----------
1 file changed, 22 insertions(+), 11 deletions(-)
From: Felipe Balbi <hidden> Date: 2012-08-23 10:37:56
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 <redacted>
Acked-by: Santosh Shilimkar <redacted>
Signed-off-by: Felipe Balbi <redacted>
---
drivers/tty/serial/omap-serial.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
From: Felipe Balbi <hidden> Date: 2012-08-23 10:38:18
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 <redacted>
Signed-off-by: Felipe Balbi <redacted>
---
drivers/tty/serial/omap-serial.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
From: Felipe Balbi <hidden> Date: 2012-08-23 10:38:32
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 <redacted>
Signed-off-by: Felipe Balbi <redacted>
---
drivers/tty/serial/omap-serial.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
From: Felipe Balbi <hidden> Date: 2012-08-23 10:38:37
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 <redacted>
Signed-off-by: Felipe Balbi <redacted>
---
arch/arm/plat-omap/include/plat/omap-serial.h | 37 --------------------------
drivers/tty/serial/omap-serial.c | 38 +++++++++++++++++++++++++++
2 files changed, 38 insertions(+), 37 deletions(-)
From: Felipe Balbi <hidden> Date: 2012-08-23 10:39:27
From: Vikram Pandita <redacted>
Software flow control register bits were not defined correctly.
Also clarify the IXON and IXOFF logic to reflect what userspace wants.
Cc: stable at vger.kernel.org
Tested-by: Shubhrajyoti D <redacted>
Signed-off-by: Vikram Pandita <redacted>
Signed-off-by: Shubhrajyoti D <redacted>
Signed-off-by: Felipe Balbi <redacted>
---
arch/arm/plat-omap/include/plat/omap-serial.h | 4 ++--
drivers/tty/serial/omap-serial.c | 12 ++++++------
2 files changed, 8 insertions(+), 8 deletions(-)
From: Felipe Balbi <hidden> Date: 2012-08-23 10:39:31
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 <redacted>
Signed-off-by: Felipe Balbi <redacted>
---
drivers/tty/serial/omap-serial.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
From: Felipe Balbi <hidden> Date: 2012-08-23 10:39:58
This has been missing from OMAP UART driver
for quite a while and it's simple enough
to implement it.
Tested-by: Shubhrajyoti D <redacted>
Signed-off-by: Felipe Balbi <redacted>
---
drivers/tty/serial/omap-serial.c | 10 ++++++++++
1 file changed, 10 insertions(+)
From: Felipe Balbi <hidden> Date: 2012-08-23 10:40:04
From: Ruchika Kharwar <redacted>
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 <redacted>
Signed-off-by: Ruchika Kharwar <redacted>
Signed-off-by: Pavan Savoy <redacted>
Signed-off-by: Vijay Badawadagi <redacted>
Signed-off-by: Felipe Balbi <redacted>
---
drivers/tty/serial/omap-serial.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
From: Felipe Balbi <hidden> Date: 2012-08-23 10:40:14
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 <redacted>
Signed-off-by: Ruchika Kharwar <redacted>
Signed-off-by: Felipe Balbi <redacted>
---
drivers/tty/serial/omap-serial.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
From: Felipe Balbi <hidden> Date: 2012-08-23 10:41:49
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 <redacted>
Signed-off-by: Felipe Balbi <redacted>
---
drivers/tty/serial/omap-serial.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
From: Felipe Balbi <hidden> Date: 2012-08-23 10:42:20
before removing the driver, let's make sure
to force device into a suspended state in order
to conserve power.
Tested-by: Shubhrajyoti D <redacted>
Acked-by: Santosh Shilimkar <redacted>
Signed-off-by: Felipe Balbi <redacted>
---
drivers/tty/serial/omap-serial.c | 1 +
1 file changed, 1 insertion(+)
From: Felipe Balbi <hidden> Date: 2012-08-23 10:43:01
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 <redacted>
Acked-by: Santosh Shilimkar <redacted>
Signed-off-by: Felipe Balbi <redacted>
---
drivers/tty/serial/omap-serial.c | 9 +++------
1 file changed, 3 insertions(+), 6 deletions(-)
From: Felipe Balbi <hidden> Date: 2012-08-23 10:43:08
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 <redacted>
Acked-by: Santosh Shilimkar <redacted>
Signed-off-by: Felipe Balbi <redacted>
---
drivers/tty/serial/omap-serial.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
From: Felipe Balbi <hidden> Date: 2012-08-23 10:43:58
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 <redacted>
Acked-by: Santosh Shilimkar <redacted>
Signed-off-by: Felipe Balbi <redacted>
---
drivers/tty/serial/omap-serial.c | 205 +++++++++++++++++++--------------------
1 file changed, 101 insertions(+), 104 deletions(-)
@@ -195,74 +195,6 @@ static void serial_omap_stop_rx(struct uart_port *port)pm_runtime_put_autosuspend(up->dev);}-staticinlinevoidreceive_chars(structuart_omap_port*up,-unsignedint*status)-{-structtty_struct*tty=up->port.state->port.tty;-unsignedintflag,lsr=*status;-unsignedcharch=0;-intmax_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)){-/*-*Forstatisticsonly-*/-if(lsr&UART_LSR_BI){-lsr&=~(UART_LSR_FE|UART_LSR_PE);-up->port.icount.brk++;-/*-*WedotheSysRQandSAKchecking-*herebecauseotherwisethebreak-*maygetmaskedbyignore_status_mask-*orread_status_mask.-*/-if(uart_handle_break(&up->port))-gotoignore_char;-}elseif(lsr&UART_LSR_PE){-up->port.icount.parity++;-}elseif(lsr&UART_LSR_FE){-up->port.icount.frame++;-}--if(lsr&UART_LSR_OE)-up->port.icount.overrun++;--/*-*Maskoffconditionswhichshouldbeignored.-*/-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;-elseif(lsr&UART_LSR_PE)-flag=TTY_PARITY;-elseif(lsr&UART_LSR_FE)-flag=TTY_FRAME;-}--if(uart_handle_sysrq_char(&up->port,ch))-gotoignore_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);-}-staticvoidtransmit_chars(structuart_omap_port*up){structcirc_buf*xmit=&up->port.state->xmit;
@@ -341,6 +273,68 @@ static unsigned int check_modem_status(struct uart_omap_port *up)returnstatus;}+staticvoidserial_omap_rlsi(structuart_omap_port*up,unsignedintlsr)+{+unsignedintflag;++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++;+/*+*WedotheSysRQandSAKchecking+*herebecauseotherwisethebreak+*maygetmaskedbyignore_status_mask+*orread_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);+}++staticvoidserial_omap_rdi(structuart_omap_port*up,unsignedintlsr)+{+unsignedcharch=0;+unsignedintflag;++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()-Thishandlestheinterruptfromoneport*@irq:uartportirqnumber
@@ -349,54 +343,57 @@ static unsigned int check_modem_status(struct uart_omap_port *up)staticinlineirqreturn_tserial_omap_irq(intirq,void*dev_id){structuart_omap_port*up=dev_id;+structtty_struct*tty=up->port.state->port.tty;unsignedintiir,lsr;unsignedinttype;unsignedlongflags;irqreturn_tret=IRQ_NONE;+intmax_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)-gotoout;-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){-caseUART_IIR_MSI:-check_modem_status(up);-break;-caseUART_IIR_THRI:-if(lsr&UART_LSR_THRE)-transmit_chars(up);-break;-caseUART_IIR_RDI:-if(lsr&UART_LSR_DR)-receive_chars(up,&lsr);-break;-caseUART_IIR_RLSI:-if(lsr&UART_LSR_BRK_ERROR_BITS)-receive_chars(up,&lsr);-break;-caseUART_IIR_RX_TIMEOUT:-receive_chars(up,&lsr);-break;-caseUART_IIR_CTS_RTS_DSR:-iir=serial_in(up,UART_IIR);-gotoagain;-caseUART_IIR_XOFF:-/* FALLTHROUGH */-default:-break;-}+/* extract IRQ type from IIR register */+type=iir&0x3e;++switch(type){+caseUART_IIR_MSI:+check_modem_status(up);+break;+caseUART_IIR_THRI:+if(lsr&UART_LSR_THRE)+transmit_chars(up);+break;+caseUART_IIR_RX_TIMEOUT:+/* FALLTHROUGH */+caseUART_IIR_RDI:+serial_omap_rdi(up,lsr);+break;+caseUART_IIR_RLSI:+serial_omap_rlsi(up,lsr);+break;+caseUART_IIR_CTS_RTS_DSR:+/* simply try again */+break;+caseUART_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;
From: Felipe Balbi <hidden> Date: 2012-08-23 10:43:59
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 <redacted>
Acked-by: Santosh Shilimkar <redacted>
Signed-off-by: Felipe Balbi <redacted>
---
drivers/tty/serial/omap-serial.c | 51 ++++++++++++++++++++++++++++++----------
1 file changed, 38 insertions(+), 13 deletions(-)
From: Felipe Balbi <hidden> Date: 2012-08-23 10:44:01
OMAP has some extra Interrupt types which can
be really useful for SW. Let's define them
so we can later use those in OMAP's serial driver.
Tested-by: Shubhrajyoti D <redacted>
Acked-by: Santosh Shilimkar <redacted>
Signed-off-by: Felipe Balbi <redacted>
---
include/linux/serial_reg.h | 4 ++++
1 file changed, 4 insertions(+)
From: Felipe Balbi <hidden> Date: 2012-08-23 10:45:02
The driver doesn't need to know about its platform_device.
Everything the driver needs can be done through the
struct device pointer. In case we need to use the
OMAP-specific PM function pointers, those can make
sure to find the device's platform_device pointer
so they can find the struct omap_device through
pdev->archdata field.
Tested-by: Shubhrajyoti D <redacted>
Acked-by: Santosh Shilimkar <redacted>
Signed-off-by: Felipe Balbi <redacted>
---
arch/arm/mach-omap2/serial.c | 15 ++--
arch/arm/plat-omap/include/plat/omap-serial.h | 10 +--
drivers/tty/serial/omap-serial.c | 124 +++++++++++++-------------
3 files changed, 76 insertions(+), 73 deletions(-)
@@ -574,7 +574,7 @@ static int serial_omap_startup(struct uart_port *port)dev_dbg(up->port.dev,"serial_omap_startup+%d\n",up->port.line);-pm_runtime_get_sync(&up->pdev->dev);+pm_runtime_get_sync(up->dev);/**CleartheFIFObuffersanddisablethem.*(theywillbereenabledinset_termios())
@@ -630,8 +630,8 @@ static int serial_omap_startup(struct uart_port *port)/* Enable module level wake up */serial_out(up,UART_OMAP_WER,OMAP_UART_WER_MOD_WKUP);-pm_runtime_mark_last_busy(&up->pdev->dev);-pm_runtime_put_autosuspend(&up->pdev->dev);+pm_runtime_mark_last_busy(up->dev);+pm_runtime_put_autosuspend(up->dev);up->port_activity=jiffies;return0;}
From: Felipe Balbi <hidden> Date: 2012-08-23 10:45:47
current code only works because struct uart_port
is the first member on the uart_omap_port structure.
If, for whatever reason, someone puts another
member as the first of the structure, that cast
won't work anymore. In order to be safe, let's use
a container_of() which, for now, gets optimized into
a cast anyway.
Tested-by: Shubhrajyoti D <redacted>
Acked-by: Santosh Shilimkar <redacted>
Signed-off-by: Felipe Balbi <redacted>
---
arch/arm/plat-omap/include/plat/omap-serial.h | 2 ++
drivers/tty/serial/omap-serial.c | 36 +++++++++++++--------------
2 files changed, 20 insertions(+), 18 deletions(-)
From: Felipe Balbi <hidden> Date: 2012-08-24 10:44:54
Forgot to Cc greg initially, my bad
On Thu, Aug 23, 2012 at 01:32:40PM +0300, Felipe Balbi wrote:
Hi guys,
here's v3 and hopefully final version of this series. A whole bunch of new
patches added but the good thing is that now I had another engineer's help to
test, so he's got his Tested-by in all patches.
Changes since v2:
. Added a bunch of new patches
. Fixed a problem where we would always return IRQ_NONE even though we
handled IRQ
Changes since v1:
. improved commit log on patch 9/13 (formerly 10/13)
. removed patch 2/13
. added a new patch switching from spin_lock_irqsave() to spin_lock and
spin_unlock_irqrestore to spin_unlock
Alan, if you prefer in pull request form, here it is:
The following changes since commit d9875690d9b89a866022ff49e3fcea892345ad92:
Linux 3.6-rc2 (2012-08-16 14:51:24 -0700)
are available in the git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/balbi/usb.git uart
for you to fetch changes up to a29230f14d8466c9b8c25171715378bf52189453:
serial: omap: enable RX and TX FIFO usage (2012-08-23 09:25:16 +0300)
----------------------------------------------------------------
Felipe Balbi (20):
serial: omap: define and use to_uart_omap_port()
serial: omap: define helpers for pdata function pointers
serial: omap: don't access the platform_device
serial: omap: drop DMA support
serial: add OMAP-specific defines
serial: omap: simplify IRQ handling
serial: omap: refactor receive_chars() into rdi/rlsi handlers
serial: omap: move THRE check to transmit_chars()
serial: omap: stick to put_autosuspend
serial: omap: set dev->drvdata before enabling pm_runtime
serial: omap: drop unnecessary check from remove
serial: omap: make sure to suspend device before remove
serial: omap: don't save IRQ flags on hardirq
serial: omap: optimization with section annotations
serial: omap: drop "inline" from IRQ handler prototype
serial: omap: implement set_wake
serial: omap: make sure to put() on poll_get_char
serial: omap: remove unnecessary header and add a missing one
serial: omap: move uart_omap_port definition to C file
serial: omap: enable RX and TX FIFO usage
Ruchika Kharwar (2):
serial: omap: fix sequence of pm_runtime_* calls.
serial: omap: unlock the port lock
Vikram Pandita (1):
serial: omap: fix software flow control
arch/arm/mach-omap2/serial.c | 15 +-
arch/arm/plat-omap/include/plat/omap-serial.h | 47 +-
drivers/tty/serial/omap-serial.c | 808 ++++++++++----------------
include/linux/serial_reg.h | 4 +
4 files changed, 330 insertions(+), 544 deletions(-)
--
1.7.12.rc3
From: Tony Lindgren <tony@atomide.com> Date: 2012-08-24 19:08:44
* Felipe Balbi [off-list ref] [120823 03:38]:
From: Vikram Pandita <redacted>
Software flow control register bits were not defined correctly.
Also clarify the IXON and IXOFF logic to reflect what userspace wants.
Cc: stable at vger.kernel.org
Tested-by: Shubhrajyoti D <redacted>
Signed-off-by: Vikram Pandita <redacted>
Signed-off-by: Shubhrajyoti D <redacted>
Signed-off-by: Felipe Balbi <redacted>
From: Tony Lindgren <tony@atomide.com> Date: 2012-08-24 19:43:51
* Felipe Balbi [off-list ref] [120823 03:38]:
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 <redacted>
Signed-off-by: Felipe Balbi <redacted>
From: Tony Lindgren <tony@atomide.com> Date: 2012-08-24 20:08:10
* Felipe Balbi [off-list ref] [120823 03:37]:
quoted hunk
current code only works because struct uart_port
is the first member on the uart_omap_port structure.
If, for whatever reason, someone puts another
member as the first of the structure, that cast
won't work anymore. In order to be safe, let's use
a container_of() which, for now, gets optimized into
a cast anyway.
Tested-by: Shubhrajyoti D <redacted>
Acked-by: Santosh Shilimkar <redacted>
Signed-off-by: Felipe Balbi <redacted>
---
arch/arm/plat-omap/include/plat/omap-serial.h | 2 ++
drivers/tty/serial/omap-serial.c | 36 +++++++++++++--------------
2 files changed, 20 insertions(+), 18 deletions(-)
For the arch/arm/*omap*/* parts:
Acked-by: Tony Lindgren <tony@atomide.com>
FYI, note that there are ARM SoC patches to move various header files to
live under include/linux/platform_data which may cause conflicts with these
changes.
Regards,
Tony
From: Tony Lindgren <tony@atomide.com> Date: 2012-08-24 21:26:07
* Felipe Balbi [off-list ref] [120823 03:37]:
The driver doesn't need to know about its platform_device.
Everything the driver needs can be done through the
struct device pointer. In case we need to use the
OMAP-specific PM function pointers, those can make
sure to find the device's platform_device pointer
so they can find the struct omap_device through
pdev->archdata field.
Tested-by: Shubhrajyoti D <redacted>
Acked-by: Santosh Shilimkar <redacted>
Signed-off-by: Felipe Balbi <redacted>
From: Felipe Balbi <hidden> Date: 2012-09-04 11:50:06
Hi,
On Fri, Aug 24, 2012 at 01:40:47PM +0300, Felipe Balbi wrote:
Forgot to Cc greg initially, my bad
a gentle ping on this series so we don't miss it for v3.7 merge window.
Greg, let me know if you need me to resend.
cheers
On Thu, Aug 23, 2012 at 01:32:40PM +0300, Felipe Balbi wrote:
quoted
Hi guys,
here's v3 and hopefully final version of this series. A whole bunch of new
patches added but the good thing is that now I had another engineer's help to
test, so he's got his Tested-by in all patches.
Changes since v2:
. Added a bunch of new patches
. Fixed a problem where we would always return IRQ_NONE even though we
handled IRQ
Changes since v1:
. improved commit log on patch 9/13 (formerly 10/13)
. removed patch 2/13
. added a new patch switching from spin_lock_irqsave() to spin_lock and
spin_unlock_irqrestore to spin_unlock
Alan, if you prefer in pull request form, here it is:
The following changes since commit d9875690d9b89a866022ff49e3fcea892345ad92:
Linux 3.6-rc2 (2012-08-16 14:51:24 -0700)
are available in the git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/balbi/usb.git uart
for you to fetch changes up to a29230f14d8466c9b8c25171715378bf52189453:
serial: omap: enable RX and TX FIFO usage (2012-08-23 09:25:16 +0300)
----------------------------------------------------------------
Felipe Balbi (20):
serial: omap: define and use to_uart_omap_port()
serial: omap: define helpers for pdata function pointers
serial: omap: don't access the platform_device
serial: omap: drop DMA support
serial: add OMAP-specific defines
serial: omap: simplify IRQ handling
serial: omap: refactor receive_chars() into rdi/rlsi handlers
serial: omap: move THRE check to transmit_chars()
serial: omap: stick to put_autosuspend
serial: omap: set dev->drvdata before enabling pm_runtime
serial: omap: drop unnecessary check from remove
serial: omap: make sure to suspend device before remove
serial: omap: don't save IRQ flags on hardirq
serial: omap: optimization with section annotations
serial: omap: drop "inline" from IRQ handler prototype
serial: omap: implement set_wake
serial: omap: make sure to put() on poll_get_char
serial: omap: remove unnecessary header and add a missing one
serial: omap: move uart_omap_port definition to C file
serial: omap: enable RX and TX FIFO usage
Ruchika Kharwar (2):
serial: omap: fix sequence of pm_runtime_* calls.
serial: omap: unlock the port lock
Vikram Pandita (1):
serial: omap: fix software flow control
arch/arm/mach-omap2/serial.c | 15 +-
arch/arm/plat-omap/include/plat/omap-serial.h | 47 +-
drivers/tty/serial/omap-serial.c | 808 ++++++++++----------------
include/linux/serial_reg.h | 4 +
4 files changed, 330 insertions(+), 544 deletions(-)
--
1.7.12.rc3
On Thu, Aug 23, 2012 at 01:32:43PM +0300, Felipe Balbi wrote:
The driver doesn't need to know about its platform_device.
Everything the driver needs can be done through the
struct device pointer. In case we need to use the
OMAP-specific PM function pointers, those can make
sure to find the device's platform_device pointer
so they can find the struct omap_device through
pdev->archdata field.
Tested-by: Shubhrajyoti D <redacted>
Acked-by: Santosh Shilimkar <redacted>
Signed-off-by: Felipe Balbi <redacted>
Acked-by: Tony Lindgren <tony@atomide.com>
This series fails when applying to my tty-next branch at this patch :(
Care to refresh it, and resend it, with Tony's acks added, so I can
apply it? Note, I've already applied the first two.
thanks,
greg k-h
On Thu, Aug 23, 2012 at 01:33:00PM +0300, Felipe Balbi wrote:
From: Vikram Pandita <redacted>
Software flow control register bits were not defined correctly.
Also clarify the IXON and IXOFF logic to reflect what userspace wants.
Cc: stable at vger.kernel.org
Tested-by: Shubhrajyoti D <redacted>
Signed-off-by: Vikram Pandita <redacted>
Signed-off-by: Shubhrajyoti D <redacted>
Signed-off-by: Felipe Balbi <redacted>
Acked-by: Tony Lindgren <tony@atomide.com>
---
If this is a stable patch, should it be pulled out and put also in for
3.6?
thanks,
greg k-h
From: Felipe Balbi <hidden> Date: 2012-09-06 12:34:19
On Wed, Sep 05, 2012 at 01:27:21PM -0700, Greg KH wrote:
On Thu, Aug 23, 2012 at 01:32:43PM +0300, Felipe Balbi wrote:
quoted
The driver doesn't need to know about its platform_device.
Everything the driver needs can be done through the
struct device pointer. In case we need to use the
OMAP-specific PM function pointers, those can make
sure to find the device's platform_device pointer
so they can find the struct omap_device through
pdev->archdata field.
Tested-by: Shubhrajyoti D <redacted>
Acked-by: Santosh Shilimkar <redacted>
Signed-off-by: Felipe Balbi <redacted>
Acked-by: Tony Lindgren <tony@atomide.com>
This series fails when applying to my tty-next branch at this patch :(
Care to refresh it, and resend it, with Tony's acks added, so I can
apply it? Note, I've already applied the first two.
From: Felipe Balbi <hidden> Date: 2012-09-06 12:36:07
On Wed, Sep 05, 2012 at 01:27:49PM -0700, Greg KH wrote:
On Thu, Aug 23, 2012 at 01:33:00PM +0300, Felipe Balbi wrote:
quoted
From: Vikram Pandita <redacted>
Software flow control register bits were not defined correctly.
Also clarify the IXON and IXOFF logic to reflect what userspace wants.
Cc: stable at vger.kernel.org
Tested-by: Shubhrajyoti D <redacted>
Signed-off-by: Vikram Pandita <redacted>
Signed-off-by: Shubhrajyoti D <redacted>
Signed-off-by: Felipe Balbi <redacted>
Acked-by: Tony Lindgren <tony@atomide.com>
---
If this is a stable patch, should it be pulled out and put also in for
3.6?
I'll leave that for Vikram to answer. Vikram, do you think this is
something so extreme that we _must_ apply it now, or can it wait for the
next merge window ?
I mean, I think this bug has been in the driver for a long time, right ?
--
balbi
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20120906/28a9f259/attachment-0001.sig>
From: Felipe Balbi <hidden> Date: 2012-09-06 12:50:16
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
Changes since v2:
. Added a bunch of new patches
. Fixed a problem where we would always return IRQ_NONE even though we
handled IRQ
Changes since v1:
. improved commit log on patch 9/13 (formerly 10/13)
. removed patch 2/13
. added a new patch switching from spin_lock_irqsave() to spin_lock and
spin_unlock_irqrestore to spin_unlock
Felipe Balbi (18):
serial: omap: don't access the platform_device
serial: omap: drop DMA support
serial: add OMAP-specific defines
serial: omap: simplify IRQ handling
serial: omap: refactor receive_chars() into rdi/rlsi handlers
serial: omap: move THRE check to transmit_chars()
serial: omap: stick to put_autosuspend
serial: omap: set dev->drvdata before enabling pm_runtime
serial: omap: drop unnecessary check from remove
serial: omap: make sure to suspend device before remove
serial: omap: don't save IRQ flags on hardirq
serial: omap: optimization with section annotations
serial: omap: drop "inline" from IRQ handler prototype
serial: omap: implement set_wake
serial: omap: make sure to put() on poll_get_char
serial: omap: remove unnecessary header and add a missing one
serial: omap: move uart_omap_port definition to C file
serial: omap: enable RX and TX FIFO usage
Ruchika Kharwar (2):
serial: omap: fix sequence of pm_runtime_* calls.
serial: omap: unlock the port lock
Vikram Pandita (1):
serial: omap: fix software flow control
arch/arm/mach-omap2/serial.c | 15 +-
arch/arm/plat-omap/include/plat/omap-serial.h | 49 +-
drivers/tty/serial/omap-serial.c | 740 +++++++++-----------------
include/linux/serial_reg.h | 4 +
4 files changed, 282 insertions(+), 526 deletions(-)
--
1.7.12.rc3
From: Felipe Balbi <hidden> Date: 2012-09-06 12:50:22
OMAP has some extra Interrupt types which can
be really useful for SW. Let's define them
so we can later use those in OMAP's serial driver.
Tested-by: Shubhrajyoti D <redacted>
Acked-by: Santosh Shilimkar <redacted>
Signed-off-by: Felipe Balbi <redacted>
---
include/linux/serial_reg.h | 4 ++++
1 file changed, 4 insertions(+)
From: Felipe Balbi <hidden> Date: 2012-09-06 12:50:31
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 <redacted>
Acked-by: Santosh Shilimkar <redacted>
Signed-off-by: Felipe Balbi <redacted>
---
drivers/tty/serial/omap-serial.c | 205 +++++++++++++++++++--------------------
1 file changed, 101 insertions(+), 104 deletions(-)
@@ -196,74 +196,6 @@ static void serial_omap_stop_rx(struct uart_port *port)pm_runtime_put_autosuspend(up->dev);}-staticinlinevoidreceive_chars(structuart_omap_port*up,-unsignedint*status)-{-structtty_struct*tty=up->port.state->port.tty;-unsignedintflag,lsr=*status;-unsignedcharch=0;-intmax_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)){-/*-*Forstatisticsonly-*/-if(lsr&UART_LSR_BI){-lsr&=~(UART_LSR_FE|UART_LSR_PE);-up->port.icount.brk++;-/*-*WedotheSysRQandSAKchecking-*herebecauseotherwisethebreak-*maygetmaskedbyignore_status_mask-*orread_status_mask.-*/-if(uart_handle_break(&up->port))-gotoignore_char;-}elseif(lsr&UART_LSR_PE){-up->port.icount.parity++;-}elseif(lsr&UART_LSR_FE){-up->port.icount.frame++;-}--if(lsr&UART_LSR_OE)-up->port.icount.overrun++;--/*-*Maskoffconditionswhichshouldbeignored.-*/-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;-elseif(lsr&UART_LSR_PE)-flag=TTY_PARITY;-elseif(lsr&UART_LSR_FE)-flag=TTY_FRAME;-}--if(uart_handle_sysrq_char(&up->port,ch))-gotoignore_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);-}-staticvoidtransmit_chars(structuart_omap_port*up){structcirc_buf*xmit=&up->port.state->xmit;
@@ -342,6 +274,68 @@ static unsigned int check_modem_status(struct uart_omap_port *up)returnstatus;}+staticvoidserial_omap_rlsi(structuart_omap_port*up,unsignedintlsr)+{+unsignedintflag;++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++;+/*+*WedotheSysRQandSAKchecking+*herebecauseotherwisethebreak+*maygetmaskedbyignore_status_mask+*orread_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);+}++staticvoidserial_omap_rdi(structuart_omap_port*up,unsignedintlsr)+{+unsignedcharch=0;+unsignedintflag;++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()-Thishandlestheinterruptfromoneport*@irq:uartportirqnumber
@@ -350,54 +344,57 @@ static unsigned int check_modem_status(struct uart_omap_port *up)staticinlineirqreturn_tserial_omap_irq(intirq,void*dev_id){structuart_omap_port*up=dev_id;+structtty_struct*tty=up->port.state->port.tty;unsignedintiir,lsr;unsignedinttype;unsignedlongflags;irqreturn_tret=IRQ_NONE;+intmax_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)-gotoout;-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){-caseUART_IIR_MSI:-check_modem_status(up);-break;-caseUART_IIR_THRI:-if(lsr&UART_LSR_THRE)-transmit_chars(up);-break;-caseUART_IIR_RDI:-if(lsr&UART_LSR_DR)-receive_chars(up,&lsr);-break;-caseUART_IIR_RLSI:-if(lsr&UART_LSR_BRK_ERROR_BITS)-receive_chars(up,&lsr);-break;-caseUART_IIR_RX_TIMEOUT:-receive_chars(up,&lsr);-break;-caseUART_IIR_CTS_RTS_DSR:-iir=serial_in(up,UART_IIR);-gotoagain;-caseUART_IIR_XOFF:-/* FALLTHROUGH */-default:-break;-}+/* extract IRQ type from IIR register */+type=iir&0x3e;++switch(type){+caseUART_IIR_MSI:+check_modem_status(up);+break;+caseUART_IIR_THRI:+if(lsr&UART_LSR_THRE)+transmit_chars(up);+break;+caseUART_IIR_RX_TIMEOUT:+/* FALLTHROUGH */+caseUART_IIR_RDI:+serial_omap_rdi(up,lsr);+break;+caseUART_IIR_RLSI:+serial_omap_rlsi(up,lsr);+break;+caseUART_IIR_CTS_RTS_DSR:+/* simply try again */+break;+caseUART_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;
From: Felipe Balbi <hidden> Date: 2012-09-06 12:50:37
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 <redacted>
Acked-by: Santosh Shilimkar <redacted>
Signed-off-by: Felipe Balbi <redacted>
---
drivers/tty/serial/omap-serial.c | 33 ++++++++++++++++++++++-----------
1 file changed, 22 insertions(+), 11 deletions(-)
From: Felipe Balbi <hidden> Date: 2012-09-06 12:50:46
before removing the driver, let's make sure
to force device into a suspended state in order
to conserve power.
Tested-by: Shubhrajyoti D <redacted>
Acked-by: Santosh Shilimkar <redacted>
Signed-off-by: Felipe Balbi <redacted>
---
drivers/tty/serial/omap-serial.c | 1 +
1 file changed, 1 insertion(+)
From: Felipe Balbi <hidden> Date: 2012-09-06 12:50:48
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 <redacted>
Acked-by: Santosh Shilimkar <redacted>
Signed-off-by: Felipe Balbi <redacted>
---
drivers/tty/serial/omap-serial.c | 9 +++------
1 file changed, 3 insertions(+), 6 deletions(-)
From: Felipe Balbi <hidden> Date: 2012-09-06 12:50:52
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 <redacted>
Signed-off-by: Ruchika Kharwar <redacted>
Signed-off-by: Felipe Balbi <redacted>
---
drivers/tty/serial/omap-serial.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
From: Felipe Balbi <hidden> Date: 2012-09-06 12:50:59
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 <redacted>
Signed-off-by: Felipe Balbi <redacted>
---
drivers/tty/serial/omap-serial.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
From: Felipe Balbi <hidden> Date: 2012-09-06 12:51:08
From: Ruchika Kharwar <redacted>
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 <redacted>
Signed-off-by: Ruchika Kharwar <redacted>
Signed-off-by: Pavan Savoy <redacted>
Signed-off-by: Vijay Badawadagi <redacted>
Signed-off-by: Felipe Balbi <redacted>
---
drivers/tty/serial/omap-serial.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
From: Felipe Balbi <hidden> Date: 2012-09-06 12:51:13
From: Vikram Pandita <redacted>
Software flow control register bits were not defined correctly.
Also clarify the IXON and IXOFF logic to reflect what userspace wants.
Cc: stable at vger.kernel.org
Tested-by: Shubhrajyoti D <redacted>
Signed-off-by: Vikram Pandita <redacted>
Signed-off-by: Shubhrajyoti D <redacted>
Acked-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Felipe Balbi <redacted>
---
arch/arm/plat-omap/include/plat/omap-serial.h | 4 ++--
drivers/tty/serial/omap-serial.c | 12 ++++++------
2 files changed, 8 insertions(+), 8 deletions(-)
From: Felipe Balbi <hidden> Date: 2012-09-06 12:51:17
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 <redacted>
Acked-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Felipe Balbi <redacted>
---
arch/arm/plat-omap/include/plat/omap-serial.h | 37 --------------------------
drivers/tty/serial/omap-serial.c | 38 +++++++++++++++++++++++++++
2 files changed, 38 insertions(+), 37 deletions(-)
From: Felipe Balbi <hidden> Date: 2012-09-06 12:52:07
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 <redacted>
Signed-off-by: Felipe Balbi <redacted>
---
drivers/tty/serial/omap-serial.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
From: Felipe Balbi <hidden> Date: 2012-09-06 12:52:37
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 <redacted>
Signed-off-by: Felipe Balbi <redacted>
---
drivers/tty/serial/omap-serial.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
From: Felipe Balbi <hidden> Date: 2012-09-06 12:52:58
This has been missing from OMAP UART driver
for quite a while and it's simple enough
to implement it.
Tested-by: Shubhrajyoti D <redacted>
Signed-off-by: Felipe Balbi <redacted>
---
drivers/tty/serial/omap-serial.c | 10 ++++++++++
1 file changed, 10 insertions(+)
From: Felipe Balbi <hidden> Date: 2012-09-06 12:54:12
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 <redacted>
Signed-off-by: Felipe Balbi <redacted>
---
drivers/tty/serial/omap-serial.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
From: Felipe Balbi <hidden> Date: 2012-09-06 12:54:42
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 <redacted>
Acked-by: Santosh Shilimkar <redacted>
Signed-off-by: Felipe Balbi <redacted>
---
drivers/tty/serial/omap-serial.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
From: Felipe Balbi <hidden> Date: 2012-09-06 12:55:10
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 <redacted>
Acked-by: Santosh Shilimkar <redacted>
Signed-off-by: Felipe Balbi <redacted>
---
drivers/tty/serial/omap-serial.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
From: Felipe Balbi <hidden> Date: 2012-09-06 12:55:56
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 <redacted>
Acked-by: Santosh Shilimkar <redacted>
Signed-off-by: Felipe Balbi <redacted>
---
drivers/tty/serial/omap-serial.c | 51 ++++++++++++++++++++++++++++++----------
1 file changed, 38 insertions(+), 13 deletions(-)
From: Felipe Balbi <hidden> Date: 2012-09-06 12:56:17
The current support is known to be broken and
a later patch will come re-adding it using
dma engine API.
Tested-by: Shubhrajyoti D <redacted>
Acked-by: Santosh Shilimkar <redacted>
Signed-off-by: Felipe Balbi <redacted>
---
drivers/tty/serial/omap-serial.c | 330 ++-------------------------------------
1 file changed, 12 insertions(+), 318 deletions(-)
@@ -616,20 +516,6 @@ static int serial_omap_startup(struct uart_port *port)spin_unlock_irqrestore(&up->port.lock,flags);up->msr_saved_flags=0;-if(up->use_dma){-free_page((unsignedlong)up->port.state->xmit.buf);-up->port.state->xmit.buf=dma_alloc_coherent(NULL,-UART_XMIT_SIZE,-(dma_addr_t*)&(up->uart_dma.tx_buf_dma_phys),-0);-init_timer(&(up->uart_dma.rx_timer));-up->uart_dma.rx_timer.function=serial_omap_rxdma_poll;-up->uart_dma.rx_timer.data=up->port.line;-/* Currently the buffer size is 4KB. Can increase it */-up->uart_dma.rx_buf=dma_alloc_coherent(NULL,-up->uart_dma.rx_buf_size,-(dma_addr_t*)&(up->uart_dma.rx_buf_dma_phys),0);-}/**Finally,enableinterrupts.Note:Modemstatusinterrupts*aresetviaset_termios(),whichwillbeoccurringimminently
From: Felipe Balbi <hidden> Date: 2012-09-06 12:56:46
The driver doesn't need to know about its platform_device.
Everything the driver needs can be done through the
struct device pointer. In case we need to use the
OMAP-specific PM function pointers, those can make
sure to find the device's platform_device pointer
so they can find the struct omap_device through
pdev->archdata field.
Tested-by: Shubhrajyoti D <redacted>
Acked-by: Santosh Shilimkar <redacted>
Signed-off-by: Felipe Balbi <redacted>
---
arch/arm/mach-omap2/serial.c | 15 ++--
arch/arm/plat-omap/include/plat/omap-serial.h | 10 +--
drivers/tty/serial/omap-serial.c | 124 +++++++++++++-------------
3 files changed, 76 insertions(+), 73 deletions(-)
@@ -585,7 +585,7 @@ static int serial_omap_startup(struct uart_port *port)dev_dbg(up->port.dev,"serial_omap_startup+%d\n",up->port.line);-pm_runtime_get_sync(&up->pdev->dev);+pm_runtime_get_sync(up->dev);/**CleartheFIFObuffersanddisablethem.*(theywillbereenabledinset_termios())
@@ -641,8 +641,8 @@ static int serial_omap_startup(struct uart_port *port)/* Enable module level wake up */serial_out(up,UART_OMAP_WER,OMAP_UART_WER_MOD_WKUP);-pm_runtime_mark_last_busy(&up->pdev->dev);-pm_runtime_put_autosuspend(&up->pdev->dev);+pm_runtime_mark_last_busy(up->dev);+pm_runtime_put_autosuspend(up->dev);up->port_activity=jiffies;return0;}
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
From: Felipe Balbi <hidden> Date: 2012-09-06 17:29:58
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:
quoted
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
From: Paul Walmsley <paul@pwsan.com> Date: 2012-09-06 21:37:27
Hi
On Thu, 6 Sep 2012, 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.
Was curious to know if these have been PM-tested, and if so, under what
configurations?
- Paul
From: Paul Walmsley <paul@pwsan.com> Date: 2012-09-11 22:02:52
Hi Felipe
Just tested these OMAP serial changes at commit
e36851d0fa94b0f7802b3cc80406dbd3ef4f2f16 ("serial: omap: fix compile
breakage"). There's good news and bad news...
The good news is that after applying this series, the 'OMAP4 UART garbage
on long transmit buffers when PM is enabled' bug:
http://www.pwsan.com/omap/testlogs/test_v3.6-rc5/20120908202511/pm/4430es2panda/4430es2panda_log.txt
... goes away. (Unclear if it's because the underlying bug was fixed, or
if unrelated changes are masking it.) Not sure what caused the problem to
go away exactly, but it's one of the changes between d37c6ceb and bf63a08.
So that's good!
The bad news is that N800 no longer boots -- or the UART dies during
serial init:
http://www.pwsan.com/omap/testlogs/test_tty_next_e36851d0/20120910020323/boot/2420n800/2420n800_log.txt
The problem doesn't seem to affect the 2430SDP.
Could you put together a patch to fix N800?
regards
- Paul
From: Felipe Balbi <hidden> Date: 2012-09-12 06:27:42
Hi,
On Tue, Sep 11, 2012 at 10:02:48PM +0000, Paul Walmsley wrote:
Hi Felipe
Just tested these OMAP serial changes at commit
e36851d0fa94b0f7802b3cc80406dbd3ef4f2f16 ("serial: omap: fix compile
breakage"). There's good news and bad news...
The good news is that after applying this series, the 'OMAP4 UART garbage
on long transmit buffers when PM is enabled' bug:
http://www.pwsan.com/omap/testlogs/test_v3.6-rc5/20120908202511/pm/4430es2panda/4430es2panda_log.txt
... goes away. (Unclear if it's because the underlying bug was fixed, or
if unrelated changes are masking it.) Not sure what caused the problem to
go away exactly, but it's one of the changes between d37c6ceb and bf63a08.
So that's good!
I'd point the finger at sticking to put_autosuspend() as that would give
HW enough time to actually unload all bytes from its FIFO through the
UART lines. can you check if forcing the autosuspend_delay to -1
triggers the issue again ? If it does, it's some help from autosuspend,
which would mean we still have the problem and needs to be properly
fixed.
Bisected this down. It's this one that causes the problem on N800:
commit 93220dcc3052182e7156c09655ad1316055564b9
Author: Felipe Balbi [off-list ref]
Date: Thu Sep 6 15:45:27 2012 +0300
serial: omap: set dev->drvdata before enabling pm_runtime
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 [off-list ref]
Acked-by: Santosh Shilimkar [off-list ref]
Signed-off-by: Felipe Balbi [off-list ref]
Signed-off-by: Greg Kroah-Hartman [off-list ref]
- Paul
Bisected this down. It's this one that causes the problem on N800:
commit 93220dcc3052182e7156c09655ad1316055564b9
Author: Felipe Balbi [off-list ref]
Date: Thu Sep 6 15:45:27 2012 +0300
serial: omap: set dev->drvdata before enabling pm_runtime
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 [off-list ref]
Acked-by: Santosh Shilimkar [off-list ref]
Signed-off-by: Felipe Balbi [off-list ref]
Signed-off-by: Greg Kroah-Hartman [off-list ref]
Interesting. That simply moves platform_set_drvdata() to a saner
location... The only way for this to cause problems is if we're trying
to restore a context which was never saved.
Is there a way to prevent runtime_resume() to be called during probe()
if I know the HW is already enabled ? Maybe with
pm_runtime_set_active() ?
--
balbi
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20120916/4687d1c4/attachment.sig>