Re: [PATCH v5 4/5] clk/exynos5260: add macros and documentation for exynos5260

2014-03-13 Thread Tomasz Figa

Hi Rahul,

On 12.03.2014 15:56, Rahul Sharma wrote:

Add macros which are used as Clock IDs in DT and clock file.
It also adds the documentation for the exynos5260 clocks.

Signed-off-by: Rahul Sharma 
---
  .../devicetree/bindings/clock/exynos5260-clock.txt |   55 +
  include/dt-bindings/clock/exynos5260-clk.h |  233 
  2 files changed, 288 insertions(+)
  create mode 100644 
Documentation/devicetree/bindings/clock/exynos5260-clock.txt
  create mode 100644 include/dt-bindings/clock/exynos5260-clk.h

diff --git a/Documentation/devicetree/bindings/clock/exynos5260-clock.txt 
b/Documentation/devicetree/bindings/clock/exynos5260-clock.txt
new file mode 100644
index 000..4128892
--- /dev/null
+++ b/Documentation/devicetree/bindings/clock/exynos5260-clock.txt
@@ -0,0 +1,55 @@
+* Samsung Exynos5260 Clock Controller
+
+The Exynos5260 clock controller encapsulate all CMUs which are


s/encapsulate/encapsulates/

Anyway, I don't think there is any global clock controller entity that 
should be described here. The binding is related to several separate 
entities found on Exynos5260, i.e. particular CMUs.



+instantiaited independently from the device-tree. As a whole, these


s/instantiaited/instantiated/
s/the device-tree/device tree/


+CMUs generates and supplies clocks to various controllers within


s/generates/generate/
s/supplies/supply/


+the Exynos5260 SoC.
+
+Required Properties:
+
+- compatible: should be one of the following.
+   "exynos5260-clock-top"
+   "exynos5260-clock-peri"
+   "exynos5260-clock-egl"
+   "exynos5260-clock-kfc"
+   "exynos5260-clock-g2d"
+   "exynos5260-clock-mif"
+   "exynos5260-clock-mfc"
+   "exynos5260-clock-g3d"
+   "exynos5260-clock-fsys"
+   "exynos5260-clock-aud"
+   "exynos5260-clock-isp"
+   "exynos5260-clock-gscl"
+   "exynos5260-clock-disp"


Compatible strings should be prefixed with Samsung's vendor prefix, i.e. 
"samsung,".



+
+- reg: physical base address of the controller and length of memory mapped
+  region.
+
+- #clock-cells: should be 1.


As implemented in patch [1] the clock core will be able to sort out 
dependencies between particular clock providers based on clock consumer 
bindings. This means that it would be a good idea to add clock 
properties to this binding and strictly specify which clocks outside 
particular CMU block are fed into the block.


So for example, if CMU TOP uses fin_pll clock, its node would need to 
have "clock-names" property with "fin_pll" entry and "clocks" property 
with respective entry pointing to the fixed rate clock node.


In general, all external, IO and PHY clocks fed into CMU blocks should 
be listed this way to have dependencies between clocks properly defined 
in the system.


[1] http://thread.gmane.org/gmane.linux.kernel/1654635


+
+The following is the list of clocks generated by each controller.


There is no list below. IMHO this sentence should be removed.


Each
+clock is assigned with a MACRO constant. These constants are defined in
+"dt-bindings/clk/exynos5260-clk.h". DT client nodes use this MACRO to
+specify the clock, which they want to consume.


IMHO the whole paragraph above can be rewritten taking 
samsung,s3c64xx-clock.txt as an example:


Each clock is assigned an identifier and client nodes can use this 
identifier to specify the clock which they consume. All available clocks 
are defined as preprocessor macros in dt-bindings/clock/exynos5260-clk.h 
header and can be used in device tree sources.


In addition to the above, a list of external clocks that need or may be 
present should be added. Again, see samsung,s3c64xx-clock.txt for an 
example.



+
+Example 1: An example of a clock controller node is listed below.
+
+   cmu_disp: clock-controller@0x1455 {
+   compatible = "exynos5260-clock-disp";


Incorrect compatible string.


+   reg = <0x1455 0x1>;
+   #clock-cells = <1>;
+   };
+
+Example 2: UART controller node that consumes the clock generated by the
+   peri clock controller. Refer to the standard clock bindings for
+   information about 'clocks' and 'clock-names' property.
+
+   serial@12C0 {
+   compatible = "samsung,exynos4210-uart";
+   reg = <0x12C0 0x100>;
+   interrupts = <0 146 0>;
+   clocks = <&clock_peri PERI_PCLK_UART0>, <&clock_peri 
PERI_SCLK_UART0>;
+   clock-names = "uart", "clk_uart_baud0";
+   status = "disabled";
+   };
+
diff --git a/include/dt-bindings/clock/exynos5260-clk.h 
b/include/dt-bindings/clock/exynos5260-clk.h
new file mode 100644
index 000..d6f4391
--- /dev/null
+++ b/include/dt-bindings/clock/exynos5260-clk.h
@@ -0,0 +1,233 @@
+/*
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General

Re: [PATCH v5 4/5] clk/exynos5260: add macros and documentation for exynos5260

2014-03-12 Thread Rahul Sharma
On 13 March 2014 06:53, Pankaj Dubey  wrote:
> Hi Rahul,
>
>
> On 03/12/2014 11:56 PM, Rahul Sharma wrote:
>>
>> Add macros which are used as Clock IDs in DT and clock file.
>> It also adds the documentation for the exynos5260 clocks.
>>
>> Signed-off-by: Rahul Sharma 
>> ---
>>   .../devicetree/bindings/clock/exynos5260-clock.txt |   55 +
>>   include/dt-bindings/clock/exynos5260-clk.h |  233
>> 
>>   2 files changed, 288 insertions(+)
>>   create mode 100644
>> Documentation/devicetree/bindings/clock/exynos5260-clock.txt
>>   create mode 100644 include/dt-bindings/clock/exynos5260-clk.h
>>
>> diff --git a/Documentation/devicetree/bindings/clock/exynos5260-clock.txt
>> b/Documentation/devicetree/bindings/clock/exynos5260-clock.txt
>> new file mode 100644
>> index 000..4128892
>> --- /dev/null
>> +++ b/Documentation/devicetree/bindings/clock/exynos5260-clock.txt
>> @@ -0,0 +1,55 @@
>> +* Samsung Exynos5260 Clock Controller
>> +
>> +The Exynos5260 clock controller encapsulate all CMUs which are
>> +instantiaited independently from the device-tree. As a whole, these
>> +CMUs generates and supplies clocks to various controllers within
>> +the Exynos5260 SoC.
>> +
>> +Required Properties:
>> +
>> +- compatible: should be one of the following.
>> +   "exynos5260-clock-top"
>> +   "exynos5260-clock-peri"
>> +   "exynos5260-clock-egl"
>> +   "exynos5260-clock-kfc"
>> +   "exynos5260-clock-g2d"
>> +   "exynos5260-clock-mif"
>> +   "exynos5260-clock-mfc"
>> +   "exynos5260-clock-g3d"
>> +   "exynos5260-clock-fsys"
>> +   "exynos5260-clock-aud"
>> +   "exynos5260-clock-isp"
>> +   "exynos5260-clock-gscl"
>> +   "exynos5260-clock-disp"
>> +
>> +- reg: physical base address of the controller and length of memory
>> mapped
>> +  region.
>> +
>> +- #clock-cells: should be 1.
>> +
>> +The following is the list of clocks generated by each controller. Each
>> +clock is assigned with a MACRO constant. These constants are defined in
>> +"dt-bindings/clk/exynos5260-clk.h". DT client nodes use this MACRO to
>
>
> nit: s/clk/clock
>

Oops. I will change this.

>
>> +specify the clock, which they want to consume.
>> +
>> +Example 1: An example of a clock controller node is listed below.
>> +
>> +   cmu_disp: clock-controller@0x1455 {
>> +   compatible = "exynos5260-clock-disp";
>> +   reg = <0x1455 0x1>;
>> +   #clock-cells = <1>;
>> +   };
>> +
>> +Example 2: UART controller node that consumes the clock generated by the
>> +   peri clock controller. Refer to the standard clock
>> bindings for
>> +   information about 'clocks' and 'clock-names' property.
>> +
>> +   serial@12C0 {
>> +   compatible = "samsung,exynos4210-uart";
>> +   reg = <0x12C0 0x100>;
>> +   interrupts = <0 146 0>;
>> +   clocks = <&clock_peri PERI_PCLK_UART0>, <&clock_peri
>> PERI_SCLK_UART0>;
>> +   clock-names = "uart", "clk_uart_baud0";
>> +   status = "disabled";
>> +   };
>
>
> Isn't it better that we should add binding information about fixed-clocks
> (phyclocks and ioclks) here?
>

Binding for "fixed-clocks" are applicable for the above clocks. We don't
need to add them here. Did you mean something different ?

>
>> +
>> diff --git a/include/dt-bindings/clock/exynos5260-clk.h
>> b/include/dt-bindings/clock/exynos5260-clk.h
>> new file mode 100644
>> index 000..d6f4391
>> --- /dev/null
>> +++ b/include/dt-bindings/clock/exynos5260-clk.h
>> @@ -0,0 +1,233 @@
>> +/*
>> + * Copyright (c) 2014 Samsung Electronics Co., Ltd.
>> + *
>> + * 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.
>> + *
>> + * Provides Constants for Exynos5260 clocks.
>> +*/
>> +
>> +#ifndef _DT_BINDINGS_CLK_EXYNOS5260_H
>> +#define _DT_BINDINGS_CLK_EXYNOS5260_H
>> +
>> +/*
>> + * Clock names:X_YY_
>> + * |---| || |--|
>> + *  cmu   type   IP
>> + */
>> +
>> +/* List Of Clocks For CMU_TOP */
>> +#define FIN_PLL1
>
>
> This should be removed now.
>
>
>> +#define TOP_FOUT_DISP_PLL  2
>> +#define TOP_FOUT_AUD_PLL   3
>> +#define TOP_SCLK_MMC0  4
>> +#define TOP_SCLK_MMC1  5
>> +#define TOP_SCLK_MMC2  6
>> +#define TOP_SCLK_HDMIPHY   7
>> +#define TOP_SCLK_FIMD1 8
>> +#define TOP_MOUT_FIMD1 9
>> +#define TOP_MOUT_DISP_PLL  10
>> +#define TOP_HDMI_PHY_PIXEL_CLKO11
>
>
yea, I will remove these 2.
>
>
>> +#define TOP_NR_CLK 12
>> +
>> +/* List Of Clocks For CMU_EGL */
>> +#define EGL_FOUT_EGL_PLL   1
>> +#define EGL_FOUT_EGL_DPLL  2
>> +#define EGL_NR_CLK 3
>> +
>> +/* List Of Clocks For CMU_KFC */
>> +#define KFC_FOUT_KFC_PLL 

Re: [PATCH v5 4/5] clk/exynos5260: add macros and documentation for exynos5260

2014-03-12 Thread Pankaj Dubey

Hi Rahul,

On 03/12/2014 11:56 PM, Rahul Sharma wrote:

Add macros which are used as Clock IDs in DT and clock file.
It also adds the documentation for the exynos5260 clocks.

Signed-off-by: Rahul Sharma 
---
  .../devicetree/bindings/clock/exynos5260-clock.txt |   55 +
  include/dt-bindings/clock/exynos5260-clk.h |  233 
  2 files changed, 288 insertions(+)
  create mode 100644 
Documentation/devicetree/bindings/clock/exynos5260-clock.txt
  create mode 100644 include/dt-bindings/clock/exynos5260-clk.h

diff --git a/Documentation/devicetree/bindings/clock/exynos5260-clock.txt 
b/Documentation/devicetree/bindings/clock/exynos5260-clock.txt
new file mode 100644
index 000..4128892
--- /dev/null
+++ b/Documentation/devicetree/bindings/clock/exynos5260-clock.txt
@@ -0,0 +1,55 @@
+* Samsung Exynos5260 Clock Controller
+
+The Exynos5260 clock controller encapsulate all CMUs which are
+instantiaited independently from the device-tree. As a whole, these
+CMUs generates and supplies clocks to various controllers within
+the Exynos5260 SoC.
+
+Required Properties:
+
+- compatible: should be one of the following.
+   "exynos5260-clock-top"
+   "exynos5260-clock-peri"
+   "exynos5260-clock-egl"
+   "exynos5260-clock-kfc"
+   "exynos5260-clock-g2d"
+   "exynos5260-clock-mif"
+   "exynos5260-clock-mfc"
+   "exynos5260-clock-g3d"
+   "exynos5260-clock-fsys"
+   "exynos5260-clock-aud"
+   "exynos5260-clock-isp"
+   "exynos5260-clock-gscl"
+   "exynos5260-clock-disp"
+
+- reg: physical base address of the controller and length of memory mapped
+  region.
+
+- #clock-cells: should be 1.
+
+The following is the list of clocks generated by each controller. Each
+clock is assigned with a MACRO constant. These constants are defined in
+"dt-bindings/clk/exynos5260-clk.h". DT client nodes use this MACRO to


nit: s/clk/clock


+specify the clock, which they want to consume.
+
+Example 1: An example of a clock controller node is listed below.
+
+   cmu_disp: clock-controller@0x1455 {
+   compatible = "exynos5260-clock-disp";
+   reg = <0x1455 0x1>;
+   #clock-cells = <1>;
+   };
+
+Example 2: UART controller node that consumes the clock generated by the
+   peri clock controller. Refer to the standard clock bindings for
+   information about 'clocks' and 'clock-names' property.
+
+   serial@12C0 {
+   compatible = "samsung,exynos4210-uart";
+   reg = <0x12C0 0x100>;
+   interrupts = <0 146 0>;
+   clocks = <&clock_peri PERI_PCLK_UART0>, <&clock_peri 
PERI_SCLK_UART0>;
+   clock-names = "uart", "clk_uart_baud0";
+   status = "disabled";
+   };


Isn't it better that we should add binding information about fixed-clocks 
(phyclocks and ioclks) here?



+
diff --git a/include/dt-bindings/clock/exynos5260-clk.h 
b/include/dt-bindings/clock/exynos5260-clk.h
new file mode 100644
index 000..d6f4391
--- /dev/null
+++ b/include/dt-bindings/clock/exynos5260-clk.h
@@ -0,0 +1,233 @@
+/*
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+ *
+ * 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.
+ *
+ * Provides Constants for Exynos5260 clocks.
+*/
+
+#ifndef _DT_BINDINGS_CLK_EXYNOS5260_H
+#define _DT_BINDINGS_CLK_EXYNOS5260_H
+
+/*
+ * Clock names:X_YY_
+ * |---| || |--|
+ *  cmu   type   IP
+ */
+
+/* List Of Clocks For CMU_TOP */
+#define FIN_PLL1


This should be removed now.


+#define TOP_FOUT_DISP_PLL  2
+#define TOP_FOUT_AUD_PLL   3
+#define TOP_SCLK_MMC0  4
+#define TOP_SCLK_MMC1  5
+#define TOP_SCLK_MMC2  6
+#define TOP_SCLK_HDMIPHY   7
+#define TOP_SCLK_FIMD1 8
+#define TOP_MOUT_FIMD1 9
+#define TOP_MOUT_DISP_PLL  10
+#define TOP_HDMI_PHY_PIXEL_CLKO11


ditto.


+#define TOP_NR_CLK 12
+
+/* List Of Clocks For CMU_EGL */
+#define EGL_FOUT_EGL_PLL   1
+#define EGL_FOUT_EGL_DPLL  2
+#define EGL_NR_CLK 3
+
+/* List Of Clocks For CMU_KFC */
+#define KFC_FOUT_KFC_PLL   1
+#define KFC_NR_CLK 2
+
+/* List Of Clocks For CMU_MIF */
+#define MIF_FOUT_MEM_PLL   1
+#define MIF_FOUT_BUS_PLL   2
+#define MIF_FOUT_MEDIA_PLL 3
+#define MIF_NR_CLK 4
+
+/* List Of Clocks For CMU_G3D */
+#define G3D_FOUT_G3D_PLL   1
+#define G3D_CLK_G3D_HPM2
+#define G3D_CLK_G3D3
+#define G3D_NR_CLK 4
+
+/* List Of Clocks For CMU_AUD */
+#define AUD_CLK_AUD_UART   1
+#define AUD_CLK_PCM2
+#define AUD_CLK_I2S3
+#define AUD_CLK_DMAC   4
+#define AUD_SCLK_AUD_UART  5
+#define AUD_SCLK_PCM 

[PATCH v5 4/5] clk/exynos5260: add macros and documentation for exynos5260

2014-03-12 Thread Rahul Sharma
Add macros which are used as Clock IDs in DT and clock file.
It also adds the documentation for the exynos5260 clocks.

Signed-off-by: Rahul Sharma 
---
 .../devicetree/bindings/clock/exynos5260-clock.txt |   55 +
 include/dt-bindings/clock/exynos5260-clk.h |  233 
 2 files changed, 288 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/clock/exynos5260-clock.txt
 create mode 100644 include/dt-bindings/clock/exynos5260-clk.h

diff --git a/Documentation/devicetree/bindings/clock/exynos5260-clock.txt 
b/Documentation/devicetree/bindings/clock/exynos5260-clock.txt
new file mode 100644
index 000..4128892
--- /dev/null
+++ b/Documentation/devicetree/bindings/clock/exynos5260-clock.txt
@@ -0,0 +1,55 @@
+* Samsung Exynos5260 Clock Controller
+
+The Exynos5260 clock controller encapsulate all CMUs which are
+instantiaited independently from the device-tree. As a whole, these
+CMUs generates and supplies clocks to various controllers within
+the Exynos5260 SoC.
+
+Required Properties:
+
+- compatible: should be one of the following.
+   "exynos5260-clock-top"
+   "exynos5260-clock-peri"
+   "exynos5260-clock-egl"
+   "exynos5260-clock-kfc"
+   "exynos5260-clock-g2d"
+   "exynos5260-clock-mif"
+   "exynos5260-clock-mfc"
+   "exynos5260-clock-g3d"
+   "exynos5260-clock-fsys"
+   "exynos5260-clock-aud"
+   "exynos5260-clock-isp"
+   "exynos5260-clock-gscl"
+   "exynos5260-clock-disp"
+
+- reg: physical base address of the controller and length of memory mapped
+  region.
+
+- #clock-cells: should be 1.
+
+The following is the list of clocks generated by each controller. Each
+clock is assigned with a MACRO constant. These constants are defined in
+"dt-bindings/clk/exynos5260-clk.h". DT client nodes use this MACRO to
+specify the clock, which they want to consume.
+
+Example 1: An example of a clock controller node is listed below.
+
+   cmu_disp: clock-controller@0x1455 {
+   compatible = "exynos5260-clock-disp";
+   reg = <0x1455 0x1>;
+   #clock-cells = <1>;
+   };
+
+Example 2: UART controller node that consumes the clock generated by the
+   peri clock controller. Refer to the standard clock bindings for
+   information about 'clocks' and 'clock-names' property.
+
+   serial@12C0 {
+   compatible = "samsung,exynos4210-uart";
+   reg = <0x12C0 0x100>;
+   interrupts = <0 146 0>;
+   clocks = <&clock_peri PERI_PCLK_UART0>, <&clock_peri 
PERI_SCLK_UART0>;
+   clock-names = "uart", "clk_uart_baud0";
+   status = "disabled";
+   };
+
diff --git a/include/dt-bindings/clock/exynos5260-clk.h 
b/include/dt-bindings/clock/exynos5260-clk.h
new file mode 100644
index 000..d6f4391
--- /dev/null
+++ b/include/dt-bindings/clock/exynos5260-clk.h
@@ -0,0 +1,233 @@
+/*
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+ *
+ * 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.
+ *
+ * Provides Constants for Exynos5260 clocks.
+*/
+
+#ifndef _DT_BINDINGS_CLK_EXYNOS5260_H
+#define _DT_BINDINGS_CLK_EXYNOS5260_H
+
+/*
+ * Clock names:X_YY_
+ * |---| || |--|
+ *  cmu   type   IP
+ */
+
+/* List Of Clocks For CMU_TOP */
+#define FIN_PLL1
+#define TOP_FOUT_DISP_PLL  2
+#define TOP_FOUT_AUD_PLL   3
+#define TOP_SCLK_MMC0  4
+#define TOP_SCLK_MMC1  5
+#define TOP_SCLK_MMC2  6
+#define TOP_SCLK_HDMIPHY   7
+#define TOP_SCLK_FIMD1 8
+#define TOP_MOUT_FIMD1 9
+#define TOP_MOUT_DISP_PLL  10
+#define TOP_HDMI_PHY_PIXEL_CLKO11
+#define TOP_NR_CLK 12
+
+/* List Of Clocks For CMU_EGL */
+#define EGL_FOUT_EGL_PLL   1
+#define EGL_FOUT_EGL_DPLL  2
+#define EGL_NR_CLK 3
+
+/* List Of Clocks For CMU_KFC */
+#define KFC_FOUT_KFC_PLL   1
+#define KFC_NR_CLK 2
+
+/* List Of Clocks For CMU_MIF */
+#define MIF_FOUT_MEM_PLL   1
+#define MIF_FOUT_BUS_PLL   2
+#define MIF_FOUT_MEDIA_PLL 3
+#define MIF_NR_CLK 4
+
+/* List Of Clocks For CMU_G3D */
+#define G3D_FOUT_G3D_PLL   1
+#define G3D_CLK_G3D_HPM2
+#define G3D_CLK_G3D3
+#define G3D_NR_CLK 4
+
+/* List Of Clocks For CMU_AUD */
+#define AUD_CLK_AUD_UART   1
+#define AUD_CLK_PCM2
+#define AUD_CLK_I2S3
+#define AUD_CLK_DMAC   4
+#define AUD_SCLK_AUD_UART  5
+#define AUD_SCLK_PCM   6
+#define AUD_SCLK_I2S   7
+#define AUD_NR_CLK 8
+
+/* List Of Clocks For CMU_MFC */
+#define MFC_CLK_MFC1
+#define MFC_CLK_SMMU2_MFCM12
+#define MFC_CLK_SMMU2_MFCM03
+#define MFC_NR_CLK