Skip to contentSkip to conversation

imx31: fix parent clock for rtc

PATCH New Vladimir Zapolskiy 2 participants 6 messages Mar 24, 2010 – Mar 26, 2010

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/3 imx31: fix parent clock for rtc

According to imx31 reference manual the signal from external low frequency clock is sent to RTC clock.
The patch makes redundant the previously defined mxc_rtc clock.

---
 arch/arm/mach-mx3/clock-imx31.c |    5 ++---
 1 files changed, 2 insertions(+), 3 deletions(-)
arch/arm/mach-mx3/clock-imx31.c +2 -3
index 80dba99..9a9eb6d 100644
@@ -468,6 +468,7 @@ static struct clk ahb_clk = {
 	}
 
 DEFINE_CLOCK(perclk_clk,  0, NULL,          0, NULL, NULL, &ipg_clk);
+DEFINE_CLOCK(ckil_clk,    0, NULL,          0, clk_ckil_get_rate, NULL, NULL);
 
 DEFINE_CLOCK(sdhc1_clk,   0, MXC_CCM_CGR0,  0, NULL, NULL, &perclk_clk);
 DEFINE_CLOCK(sdhc2_clk,   1, MXC_CCM_CGR0,  2, NULL, NULL, &perclk_clk);
@@ -490,7 +491,7 @@ DEFINE_CLOCK(mpeg4_clk,   0, MXC_CCM_CGR1,  0, NULL, NULL, &ahb_clk);
 DEFINE_CLOCK(mstick1_clk, 0, MXC_CCM_CGR1,  2, mstick1_get_rate, NULL, &usb_pll_clk);
 DEFINE_CLOCK(mstick2_clk, 1, MXC_CCM_CGR1,  4, mstick2_get_rate, NULL, &usb_pll_clk);
 DEFINE_CLOCK1(csi_clk,    0, MXC_CCM_CGR1,  6, csi, NULL, &serial_pll_clk);
-DEFINE_CLOCK(rtc_clk,     0, MXC_CCM_CGR1,  8, NULL, NULL, &ipg_clk);
+DEFINE_CLOCK(rtc_clk,     0, MXC_CCM_CGR1,  8, NULL, NULL, &ckil_clk);
 DEFINE_CLOCK(wdog_clk,    0, MXC_CCM_CGR1, 10, NULL, NULL, &ipg_clk);
 DEFINE_CLOCK(pwm_clk,     0, MXC_CCM_CGR1, 12, NULL, NULL, &perclk_clk);
 DEFINE_CLOCK(usb_clk2,    0, MXC_CCM_CGR1, 18, usb_get_rate, NULL, &ahb_clk);
@@ -514,7 +515,6 @@ DEFINE_CLOCK(usb_clk1,    0, NULL,          0, usb_get_rate, NULL, &usb_pll_clk)
 DEFINE_CLOCK(nfc_clk,     0, NULL,          0, nfc_get_rate, NULL, &ahb_clk);
 DEFINE_CLOCK(scc_clk,     0, NULL,          0, NULL, NULL, &ipg_clk);
 DEFINE_CLOCK(ipg_clk,     0, NULL,          0, ipg_get_rate, NULL, &ahb_clk);
-DEFINE_CLOCK(ckil_clk,    0, NULL,          0, clk_ckil_get_rate, NULL, NULL);
 
 #define _REGISTER_CLOCK(d, n, c) \
 	{ \
@@ -572,7 +572,6 @@ static struct clk_lookup lookups[] = {
 	_REGISTER_CLOCK(NULL, "iim", iim_clk)
 	_REGISTER_CLOCK(NULL, "mpeg4", mpeg4_clk)
 	_REGISTER_CLOCK(NULL, "mbx", mbx_clk)
-	_REGISTER_CLOCK("mxc_rtc", NULL, ckil_clk)
 };
 
 int __init mx31_clocks_init(unsigned long fref)
Signature · 1 line
1.6.6.1
#1 lore raw

PATCH 2/3 imx3: Add rtc platform device support

This patch adds support for build-in RTC device found on Freescale imx31 and imx35 SoCs.

---
 arch/arm/mach-mx3/devices.c |   19 +++++++++++++++++++
 arch/arm/mach-mx3/devices.h |    1 +
 2 files changed, 20 insertions(+), 0 deletions(-)
arch/arm/mach-mx3/devices.c +19 -0
index f891115..1ffed28 100644
@@ -588,6 +588,25 @@ struct platform_device imx_wdt_device0 = {
 	.resource       = imx_wdt_resources,
 };
 
+static struct resource imx_rtc_resources[] = {
+	{
+		.start  = MX31_RTC_BASE_ADDR,
+		.end    = MX31_RTC_BASE_ADDR + 0x3fff,
+		.flags  = IORESOURCE_MEM,
+	},
+	{
+		.start  = MX31_INT_RTC,
+		.flags  = IORESOURCE_IRQ,
+	},
+};
+
+struct platform_device imx_rtc_device0 = {
+	.name           = "mxc_rtc",
+	.id             = -1,
+	.num_resources  = ARRAY_SIZE(imx_rtc_resources),
+	.resource       = imx_rtc_resources,
+};
+
 static int __init mx3_devices_init(void)
 {
 	if (cpu_is_mx31()) {
arch/arm/mach-mx3/devices.h +1 -0
index 4f77eb5..b1687ad 100644
@@ -27,3 +27,4 @@ extern struct platform_device imx_ssi_device0;
 extern struct platform_device imx_ssi_device1;
 extern struct platform_device imx_ssi_device1;
 extern struct platform_device imx_wdt_device0;
+extern struct platform_device imx_rtc_device0;
Signature · 1 line
1.6.6.1
#2 lore raw

PATCH 3/3 imx31: add rtc device on litekit board.

This patch adds support for SoC build-in RTC device on litekit board.

---
 arch/arm/mach-mx3/mx31lite-db.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
arch/arm/mach-mx3/mx31lite-db.c +1 -0
index 0201683..466996e 100644
@@ -207,5 +207,6 @@ void __init mx31lite_db_init(void)
 	mxc_register_device(&mxc_spi_device0, &spi0_pdata);
 	platform_device_register(&litekit_led_device);
 	mxc_register_device(&imx_wdt_device0, NULL);
+	mxc_register_device(&imx_rtc_device0, NULL);
 }
 
Signature · 1 line
1.6.6.1
maintainer
#3 lore raw

PATCH 2/3 imx3: Add rtc platform device support

In reply to Vladimir Zapolskiy

Hi Vladimir,

Quoted 15 lines · Vladimir Zapolskiy

This patch adds support for build-in RTC device found on Freescale imx31 and imx35 SoCs.

---
 arch/arm/mach-mx3/devices.c |   19 +++++++++++++++++++
 arch/arm/mach-mx3/devices.h |    1 +
 2 files changed, 20 insertions(+), 0 deletions(-)
arch/arm/mach-mx3/devices.c +0 -0
index f891115..1ffed28 100644

arch/arm/mach-mx3/devices.c struct platform_device imx_wdt_device0 = { · line 588

Quoted 1 line
arch/arm/mach-mx3/devices.c +0 -0
@@ -588,6 +588,25 @@ struct platform_device imx_wdt_device0 = {
 	.resource       = imx_wdt_resources,

This patch does not apply. We do not have the watchdog in devices.c atm.

arch/arm/mach-mx3/devices.c struct platform_device imx_wdt_device0 = { · line 600

Quoted 12 lines
arch/arm/mach-mx3/devices.c +10 -0
 };
 
+static struct resource imx_rtc_resources[] = {
+	{
+		.start  = MX31_RTC_BASE_ADDR,
+		.end    = MX31_RTC_BASE_ADDR + 0x3fff,
+		.flags  = IORESOURCE_MEM,
+	},
+	{
+		.start  = MX31_INT_RTC,
+		.flags  = IORESOURCE_IRQ,
+	},

Can you provide a fixup for i.MX35, please? See mx3_devices_init().

Sascha

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 |
#4 lore raw

PATCH 2/3 imx3: Add rtc platform device support

Hi Sasha,

Quoted 12 lines · Vladimir Zapolskiy
Quoted 10 lines

This patch adds support for build-in RTC device found on Freescale imx31 and imx35 SoCs.

---
 arch/arm/mach-mx3/devices.c |   19 +++++++++++++++++++
 arch/arm/mach-mx3/devices.h |    1 +
 2 files changed, 20 insertions(+), 0 deletions(-)
Quoted 9 lines

arch/arm/mach-mx3/devices.c struct platform_device imx_wdt_device0 = { · line 588

Quoted 6 lines
arch/arm/mach-mx3/devices.c +0 -0
index f891115..1ffed28 100644
@@ -588,6 +588,25 @@ struct platform_device imx_wdt_device0 = {
 	.resource       = imx_wdt_resources,

This patch does not apply. We do not have the watchdog in devices.c atm.

please could you suggest the appropriate branch, because this patch is based on mxc-master branch, where the watchdog is already pushed, see
http://git.pengutronix.de/?p=imx/linux-2.6.git;a=shortlog;h=refs/heads/mxc-master

Quoted 14 lines

arch/arm/mach-mx3/devices.c struct platform_device imx_wdt_device0 = { · line 600

Quoted 12 lines
arch/arm/mach-mx3/devices.c +10 -0
 };
 
+static struct resource imx_rtc_resources[] = {
+	{
+		.start  = MX31_RTC_BASE_ADDR,
+		.end    = MX31_RTC_BASE_ADDR + 0x3fff,
+		.flags  = IORESOURCE_MEM,
+	},
+	{
+		.start  = MX31_INT_RTC,
+		.flags  = IORESOURCE_IRQ,
+	},

Can you provide a fixup for i.MX35, please? See mx3_devices_init().

Surely. Before patch submission I just checked that base address, size and interrupt number are equal for i.MX31 and i.MX35 SoCs, and I've found that in such cases the resources are defined using MX31 macros, see imx_ssi_resources or mxc_usbhX_resources as reference.

Probably better to separate the devices.c file into two files? You see one day I hope i.MX37 support will be included into the Linux kernel, and it would be quite uncomfortable to support three kinds of peripheral in a single file.

--
With best wishes,
Vladimir

maintainer
#5 lore raw

PATCH 2/3 imx3: Add rtc platform device support

Quoted 24 lines · Vladimir Zapolskiy

Hi Sasha,

Quoted 12 lines · Vladimir Zapolskiy
Quoted 10 lines

This patch adds support for build-in RTC device found on Freescale imx31 and imx35 SoCs.

---
 arch/arm/mach-mx3/devices.c |   19 +++++++++++++++++++
 arch/arm/mach-mx3/devices.h |    1 +
 2 files changed, 20 insertions(+), 0 deletions(-)
Quoted 9 lines

arch/arm/mach-mx3/devices.c struct platform_device imx_wdt_device0 = { · line 588

Quoted 6 lines
arch/arm/mach-mx3/devices.c +0 -0
index f891115..1ffed28 100644
@@ -588,6 +588,25 @@ struct platform_device imx_wdt_device0 = {
 	.resource       = imx_wdt_resources,

This patch does not apply. We do not have the watchdog in devices.c atm.

Quoted 3 lines

please could you suggest the appropriate branch, because this patch is based on mxc-master branch, where the watchdog is already pushed, see
http://git.pengutronix.de/?p=imx/linux-2.6.git;a=shortlog;h=refs/heads/mxc-master

Oh, my bad. I myself tried to push it on master and not on mxc-master.

Quoted 16 lines
Quoted 15 lines

arch/arm/mach-mx3/devices.c struct platform_device imx_wdt_device0 = { · line 600

Quoted 13 lines
arch/arm/mach-mx3/devices.c +10 -0
 };
 
+static struct resource imx_rtc_resources[] = {
+	{
+		.start  = MX31_RTC_BASE_ADDR,
+		.end    = MX31_RTC_BASE_ADDR + 0x3fff,
+		.flags  = IORESOURCE_MEM,
+	},
+	{
+		.start  = MX31_INT_RTC,
+		.flags  = IORESOURCE_IRQ,
+	},

Can you provide a fixup for i.MX35, please? See mx3_devices_init().

Quoted 4 lines

Surely. Before patch submission I just checked that base address, size and interrupt number are equal for i.MX31 and i.MX35 SoCs, and I've found that in such cases the resources are defined using MX31 macros, see imx_ssi_resources or mxc_usbhX_resources as reference.

Ok. I just saw that there are two defines without checking that they are actually identical.

Quoted 5 lines

Probably better to separate the devices.c file into two files? You see one day I hope i.MX37 support will be included into the Linux kernel, and it would be quite uncomfortable to support three kinds of peripheral in a single file.

We are already working on seperating them. Have a look at the i.MX21/27 devices.c.

Sascha

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 |