CCF support for Renesas r7s72100
Subsystems (7)
v2 cover CCF support for Renesas r7s72100
From: Wolfram Sang <[email protected]>
This series moves the r7s72100 platfrom from the legacy clock implementation to the common clock framework.
This series has been tested with the renesas-devel-v3.14-rc4-20140227 tag. It has a build dependency [1] because it uses the clkdev workaround. If you want to boot into a console, you also have a runtime dependency [2]. A git branch can be found here:
Patches 1-5 is the minimal set to activate CCF and get the board booting into a console. Patches 6-8 add SCIF support, 9+10 I2C support, and 11+12 SPI support.
Changes since V1:
Patches 2 and 6-12 are new. Patches 1,3,4 got updates, see the changelog there.
Patch 1 should probably go via clock tree (it has no dependencies). The rest via shmobile. Please apply.
Wolfram
PS: A tree can be found here:
git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux.git renesas/r7s-ccf
[1] http://www.spinics.net/lists/arm-kernel/msg310279.html (ARM: shmobile: Introduce shmobile_clk_workaround())
[2] http://lkml.org/lkml/2014/2/20/205 ([PATCH V7 0/3] clocksource: Consolidate SH and ARM mach-shmobile Kconfig bits)
Wolfram Sang (12):
clk: shmobile: add CPG driver for rz-platforms
ARM: shmobile: r7s72100: document MSTP clock support
ARM: shmobile: r7s72100: add essential clock nodes to dtsi
ARM: shmobile: r7s72100: genmai: populate nodes for external clocks
ARM: shmobile: r7s72100: use workaround for non DT-clocks
ARM: shmobile: r7s72100: add scif nodes to dtsi
ARM: shmobile: r7s72100: genmai: activate scif2 for console output
ARM: shmobile: r7s72100: genmai: platform scif devices only for legacy
support
ARM: shmobile: r7s72100: add i2c clocks to dtsi
ARM: shmobile: r7s72100: remove I2C DT clocks from legacy clock
support
ARM: shmobile: r7s72100: add spi clocks to dtsi
ARM: shmobile: r7s72100: remove SPI DT clocks from legacy clock
support
.../bindings/clock/renesas,cpg-mstp-clocks.txt | 1 + .../bindings/clock/renesas,rz-cpg-clocks.txt | 29 +++ arch/arm/boot/dts/r7s72100-genmai-reference.dts | 12 ++ arch/arm/boot/dts/r7s72100.dtsi | 223 ++++++++++++++++++++- arch/arm/mach-shmobile/board-genmai-reference.c | 14 +- arch/arm/mach-shmobile/board-genmai.c | 44 ++++ arch/arm/mach-shmobile/clock-r7s72100.c | 9 - arch/arm/mach-shmobile/setup-r7s72100.c | 43 ---- drivers/clk/shmobile/Makefile | 1 + drivers/clk/shmobile/clk-rz.c | 113 +++++++++++ include/dt-bindings/clock/r7s72100-clock.h | 38 ++++ 11 files changed, 472 insertions(+), 55 deletions(-) create mode 100644 Documentation/devicetree/bindings/clock/renesas,rz-cpg-clocks.txt create mode 100644 drivers/clk/shmobile/clk-rz.c create mode 100644 include/dt-bindings/clock/r7s72100-clock.h
Signature · 1 line
1.9.0
PATCH v2 1/12 clk: shmobile: add CPG driver for rz-platforms
From: Wolfram Sang <[email protected]>
---
Changes since V1:
* added docs
* preparation for usb_x1 support by documenting two input clocks
* static-consted frqcr_tab
* bail out if num_clks == 0
* cosmetic fixes
Mike: if you are fine with this driver, it would be good if you could apply it. Then, we can deal with the orthogonal dependencies in mach-shmobile seperately and know that the driver is already in place when the rest gets resolved. Thanks!
.../bindings/clock/renesas,rz-cpg-clocks.txt | 29 ++++++ drivers/clk/shmobile/Makefile | 1 + drivers/clk/shmobile/clk-rz.c | 113 +++++++++++++++++++++ 3 files changed, 143 insertions(+) create mode 100644 Documentation/devicetree/bindings/clock/renesas,rz-cpg-clocks.txt create mode 100644 drivers/clk/shmobile/clk-rz.c
Documentation/devicetree/bindings/clock/renesas,rz-cpg-clocks.txt new file +29 -0
@@ -0,0 +1,29 @@ +* Renesas RZ Clock Pulse Generator (CPG) + +The CPG generates core clocks for the RZ SoCs. It includes the PLL, variable +CPU and GPU clocks, and several fixed ratio dividers. + +Required Properties: + + - compatible: Must be one of + - "renesas,r7s72100-cpg-clocks" for the r7s72100 CPG + - "renesas,rz-cpg-clocks" for the generic RZ CPG + - reg: Base address and length of the memory resource used by the CPG + - clocks: References to possible parent clocks. Order must match clock modes + in the datasheet. + - #clock-cells: Must be 1 + - clock-output-names: The names of the clocks. Supported clocks are "pll", + "i", and "g" + + +Example +------- + + cpg_clocks: cpg_clocks at fcfe0000 { + #clock-cells = <1>; + compatible = "renesas,r7s72100-cpg-clocks", + "renesas,rz-cpg-clocks"; + reg = <0xfcfe0000 0x18>; + clocks = <&extal_clk>, <&usb_x1_clk>; + clock-output-names = "pll", "i", "g"; + };
drivers/clk/shmobile/Makefile +1 -0
@@ -1,4 +1,5 @@ obj-$(CONFIG_ARCH_EMEV2) += clk-emev2.o +obj-$(CONFIG_ARCH_R7S72100) += clk-rz.o obj-$(CONFIG_ARCH_R8A7790) += clk-rcar-gen2.o obj-$(CONFIG_ARCH_R8A7791) += clk-rcar-gen2.o obj-$(CONFIG_ARCH_SHMOBILE_MULTI) += clk-div6.o
drivers/clk/shmobile/clk-rz.c new file +113 -0
113 lines not on this page · raw message
Signature · 1 line
1.9.0
PATCH v2 1/12 clk: shmobile: add CPG driver for rz-platforms
Hi Wolfram,
Thank you for the patch.
Quoted 45 lines · On Thursday 06 March 2014 12:32:21 Wolfram Sang wrote:
From: Wolfram Sang <[email protected]>
Signed-off-by Wolfram Sang <[email protected]>---
Changes since V1:
* added docs
* preparation forusb_x1support by documenting two input clocks
* static-constedfrqcr_tab
* bail out ifnum_clks== 0
* cosmetic fixesMike: if you are fine with this driver, it would be good if you could apply it. Then, we can deal with the orthogonal dependencies in mach-shmobile seperately and know that the driver is already in place when the rest gets resolved. Thanks!
.../bindings/clock/renesas,rz-cpg-clocks.txt | 29 ++++++ drivers/clk/shmobile/Makefile | 1 + drivers/clk/shmobile/clk-rz.c | 113 ++++++++++++++++++ 3 files changed, 143 insertions(+) create mode 100644
Documentation/devicetree/bindings/clock/renesas,rz-cpg-clocks.txtcreate mode 100644drivers/clk/shmobile/clk-rz.cdiff --git
a/Documentation/devicetree/bindings/clock/renesas,rz-cpg-clocks.txtb/Documentation/devicetree/bindings/clock/renesas,rz-cpg-clocks.txtnew file mode 100644
index 000000000000..c8e8821f08f6Documentation/devicetree/bindings/clock/renesas,rz-cpg-clocks.txt new file +3
-0@@ -0,0 +1,29 @@ +* Renesas RZ Clock Pulse Generator (CPG) + +The CPG generates core clocks for the RZ SoCs. It includes the PLL,variable +CPU and GPU clocks, and several fixed ratio dividers.
Documentation/devicetree/bindings/clock/renesas,rz-cpg-clocks.txt new file +8
-0+ +Required Properties: + + - compatible: Must be one of + - "renesas,r7s72100-cpg-clocks" for the r7s72100 CPG + - "renesas,rz-cpg-clocks" for the generic RZ CPG + - reg: Base address and length of the memory resource used by the CPG + - clocks: References to possible parent clocks. Order must match clock
Quoted 2 lines
modes
+ in the datasheet.
I believe the order should be documented explicitly instead of referring to the datasheet.
Quoted 100 lines
Documentation/devicetree/bindings/clock/renesas,rz-cpg-clocks.txt new file +2
-0+ - #clock-cells: Must be 1 + - clock-output-names: The names of the clocks. Supported clocks are"pll",
Documentation/devicetree/bindings/clock/renesas,rz-cpg-clocks.txt new file +14
-0+ "i", and "g" + + +Example +------- + + cpg_clocks: cpg_clocks at fcfe0000 { + #clock-cells = <1>; + compatible = "renesas,r7s72100-cpg-clocks", + "renesas,rz-cpg-clocks"; + reg = <0xfcfe0000 0x18>; + clocks = <&extal_clk>, <&usb_x1_clk>; + clock-output-names = "pll", "i", "g"; + };drivers/clk/shmobile/Makefile +1
-0@@ -1,4 +1,5 @@ obj-$(CONFIG_ARCH_EMEV2) += clk-emev2.o +obj-$(CONFIG_ARCH_R7S72100) += clk-rz.o obj-$(CONFIG_ARCH_R8A7790) += clk-rcar-gen2.o obj-$(CONFIG_ARCH_R8A7791) += clk-rcar-gen2.o obj-$(CONFIG_ARCH_SHMOBILE_MULTI) += clk-div6.odrivers/clk/shmobile/clk-rz.c new file +5
-0@@ -0,0 +1,113 @@ +/* +* rz Core CPG Clocks +* +* Copyright (C) 2013 Ideas On Board SPRL +* Copyright (C) 2014 Wolfram Sang, Sang Engineering <[email protected]> + *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License.
+ */drivers/clk/shmobile/clk-rz.c new file +21
-2+ +#include <linux/clk-provider.h> +#include <linux/init.h> +#include <linux/kernel.h> +#include <linux/of.h> +#include <linux/of_address.h> +#include <linux/slab.h> + +struct rz_cpg { +struct clk_onecell_data data; +void __iomem *reg; +}; + +#define CPG_FRQCR 0x10 +#define CPG_FRQCR2 0x14 + +/* --------------------------------------------------------------------------- -- + * Initialization +*/ + +static struct clk *__init +rz_cpg_register_clock(struct device_node *np, struct rz_cpg *cpg, constchar *name)
drivers/clk/shmobile/clk-rz.c new file +7
-0+{ +u32 val; +unsigned mult; +static const unsigned frqcr_tab[4 ] = {3 ,2 ,0 ,1 }; + +if (strcmp (name,"pll" ) ==0 ) { +/* FIXME: cpg_mode should be read from GPIO. But no GPIO support yet */
drivers/clk/shmobile/clk-rz.c new file +6
-0+unsigned cpg_mode =0 ;/* hardcoded to EXTAL for now */ +const char *parent_name =of_clk_get_parent_name (np, cpg_mode); + + mult = cpg_mode ? (32 /4 ) :30 ; + + return clk_register_fixed_factor(NULL, name, parent_name, 0, mult,1);
drivers/clk/shmobile/clk-rz.c new file +3
-0+ } + +/* FIXME:"i" and "g" are variable clocks with non-integer dividers (e.g. 2/3)
drivers/clk/shmobile/clk-rz.c new file +14
-0+* and the constraint that always g <= i. To get the rz platform started, +* let them run at fixed current speed and implement the details later. +*/ +if (strcmp (name,"i" ) ==0 ) + val = (clk_readl (cpg->reg +CPG_FRQCR ) >>8 ) &3 ; +else if (strcmp (name,"g" ) ==0 ) + val =clk_readl (cpg->reg +CPG_FRQCR2 ) &3 ; +else +return ERR_PTR (-EINVAL ); + + mult = frqcr_tab[val]; +return clk_register_fixed_factor (NULL , name,"pll" ,0 , mult,3 ); +} +
drivers/clk/shmobile/clk-rz.c line 72
Quoted 10 lines
drivers/clk/shmobile/clk-rz.c new file +10
-0+static void __init rz_cpg_clocks_init (struct device_node *np) +{ +struct rz_cpg *cpg; +struct clk **clks; +unsigned i; +int num_clks; + + num_clks =of_property_count_strings (np,"clock-output-names" ); +if (WARN (num_clks <=0 ,"can't count CPG clocks\n" )) + goto out;
You can return directly instead of goto out.
drivers/clk/shmobile/clk-rz.c line 75
Quoted 3 lines
drivers/clk/shmobile/clk-rz.c new file +3
-0+ + cpg =kzalloc (sizeof (*cpg),GFP_KERNEL ); +if (WARN (!cpg,"out of memory!\n" ))
kmalloc() warns already when it can't allocate memory, so you can remove the warning here.
drivers/clk/shmobile/clk-rz.c
Quoted 1 line
drivers/clk/shmobile/clk-rz.c new file +1
-0+ goto out;
You can return directly here too.
drivers/clk/shmobile/clk-rz.c line 79
Quoted 3 lines
drivers/clk/shmobile/clk-rz.c new file +3
-0+ + clks =kzalloc (num_clks *sizeof (*clks),GFP_KERNEL ); +if (WARN (!clks,"out of memory!\n" ))
You can remove this warning too.
Quoted 22 lines
drivers/clk/shmobile/clk-rz.c new file +22
-0+ goto free_cpg; + + cpg->data.clks = clks; + cpg->data.clk_num = num_clks; + + cpg->reg =of_iomap (np,0 ); +if (WARN (!cpg->reg,"can't remap CPG registers!\n" )) + goto free_clks; + +for (i =0 ; i < num_clks; ++i) { +const char *name; +struct clk *clk; + +of_property_read_string_index (np,"clock-output-names" , i, &name); + + clk =rz_cpg_register_clock (np, cpg, name); +if (IS_ERR (clk)) +pr_err ("%s: failed to register %s %s clock (%ld)\n" , + __func__, np->name, name,PTR_ERR (clk)); +else + cpg->data.clks[i] = clk; + }
drivers/clk/shmobile/clk-rz.c line 111
Quoted 10 lines
drivers/clk/shmobile/clk-rz.c new file +10
-0+ +of_clk_add_provider (np, of_clk_src_onecell_get, &cpg->data); +return ; + +free_clks: +kfree (clks); +free_cpg: +kfree (cpg); +out: +return ;
No need for an explicit return.
Quoted 2 lines
drivers/clk/shmobile/clk-rz.c new file +2
-0+} +CLK_OF_DECLARE (rz_cpg_clks,"renesas,rz-cpg-clocks" , rz_cpg_clocks_init);
Signature · 3 lines
Regards, Laurent Pinchart
PATCH v2 1/12 clk: shmobile: add CPG driver for rz-platforms
Quoted 7 lines
Quoted 4 lines
+ - clocks: References to possible parent clocks. Order must match clock modes
+ in the datasheet.I believe the order should be documented explicitly instead of referring to the datasheet.
I wanted to keep it generic in case future SoCs want to use the driver.
Quoted 5 lines
drivers/clk/shmobile/clk-rz.c line 72
Quoted 3 lines
drivers/clk/shmobile/clk-rz.c new file +3
-0+ num_clks =of_property_count_strings (np,"clock-output-names" ); +if (WARN (num_clks <=0 ,"can't count CPG clocks\n" )) + goto out;You can return directly instead of goto out.
I personally don't prefer the mixture of goto and direct return. Please say if you insist on that.
-------------- 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/20140306/2817bf52/attachment-0001.sig>
PATCH v2 1/12 clk: shmobile: add CPG driver for rz-platforms
Hi Wolfram,
Quoted 8 lines · Wolfram Sang
Quoted 5 lines
drivers/clk/shmobile/clk-rz.c line 72
Quoted 3 lines
drivers/clk/shmobile/clk-rz.c new file +3
-0+ num_clks =of_property_count_strings (np,"clock-output-names" ); +if (WARN (num_clks <=0 ,"can't count CPG clocks\n" )) + goto out;You can return directly instead of goto out.
I personally don't prefer the mixture of goto and direct return. Please say if you insist on that.
Here it's not really a mix: there is a strict separation between cases where cleanup/error handling is done and case where it's not.
So it serves as a clue for the reader, who doesn't have to scroll down to see that no cleanup/error handling is done later.
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert at linux-m68k.org
In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
PATCH v2 2/12 ARM: shmobile: r7s72100: document MSTP clock support
In reply to Wolfram SangFrom: Wolfram Sang <[email protected]>
--- Documentation/devicetree/bindings/clock/renesas,cpg-mstp-clocks.txt | 1 + 1 file changed, 1 insertion(+)
Documentation/devicetree/bindings/clock/renesas,cpg-mstp-clocks.txt +1 -0
@@ -10,6 +10,7 @@ index in the group, from 0 to 31. Required Properties: - compatible: Must be one of the following + - "renesas,r7s72100-mstp-clocks" for R7S72100 (RZ) MSTP gate clocks - "renesas,r8a7790-mstp-clocks" for R8A7790 (R-Car H2) MSTP gate clocks - "renesas,r8a7791-mstp-clocks" for R8A7791 (R-Car M2) MSTP gate clocks - "renesas,cpg-mstp-clock" for generic MSTP gate clocks
Signature · 1 line
1.9.0
PATCH v2 3/12 ARM: shmobile: r7s72100: add essential clock nodes to dtsi
In reply to Wolfram SangFrom: Wolfram Sang <[email protected]>
Only essential clocks are added for now. Other clocks will be added when needed.
---
Changes since V1:
* add usb_x1 clock
* reference usb_x1 to cpg
* improved wording
* #clock-cells consistently first property
arch/arm/boot/dts/r7s72100.dtsi | 86 +++++++++++++++++++++++++++++- include/dt-bindings/clock/r7s72100-clock.h | 25 +++++++++ 2 files changed, 110 insertions(+), 1 deletion(-) create mode 100644 include/dt-bindings/clock/r7s72100-clock.h
arch/arm/boot/dts/r7s72100.dtsi +85 -1
@@ -1,13 +1,15 @@ /* * Device Tree Source for the r7s72100 SoC * - * Copyright (C) 2013 Renesas Solutions Corp. + * Copyright (C) 2013-14 Renesas Solutions Corp. + * Copyright (C) 2014 Wolfram Sang, Sang Engineering <[email protected]> * * This file is licensed under the terms of the GNU General Public License * version 2. This program is licensed "as is" without any warranty of any * kind, whether express or implied. */ +#include <dt-bindings/clock/r7s72100-clock.h> #include <dt-bindings/interrupt-controller/irq.h> / {
@@ -28,6 +30,88 @@ spi4 = &spi4; }; + clocks { + ranges; + #address-cells = <1>; + #size-cells = <1>; + + /* External clocks */ + extal_clk: extal_clk { + #clock-cells = <0>; + compatible = "fixed-clock"; + /* If clk present, value must be set by board */ + clock-frequency = <0>; + clock-output-names = "extal"; + }; + + usb_x1_clk: usb_x1_clk { + #clock-cells = <0>; + compatible = "fixed-clock"; + /* If clk present, value must be set by board */ + clock-frequency = <0>; + clock-output-names = "usb_x1"; + }; + + /* Special CPG clocks */ + cpg_clocks: cpg_clocks at fcfe0000 { + #clock-cells = <1>; + compatible = "renesas,r7s72100-cpg-clocks", + "renesas,rz-cpg-clocks"; + reg = <0xfcfe0000 0x18>; + clocks = <&extal_clk>, <&usb_x1_clk>; + clock-output-names = "pll", "i", "g"; + }; + + /* Fixed factor clocks */ + b_clk: b_clk { + #clock-cells = <0>; + compatible = "fixed-factor-clock"; + clocks = <&cpg_clocks 0>; + clock-mult = <1>; + clock-div = <3>; + clock-output-names = "b"; + }; + p1_clk: p1_clk { + #clock-cells = <0>; + compatible = "fixed-factor-clock"; + clocks = <&cpg_clocks 0>; + clock-mult = <1>; + clock-div = <6>; + clock-output-names = "p1"; + }; + p0_clk: p0_clk { + #clock-cells = <0>; + compatible = "fixed-factor-clock"; + clocks = <&cpg_clocks 0>; + clock-mult = <1>; + clock-div = <12>; + clock-output-names = "p0"; + }; + + /* MSTP clocks */ + mstp3_clks: mstp3_clks at fcfe0420 { + #clock-cells = <1>; + compatible = "renesas,r7s72100-mstp-clocks", "renesas,cpg-mstp-clocks"; + reg = <0xfcfe0420 4>; + clocks = <&p0_clk>; + renesas,clock-indices = <R7S72100_CLK_MTU2>; + clock-output-names = "mtu2"; + }; + + mstp4_clks: mstp4_clks at fcfe0424 { + #clock-cells = <1>; + compatible = "renesas,r7s72100-mstp-clocks", "renesas,cpg-mstp-clocks"; + reg = <0xfcfe0424 4>; + clocks = <&p1_clk>, <&p1_clk>, <&p1_clk>, <&p1_clk>, + <&p1_clk>, <&p1_clk>, <&p1_clk>, <&p1_clk>; + renesas,clock-indices = < + R7S72100_CLK_SCIF0 R7S72100_CLK_SCIF1 R7S72100_CLK_SCIF2 R7S72100_CLK_SCIF3 + R7S72100_CLK_SCIF4 R7S72100_CLK_SCIF5 R7S72100_CLK_SCIF6 R7S72100_CLK_SCIF7 + >; + clock-output-names = "scif0", "scif1", "scif2", "scif3", "scif4", "scif5", "scif6", "scif7"; + }; + }; + cpus { #address-cells = <1>; #size-cells = <0>;
include/dt-bindings/clock/r7s72100-clock.h new file +25 -0
@@ -0,0 +1,25 @@ +/* +* Copyright (C) 2014 Wolfram Sang, Sang Engineering <[email protected]> +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; version 2 of the License. +*/ + +#ifndef __DT_BINDINGS_CLOCK_R7S72100_H__ +#define __DT_BINDINGS_CLOCK_R7S72100_H__ + +/* MSTP3 */ +#define R7S72100_CLK_MTU2 3 + +/* MSTP4 */ +#define R7S72100_CLK_SCIF0 7 +#define R7S72100_CLK_SCIF1 6 +#define R7S72100_CLK_SCIF2 5 +#define R7S72100_CLK_SCIF3 4 +#define R7S72100_CLK_SCIF4 3 +#define R7S72100_CLK_SCIF5 2 +#define R7S72100_CLK_SCIF6 1 +#define R7S72100_CLK_SCIF7 0 + +#endif /* __DT_BINDINGS_CLOCK_R7S72100_H__ */
Signature · 1 line
1.9.0
PATCH v2 3/12 ARM: shmobile: r7s72100: add essential clock nodes to dtsi
Hi Wolfram,
Thank you for the patch.
Quoted 72 lines · On Thursday 06 March 2014 12:32:23 Wolfram Sang wrote:
From: Wolfram Sang <[email protected]>
Only essential clocks are added for now. Other clocks will be added when needed.
Signed-off-by Wolfram Sang <[email protected]>---
Changes since V1:
* addusb_x1clock
* referenceusb_x1to cpg
* improved wording
* #clock-cells consistently first propertyarch/arm/boot/dts/r7s72100.dtsi | 86 ++++++++++++++++++++++++++- include/dt-bindings/clock/r7s72100-clock.h | 25 +++++++++ 2 files changed, 110 insertions(+), 1 deletion(-) create mode 100644 include/dt-bindings/clock/r7s72100-clock.h(quoted diff) +0
-0
b/arch/arm/boot/dts/r7s72100.dtsiindexee700717a34b..2429b5be2e56100644arch/arm/boot/dts/r7s72100.dtsi +2
-1@@ -1,13 +1,15 @@ /* * Device Tree Source for the r7s72100 SoC * - * Copyright (C) 2013 Renesas Solutions Corp. + * Copyright (C) 2013-14 Renesas Solutions Corp. + * Copyright (C) 2014 Wolfram Sang, Sang Engineering<[email protected]>
*
* This file is licensed under the terms of the GNU General Public License
* version 2. This program is licensed "as is" without any warranty of any
* kind, whether express or implied.
*/arch/arm/boot/dts/r7s72100.dtsi +28
-0+#include <dt-bindings/clock/r7s72100-clock.h> #include <dt-bindings/interrupt-controller/irq.h> / {@@ -28,6 +30,88 @@ spi4 = &spi4; }; + clocks { + ranges; + #address-cells = <1>; + #size-cells = <1>; + + /* External clocks */ + extal_clk: extal_clk { + #clock-cells = <0>; + compatible = "fixed-clock"; + /* If clk present, value must be set by board */ + clock-frequency = <0>; + clock-output-names = "extal"; + }; + + usb_x1_clk: usb_x1_clk { + #clock-cells = <0>; + compatible = "fixed-clock"; + /* If clk present, value must be set by board */ + clock-frequency = <0>; + clock-output-names = "usb_x1"; + }; + + /* Special CPG clocks */ + cpg_clocks: cpg_clocks at fcfe0000 { + #clock-cells = <1>; + compatible = "renesas,r7s72100-cpg-clocks", + "renesas,rz-cpg-clocks";
arch/arm/boot/dts/r7s72100.dtsi line 69
Quoted 10 lines
arch/arm/boot/dts/r7s72100.dtsi +10
-0+ reg = <0xfcfe0000 0x18>; + clocks = <&extal_clk>, <&usb_x1_clk>; + clock-output-names = "pll", "i", "g"; + }; + + /* Fixed factor clocks */ + b_clk: b_clk { + #clock-cells = <0>; + compatible = "fixed-factor-clock"; + clocks = <&cpg_clocks 0>;
What about adding #define's for the CPG clocks to include/dt- bindings/clock/r7s72100-clock.h like is done for the R8A7790 and R8A7791 ?
Quoted 15 lines
arch/arm/boot/dts/r7s72100.dtsi +15
-0+ clock-mult = <1>; + clock-div = <3>; + clock-output-names = "b"; + }; + p1_clk: p1_clk { + #clock-cells = <0>; + compatible = "fixed-factor-clock"; + clocks = <&cpg_clocks 0>; + clock-mult = <1>; + clock-div = <6>; + clock-output-names = "p1"; + }; + p0_clk: p0_clk { + #clock-cells = <0>; + compatible = "fixed-factor-clock";
arch/arm/boot/dts/r7s72100.dtsi
Quoted 10 lines
arch/arm/boot/dts/r7s72100.dtsi +10
-0+ clocks = <&cpg_clocks 0>; + clock-mult = <1>; + clock-div = <12>; + clock-output-names = "p0"; + }; + + /* MSTP clocks */ + mstp3_clks: mstp3_clks at fcfe0420 { + #clock-cells = <1>; + compatible = "renesas,r7s72100-mstp-clocks", "renesas,cpg-mstp-
clocks";
arch/arm/boot/dts/r7s72100.dtsi
Quoted 9 lines
arch/arm/boot/dts/r7s72100.dtsi +9
-0+ reg = <0xfcfe0420 4>; + clocks = <&p0_clk>; + renesas,clock-indices = <R7S72100_CLK_MTU2>; + clock-output-names = "mtu2"; + }; + + mstp4_clks: mstp4_clks at fcfe0424 { + #clock-cells = <1>; + compatible = "renesas,r7s72100-mstp-clocks", "renesas,cpg-mstp-
clocks";
Quoted 45 lines
arch/arm/boot/dts/r7s72100.dtsi +5
-0+ reg = <0xfcfe0424 4>; + clocks = <&p1_clk>, <&p1_clk>, <&p1_clk>, <&p1_clk>, + <&p1_clk>, <&p1_clk>, <&p1_clk>, <&p1_clk>; + renesas,clock-indices = < + R7S72100_CLK_SCIF0 R7S72100_CLK_SCIF1 R7S72100_CLK_SCIF2
R7S72100_CLK_SCIF3+R7S72100_CLK_SCIF4R7S72100_CLK_SCIF5R7S72100_CLK_SCIF6R7S72100_CLK_SCIF7+ >;arch/arm/boot/dts/r7s72100.dtsi +1
-0+ clock-output-names = "scif0", "scif1", "scif2", "scif3", "scif4","scif5", "scif6", "scif7"; + };
arch/arm/boot/dts/r7s72100.dtsi +2
-0+ }; + cpus { #address-cells = <1>; #size-cells = <0>;(quoted diff) +0
-0
b/include/dt-bindings/clock/r7s72100-clock.hnew file mode 100644 index 000000000000..eced0a8382b0include/dt-bindings/clock/r7s72100-clock.h new file +2
-0@@ -0,0 +1,25 @@ +/* +* Copyright (C) 2014 Wolfram Sang, Sang Engineering <[email protected]> + *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License.
+ */include/dt-bindings/clock/r7s72100-clock.h new file +18
-0+ +#ifndef __DT_BINDINGS_CLOCK_R7S72100_H__ +#define __DT_BINDINGS_CLOCK_R7S72100_H__ + +/* MSTP3 */ +#define R7S72100_CLK_MTU2 3 + +/* MSTP4 */ +#define R7S72100_CLK_SCIF0 7 +#define R7S72100_CLK_SCIF1 6 +#define R7S72100_CLK_SCIF2 5 +#define R7S72100_CLK_SCIF3 4 +#define R7S72100_CLK_SCIF4 3 +#define R7S72100_CLK_SCIF5 2 +#define R7S72100_CLK_SCIF6 1 +#define R7S72100_CLK_SCIF7 0 + +#endif /* __DT_BINDINGS_CLOCK_R7S72100_H__ */
Signature · 3 lines
Regards, Laurent Pinchart
PATCH v2 4/12 ARM: shmobile: r7s72100: genmai: populate nodes for external clocks
In reply to Wolfram SangFrom: Wolfram Sang <[email protected]>
---
Changes since V1:
* activate usb_x1, too
arch/arm/boot/dts/r7s72100-genmai-reference.dts | 8 ++++++++ 1 file changed, 8 insertions(+)
arch/arm/boot/dts/r7s72100-genmai-reference.dts +8 -0
@@ -30,6 +30,14 @@ }; }; +&extal_clk { + clock-frequency = <13330000>; +}; + +&usb_x1_clk { + clock-frequency = <48000000>; +}; + &i2c2 { status = "okay"; clock-frequency = <400000>;
Signature · 1 line
1.9.0
PATCH v2 5/12 ARM: shmobile: r7s72100: use workaround for non DT-clocks
In reply to Wolfram SangFrom: Wolfram Sang <[email protected]>
SCIF2 and MTU2 are not yet prepared for DT usage, so use the common workaround via clkdev for now.
---
No changes since V1.
arch/arm/mach-shmobile/board-genmai-reference.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-)
arch/arm/mach-shmobile/board-genmai-reference.c +13 -2
@@ -18,18 +18,29 @@* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -#include <linux/clk-provider.h> #include <linux/kernel.h> #include <linux/of_platform.h> +#include <mach/clock.h> #include <mach/common.h> #include <mach/r7s72100.h> #include <asm/mach-types.h> #include <asm/mach/arch.h> +#ifdef CONFIG_COMMON_CLK +/* +* This is a really crude hack to provide clkdev support to platform +* devices until they get moved to DT. +*/ +static const struct clk_name clk_names[] = { + {"mtu2" ,NULL ,"sh_mtu2.0" }, + {"scif2" ,NULL ,"sh-sci.2" }, +}; +#endif +static void __init genmai_add_standard_devices (void ) {#ifdef CONFIG_COMMON_CLK -of_clk_init (NULL ); +shmobile_clk_workaround (clk_names,ARRAY_SIZE (clk_names), true);#else r7s72100_clock_init ();#endif
Signature · 1 line
1.9.0
PATCH v2 6/12 ARM: shmobile: r7s72100: add scif nodes to dtsi
In reply to Wolfram SangFrom: Wolfram Sang <[email protected]>
--- arch/arm/boot/dts/r7s72100.dtsi | 104 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 104 insertions(+)
arch/arm/boot/dts/r7s72100.dtsi +104 -0
@@ -23,6 +23,14 @@ i2c1 = &i2c1; i2c2 = &i2c2; i2c3 = &i2c3; + serial0 = &scif0; + serial1 = &scif1; + serial2 = &scif2; + serial3 = &scif3; + serial4 = &scif4; + serial5 = &scif5; + serial6 = &scif6; + serial7 = &scif7; spi0 = &spi0; spi1 = &spi1; spi2 = &spi2;
@@ -200,6 +208,102 @@ status = "disabled"; }; + scif0: serial at e8007000 { + compatible = "renesas,scif-r7s72100", "renesas,scif"; + reg = <0xe8007000 64>; + interrupts = <0 190 IRQ_TYPE_LEVEL_HIGH>, + <0 191 IRQ_TYPE_LEVEL_HIGH>, + <0 192 IRQ_TYPE_LEVEL_HIGH>, + <0 189 IRQ_TYPE_LEVEL_HIGH>; + clocks = <&mstp4_clks R7S72100_CLK_SCIF0>; + clock-names = "sci_ick"; + status = "disabled"; + }; + + scif1: serial at e8007800 { + compatible = "renesas,scif-r7s72100", "renesas,scif"; + reg = <0xe8007800 64>; + interrupts = <0 194 IRQ_TYPE_LEVEL_HIGH>, + <0 195 IRQ_TYPE_LEVEL_HIGH>, + <0 196 IRQ_TYPE_LEVEL_HIGH>, + <0 193 IRQ_TYPE_LEVEL_HIGH>; + clocks = <&mstp4_clks R7S72100_CLK_SCIF1>; + clock-names = "sci_ick"; + status = "disabled"; + }; + + scif2: serial at e8008000 { + compatible = "renesas,scif-r7s72100", "renesas,scif"; + reg = <0xe8008000 64>; + interrupts = <0 198 IRQ_TYPE_LEVEL_HIGH>, + <0 199 IRQ_TYPE_LEVEL_HIGH>, + <0 200 IRQ_TYPE_LEVEL_HIGH>, + <0 197 IRQ_TYPE_LEVEL_HIGH>; + clocks = <&mstp4_clks R7S72100_CLK_SCIF2>; + clock-names = "sci_ick"; + status = "disabled"; + }; + + scif3: serial at e8008800 { + compatible = "renesas,scif-r7s72100", "renesas,scif"; + reg = <0xe8008800 64>; + interrupts = <0 202 IRQ_TYPE_LEVEL_HIGH>, + <0 203 IRQ_TYPE_LEVEL_HIGH>, + <0 204 IRQ_TYPE_LEVEL_HIGH>, + <0 201 IRQ_TYPE_LEVEL_HIGH>; + clocks = <&mstp4_clks R7S72100_CLK_SCIF3>; + clock-names = "sci_ick"; + status = "disabled"; + }; + + scif4: serial at e8009000 { + compatible = "renesas,scif-r7s72100", "renesas,scif"; + reg = <0xe8009000 64>; + interrupts = <0 206 IRQ_TYPE_LEVEL_HIGH>, + <0 207 IRQ_TYPE_LEVEL_HIGH>, + <0 208 IRQ_TYPE_LEVEL_HIGH>, + <0 205 IRQ_TYPE_LEVEL_HIGH>; + clocks = <&mstp4_clks R7S72100_CLK_SCIF4>; + clock-names = "sci_ick"; + status = "disabled"; + }; + + scif5: serial at e8009800 { + compatible = "renesas,scif-r7s72100", "renesas,scif"; + reg = <0xe8009800 64>; + interrupts = <0 210 IRQ_TYPE_LEVEL_HIGH>, + <0 211 IRQ_TYPE_LEVEL_HIGH>, + <0 212 IRQ_TYPE_LEVEL_HIGH>, + <0 209 IRQ_TYPE_LEVEL_HIGH>; + clocks = <&mstp4_clks R7S72100_CLK_SCIF5>; + clock-names = "sci_ick"; + status = "disabled"; + }; + + scif6: serial at e800a000 { + compatible = "renesas,scif-r7s72100", "renesas,scif"; + reg = <0xe800a000 64>; + interrupts = <0 214 IRQ_TYPE_LEVEL_HIGH>, + <0 215 IRQ_TYPE_LEVEL_HIGH>, + <0 216 IRQ_TYPE_LEVEL_HIGH>, + <0 213 IRQ_TYPE_LEVEL_HIGH>; + clocks = <&mstp4_clks R7S72100_CLK_SCIF6>; + clock-names = "sci_ick"; + status = "disabled"; + }; + + scif7: serial at e800a800 { + compatible = "renesas,scif-r7s72100", "renesas,scif"; + reg = <0xe800a800 64>; + interrupts = <0 218 IRQ_TYPE_LEVEL_HIGH>, + <0 219 IRQ_TYPE_LEVEL_HIGH>, + <0 220 IRQ_TYPE_LEVEL_HIGH>, + <0 217 IRQ_TYPE_LEVEL_HIGH>; + clocks = <&mstp4_clks R7S72100_CLK_SCIF7>; + clock-names = "sci_ick"; + status = "disabled"; + }; + spi0: spi at e800c800 { compatible = "renesas,rspi-r7s72100", "renesas,rspi-rz"; reg = <0xe800c800 0x24>;
Signature · 1 line
1.9.0
PATCH v2 7/12 ARM: shmobile: r7s72100: genmai: activate scif2 for console output
In reply to Wolfram SangFrom: Wolfram Sang <[email protected]>
--- arch/arm/boot/dts/r7s72100-genmai-reference.dts | 4 ++++ 1 file changed, 4 insertions(+)
arch/arm/boot/dts/r7s72100-genmai-reference.dts +4 -0
@@ -48,3 +48,7 @@ pagesize = <64>; }; }; + +&scif2 { + status = "okay"; +};
Signature · 1 line
1.9.0
PATCH v2 8/12 ARM: shmobile: r7s72100: genmai: platform scif devices only for legacy support
In reply to Wolfram SangFrom: Wolfram Sang <[email protected]>
We have now DT support for SCIF, so use the platform_device initialization only for the legacy support.
--- arch/arm/mach-shmobile/board-genmai-reference.c | 1 - arch/arm/mach-shmobile/board-genmai.c | 44 +++++++++++++++++++++++++ arch/arm/mach-shmobile/setup-r7s72100.c | 43 ------------------------ 3 files changed, 44 insertions(+), 44 deletions(-)
arch/arm/mach-shmobile/board-genmai-reference.c +0 -1
@@ -33,7 +33,6 @@*/ static const struct clk_name clk_names[] = { {"mtu2" ,NULL ,"sh_mtu2.0" }, - {"scif2" ,NULL ,"sh-sci.2" }, };#endif
arch/arm/mach-shmobile/board-genmai.c +44 -0
62 lines not on this page · raw message
arch/arm/mach-shmobile/setup-r7s72100.c +0 -43
61 lines not on this page · raw message
Signature · 1 line
1.9.0
PATCH v2 9/12 ARM: shmobile: r7s72100: add i2c clocks to dtsi
In reply to Wolfram SangFrom: Wolfram Sang <[email protected]>
--- arch/arm/boot/dts/r7s72100.dtsi | 15 +++++++++++++++ include/dt-bindings/clock/r7s72100-clock.h | 6 ++++++ 2 files changed, 21 insertions(+)
arch/arm/boot/dts/r7s72100.dtsi +15 -0
@@ -118,6 +118,17 @@ >; clock-output-names = "scif0", "scif1", "scif2", "scif3", "scif4", "scif5", "scif6", "scif7"; }; + + mstp9_clks: mstp9_clks at fcfe0438 { + #clock-cells = <1>; + compatible = "renesas,r7s72100-mstp-clocks", "renesas,cpg-mstp-clocks"; + reg = <0xfcfe0438 4>; + clocks = <&p0_clk>, <&p0_clk>, <&p0_clk>, <&p0_clk>; + renesas,clock-indices = < + R7S72100_CLK_I2C0 R7S72100_CLK_I2C1 R7S72100_CLK_I2C2 R7S72100_CLK_I2C3 + >; + clock-output-names = "i2c0", "i2c1", "i2c2", "i2c3"; + }; }; cpus {
@@ -153,6 +164,7 @@ <0 162 IRQ_TYPE_LEVEL_HIGH>, <0 163 IRQ_TYPE_LEVEL_HIGH>, <0 164 IRQ_TYPE_LEVEL_HIGH>; + clocks = <&mstp9_clks R7S72100_CLK_I2C0>; clock-frequency = <100000>; status = "disabled"; };
@@ -170,6 +182,7 @@ <0 170 IRQ_TYPE_LEVEL_HIGH>, <0 171 IRQ_TYPE_LEVEL_HIGH>, <0 172 IRQ_TYPE_LEVEL_HIGH>; + clocks = <&mstp9_clks R7S72100_CLK_I2C1>; clock-frequency = <100000>; status = "disabled"; };
@@ -187,6 +200,7 @@ <0 178 IRQ_TYPE_LEVEL_HIGH>, <0 179 IRQ_TYPE_LEVEL_HIGH>, <0 180 IRQ_TYPE_LEVEL_HIGH>; + clocks = <&mstp9_clks R7S72100_CLK_I2C2>; clock-frequency = <100000>; status = "disabled"; };
@@ -204,6 +218,7 @@ <0 186 IRQ_TYPE_LEVEL_HIGH>, <0 187 IRQ_TYPE_LEVEL_HIGH>, <0 188 IRQ_TYPE_LEVEL_HIGH>; + clocks = <&mstp9_clks R7S72100_CLK_I2C3>; clock-frequency = <100000>; status = "disabled"; };
include/dt-bindings/clock/r7s72100-clock.h +6 -0
@@ -22,4 +22,10 @@#define R7S72100_CLK_SCIF6 1#define R7S72100_CLK_SCIF7 0 +/* MSTP9 */ +#define R7S72100_CLK_I2C0 7 +#define R7S72100_CLK_I2C1 6 +#define R7S72100_CLK_I2C2 5 +#define R7S72100_CLK_I2C3 4 +#endif /* __DT_BINDINGS_CLOCK_R7S72100_H__ */
Signature · 1 line
1.9.0
PATCH v2 10/12 ARM: shmobile: r7s72100: remove I2C DT clocks from legacy clock support
In reply to Wolfram SangFrom: Wolfram Sang <[email protected]>
Not used anymore since we switched to CCF.
--- arch/arm/mach-shmobile/clock-r7s72100.c | 4 ---- 1 file changed, 4 deletions(-)
arch/arm/mach-shmobile/clock-r7s72100.c +0 -4
@@ -199,10 +199,6 @@ static struct clk_lookup lookups[] = {CLKDEV_DEV_ID ("e800d800.spi" , &mstp_clks[MSTP105 ]),CLKDEV_DEV_ID ("e800e000.spi" , &mstp_clks[MSTP104 ]),CLKDEV_DEV_ID ("e800e800.spi" , &mstp_clks[MSTP103 ]), -CLKDEV_DEV_ID ("fcfee000.i2c" , &mstp_clks[MSTP97 ]), -CLKDEV_DEV_ID ("fcfee400.i2c" , &mstp_clks[MSTP96 ]), -CLKDEV_DEV_ID ("fcfee800.i2c" , &mstp_clks[MSTP95 ]), -CLKDEV_DEV_ID ("fcfeec00.i2c" , &mstp_clks[MSTP94 ]),CLKDEV_DEV_ID ("r7s72100-ether" , &mstp_clks[MSTP74 ]), CLKDEV_CON_ID("mtu2_fck", &mstp_clks[MSTP33]),
Signature · 1 line
1.9.0
PATCH v2 11/12 ARM: shmobile: r7s72100: add spi clocks to dtsi
In reply to Wolfram SangFrom: Wolfram Sang <[email protected]>
--- arch/arm/boot/dts/r7s72100.dtsi | 18 ++++++++++++++++++ include/dt-bindings/clock/r7s72100-clock.h | 7 +++++++ 2 files changed, 25 insertions(+)
arch/arm/boot/dts/r7s72100.dtsi +18 -0
@@ -129,6 +129,19 @@ >; clock-output-names = "i2c0", "i2c1", "i2c2", "i2c3"; }; + + mstp10_clks: mstp10_clks at fcfe043c { + #clock-cells = <1>; + compatible = "renesas,r7s72100-mstp-clocks", "renesas,cpg-mstp-clocks"; + reg = <0xfcfe043c 4>; + clocks = <&p1_clk>, <&p1_clk>, <&p1_clk>, <&p1_clk>, + <&p1_clk>; + renesas,clock-indices = < + R7S72100_CLK_SPI0 R7S72100_CLK_SPI1 R7S72100_CLK_SPI2 R7S72100_CLK_SPI3 + R7S72100_CLK_SPI4 + >; + clock-output-names = "spi0", "spi1", "spi2", "spi3", "spi4"; + }; }; cpus {
@@ -326,6 +339,7 @@ <0 239 IRQ_TYPE_LEVEL_HIGH>, <0 240 IRQ_TYPE_LEVEL_HIGH>; interrupt-names = "error", "rx", "tx"; + clocks = <&mstp10_clks R7S72100_CLK_SPI0>; num-cs = <1>; #address-cells = <1>; #size-cells = <0>;
@@ -339,6 +353,7 @@ <0 242 IRQ_TYPE_LEVEL_HIGH>, <0 243 IRQ_TYPE_LEVEL_HIGH>; interrupt-names = "error", "rx", "tx"; + clocks = <&mstp10_clks R7S72100_CLK_SPI1>; num-cs = <1>; #address-cells = <1>; #size-cells = <0>;
@@ -352,6 +367,7 @@ <0 245 IRQ_TYPE_LEVEL_HIGH>, <0 246 IRQ_TYPE_LEVEL_HIGH>; interrupt-names = "error", "rx", "tx"; + clocks = <&mstp10_clks R7S72100_CLK_SPI2>; num-cs = <1>; #address-cells = <1>; #size-cells = <0>;
@@ -365,6 +381,7 @@ <0 248 IRQ_TYPE_LEVEL_HIGH>, <0 249 IRQ_TYPE_LEVEL_HIGH>; interrupt-names = "error", "rx", "tx"; + clocks = <&mstp10_clks R7S72100_CLK_SPI3>; num-cs = <1>; #address-cells = <1>; #size-cells = <0>;
@@ -378,6 +395,7 @@ <0 251 IRQ_TYPE_LEVEL_HIGH>, <0 252 IRQ_TYPE_LEVEL_HIGH>; interrupt-names = "error", "rx", "tx"; + clocks = <&mstp10_clks R7S72100_CLK_SPI4>; num-cs = <1>; #address-cells = <1>; #size-cells = <0>;
include/dt-bindings/clock/r7s72100-clock.h +7 -0
@@ -28,4 +28,11 @@#define R7S72100_CLK_I2C2 5#define R7S72100_CLK_I2C3 4 +/* MSTP10 */ +#define R7S72100_CLK_SPI0 7 +#define R7S72100_CLK_SPI1 6 +#define R7S72100_CLK_SPI2 5 +#define R7S72100_CLK_SPI3 4 +#define R7S72100_CLK_SPI4 3 +#endif /* __DT_BINDINGS_CLOCK_R7S72100_H__ */
Signature · 1 line
1.9.0
PATCH v2 11/12 ARM: shmobile: r7s72100: add spi clocks to dtsi
Quoted 1 line · Wolfram Sang
From: Wolfram Sang <[email protected]>
Thanks for your patch!
Quoted 1 line
Signed-off-by Wolfram Sang <[email protected]>
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert at linux-m68k.org
In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds