Skip to contentSkip to conversation

MXC: EPIT Support

PATCH Superseded Michael Grzeschik 3 participants 5 messages Aug 17, 2010

Subsystems (3)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

cover MXC: EPIT Support

Hi everyone,

this patches include support for the "Enhanced Periodic Interrupt Timer" which can be used as an alternative for the "General Purpose Timer" on the mx35.

Sascha Hauer (2):
i.MX: Add EPIT support
i.MX35: Add EPIT support

 arch/arm/mach-mx3/Kconfig               |    1 +
 arch/arm/mach-mx3/clock-imx35.c         |   13 +-
 arch/arm/plat-mxc/Kconfig               |   12 ++
 arch/arm/plat-mxc/Makefile              |    1 +
 arch/arm/plat-mxc/epit.c                |  243 +++++++++++++++++++++++++++++++
 arch/arm/plat-mxc/include/mach/common.h |    1 +
 6 files changed, 267 insertions(+), 4 deletions(-)
 create mode 100644 arch/arm/plat-mxc/epit.c
#1 lore raw

PATCH 1/2 i.MX: Add EPIT support

From: Sascha Hauer <[email protected]>

The Enhanced Periodic Interrupt Timer (EPIT) is found on newer i.MX SoCs and can be used as an alternative system timer.

---
 arch/arm/plat-mxc/Kconfig  |   12 ++
 arch/arm/plat-mxc/Makefile |    1 +
 arch/arm/plat-mxc/epit.c   |  243 ++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 256 insertions(+), 0 deletions(-)
 create mode 100644 arch/arm/plat-mxc/epit.c
arch/arm/plat-mxc/Kconfig +12 -0
index 0527e65..448098b 100644
@@ -91,6 +91,18 @@ config MXC_DEBUG_BOARD
 	  data/address de-multiplexing and decode, signal level shift,
 	  interrupt control and various board functions.
 
+config HAVE_EPIT
+	bool
+
+config MXC_USE_EPIT
+	bool "Use EPIT instead of GPT"
+	depends on HAVE_EPIT
+	help
+	  Use EPIT as the system timer on systems that have it. Normally you
+	  don't have a reason to do so as the EPIT has the same features and
+	  uses the same clocks as the GPT. Anyway, on some systems the GPT
+	  may be in use for other purposes.
+
 config MXC_ULPI
 	bool
 
arch/arm/plat-mxc/Makefile +1 -0
index 78d405e..bb3443f 100644
@@ -13,6 +13,7 @@ obj-$(CONFIG_ARCH_MXC_IOMUX_V3) += iomux-v3.o
 obj-$(CONFIG_MXC_PWM)  += pwm.o
 obj-$(CONFIG_USB_EHCI_MXC) += ehci.o
 obj-$(CONFIG_MXC_ULPI) += ulpi.o
+obj-$(CONFIG_MXC_USE_EPIT) += epit.o
 obj-$(CONFIG_ARCH_MXC_AUDMUX_V1) += audmux-v1.o
 obj-$(CONFIG_ARCH_MXC_AUDMUX_V2) += audmux-v2.o
 obj-$(CONFIG_MXC_DEBUG_BOARD) += 3ds_debugboard.o
arch/arm/plat-mxc/epit.c new file +243 -0

243 lines not on this page · raw message

Signature · 1 line
1.7.1
#2 lore raw

PATCH 2/2 i.MX35: Add EPIT support

In reply to Michael Grzeschik

From: Sascha Hauer <[email protected]>

---
 arch/arm/mach-mx3/Kconfig               |    1 +
 arch/arm/mach-mx3/clock-imx35.c         |   13 +++++++++----
 arch/arm/plat-mxc/include/mach/common.h |    1 +
 3 files changed, 11 insertions(+), 4 deletions(-)
arch/arm/mach-mx3/Kconfig +1 -0
index 85beece..486c05d 100644
@@ -9,6 +9,7 @@ config ARCH_MX35
 	bool
 	select ARCH_MXC_IOMUX_V3
 	select ARCH_MXC_AUDMUX_V2
+	select HAVE_EPIT
 
 comment "MX3 platforms:"
 
arch/arm/mach-mx3/clock-imx35.c +9 -4
index 9b7dbcc..c409ad3 100644
@@ -368,8 +368,8 @@ DEFINE_CLOCK(cspi2_clk,  1, CCM_CGR0, 12, get_rate_ipg, NULL);
 DEFINE_CLOCK(ect_clk,    0, CCM_CGR0, 14, get_rate_ipg, NULL);
 DEFINE_CLOCK(edio_clk,   0, CCM_CGR0, 16, NULL, NULL);
 DEFINE_CLOCK(emi_clk,    0, CCM_CGR0, 18, get_rate_ipg, NULL);
-DEFINE_CLOCK(epit1_clk,  0, CCM_CGR0, 20, get_rate_ipg_per, NULL);
-DEFINE_CLOCK(epit2_clk,  1, CCM_CGR0, 22, get_rate_ipg_per, NULL);
+DEFINE_CLOCK(epit1_clk,  0, CCM_CGR0, 20, get_rate_ipg, NULL);
+DEFINE_CLOCK(epit2_clk,  1, CCM_CGR0, 22, get_rate_ipg, NULL);
 DEFINE_CLOCK(esai_clk,   0, CCM_CGR0, 24, NULL, NULL);
 DEFINE_CLOCK(esdhc1_clk, 0, CCM_CGR0, 26, get_rate_sdhc, NULL);
 DEFINE_CLOCK(esdhc2_clk, 1, CCM_CGR0, 28, get_rate_sdhc, NULL);
@@ -460,8 +460,8 @@ static struct clk_lookup lookups[] = {
 	_REGISTER_CLOCK(NULL, "ect", ect_clk)
 	_REGISTER_CLOCK(NULL, "edio", edio_clk)
 	_REGISTER_CLOCK(NULL, "emi", emi_clk)
-	_REGISTER_CLOCK(NULL, "epit", epit1_clk)
-	_REGISTER_CLOCK(NULL, "epit", epit2_clk)
+	_REGISTER_CLOCK("imx-epit.0", NULL, epit1_clk)
+	_REGISTER_CLOCK("imx-epit.1", NULL, epit2_clk)
 	_REGISTER_CLOCK(NULL, "esai", esai_clk)
 	_REGISTER_CLOCK(NULL, "sdhc", esdhc1_clk)
 	_REGISTER_CLOCK(NULL, "sdhc", esdhc2_clk)
@@ -527,8 +527,13 @@ int __init mx35_clocks_init()
 	__raw_writel((3 << 26) | ll, CCM_BASE + CCM_CGR2);
 	__raw_writel(0, CCM_BASE + CCM_CGR3);
 
+#ifdef CONFIG_MXC_USE_EPIT
+	epit_timer_init(&epit1_clk,
+			MX35_IO_ADDRESS(MX35_EPIT1_BASE_ADDR), MX35_INT_EPIT1);
+#else
 	mxc_timer_init(&gpt_clk,
 			MX35_IO_ADDRESS(MX35_GPT1_BASE_ADDR), MX35_INT_GPT);
+#endif
 
 	return 0;
 }
arch/arm/plat-mxc/include/mach/common.h +1 -0
index 2941472..7a1e1f8 100644
@@ -32,6 +32,7 @@ extern void mx31_init_irq(void);
 extern void mx35_init_irq(void);
 extern void mx51_init_irq(void);
 extern void mxc91231_init_irq(void);
+extern void epit_timer_init(struct clk *timer_clk, void __iomem *base, int irq);
 extern void mxc_timer_init(struct clk *timer_clk, void __iomem *, int);
 extern int mx1_clocks_init(unsigned long fref);
 extern int mx21_clocks_init(unsigned long lref, unsigned long fref);
Signature · 1 line
1.7.1
#3 lore raw

PATCH 2/2 i.MX35: Add EPIT support

Hi Michael, Sascha,

Quoted 5 lines · Michael Grzeschik

From: Sascha Hauer <[email protected]>

---

[snip]

arch/arm/plat-mxc/include/mach/common.h extern void mx31_init_irq(void); · line 38

Quoted 13 lines
arch/arm/plat-mxc/include/mach/common.h +1 -0
index 2941472..7a1e1f8 100644
@@ -32,6 +32,7 @@ extern void mx31_init_irq(void);
 extern void mx35_init_irq(void);
 extern void mx51_init_irq(void);
 extern void mxc91231_init_irq(void);
+extern void epit_timer_init(struct clk *timer_clk, void __iomem *base, int irq);
 extern void mxc_timer_init(struct clk *timer_clk, void __iomem *, int);
 extern int mx1_clocks_init(unsigned long fref);
 extern int mx21_clocks_init(unsigned long lref, unsigned long fref);

This hunk should probably be moved to the previous patch, where epit_timer_init is defined.

baruch

Quoted 1 line
Signature · 3 lines
                                                     ~. .~   Tk Open Systems
=}------------------------------------------------ooO--U--Ooo------------{=
   - baruch at tkos.co.il - tel: +972.2.679.5364, http://www.tkos.co.il -
#4 lore raw

PATCH 2/2 i.MX35: Add EPIT support

Quoted 11 lines · Baruch Siach

Hi Michael, Sascha,

Quoted 5 lines · Michael Grzeschik

From: Sascha Hauer <[email protected]>

---

[snip]

Quoted 16 lines

arch/arm/plat-mxc/include/mach/common.h extern void mx31_init_irq(void); · line 38

Quoted 13 lines
arch/arm/plat-mxc/include/mach/common.h +1 -0
index 2941472..7a1e1f8 100644
@@ -32,6 +32,7 @@ extern void mx31_init_irq(void);
 extern void mx35_init_irq(void);
 extern void mx51_init_irq(void);
 extern void mxc91231_init_irq(void);
+extern void epit_timer_init(struct clk *timer_clk, void __iomem *base, int irq);
 extern void mxc_timer_init(struct clk *timer_clk, void __iomem *, int);
 extern int mx1_clocks_init(unsigned long fref);
 extern int mx21_clocks_init(unsigned long lref, unsigned long fref);

This hunk should probably be moved to the previous patch, where epit_timer_init is defined.

Yes, this should move. I will wait some more time
for more feedback and post v2 Version afterwards.

Michael

Signature · 4 lines
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |