Skip to contentSkip to conversation

Initial Device Tree support for S3C64xx

PATCH Superseded Tomasz Figa 4 participants 15 messages Jun 21, 2013 – Jun 22, 2013

Subsystems (8)

v6 of 9 Superseded Latest is v9 →

lore
Share & tools
lore
#0 lore raw

v6 cover Initial Device Tree support for S3C64xx

This series adds Device Tree support for Samsung S3C64xx SoC series.

It fixes several problems preventing from booting an S3C64xx-based system using Device Tree, adds all the infrastructure for Device Tree-based board support, including mach-s3c64xx-dt and dts include files for S3C64xx SoCs, and basic device tree source for FriendlyARM Mini6410 and SAMSUNG SMDK6410 boards.

Current support is somewhat limite, but should be fine as a start and will be extended in future, hopefully with help of S3C64xx board maintainers.

Depends on:
- [PATCH 0/7] Common Clock Framework support for Samsung S3C64xx
http://comments.gmane.org/gmane.linux.usb.general/87571

Changes since v5:
- Rebased onto current for-next branch of Kgene's tree,
- Added support for new Common Clock Framework based clock driver,
- Introduced hierarchical structure of device nodes (representing physical AHB and APB buses),
- Bypassed most of legacy initialization when booting with DT,
- Used preprocessor macros in dts files to improve readabilty,
- Added support for SMDK6410 board.

Changes since v4:
- Rebased onto current for-next branch of Kgene's tree
- Added support for pinctrl (driver merged through pinctrl tree)
- Added labels to all nodes that can be overridden from board dts
- Modified board dts to use the &label syntax to reference device nodes

Changes since v3:
- Rebased onto current for-next branch of Kgene's tree
- Updated timer node for next version of samsung-time patches
- Replaced local s3c64xx_dt_init_irq with irqchip_init

Changes since v2:
- Updated timer node for next version of samsung-time patches

Changes since v1:
- Dropped two VIC-related patches that are no longer necessary
- Added Device Tree-based instantation of system timers
- Corrected VIC interrupt specifiers
- Adjusted CPU compatible values and dropped @id

Tomasz Figa (8):
ARM: common: vic: Parse interrupt and resume masks from device tree
ARM: s3c64xx: Bypass legacy initialization when booting with DT
gpio: samsung: Skip legacy GPIO registration if pinctrl-s3c64xx is
present
ARM: Add .init_platform() callback to machine descriptor
ARM: s3c64xx: Add board file for boot using Device Tree
ARM: dts: Add basic dts include files for Samsung S3C64xx SoCs
ARM: dts: Add dts file for S3C6410-based Mini6410 board
ARM: dts: Add dts file for S3C6410-based SMDK6410 board

 Documentation/devicetree/bindings/arm/vic.txt |   6 +
 arch/arm/boot/dts/Makefile                    |   2 +
 arch/arm/boot/dts/s3c6400.dtsi                |  41 ++
 arch/arm/boot/dts/s3c6410-mini6410.dts        | 199 ++++++++
 arch/arm/boot/dts/s3c6410-smdk6410.dts        |  93 ++++
 arch/arm/boot/dts/s3c6410.dtsi                |  41 ++
 arch/arm/boot/dts/s3c64xx-pinctrl.dtsi        | 687 ++++++++++++++++++++++++++
 arch/arm/boot/dts/s3c64xx.dtsi                | 190 +++++++
 arch/arm/include/asm/mach/arch.h              |   1 +
 arch/arm/kernel/irq.c                         |   3 +
 arch/arm/mach-s3c64xx/Kconfig                 |  16 +
 arch/arm/mach-s3c64xx/Makefile                |   1 +
 arch/arm/mach-s3c64xx/common.c                |  12 +
 arch/arm/mach-s3c64xx/dma.c                   |   9 +
 arch/arm/mach-s3c64xx/irq-pm.c                |   9 +
 arch/arm/mach-s3c64xx/mach-s3c64xx-dt.c       |  83 ++++
 arch/arm/mach-s3c64xx/s3c6400.c               |   9 +
 arch/arm/mach-s3c64xx/s3c6410.c               |   9 +
 arch/arm/plat-samsung/init.c                  |  12 +-
 drivers/gpio/gpio-samsung.c                   |   3 +-
 drivers/irqchip/irq-vic.c                     |   7 +-
 21 files changed, 1430 insertions(+), 3 deletions(-)
 create mode 100644 arch/arm/boot/dts/s3c6400.dtsi
 create mode 100644 arch/arm/boot/dts/s3c6410-mini6410.dts
 create mode 100644 arch/arm/boot/dts/s3c6410-smdk6410.dts
 create mode 100644 arch/arm/boot/dts/s3c6410.dtsi
 create mode 100644 arch/arm/boot/dts/s3c64xx-pinctrl.dtsi
 create mode 100644 arch/arm/boot/dts/s3c64xx.dtsi
 create mode 100644 arch/arm/mach-s3c64xx/mach-s3c64xx-dt.c
Signature · 1 line
1.8.2.1
#1 lore raw

PATCH v6 1/8 ARM: common: vic: Parse interrupt and resume masks from device tree

This patch extends vic_of_init to parse valid interrupt sources and resume sources masks from device tree.

If mask values are not specified in device tree, all sources are assumed to be valid, as before this patch.

---
 Documentation/devicetree/bindings/arm/vic.txt | 6 ++++++
 drivers/irqchip/irq-vic.c                     | 7 ++++++-
 2 files changed, 12 insertions(+), 1 deletion(-)
Documentation/devicetree/bindings/arm/vic.txt +6 -0
index 266716b..bb7137c 100644
@@ -18,6 +18,9 @@ Required properties:
 Optional properties:
 
 - interrupts : Interrupt source for parent controllers if the VIC is nested.
+- interrupt-mask : Bit mask of valid interrupt sources (defaults to all valid)
+- wakeup-mask : Bit mask of interrupt sources that can wake up the system
+  (defaults to all allowed)
 
 Example:
 
@@ -26,4 +29,7 @@ Example:
 		interrupt-controller;
 		#interrupt-cells = <1>;
 		reg = <0x60000 0x1000>;
+
+		interrupt-mask = <0xffffff7f>;
+		wakeup-mask = <0x0000ff7f>;
 	};
drivers/irqchip/irq-vic.c +6 -1
index 2bbb004..d56750eb 100644
@@ -469,6 +469,8 @@ void __init vic_init(void __iomem *base, unsigned int irq_start,
 int __init vic_of_init(struct device_node *node, struct device_node *parent)
 {
 	void __iomem *regs;
+	u32 interrupt_mask = ~0;
+	u32 wakeup_mask = ~0;
 
 	if (WARN(parent, "non-root VICs are not supported"))
 		return -EINVAL;
@@ -477,10 +479,13 @@ int __init vic_of_init(struct device_node *node, struct device_node *parent)
 	if (WARN_ON(!regs))
 		return -EIO;
 
+	of_property_read_u32(node, "interrupt-mask", &interrupt_mask);
+	of_property_read_u32(node, "wakeup-mask", &wakeup_mask);
+
 	/*
 	 * Passing 0 as first IRQ makes the simple domain allocate descriptors
 	 */
-	__vic_init(regs, 0, ~0, ~0, node);
+	__vic_init(regs, 0, interrupt_mask, wakeup_mask, node);
 
 	return 0;
 }
Signature · 1 line
1.8.2.1
#2 lore raw

PATCH v6 2/8 ARM: s3c64xx: Bypass legacy initialization when booting with DT

In reply to Tomasz Figa

This patch allows bypassing most of legacy initialization when booting an S3C64xx-based board using device tree, by adding conditional checks for DT presence to initcalls which are no longer necessary when booting with DT..

---
 arch/arm/mach-s3c64xx/common.c  | 12 ++++++++++++
 arch/arm/mach-s3c64xx/dma.c     |  9 +++++++++
 arch/arm/mach-s3c64xx/irq-pm.c  |  9 +++++++++
 arch/arm/mach-s3c64xx/s3c6400.c |  9 +++++++++
 arch/arm/mach-s3c64xx/s3c6410.c |  9 +++++++++
 arch/arm/plat-samsung/init.c    | 12 +++++++++++-
 6 files changed, 59 insertions(+), 1 deletion(-)
arch/arm/mach-s3c64xx/common.c +12 -0
index bf00e60..77a22c6 100644
@@ -14,6 +14,10 @@
  * published by the Free Software Foundation.
  */
 
+/*
+ * NOTE: Code in this file is not used when booting with Device Tree support.
+ */
+
 #include <linux/kernel.h>
 #include <linux/init.h>
 #include <linux/module.h>
@@ -202,6 +206,10 @@ void __init s3c64xx_init_io(struct map_desc *mach_desc, int size)
 
 static __init int s3c64xx_dev_init(void)
 {
+	/* Not applicable when using DT. */
+	if (of_have_populated_dt())
+		return 0;
+
 	subsys_system_register(&s3c64xx_subsys, NULL);
 	return device_register(&s3c64xx_dev);
 }
@@ -403,6 +411,10 @@ static int __init s3c64xx_init_irq_eint(void)
 {
 	int irq;
 
+	/* On DT-enabled systems EINTs are handled by pinctrl-s3c64xx driver. */
+	if (of_have_populated_dt())
+		return -ENODEV;
+
 	for (irq = IRQ_EINT(0); irq <= IRQ_EINT(27); irq++) {
 		irq_set_chip_and_handler(irq, &s3c_irq_eint, handle_level_irq);
 		irq_set_chip_data(irq, (void *)eint_irq_to_bit(irq));
arch/arm/mach-s3c64xx/dma.c +9 -0
index c511dfa..7e22c21 100644
@@ -12,6 +12,10 @@
  * published by the Free Software Foundation.
 */
 
+/*
+ * NOTE: Code in this file is not used when booting with Device Tree support.
+ */
+
 #include <linux/kernel.h>
 #include <linux/module.h>
 #include <linux/interrupt.h>
@@ -24,6 +28,7 @@
 #include <linux/err.h>
 #include <linux/io.h>
 #include <linux/amba/pl080.h>
+#include <linux/of.h>
 
 #include <mach/dma.h>
 #include <mach/map.h>
@@ -726,6 +731,10 @@ static int __init s3c64xx_dma_init(void)
 {
 	int ret;
 
+	/* This driver is not supported when booting with device tree. */
+	if (of_have_populated_dt())
+		return -ENODEV;
+
 	printk(KERN_INFO "%s: Registering DMA channels\n", __func__);
 
 	dma_pool = dma_pool_create("DMA-LLI", NULL, sizeof(struct pl080s_lli), 16, 0);
arch/arm/mach-s3c64xx/irq-pm.c +9 -0
index c3da1b6..1649c0d 100644
@@ -12,12 +12,17 @@
  * published by the Free Software Foundation.
  */
 
+/*
+ * NOTE: Code in this file is not used when booting with Device Tree support.
+ */
+
 #include <linux/kernel.h>
 #include <linux/syscore_ops.h>
 #include <linux/interrupt.h>
 #include <linux/serial_core.h>
 #include <linux/irq.h>
 #include <linux/io.h>
+#include <linux/of.h>
 
 #include <mach/map.h>
 
@@ -101,6 +106,10 @@ static struct syscore_ops s3c64xx_irq_syscore_ops = {
 
 static __init int s3c64xx_syscore_init(void)
 {
+	/* Appropriate drivers (pinctrl, uart) handle this when using DT. */
+	if (of_have_populated_dt())
+		return 0;
+
 	register_syscore_ops(&s3c64xx_irq_syscore_ops);
 
 	return 0;
arch/arm/mach-s3c64xx/s3c6400.c +9 -0
index 331fe8e..3db0c98 100644
@@ -9,6 +9,10 @@
  * published by the Free Software Foundation.
 */
 
+/*
+ * NOTE: Code in this file is not used when booting with Device Tree support.
+ */
+
 #include <linux/kernel.h>
 #include <linux/types.h>
 #include <linux/interrupt.h>
@@ -20,6 +24,7 @@
 #include <linux/device.h>
 #include <linux/serial_core.h>
 #include <linux/platform_device.h>
+#include <linux/of.h>
 
 #include <asm/mach/arch.h>
 #include <asm/mach/map.h>
@@ -76,6 +81,10 @@ static struct device s3c6400_dev = {
 
 static int __init s3c6400_core_init(void)
 {
+	/* Not applicable when using DT. */
+	if (of_have_populated_dt())
+		return 0;
+
 	return subsys_system_register(&s3c6400_subsys, NULL);
 }
 
arch/arm/mach-s3c64xx/s3c6410.c +9 -0
index 7e6fa12..72b2278 100644
@@ -10,6 +10,10 @@
  * published by the Free Software Foundation.
 */
 
+/*
+ * NOTE: Code in this file is not used when booting with Device Tree support.
+ */
+
 #include <linux/kernel.h>
 #include <linux/types.h>
 #include <linux/interrupt.h>
@@ -21,6 +25,7 @@
 #include <linux/device.h>
 #include <linux/serial_core.h>
 #include <linux/platform_device.h>
+#include <linux/of.h>
 
 #include <asm/mach/arch.h>
 #include <asm/mach/map.h>
@@ -79,6 +84,10 @@ static struct device s3c6410_dev = {
 
 static int __init s3c6410_core_init(void)
 {
+	/* Not applicable when using DT. */
+	if (of_have_populated_dt())
+		return 0;
+
 	return subsys_system_register(&s3c6410_subsys, NULL);
 }
 
arch/arm/plat-samsung/init.c +11 -1
index 3e5c461..e92aee2 100644
@@ -11,12 +11,18 @@
  * published by the Free Software Foundation.
 */
 
+/*
+ * NOTE: Code in this file is not used on S3C64xx when booting with
+ * Device Tree support.
+ */
+
 #include <linux/init.h>
 #include <linux/module.h>
 #include <linux/interrupt.h>
 #include <linux/ioport.h>
 #include <linux/serial_core.h>
 #include <linux/platform_device.h>
+#include <linux/of.h>
 
 #include <mach/hardware.h>
 
@@ -147,8 +153,12 @@ static int __init s3c_arch_init(void)
 
 	// do the correct init for cpu
 
-	if (cpu == NULL)
+	if (cpu == NULL) {
+		/* Not needed when booting with device tree. */
+		if (of_have_populated_dt())
+			return 0;
 		panic("s3c_arch_init: NULL cpu\n");
+	}
 
 	ret = (cpu->init)();
 	if (ret != 0)
Signature · 1 line
1.8.2.1
#3 lore raw

PATCH v6 3/8 gpio: samsung: Skip legacy GPIO registration if pinctrl-s3c64xx is present

In reply to Tomasz Figa

The new driver handles GPIO on DT-enabled platforms.

---
 drivers/gpio/gpio-samsung.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpio/gpio-samsung.c +2 -1
index a1392f4..8d512b1 100644
@@ -2949,7 +2949,7 @@ static __init int samsung_gpiolib_init(void)
 	int i, nr_chips;
 	int group = 0;
 
-#if defined(CONFIG_PINCTRL_EXYNOS) || defined(CONFIG_PINCTRL_EXYNOS5440)
+#if defined(CONFIG_PINCTRL_SAMSUNG) || defined(CONFIG_PINCTRL_EXYNOS5440)
 	/*
 	* This gpio driver includes support for device tree support and there
 	* are platforms using it. In order to maintain compatibility with those
@@ -2967,6 +2967,7 @@ static __init int samsung_gpiolib_init(void)
 		{ .compatible = "samsung,s3c2416-pinctrl", },
 		{ .compatible = "samsung,s3c2440-pinctrl", },
 		{ .compatible = "samsung,s3c2450-pinctrl", },
+		{ .compatible = "samsung,s3c64xx-pinctrl", },
 		{ .compatible = "samsung,exynos4210-pinctrl", },
 		{ .compatible = "samsung,exynos4x12-pinctrl", },
 		{ .compatible = "samsung,exynos5250-pinctrl", },
Signature · 1 line
1.8.2.1
#4 lore raw

PATCH v6 4/8 ARM: Add .init_platform() callback to machine descriptor

In reply to Tomasz Figa

Most ARM platforms have parts that should be initialized as early as possible, which usually means as soon as memory management (kmalloc, ioremap) starts to work,

However, currently there is no appropriate callback in machine_desc struct to use for such initialization and platforms tend to stuff things up .init_irq() and .init_time() callbacks.

Since all the DT-based platforms are going towards generic IRQ and time initialization (using irqchip_init and clocksource_of_init) and current code assumes that if custom callbacks are not provided in machine_desc then generic ones should be used, this problem has become a bit more inconvenient.

This patch tries to solve this issue by introducing new callback called .init_platform(), where any custom low level initialization of platform can be done safely.

---
 arch/arm/include/asm/mach/arch.h | 1 +
 arch/arm/kernel/irq.c            | 3 +++
 2 files changed, 4 insertions(+)
arch/arm/include/asm/mach/arch.h +1 -0
index 308ad7d..b2f4d11 100644
@@ -46,6 +46,7 @@ struct machine_desc {
 	void			(*reserve)(void);/* reserve mem blocks	*/
 	void			(*map_io)(void);/* IO mapping function	*/
 	void			(*init_early)(void);
+	void			(*init_platform)(void);
 	void			(*init_irq)(void);
 	void			(*init_time)(void);
 	void			(*init_machine)(void);
arch/arm/kernel/irq.c +3 -0
index 9723d17..61e2000 100644
@@ -115,6 +115,9 @@ EXPORT_SYMBOL_GPL(set_irq_flags);
 
 void __init init_IRQ(void)
 {
+	if (machine_desc->init_platform)
+		machine_desc->init_platform();
+
 	if (IS_ENABLED(CONFIG_OF) && !machine_desc->init_irq)
 		irqchip_init();
 	else
Signature · 1 line
1.8.2.1
#5 lore raw

Re: [PATCH v6 4/8] ARM: Add .init_platform() callback to machine descriptor

On 21/06/13 01:35, Tomasz Figa wrote:

Hi Tomasz,

Quoted 41 lines

Most ARM platforms have parts that should be initialized as early as possible, which usually means as soon as memory management (kmalloc, ioremap) starts to work,

However, currently there is no appropriate callback in machine_desc struct to use for such initialization and platforms tend to stuff things up .init_irq() and .init_time() callbacks.

Since all the DT-based platforms are going towards generic IRQ and time initialization (using irqchip_init and clocksource_of_init) and current code assumes that if custom callbacks are not provided in machine_desc then generic ones should be used, this problem has become a bit more inconvenient.

This patch tries to solve this issue by introducing new callback called .init_platform(), where any custom low level initialization of platform can be done safely.

---
 arch/arm/include/asm/mach/arch.h | 1 +
 arch/arm/kernel/irq.c            | 3 +++
 2 files changed, 4 insertions(+)
arch/arm/include/asm/mach/arch.h +1 -0
index 308ad7d..b2f4d11 100644
@@ -46,6 +46,7 @@ struct machine_desc {
 	void			(*reserve)(void);/* reserve mem blocks	*/
 	void			(*map_io)(void);/* IO mapping function	*/
 	void			(*init_early)(void);
+	void			(*init_platform)(void);
 	void			(*init_irq)(void);
 	void			(*init_time)(void);
 	void			(*init_machine)(void);
arch/arm/kernel/irq.c +0 -0
index 9723d17..61e2000 100644

arch/arm/kernel/irq.c EXPORT_SYMBOL_GPL(set_irq_flags); · line 123

Quoted 9 lines
arch/arm/kernel/irq.c +3 -0
@@ -115,6 +115,9 @@ EXPORT_SYMBOL_GPL(set_irq_flags);
 
 void __init init_IRQ(void)
 {
+	if (machine_desc->init_platform)
+		machine_desc->init_platform();
+
 	if (IS_ENABLED(CONFIG_OF) && !machine_desc->init_irq)
 		irqchip_init();
 	else

To me, this new hook is strictly equivalent to init_irq. What do we gain exactly? I didn't think init_irq was going away...

I know init_irq is not pretty, and we tend to overload it with other stuff, but I don't really see the point of adding a new callback that has the exact same properties.

	M.
Signature · 1 line
Jazz is not dead. It just smells funny...
#6 lore raw

Re: [PATCH v6 4/8] ARM: Add .init_platform() callback to machine descriptor

Hi Marc,

Quoted 63 lines · On Friday 21 of June 2013 11:24:52 Marc Zyngier wrote:

On 21/06/13 01:35, Tomasz Figa wrote:

Hi Tomasz,

Quoted 59 lines

Most ARM platforms have parts that should be initialized as early as possible, which usually means as soon as memory management (kmalloc, ioremap) starts to work,

However, currently there is no appropriate callback in machine_desc struct to use for such initialization and platforms tend to stuff things
up .init_irq() and .init_time() callbacks.

Since all the DT-based platforms are going towards generic IRQ and time initialization (using irqchip_init and clocksource_of_init) and current code assumes that if custom callbacks are not provided in machine_desc then generic ones should be used, this problem has become a bit more inconvenient.

This patch tries to solve this issue by introducing new callback called .init_platform(), where any custom low level initialization of platform can be done safely.

---

 arch/arm/include/asm/mach/arch.h | 1 +
 arch/arm/kernel/irq.c            | 3 +++
 2 files changed, 4 insertions(+)
(quoted diff) +0 -0

b/arch/arm/include/asm/mach/arch.h index 308ad7d..b2f4d11 100644

arch/arm/include/asm/mach/arch.h +1 -0
@@ -46,6 +46,7 @@ struct machine_desc {
 
 	void			(*reserve)(void);/* reserve mem blocks	*/
 	void			(*map_io)(void);/* IO mapping function	*/
 	void			(*init_early)(void);
 
+	void			(*init_platform)(void);
 
arch/arm/include/asm/mach/arch.h +0 -0
 	void			(*init_irq)(void);
 	void			(*init_time)(void);
 	void			(*init_machine)(void);
arch/arm/kernel/irq.c +3 -0
index 9723d17..61e2000 100644
@@ -115,6 +115,9 @@ EXPORT_SYMBOL_GPL(set_irq_flags);
 
 void __init init_IRQ(void)
 {
 
+	if (machine_desc->init_platform)
+		machine_desc->init_platform();
+
 
 	if (IS_ENABLED(CONFIG_OF) && !machine_desc->init_irq)

irqchip_init();

Quoted 8 lines
Quoted 1 line

else

To me, this new hook is strictly equivalent to init_irq. What do we gain exactly? I didn't think init_irq was going away...

I know init_irq is not pretty, and we tend to overload it with other stuff, but I don't really see the point of adding a new callback that has the exact same properties.

Well, it doesn't really give us any functional benefits.

However in my opinion it looks much saner in case of DT-only platforms that don't need any specific IRQ initialization, but need to call some platform specific initialization routines, after memory management, but before anything else is initialized.

This way irqchip_init() doesn't have to be explicitly called in platform code.

Anyway, I don't have any strong opinion on this. If it is perfectly fine to abuse irqchip_init() for anything that must be done at this stage of boot, then I'm fine with this either and will modify the board file from further patch from this series to not rely on this change any more.

Best regards,
Tomasz

Quoted 2 lines
	M.
maintainer
#7 lore raw

Re: [PATCH v6 4/8] ARM: Add .init_platform() callback to machine descriptor

Quoted 14 lines · Tomasz Figa
Quoted 6 lines

To me, this new hook is strictly equivalent to init_irq. What do we gain exactly? I didn't think init_irq was going away...

I know init_irq is not pretty, and we tend to overload it with other stuff, but I don't really see the point of adding a new callback that has the exact same properties.

Well, it doesn't really give us any functional benefits.

However in my opinion it looks much saner in case of DT-only platforms that don't need any specific IRQ initialization, but need to call some platform specific initialization routines, after memory management, but before anything else is initialized.

Quoted 7 lines

This way irqchip_init() doesn't have to be explicitly called in platform code.

Anyway, I don't have any strong opinion on this. If it is perfectly fine to abuse irqchip_init() for anything that must be done at this stage of boot, then I'm fine with this either and will modify the board file from further patch from this series to not rely on this change any more.

Your init_platform only has these two calls in it:

+ of_clk_init(NULL);
+ samsung_wdt_reset_of_init();

Presumably you need of_clk_init() for the watchdog to work. But do you actually need to initialize the reset logic this early? Why not turn samsung_wdt_reset_of_init into a standalone driver, or call it from init_machine?

I would actually like to call of_clk_init from common code at some point between init_irq and init_time, although I'm not sure if some platforms need it to be called before init_irq.

Arnd

#8 lore raw

Re: [PATCH v6 4/8] ARM: Add .init_platform() callback to machine descriptor

Quoted 30 lines · On Friday 21 of June 2013 16:12:15 Arnd Bergmann wrote:
Quoted 15 lines · Tomasz Figa
Quoted 7 lines

To me, this new hook is strictly equivalent to init_irq. What do we gain exactly? I didn't think init_irq was going away...

I know init_irq is not pretty, and we tend to overload it with other stuff, but I don't really see the point of adding a new callback that
has the exact same properties.

Well, it doesn't really give us any functional benefits.

However in my opinion it looks much saner in case of DT-only platforms that don't need any specific IRQ initialization, but need to call some platform specific initialization routines, after memory management, but before anything else is initialized.

Quoted 8 lines

This way irqchip_init() doesn't have to be explicitly called in platform code.

Anyway, I don't have any strong opinion on this. If it is perfectly fine to abuse irqchip_init() for anything that must be done at this stage of boot, then I'm fine with this either and will modify the board file from further patch from this series to not rely on this change any more.

Your init_platform only has these two calls in it:

(quoted diff) +2 -0
+       of_clk_init(NULL);
+       samsung_wdt_reset_of_init();
Quoted 1 line

Presumably you need of_clk_init() for the watchdog to work.

Clock initialization is also required for timekeeping to work, so if we had to defer it, it must happen before (or inside) init_time().

Putting this platform aside, there might be other platforms which require clock initialization before IRQ initialization, e.g. to enable clock of an interrupt controller.

Quoted 4 lines

But do you
actually need to initialize the reset logic this early? Why not turn samsung_wdt_reset_of_init into a standalone driver, or call it from init_machine?

This is debatable. One might want to have reset support working as early as possible to have panic timeout working, but I'm not sure if there is any point of rebooting the machine if the kernel fails so early.

Personally I'd prefer this to be a separate driver, in drivers/power/reset/ or wherever appropriate, but I didn't want to change existing behavior too much, which was the reset working already after clock initialization.

Quoted 3 lines

I would actually like to call of_clk_init from common code at some point between init_irq and init_time, although I'm not sure if some platforms need it to be called before init_irq.

Now as I think of it, some platforms might need it earlier, some later, so my init_platform(), which is not flexible at all, would be useless for some of them, that need such things done after init_irq().

I'm going to drop this patch from this series (and simply abuse one of existing callbacks instead), but we should think about a better solution for this issue.

Best regards,
Tomasz

Quoted 6 lines

Arnd
--
To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in the body of a message to majordomo at vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html

#9 lore raw

Re: [PATCH v6 4/8] ARM: Add .init_platform() callback to machine descriptor

In reply to Tomasz Figa

Hi Kukjin,

Quoted 18 lines · On Friday 21 of June 2013 02:35:20 Tomasz Figa wrote:

Most ARM platforms have parts that should be initialized as early as possible, which usually means as soon as memory management (kmalloc, ioremap) starts to work,

However, currently there is no appropriate callback in machine_desc struct to use for such initialization and platforms tend to stuff things up .init_irq() and .init_time() callbacks.

Since all the DT-based platforms are going towards generic IRQ and time initialization (using irqchip_init and clocksource_of_init) and current code assumes that if custom callbacks are not provided in machine_desc then generic ones should be used, this problem has become a bit more inconvenient.

This patch tries to solve this issue by introducing new callback called .init_platform(), where any custom low level initialization of platform can be done safely.

Quoted 5 lines
---
 arch/arm/include/asm/mach/arch.h | 1 +
 arch/arm/kernel/irq.c            | 3 +++
 2 files changed, 4 insertions(+)

Please disregard this patch when applying the series (if that happens).

Best regards,
Tomasz

#10 lore raw

PATCH v6 5/8 ARM: s3c64xx: Add board file for boot using Device Tree

In reply to Tomasz Figa

This patch adds board file that will be used to boot S3C64xx-based boards using Device Tree.

---
 arch/arm/mach-s3c64xx/Kconfig           | 16 +++++++
 arch/arm/mach-s3c64xx/Makefile          |  1 +
 arch/arm/mach-s3c64xx/mach-s3c64xx-dt.c | 83 +++++++++++++++++++++++++++++++++
 3 files changed, 100 insertions(+)
 create mode 100644 arch/arm/mach-s3c64xx/mach-s3c64xx-dt.c
arch/arm/mach-s3c64xx/Kconfig +16 -0
index f78a6a0..fb4258c 100644
@@ -308,3 +308,19 @@ config MACH_WLF_CRAGG_6410
 	select SAMSUNG_GPIO_EXTRA128
 	help
 	  Machine support for the Wolfson Cragganmore S3C6410 variant.
+
+config MACH_S3C64XX_DT
+	bool "Samsung S3C6400/S3C6410 machine using Device Tree"
+	select CLKSRC_OF
+	select CPU_S3C6400
+	select CPU_S3C6410
+	select PINCTRL
+	select PINCTRL_S3C64XX
+	select USE_OF
+	help
+	  Machine support for Samsung S3C6400/S3C6410 machines with Device Tree
+	  enabled.
+	  Select this if a fdt blob is available for your S3C64XX SoC based
+	  board.
+	  Note: This is under development and not all peripherals can be
+	  supported with this machine file.
arch/arm/mach-s3c64xx/Makefile +1 -0
index 645a8fe..6faedcf 100644
@@ -57,3 +57,4 @@ obj-$(CONFIG_MACH_SMARTQ7)		+= mach-smartq7.o
 obj-$(CONFIG_MACH_SMDK6400)		+= mach-smdk6400.o
 obj-$(CONFIG_MACH_SMDK6410)		+= mach-smdk6410.o
 obj-$(CONFIG_MACH_WLF_CRAGG_6410)	+= mach-crag6410.o mach-crag6410-module.o
+obj-$(CONFIG_MACH_S3C64XX_DT)		+= mach-s3c64xx-dt.o
arch/arm/mach-s3c64xx/mach-s3c64xx-dt.c new file +83 -0

83 lines not on this page · raw message

Signature · 1 line
1.8.2.1
#11 lore raw

PATCH v7 5/8 ARM: s3c64xx: Add board file for boot using Device Tree

This patch adds board file that will be used to boot S3C64xx-based boards using Device Tree.

---
 arch/arm/mach-s3c64xx/Kconfig           | 16 +++++++
 arch/arm/mach-s3c64xx/Makefile          |  1 +
 arch/arm/mach-s3c64xx/mach-s3c64xx-dt.c | 85 +++++++++++++++++++++++++++++++++
 3 files changed, 102 insertions(+)
 create mode 100644 arch/arm/mach-s3c64xx/mach-s3c64xx-dt.c

Changes since v6:
- Dropped the concept of .init_platform() callback and returned back to the old good abuse of .init_irq().

arch/arm/mach-s3c64xx/Kconfig +16 -0
index f78a6a0..fb4258c 100644
@@ -308,3 +308,19 @@ config MACH_WLF_CRAGG_6410
 	select SAMSUNG_GPIO_EXTRA128
 	help
 	  Machine support for the Wolfson Cragganmore S3C6410 variant.
+
+config MACH_S3C64XX_DT
+	bool "Samsung S3C6400/S3C6410 machine using Device Tree"
+	select CLKSRC_OF
+	select CPU_S3C6400
+	select CPU_S3C6410
+	select PINCTRL
+	select PINCTRL_S3C64XX
+	select USE_OF
+	help
+	  Machine support for Samsung S3C6400/S3C6410 machines with Device Tree
+	  enabled.
+	  Select this if a fdt blob is available for your S3C64XX SoC based
+	  board.
+	  Note: This is under development and not all peripherals can be
+	  supported with this machine file.
arch/arm/mach-s3c64xx/Makefile +1 -0
index 645a8fe..6faedcf 100644
@@ -57,3 +57,4 @@ obj-$(CONFIG_MACH_SMARTQ7)		+= mach-smartq7.o
 obj-$(CONFIG_MACH_SMDK6400)		+= mach-smdk6400.o
 obj-$(CONFIG_MACH_SMDK6410)		+= mach-smdk6410.o
 obj-$(CONFIG_MACH_WLF_CRAGG_6410)	+= mach-crag6410.o mach-crag6410-module.o
+obj-$(CONFIG_MACH_S3C64XX_DT)		+= mach-s3c64xx-dt.o
arch/arm/mach-s3c64xx/mach-s3c64xx-dt.c new file +85 -0

85 lines not on this page · raw message

Signature · 1 line
1.8.2.1
#12 lore raw

PATCH v6 6/8 ARM: dts: Add basic dts include files for Samsung S3C64xx SoCs

In reply to Tomasz Figa

This patch adds basic device tree definitions for Samsung S3C64xx SoCs.

Since all the SoCs in the series are very similar, the files are created hierarchically - one file for the whole series and then separate files for particular SoCs including the common one.

---
 arch/arm/boot/dts/s3c6400.dtsi         |  41 ++
 arch/arm/boot/dts/s3c6410.dtsi         |  41 ++
 arch/arm/boot/dts/s3c64xx-pinctrl.dtsi | 687 +++++++++++++++++++++++++++++++++
 arch/arm/boot/dts/s3c64xx.dtsi         | 190 +++++++++
 4 files changed, 959 insertions(+)
 create mode 100644 arch/arm/boot/dts/s3c6400.dtsi
 create mode 100644 arch/arm/boot/dts/s3c6410.dtsi
 create mode 100644 arch/arm/boot/dts/s3c64xx-pinctrl.dtsi
 create mode 100644 arch/arm/boot/dts/s3c64xx.dtsi
arch/arm/boot/dts/s3c6400.dtsi new file +41 -0
new file mode 100644
index 0000000..e4ef183
@@ -0,0 +1,41 @@
+/*
+ * Samsung's S3C6400 SoC device tree source
+ *
+ * Copyright (c) 2013 Tomasz Figa <[email protected]>
+ *
+ * Samsung's S3C6400 SoC device nodes are listed in this file. S3C6400
+ * based board files can include this file and provide values for board specfic
+ * bindings.
+ *
+ * Note: This file does not include device nodes for all the controllers in
+ * S3C6400 SoC. As device tree coverage for S3C6400 increases, additional
+ * nodes can be added to this file.
+ *
+ * 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 "s3c64xx.dtsi"
+
+/ {
+	compatible = "samsung,s3c6400";
+};
+
+&vic0 {
+	interrupt-mask = <0xfffffe1f>;
+	wakeup-mask = <0x00200004>;
+};
+
+&vic1 {
+	interrupt-mask = <0xffffffff>;
+	wakeup-mask = <0x53020000>;
+};
+
+&apb {
+	clocks: clock-controller at 7e00f000 {
+		compatible = "samsung,s3c6400-clock";
+		reg = <0x7e00f000 0x1000>;
+		#clock-cells = <1>;
+	};
+};
arch/arm/boot/dts/s3c6410.dtsi new file +41 -0

41 lines not on this page · raw message

arch/arm/boot/dts/s3c64xx-pinctrl.dtsi new file +687 -0

687 lines not on this page · raw message

arch/arm/boot/dts/s3c64xx.dtsi new file +190 -0

190 lines not on this page · raw message

Signature · 1 line
1.8.2.1
#13 lore raw

PATCH v6 7/8 ARM: dts: Add dts file for S3C6410-based Mini6410 board

In reply to Tomasz Figa

This patch adds basic device tree sources for FriendlyARM Mini6410 board based on Samsung S3C6410 SoC.

---
 arch/arm/boot/dts/Makefile             |   1 +
 arch/arm/boot/dts/s3c6410-mini6410.dts | 199 +++++++++++++++++++++++++++++++++
 2 files changed, 200 insertions(+)
 create mode 100644 arch/arm/boot/dts/s3c6410-mini6410.dts
arch/arm/boot/dts/Makefile +1 -0
index 1357510..acf41d7 100644
@@ -161,6 +161,7 @@ dtb-$(CONFIG_ARCH_U8500) += snowball.dtb \
 	hrefv60plus.dtb \
 	ccu9540.dtb
 dtb-$(CONFIG_ARCH_S3C24XX) += s3c2416-smdk2416.dtb
+dtb-$(CONFIG_ARCH_S3C64XX) += s3c6410-mini6410.dtb
 dtb-$(CONFIG_ARCH_SHMOBILE) += emev2-kzm9d.dtb \
 	r8a7740-armadillo800eva.dtb \
 	r8a7778-bockw.dtb \
arch/arm/boot/dts/s3c6410-mini6410.dts new file +199 -0

199 lines not on this page · raw message

Signature · 1 line
1.8.2.1
#14 lore raw

PATCH v6 8/8 ARM: dts: Add dts file for S3C6410-based SMDK6410 board

In reply to Tomasz Figa

This patch adds basic device tree sources for SAMSUNG SMDK6410 board based on SAMSUNG S3C6410 SoC.

Currently only UARTs, SD channel 0 and 100Mbps ethernet (SMSC911x) are supported.

---
 arch/arm/boot/dts/Makefile             |  3 +-
 arch/arm/boot/dts/s3c6410-smdk6410.dts | 93 ++++++++++++++++++++++++++++++++++
 2 files changed, 95 insertions(+), 1 deletion(-)
 create mode 100644 arch/arm/boot/dts/s3c6410-smdk6410.dts
arch/arm/boot/dts/Makefile +2 -1
index acf41d7..0382554 100644
@@ -161,7 +161,8 @@ dtb-$(CONFIG_ARCH_U8500) += snowball.dtb \
 	hrefv60plus.dtb \
 	ccu9540.dtb
 dtb-$(CONFIG_ARCH_S3C24XX) += s3c2416-smdk2416.dtb
-dtb-$(CONFIG_ARCH_S3C64XX) += s3c6410-mini6410.dtb
+dtb-$(CONFIG_ARCH_S3C64XX) += s3c6410-mini6410.dtb \
+	s3c6410-smdk6410.dtb
 dtb-$(CONFIG_ARCH_SHMOBILE) += emev2-kzm9d.dtb \
 	r8a7740-armadillo800eva.dtb \
 	r8a7778-bockw.dtb \
arch/arm/boot/dts/s3c6410-smdk6410.dts new file +93 -0

93 lines not on this page · raw message

Signature · 1 line
1.8.2.1