linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ARM: EXYNOS: Fix support of Exynos4210 rev0 SoC
@ 2013-05-15 15:08 Tomasz Figa
  2013-05-20 19:58 ` Tomasz Figa
  0 siblings, 1 reply; 6+ messages in thread
From: Tomasz Figa @ 2013-05-15 15:08 UTC (permalink / raw)
  To: linux-arm-kernel

This patch extends exynos_init_time() function to handle Exynos4210 rev0
SoC, which differs in availability of system timers and needs different
clocksource initialization.

This makes it possible to use exynos_init_time() function as init_time
callback for all Exynos-based boards, including Universal_C210, which
originally had to use samsung_timer_init().

Signed-off-by: Tomasz Figa <t.figa@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
---
 arch/arm/mach-exynos/Kconfig               |  3 ++-
 arch/arm/mach-exynos/common.c              | 30 +++++++++++++++++++++++++++++-
 arch/arm/mach-exynos/common.h              |  2 ++
 arch/arm/mach-exynos/mach-universal_c210.c |  5 ++---
 4 files changed, 35 insertions(+), 5 deletions(-)

diff --git a/arch/arm/mach-exynos/Kconfig b/arch/arm/mach-exynos/Kconfig
index d19edff..ff18fc2 100644
--- a/arch/arm/mach-exynos/Kconfig
+++ b/arch/arm/mach-exynos/Kconfig
@@ -250,6 +250,7 @@ config MACH_ARMLEX4210
 config MACH_UNIVERSAL_C210
 	bool "Mobile UNIVERSAL_C210 Board"
 	select CLKSRC_MMIO
+	select CLKSRC_SAMSUNG_PWM
 	select CPU_EXYNOS4210
 	select EXYNOS4_SETUP_FIMC
 	select EXYNOS4_SETUP_FIMD0
@@ -281,7 +282,6 @@ config MACH_UNIVERSAL_C210
 	select S5P_DEV_TV
 	select S5P_GPIO_INT
 	select S5P_SETUP_MIPIPHY
-	select SAMSUNG_HRT
 	help
 	  Machine support for Samsung Mobile Universal S5PC210 Reference
 	  Board.
@@ -410,6 +410,7 @@ config MACH_EXYNOS4_DT
 	depends on ARCH_EXYNOS4
 	select ARM_AMBA
 	select CLKSRC_OF
+	select CLKSRC_SAMSUNG_PWM if CPU_EXYNOS4210
 	select CPU_EXYNOS4210
 	select KEYBOARD_SAMSUNG if INPUT_KEYBOARD
 	select PINCTRL
diff --git a/arch/arm/mach-exynos/common.c b/arch/arm/mach-exynos/common.c
index 745e304..a2d2012 100644
--- a/arch/arm/mach-exynos/common.c
+++ b/arch/arm/mach-exynos/common.c
@@ -10,12 +10,14 @@
  */
 
 #include <linux/kernel.h>
+#include <linux/bitops.h>
 #include <linux/interrupt.h>
 #include <linux/irq.h>
 #include <linux/irqchip.h>
 #include <linux/io.h>
 #include <linux/device.h>
 #include <linux/gpio.h>
+#include <clocksource/samsung_pwm.h>
 #include <linux/sched.h>
 #include <linux/serial_core.h>
 #include <linux/of.h>
@@ -302,6 +304,13 @@ static struct map_desc exynos5440_iodesc0[] __initdata = {
 	},
 };
 
+static struct samsung_pwm_variant exynos4_pwm_variant = {
+	.bits		= 32,
+	.div_base	= 0,
+	.has_tint_cstat	= true,
+	.tclk_mask	= 0,
+};
+
 void exynos4_restart(char mode, const char *cmd)
 {
 	__raw_writel(0x1, S5P_SWRESET);
@@ -442,8 +451,20 @@ static void __init exynos5440_map_io(void)
 	iotable_init(exynos5440_iodesc0, ARRAY_SIZE(exynos5440_iodesc0));
 }
 
+void __init exynos_set_timer_source(u8 channels)
+{
+	exynos4_pwm_variant.output_mask = BIT(SAMSUNG_PWM_NUM) - 1;
+	exynos4_pwm_variant.output_mask &= ~channels;
+}
+
 void __init exynos_init_time(void)
 {
+	unsigned int timer_irqs[SAMSUNG_PWM_NUM] = {
+		EXYNOS4_IRQ_TIMER0_VIC, EXYNOS4_IRQ_TIMER1_VIC,
+		EXYNOS4_IRQ_TIMER2_VIC, EXYNOS4_IRQ_TIMER3_VIC,
+		EXYNOS4_IRQ_TIMER4_VIC,
+	};
+
 	if (of_have_populated_dt()) {
 #ifdef CONFIG_OF
 		of_clk_init(NULL);
@@ -455,7 +476,14 @@ void __init exynos_init_time(void)
 		exynos4_clk_init(NULL, !soc_is_exynos4210(), S5P_VA_CMU, readl(S5P_VA_CHIPID + 8) & 1);
 		exynos4_clk_register_fixed_ext(xxti_f, xusbxti_f);
 #endif
-		mct_init(S5P_VA_SYSTIMER, EXYNOS4_IRQ_MCT_G0, EXYNOS4_IRQ_MCT_L0, EXYNOS4_IRQ_MCT_L1);
+#ifdef CONFIG_CLKSRC_SAMSUNG_PWM
+		if (soc_is_exynos4210() && samsung_rev() == EXYNOS4210_REV_0)
+			samsung_pwm_clocksource_init(S3C_VA_TIMER,
+					timer_irqs, &exynos4_pwm_variant);
+		else
+#endif
+			mct_init(S5P_VA_SYSTIMER, EXYNOS4_IRQ_MCT_G0,
+					EXYNOS4_IRQ_MCT_L0, EXYNOS4_IRQ_MCT_L1);
 	}
 }
 
diff --git a/arch/arm/mach-exynos/common.h b/arch/arm/mach-exynos/common.h
index 60dd35c..11fc1e2 100644
--- a/arch/arm/mach-exynos/common.h
+++ b/arch/arm/mach-exynos/common.h
@@ -32,6 +32,8 @@ void exynos4_clk_register_fixed_ext(unsigned long, unsigned long);
 
 void exynos_firmware_init(void);
 
+void exynos_set_timer_source(u8 channels);
+
 #ifdef CONFIG_PM_GENERIC_DOMAINS
 int exynos_pm_late_initcall(void);
 #else
diff --git a/arch/arm/mach-exynos/mach-universal_c210.c b/arch/arm/mach-exynos/mach-universal_c210.c
index 327d50d..74ddb2b 100644
--- a/arch/arm/mach-exynos/mach-universal_c210.c
+++ b/arch/arm/mach-exynos/mach-universal_c210.c
@@ -41,7 +41,6 @@
 #include <plat/mfc.h>
 #include <plat/sdhci.h>
 #include <plat/fimc-core.h>
-#include <plat/samsung-time.h>
 #include <plat/camport.h>
 
 #include <mach/map.h>
@@ -1094,7 +1093,7 @@ static void __init universal_map_io(void)
 {
 	exynos_init_io(NULL, 0);
 	s3c24xx_init_uarts(universal_uartcfgs, ARRAY_SIZE(universal_uartcfgs));
-	samsung_set_timer_source(SAMSUNG_PWM2, SAMSUNG_PWM4);
+	exynos_set_timer_source(BIT(2) | BIT(4));
 	xxti_f = 0;
 	xusbxti_f = 24000000;
 }
@@ -1154,7 +1153,7 @@ MACHINE_START(UNIVERSAL_C210, "UNIVERSAL_C210")
 	.map_io		= universal_map_io,
 	.init_machine	= universal_machine_init,
 	.init_late	= exynos_init_late,
-	.init_time	= samsung_timer_init,
+	.init_time	= exynos_init_time,
 	.reserve        = &universal_reserve,
 	.restart	= exynos4_restart,
 MACHINE_END
-- 
1.8.2.1

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH] ARM: EXYNOS: Fix support of Exynos4210 rev0 SoC
  2013-05-15 15:08 [PATCH] ARM: EXYNOS: Fix support of Exynos4210 rev0 SoC Tomasz Figa
@ 2013-05-20 19:58 ` Tomasz Figa
  2013-05-21  1:27   ` Kukjin Kim
  2013-05-23  1:11   ` Kukjin Kim
  0 siblings, 2 replies; 6+ messages in thread
From: Tomasz Figa @ 2013-05-20 19:58 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Kukjin,

On Wednesday 15 of May 2013 17:08:04 Tomasz Figa wrote:
> This patch extends exynos_init_time() function to handle Exynos4210 rev0
> SoC, which differs in availability of system timers and needs different
> clocksource initialization.
> 
> This makes it possible to use exynos_init_time() function as init_time
> callback for all Exynos-based boards, including Universal_C210, which
> originally had to use samsung_timer_init().
> 
> Signed-off-by: Tomasz Figa <t.figa@samsung.com>
> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
> ---
>  arch/arm/mach-exynos/Kconfig               |  3 ++-
>  arch/arm/mach-exynos/common.c              | 30
> +++++++++++++++++++++++++++++- arch/arm/mach-exynos/common.h           
>   |  2 ++
>  arch/arm/mach-exynos/mach-universal_c210.c |  5 ++---
>  4 files changed, 35 insertions(+), 5 deletions(-)

Could you pick this patch to your fixes branch?

This is a fix of a regression in handling Exynos4210 rev0 SoC (e.g. 
Universal C210 board) introduced by patches merged to 3.10.

Best regards,
Tomasz

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH] ARM: EXYNOS: Fix support of Exynos4210 rev0 SoC
  2013-05-20 19:58 ` Tomasz Figa
@ 2013-05-21  1:27   ` Kukjin Kim
  2013-05-23  1:11   ` Kukjin Kim
  1 sibling, 0 replies; 6+ messages in thread
From: Kukjin Kim @ 2013-05-21  1:27 UTC (permalink / raw)
  To: linux-arm-kernel

Tomasz Figa wrote:
> 
> Hi Kukjin,
> 
Hi,

> On Wednesday 15 of May 2013 17:08:04 Tomasz Figa wrote:
> > This patch extends exynos_init_time() function to handle Exynos4210 rev0
> > SoC, which differs in availability of system timers and needs different
> > clocksource initialization.
> >
> > This makes it possible to use exynos_init_time() function as init_time
> > callback for all Exynos-based boards, including Universal_C210, which
> > originally had to use samsung_timer_init().
> >
> > Signed-off-by: Tomasz Figa <t.figa@samsung.com>
> > Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
> > ---
> >  arch/arm/mach-exynos/Kconfig               |  3 ++-
> >  arch/arm/mach-exynos/common.c              | 30
> > +++++++++++++++++++++++++++++- arch/arm/mach-exynos/common.h
> >   |  2 ++
> >  arch/arm/mach-exynos/mach-universal_c210.c |  5 ++---
> >  4 files changed, 35 insertions(+), 5 deletions(-)
> 
> Could you pick this patch to your fixes branch?
> 
Yeah, I will after looking at.

> This is a fix of a regression in handling Exynos4210 rev0 SoC (e.g.
> Universal C210 board) introduced by patches merged to 3.10.
> 
OK, I see but I didn't review yet and I  will within a couple of days ;-)

- Kukjin

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH] ARM: EXYNOS: Fix support of Exynos4210 rev0 SoC
  2013-05-20 19:58 ` Tomasz Figa
  2013-05-21  1:27   ` Kukjin Kim
@ 2013-05-23  1:11   ` Kukjin Kim
  2013-05-23 10:37     ` Tomasz Figa
  2013-05-29  9:16     ` Marek Szyprowski
  1 sibling, 2 replies; 6+ messages in thread
From: Kukjin Kim @ 2013-05-23  1:11 UTC (permalink / raw)
  To: linux-arm-kernel

Kukjin Kim wrote:
> 
> Tomasz Figa wrote:
> >
> > Hi Kukjin,
> >
> Hi,
> 
> > On Wednesday 15 of May 2013 17:08:04 Tomasz Figa wrote:
> > > This patch extends exynos_init_time() function to handle Exynos4210
> rev0
> > > SoC, which differs in availability of system timers and needs
> different
> > > clocksource initialization.
> > >
> > > This makes it possible to use exynos_init_time() function as init_time
> > > callback for all Exynos-based boards, including Universal_C210, which
> > > originally had to use samsung_timer_init().
> > >
> > > Signed-off-by: Tomasz Figa <t.figa@samsung.com>
> > > Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
> > > ---
> > >  arch/arm/mach-exynos/Kconfig               |  3 ++-
> > >  arch/arm/mach-exynos/common.c              | 30
> > > +++++++++++++++++++++++++++++- arch/arm/mach-exynos/common.h
> > >   |  2 ++
> > >  arch/arm/mach-exynos/mach-universal_c210.c |  5 ++---
> > >  4 files changed, 35 insertions(+), 5 deletions(-)
> >
> > Could you pick this patch to your fixes branch?
> >
> Yeah, I will after looking at.
> 
> > This is a fix of a regression in handling Exynos4210 rev0 SoC (e.g.
> > Universal C210 board) introduced by patches merged to 3.10.
> >
> OK, I see but I didn't review yet and I  will within a couple of days ;-)
> 
OK, looks fine, this will be sent to upstream during -rc for v3.10.

But, Tomasz, as you know, non-DT supporting files will be gone away in
v3.11, just note.

Thanks.

- Kukjin

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH] ARM: EXYNOS: Fix support of Exynos4210 rev0 SoC
  2013-05-23  1:11   ` Kukjin Kim
@ 2013-05-23 10:37     ` Tomasz Figa
  2013-05-29  9:16     ` Marek Szyprowski
  1 sibling, 0 replies; 6+ messages in thread
From: Tomasz Figa @ 2013-05-23 10:37 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Kukjin,

On Thursday 23 of May 2013 10:11:17 Kukjin Kim wrote:
> Kukjin Kim wrote:
> > Tomasz Figa wrote:
> > > Hi Kukjin,
> > 
> > Hi,
> > 
> > > On Wednesday 15 of May 2013 17:08:04 Tomasz Figa wrote:
> > > > This patch extends exynos_init_time() function to handle Exynos4210
> > 
> > rev0
> > 
> > > > SoC, which differs in availability of system timers and needs
> > 
> > different
> > 
> > > > clocksource initialization.
> > > > 
> > > > This makes it possible to use exynos_init_time() function as init_time
> > > > callback for all Exynos-based boards, including Universal_C210, which
> > > > originally had to use samsung_timer_init().
> > > > 
> > > > Signed-off-by: Tomasz Figa <t.figa@samsung.com>
> > > > Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
> > > > ---
> > > > 
> > > >  arch/arm/mach-exynos/Kconfig               |  3 ++-
> > > >  arch/arm/mach-exynos/common.c              | 30
> > > > 
> > > > +++++++++++++++++++++++++++++- arch/arm/mach-exynos/common.h
> > > > 
> > > >   |  2 ++
> > > >  
> > > >  arch/arm/mach-exynos/mach-universal_c210.c |  5 ++---
> > > >  4 files changed, 35 insertions(+), 5 deletions(-)
> > > 
> > > Could you pick this patch to your fixes branch?
> > 
> > Yeah, I will after looking at.
> > 
> > > This is a fix of a regression in handling Exynos4210 rev0 SoC (e.g.
> > > Universal C210 board) introduced by patches merged to 3.10.
> > 
> > OK, I see but I didn't review yet and I  will within a couple of days ;-)
> 
> OK, looks fine, this will be sent to upstream during -rc for v3.10.

Thanks.

> But, Tomasz, as you know, non-DT supporting files will be gone away in
> v3.11, just note.

Sure. This is a good thing.

In 3.11 Universal C210 will be supported only using device tree, but for 3.10 
we need this patch to make the old board file still work.

Best regards,
-- 
Tomasz Figa
Linux Kernel Developer
Samsung R&D Institute Poland
Samsung Electronics

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH] ARM: EXYNOS: Fix support of Exynos4210 rev0 SoC
  2013-05-23  1:11   ` Kukjin Kim
  2013-05-23 10:37     ` Tomasz Figa
@ 2013-05-29  9:16     ` Marek Szyprowski
  1 sibling, 0 replies; 6+ messages in thread
From: Marek Szyprowski @ 2013-05-29  9:16 UTC (permalink / raw)
  To: linux-arm-kernel

Hello,

On 5/23/2013 3:11 AM, Kukjin Kim wrote:
> Kukjin Kim wrote:
> >
> > Tomasz Figa wrote:
> > >
> > > Hi Kukjin,
> > >
> > Hi,
> >
> > > On Wednesday 15 of May 2013 17:08:04 Tomasz Figa wrote:
> > > > This patch extends exynos_init_time() function to handle Exynos4210
> > rev0
> > > > SoC, which differs in availability of system timers and needs
> > different
> > > > clocksource initialization.
> > > >
> > > > This makes it possible to use exynos_init_time() function as init_time
> > > > callback for all Exynos-based boards, including Universal_C210, which
> > > > originally had to use samsung_timer_init().
> > > >
> > > > Signed-off-by: Tomasz Figa <t.figa@samsung.com>
> > > > Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
> > > > ---
> > > >  arch/arm/mach-exynos/Kconfig               |  3 ++-
> > > >  arch/arm/mach-exynos/common.c              | 30
> > > > +++++++++++++++++++++++++++++- arch/arm/mach-exynos/common.h
> > > >   |  2 ++
> > > >  arch/arm/mach-exynos/mach-universal_c210.c |  5 ++---
> > > >  4 files changed, 35 insertions(+), 5 deletions(-)
> > >
> > > Could you pick this patch to your fixes branch?
> > >
> > Yeah, I will after looking at.
> >
> > > This is a fix of a regression in handling Exynos4210 rev0 SoC (e.g.
> > > Universal C210 board) introduced by patches merged to 3.10.
> > >
> > OK, I see but I didn't review yet and I  will within a couple of days ;-)
> >
> OK, looks fine, this will be sent to upstream during -rc for v3.10.
>
> But, Tomasz, as you know, non-DT supporting files will be gone away in
> v3.11, just note.

This patch is needed to get REV0 4210 based board working both in DT and 
non-DT
modes.

Best regards
-- 
Marek Szyprowski
Samsung R&D Institute Poland

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2013-05-29  9:16 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-05-15 15:08 [PATCH] ARM: EXYNOS: Fix support of Exynos4210 rev0 SoC Tomasz Figa
2013-05-20 19:58 ` Tomasz Figa
2013-05-21  1:27   ` Kukjin Kim
2013-05-23  1:11   ` Kukjin Kim
2013-05-23 10:37     ` Tomasz Figa
2013-05-29  9:16     ` Marek Szyprowski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).