* [PATCH 1/2] serial: sh-sci: Don't enable/disable port from within break timer
2013-11-28 17:11 [PATCH 0/2] serial: sh-sci: Prepare for CCF migration Laurent Pinchart
@ 2013-11-28 17:11 ` Laurent Pinchart
2013-11-28 17:11 ` [PATCH 2/2] serial: sh-sci: Convert to clk_prepare/unprepare Laurent Pinchart
` (2 subsequent siblings)
3 siblings, 0 replies; 7+ messages in thread
From: Laurent Pinchart @ 2013-11-28 17:11 UTC (permalink / raw)
To: linux-sh; +Cc: linux-serial, Greg Kroah-Hartman, Simon Horman
The break timer accesses hardware registers and thus requires the port
to be enabled. It currently ensures this by enabling the port at the
beginning of the timer handler, and disabling it at the end. However,
the enable/disable operations call the runtime PM sync functions, which
are not allowed in atomic context. The current situation is thus broken.
This change relies on non-atomic code to enable/disable the port. The
break timer will only be started from the IRQ handler, which already
runs with the port enabled. We just need to ensure that the port won't
be disabled with the timer running, and that's easily done by just
cancelling the timer in the port disable function.
Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
---
drivers/tty/serial/sh-sci.c | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/drivers/tty/serial/sh-sci.c b/drivers/tty/serial/sh-sci.c
index 28f8b7e..decaf24 100644
--- a/drivers/tty/serial/sh-sci.c
+++ b/drivers/tty/serial/sh-sci.c
@@ -450,6 +450,14 @@ static void sci_port_disable(struct sci_port *sci_port)
if (!sci_port->port.dev)
return;
+ /* Cancel the break timer to ensure that the timer handler will not try
+ * to access the hardware with clocks and power disabled. Reset the
+ * break flag to make the break debouncing state machine ready for the
+ * next break.
+ */
+ del_timer_sync(&sci_port->break_timer);
+ sci_port->break_flag = 0;
+
clk_disable(sci_port->fclk);
clk_disable(sci_port->iclk);
@@ -752,8 +760,6 @@ static void sci_break_timer(unsigned long data)
{
struct sci_port *port = (struct sci_port *)data;
- sci_port_enable(port);
-
if (sci_rxd_in(&port->port) == 0) {
port->break_flag = 1;
sci_schedule_break_timer(port);
@@ -763,8 +769,6 @@ static void sci_break_timer(unsigned long data)
sci_schedule_break_timer(port);
} else
port->break_flag = 0;
-
- sci_port_disable(port);
}
static int sci_handle_errors(struct uart_port *port)
--
1.8.3.2
^ permalink raw reply related [flat|nested] 7+ messages in thread* [PATCH 2/2] serial: sh-sci: Convert to clk_prepare/unprepare
2013-11-28 17:11 [PATCH 0/2] serial: sh-sci: Prepare for CCF migration Laurent Pinchart
2013-11-28 17:11 ` [PATCH 1/2] serial: sh-sci: Don't enable/disable port from within break timer Laurent Pinchart
@ 2013-11-28 17:11 ` Laurent Pinchart
2013-11-29 2:15 ` [PATCH 0/2] serial: sh-sci: Prepare for CCF migration Magnus Damm
2013-12-02 13:36 ` Laurent Pinchart
3 siblings, 0 replies; 7+ messages in thread
From: Laurent Pinchart @ 2013-11-28 17:11 UTC (permalink / raw)
To: linux-sh; +Cc: linux-serial, Greg Kroah-Hartman, Simon Horman
Turn clk_enable() and clk_disable() calls into clk_prepare_enable() and
clk_disable_unprepare() to get ready for the migration to the common
clock framework.
Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
---
drivers/tty/serial/sh-sci.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/tty/serial/sh-sci.c b/drivers/tty/serial/sh-sci.c
index decaf24..852cc19 100644
--- a/drivers/tty/serial/sh-sci.c
+++ b/drivers/tty/serial/sh-sci.c
@@ -440,9 +440,9 @@ static void sci_port_enable(struct sci_port *sci_port)
pm_runtime_get_sync(sci_port->port.dev);
- clk_enable(sci_port->iclk);
+ clk_prepare_enable(sci_port->iclk);
sci_port->port.uartclk = clk_get_rate(sci_port->iclk);
- clk_enable(sci_port->fclk);
+ clk_prepare_enable(sci_port->fclk);
}
static void sci_port_disable(struct sci_port *sci_port)
@@ -458,8 +458,8 @@ static void sci_port_disable(struct sci_port *sci_port)
del_timer_sync(&sci_port->break_timer);
sci_port->break_flag = 0;
- clk_disable(sci_port->fclk);
- clk_disable(sci_port->iclk);
+ clk_disable_unprepare(sci_port->fclk);
+ clk_disable_unprepare(sci_port->iclk);
pm_runtime_put_sync(sci_port->port.dev);
}
--
1.8.3.2
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH 0/2] serial: sh-sci: Prepare for CCF migration
2013-11-28 17:11 [PATCH 0/2] serial: sh-sci: Prepare for CCF migration Laurent Pinchart
2013-11-28 17:11 ` [PATCH 1/2] serial: sh-sci: Don't enable/disable port from within break timer Laurent Pinchart
2013-11-28 17:11 ` [PATCH 2/2] serial: sh-sci: Convert to clk_prepare/unprepare Laurent Pinchart
@ 2013-11-29 2:15 ` Magnus Damm
2013-12-02 13:36 ` Laurent Pinchart
3 siblings, 0 replies; 7+ messages in thread
From: Magnus Damm @ 2013-11-29 2:15 UTC (permalink / raw)
To: Laurent Pinchart; +Cc: SH-Linux, linux-serial, Greg Kroah-Hartman, Simon Horman
On Fri, Nov 29, 2013 at 2:11 AM, Laurent Pinchart
<laurent.pinchart+renesas@ideasonboard.com> wrote:
> Hello,
>
> This patch set prepares the driver to CCF migration by replacing clk_enable()
> and clk_disable() by clk_prepare_enable() and clk_disable_unprepare()
> respectively (2/2). In order to do so it first ensures that the clk_enable()
> and clk_disable() calls will only take place from non-atomic context (1/2).
>
> Greg, these patches are dependencies for a bunch of ARM patches that will go
> through Simon's tree. Would you be fine if Simon merged all sh-sci patches
> through his tree for v3.14 ?
>
> Laurent Pinchart (2):
> serial: sh-sci: Don't enable/disable port from within break timer
> serial: sh-sci: Convert to clk_prepare/unprepare
>
> drivers/tty/serial/sh-sci.c | 20 ++++++++++++--------
> 1 file changed, 12 insertions(+), 8 deletions(-)
Looking good, thanks for hacking this up! For this series:
Acked-by: Magnus Damm <damm@opensource.se>
Cheers,
/ magnus
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 0/2] serial: sh-sci: Prepare for CCF migration
2013-11-28 17:11 [PATCH 0/2] serial: sh-sci: Prepare for CCF migration Laurent Pinchart
` (2 preceding siblings ...)
2013-11-29 2:15 ` [PATCH 0/2] serial: sh-sci: Prepare for CCF migration Magnus Damm
@ 2013-12-02 13:36 ` Laurent Pinchart
2013-12-03 18:43 ` Greg Kroah-Hartman
3 siblings, 1 reply; 7+ messages in thread
From: Laurent Pinchart @ 2013-12-02 13:36 UTC (permalink / raw)
To: Greg Kroah-Hartman; +Cc: linux-sh, linux-serial, Simon Horman
Hi Greg,
On Thursday 28 November 2013 18:11:44 Laurent Pinchart wrote:
> Hello,
>
> This patch set prepares the driver to CCF migration by replacing
> clk_enable() and clk_disable() by clk_prepare_enable() and
> clk_disable_unprepare() respectively (2/2). In order to do so it first
> ensures that the clk_enable() and clk_disable() calls will only take place
> from non-atomic context (1/2).
>
> Greg, these patches are dependencies for a bunch of ARM patches that will go
> through Simon's tree. Would you be fine if Simon merged all sh-sci patches
> through his tree for v3.14 ?
Ping ?
> Laurent Pinchart (2):
> serial: sh-sci: Don't enable/disable port from within break timer
> serial: sh-sci: Convert to clk_prepare/unprepare
>
> drivers/tty/serial/sh-sci.c | 20 ++++++++++++--------
> 1 file changed, 12 insertions(+), 8 deletions(-)
--
Regards,
Laurent Pinchart
^ permalink raw reply [flat|nested] 7+ messages in thread* Re: [PATCH 0/2] serial: sh-sci: Prepare for CCF migration
2013-12-02 13:36 ` Laurent Pinchart
@ 2013-12-03 18:43 ` Greg Kroah-Hartman
2013-12-14 1:00 ` Simon Horman
0 siblings, 1 reply; 7+ messages in thread
From: Greg Kroah-Hartman @ 2013-12-03 18:43 UTC (permalink / raw)
To: Laurent Pinchart; +Cc: linux-sh, linux-serial, Simon Horman
On Mon, Dec 02, 2013 at 02:36:32PM +0100, Laurent Pinchart wrote:
> Hi Greg,
>
> On Thursday 28 November 2013 18:11:44 Laurent Pinchart wrote:
> > Hello,
> >
> > This patch set prepares the driver to CCF migration by replacing
> > clk_enable() and clk_disable() by clk_prepare_enable() and
> > clk_disable_unprepare() respectively (2/2). In order to do so it first
> > ensures that the clk_enable() and clk_disable() calls will only take place
> > from non-atomic context (1/2).
> >
> > Greg, these patches are dependencies for a bunch of ARM patches that will go
> > through Simon's tree. Would you be fine if Simon merged all sh-sci patches
> > through his tree for v3.14 ?
>
> Ping ?
Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 0/2] serial: sh-sci: Prepare for CCF migration
2013-12-03 18:43 ` Greg Kroah-Hartman
@ 2013-12-14 1:00 ` Simon Horman
0 siblings, 0 replies; 7+ messages in thread
From: Simon Horman @ 2013-12-14 1:00 UTC (permalink / raw)
To: Greg Kroah-Hartman; +Cc: Laurent Pinchart, linux-sh, linux-serial
On Tue, Dec 03, 2013 at 10:43:46AM -0800, Greg Kroah-Hartman wrote:
> On Mon, Dec 02, 2013 at 02:36:32PM +0100, Laurent Pinchart wrote:
> > Hi Greg,
> >
> > On Thursday 28 November 2013 18:11:44 Laurent Pinchart wrote:
> > > Hello,
> > >
> > > This patch set prepares the driver to CCF migration by replacing
> > > clk_enable() and clk_disable() by clk_prepare_enable() and
> > > clk_disable_unprepare() respectively (2/2). In order to do so it first
> > > ensures that the clk_enable() and clk_disable() calls will only take place
> > > from non-atomic context (1/2).
> > >
> > > Greg, these patches are dependencies for a bunch of ARM patches that will go
> > > through Simon's tree. Would you be fine if Simon merged all sh-sci patches
> > > through his tree for v3.14 ?
> >
> > Ping ?
>
> Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Thanks, I will (finally) queue these up.
^ permalink raw reply [flat|nested] 7+ messages in thread