Re: [PATCH 2/7] clk: samsung: Add clock driver for S3C64xx SoCs

2013-06-19 Thread Kukjin Kim

On 06/13/13 06:38, Tomasz Figa wrote:

[...]


Another thing is that it's unlikely for any new SoC from S3C64xx
series to show up, so basically the clock list is fixed.


Sure.  I can take this into clk-next along with patch #1, or if you
prefer:

Acked-by: Mike Turquettemturque...@linaro.org


Thanks.

IMHO with all the remaining platform patches in this series, it should go
through Samsung tree.



Mike, thanks for your ack. Let me take this whole series into samsung 
tree when ready for other dependencies like PWM...


- Kukjin
--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 2/7] clk: samsung: Add clock driver for S3C64xx SoCs

2013-06-12 Thread Tomasz Figa
Hi Mike,

On Tuesday 11 of June 2013 19:54:51 Mike Turquette wrote:
 Quoting Tomasz Figa (2013-06-05 16:57:26)
 
  This patch adds new, Common Clock Framework-based clock driver for
  Samsung S3C64xx SoCs. The driver is just added, without actually
  letting the platforms use it yet, since this requires more
  intermediate steps.
 It seems like there is an awful lot of clock data here that exists
 alongside the stuff in DT.  Is this how you plan to keep things going
 forward or is this conversion just an intermediate step?

Current S3C64xx support contains a lot of boards, for which I don't see 
any chance for DT conversion in any time soon, so the driver must cover 
both DT and non-DT cases. (Not even saying that DT support for S3C64xx is 
not yet submitted, as I want to get all the dependencies merged, or at 
least acked, first.)

Also, personally, I don't see anything wrong with having those clocks 
defined in the driver. The binding specifies the exact mapping between 
clock IDs inside the clock provider and hardware clocks and not all clocks 
need to be exported (most of muxes and divs don't need to), so I find it 
more reasonable to define them in the driver instead.

Another thing is that it's unlikely for any new SoC from S3C64xx series to 
show up, so basically the clock list is fixed.

Best regards,
Tomasz

 Regards,
 Mike
 
  Signed-off-by: Tomasz Figa tomasz.f...@gmail.com
  ---
  
   .../bindings/clock/samsung,s3c64xx-clock.txt   |  48 ++
   drivers/clk/samsung/Makefile   |   3 +
   drivers/clk/samsung/clk-s3c64xx.c  | 503
   +
   include/dt-bindings/clock/samsung,s3c64xx-clock.h  | 144 ++ 4
   files changed, 698 insertions(+)
   create mode 100644
   Documentation/devicetree/bindings/clock/samsung,s3c64xx-clock.txt
   create mode 100644 drivers/clk/samsung/clk-s3c64xx.c
   create mode 100644 include/dt-bindings/clock/samsung,s3c64xx-clock.h
  
  diff --git
  a/Documentation/devicetree/bindings/clock/samsung,s3c64xx-clock.txt
  b/Documentation/devicetree/bindings/clock/samsung,s3c64xx-clock.txt
  new file mode 100644
  index 000..278ab6e
  --- /dev/null
  +++
  b/Documentation/devicetree/bindings/clock/samsung,s3c64xx-clock.txt
  @@ -0,0 +1,48 @@
  +* Samsung S3C64xx Clock Controller
  +
  +The S3C64xx clock controller generates and supplies clock to various
  controllers +within the SoC. The clock binding described here is
  applicable to all SoCs in +the S3C64xx family.
  +
  +Required Properties:
  +
  +- comptible: should be one of the following.
  +  - samsung,s3c6400-clock - controller compatible with S3C6400 SoC.
  +  - samsung,s3c6410-clock - controller compatible with S3C6410 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 S3C64xx SoC and this is
  specified where applicable. +
  +All available clocks are defined as preprocessor macros in
  +dt-bindings/clock/samsung,s3c64xx-clock.h header and can be used in
  device +tree sources.
  +
  +Example: Clock controller node:
  +
  +   clocks: clock-controller@7e00f000 {
  +   compatible = samsung,s3c6410-clock;
  +   reg = 0x7e00f000 0x1000;
  +   #clock-cells = 1;
  +   };
  +
  +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,s3c6400-uart;
  +   reg = 0x7f005000 0x100;
  +   interrupt-parent = vic1;
  +   interrupts = 5;
  +   clock-names = uart, clk_uart_baud2,
  +   clk_uart_baud3;
  +   clocks = clocks PCLK_UART0, clocks
  PCLK_UART0, +   clocks
  SCLK_UART;
  +   status = disabled;
  +   };
  diff --git a/drivers/clk/samsung/Makefile
  b/drivers/clk/samsung/Makefile index b7c232e..c023474 100644
  --- a/drivers/clk/samsung/Makefile
  +++ b/drivers/clk/samsung/Makefile
  @@ -6,3 +6,6 @@ obj-$(CONFIG_COMMON_CLK)+= clk.o clk-pll.o
  
   obj-$(CONFIG_ARCH_EXYNOS4) += clk-exynos4.o
   obj-$(CONFIG_SOC_EXYNOS5250)   += clk-exynos5250.o
   obj-$(CONFIG_SOC_EXYNOS5440)   += clk-exynos5440.o
  
  +ifdef CONFIG_COMMON_CLK
  +obj-$(CONFIG_ARCH_S3C64XX) += clk-s3c64xx.o
  +endif
  diff --git a/drivers/clk/samsung/clk-s3c64xx.c
  b/drivers/clk/samsung/clk-s3c64xx.c new file mode 100644
  index 000..253a972
  --- /dev/null
  +++ b/drivers/clk/samsung/clk-s3c64xx.c
  @@ -0,0 +1,503 @@
  +/*
  + * Copyright (c) 

Re: [PATCH 2/7] clk: samsung: Add clock driver for S3C64xx SoCs

2013-06-11 Thread Mike Turquette
Quoting Tomasz Figa (2013-06-05 16:57:26)
 This patch adds new, Common Clock Framework-based clock driver for Samsung
 S3C64xx SoCs. The driver is just added, without actually letting the
 platforms use it yet, since this requires more intermediate steps.
 

It seems like there is an awful lot of clock data here that exists
alongside the stuff in DT.  Is this how you plan to keep things going
forward or is this conversion just an intermediate step?

Regards,
Mike

 Signed-off-by: Tomasz Figa tomasz.f...@gmail.com
 ---
  .../bindings/clock/samsung,s3c64xx-clock.txt   |  48 ++
  drivers/clk/samsung/Makefile   |   3 +
  drivers/clk/samsung/clk-s3c64xx.c  | 503 
 +
  include/dt-bindings/clock/samsung,s3c64xx-clock.h  | 144 ++
  4 files changed, 698 insertions(+)
  create mode 100644 
 Documentation/devicetree/bindings/clock/samsung,s3c64xx-clock.txt
  create mode 100644 drivers/clk/samsung/clk-s3c64xx.c
  create mode 100644 include/dt-bindings/clock/samsung,s3c64xx-clock.h
 
 diff --git 
 a/Documentation/devicetree/bindings/clock/samsung,s3c64xx-clock.txt 
 b/Documentation/devicetree/bindings/clock/samsung,s3c64xx-clock.txt
 new file mode 100644
 index 000..278ab6e
 --- /dev/null
 +++ b/Documentation/devicetree/bindings/clock/samsung,s3c64xx-clock.txt
 @@ -0,0 +1,48 @@
 +* Samsung S3C64xx Clock Controller
 +
 +The S3C64xx clock controller generates and supplies clock to various 
 controllers
 +within the SoC. The clock binding described here is applicable to all SoCs in
 +the S3C64xx family.
 +
 +Required Properties:
 +
 +- comptible: should be one of the following.
 +  - samsung,s3c6400-clock - controller compatible with S3C6400 SoC.
 +  - samsung,s3c6410-clock - controller compatible with S3C6410 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 S3C64xx SoC and this is specified where applicable.
 +
 +All available clocks are defined as preprocessor macros in
 +dt-bindings/clock/samsung,s3c64xx-clock.h header and can be used in device
 +tree sources.
 +
 +Example: Clock controller node:
 +
 +   clocks: clock-controller@7e00f000 {
 +   compatible = samsung,s3c6410-clock;
 +   reg = 0x7e00f000 0x1000;
 +   #clock-cells = 1;
 +   };
 +
 +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,s3c6400-uart;
 +   reg = 0x7f005000 0x100;
 +   interrupt-parent = vic1;
 +   interrupts = 5;
 +   clock-names = uart, clk_uart_baud2,
 +   clk_uart_baud3;
 +   clocks = clocks PCLK_UART0, clocks PCLK_UART0,
 +   clocks SCLK_UART;
 +   status = disabled;
 +   };
 diff --git a/drivers/clk/samsung/Makefile b/drivers/clk/samsung/Makefile
 index b7c232e..c023474 100644
 --- a/drivers/clk/samsung/Makefile
 +++ b/drivers/clk/samsung/Makefile
 @@ -6,3 +6,6 @@ obj-$(CONFIG_COMMON_CLK)+= clk.o clk-pll.o
  obj-$(CONFIG_ARCH_EXYNOS4) += clk-exynos4.o
  obj-$(CONFIG_SOC_EXYNOS5250)   += clk-exynos5250.o
  obj-$(CONFIG_SOC_EXYNOS5440)   += clk-exynos5440.o
 +ifdef CONFIG_COMMON_CLK
 +obj-$(CONFIG_ARCH_S3C64XX) += clk-s3c64xx.o
 +endif
 diff --git a/drivers/clk/samsung/clk-s3c64xx.c 
 b/drivers/clk/samsung/clk-s3c64xx.c
 new file mode 100644
 index 000..253a972
 --- /dev/null
 +++ b/drivers/clk/samsung/clk-s3c64xx.c
 @@ -0,0 +1,503 @@
 +/*
 + * Copyright (c) 2013 Tomasz Figa tomasz.figa at gmail.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 S3C64xx SoCs.
 +*/
 +
 +#include linux/clk.h
 +#include linux/clkdev.h
 +#include linux/clk-provider.h
 +#include linux/of.h
 +#include linux/of_address.h
 +
 +#include dt-bindings/clock/samsung,s3c64xx-clock.h
 +
 +#include clk.h
 +#include clk-pll.h
 +
 +/* S3C64xx clock controller register offsets. */
 +#define APLL_LOCK  0x000
 +#define MPLL_LOCK  0x004
 +#define EPLL_LOCK  0x008
 +#define APLL_CON   0x00c
 +#define MPLL_CON   0x010
 +#define EPLL_CON0  0x014
 +#define EPLL_CON1  0x018
 +#define CLK_SRC0x01c
 +#define CLK_DIV0   0x020
 +#define CLK_DIV1 

[PATCH 2/7] clk: samsung: Add clock driver for S3C64xx SoCs

2013-06-05 Thread Tomasz Figa
This patch adds new, Common Clock Framework-based clock driver for Samsung
S3C64xx SoCs. The driver is just added, without actually letting the
platforms use it yet, since this requires more intermediate steps.

Signed-off-by: Tomasz Figa tomasz.f...@gmail.com
---
 .../bindings/clock/samsung,s3c64xx-clock.txt   |  48 ++
 drivers/clk/samsung/Makefile   |   3 +
 drivers/clk/samsung/clk-s3c64xx.c  | 503 +
 include/dt-bindings/clock/samsung,s3c64xx-clock.h  | 144 ++
 4 files changed, 698 insertions(+)
 create mode 100644 
Documentation/devicetree/bindings/clock/samsung,s3c64xx-clock.txt
 create mode 100644 drivers/clk/samsung/clk-s3c64xx.c
 create mode 100644 include/dt-bindings/clock/samsung,s3c64xx-clock.h

diff --git a/Documentation/devicetree/bindings/clock/samsung,s3c64xx-clock.txt 
b/Documentation/devicetree/bindings/clock/samsung,s3c64xx-clock.txt
new file mode 100644
index 000..278ab6e
--- /dev/null
+++ b/Documentation/devicetree/bindings/clock/samsung,s3c64xx-clock.txt
@@ -0,0 +1,48 @@
+* Samsung S3C64xx Clock Controller
+
+The S3C64xx clock controller generates and supplies clock to various 
controllers
+within the SoC. The clock binding described here is applicable to all SoCs in
+the S3C64xx family.
+
+Required Properties:
+
+- comptible: should be one of the following.
+  - samsung,s3c6400-clock - controller compatible with S3C6400 SoC.
+  - samsung,s3c6410-clock - controller compatible with S3C6410 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 S3C64xx SoC and this is specified where applicable.
+
+All available clocks are defined as preprocessor macros in
+dt-bindings/clock/samsung,s3c64xx-clock.h header and can be used in device
+tree sources.
+
+Example: Clock controller node:
+
+   clocks: clock-controller@7e00f000 {
+   compatible = samsung,s3c6410-clock;
+   reg = 0x7e00f000 0x1000;
+   #clock-cells = 1;
+   };
+
+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,s3c6400-uart;
+   reg = 0x7f005000 0x100;
+   interrupt-parent = vic1;
+   interrupts = 5;
+   clock-names = uart, clk_uart_baud2,
+   clk_uart_baud3;
+   clocks = clocks PCLK_UART0, clocks PCLK_UART0,
+   clocks SCLK_UART;
+   status = disabled;
+   };
diff --git a/drivers/clk/samsung/Makefile b/drivers/clk/samsung/Makefile
index b7c232e..c023474 100644
--- a/drivers/clk/samsung/Makefile
+++ b/drivers/clk/samsung/Makefile
@@ -6,3 +6,6 @@ obj-$(CONFIG_COMMON_CLK)+= clk.o clk-pll.o
 obj-$(CONFIG_ARCH_EXYNOS4) += clk-exynos4.o
 obj-$(CONFIG_SOC_EXYNOS5250)   += clk-exynos5250.o
 obj-$(CONFIG_SOC_EXYNOS5440)   += clk-exynos5440.o
+ifdef CONFIG_COMMON_CLK
+obj-$(CONFIG_ARCH_S3C64XX) += clk-s3c64xx.o
+endif
diff --git a/drivers/clk/samsung/clk-s3c64xx.c 
b/drivers/clk/samsung/clk-s3c64xx.c
new file mode 100644
index 000..253a972
--- /dev/null
+++ b/drivers/clk/samsung/clk-s3c64xx.c
@@ -0,0 +1,503 @@
+/*
+ * Copyright (c) 2013 Tomasz Figa tomasz.figa at gmail.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 S3C64xx SoCs.
+*/
+
+#include linux/clk.h
+#include linux/clkdev.h
+#include linux/clk-provider.h
+#include linux/of.h
+#include linux/of_address.h
+
+#include dt-bindings/clock/samsung,s3c64xx-clock.h
+
+#include clk.h
+#include clk-pll.h
+
+/* S3C64xx clock controller register offsets. */
+#define APLL_LOCK  0x000
+#define MPLL_LOCK  0x004
+#define EPLL_LOCK  0x008
+#define APLL_CON   0x00c
+#define MPLL_CON   0x010
+#define EPLL_CON0  0x014
+#define EPLL_CON1  0x018
+#define CLK_SRC0x01c
+#define CLK_DIV0   0x020
+#define CLK_DIV1   0x024
+#define CLK_DIV2   0x028
+#define HCLK_GATE  0x030
+#define PCLK_GATE  0x034
+#define SCLK_GATE  0x038
+#define MEM0_GATE  0x03c
+#define CLK_SRC2   0x10c
+#define OTHERS 0x900
+
+/* Special bitfields used in the driver. */
+#define OTHERS_SYNCMUXSEL  (1  6)
+
+/* Helper macros