Skip to contentSkip to conversation

clk: mmp: add clock framework for mmp

PATCH In review Chao Xie 4 participants 12 messages Aug 20, 2012 – Sep 11, 2012

Subsystems (4)
lore
Share & tools
lore

Chao Xie

author
#0 lore raw

v5 cover clk: mmp: add clock framework for mmp

From: Chao Xie <[email protected]>

v1->v2:
replace __raw_xxx with xxx_relax
use ioremap to remap the registers. Finaly it will use device tree to get the physical address.
do not use macro to register clocks, and directly call the functions.

v2->v3:
pxa910 will have APB extension clock, so some peripharals will have clocks in APB extension base.
change pxa168-pwm to be pxa910-pwm for pxa910. It will fit the current pwm driver.

v3->v4:
remove addtional clock name definition
replace left __raw_xxx

v4->v5:
change the format of the file

Chao Xie (5):
clk: mmp: add mmp specific clocks
clk: mmp: add clock definition for pxa168
clk: mmp: add clock definition for pxa910
clk: mmp: add clock definition for mmp2
arm: mmp: make all SOCs use common clock by default

 arch/arm/mach-mmp/Kconfig    |    3 +
 drivers/clk/Makefile         |    3 +
 drivers/clk/mmp/Makefile     |    9 +
 drivers/clk/mmp/clk-apbc.c   |  152 ++++++++++++++
 drivers/clk/mmp/clk-apmu.c   |   97 +++++++++
 drivers/clk/mmp/clk-frac.c   |  153 ++++++++++++++
 drivers/clk/mmp/clk-mmp2.c   |  449 ++++++++++++++++++++++++++++++++++++++++++
 drivers/clk/mmp/clk-pxa168.c |  346 ++++++++++++++++++++++++++++++++
 drivers/clk/mmp/clk-pxa910.c |  320 ++++++++++++++++++++++++++++++
 drivers/clk/mmp/clk.h        |   35 ++++
 10 files changed, 1567 insertions(+), 0 deletions(-)
 create mode 100644 drivers/clk/mmp/Makefile
 create mode 100644 drivers/clk/mmp/clk-apbc.c
 create mode 100644 drivers/clk/mmp/clk-apmu.c
 create mode 100644 drivers/clk/mmp/clk-frac.c
 create mode 100644 drivers/clk/mmp/clk-mmp2.c
 create mode 100644 drivers/clk/mmp/clk-pxa168.c
 create mode 100644 drivers/clk/mmp/clk-pxa910.c
 create mode 100644 drivers/clk/mmp/clk.h
author
#1 lore raw

PATCH v5 1/5 clk: mmp: add mmp specific clocks

From: Chao Xie <[email protected]>

add mmp specific clocks including apbc cloks, apmu clocks, and pll2, fraction clocks

---
 drivers/clk/Makefile       |    3 +
 drivers/clk/mmp/Makefile   |    5 ++
 drivers/clk/mmp/clk-apbc.c |  152 +++++++++++++++++++++++++++++++++++++++++++
 drivers/clk/mmp/clk-apmu.c |   97 ++++++++++++++++++++++++++++
 drivers/clk/mmp/clk-frac.c |  153 ++++++++++++++++++++++++++++++++++++++++++++
 drivers/clk/mmp/clk.h      |   35 ++++++++++
 6 files changed, 445 insertions(+), 0 deletions(-)
 create mode 100644 drivers/clk/mmp/Makefile
 create mode 100644 drivers/clk/mmp/clk-apbc.c
 create mode 100644 drivers/clk/mmp/clk-apmu.c
 create mode 100644 drivers/clk/mmp/clk-frac.c
 create mode 100644 drivers/clk/mmp/clk.h
drivers/clk/Makefile +3 -0
index 5869ea3..58590c8 100644
@@ -10,6 +10,9 @@ obj-$(CONFIG_ARCH_SOCFPGA)	+= socfpga/
 obj-$(CONFIG_PLAT_SPEAR)	+= spear/
 obj-$(CONFIG_ARCH_U300)		+= clk-u300.o
 obj-$(CONFIG_ARCH_INTEGRATOR)	+= versatile/
+ifeq ($(CONFIG_COMMON_CLK), y)
+obj-$(CONFIG_ARCH_MMP)		+= mmp/
+endif
 
 # Chip specific
 obj-$(CONFIG_COMMON_CLK_WM831X) += clk-wm831x.o
drivers/clk/mmp/Makefile new file +5 -0
new file mode 100644
index 0000000..b5bc88c
@@ -0,0 +1,5 @@
+#
+# Makefile for mmp specific clk
+#
+
+obj-y += clk-apbc.o clk-apmu.o clk-frac.o
drivers/clk/mmp/clk-apbc.c new file +152 -0

152 lines not on this page · raw message

drivers/clk/mmp/clk-apmu.c new file +97 -0

97 lines not on this page · raw message

drivers/clk/mmp/clk-frac.c new file +153 -0

153 lines not on this page · raw message

drivers/clk/mmp/clk.h new file +35 -0
new file mode 100644
index 0000000..ab86dd4
@@ -0,0 +1,35 @@
+#ifndef __MACH_MMP_CLK_H
+#define __MACH_MMP_CLK_H
+
+#include <linux/clk-provider.h>
+#include <linux/clkdev.h>
+
+#define APBC_NO_BUS_CTRL	BIT(0)
+#define APBC_POWER_CTRL		BIT(1)
+
+struct clk_factor_masks {
+	unsigned int	factor;
+	unsigned int	num_mask;
+	unsigned int	den_mask;
+	unsigned int	num_shift;
+	unsigned int	den_shift;
+};
+
+struct clk_factor_tbl {
+	unsigned int num;
+	unsigned int den;
+};
+
+extern struct clk *mmp_clk_register_pll2(const char *name,
+		const char *parent_name, unsigned long flags);
+extern struct clk *mmp_clk_register_apbc(const char *name,
+		const char *parent_name, void __iomem *base,
+		unsigned int delay, unsigned int apbc_flags, spinlock_t *lock);
+extern struct clk *mmp_clk_register_apmu(const char *name,
+		const char *parent_name, void __iomem *base, u32 enable_mask,
+		spinlock_t *lock);
+extern struct clk *mmp_clk_register_factor(const char *name,
+		const char *parent_name, unsigned long flags,
+		void __iomem *base, struct clk_factor_masks *masks,
+		struct clk_factor_tbl *ftbl, unsigned int ftbl_cnt);
+#endif
Signature · 1 line
1.7.0.4
author
#2 lore raw

PATCH v5 2/5 clk: mmp: add clock definition for pxa168

In reply to Chao Xie

From: Chao Xie <[email protected]>

Initialize the clocks for pxa168

---
 drivers/clk/mmp/Makefile     |    2 +
 drivers/clk/mmp/clk-pxa168.c |  346 ++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 348 insertions(+), 0 deletions(-)
 create mode 100644 drivers/clk/mmp/clk-pxa168.c
drivers/clk/mmp/Makefile +2 -0
index b5bc88c..a0e69ed 100644
@@ -3,3 +3,5 @@
 #
 
 obj-y += clk-apbc.o clk-apmu.o clk-frac.o
+
+obj-$(CONFIG_CPU_PXA168) += clk-pxa168.o
drivers/clk/mmp/clk-pxa168.c new file +346 -0

346 lines not on this page · raw message

Signature · 1 line
1.7.0.4
author
#3 lore raw

PATCH v5 3/5 clk: mmp: add clock definition for pxa910

In reply to Chao Xie

From: Chao Xie <[email protected]>

Initialize the clocks for pxa910

---
 drivers/clk/mmp/Makefile     |    1 +
 drivers/clk/mmp/clk-pxa910.c |  320 ++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 321 insertions(+), 0 deletions(-)
 create mode 100644 drivers/clk/mmp/clk-pxa910.c
drivers/clk/mmp/Makefile +1 -0
index a0e69ed..6160ac2 100644
@@ -5,3 +5,4 @@
 obj-y += clk-apbc.o clk-apmu.o clk-frac.o
 
 obj-$(CONFIG_CPU_PXA168) += clk-pxa168.o
+obj-$(CONFIG_CPU_PXA910) += clk-pxa910.o
drivers/clk/mmp/clk-pxa910.c new file +320 -0

320 lines not on this page · raw message

Signature · 1 line
1.7.0.4
author
#4 lore raw

PATCH v5 4/5 clk: mmp: add clock definition for mmp2

In reply to Chao Xie

From: Chao Xie <[email protected]>

Initialize the clocks for mmp2

---
 drivers/clk/mmp/Makefile   |    1 +
 drivers/clk/mmp/clk-mmp2.c |  449 ++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 450 insertions(+), 0 deletions(-)
 create mode 100644 drivers/clk/mmp/clk-mmp2.c
drivers/clk/mmp/Makefile +1 -0
index 6160ac2..392d780 100644
@@ -6,3 +6,4 @@ obj-y += clk-apbc.o clk-apmu.o clk-frac.o
 
 obj-$(CONFIG_CPU_PXA168) += clk-pxa168.o
 obj-$(CONFIG_CPU_PXA910) += clk-pxa910.o
+obj-$(CONFIG_CPU_MMP2) += clk-mmp2.o
drivers/clk/mmp/clk-mmp2.c new file +449 -0

449 lines not on this page · raw message

Signature · 1 line
1.7.0.4
author
#5 lore raw

PATCH v5 5/5 arm: mmp: make all SOCs use common clock by default

In reply to Chao Xie

From: Chao Xie <[email protected]>

---
 arch/arm/mach-mmp/Kconfig |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)
arch/arm/mach-mmp/Kconfig +3 -0
index 7fddd01..d697d07 100644
@@ -108,18 +108,21 @@ endmenu
 config CPU_PXA168
 	bool
 	select CPU_MOHAWK
+	select COMMON_CLK
 	help
 	  Select code specific to PXA168
 
 config CPU_PXA910
 	bool
 	select CPU_MOHAWK
+	select COMMON_CLK
 	help
 	  Select code specific to PXA910
 
 config CPU_MMP2
 	bool
 	select CPU_PJ4
+	select COMMON_CLK
 	help
 	  Select code specific to MMP2. MMP2 is ARMv7 compatible.
 
Signature · 1 line
1.7.0.4
Reviewed-by on the v5 series
#6 lore raw
In reply to Chao Xie
Quoted 15 lines · Chao Xie

From: Chao Xie <[email protected]>

v1->v2:
replace __raw_xxx with xxx_relax
use ioremap to remap the registers. Finaly it will use device tree to get the physical address.
do not use macro to register clocks, and directly call the functions.

v2->v3:
pxa910 will have APB extension clock, so some peripharals will have clocks in APB extension base.
change pxa168-pwm to be pxa910-pwm for pxa910. It will fit the current pwm driver.

Quoted 7 lines

v3->v4:
remove addtional clock name definition
replace left __raw_xxx

v4->v5:
change the format of the file

Arnd

#7 lore raw
In reply to Chao Xie

Quoting Chao Xie (2012-08-19 19:55:10)

Quoted 11 lines

From: Chao Xie <[email protected]>

 arch/arm/mach-mmp/Kconfig    |    3 +
 drivers/clk/Makefile         |    3 +
 drivers/clk/mmp/Makefile     |    9 +
 drivers/clk/mmp/clk-apbc.c   |  152 ++++++++++++++
 drivers/clk/mmp/clk-apmu.c   |   97 +++++++++
 drivers/clk/mmp/clk-frac.c   |  153 ++++++++++++++
 drivers/clk/mmp/clk-mmp2.c   |  449 ++++++++++++++++++++++++++++++++++++++++++
 drivers/clk/mmp/clk-pxa168.c |  346 ++++++++++++++++++++++++++++++++
 drivers/clk/mmp/clk-pxa910.c |  320 ++++++++++++++++++++++++++++++
 drivers/clk/mmp/clk.h        |   35 ++++

Looks like you are not removing your arch/arm/mach-mmp/clock.c. Is that intentional?

When I apply your series against v3.6-rc3 I find that compilation breaks with mmp2_defconfig due to conflicting definitions for the clk api (clk_enable, clk_set_rate, etc). This is not surprising since your legacy clock code is neither deleted nor removed from compilation conditionally by checking for CONFIG_COMMON_CLK.

Did I somehow manage to misapply your patches or should your patches have removed the arch-specific clock framework as well?

Regards,
Mike

Quoted 9 lines
 10 files changed, 1567 insertions(+), 0 deletions(-)
 create mode 100644 drivers/clk/mmp/Makefile
 create mode 100644 drivers/clk/mmp/clk-apbc.c
 create mode 100644 drivers/clk/mmp/clk-apmu.c
 create mode 100644 drivers/clk/mmp/clk-frac.c
 create mode 100644 drivers/clk/mmp/clk-mmp2.c
 create mode 100644 drivers/clk/mmp/clk-pxa168.c
 create mode 100644 drivers/clk/mmp/clk-pxa910.c
 create mode 100644 drivers/clk/mmp/clk.h
author
#8 lore raw
Quoted 16 lines · Mike Turquette

Quoting Chao Xie (2012-08-19 19:55:10)

Quoted 11 lines

From: Chao Xie <[email protected]>

 arch/arm/mach-mmp/Kconfig    |    3 +
 drivers/clk/Makefile         |    3 +
 drivers/clk/mmp/Makefile     |    9 +
 drivers/clk/mmp/clk-apbc.c   |  152 ++++++++++++++
 drivers/clk/mmp/clk-apmu.c   |   97 +++++++++
 drivers/clk/mmp/clk-frac.c   |  153 ++++++++++++++
 drivers/clk/mmp/clk-mmp2.c   |  449 ++++++++++++++++++++++++++++++++++++++++++
 drivers/clk/mmp/clk-pxa168.c |  346 ++++++++++++++++++++++++++++++++
 drivers/clk/mmp/clk-pxa910.c |  320 ++++++++++++++++++++++++++++++
 drivers/clk/mmp/clk.h        |   35 ++++

Looks like you are not removing your arch/arm/mach-mmp/clock.c. Is that intentional?

Quoted 9 lines

When I apply your series against v3.6-rc3 I find that compilation breaks with mmp2_defconfig due to conflicting definitions for the clk api (clk_enable, clk_set_rate, etc). This is not surprising since your legacy clock code is neither deleted nor removed from compilation conditionally by checking for CONFIG_COMMON_CLK.

Did I somehow manage to misapply your patches or should your patches have removed the arch-specific clock framework as well?

hi, Mike
Yes. There are some patches for seperate the original clock code in arch. I had sent these patches before, but it seems that too many patches sent, and haojian missed it.
I will sent out the patches for arch today. Thanks.

Quoted 12 lines

Regards,
Mike

Quoted 9 lines
 10 files changed, 1567 insertions(+), 0 deletions(-)
 create mode 100644 drivers/clk/mmp/Makefile
 create mode 100644 drivers/clk/mmp/clk-apbc.c
 create mode 100644 drivers/clk/mmp/clk-apmu.c
 create mode 100644 drivers/clk/mmp/clk-frac.c
 create mode 100644 drivers/clk/mmp/clk-mmp2.c
 create mode 100644 drivers/clk/mmp/clk-pxa168.c
 create mode 100644 drivers/clk/mmp/clk-pxa910.c
 create mode 100644 drivers/clk/mmp/clk.h
#9 lore raw

v5 cover clk: mmp: add clock framework for mmp

Quoting Chao Xie (2012-08-26 18:19:02)

Quoted 23 lines · Mike Turquette
Quoted 22 lines

Quoting Chao Xie (2012-08-19 19:55:10)

Quoted 11 lines

From: Chao Xie <[email protected]>

 arch/arm/mach-mmp/Kconfig    |    3 +
 drivers/clk/Makefile         |    3 +
 drivers/clk/mmp/Makefile     |    9 +
 drivers/clk/mmp/clk-apbc.c   |  152 ++++++++++++++
 drivers/clk/mmp/clk-apmu.c   |   97 +++++++++
 drivers/clk/mmp/clk-frac.c   |  153 ++++++++++++++
 drivers/clk/mmp/clk-mmp2.c   |  449 ++++++++++++++++++++++++++++++++++++++++++
 drivers/clk/mmp/clk-pxa168.c |  346 ++++++++++++++++++++++++++++++++
 drivers/clk/mmp/clk-pxa910.c |  320 ++++++++++++++++++++++++++++++
 drivers/clk/mmp/clk.h        |   35 ++++

Looks like you are not removing your arch/arm/mach-mmp/clock.c. Is that intentional?

When I apply your series against v3.6-rc3 I find that compilation breaks with mmp2_defconfig due to conflicting definitions for the clk api (clk_enable, clk_set_rate, etc). This is not surprising since your legacy clock code is neither deleted nor removed from compilation conditionally by checking for CONFIG_COMMON_CLK.

Quoted 9 lines
Quoted 3 lines

Did I somehow manage to misapply your patches or should your patches have removed the arch-specific clock framework as well?

hi, Mike
Yes. There are some patches for seperate the original clock code in arch. I had sent these patches before, but it seems that too many patches sent, and haojian missed it.
I will sent out the patches for arch today. Thanks.

I pulled in the dependency series and the build goes through nicely now. I'm happy to take these five patches into clk-next but of course mmp will have problems building clk-next without the dependencies, which I assume are going through arm-soc.

Regards,
Mike

Quoted 12 lines
Quoted 12 lines

Regards,
Mike

Quoted 9 lines
 10 files changed, 1567 insertions(+), 0 deletions(-)
 create mode 100644 drivers/clk/mmp/Makefile
 create mode 100644 drivers/clk/mmp/clk-apbc.c
 create mode 100644 drivers/clk/mmp/clk-apmu.c
 create mode 100644 drivers/clk/mmp/clk-frac.c
 create mode 100644 drivers/clk/mmp/clk-mmp2.c
 create mode 100644 drivers/clk/mmp/clk-pxa168.c
 create mode 100644 drivers/clk/mmp/clk-pxa910.c
 create mode 100644 drivers/clk/mmp/clk.h
author
#10 lore raw
Quoted 34 lines · Mike Turquette

Quoting Chao Xie (2012-08-26 18:19:02)

Quoted 23 lines · Mike Turquette
Quoted 22 lines

Quoting Chao Xie (2012-08-19 19:55:10)

Quoted 11 lines

From: Chao Xie <[email protected]>

 arch/arm/mach-mmp/Kconfig    |    3 +
 drivers/clk/Makefile         |    3 +
 drivers/clk/mmp/Makefile     |    9 +
 drivers/clk/mmp/clk-apbc.c   |  152 ++++++++++++++
 drivers/clk/mmp/clk-apmu.c   |   97 +++++++++
 drivers/clk/mmp/clk-frac.c   |  153 ++++++++++++++
 drivers/clk/mmp/clk-mmp2.c   |  449 ++++++++++++++++++++++++++++++++++++++++++
 drivers/clk/mmp/clk-pxa168.c |  346 ++++++++++++++++++++++++++++++++
 drivers/clk/mmp/clk-pxa910.c |  320 ++++++++++++++++++++++++++++++
 drivers/clk/mmp/clk.h        |   35 ++++

Looks like you are not removing your arch/arm/mach-mmp/clock.c. Is that intentional?

When I apply your series against v3.6-rc3 I find that compilation breaks with mmp2_defconfig due to conflicting definitions for the clk api (clk_enable, clk_set_rate, etc). This is not surprising since your legacy clock code is neither deleted nor removed from compilation conditionally by checking for CONFIG_COMMON_CLK.

Quoted 9 lines
Quoted 3 lines

Did I somehow manage to misapply your patches or should your patches have removed the arch-specific clock framework as well?

hi, Mike
Yes. There are some patches for seperate the original clock code in arch. I had sent these patches before, but it seems that too many patches sent, and haojian missed it.
I will sent out the patches for arch today. Thanks.

Quoted 20 lines

I pulled in the dependency series and the build goes through nicely now. I'm happy to take these five patches into clk-next but of course mmp will have problems building clk-next without the dependencies, which I assume are going through arm-soc.

Regards,
Mike

Quoted 12 lines
Quoted 12 lines

Regards,
Mike

Quoted 9 lines
 10 files changed, 1567 insertions(+), 0 deletions(-)
 create mode 100644 drivers/clk/mmp/Makefile
 create mode 100644 drivers/clk/mmp/clk-apbc.c
 create mode 100644 drivers/clk/mmp/clk-apmu.c
 create mode 100644 drivers/clk/mmp/clk-frac.c
 create mode 100644 drivers/clk/mmp/clk-mmp2.c
 create mode 100644 drivers/clk/mmp/clk-pxa168.c
 create mode 100644 drivers/clk/mmp/clk-pxa910.c
 create mode 100644 drivers/clk/mmp/clk.h

Thanks.
I think Haojian who is the maintainer of pxa and mmp will help to integrate the dependency patches.

#11 lore raw
Quoted 56 lines · Chao Xie
Quoted 34 lines · Mike Turquette

Quoting Chao Xie (2012-08-26 18:19:02)

Quoted 23 lines · Mike Turquette
Quoted 22 lines

Quoting Chao Xie (2012-08-19 19:55:10)

Quoted 11 lines

From: Chao Xie <[email protected]>

 arch/arm/mach-mmp/Kconfig    |    3 +
 drivers/clk/Makefile         |    3 +
 drivers/clk/mmp/Makefile     |    9 +
 drivers/clk/mmp/clk-apbc.c   |  152 ++++++++++++++
 drivers/clk/mmp/clk-apmu.c   |   97 +++++++++
 drivers/clk/mmp/clk-frac.c   |  153 ++++++++++++++
 drivers/clk/mmp/clk-mmp2.c   |  449 ++++++++++++++++++++++++++++++++++++++++++
 drivers/clk/mmp/clk-pxa168.c |  346 ++++++++++++++++++++++++++++++++
 drivers/clk/mmp/clk-pxa910.c |  320 ++++++++++++++++++++++++++++++
 drivers/clk/mmp/clk.h        |   35 ++++

Looks like you are not removing your arch/arm/mach-mmp/clock.c. Is that intentional?

When I apply your series against v3.6-rc3 I find that compilation breaks with mmp2_defconfig due to conflicting definitions for the clk api (clk_enable, clk_set_rate, etc). This is not surprising since your legacy clock code is neither deleted nor removed from compilation conditionally by checking for CONFIG_COMMON_CLK.

Quoted 9 lines
Quoted 3 lines

Did I somehow manage to misapply your patches or should your patches have removed the arch-specific clock framework as well?

hi, Mike
Yes. There are some patches for seperate the original clock code in arch. I had sent these patches before, but it seems that too many patches sent, and haojian missed it.
I will sent out the patches for arch today. Thanks.

Quoted 20 lines

I pulled in the dependency series and the build goes through nicely now. I'm happy to take these five patches into clk-next but of course mmp will have problems building clk-next without the dependencies, which I assume are going through arm-soc.

Regards,
Mike

Quoted 12 lines
Quoted 12 lines

Regards,
Mike

Quoted 9 lines
 10 files changed, 1567 insertions(+), 0 deletions(-)
 create mode 100644 drivers/clk/mmp/Makefile
 create mode 100644 drivers/clk/mmp/clk-apbc.c
 create mode 100644 drivers/clk/mmp/clk-apmu.c
 create mode 100644 drivers/clk/mmp/clk-frac.c
 create mode 100644 drivers/clk/mmp/clk-mmp2.c
 create mode 100644 drivers/clk/mmp/clk-pxa168.c
 create mode 100644 drivers/clk/mmp/clk-pxa910.c
 create mode 100644 drivers/clk/mmp/clk.h
Quoted 3 lines

Thanks.
I think Haojian who is the maintainer of pxa and mmp will help to integrate the dependency patches.

I've applied. Now I'm waiting for Arnd's pull into arm-soc tree.