Skip to contentSkip to conversation

Add basic device tree support for Samsung's Exynos4210 platform

PATCH In review Thomas Abraham 2 participants 4 messages Jul 17, 2011

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

v2 cover Add basic device tree support for Samsung's Exynos4210 platform

This patch series adds a basic device tree based boot for Samsung's Exynos4 platforms and specifically for smdkv310 board. Device tree based driver probe is added for sdhci and watchdog drivers.

This patch series is based on git.secretlab.ca/git/linux-2.6.git devicetree/test

and depends on the following patches which are not yet available in the devicetree/test branch.

1. [PATCH] ARM: EXYNOS4: Fix card detection for sdhci 0 and 2
[http://www.mail-archive.com/linux-samsung-soc <at> vger.kernel.org/msg04704.html]

2. [PATCH] ARM: EXYNOS4: Fix missing S5P_VA_AUDSS definition
[http://www.mail-archive.com/linux-samsung-soc <at> vger.kernel.org/msg04866.html]

3. [PATCH 0/9] Add clkdev support for Samsung platforms
[http://www.mail-archive.com/linux-samsung-soc <at> vger.kernel.org/msg04874.html]

4. Consolidate the clkdev header files
[http://patchwork.ozlabs.org/patch/97862/]

Changes since v1:
* Addressed all comments from Grant Likely
- Moved sdhci platform data as properties in dts file
- Add relevant comments in the machine file.

Thomas Abraham (2):
arm: dts: Add nodes in smdkv310 device tree source file
arm: exynos4: Add a new Exynos4 device tree enabled machine

 Documentation/devicetree/bindings/arm/samsung.txt |   11 +-
 arch/arm/boot/dts/exynos4-smdkv310.dts            |   61 +++++++++++-
 arch/arm/mach-exynos4/Kconfig                     |   10 ++
 arch/arm/mach-exynos4/Makefile                    |    1 +
 arch/arm/mach-exynos4/mach-exynos4-dt.c           |  112 +++++++++++++++++++++
 5 files changed, 187 insertions(+), 8 deletions(-)
 create mode 100644 arch/arm/mach-exynos4/mach-exynos4-dt.c
#1 lore raw

PATCH v2 1/2 arm: dts: Add nodes in smdkv310 device tree source file

Include device tree nodes for watchdog timer and sdhci instance 0 and 1.

---
 arch/arm/boot/dts/exynos4-smdkv310.dts |   61 ++++++++++++++++++++++++++++++-
 1 files changed, 59 insertions(+), 2 deletions(-)
arch/arm/boot/dts/exynos4-smdkv310.dts +59 -2
index dd6c80a..155f836 100644
@@ -1,11 +1,68 @@
+/*
+ * Samsung's Exynos4 based smdkv310 board device tree source.
+ *
+ * Copyright (c) 2010-2011 Samsung Electronics Co., Ltd.
+ *		http://www.samsung.com
+ * Copyright (c) 2010-2011 Linaro Ltd.
+ *		www.linaro.org
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+*/
+
 /dts-v1/;
 /include/ "skeleton.dtsi"
 
 / {
 	model = "Samsung Exynos4 SMDKV310 eval board";
-	compatible = "samsung,smdkv310", "samsung,s5pv310";
+	compatible = "samsung,smdkv310", "samsung,exynos4210";
 
 	memory {
-		reg = <0x40000000 0x08000000>;
+		reg = <0x40000000 0x80000000>;
+	};
+
+	chosen {
+		bootargs = "root=/dev/mmcblk0p1 rootfstype=ext3 rootwait console=ttySAC1,115200";
+	};
+
+	soc {
+		#address-cells = <1>;
+		#size-cells = <1>;
+		interrupt-parent = <&intc>;
+		compatible = "simple-bus";
+		ranges;
+
+		intc:interrupt-controller@10501000 {
+			compatible = "samsung,exynos4-gic","arm,cortex-a9-gic";
+			#interrupt-cells = <1>;
+			interrupt-controller;
+			reg = <0x10501000 0x1000>, <0x10500100 0x100>;
+			irq-start = <61>;
+		};
+
+		watchdog@10060000 {
+			compatible = "samsung,s3c2410-wdt";
+			reg = <0x10060000 0x400>;
+			interrupts = <552>;
+		};
+
+		sdhci@12530000 {
+			compatible = "samsung,s3c6410-sdhci";
+			reg = <0x12530000 0x1000>;
+			interrupts = <362>;
+			samsung,sdhci-bus-width = <4>;
+			samsung,sdhci-cd-type = <0>;
+			samsung,sdhci-clkdiv-external;
+		};
+
+		sdhci@12510000 {
+			compatible = "samsung,s3c6410-sdhci";
+			reg = <0x12510000 0x1000>;
+			interrupts = <360>;
+			samsung,sdhci-bus-width = <4>;
+			samsung,sdhci-cd-type = <0>;
+			samsung,sdhci-clkdiv-external;
+		};
 	};
 };
Signature · 1 line
1.7.1
#2 lore raw

PATCH v2 2/2 arm: exynos4: Add a new Exynos4 device tree enabled machine

In reply to Thomas Abraham

Basic Exynos4 machine with device tree support that can boot on a Exynos4 processor based board and bring up the console.

---
 Documentation/devicetree/bindings/arm/samsung.txt |   11 +-
 arch/arm/mach-exynos4/Kconfig                     |   10 ++
 arch/arm/mach-exynos4/Makefile                    |    1 +
 arch/arm/mach-exynos4/mach-exynos4-dt.c           |  112 +++++++++++++++++++++
 4 files changed, 128 insertions(+), 6 deletions(-)
 create mode 100644 arch/arm/mach-exynos4/mach-exynos4-dt.c
Documentation/devicetree/bindings/arm/samsung.txt +5 -6
index 594cb97..5676bca 100644
@@ -1,9 +1,8 @@
-Samsung Exynos4 S5PV310 SoC based SMDKV310 eval board
+Samsung Exynos4 architecture based SMDKV310 eval board
 
-    SMDKV310 eval board is based on S5PV310 SoC which belongs to
-    Samsung's Exynos4 family of application processors.
+  SMDKV310 eval board is based on Samsung's Exynos4210 application processor.
 
 Required root node properties:
-    - compatible = "samsung,smdkv310","samsung,s5pv310"
-        (a) "samsung,smdkv310" - for Samsung's SMDKV310 eval board.
-        (b) "samsung,s5pv310"  - for boards based on S5PV310 SoC.
+  - compatible = "samsung,smdkv310", "samsung,exynos4210'.
+      (a) "samsung,smdkv310" - for Samsung's SMDKV310 eval board.
+      (b) "samsung,exynos4210" - for boards based on Exynos4210 processor.
arch/arm/mach-exynos4/Kconfig +10 -0
index 1435fc3..bb97b7e 100644
@@ -186,6 +186,16 @@ config MACH_NURI
 	help
 	  Machine support for Samsung Mobile NURI Board.
 
+config MACH_EXYNOS4_DT
+	bool "Samsung Exynos4 Machine using device tree"
+	select CPU_EXYNOS4210
+	select USE_OF
+	select S3C_DEV_HSMMC
+	select S3C_DEV_HSMMC2
+	select EXYNOS4_SETUP_SDHCI
+	help
+	  Machine support for Samsung Exynos4 machine with device tree enabled.
+
 endmenu
 
 comment "Configuration for HSMMC bus width"
arch/arm/mach-exynos4/Makefile +1 -0
index 60fe5ec..6491e5b 100644
@@ -36,6 +36,7 @@ obj-$(CONFIG_MACH_SMDKV310)		+= mach-smdkv310.o
 obj-$(CONFIG_MACH_ARMLEX4210)		+= mach-armlex4210.o
 obj-$(CONFIG_MACH_UNIVERSAL_C210)	+= mach-universal_c210.o
 obj-$(CONFIG_MACH_NURI)			+= mach-nuri.o
+obj-$(CONFIG_MACH_EXYNOS4_DT)		+= mach-exynos4-dt.o
 
 # device support
 
arch/arm/mach-exynos4/mach-exynos4-dt.c new file +112 -0

112 lines not on this page · raw message

Signature · 1 line
1.7.1
#3 lore raw

Re: [PATCH v2 2/2] arm: exynos4: Add a new Exynos4 device tree enabled machine

Quoted 129 lines · Thomas Abraham

Basic Exynos4 machine with device tree support that can boot on a Exynos4 processor based board and bring up the console.

---
 Documentation/devicetree/bindings/arm/samsung.txt |   11 +-
 arch/arm/mach-exynos4/Kconfig                     |   10 ++
 arch/arm/mach-exynos4/Makefile                    |    1 +
 arch/arm/mach-exynos4/mach-exynos4-dt.c           |  112 +++++++++++++++++++++
 4 files changed, 128 insertions(+), 6 deletions(-)
 create mode 100644 arch/arm/mach-exynos4/mach-exynos4-dt.c
Documentation/devicetree/bindings/arm/samsung.txt +5 -6
index 594cb97..5676bca 100644
@@ -1,9 +1,8 @@
-Samsung Exynos4 S5PV310 SoC based SMDKV310 eval board
+Samsung Exynos4 architecture based SMDKV310 eval board
 
-    SMDKV310 eval board is based on S5PV310 SoC which belongs to
-    Samsung's Exynos4 family of application processors.
+  SMDKV310 eval board is based on Samsung's Exynos4210 application processor.
 
 Required root node properties:
-    - compatible = "samsung,smdkv310","samsung,s5pv310"
-        (a) "samsung,smdkv310" - for Samsung's SMDKV310 eval board.
-        (b) "samsung,s5pv310"  - for boards based on S5PV310 SoC.
+  - compatible = "samsung,smdkv310", "samsung,exynos4210'.
+      (a) "samsung,smdkv310" - for Samsung's SMDKV310 eval board.
+      (b) "samsung,exynos4210" - for boards based on Exynos4210 processor.
arch/arm/mach-exynos4/Kconfig +10 -0
index 1435fc3..bb97b7e 100644
@@ -186,6 +186,16 @@ config MACH_NURI
 	help
 	  Machine support for Samsung Mobile NURI Board.
 
+config MACH_EXYNOS4_DT
+	bool "Samsung Exynos4 Machine using device tree"
+	select CPU_EXYNOS4210
+	select USE_OF
+	select S3C_DEV_HSMMC
+	select S3C_DEV_HSMMC2
+	select EXYNOS4_SETUP_SDHCI
+	help
+	  Machine support for Samsung Exynos4 machine with device tree enabled.
+
 endmenu
 
 comment "Configuration for HSMMC bus width"
arch/arm/mach-exynos4/Makefile +1 -0
index 60fe5ec..6491e5b 100644
@@ -36,6 +36,7 @@ obj-$(CONFIG_MACH_SMDKV310)		+= mach-smdkv310.o
 obj-$(CONFIG_MACH_ARMLEX4210)		+= mach-armlex4210.o
 obj-$(CONFIG_MACH_UNIVERSAL_C210)	+= mach-universal_c210.o
 obj-$(CONFIG_MACH_NURI)			+= mach-nuri.o
+obj-$(CONFIG_MACH_EXYNOS4_DT)		+= mach-exynos4-dt.o
 
 # device support
 
arch/arm/mach-exynos4/mach-exynos4-dt.c new file +59 -0
new file mode 100644
index 0000000..120665a
@@ -0,0 +1,112 @@
+/*
+ * Samsung's Exynos4 device tree enabled machine.
+ *
+ * Copyright (c) 2010-2011 Samsung Electronics Co., Ltd.
+ *		http://www.samsung.com
+ * Copyright (c) 2010-2011 Linaro Ltd.
+ *		www.linaro.org
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+*/
+
+#include <linux/serial_core.h>
+#include <linux/platform_device.h>
+#include <linux/io.h>
+#include <linux/of_platform.h>
+#include <linux/irq.h>
+
+#include <asm/mach/arch.h>
+#include <asm/mach-types.h>
+
+#include <plat/regs-serial.h>
+#include <plat/exynos4.h>
+#include <plat/cpu.h>
+#include <plat/sdhci.h>
+
+#include <mach/map.h>
+
+/* Following are default values for UCON, ULCON and UFCON UART registers */
+#define SMDKV310_UCON_DEFAULT	(S3C2410_UCON_TXILEVEL |	\
+				 S3C2410_UCON_RXILEVEL |	\
+				 S3C2410_UCON_TXIRQMODE |	\
+				 S3C2410_UCON_RXIRQMODE |	\
+				 S3C2410_UCON_RXFIFO_TOI |	\
+				 S3C2443_UCON_RXERR_IRQEN)
+
+#define SMDKV310_UFCON_DEFAULT	(S3C2410_UFCON_FIFOMODE |	\
+				 S5PV210_UFCON_TXTRIG4 |	\
+				 S5PV210_UFCON_RXTRIG4)
+
+static struct s3c2410_uartcfg smdkv310_uartcfgs[] __initdata = {
+	[0] = {
+		.hwport		= 0,
+		.ucon		= SMDKV310_UCON_DEFAULT,
+		.ufcon		= SMDKV310_UFCON_DEFAULT,
+	},
+	[1] = {
+		.hwport		= 1,
+		.ucon		= SMDKV310_UCON_DEFAULT,
+		.ufcon		= SMDKV310_UFCON_DEFAULT,
+	},
+	[2] = {
+		.hwport		= 2,
+		.ucon		= SMDKV310_UCON_DEFAULT,
+		.ufcon		= SMDKV310_UFCON_DEFAULT,
+	},
+	[3] = {
+		.hwport		= 3,

arch/arm/mach-exynos4/mach-exynos4-dt.c line 69

Quoted 10 lines
arch/arm/mach-exynos4/mach-exynos4-dt.c new file +10 -0
+		.ucon		= SMDKV310_UCON_DEFAULT,
+		.ufcon		= SMDKV310_UFCON_DEFAULT,
+	},
+};
+
+/*
+ * The following lookup table is used to override device names when devices
+ * are registered from device tree. Optionally, the platform data can also
+ * to supplied. The sdhci driver requires the device name to be overridden
+ * and also requires a platform data to be supplied.

Don't pass a default platform_data pointer. Just pass null. The driver should be modified to use sane defaults if pdata is not provided.

Otherwise, this patch looks good.

g.

Quoted 50 lines
arch/arm/mach-exynos4/mach-exynos4-dt.c new file +43 -0
+ *
+ * This is temporarily added to enable device tree support.
+ */
+static const struct of_dev_auxdata exynos4_auxdata_lookup[] __initconst = {
+	OF_DEV_AUXDATA("samsung,s3c6410-sdhci", EXYNOS4_PA_HSMMC(2),
+				"s3c-sdhci.2", &s3c_hsmmc2_def_platdata),
+	OF_DEV_AUXDATA("samsung,s3c6410-sdhci", EXYNOS4_PA_HSMMC(0),
+				"s3c-sdhci.0", &s3c_hsmmc0_def_platdata),
+	{},
+};
+
+static void __init exynos4_dt_map_io(void)
+{
+	s5p_init_io(NULL, 0, S5P_VA_CHIPID);
+	s3c24xx_init_clocks(24000000);
+	s3c24xx_init_uarts(smdkv310_uartcfgs, ARRAY_SIZE(smdkv310_uartcfgs));
+}
+
+static const struct of_device_id intc_of_match[] __initconst = {
+	{ .compatible = "samsung,exynos4-gic", },
+	{}
+};
+
+static void __init exynos4_dt_machine_init(void)
+{
+	irq_domain_generate_simple(intc_of_match, EXYNOS4_PA_GIC_DIST, 0);
+	of_platform_populate(NULL, of_default_bus_match_table,
+				exynos4_auxdata_lookup, NULL);
+}
+
+static char const *exynos4_dt_compat[] __initdata = {
+	"samsung,exynos4210",
+	NULL
+};
+
+DT_MACHINE_START(SMDKV310, "Samsung Exynos4 DT")
+	/* Maintainer: Kukjin Kim <[email protected]> */
+	.init_irq	= exynos4_init_irq,
+	.map_io		= exynos4_dt_map_io,
+	.init_machine	= exynos4_dt_machine_init,
+	.timer		= &exynos4_timer,
+	.dt_compat	= exynos4_dt_compat,
+MACHINE_END
Signature · 6 lines
1.7.1

_______________________________________________
devicetree-discuss mailing list
[email protected]
https://lists.ozlabs.org/listinfo/devicetree-discuss