Re: [PATCH v3 5/6] clk: samsung: Add clock driver for s5pc110/s5pv210

2013-08-29 Thread Tomasz Figa
Hi Mateusz,

On Wednesday 28 of August 2013 18:13:03 Mateusz Krawczuk wrote:
 This patch adds new, Common Clock Framework-based clock driver for
 Samsung S5PV210 SoCs. The driver is just added, without enabling it yet.
 
 Signed-off-by: Mateusz Krawczuk m.krawc...@partner.samsung.com
 ---
  .../bindings/clock/samsung,s5pv210-clock.txt   |  72 ++
  drivers/clk/samsung/Makefile   |   3 +
  drivers/clk/samsung/clk-s5pv210.c  | 732
 + include/dt-bindings/clock/samsung,s5pv210-clock.h 
 | 221 +++ 4 files changed, 1028 insertions(+)
  create mode 100644
 Documentation/devicetree/bindings/clock/samsung,s5pv210-clock.txt create
 mode 100644 drivers/clk/samsung/clk-s5pv210.c
  create mode 100644 include/dt-bindings/clock/samsung,s5pv210-clock.h
 
 diff --git
 a/Documentation/devicetree/bindings/clock/samsung,s5pv210-clock.txt
 b/Documentation/devicetree/bindings/clock/samsung,s5pv210-clock.txt new
 file mode 100644
 index 000..753c8f9
 --- /dev/null
 +++ b/Documentation/devicetree/bindings/clock/samsung,s5pv210-clock.txt
 @@ -0,0 +1,72 @@
 +* Samsung S5PC110/S5PV210 Clock Controller
 +
 +The S5PV210 clock controller generates and supplies clock to various
 controllers +within the SoC. The clock binding described here is
 applicable to all SoCs in +the S5PC110/S5PV210 family.
 +
 +Required Properties:
 +
 +- compatible: should be one of the following.
 +  - samsung,s5pv210-clock - controller compatible with S5PC110/S5PV210
 SoC. +
 +- reg: physical base address of the controller and length of memory
 mapped +  region.
 +
 +- #clock-cells: should be 1.
 +
 +Each clock is assigned an identifier and client nodes can use this
 identifier +to specify the clock which they consume. Some of the clocks
 are available only +on a particular S5PC110/S5PV210 SoC and this is
 specified where applicable. +
 +All available clocks are defined as preprocessor macros in
 +dt-bindings/clock/samsung,s5pv210-clock.h header and can be used in
 device +tree sources.
 +
 +External clocks:
 +
 +There are several clocks that are generated outside the SoC. It is
 expected +that they are defined using standard clock bindings with
 following +clock-output-names:
 + - xxti- xtal - required
 + - xusbxti - USB xtal - required,

Hmm, I'm not sure if all the boards must always provide both of them. 
Actually it looks like the correct statement here would be At least one of 
the above clocks should be specified..

 +
 +
 +Example: Clock controller node:
 +
 + clock: clock-controller@7e00f000 {
 + compatible = samsung,s5pv210-clock;
 + reg = 0x7e00f000 0x1000;
 + #clock-cells = 1;
 + };
 +
 +Example: Required external clocks:
 +
 + fin_pll: clock-xxti {
 + compatible = fixed-clock;
 + clock-output-names = xxti;
 + clock-frequency = 1200;
 + #clock-cells = 0;
 + };
 +
 + xusbxti: clock-xusbxti {
 + compatible = fixed-clock;
 + clock-output-names = xusbxti;
 + clock-frequency = 4800;
 + #clock-cells = 0;
 + };
 +
 +Example: UART controller node that consumes the clock generated by the
 clock +  controller (refer to the standard clock bindings for
 information about +  clocks and clock-names properties):
 +
 + uart0: serial@7f005000 {
 + compatible = samsung,s5pv210-uart;
 + reg = 0x7f005000 0x100;
 + interrupt-parent = vic1;
 + interrupts = 5;
 + clock-names = uart, clk_uart_baud2,
 + clk_uart_baud3;
 + clocks = clock PCLK_UART0, clocks PCLK_UART0,
 + clock SCLK_UART;
 + status = disabled;
 + };
 \ No newline at end of file
 diff --git a/drivers/clk/samsung/Makefile b/drivers/clk/samsung/Makefile
 index 8eb4799..e08c45e 100644
 --- a/drivers/clk/samsung/Makefile
 +++ b/drivers/clk/samsung/Makefile
 @@ -9,3 +9,6 @@ obj-$(CONFIG_SOC_EXYNOS5420)  += clk-exynos5420.o
  obj-$(CONFIG_SOC_EXYNOS5440) += clk-exynos5440.o
  obj-$(CONFIG_ARCH_EXYNOS)+= clk-exynos-audss.o
  obj-$(CONFIG_ARCH_S3C64XX)   += clk-s3c64xx.o
 +ifeq ($(CONFIG_COMMON_CLK), y)
 +obj-$(CONFIG_ARCH_S5PV210)   += clk-s5pv210.o
 +endif
 \ No newline at end of file
 diff --git a/drivers/clk/samsung/clk-s5pv210.c
 b/drivers/clk/samsung/clk-s5pv210.c new file mode 100644
 index 000..1c5ea5c
 --- /dev/null
 +++ b/drivers/clk/samsung/clk-s5pv210.c
 @@ -0,0 +1,732 @@
 +/*
 + * Copyright (c) 2013 Samsung Electronics Co., Ltd.
 + * Author: Mateusz Krawczuk m.krawc...@partner.samsung.com
 + *
 + * This program is free software; you can redistribute it and/or modify
 + * it under the terms of the GNU General Public License version 2 as
 + * published by the Free Software Foundation.
 + *
 + * Common Clock Framework support for all 

[PATCH v3 5/6] clk: samsung: Add clock driver for s5pc110/s5pv210

2013-08-28 Thread Mateusz Krawczuk
This patch adds new, Common Clock Framework-based clock driver for Samsung
S5PV210 SoCs. The driver is just added, without enabling it yet.

Signed-off-by: Mateusz Krawczuk m.krawc...@partner.samsung.com
---
 .../bindings/clock/samsung,s5pv210-clock.txt   |  72 ++
 drivers/clk/samsung/Makefile   |   3 +
 drivers/clk/samsung/clk-s5pv210.c  | 732 +
 include/dt-bindings/clock/samsung,s5pv210-clock.h  | 221 +++
 4 files changed, 1028 insertions(+)
 create mode 100644 
Documentation/devicetree/bindings/clock/samsung,s5pv210-clock.txt
 create mode 100644 drivers/clk/samsung/clk-s5pv210.c
 create mode 100644 include/dt-bindings/clock/samsung,s5pv210-clock.h

diff --git a/Documentation/devicetree/bindings/clock/samsung,s5pv210-clock.txt 
b/Documentation/devicetree/bindings/clock/samsung,s5pv210-clock.txt
new file mode 100644
index 000..753c8f9
--- /dev/null
+++ b/Documentation/devicetree/bindings/clock/samsung,s5pv210-clock.txt
@@ -0,0 +1,72 @@
+* Samsung S5PC110/S5PV210 Clock Controller
+
+The S5PV210 clock controller generates and supplies clock to various 
controllers
+within the SoC. The clock binding described here is applicable to all SoCs in
+the S5PC110/S5PV210 family.
+
+Required Properties:
+
+- compatible: should be one of the following.
+  - samsung,s5pv210-clock - controller compatible with S5PC110/S5PV210 SoC.
+
+- reg: physical base address of the controller and length of memory mapped
+  region.
+
+- #clock-cells: should be 1.
+
+Each clock is assigned an identifier and client nodes can use this identifier
+to specify the clock which they consume. Some of the clocks are available only
+on a particular S5PC110/S5PV210 SoC and this is specified where applicable.
+
+All available clocks are defined as preprocessor macros in
+dt-bindings/clock/samsung,s5pv210-clock.h header and can be used in device
+tree sources.
+
+External clocks:
+
+There are several clocks that are generated outside the SoC. It is expected
+that they are defined using standard clock bindings with following
+clock-output-names:
+ - xxti- xtal - required
+ - xusbxti - USB xtal - required,
+
+
+Example: Clock controller node:
+
+   clock: clock-controller@7e00f000 {
+   compatible = samsung,s5pv210-clock;
+   reg = 0x7e00f000 0x1000;
+   #clock-cells = 1;
+   };
+
+Example: Required external clocks:
+
+   fin_pll: clock-xxti {
+   compatible = fixed-clock;
+   clock-output-names = xxti;
+   clock-frequency = 1200;
+   #clock-cells = 0;
+   };
+
+   xusbxti: clock-xusbxti {
+   compatible = fixed-clock;
+   clock-output-names = xusbxti;
+   clock-frequency = 4800;
+   #clock-cells = 0;
+   };
+
+Example: UART controller node that consumes the clock generated by the clock
+  controller (refer to the standard clock bindings for information about
+  clocks and clock-names properties):
+
+   uart0: serial@7f005000 {
+   compatible = samsung,s5pv210-uart;
+   reg = 0x7f005000 0x100;
+   interrupt-parent = vic1;
+   interrupts = 5;
+   clock-names = uart, clk_uart_baud2,
+   clk_uart_baud3;
+   clocks = clock PCLK_UART0, clocks PCLK_UART0,
+   clock SCLK_UART;
+   status = disabled;
+   };
\ No newline at end of file
diff --git a/drivers/clk/samsung/Makefile b/drivers/clk/samsung/Makefile
index 8eb4799..e08c45e 100644
--- a/drivers/clk/samsung/Makefile
+++ b/drivers/clk/samsung/Makefile
@@ -9,3 +9,6 @@ obj-$(CONFIG_SOC_EXYNOS5420)+= clk-exynos5420.o
 obj-$(CONFIG_SOC_EXYNOS5440)   += clk-exynos5440.o
 obj-$(CONFIG_ARCH_EXYNOS)  += clk-exynos-audss.o
 obj-$(CONFIG_ARCH_S3C64XX) += clk-s3c64xx.o
+ifeq ($(CONFIG_COMMON_CLK), y)
+obj-$(CONFIG_ARCH_S5PV210) += clk-s5pv210.o
+endif
\ No newline at end of file
diff --git a/drivers/clk/samsung/clk-s5pv210.c 
b/drivers/clk/samsung/clk-s5pv210.c
new file mode 100644
index 000..1c5ea5c
--- /dev/null
+++ b/drivers/clk/samsung/clk-s5pv210.c
@@ -0,0 +1,732 @@
+/*
+ * Copyright (c) 2013 Samsung Electronics Co., Ltd.
+ * Author: Mateusz Krawczuk m.krawc...@partner.samsung.com
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * Common Clock Framework support for all S5PC110/S5PV210 SoCs.
+*/
+
+#include linux/clk.h
+#include linux/clkdev.h
+#include linux/clk-provider.h
+#include linux/of.h
+#include linux/of_address.h
+#include mach/regs-clock.h
+
+#include clk.h
+#include clk-pll.h
+
+#include dt-bindings/clock/samsung,s5pv210-clock.h
+
+/* S5PC110/S5PV210 clock controller