Skip to contentSkip to conversation

arm: mmp: make private clock definition exclude from common clock

PATCH New Chao Xie 3 participants 9 messages Aug 27, 2012 – Aug 28, 2012

Subsystems (3)
lore
Share & tools
lore

Chao Xie

author
#0 lore raw

PATCH 1/5 arm: mmp: make private clock definition exclude from common clock

From: Chao Xie <[email protected]>

the clock.c is mmp private implementation, make it excluded from common clock framework

---
 arch/arm/mach-mmp/Makefile |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)
arch/arm/mach-mmp/Makefile +4 -1
index b786f7e..815c3e7 100644
@@ -2,13 +2,16 @@
 # Makefile for Marvell's PXA168 processors line
 #
 
-obj-y				+= common.o clock.o devices.o time.o irq.o
+obj-y				+= common.o devices.o time.o irq.o
 
 # SoC support
 obj-$(CONFIG_CPU_PXA168)	+= pxa168.o
 obj-$(CONFIG_CPU_PXA910)	+= pxa910.o
 obj-$(CONFIG_CPU_MMP2)		+= mmp2.o sram.o
 
+ifeq ($(CONFIG_COMMON_CLK), )
+obj-y				+= clock.o
+endif
 ifeq ($(CONFIG_PM),y)
 obj-$(CONFIG_CPU_PXA910)	+= pm-pxa910.o
 obj-$(CONFIG_CPU_MMP2)		+= pm-mmp2.o
Signature · 1 line
1.7.0.4
author
#1 lore raw

PATCH 2/5 arm: mmp: move pxa168 clock definition to separated file

From: Chao Xie <[email protected]>

move pxa168 clock definition to another file. Then pxa168 can choose common clock framework or private clock framework.

---
 arch/arm/mach-mmp/Makefile       |    1 +
 arch/arm/mach-mmp/clock-pxa168.c |   91 ++++++++++++++++++++++++++++++++++++++
 arch/arm/mach-mmp/common.h       |    1 +
 arch/arm/mach-mmp/pxa168.c       |   58 ++----------------------
 4 files changed, 98 insertions(+), 53 deletions(-)
 create mode 100644 arch/arm/mach-mmp/clock-pxa168.c
arch/arm/mach-mmp/Makefile +1 -0
index 815c3e7..bb63f86 100644
@@ -11,6 +11,7 @@ obj-$(CONFIG_CPU_MMP2)		+= mmp2.o sram.o
 
 ifeq ($(CONFIG_COMMON_CLK), )
 obj-y				+= clock.o
+obj-$(CONFIG_CPU_PXA168)	+= clock-pxa168.o
 endif
 ifeq ($(CONFIG_PM),y)
 obj-$(CONFIG_CPU_PXA910)	+= pm-pxa910.o
arch/arm/mach-mmp/clock-pxa168.c new file +91 -0

91 lines not on this page · raw message

arch/arm/mach-mmp/common.h +1 -0
index 1c9d6c1..e47f73f 100644
@@ -7,3 +7,4 @@ extern void timer_init(int irq);
 extern void __init icu_init_irq(void);
 extern void __init mmp_map_io(void);
 extern void mmp_restart(char, const char *);
+extern void __init pxa168_clk_init(void);
arch/arm/mach-mmp/pxa168.c +5 -53

91 lines not on this page · raw message

Signature · 1 line
1.7.0.4
author
#2 lore raw

PATCH 3/5 arm: mmp: move pxa910 clock definition to separated file

In reply to Chao Xie

From: Chao Xie <[email protected]>

move pxa910 clock definition to another file. Then pxa910 can choose common clock framework or private clock framework.

---
 arch/arm/mach-mmp/Makefile       |    1 +
 arch/arm/mach-mmp/clock-pxa910.c |   67 ++++++++++++++++++++++++++++++++++++++
 arch/arm/mach-mmp/common.h       |    1 +
 arch/arm/mach-mmp/pxa910.c       |   40 ++--------------------
 4 files changed, 73 insertions(+), 36 deletions(-)
 create mode 100644 arch/arm/mach-mmp/clock-pxa910.c
arch/arm/mach-mmp/Makefile +1 -0
index bb63f86..ac0e885 100644
@@ -12,6 +12,7 @@ obj-$(CONFIG_CPU_MMP2)		+= mmp2.o sram.o
 ifeq ($(CONFIG_COMMON_CLK), )
 obj-y				+= clock.o
 obj-$(CONFIG_CPU_PXA168)	+= clock-pxa168.o
+obj-$(CONFIG_CPU_PXA910)	+= clock-pxa910.o
 endif
 ifeq ($(CONFIG_PM),y)
 obj-$(CONFIG_CPU_PXA910)	+= pm-pxa910.o
arch/arm/mach-mmp/clock-pxa910.c new file +67 -0

67 lines not on this page · raw message

arch/arm/mach-mmp/common.h +1 -0
index e47f73f..1cad41b 100644
@@ -8,3 +8,4 @@ extern void __init icu_init_irq(void);
 extern void __init mmp_map_io(void);
 extern void mmp_restart(char, const char *);
 extern void __init pxa168_clk_init(void);
+extern void __init pxa910_clk_init(void);
arch/arm/mach-mmp/pxa910.c +4 -36
index 6da52e9..7d84521 100644
@@ -17,7 +17,6 @@
 #include <asm/mach/time.h>
 #include <mach/addr-map.h>
 #include <mach/regs-apbc.h>
-#include <mach/regs-apmu.h>
 #include <mach/cputype.h>
 #include <mach/irqs.h>
 #include <mach/dma.h>
@@ -25,7 +24,6 @@
 #include <mach/devices.h>
 
 #include "common.h"
-#include "clock.h"
 
 #define MFPR_VIRT_BASE	(APB_VIRT_BASE + 0x1e000)
 
@@ -82,44 +80,13 @@ void __init pxa910_init_irq(void)
 	icu_init_irq();
 }
 
-/* APB peripheral clocks */
-static APBC_CLK(uart1, PXA910_UART0, 1, 14745600);
-static APBC_CLK(uart2, PXA910_UART1, 1, 14745600);
-static APBC_CLK(twsi0, PXA168_TWSI0, 1, 33000000);
-static APBC_CLK(twsi1, PXA168_TWSI1, 1, 33000000);
-static APBC_CLK(pwm1, PXA910_PWM1, 1, 13000000);
-static APBC_CLK(pwm2, PXA910_PWM2, 1, 13000000);
-static APBC_CLK(pwm3, PXA910_PWM3, 1, 13000000);
-static APBC_CLK(pwm4, PXA910_PWM4, 1, 13000000);
-static APBC_CLK(gpio, PXA910_GPIO, 0, 13000000);
-static APBC_CLK(rtc, PXA910_RTC, 8, 32768);
-
-static APMU_CLK(nand, NAND, 0x19b, 156000000);
-static APMU_CLK(u2o, USB, 0x1b, 480000000);
-
-/* device and clock bindings */
-static struct clk_lookup pxa910_clkregs[] = {
-	INIT_CLKREG(&clk_uart1, "pxa2xx-uart.0", NULL),
-	INIT_CLKREG(&clk_uart2, "pxa2xx-uart.1", NULL),
-	INIT_CLKREG(&clk_twsi0, "pxa2xx-i2c.0", NULL),
-	INIT_CLKREG(&clk_twsi1, "pxa2xx-i2c.1", NULL),
-	INIT_CLKREG(&clk_pwm1, "pxa910-pwm.0", NULL),
-	INIT_CLKREG(&clk_pwm2, "pxa910-pwm.1", NULL),
-	INIT_CLKREG(&clk_pwm3, "pxa910-pwm.2", NULL),
-	INIT_CLKREG(&clk_pwm4, "pxa910-pwm.3", NULL),
-	INIT_CLKREG(&clk_nand, "pxa3xx-nand", NULL),
-	INIT_CLKREG(&clk_gpio, "pxa-gpio", NULL),
-	INIT_CLKREG(&clk_u2o, NULL, "U2OCLK"),
-	INIT_CLKREG(&clk_rtc, "sa1100-rtc", NULL),
-};
-
 static int __init pxa910_init(void)
 {
 	if (cpu_is_pxa910()) {
 		mfp_init_base(MFPR_VIRT_BASE);
 		mfp_init_addr(pxa910_mfp_addr_map);
 		pxa_init_dma(IRQ_PXA910_DMA_INT0, 32);
-		clkdev_add_table(ARRAY_AND_SIZE(pxa910_clkregs));
+		pxa910_clk_init();
 	}
 
 	return 0;
@@ -128,12 +95,13 @@ postcore_initcall(pxa910_init);
 
 /* system timer - clock enabled, 3.25MHz */
 #define TIMER_CLK_RST	(APBC_APBCLK | APBC_FNCLK | APBC_FNCLKSEL(3))
+#define APBC_TIMERS	APBC_REG(0x34)
 
 static void __init pxa910_timer_init(void)
 {
 	/* reset and configure */
-	__raw_writel(APBC_APBCLK | APBC_RST, APBC_PXA910_TIMERS);
-	__raw_writel(TIMER_CLK_RST, APBC_PXA910_TIMERS);
+	__raw_writel(APBC_APBCLK | APBC_RST, APBC_TIMERS);
+	__raw_writel(TIMER_CLK_RST, APBC_TIMERS);
 
 	timer_init(IRQ_PXA910_AP1_TIMER1);
 }
Signature · 1 line
1.7.0.4
author
#3 lore raw

PATCH 4/5 arm: mmp: move mmp2 clock definition to separated file

In reply to Chao Xie

From: Chao Xie <[email protected]>

move mmp2 clock definition to another file. Then mmp2 can choose common clock framework or private clock framework.

---
 arch/arm/mach-mmp/Makefile     |    1 +
 arch/arm/mach-mmp/clock-mmp2.c |  111 ++++++++++++++++++++++++++++++++++++++++
 arch/arm/mach-mmp/common.h     |    1 +
 arch/arm/mach-mmp/mmp2.c       |   71 ++------------------------
 4 files changed, 118 insertions(+), 66 deletions(-)
 create mode 100644 arch/arm/mach-mmp/clock-mmp2.c
arch/arm/mach-mmp/Makefile +1 -0
index ac0e885..095c155 100644
@@ -13,6 +13,7 @@ ifeq ($(CONFIG_COMMON_CLK), )
 obj-y				+= clock.o
 obj-$(CONFIG_CPU_PXA168)	+= clock-pxa168.o
 obj-$(CONFIG_CPU_PXA910)	+= clock-pxa910.o
+obj-$(CONFIG_CPU_MMP2)		+= clock-mmp2.o
 endif
 ifeq ($(CONFIG_PM),y)
 obj-$(CONFIG_CPU_PXA910)	+= pm-pxa910.o
arch/arm/mach-mmp/clock-mmp2.c new file +111 -0

111 lines not on this page · raw message

arch/arm/mach-mmp/common.h +1 -0
index 1cad41b..bd45327 100644
@@ -9,3 +9,4 @@ extern void __init mmp_map_io(void);
 extern void mmp_restart(char, const char *);
 extern void __init pxa168_clk_init(void);
 extern void __init pxa910_clk_init(void);
+extern void __init mmp2_clk_init(void);
arch/arm/mach-mmp/mmp2.c +5 -66

111 lines not on this page · raw message

Signature · 1 line
1.7.0.4
author
#4 lore raw

PATCH 5/5 arm: mmp: remove unused definition in regs-apbc and regs-apmu

In reply to Chao Xie

From: Chao Xie <[email protected]>

---
 arch/arm/mach-mmp/include/mach/regs-apbc.h |   95 ----------------------------
 arch/arm/mach-mmp/include/mach/regs-apmu.h |   15 -----
 2 files changed, 0 insertions(+), 110 deletions(-)
arch/arm/mach-mmp/include/mach/regs-apbc.h +0 -95
index 68b0c93..ddc812f 100644
@@ -13,101 +13,6 @@
 
 #include <mach/addr-map.h>
 
-/*
- * APB clock register offsets for PXA168
- */
-#define APBC_PXA168_UART1	APBC_REG(0x000)
-#define APBC_PXA168_UART2	APBC_REG(0x004)
-#define APBC_PXA168_GPIO	APBC_REG(0x008)
-#define APBC_PXA168_PWM1	APBC_REG(0x00c)
-#define APBC_PXA168_PWM2	APBC_REG(0x010)
-#define APBC_PXA168_PWM3	APBC_REG(0x014)
-#define APBC_PXA168_PWM4	APBC_REG(0x018)
-#define APBC_PXA168_RTC		APBC_REG(0x028)
-#define APBC_PXA168_TWSI0	APBC_REG(0x02c)
-#define APBC_PXA168_KPC		APBC_REG(0x030)
-#define APBC_PXA168_TIMERS	APBC_REG(0x034)
-#define APBC_PXA168_AIB		APBC_REG(0x03c)
-#define APBC_PXA168_SW_JTAG	APBC_REG(0x040)
-#define APBC_PXA168_ONEWIRE	APBC_REG(0x048)
-#define APBC_PXA168_ASFAR	APBC_REG(0x050)
-#define APBC_PXA168_ASSAR	APBC_REG(0x054)
-#define APBC_PXA168_TWSI1	APBC_REG(0x06c)
-#define APBC_PXA168_UART3	APBC_REG(0x070)
-#define APBC_PXA168_AC97	APBC_REG(0x084)
-#define APBC_PXA168_SSP1	APBC_REG(0x81c)
-#define APBC_PXA168_SSP2	APBC_REG(0x820)
-#define APBC_PXA168_SSP3	APBC_REG(0x84c)
-#define APBC_PXA168_SSP4	APBC_REG(0x858)
-#define APBC_PXA168_SSP5	APBC_REG(0x85c)
-
-/*
- * APB Clock register offsets for PXA910
- */
-#define APBC_PXA910_UART0	APBC_REG(0x000)
-#define APBC_PXA910_UART1	APBC_REG(0x004)
-#define APBC_PXA910_GPIO	APBC_REG(0x008)
-#define APBC_PXA910_PWM1	APBC_REG(0x00c)
-#define APBC_PXA910_PWM2	APBC_REG(0x010)
-#define APBC_PXA910_PWM3	APBC_REG(0x014)
-#define APBC_PXA910_PWM4	APBC_REG(0x018)
-#define APBC_PXA910_SSP1	APBC_REG(0x01c)
-#define APBC_PXA910_SSP2	APBC_REG(0x020)
-#define APBC_PXA910_IPC		APBC_REG(0x024)
-#define APBC_PXA910_RTC		APBC_REG(0x028)
-#define APBC_PXA910_TWSI0	APBC_REG(0x02c)
-#define APBC_PXA910_KPC		APBC_REG(0x030)
-#define APBC_PXA910_TIMERS	APBC_REG(0x034)
-#define APBC_PXA910_TBROT	APBC_REG(0x038)
-#define APBC_PXA910_AIB		APBC_REG(0x03c)
-#define APBC_PXA910_SW_JTAG	APBC_REG(0x040)
-#define APBC_PXA910_TIMERS1	APBC_REG(0x044)
-#define APBC_PXA910_ONEWIRE	APBC_REG(0x048)
-#define APBC_PXA910_SSP3	APBC_REG(0x04c)
-#define APBC_PXA910_ASFAR	APBC_REG(0x050)
-#define APBC_PXA910_ASSAR	APBC_REG(0x054)
-
-/*
- * APB Clock register offsets for MMP2
- */
-#define APBC_MMP2_RTC		APBC_REG(0x000)
-#define APBC_MMP2_TWSI1		APBC_REG(0x004)
-#define APBC_MMP2_TWSI2		APBC_REG(0x008)
-#define APBC_MMP2_TWSI3		APBC_REG(0x00c)
-#define APBC_MMP2_TWSI4		APBC_REG(0x010)
-#define APBC_MMP2_ONEWIRE	APBC_REG(0x014)
-#define APBC_MMP2_KPC		APBC_REG(0x018)
-#define APBC_MMP2_TB_ROTARY	APBC_REG(0x01c)
-#define APBC_MMP2_SW_JTAG	APBC_REG(0x020)
-#define APBC_MMP2_TIMERS	APBC_REG(0x024)
-#define APBC_MMP2_UART1		APBC_REG(0x02c)
-#define APBC_MMP2_UART2		APBC_REG(0x030)
-#define APBC_MMP2_UART3		APBC_REG(0x034)
-#define APBC_MMP2_GPIO		APBC_REG(0x038)
-#define APBC_MMP2_PWM0		APBC_REG(0x03c)
-#define APBC_MMP2_PWM1		APBC_REG(0x040)
-#define APBC_MMP2_PWM2		APBC_REG(0x044)
-#define APBC_MMP2_PWM3		APBC_REG(0x048)
-#define APBC_MMP2_SSP0		APBC_REG(0x04c)
-#define APBC_MMP2_SSP1		APBC_REG(0x050)
-#define APBC_MMP2_SSP2		APBC_REG(0x054)
-#define APBC_MMP2_SSP3		APBC_REG(0x058)
-#define APBC_MMP2_SSP4		APBC_REG(0x05c)
-#define APBC_MMP2_SSP5		APBC_REG(0x060)
-#define APBC_MMP2_AIB		APBC_REG(0x064)
-#define APBC_MMP2_ASFAR		APBC_REG(0x068)
-#define APBC_MMP2_ASSAR		APBC_REG(0x06c)
-#define APBC_MMP2_USIM		APBC_REG(0x070)
-#define APBC_MMP2_MPMU		APBC_REG(0x074)
-#define APBC_MMP2_IPC		APBC_REG(0x078)
-#define APBC_MMP2_TWSI5		APBC_REG(0x07c)
-#define APBC_MMP2_TWSI6		APBC_REG(0x080)
-#define APBC_MMP2_TWSI_INTSTS	APBC_REG(0x084)
-#define APBC_MMP2_UART4		APBC_REG(0x088)
-#define APBC_MMP2_RIPC		APBC_REG(0x08c)
-#define APBC_MMP2_THSENS1	APBC_REG(0x090)	/* Thermal Sensor */
-#define APBC_MMP2_THSENS_INTSTS	APBC_REG(0x0a4)
-
 /* Common APB clock register bit definitions */
 #define APBC_APBCLK	(1 << 0)  /* APB Bus Clock Enable */
 #define APBC_FNCLK	(1 << 1)  /* Functional Clock Enable */
arch/arm/mach-mmp/include/mach/regs-apmu.h +0 -15
index 7af8deb..93c8d0e 100644
@@ -13,21 +13,6 @@
 
 #include <mach/addr-map.h>
 
-/* Clock Reset Control */
-#define APMU_IRE	APMU_REG(0x048)
-#define APMU_LCD	APMU_REG(0x04c)
-#define APMU_CCIC	APMU_REG(0x050)
-#define APMU_SDH0	APMU_REG(0x054)
-#define APMU_SDH1	APMU_REG(0x058)
-#define APMU_USB	APMU_REG(0x05c)
-#define APMU_NAND	APMU_REG(0x060)
-#define APMU_DMA	APMU_REG(0x064)
-#define APMU_GEU	APMU_REG(0x068)
-#define APMU_BUS	APMU_REG(0x06c)
-#define APMU_SDH2	APMU_REG(0x0e8)
-#define APMU_SDH3	APMU_REG(0x0ec)
-#define APMU_ETH	APMU_REG(0x0fc)
-
 #define APMU_FNCLK_EN	(1 << 4)
 #define APMU_AXICLK_EN	(1 << 3)
 #define APMU_FNRST_DIS	(1 << 1)
Signature · 1 line
1.7.0.4
#5 lore raw

PATCH 1/5 arm: mmp: make private clock definition exclude from common clock

In reply to Chao Xie
Quoted 19 lines · Chao Xie

From: Chao Xie <[email protected]>

the clock.c is mmp private implementation, make it excluded from common clock framework

---
 arch/arm/mach-mmp/Makefile |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)
arch/arm/mach-mmp/Makefile +0 -1
index b786f7e..815c3e7 100644
@@ -2,13 +2,16 @@
 # Makefile for Marvell's PXA168 processors line
 #
 
-obj-y                          += common.o clock.o devices.o time.o irq.o

arch/arm/mach-mmp/Makefile line 14

Quoted 10 lines
arch/arm/mach-mmp/Makefile +4 -0
+obj-y                          += common.o devices.o time.o irq.o
 
 # SoC support
 obj-$(CONFIG_CPU_PXA168)       += pxa168.o
 obj-$(CONFIG_CPU_PXA910)       += pxa910.o
 obj-$(CONFIG_CPU_MMP2)         += mmp2.o sram.o
 
+ifeq ($(CONFIG_COMMON_CLK), )
+obj-y                          += clock.o
+endif

Why not to discard all private clock code? Maybe you can use common clk in arch-mmp directly.

author
#6 lore raw

PATCH 1/5 arm: mmp: make private clock definition exclude from common clock

Quoted 27 lines · Haojian Zhuang
Quoted 26 lines · Chao Xie

From: Chao Xie <[email protected]>

the clock.c is mmp private implementation, make it excluded from common clock framework

---
 arch/arm/mach-mmp/Makefile |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)
arch/arm/mach-mmp/Makefile +1 -1
index b786f7e..815c3e7 100644
@@ -2,13 +2,16 @@
 # Makefile for Marvell's PXA168 processors line
 #
 
-obj-y                          += common.o clock.o devices.o time.o irq.o
+obj-y                          += common.o devices.o time.o irq.o
 
 # SoC support
 obj-$(CONFIG_CPU_PXA168)       += pxa168.o
 obj-$(CONFIG_CPU_PXA910)       += pxa910.o
 obj-$(CONFIG_CPU_MMP2)         += mmp2.o sram.o
 
Quoted 6 lines

arch/arm/mach-mmp/Makefile line 14

Quoted 3 lines
arch/arm/mach-mmp/Makefile +3 -0
+ifeq ($(CONFIG_COMMON_CLK), )
+obj-y                          += clock.o
+endif

Why not to discard all private clock code? Maybe you can use common clk in arch-mmp directly.

Our dvfs and devfreq are set up based on private clock code. The migration of dvfs and devfreq is on going. Checking in common clock framework code will help us mirgarate the dvfs and devfreq, but i do not want to block the our product development, so I would like to keep the private clock code untile we have settle down all the problems.

#7 lore raw

PATCH 1/5 arm: mmp: make private clock definition exclude from common clock

Quoting Chao Xie (2012-08-27 18:40:07)

Quoted 35 lines
Quoted 27 lines · Haojian Zhuang
Quoted 26 lines · Chao Xie

From: Chao Xie <[email protected]>

the clock.c is mmp private implementation, make it excluded from common clock framework

---
 arch/arm/mach-mmp/Makefile |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)
arch/arm/mach-mmp/Makefile +1 -1
index b786f7e..815c3e7 100644
@@ -2,13 +2,16 @@
 # Makefile for Marvell's PXA168 processors line
 #
 
-obj-y                          += common.o clock.o devices.o time.o irq.o
+obj-y                          += common.o devices.o time.o irq.o
 
 # SoC support
 obj-$(CONFIG_CPU_PXA168)       += pxa168.o
 obj-$(CONFIG_CPU_PXA910)       += pxa910.o
 obj-$(CONFIG_CPU_MMP2)         += mmp2.o sram.o
 
Quoted 6 lines

arch/arm/mach-mmp/Makefile line 14

Quoted 3 lines
arch/arm/mach-mmp/Makefile +3 -0
+ifeq ($(CONFIG_COMMON_CLK), )
+obj-y                          += clock.o
+endif

Why not to discard all private clock code? Maybe you can use common clk in arch-mmp directly.

Quoted 5 lines

Our dvfs and devfreq are set up based on private clock code. The migration of dvfs and devfreq is on going. Checking in common clock framework code will help us mirgarate the dvfs and devfreq, but i do not want to block the our product development, so I would like to keep the private clock code untile we have settle down all the problems.

I am OK with the general approach. It would be nice to remove all of the old stuff at the same time to have a better diffstat, but I also understand needing to balance out the needs of product teams.

Since DVFS is a concern for you I would ask you look in on my dvfs/reentrancy rfc [1] and provide feedback on whether you think it will work well for your platform.

Regards,
Mike

[1] http://marc.info/?l=linux-arm-kernel&m=134507427602446&w=2