* [PATCH] tty: serial: msm: Remove duplicate handling of clocks
@ 2016-05-11 9:00 Pramod Gurav
2016-05-12 0:18 ` Stephen Boyd
2016-05-16 8:31 ` Pramod Gurav
0 siblings, 2 replies; 5+ messages in thread
From: Pramod Gurav @ 2016-05-11 9:00 UTC (permalink / raw)
To: sboyd, andy.gross, gregkh, davidb, jslaby
Cc: linux-arm-msm, linux-serial, linux-kernel, Pramod Gurav
msm_serial driver provides a .pm callback to the serial core to enable
and disable clock resource in suspend/resume path. This function is
also called before msm_startup. msm_startup also enables the clocks which
is not needed. Hence remove the duplcate clock operation from msm_startup
and msm_shutdown. Same is done in console setup to get rid of duplicate
clock operation.
Tested on DB410C console.
Signed-off-by: Pramod Gurav <pramod.gurav@linaro.org>
---
drivers/tty/serial/msm_serial.c | 15 ++-------------
1 file changed, 2 insertions(+), 13 deletions(-)
diff --git a/drivers/tty/serial/msm_serial.c b/drivers/tty/serial/msm_serial.c
index dcde955..73c3217 100644
--- a/drivers/tty/serial/msm_serial.c
+++ b/drivers/tty/serial/msm_serial.c
@@ -959,15 +959,6 @@ static int msm_set_baud_rate(struct uart_port *port, unsigned int baud,
return baud;
}
-static void msm_init_clock(struct uart_port *port)
-{
- struct msm_port *msm_port = UART_TO_MSM(port);
-
- clk_prepare_enable(msm_port->clk);
- clk_prepare_enable(msm_port->pclk);
- msm_serial_set_mnd_regs(port);
-}
-
static int msm_startup(struct uart_port *port)
{
struct msm_port *msm_port = UART_TO_MSM(port);
@@ -982,7 +973,7 @@ static int msm_startup(struct uart_port *port)
if (unlikely(ret))
return ret;
- msm_init_clock(port);
+ msm_serial_set_mnd_regs(port);
if (likely(port->fifosize > 12))
rfr_level = port->fifosize - 12;
@@ -1021,8 +1012,6 @@ static void msm_shutdown(struct uart_port *port)
if (msm_port->is_uartdm)
msm_release_dma(msm_port);
- clk_disable_unprepare(msm_port->clk);
-
free_irq(port->irq, port);
}
@@ -1451,7 +1440,7 @@ static int __init msm_console_setup(struct console *co, char *options)
if (unlikely(!port->membase))
return -ENXIO;
- msm_init_clock(port);
+ msm_serial_set_mnd_regs(port);
if (options)
uart_parse_options(options, &baud, &parity, &bits, &flow);
--
1.8.2.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] tty: serial: msm: Remove duplicate handling of clocks
2016-05-11 9:00 [PATCH] tty: serial: msm: Remove duplicate handling of clocks Pramod Gurav
@ 2016-05-12 0:18 ` Stephen Boyd
2016-05-12 4:38 ` Pramod Gurav
2016-05-16 8:31 ` Pramod Gurav
1 sibling, 1 reply; 5+ messages in thread
From: Stephen Boyd @ 2016-05-12 0:18 UTC (permalink / raw)
To: Pramod Gurav
Cc: andy.gross, gregkh, davidb, jslaby, linux-arm-msm, linux-serial,
linux-kernel
On 05/11, Pramod Gurav wrote:
> msm_serial driver provides a .pm callback to the serial core to enable
> and disable clock resource in suspend/resume path. This function is
> also called before msm_startup. msm_startup also enables the clocks which
> is not needed. Hence remove the duplcate clock operation from msm_startup
> and msm_shutdown. Same is done in console setup to get rid of duplicate
> clock operation.
I had to check and I see that for the console case we call the
.pm callback and don't turn it off until suspend/resume paths
(would be nice to add suspend/resume to this driver too). I
guess that's what you meant by this last sentence?
>
> Tested on DB410C console.
>
> Signed-off-by: Pramod Gurav <pramod.gurav@linaro.org>
Reviewed-by: Stephen Boyd <sboyd@codeaurora.org>
--
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] tty: serial: msm: Remove duplicate handling of clocks
2016-05-12 0:18 ` Stephen Boyd
@ 2016-05-12 4:38 ` Pramod Gurav
0 siblings, 0 replies; 5+ messages in thread
From: Pramod Gurav @ 2016-05-12 4:38 UTC (permalink / raw)
To: Stephen Boyd
Cc: Andy Gross, gregkh, David Brown, jslaby, linux-arm-msm,
linux-serial, linux-kernel
On 12 May 2016 at 05:48, Stephen Boyd <sboyd@codeaurora.org> wrote:
> On 05/11, Pramod Gurav wrote:
>> msm_serial driver provides a .pm callback to the serial core to enable
>> and disable clock resource in suspend/resume path. This function is
>> also called before msm_startup. msm_startup also enables the clocks which
>> is not needed. Hence remove the duplcate clock operation from msm_startup
>> and msm_shutdown. Same is done in console setup to get rid of duplicate
>> clock operation.
>
> I had to check and I see that for the console case we call the
> .pm callback and don't turn it off until suspend/resume paths
> (would be nice to add suspend/resume to this driver too). I
> guess that's what you meant by this last sentence?
>
Yes the clocks would be kept ON if its console.
I am working to add suspend/resume and runtime pm as it will not
happen by default through core.
>>
>> Tested on DB410C console.
>>
>> Signed-off-by: Pramod Gurav <pramod.gurav@linaro.org>
>
> Reviewed-by: Stephen Boyd <sboyd@codeaurora.org>
>
> --
> Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
> a Linux Foundation Collaborative Project
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] tty: serial: msm: Remove duplicate handling of clocks
2016-05-11 9:00 [PATCH] tty: serial: msm: Remove duplicate handling of clocks Pramod Gurav
2016-05-12 0:18 ` Stephen Boyd
@ 2016-05-16 8:31 ` Pramod Gurav
2016-05-25 23:07 ` Stephen Boyd
1 sibling, 1 reply; 5+ messages in thread
From: Pramod Gurav @ 2016-05-16 8:31 UTC (permalink / raw)
To: Stephen Boyd, Andy Gross, gregkh, David Brown, jslaby
Cc: linux-arm-msm, linux-serial, linux-kernel, Pramod Gurav
On 11 May 2016 at 14:30, Pramod Gurav <pramod.gurav@linaro.org> wrote:
> msm_serial driver provides a .pm callback to the serial core to enable
> and disable clock resource in suspend/resume path. This function is
> also called before msm_startup. msm_startup also enables the clocks which
> is not needed. Hence remove the duplcate clock operation from msm_startup
> and msm_shutdown. Same is done in console setup to get rid of duplicate
> clock operation.
>
> Tested on DB410C console.
>
> Signed-off-by: Pramod Gurav <pramod.gurav@linaro.org>
> ---
> drivers/tty/serial/msm_serial.c | 15 ++-------------
> 1 file changed, 2 insertions(+), 13 deletions(-)
>
> diff --git a/drivers/tty/serial/msm_serial.c b/drivers/tty/serial/msm_serial.c
> index dcde955..73c3217 100644
> --- a/drivers/tty/serial/msm_serial.c
> +++ b/drivers/tty/serial/msm_serial.c
> @@ -959,15 +959,6 @@ static int msm_set_baud_rate(struct uart_port *port, unsigned int baud,
> return baud;
> }
>
> -static void msm_init_clock(struct uart_port *port)
> -{
> - struct msm_port *msm_port = UART_TO_MSM(port);
> -
> - clk_prepare_enable(msm_port->clk);
> - clk_prepare_enable(msm_port->pclk);
> - msm_serial_set_mnd_regs(port);
> -}
> -
> static int msm_startup(struct uart_port *port)
> {
> struct msm_port *msm_port = UART_TO_MSM(port);
> @@ -982,7 +973,7 @@ static int msm_startup(struct uart_port *port)
> if (unlikely(ret))
> return ret;
>
> - msm_init_clock(port);
> + msm_serial_set_mnd_regs(port);
Further testing with another UART port made me realize that serial
port does not work after disabling msm_port->clk clock. The RX data
part will be affected.
Confirmed from manual that this clock should never be turned of to
avoid loss of incoming data. Sorry for the noise.
>
> if (likely(port->fifosize > 12))
> rfr_level = port->fifosize - 12;
> @@ -1021,8 +1012,6 @@ static void msm_shutdown(struct uart_port *port)
> if (msm_port->is_uartdm)
> msm_release_dma(msm_port);
>
> - clk_disable_unprepare(msm_port->clk);
> -
> free_irq(port->irq, port);
> }
>
> @@ -1451,7 +1440,7 @@ static int __init msm_console_setup(struct console *co, char *options)
> if (unlikely(!port->membase))
> return -ENXIO;
>
> - msm_init_clock(port);
> + msm_serial_set_mnd_regs(port);
>
> if (options)
> uart_parse_options(options, &baud, &parity, &bits, &flow);
> --
> 1.8.2.1
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] tty: serial: msm: Remove duplicate handling of clocks
2016-05-16 8:31 ` Pramod Gurav
@ 2016-05-25 23:07 ` Stephen Boyd
0 siblings, 0 replies; 5+ messages in thread
From: Stephen Boyd @ 2016-05-25 23:07 UTC (permalink / raw)
To: Pramod Gurav
Cc: Andy Gross, gregkh, David Brown, jslaby, linux-arm-msm,
linux-serial, linux-kernel
On 05/16, Pramod Gurav wrote:
> On 11 May 2016 at 14:30, Pramod Gurav <pramod.gurav@linaro.org> wrote:
> > msm_serial driver provides a .pm callback to the serial core to enable
> > and disable clock resource in suspend/resume path. This function is
> > also called before msm_startup. msm_startup also enables the clocks which
> > is not needed. Hence remove the duplcate clock operation from msm_startup
> > and msm_shutdown. Same is done in console setup to get rid of duplicate
> > clock operation.
> >
> > Tested on DB410C console.
> >
> > Signed-off-by: Pramod Gurav <pramod.gurav@linaro.org>
> > ---
> > drivers/tty/serial/msm_serial.c | 15 ++-------------
> > 1 file changed, 2 insertions(+), 13 deletions(-)
> >
> > diff --git a/drivers/tty/serial/msm_serial.c b/drivers/tty/serial/msm_serial.c
> > index dcde955..73c3217 100644
> > --- a/drivers/tty/serial/msm_serial.c
> > +++ b/drivers/tty/serial/msm_serial.c
> > @@ -959,15 +959,6 @@ static int msm_set_baud_rate(struct uart_port *port, unsigned int baud,
> > return baud;
> > }
> >
> > -static void msm_init_clock(struct uart_port *port)
> > -{
> > - struct msm_port *msm_port = UART_TO_MSM(port);
> > -
> > - clk_prepare_enable(msm_port->clk);
> > - clk_prepare_enable(msm_port->pclk);
> > - msm_serial_set_mnd_regs(port);
> > -}
> > -
> > static int msm_startup(struct uart_port *port)
> > {
> > struct msm_port *msm_port = UART_TO_MSM(port);
> > @@ -982,7 +973,7 @@ static int msm_startup(struct uart_port *port)
> > if (unlikely(ret))
> > return ret;
> >
> > - msm_init_clock(port);
> > + msm_serial_set_mnd_regs(port);
>
> Further testing with another UART port made me realize that serial
> port does not work after disabling msm_port->clk clock. The RX data
> part will be affected.
> Confirmed from manual that this clock should never be turned of to
> avoid loss of incoming data. Sorry for the noise.
>
Does that mean this patch shouldn't be applied? I hope that the
pm callback would do the right thing and be called when we expect
to be receiving data on the line.
--
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2016-05-25 23:07 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-05-11 9:00 [PATCH] tty: serial: msm: Remove duplicate handling of clocks Pramod Gurav
2016-05-12 0:18 ` Stephen Boyd
2016-05-12 4:38 ` Pramod Gurav
2016-05-16 8:31 ` Pramod Gurav
2016-05-25 23:07 ` Stephen Boyd
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).