linux-serial.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2, 0/3] tty/serial: meson_uart: add support for core clock handling
@ 2017-03-28  9:25 Helmut Klein
  2017-03-28  9:25 ` [PATCH v2, 3/3] tty/serial: meson_uart: add the core clock handling to the driver Helmut Klein
  0 siblings, 1 reply; 4+ messages in thread
From: Helmut Klein @ 2017-03-28  9:25 UTC (permalink / raw)
  Cc: devicetree, linux-kernel, Helmut Klein, linux-serial,
	linux-amlogic, linux-clk, linux-arm-kernel

To be able to use the three none AO uarts of the s905 SoCs (uart_A, uart_B
& uart_C), the core clock has to be enabled. (see chapter 22.3 of the
public s905 data sheet) At least the u-boot of my s905 based media player
(netxeon minimx) doesn't do this. so the driver must do it.

This patch set does:
- exposes the clock ids to the dtb
- adds documentation for the dt-bindings of meson_uart
- adds the core clock handling to the driver

The patchset is based on the branch master of the repository in [1]

Changes since v1
- use git to produce the patch set
- added the clock ids for uart_B and uart_C

None of the available s905 dts use uart_A actively. So there is no patch
for any of the existing dts files.

[1] git://git.kernel.org/pub/scm/linux/kernel/git/khilman/linux-amlogic.git

Helmut Klein (3):
  tty/serial: meson_uart: expose CLKID_UARTx
  tty/serial: meson_uart: add documentation for the dt-bindings
  tty/serial: meson_uart: add the core clock handling to the driver

 .../bindings/serial/amlogic,meson_uart.txt         | 25 ++++++++++++++++++++++
 drivers/clk/meson/gxbb.h                           |  6 +++---
 drivers/tty/serial/meson_uart.c                    | 10 +++++++++
 include/dt-bindings/clock/gxbb-clkc.h              |  3 +++
 4 files changed, 41 insertions(+), 3 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/serial/amlogic,meson_uart.txt

--
2.11.0

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH v2, 3/3] tty/serial: meson_uart: add the core clock handling to the driver
  2017-03-28  9:25 [PATCH v2, 0/3] tty/serial: meson_uart: add support for core clock handling Helmut Klein
@ 2017-03-28  9:25 ` Helmut Klein
  2017-03-28 19:16   ` Jerome Brunet
  0 siblings, 1 reply; 4+ messages in thread
From: Helmut Klein @ 2017-03-28  9:25 UTC (permalink / raw)
  To: gregkh, carlo, khilman
  Cc: linux-amlogic, Helmut Klein, linux-arm-kernel, linux-serial,
	linux-kernel

This patch gets the core clock as provided by the DT and enables it.
The code was taken from Amlogic's serial driver, and was tested on my
board.

Signed-off-by: Helmut Klein <hgkr.klein@gmail.com>
---
 drivers/tty/serial/meson_uart.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/drivers/tty/serial/meson_uart.c b/drivers/tty/serial/meson_uart.c
index 60f16795d16b..cb99112288eb 100644
--- a/drivers/tty/serial/meson_uart.c
+++ b/drivers/tty/serial/meson_uart.c
@@ -600,6 +600,7 @@ static int meson_uart_probe(struct platform_device *pdev)
 	struct resource *res_mem, *res_irq;
 	struct uart_port *port;
 	struct clk *clk;
+	struct clk *core_clk;
 	int ret = 0;

 	if (pdev->dev.of_node)
@@ -625,6 +626,15 @@ static int meson_uart_probe(struct platform_device *pdev)
 	if (!port)
 		return -ENOMEM;

+	core_clk = devm_clk_get(&pdev->dev, "core");
+	if (!IS_ERR(core_clk)) {
+		ret = clk_prepare_enable(core_clk);
+		if (ret) {
+			dev_err(&pdev->dev, "couldn't enable clkc\n");
+			return ret;
+		}
+	}
+
 	clk = clk_get(&pdev->dev, NULL);
 	if (IS_ERR(clk))
 		return PTR_ERR(clk);
--
2.11.0

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH v2, 3/3] tty/serial: meson_uart: add the core clock handling to the driver
  2017-03-28  9:25 ` [PATCH v2, 3/3] tty/serial: meson_uart: add the core clock handling to the driver Helmut Klein
@ 2017-03-28 19:16   ` Jerome Brunet
  2017-03-29  9:47     ` Helmut Klein
  0 siblings, 1 reply; 4+ messages in thread
From: Jerome Brunet @ 2017-03-28 19:16 UTC (permalink / raw)
  To: Helmut Klein, gregkh, carlo, khilman
  Cc: linux-amlogic, linux-serial, linux-arm-kernel, linux-kernel

On Tue, 2017-03-28 at 11:25 +0200, Helmut Klein wrote:
> This patch gets the core clock as provided by the DT and enables it.
> The code was taken from Amlogic's serial driver, and was tested on my
> board.
> 
> Signed-off-by: Helmut Klein <hgkr.klein@gmail.com>
> ---
>  drivers/tty/serial/meson_uart.c | 10 ++++++++++
>  1 file changed, 10 insertions(+)
> 
> diff --git a/drivers/tty/serial/meson_uart.c b/drivers/tty/serial/meson_uart.c
> index 60f16795d16b..cb99112288eb 100644
> --- a/drivers/tty/serial/meson_uart.c
> +++ b/drivers/tty/serial/meson_uart.c
> @@ -600,6 +600,7 @@ static int meson_uart_probe(struct platform_device *pdev)
>  	struct resource *res_mem, *res_irq;
>  	struct uart_port *port;
>  	struct clk *clk;
> +	struct clk *core_clk;
>  	int ret = 0;
> 
>  	if (pdev->dev.of_node)
> @@ -625,6 +626,15 @@ static int meson_uart_probe(struct platform_device *pdev)
>  	if (!port)
>  		return -ENOMEM;
> 
> +	core_clk = devm_clk_get(&pdev->dev, "core");
> +	if (!IS_ERR(core_clk)) {
> +		ret = clk_prepare_enable(core_clk);
> +		if (ret) {
> +			dev_err(&pdev->dev, "couldn't enable clkc\n");
> +			return ret;
> +		}
> +	}
> +
>  	clk = clk_get(&pdev->dev, NULL);
Now that you have 2 clocks, shouldn't this be named as well ?

>  	if (IS_ERR(clk))
>  		return PTR_ERR(clk);
> --
> 2.11.0
> 
> 
> _______________________________________________
> linux-amlogic mailing list
> linux-amlogic@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-amlogic

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v2, 3/3] tty/serial: meson_uart: add the core clock handling to the driver
  2017-03-28 19:16   ` Jerome Brunet
@ 2017-03-29  9:47     ` Helmut Klein
  0 siblings, 0 replies; 4+ messages in thread
From: Helmut Klein @ 2017-03-29  9:47 UTC (permalink / raw)
  To: Jerome Brunet, gregkh, carlo, khilman
  Cc: linux-amlogic, linux-arm-kernel, linux-serial, linux-kernel

On 28.03.2017 21:16, Jerome Brunet wrote:
> On Tue, 2017-03-28 at 11:25 +0200, Helmut Klein wrote:
>> This patch gets the core clock as provided by the DT and enables it.
>> The code was taken from Amlogic's serial driver, and was tested on my
>> board.
>>
>> Signed-off-by: Helmut Klein <hgkr.klein@gmail.com>
>> ---
>>  drivers/tty/serial/meson_uart.c | 10 ++++++++++
>>  1 file changed, 10 insertions(+)
>>
>> diff --git a/drivers/tty/serial/meson_uart.c b/drivers/tty/serial/meson_uart.c
>> index 60f16795d16b..cb99112288eb 100644
>> --- a/drivers/tty/serial/meson_uart.c
>> +++ b/drivers/tty/serial/meson_uart.c
>> @@ -600,6 +600,7 @@ static int meson_uart_probe(struct platform_device *pdev)
>>  	struct resource *res_mem, *res_irq;
>>  	struct uart_port *port;
>>  	struct clk *clk;
>> +	struct clk *core_clk;
>>  	int ret = 0;
>>
>>  	if (pdev->dev.of_node)
>> @@ -625,6 +626,15 @@ static int meson_uart_probe(struct platform_device *pdev)
>>  	if (!port)
>>  		return -ENOMEM;
>>
>> +	core_clk = devm_clk_get(&pdev->dev, "core");
>> +	if (!IS_ERR(core_clk)) {
>> +		ret = clk_prepare_enable(core_clk);
>> +		if (ret) {
>> +			dev_err(&pdev->dev, "couldn't enable clkc\n");
>> +			return ret;
>> +		}
>> +	}
>> +
>>  	clk = clk_get(&pdev->dev, NULL);
> Now that you have 2 clocks, shouldn't this be named as well ?
>
if i change the call to "clk = clk_get(&pdev->dev, "xtal");", then IMHO 
i must add the
"clock-names" parameter (clock-names = "xtal") to the sections of the 2 
AO-UARTs
(uart_AO & uart_AO_B).

Is this ok?  (or is my assumption wrong?)

I'm going to add a patch meson-gx.dtsi anyway, so 2 lines more to add, 
isn't a big deal.

Helmut

>>  	if (IS_ERR(clk))
>>  		return PTR_ERR(clk);
>> --
>> 2.11.0
>>
>>
>> _______________________________________________
>> linux-amlogic mailing list
>> linux-amlogic@lists.infradead.org
>> http://lists.infradead.org/mailman/listinfo/linux-amlogic
>

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2017-03-29  9:47 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-03-28  9:25 [PATCH v2, 0/3] tty/serial: meson_uart: add support for core clock handling Helmut Klein
2017-03-28  9:25 ` [PATCH v2, 3/3] tty/serial: meson_uart: add the core clock handling to the driver Helmut Klein
2017-03-28 19:16   ` Jerome Brunet
2017-03-29  9:47     ` Helmut Klein

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).