Skip to contentSkip to conversation

ARM: Exynos: Fixes for Exynos5 device tree support

PATCH New Thomas Abraham 3 participants 10 messages Mar 27, 2012 – Apr 10, 2012

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

cover ARM: Exynos: Fixes for Exynos5 device tree support

This series includes general fixes for Exynos5 device tree support. This is based on the following tree. Both Exynos4 and Exynos5 device tree support have been tested when this series.

http://git.kernel.org/pub/scm/linux/kernel/git/kgene/linux-samsung.git [for-next]

Thomas Abraham (4):
ARM: Exynos: Use CHIP_ID to detect cpu type during decompression setup
ARM: Exynos: Remove a new bus_type instance for Exynos5
ARM: Exynos5: Fix incorrect initialization of GIC
ARM: Exynos5: Add PDMA and MDMA physical base address defines

 arch/arm/mach-exynos/common.c                  |   21 +++------------------
 arch/arm/mach-exynos/include/mach/map.h        |    5 +++++
 arch/arm/mach-exynos/include/mach/uncompress.h |    6 +++++-
 arch/arm/mach-exynos/mach-exynos5-dt.c         |    3 ++-
 4 files changed, 15 insertions(+), 20 deletions(-)
#1 lore raw

PATCH 1/4 ARM: Exynos: Use CHIP_ID to detect cpu type during decompression setup

The config option MACH_SMDK5250 is not available for Exynos5 since only a device tree based machine is supported and selected by MACH_EXYNOS5_DT. Hence, the detection of the cpu type based on machine_is_smdk5250 always fails and boot hangs due to incorrect uart base being used. Fix this by reading the chip id to determine the cpu type and setup the uart_base accordingly.

---
 arch/arm/mach-exynos/include/mach/uncompress.h |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)
arch/arm/mach-exynos/include/mach/uncompress.h +5 -1
index 493f4f3..603ea9b 100644
@@ -14,15 +14,19 @@
 
 #include <asm/mach-types.h>
 
+#include <plat/cpu.h>
 #include <mach/map.h>
 
 volatile u8 *uart_base;
 
 #include <plat/uncompress.h>
 
+#define __raw_readl(addr)		\
+	(*((volatile unsigned int __force *)(addr)))
+
 static void arch_detect_cpu(void)
 {
-	if (machine_is_smdk5250())
+	if ((__raw_readl(EXYNOS_PA_CHIPID) & EXYNOS5_SOC_MASK) == EXYNOS5250_SOC_ID)
 		uart_base = (volatile u8 *)EXYNOS5_PA_UART + (S3C_UART_OFFSET * CONFIG_S3C_LOWLEVEL_UART_PORT);
 	else
 		uart_base = (volatile u8 *)EXYNOS4_PA_UART + (S3C_UART_OFFSET * CONFIG_S3C_LOWLEVEL_UART_PORT);
Signature · 1 line
1.6.6.rc2
#2 lore raw

PATCH 1/4 ARM: Exynos: Use CHIP_ID to detect cpu type during decompression setup

Quoted 27 lines · Thomas Abraham

The config option MACH_SMDK5250 is not available for Exynos5 since only a device tree based machine is supported and selected by MACH_EXYNOS5_DT. Hence, the detection of the cpu type based on machine_is_smdk5250 always fails and boot hangs due to incorrect uart base being used. Fix this by reading the chip id to determine the cpu type and setup the uart_base accordingly.

---
  arch/arm/mach-exynos/include/mach/uncompress.h |    6 +++++-
  1 files changed, 5 insertions(+), 1 deletions(-)
arch/arm/mach-exynos/include/mach/uncompress.h +1 -0
index 493f4f3..603ea9b 100644
@@ -14,15 +14,19 @@
 
  #include<asm/mach-types.h>
 
+#include<plat/cpu.h>
  #include<mach/map.h>
 
  volatile u8 *uart_base;
 
  #include<plat/uncompress.h>
 

arch/arm/mach-exynos/include/mach/uncompress.h line 32

Quoted 10 lines
arch/arm/mach-exynos/include/mach/uncompress.h +4 -1
+#define __raw_readl(addr)		\
+	(*((volatile unsigned int __force *)(addr)))
+
  static void arch_detect_cpu(void)
  {
-	if (machine_is_smdk5250())
+	if ((__raw_readl(EXYNOS_PA_CHIPID)&  EXYNOS5_SOC_MASK) == EXYNOS5250_SOC_ID)
  		uart_base = (volatile u8 *)EXYNOS5_PA_UART + (S3C_UART_OFFSET * CONFIG_S3C_LOWLEVEL_UART_PORT);
  	else
  		uart_base = (volatile u8 *)EXYNOS4_PA_UART + (S3C_UART_OFFSET * CONFIG_S3C_LOWLEVEL_UART_PORT);

Hi Thomas,

Thanks for fix.

But I have following patch and it is not required to add inclusion of <plat/cpu.h>. How do you think? If you're ok, I would preferred to use follwoing.

(quoted diff) +0 -0

b/arch/arm/mach-exynos/include/mach/uncompress.h
index 493f4f3..2979995 100644

arch/arm/mach-exynos/include/mach/uncompress.h +16 -1
@@ -20,9 +20,24 @@ volatile u8 *uart_base;
 
 #include <plat/uncompress.h>
 
+static unsigned int __raw_readl(unsigned int ptr)
+{
+	return *((volatile unsigned int *)ptr);
+}
+
 static void arch_detect_cpu(void)
 {
-	if (machine_is_smdk5250())
+	u32 chip_id = __raw_readl(EXYNOS_PA_CHIPID);
+
+	/*
+	 * product_id is bits 31:12
+	 *    bits 23:20 describe the exynosX family
+	 *
+	 */
+	chip_id >>= 20;
+	chip_id &= 0xf;
+
+	if (chip_id == 0x5)
 		uart_base = (volatile u8 *)EXYNOS5_PA_UART + (S3C_UART_OFFSET *

CONFIG_S3C_LOWLEVEL_UART_PORT);
else
uart_base = (volatile u8 *)EXYNOS4_PA_UART + (S3C_UART_OFFSET *
CONFIG_S3C_LOWLEVEL_UART_PORT);

Thanks.

Best regards,
Kgene.
--
Kukjin Kim <[email protected]>, Senior Engineer, SW Solution Development Team, Samsung Electronics Co., Ltd.

#3 lore raw

PATCH 2/4 ARM: Exynos: Remove a new bus_type instance for Exynos5

In reply to Thomas Abraham

A seperate bus_type instance is not required for Exynos5. The existing bus_type instance used with Exynos4 is sufficient for both Exynos4 and Exynos5. This also solves issue of uninitialized usage of exynos4_subsys in Exynos4 power management code that is reused for Exynos5 also.

---
 arch/arm/mach-exynos/common.c |   19 ++-----------------
 1 files changed, 2 insertions(+), 17 deletions(-)
arch/arm/mach-exynos/common.c +2 -17
index a750a5d..f265dc4 100644
@@ -563,25 +563,13 @@ struct bus_type exynos4_subsys = {
 	.dev_name	= "exynos4-core",
 };
 
-struct bus_type exynos5_subsys = {
-	.name		= "exynos5-core",
-	.dev_name	= "exynos5-core",
-};
-
 static struct device exynos4_dev = {
 	.bus	= &exynos4_subsys,
 };
 
-static struct device exynos5_dev = {
-	.bus	= &exynos5_subsys,
-};
-
 static int __init exynos_core_init(void)
 {
-	if (soc_is_exynos5250())
-		return subsys_system_register(&exynos5_subsys, NULL);
-	else
-		return subsys_system_register(&exynos4_subsys, NULL);
+	return subsys_system_register(&exynos4_subsys, NULL);
 }
 core_initcall(exynos_core_init);
 
@@ -667,10 +655,7 @@ static int __init exynos_init(void)
 {
 	printk(KERN_INFO "EXYNOS: Initializing architecture\n");
 
-	if (soc_is_exynos5250())
-		return device_register(&exynos5_dev);
-	else
-		return device_register(&exynos4_dev);
+	return device_register(&exynos4_dev);
 }
 
 /* uart registration process */
Signature · 1 line
1.6.6.rc2
#4 lore raw

PATCH 3/4 ARM: Exynos5: Fix incorrect initialization of GIC

In reply to Thomas Abraham

Use the of_irq_init() call to setup the gic which also properly registers the gic device node pointer with gic irq domain, without which all interrupt specifier translations for gic fail.

---
 arch/arm/mach-exynos/common.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
arch/arm/mach-exynos/common.c +1 -1
index f265dc4..3bf39a8 100644
@@ -542,7 +542,7 @@ void __init exynos5_init_irq(void)
 {
 	int irq;
 
-	gic_init(0, IRQ_PPI(0), S5P_VA_GIC_DIST, S5P_VA_GIC_CPU);
+	of_irq_init(exynos4_dt_irq_match);
 
 	for (irq = 0; irq < EXYNOS5_MAX_COMBINER_NR; irq++) {
 		combiner_init(irq, (void __iomem *)S5P_VA_COMBINER(irq),
Signature · 1 line
1.6.6.rc2
#5 lore raw

PATCH 3/4 ARM: Exynos5: Fix incorrect initialization of GIC

Quoted 14 lines · Thomas Abraham

Use the of_irq_init() call to setup the gic which also properly registers the gic device node pointer with gic irq domain, without which all interrupt specifier translations for gic fail.

---
  arch/arm/mach-exynos/common.c |    2 +-
  1 files changed, 1 insertions(+), 1 deletions(-)
arch/arm/mach-exynos/common.c +0 -0
index f265dc4..3bf39a8 100644

arch/arm/mach-exynos/common.c void __init exynos5_init_irq(void) · line 548

Quoted 8 lines
arch/arm/mach-exynos/common.c +1 -1
@@ -542,7 +542,7 @@ void __init exynos5_init_irq(void)
  {
  	int irq;
 
-	gic_init(0, IRQ_PPI(0), S5P_VA_GIC_DIST, S5P_VA_GIC_CPU);
+	of_irq_init(exynos4_dt_irq_match);
 
  	for (irq = 0; irq<  EXYNOS5_MAX_COMBINER_NR; irq++) {
  		combiner_init(irq, (void __iomem *)S5P_VA_COMBINER(irq),

Yes, right. The of_irq_init() shold be used instead. But I need to check about the usage of SPI and if any updates, let you know :)

Thanks.

Best regards,
Kgene.
--
Kukjin Kim <[email protected]>, Senior Engineer, SW Solution Development Team, Samsung Electronics Co., Ltd.

#6 lore raw

PATCH 4/4 ARM: Exynos5: Add PDMA and MDMA physical base address defines

In reply to Thomas Abraham

Add PDMA and MDMA physical base address macros which is require for Exynos5 of_dev_auxdata setup.

---
 arch/arm/mach-exynos/include/mach/map.h |    5 +++++
 arch/arm/mach-exynos/mach-exynos5-dt.c  |    3 ++-
 2 files changed, 7 insertions(+), 1 deletions(-)
arch/arm/mach-exynos/include/mach/map.h +5 -0
index 024d38f..37d93fd 100644
@@ -90,6 +90,11 @@
 #define EXYNOS4_PA_PDMA0		0x12680000
 #define EXYNOS4_PA_PDMA1		0x12690000
 
+#define EXYNOS5_PA_PDMA0		0x121A0000
+#define EXYNOS5_PA_PDMA1		0x121B0000
+#define EXYNOS5_PA_MDMA0		0x10800000
+#define EXYNOS5_PA_MDMA1		0x11C10000
+
 #define EXYNOS4_PA_SYSMMU_MDMA		0x10A40000
 #define EXYNOS4_PA_SYSMMU_SSS		0x10A50000
 #define EXYNOS4_PA_SYSMMU_FIMC0		0x11A20000
arch/arm/mach-exynos/mach-exynos5-dt.c +2 -1
index 0d26f50..cdc3a26 100644
@@ -45,7 +45,8 @@ static const struct of_dev_auxdata exynos5250_auxdata_lookup[] __initconst = {
 				"exynos4210-uart.3", NULL),
 	OF_DEV_AUXDATA("arm,pl330", EXYNOS5_PA_PDMA0, "dma-pl330.0", NULL),
 	OF_DEV_AUXDATA("arm,pl330", EXYNOS5_PA_PDMA1, "dma-pl330.1", NULL),
-	OF_DEV_AUXDATA("arm,pl330", EXYNOS5_PA_PDMA1, "dma-pl330.2", NULL),
+	OF_DEV_AUXDATA("arm,pl330", EXYNOS5_PA_MDMA0, "dma-pl330.2", NULL),
+	OF_DEV_AUXDATA("arm,pl330", EXYNOS5_PA_MDMA0, "dma-pl330.3", NULL),
 	{},
 };
 
Signature · 1 line
1.6.6.rc2
#7 lore raw

PATCH 4/4 ARM: Exynos5: Add PDMA and MDMA physical base address defines

Quoted 14 lines · Thomas Abraham

Add PDMA and MDMA physical base address macros which is require for Exynos5 of_dev_auxdata setup.

---
  arch/arm/mach-exynos/include/mach/map.h |    5 +++++
  arch/arm/mach-exynos/mach-exynos5-dt.c  |    3 ++-
  2 files changed, 7 insertions(+), 1 deletions(-)
arch/arm/mach-exynos/include/mach/map.h +0 -0
index 024d38f..37d93fd 100644

arch/arm/mach-exynos/include/mach/map.h line 97

Quoted 8 lines
arch/arm/mach-exynos/include/mach/map.h +5 -0
@@ -90,6 +90,11 @@
  #define EXYNOS4_PA_PDMA0		0x12680000
  #define EXYNOS4_PA_PDMA1		0x12690000
 
+#define EXYNOS5_PA_PDMA0		0x121A0000
+#define EXYNOS5_PA_PDMA1		0x121B0000
+#define EXYNOS5_PA_MDMA0		0x10800000
+#define EXYNOS5_PA_MDMA1		0x11C10000
+

See, "ARM: EXYNOS: Support DMA for Exynos5250 SoC"
http://lists.infradead.org/pipermail/linux-arm-kernel/2012-February/085434.html

But this merge window is not including it :(

arch/arm/mach-exynos/mach-exynos5-dt.c static const struct of_dev_auxdata exynos5250_auxdata_lookup[] __initconst = { · line 48

Quoted 13 lines
arch/arm/mach-exynos/include/mach/map.h +0 -0
  #define EXYNOS4_PA_SYSMMU_MDMA		0x10A40000
  #define EXYNOS4_PA_SYSMMU_SSS		0x10A50000
  #define EXYNOS4_PA_SYSMMU_FIMC0		0x11A20000
arch/arm/mach-exynos/mach-exynos5-dt.c +1 -1
index 0d26f50..cdc3a26 100644
@@ -45,7 +45,8 @@ static const struct of_dev_auxdata exynos5250_auxdata_lookup[] __initconst = {
  				"exynos4210-uart.3", NULL),
  	OF_DEV_AUXDATA("arm,pl330", EXYNOS5_PA_PDMA0, "dma-pl330.0", NULL),
  	OF_DEV_AUXDATA("arm,pl330", EXYNOS5_PA_PDMA1, "dma-pl330.1", NULL),
-	OF_DEV_AUXDATA("arm,pl330", EXYNOS5_PA_PDMA1, "dma-pl330.2", NULL),
+	OF_DEV_AUXDATA("arm,pl330", EXYNOS5_PA_MDMA0, "dma-pl330.2", NULL),

OK.

arch/arm/mach-exynos/mach-exynos5-dt.c static const struct of_dev_auxdata exynos5250_auxdata_lookup[] __initconst = { · line 49

Quoted 1 line
arch/arm/mach-exynos/mach-exynos5-dt.c +1 -0
+	OF_DEV_AUXDATA("arm,pl330", EXYNOS5_PA_MDMA0, "dma-pl330.3", NULL),

Well...there is a MDMA1 on EXYNOS5250 SoC, so if we can use MDMA1, should be MDMA1 for dma-pl330.3 but...I think, I need to check :)

arch/arm/mach-exynos/mach-exynos5-dt.c static const struct of_dev_auxdata exynos5250_auxdata_lookup[] __initconst = { · line 52

Quoted 3 lines
arch/arm/mach-exynos/mach-exynos5-dt.c +0 -0
  	{},
  };
 

Thanks.

Best regards,
Kgene.
--
Kukjin Kim <[email protected]>, Senior Engineer, SW Solution Development Team, Samsung Electronics Co., Ltd.

#8 lore raw

PATCH 4/4 ARM: Exynos5: Add PDMA and MDMA physical base address defines

Hi,

2012/3/28 Kukjin Kim <[email protected]>:

Quoted 27 lines
Quoted 17 lines · Thomas Abraham

Add PDMA and MDMA physical base address macros which is require for Exynos5 of_dev_auxdata setup.

---
? arch/arm/mach-exynos/include/mach/map.h | ? ?5 +++++ ? arch/arm/mach-exynos/mach-exynos5-dt.c ?| ? ?3 ++- ? 2 files changed, 7 insertions(+), 1 deletions(-)

arch/arm/mach-exynos/include/mach/map.h +0 -0
index 024d38f..37d93fd 100644
@@ -90,6 +90,11 @@

? #define EXYNOS4_PA_PDMA0 ? ? ? ? ? ?0x12680000
? #define EXYNOS4_PA_PDMA1 ? ? ? ? ? ?0x12690000

arch/arm/mach-exynos/include/mach/map.h

Quoted 5 lines
arch/arm/mach-exynos/include/mach/map.h +5 -0
+#define EXYNOS5_PA_PDMA0 ? ? ? ? ? ? 0x121A0000
+#define EXYNOS5_PA_PDMA1 ? ? ? ? ? ? 0x121B0000
+#define EXYNOS5_PA_MDMA0 ? ? ? ? ? ? 0x10800000
+#define EXYNOS5_PA_MDMA1 ? ? ? ? ? ? 0x11C10000
+

See, "ARM: EXYNOS: Support DMA for Exynos5250 SoC"
http://lists.infradead.org/pipermail/linux-arm-kernel/2012-February/085434.html

Quoted 1 line

But this merge window is not including it :(

Compilation of CONFIG_MACH_EXYNOS5_DT is broken without the above PDMA defines. Either add the defines, or remove the AUXDATA as part of the fixes for this release, please.

-Olof

#9 lore raw

PATCH 4/4 ARM: Exynos5: Add PDMA and MDMA physical base address defines

Quoted 30 lines · Olof Johansson

Hi,

2012/3/28 Kukjin Kim<[email protected]>:

Quoted 27 lines
Quoted 14 lines · Thomas Abraham

Add PDMA and MDMA physical base address macros which is require for Exynos5 of_dev_auxdata setup.

---
   arch/arm/mach-exynos/include/mach/map.h |    5 +++++
   arch/arm/mach-exynos/mach-exynos5-dt.c  |    3 ++-
   2 files changed, 7 insertions(+), 1 deletions(-)
arch/arm/mach-exynos/include/mach/map.h +0 -0
index 024d38f..37d93fd 100644

arch/arm/mach-exynos/include/mach/map.h line 97

Quoted 8 lines
arch/arm/mach-exynos/include/mach/map.h +5 -0
@@ -90,6 +90,11 @@
   #define EXYNOS4_PA_PDMA0            0x12680000
   #define EXYNOS4_PA_PDMA1            0x12690000
 
+#define EXYNOS5_PA_PDMA0             0x121A0000
+#define EXYNOS5_PA_PDMA1             0x121B0000
+#define EXYNOS5_PA_MDMA0             0x10800000
+#define EXYNOS5_PA_MDMA1             0x11C10000
+

See, "ARM: EXYNOS: Support DMA for Exynos5250 SoC"
http://lists.infradead.org/pipermail/linux-arm-kernel/2012-February/085434.html

Quoted 6 lines
Quoted 1 line

But this merge window is not including it :(

Compilation of CONFIG_MACH_EXYNOS5_DT is broken without the above PDMA defines. Either add the defines, or remove the AUXDATA as part of the fixes for this release, please.

Yeah, right.

I fixed it with this but changed dma channel for mdma1.

@@ -45,7 +45,7 @@ static const struct of_dev_auxdata exynos5250_auxdata_lookup[]

                                 "exynos4210-uart.3", NULL),
         OF_DEV_AUXDATA("arm,pl330", EXYNOS5_PA_PDMA0, "dma-pl330.0", NULL),
         OF_DEV_AUXDATA("arm,pl330", EXYNOS5_PA_PDMA1, "dma-pl330.1", NULL),
-       OF_DEV_AUXDATA("arm,pl330", EXYNOS5_PA_PDMA1, "dma-pl330.2", NULL),
+       OF_DEV_AUXDATA("arm,pl330", EXYNOS5_PA_MDMA1, "dma-pl330.2", NULL),
         {},

};

Thanks.

Best regards,
Kgene.
--
Kukjin Kim <[email protected]>, Senior Engineer, SW Solution Development Team, Samsung Electronics Co., Ltd.