* [GIT PULL] Renesas ARM based SoC Clock updates for v3.14
@ 2013-12-23 1:10 Simon Horman
2013-12-23 1:10 ` [PATCH] clk: emev2: Add support for emev2 SMU clocks with DT Simon Horman
2013-12-23 6:40 ` [GIT PULL] Renesas ARM based SoC Clock updates for v3.14 Mike Turquette
0 siblings, 2 replies; 3+ messages in thread
From: Simon Horman @ 2013-12-23 1:10 UTC (permalink / raw)
To: linux-arm-kernel
Hi Mike,
please consider the following
Renesas ARM based SoC Clock updates for v3.14.
This pull request is based on your clk-next-shmobile branch.
The following changes since commit f94859c215b6d977794108a1a9a101239e393c09:
clk: shmobile: Add MSTP clock support (2013-12-12 19:23:59 -0800)
are available in the git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/horms/renesas.git tags/renesas-clock-for-v3.14
for you to fetch changes up to 92ca6a8ce97e07206d474da5477d8da4e41bad6c:
clk: emev2: Add support for emev2 SMU clocks with DT (2013-12-14 13:17:55 +0900)
----------------------------------------------------------------
Renesas ARM based SoC Clock updates for v3.14
Add support for using emev2 SMU clocks with DT
----------------------------------------------------------------
Takashi Yoshii (1):
clk: emev2: Add support for emev2 SMU clocks with DT
.../devicetree/bindings/clock/emev2-clock.txt | 98 +++++++++++++++++++
drivers/clk/shmobile/Makefile | 2 +-
drivers/clk/shmobile/clk-emev2.c | 104 +++++++++++++++++++++
3 files changed, 203 insertions(+), 1 deletion(-)
create mode 100644 Documentation/devicetree/bindings/clock/emev2-clock.txt
create mode 100644 drivers/clk/shmobile/clk-emev2.c
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH] clk: emev2: Add support for emev2 SMU clocks with DT
2013-12-23 1:10 [GIT PULL] Renesas ARM based SoC Clock updates for v3.14 Simon Horman
@ 2013-12-23 1:10 ` Simon Horman
2013-12-23 6:40 ` [GIT PULL] Renesas ARM based SoC Clock updates for v3.14 Mike Turquette
1 sibling, 0 replies; 3+ messages in thread
From: Simon Horman @ 2013-12-23 1:10 UTC (permalink / raw)
To: linux-arm-kernel
From: Takashi Yoshii <takasi-y@ops.dti.ne.jp>
Device tree clock binding document for EMMA Mobile EV2 SMU,
And Common clock framework based implementation of it.
Following nodes are defined to describe clock tree.
- renesas,emev2-smu
- renesas,emev2-smu-clkdiv
- renesas,emev2-smu-gclk
These bindings are designed manually based on
19UH0037EJ1000_SMU : System Management Unit User's Manual
So far, reparent is not implemented, and is fixed to index #0.
Clock tree description is not included, and should be provided
by device-tree.
Signed-off-by: Takashi Yoshii <takasi-y@ops.dti.ne.jp>
Acked-by: Magnus Damm <damm@opensource.se>
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
---
.../devicetree/bindings/clock/emev2-clock.txt | 98 +++++++++++++++++++
drivers/clk/shmobile/Makefile | 2 +-
drivers/clk/shmobile/clk-emev2.c | 104 +++++++++++++++++++++
3 files changed, 203 insertions(+), 1 deletion(-)
create mode 100644 Documentation/devicetree/bindings/clock/emev2-clock.txt
create mode 100644 drivers/clk/shmobile/clk-emev2.c
diff --git a/Documentation/devicetree/bindings/clock/emev2-clock.txt b/Documentation/devicetree/bindings/clock/emev2-clock.txt
new file mode 100644
index 0000000..60bbb1a
--- /dev/null
+++ b/Documentation/devicetree/bindings/clock/emev2-clock.txt
@@ -0,0 +1,98 @@
+Device tree Clock bindings for Renesas EMMA Mobile EV2
+
+This binding uses the common clock binding.
+
+* SMU
+System Management Unit described in user's manual R19UH0037EJ1000_SMU.
+This is not a clock provider, but clocks under SMU depend on it.
+
+Required properties:
+- compatible: Should be "renesas,emev2-smu"
+- reg: Address and Size of SMU registers
+
+* SMU_CLKDIV
+Function block with an input mux and a divider, which corresponds to
+"Serial clock generator" in fig."Clock System Overview" of the manual,
+and "xxx frequency division setting register" (XXXCLKDIV) registers.
+This makes internal (neither input nor output) clock that is provided
+to input of xxxGCLK block.
+
+Required properties:
+- compatible: Should be "renesas,emev2-smu-clkdiv"
+- reg: Byte offset from SMU base and Bit position in the register
+- clocks: Parent clocks. Input clocks as described in clock-bindings.txt
+- #clock-cells: Should be <0>
+
+* SMU_GCLK
+Clock gating node shown as "Clock stop processing block" in the
+fig."Clock System Overview" of the manual.
+Registers are "xxx clock gate control register" (XXXGCLKCTRL).
+
+Required properties:
+- compatible: Should be "renesas,emev2-smu-gclk"
+- reg: Byte offset from SMU base and Bit position in the register
+- clocks: Input clock as described in clock-bindings.txt
+- #clock-cells: Should be <0>
+
+Example of provider:
+
+usia_u0_sclkdiv: usia_u0_sclkdiv {
+ compatible = "renesas,emev2-smu-clkdiv";
+ reg = <0x610 0>;
+ clocks = <&pll3_fo>, <&pll4_fo>, <&pll1_fo>, <&osc1_fo>;
+ #clock-cells = <0>;
+};
+
+usia_u0_sclk: usia_u0_sclk {
+ compatible = "renesas,emev2-smu-gclk";
+ reg = <0x4a0 1>;
+ clocks = <&usia_u0_sclkdiv>;
+ #clock-cells = <0>;
+};
+
+Example of consumer:
+
+uart at e1020000 {
+ compatible = "renesas,em-uart";
+ reg = <0xe1020000 0x38>;
+ interrupts = <0 8 0>;
+ clocks = <&usia_u0_sclk>;
+ clock-names = "sclk";
+};
+
+Example of clock-tree description:
+
+ This describes a clock path in the clock tree
+ c32ki -> pll3_fo -> usia_u0_sclkdiv -> usia_u0_sclk
+
+smu at e0110000 {
+ compatible = "renesas,emev2-smu";
+ reg = <0xe0110000 0x10000>;
+ #address-cells = <2>;
+ #size-cells = <0>;
+
+ c32ki: c32ki {
+ compatible = "fixed-clock";
+ clock-frequency = <32768>;
+ #clock-cells = <0>;
+ };
+ pll3_fo: pll3_fo {
+ compatible = "fixed-factor-clock";
+ clocks = <&c32ki>;
+ clock-div = <1>;
+ clock-mult = <7000>;
+ #clock-cells = <0>;
+ };
+ usia_u0_sclkdiv: usia_u0_sclkdiv {
+ compatible = "renesas,emev2-smu-clkdiv";
+ reg = <0x610 0>;
+ clocks = <&pll3_fo>;
+ #clock-cells = <0>;
+ };
+ usia_u0_sclk: usia_u0_sclk {
+ compatible = "renesas,emev2-smu-gclk";
+ reg = <0x4a0 1>;
+ clocks = <&usia_u0_sclkdiv>;
+ #clock-cells = <0>;
+ };
+};
diff --git a/drivers/clk/shmobile/Makefile b/drivers/clk/shmobile/Makefile
index 706adc6..9ecef14 100644
--- a/drivers/clk/shmobile/Makefile
+++ b/drivers/clk/shmobile/Makefile
@@ -1,7 +1,7 @@
+obj-$(CONFIG_ARCH_EMEV2) += clk-emev2.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
obj-$(CONFIG_ARCH_SHMOBILE_MULTI) += clk-mstp.o
-
# for emply built-in.o
obj-n := dummy
diff --git a/drivers/clk/shmobile/clk-emev2.c b/drivers/clk/shmobile/clk-emev2.c
new file mode 100644
index 0000000..6c7c929
--- /dev/null
+++ b/drivers/clk/shmobile/clk-emev2.c
@@ -0,0 +1,104 @@
+/*
+ * EMMA Mobile EV2 common clock framework support
+ *
+ * Copyright (C) 2013 Takashi Yoshii <takashi.yoshii.ze@renesas.com>
+ * Copyright (C) 2012 Magnus Damm
+ *
+ * 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.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+#include <linux/clk-provider.h>
+#include <linux/clkdev.h>
+#include <linux/io.h>
+#include <linux/of.h>
+#include <linux/of_address.h>
+
+/* EMEV2 SMU registers */
+#define USIAU0_RSTCTRL 0x094
+#define USIBU1_RSTCTRL 0x0ac
+#define USIBU2_RSTCTRL 0x0b0
+#define USIBU3_RSTCTRL 0x0b4
+#define STI_RSTCTRL 0x124
+#define STI_CLKSEL 0x688
+
+static DEFINE_SPINLOCK(lock);
+
+/* not pretty, but hey */
+void __iomem *smu_base;
+
+static void __init emev2_smu_write(unsigned long value, int offs)
+{
+ BUG_ON(!smu_base || (offs >= PAGE_SIZE));
+ writel_relaxed(value, smu_base + offs);
+}
+
+static const struct of_device_id smu_id[] __initconst = {
+ { .compatible = "renesas,emev2-smu", },
+ {},
+};
+
+static void __init emev2_smu_init(void)
+{
+ struct device_node *np;
+
+ np = of_find_matching_node(NULL, smu_id);
+ BUG_ON(!np);
+ smu_base = of_iomap(np, 0);
+ BUG_ON(!smu_base);
+ of_node_put(np);
+
+ /* setup STI timer to run on 32.768 kHz and deassert reset */
+ emev2_smu_write(0, STI_CLKSEL);
+ emev2_smu_write(1, STI_RSTCTRL);
+
+ /* deassert reset for UART0->UART3 */
+ emev2_smu_write(2, USIAU0_RSTCTRL);
+ emev2_smu_write(2, USIBU1_RSTCTRL);
+ emev2_smu_write(2, USIBU2_RSTCTRL);
+ emev2_smu_write(2, USIBU3_RSTCTRL);
+}
+
+static void __init emev2_smu_clkdiv_init(struct device_node *np)
+{
+ u32 reg[2];
+ struct clk *clk;
+ const char *parent_name = of_clk_get_parent_name(np, 0);
+ if (WARN_ON(of_property_read_u32_array(np, "reg", reg, 2)))
+ return;
+ if (!smu_base)
+ emev2_smu_init();
+ clk = clk_register_divider(NULL, np->name, parent_name, 0,
+ smu_base + reg[0], reg[1], 8, 0, &lock);
+ of_clk_add_provider(np, of_clk_src_simple_get, clk);
+ clk_register_clkdev(clk, np->name, NULL);
+ pr_debug("## %s %s %p\n", __func__, np->name, clk);
+}
+CLK_OF_DECLARE(emev2_smu_clkdiv, "renesas,emev2-smu-clkdiv",
+ emev2_smu_clkdiv_init);
+
+static void __init emev2_smu_gclk_init(struct device_node *np)
+{
+ u32 reg[2];
+ struct clk *clk;
+ const char *parent_name = of_clk_get_parent_name(np, 0);
+ if (WARN_ON(of_property_read_u32_array(np, "reg", reg, 2)))
+ return;
+ if (!smu_base)
+ emev2_smu_init();
+ clk = clk_register_gate(NULL, np->name, parent_name, 0,
+ smu_base + reg[0], reg[1], 0, &lock);
+ of_clk_add_provider(np, of_clk_src_simple_get, clk);
+ clk_register_clkdev(clk, np->name, NULL);
+ pr_debug("## %s %s %p\n", __func__, np->name, clk);
+}
+CLK_OF_DECLARE(emev2_smu_gclk, "renesas,emev2-smu-gclk", emev2_smu_gclk_init);
--
1.8.4
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [GIT PULL] Renesas ARM based SoC Clock updates for v3.14
2013-12-23 1:10 [GIT PULL] Renesas ARM based SoC Clock updates for v3.14 Simon Horman
2013-12-23 1:10 ` [PATCH] clk: emev2: Add support for emev2 SMU clocks with DT Simon Horman
@ 2013-12-23 6:40 ` Mike Turquette
1 sibling, 0 replies; 3+ messages in thread
From: Mike Turquette @ 2013-12-23 6:40 UTC (permalink / raw)
To: linux-arm-kernel
Quoting Simon Horman (2013-12-22 17:10:23)
> Hi Mike,
>
> please consider the following
> Renesas ARM based SoC Clock updates for v3.14.
>
> This pull request is based on your clk-next-shmobile branch.
>
>
> The following changes since commit f94859c215b6d977794108a1a9a101239e393c09:
>
> clk: shmobile: Add MSTP clock support (2013-12-12 19:23:59 -0800)
>
> are available in the git repository at:
>
> git://git.kernel.org/pub/scm/linux/kernel/git/horms/renesas.git tags/renesas-clock-for-v3.14
>
> for you to fetch changes up to 92ca6a8ce97e07206d474da5477d8da4e41bad6c:
>
> clk: emev2: Add support for emev2 SMU clocks with DT (2013-12-14 13:17:55 +0900)
Pulled into clk-next.
Thanks!
Mike
>
> ----------------------------------------------------------------
> Renesas ARM based SoC Clock updates for v3.14
>
> Add support for using emev2 SMU clocks with DT
>
> ----------------------------------------------------------------
> Takashi Yoshii (1):
> clk: emev2: Add support for emev2 SMU clocks with DT
>
> .../devicetree/bindings/clock/emev2-clock.txt | 98 +++++++++++++++++++
> drivers/clk/shmobile/Makefile | 2 +-
> drivers/clk/shmobile/clk-emev2.c | 104 +++++++++++++++++++++
> 3 files changed, 203 insertions(+), 1 deletion(-)
> create mode 100644 Documentation/devicetree/bindings/clock/emev2-clock.txt
> create mode 100644 drivers/clk/shmobile/clk-emev2.c
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2013-12-23 6:40 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-12-23 1:10 [GIT PULL] Renesas ARM based SoC Clock updates for v3.14 Simon Horman
2013-12-23 1:10 ` [PATCH] clk: emev2: Add support for emev2 SMU clocks with DT Simon Horman
2013-12-23 6:40 ` [GIT PULL] Renesas ARM based SoC Clock updates for v3.14 Mike Turquette
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).