Initial Device Tree support for S3C64xx
Subsystems (5)
cover Initial Device Tree support for S3C64xx
This series is an initial proposal of 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 (very) basic device tree source for FriendlyARM Mini6410 board.
Current support is very limited and allows only basic bootup to the point of mounting rootfs, which fails, because there are no storage devices available, but should be fine as a start and will be extended in future, hopefully with help of all S3C64xx board maintainers.
Tomasz Figa (7):
ARM: common: vic: Parse interrupt and resume masks from device tree
ARM: common: vic: Fix invalid first IRQ number in OF-based
registration
ARM: s3c64xx: Add support for OF-based VIC initialization
ARM: s3c64xx: Fix build error with CONFIG_S3C_DEV_FB disabled
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
Documentation/devicetree/bindings/arm/vic.txt | 6 ++ arch/arm/boot/dts/Makefile | 1 + arch/arm/boot/dts/s3c6400.dtsi | 33 ++++++++++ arch/arm/boot/dts/s3c6410-mini6410.dts | 44 +++++++++++++ arch/arm/boot/dts/s3c6410.dtsi | 33 ++++++++++ arch/arm/boot/dts/s3c64xx.dtsi | 73 +++++++++++++++++++++ arch/arm/common/vic.c | 9 ++- arch/arm/mach-s3c64xx/Kconfig | 13 ++++ arch/arm/mach-s3c64xx/Makefile | 1 + arch/arm/mach-s3c64xx/common.c | 20 +++++- arch/arm/mach-s3c64xx/mach-s3c64xx-dt.c | 93 +++++++++++++++++++++++++++ arch/arm/mach-s3c64xx/pm.c | 4 +- 12 files changed, 323 insertions(+), 7 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.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.1
RFC PATCH 1/7 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 ++++++ arch/arm/common/vic.c | 7 ++++++- 2 files changed, 12 insertions(+), 1 deletion(-)
Documentation/devicetree/bindings/arm/vic.txt +6 -0
@@ -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>; };
arch/arm/common/vic.c +6 -1
@@ -407,6 +407,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 ;
@@ -415,10 +417,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 -1 as first IRQ makes the simple domain allocate descriptors */ -__vic_init (regs,-1 , ~0 , ~0 , node); +__vic_init (regs,-1 , interrupt_mask, wakeup_mask, node);return 0 ; }
Signature · 1 line
1.8.1
RFC PATCH 1/7 ARM: common: vic: Parse interrupt and resume masks from device tree
Quoted 3 lines · Tomasz Figa
+- 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)
Should this really be configured in the VIC itself? It seems like
something that might change at runtime (for example, due to the user
configuring wakes in sysfs).
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20130110/f067b762/attachment.sig>
RFC PATCH 1/7 ARM: common: vic: Parse interrupt and resume masks from device tree
Quoted 8 lines · On Thursday 10 of January 2013 11:03:14 Mark Brown wrote:
Quoted 3 lines · Tomasz Figa
+- 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)
Should this really be configured in the VIC itself? It seems like something that might change at runtime (for example, due to the user configuring wakes in sysfs).
This is not the runtime interrupt/wakeup mask, but a global mask of available interrupt/wakeup lines on particular platform, which still have to be configured and enabled appropriately by user.
Best regards,
Tomasz Figa
RFC PATCH 1/7 ARM: common: vic: Parse interrupt and resume masks from device tree
Quoted 3 lines · Tomasz Figa
This is not the runtime interrupt/wakeup mask, but a global mask of available interrupt/wakeup lines on particular platform, which still have to be configured and enabled appropriately by user.
Ah, OK.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20130110/29a757b2/attachment.sig>
RFC PATCH 2/7 ARM: common: vic: Fix invalid first IRQ number in OF-based registration
In reply to Tomasz FigaWithout this patch, vic_of_init passed -1 as first IRQ number to __vic_init (as signed int), then to vic_register (now as unsigned int equals to 0xffffffff) and finally to irq_domain_add_simple (again as unsigned 0xffffffff), which tries to allocate irq descriptors starting from IRQ 0xffffffff, which obviously is bound to fail.
This patch corrects OF-based VIC registration by locating VICs in IRQ address space starting from IRQ 32 and then placing one VIC after another. This is similar to the solution used with GIC and allows to maintain compatibility with legacy code using static IRQ numbers.
--- arch/arm/common/vic.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/arm/common/vic.c +2 -2
@@ -421,9 +421,9 @@ int __init vic_of_init(struct device_node *node, struct device_node *parent)of_property_read_u32 (node,"wakeup-mask" , &wakeup_mask);/* -* Passing -1 as first IRQ makes the simple domain allocate descriptors +* Use IRQ numbers starting from 32 and placing each VIC after another */ -__vic_init (regs,-1 , interrupt_mask, wakeup_mask, node); +__vic_init (regs,32 + (32 * vic_id), interrupt_mask, wakeup_mask, node);return 0 ; }
Signature · 1 line
1.8.1
RFC PATCH 3/7 ARM: s3c64xx: Add support for OF-based VIC initialization
In reply to Tomasz FigaThis patch modifies IRQ initialization code of S3C64xx to support Device Tree-based initialization of VICs.
--- arch/arm/mach-s3c64xx/common.c | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-)
arch/arm/mach-s3c64xx/common.c +17 -3
@@ -19,6 +19,7 @@#include <linux/module.h> #include <linux/interrupt.h> #include <linux/ioport.h> +#include <linux/of_irq.h> #include <linux/serial_core.h> #include <linux/platform_device.h> #include <linux/io.h>
@@ -181,13 +182,26 @@ core_initcall(s3c64xx_dev_init); 1 << (IRQ_HSMMC1 - IRQ_VIC1_BASE) | \ 1 << (IRQ_HSMMC2 - IRQ_VIC1_BASE)) +#ifdef CONFIG_OF +static const struct of_device_id s3c64xx_dt_irq_match[] = { + { .compatible ="arm,pl192-vic" , .data = vic_of_init, }, + {}, +}; +#endif +void __init s3c64xx_init_irq (u32 vic0_valid,u32 vic1_valid) {printk (KERN_DEBUG "%s: initialising interrupts\n" , __func__); -/* initialise the pair of VICs */ -vic_init (VA_VIC0 ,IRQ_VIC0_BASE , vic0_valid,IRQ_VIC0_RESUME ); -vic_init (VA_VIC1 ,IRQ_VIC1_BASE , vic1_valid,IRQ_VIC1_RESUME ); +if (!of_have_populated_dt ()) { +/* initialise the pair of VICs */ +vic_init (VA_VIC0 ,IRQ_VIC0_BASE , vic0_valid,IRQ_VIC0_RESUME ); +vic_init (VA_VIC1 ,IRQ_VIC1_BASE , vic1_valid,IRQ_VIC1_RESUME ); + } +#ifdef CONFIG_OF + else +of_irq_init (s3c64xx_dt_irq_match ); +#endif /* add the timer sub-irqs */ s3c_init_vic_timer_irq (5 ,IRQ_TIMER0 );
Signature · 1 line
1.8.1
RFC PATCH 3/7 ARM: s3c64xx: Add support for OF-based VIC initialization
Quoted 2 lines · Tomasz Figa
This patch modifies IRQ initialization code of S3C64xx to support Device Tree-based initialization of VICs.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20130110/0e98cde9/attachment.sig>
RFC PATCH 4/7 ARM: s3c64xx: Fix build error with CONFIG_S3C_DEV_FB disabled
In reply to Tomasz FigaIf there is no board selecting CONFIG_S3C_DEV_FB enabled, build will fail on arch/arm/mach-s3c64xx/pm.c, where s3c_device_fb is referenced.
This patch adds ifdef guard around the code making it compile only when CONFIG_S3C_DEV_FB is enabled.
--- arch/arm/mach-s3c64xx/pm.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/arm/mach-s3c64xx/pm.c +2 -2
@@ -338,10 +338,10 @@ int __init s3c64xx_pm_init(void)for (i =0 ; i <ARRAY_SIZE (s3c64xx_pm_domains); i++)pm_genpd_init (&s3c64xx_pm_domains[i]->pd,NULL , false); - +#ifdef CONFIG_S3C_DEV_FB if (dev_get_platdata (&s3c_device_fb.dev))pm_genpd_add_device (&s3c64xx_pm_f.pd, &s3c_device_fb.dev); - +#endif return 0 ; }
Signature · 1 line
1.8.1
RFC PATCH 4/7 ARM: s3c64xx: Fix build error with CONFIG_S3C_DEV_FB disabled
Quoted 2 lines · Tomasz Figa
If there is no board selecting
CONFIG_S3C_DEV_FBenabled, build will fail
on
Quoted 29 lines
arch/arm/mach-s3c64xx/pm.c, wheres3c_device_fbis referenced.This patch adds ifdef guard around the code making it compile only when
CONFIG_S3C_DEV_FBis enabled.Signed-off-by Tomasz Figa <[email protected]>--- arch/arm/mach-s3c64xx/pm.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)arch/arm/mach-s3c64xx/pm.c +2
-3@@ -338,10 +338,10 @@ int __init s3c64xx_pm_init(void)for (i =0 ; i <ARRAY_SIZE (s3c64xx_pm_domains); i++)pm_genpd_init (&s3c64xx_pm_domains[i]->pd,NULL , false); - +#ifdef CONFIG_S3C_DEV_FB if (dev_get_platdata (&s3c_device_fb.dev))pm_genpd_add_device (&s3c64xx_pm_f.pd, &s3c_device_fb.dev); - +#endif return 0 ; } --
Quoted 1 line
1.8.1
This should be separated patch from this series as a fix.
Let me pick this up into -fixes.
Thanks.
- Kukjin
RFC PATCH 4/7 ARM: s3c64xx: Fix build error with CONFIG_S3C_DEV_FB disabled
Hi Kukjin,
Quoted 38 lines · On Wednesday 09 of January 2013 16:15:23 Kukjin Kim wrote:
Quoted 2 lines · Tomasz Figa
If there is no board selecting
CONFIG_S3C_DEV_FBenabled, build will failon
Quoted 33 lines
arch/arm/mach-s3c64xx/pm.c, wheres3c_device_fbis referenced.This patch adds ifdef guard around the code making it compile only when
CONFIG_S3C_DEV_FBis enabled.Signed-off-by Tomasz Figa <[email protected]>---
arch/arm/mach-s3c64xx/pm.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)arch/arm/mach-s3c64xx/pm.c +1
-1@@ -338,10 +338,10 @@ int __init s3c64xx_pm_init(void)for (i =0 ; i <ARRAY_SIZE (s3c64xx_pm_domains); i++)pm_genpd_init (&s3c64xx_pm_domains[i]->pd,NULL , false); - +#ifdef CONFIG_S3C_DEV_FB if (dev_get_platdata (&s3c_device_fb.dev)) pm_genpd_add_device(&s3c64xx_pm_f.pd,&s3c_device_fb.dev);
arch/arm/mach-s3c64xx/pm.c +1
-1- +#endif
Quoted 8 lines
Quoted 6 lines
return 0;
}
--
1.8.1This should be separated patch from this series as a fix.
Right.
Quoted 1 line
Let me pick this up into -fixes.
No problem.
Best regards,
Tomasz Figa
RFC PATCH 5/7 ARM: s3c64xx: Add board file for boot using Device Tree
In reply to Tomasz FigaThis patch adds board file that will be used to boot S3C64xx-based boards using Device Tree.
--- arch/arm/mach-s3c64xx/Kconfig | 13 +++++ arch/arm/mach-s3c64xx/Makefile | 1 + arch/arm/mach-s3c64xx/mach-s3c64xx-dt.c | 93 +++++++++++++++++++++++++++++++++ 3 files changed, 107 insertions(+) create mode 100644 arch/arm/mach-s3c64xx/mach-s3c64xx-dt.c
arch/arm/mach-s3c64xx/Kconfig +13 -0
@@ -309,3 +309,16 @@ 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 CPU_S3C6400 + select CPU_S3C6410 + 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
@@ -58,3 +58,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 +93 -0
93 lines not on this page · raw message
Signature · 1 line
1.8.1
RFC PATCH 5/7 ARM: s3c64xx: Add board file for boot using Device Tree
Quoted 82 lines · Tomasz Figa
This patch adds board file that will be used to boot S3C64xx-based boards using Device Tree.
Signed-off-by Tomasz Figa <[email protected]>--- arch/arm/mach-s3c64xx/Kconfig | 13 +++++ arch/arm/mach-s3c64xx/Makefile | 1 + arch/arm/mach-s3c64xx/mach-s3c64xx-dt.c | 93 +++++++++++++++++++++++++++++++++ 3 files changed, 107 insertions(+) create mode 100644 arch/arm/mach-s3c64xx/mach-s3c64xx-dt.carch/arm/mach- renamed from arch/arm/mach-s3c64xx/Kconfig +0
-0s3c64xx/Kconfig
index 131c862..a43b3f7 100644arch/arm/mach-s3c64xx/Kconfig +8
-0@@ -309,3 +309,16 @@ 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 CPU_S3C6400 + select CPU_S3C6410 + select USE_OF + help + Machine support for Samsung S3C6400/S3C6410 machines withDevice Tree
arch/arm/mach-s3c64xx/Kconfig +5
-0+ 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- renamed from arch/arm/mach-s3c64xx/Makefile +0
-0s3c64xx/Makefile
index f9ce1dc..59b3d06 100644arch/arm/mach-s3c64xx/Makefile +0
-0@@ -58,3 +58,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.oarch/arm/mach-s3c64xx/Makefile +1
-0+obj-$(CONFIG_MACH_S3C64XX_DT) += mach-s3c64xx-dt.oarch/arm/mach- renamed from arch/arm/mach-s3c64xx/mach-s3c64xx-dt.c +0
-0
s3c64xx/mach-s3c64xx-dt.c
new file mode 100644
index 0000000..f5725cearch/arm/mach-s3c64xx/mach-s3c64xx-dt.c new file +25
-0@@ -0,0 +1,93 @@ +/* +* Samsung's S3C64XX flattened device tree enabled machine +* +* Copyright (c) 2012 Tomasz Figa <[email protected]> +* +* 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/of_platform.h> +#include <linux/serial_core.h> + +#include <asm/mach/arch.h> +#include <asm/hardware/vic.h> +#include <mach/map.h> + +#include <plat/cpu.h> +#include <plat/regs-serial.h> +#include <plat/s5p-time.h> + +#include "common.h" + +/* +* The following lookup table is used to override device names when devices
+ * are registered from device tree. This is temporarily added to enable
Quoted 8 lines
+ * device tree support addition for the Exynos4 architecture.
+ *
+ * For drivers that require platform data to be provided from the machine
+ * file, a platform data pointer can also be supplied along with the
+ * devices names. Usually, the platform data elements that cannot be parsed
+ * from the device tree by the drivers (example: function pointers) are
+ * supplied. But it should be noted that this is a temporary mechanism
and
Quoted 1 line
+ * at some point, the drivers should be capable of parsing all the
platform
arch/arm/mach-s3c64xx/mach-s3c64xx-dt.c line 45
Quoted 12 lines
+ * data from the device tree.
+ */
+static const structof_dev_auxdatas3c64xx_auxdata_lookup[]__initconst= {arch/arm/mach-s3c64xx/mach-s3c64xx-dt.c new file +8
-0+OF_DEV_AUXDATA ("samsung,s3c6400-uart" ,S3C_PA_UART0 , +"s3c6400-uart.0" ,NULL ), +OF_DEV_AUXDATA ("samsung,s3c6400-uart" ,S3C_PA_UART1 , +"s3c6400-uart.1" ,NULL ), +OF_DEV_AUXDATA ("samsung,s3c6400-uart" ,S3C_PA_UART2 , +"s3c6400-uart.2" ,NULL ), +OF_DEV_AUXDATA ("samsung,s3c6400-uart" ,S3C_PA_UART3 , + "s3c6400-uart.3", NULL),
I'd prefer to use 0x7F005000 instead of S3C_PA_UART0 so that we can remove the static definitions at the map.h
arch/arm/mach-s3c64xx/mach-s3c64xx-dt.c line 52
Quoted 7 lines
arch/arm/mach-s3c64xx/mach-s3c64xx-dt.c new file +7
-0+ {}, +}; + +static void __init s3c64xx_dt_map_io (void ) +{ +s3c64xx_init_io (NULL ,0 ); +s3c24xx_init_clocks (12000000 );
The value of xtal clock for s3c24xx_init_clocks() should be defined via dt according to board condition _next_time_ because it can be different on each board, it's same on current s3c64xx boards though.
Quoted 20 lines
arch/arm/mach-s3c64xx/mach-s3c64xx-dt.c new file +14
-0+} + +static void __init s3c64xx_dt_machine_init (void ) +{ +of_platform_populate (NULL , of_default_bus_match_table, + s3c64xx_auxdata_lookup,NULL ); +} + +static char const *s3c6400_dt_compat[]__initdata = { +"samsung,s3c6400" , +NULL +}; + +DT_MACHINE_START(S3C6400_DT, "Samsung S3C6400 (Flattened DeviceTree)")
arch/arm/mach-s3c64xx/mach-s3c64xx-dt.c new file +5
-0+/* Maintainer: Tomasz Figa <[email protected]> */ + .init_irq = s3c6400_init_irq, + .map_io = s3c64xx_dt_map_io, + .handle_irq = vic_handle_irq, + .init_machine = s3c64xx_dt_machine_init,
arch/arm/mach-s3c64xx/mach-s3c64xx-dt.c line 81
Quoted 10 lines
arch/arm/mach-s3c64xx/mach-s3c64xx-dt.c new file +10
-0+ .init_late = s3c64xx_init_late, + .timer = &s3c24xx_timer, + .dt_compat = s3c6400_dt_compat, + .restart = s3c64xx_restart, +MACHINE_END + +static char const *s3c6410_dt_compat[] __initdata = { +"samsung,s3c6410" , +NULL +};
I think, we don't need separation.
+static char const *s3c64xx_dt_compat[] __initdata = {
+ "samsung,s3c6400",
+ "samsung,s3c6410",
+ NULL
+};
arch/arm/mach-s3c64xx/mach-s3c64xx-dt.c line 91
Quoted 11 lines
arch/arm/mach-s3c64xx/mach-s3c64xx-dt.c new file +2
-0+ +DT_MACHINE_START(S3C6410_DT, "Samsung S3C6410 (Flattened DeviceTree)")
arch/arm/mach-s3c64xx/mach-s3c64xx-dt.c new file +8
-0+/* Maintainer: Tomasz Figa <[email protected]> */ + .init_irq = s3c6410_init_irq, + .map_io = s3c64xx_dt_map_io, + .handle_irq = vic_handle_irq, + .init_machine = s3c64xx_dt_machine_init, + .init_late = s3c64xx_init_late, + .timer = &s3c24xx_timer, + .dt_compat = s3c6410_dt_compat,
+ .dt_compat = s3c64xx_dt_compat,
Quoted 4 lines
arch/arm/mach-s3c64xx/mach-s3c64xx-dt.c new file +2
-1+ .restart = s3c64xx_restart, +MACHINE_END --1.8.1
RFC PATCH 5/7 ARM: s3c64xx: Add board file for boot using Device Tree
Hi Kukjin,
Quoted 105 lines · On Wednesday 09 of January 2013 16:24:42 Kukjin Kim wrote:
Quoted 90 lines · Tomasz Figa
This patch adds board file that will be used to boot S3C64xx-based boards using Device Tree.
Signed-off-by Tomasz Figa <[email protected]>---
arch/arm/mach-s3c64xx/Kconfig | 13 +++++ arch/arm/mach-s3c64xx/Makefile | 1 + arch/arm/mach-s3c64xx/mach-s3c64xx-dt.c | 93+++++++++++++++++++++++++++++++++
3 files changed, 107 insertions(+) create mode 100644 arch/arm/mach-s3c64xx/mach-s3c64xx-dt.carch/arm/mach- renamed from arch/arm/mach-s3c64xx/Kconfig +0
-0s3c64xx/Kconfig
index 131c862..a43b3f7 100644arch/arm/mach-s3c64xx/Kconfig +8
-0@@ -309,3 +309,16 @@ 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 CPU_S3C6400 + select CPU_S3C6410 + select USE_OF + help + Machine support for Samsung S3C6400/S3C6410 machines withDevice Tree
arch/arm/mach-s3c64xx/Kconfig +5
-0+ 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- renamed from arch/arm/mach-s3c64xx/Makefile +0
-0s3c64xx/Makefile
index f9ce1dc..59b3d06 100644arch/arm/mach-s3c64xx/Makefile +0
-0@@ -58,3 +58,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
arch/arm/mach-s3c64xx/Makefile +1
-0+obj-$(CONFIG_MACH_S3C64XX_DT) += mach-s3c64xx-dt.oarch/arm/mach- renamed from arch/arm/mach-s3c64xx/mach-s3c64xx-dt.c +0
-0
s3c64xx/mach-s3c64xx-dt.c
new file mode 100644
index 0000000..f5725cearch/arm/mach-s3c64xx/mach-s3c64xx-dt.c new file +6
-0@@ -0,0 +1,93 @@ +/* +* Samsung's S3C64XX flattened device tree enabled machine +* +* Copyright (c) 2012 Tomasz Figa <[email protected]> +* +* 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.
arch/arm/mach-s3c64xx/mach-s3c64xx-dt.c new file +17
-0+*/ + +#include <linux/of_platform.h> +#include <linux/serial_core.h> + +#include <asm/mach/arch.h> +#include <asm/hardware/vic.h> +#include <mach/map.h> + +#include <plat/cpu.h> +#include <plat/regs-serial.h> +#include <plat/s5p-time.h> + +#include "common.h" + +/* +* The following lookup table is used to override device names when devices
+ * are registered from device tree. This is temporarily added to enable + * device tree support addition for the Exynos4 architecture.Quoted 8 lines
+ *
+ * For drivers that require platform data to be provided from the machine + * file, a platform data pointer can also be supplied along with the + * devices names. Usually, the platform data elements that cannot be parsed
+ * from the device tree by the drivers (example: function pointers) are + * supplied. But it should be noted that this is a temporary mechanismand
Quoted 1 line
+ * at some point, the drivers should be capable of parsing all the
platform
Quoted 15 lines
arch/arm/mach-s3c64xx/mach-s3c64xx-dt.c line 45
Quoted 12 lines
+ * data from the device tree.
+ */
+static const structof_dev_auxdatas3c64xx_auxdata_lookup[]__initconst= {arch/arm/mach-s3c64xx/mach-s3c64xx-dt.c new file +8
-0+OF_DEV_AUXDATA ("samsung,s3c6400-uart" ,S3C_PA_UART0 , +"s3c6400-uart.0" ,NULL ), +OF_DEV_AUXDATA ("samsung,s3c6400-uart" ,S3C_PA_UART1 , +"s3c6400-uart.1" ,NULL ), +OF_DEV_AUXDATA ("samsung,s3c6400-uart" ,S3C_PA_UART2 , +"s3c6400-uart.2" ,NULL ), +OF_DEV_AUXDATA ("samsung,s3c6400-uart" ,S3C_PA_UART3 , + "s3c6400-uart.3", NULL),I'd prefer to use
0x7F005000instead ofS3C_PA_UART0so that we can remove the static definitions at themap.h
Ideally, I would like to completely get rid of this and start cleanly with common clock framework, but support for it would be probably based on Thomas Abraham's code for Exynos, which would have to be merged first.
So for now I will replace symbolic addresses with numeric ones, as you suggested.
Quoted 11 lines
arch/arm/mach-s3c64xx/mach-s3c64xx-dt.c line 52
Quoted 7 lines
arch/arm/mach-s3c64xx/mach-s3c64xx-dt.c new file +7
-0+ {}, +}; + +static void __init s3c64xx_dt_map_io (void ) +{ +s3c64xx_init_io (NULL ,0 ); +s3c24xx_init_clocks (12000000 );The value of xtal clock for
s3c24xx_init_clocks()should be defined via dt according to board condition _next_time_ because it can be different on each board, it's same on current s3c64xx boards though.
This is yet another issue that will be solved by using Common Clock Framework.
Quoted 24 lines
Quoted 24 lines
arch/arm/mach-s3c64xx/mach-s3c64xx-dt.c new file +14
-0+} + +static void __init s3c64xx_dt_machine_init (void ) +{ +of_platform_populate (NULL , of_default_bus_match_table, + s3c64xx_auxdata_lookup,NULL ); +} + +static char const *s3c6400_dt_compat[]__initdata = { +"samsung,s3c6400" , +NULL +}; + +DT_MACHINE_START(S3C6400_DT, "Samsung S3C6400 (Flattened DeviceTree)")
arch/arm/mach-s3c64xx/mach-s3c64xx-dt.c new file +9
-0+/* Maintainer: Tomasz Figa <[email protected]> */ + .init_irq = s3c6400_init_irq, + .map_io = s3c64xx_dt_map_io, + .handle_irq = vic_handle_irq, + .init_machine = s3c64xx_dt_machine_init, + .init_late = s3c64xx_init_late, + .timer = &s3c24xx_timer, + .dt_compat = s3c6400_dt_compat, + .restart = s3c64xx_restart,
Quoted 8 lines
arch/arm/mach-s3c64xx/mach-s3c64xx-dt.c line 81
Quoted 6 lines
arch/arm/mach-s3c64xx/mach-s3c64xx-dt.c new file +6
-0+MACHINE_END + +static char const *s3c6410_dt_compat[] __initdata = { +"samsung,s3c6410" , +NULL +};I think, we don't need separation.
These two differ in init_irq callback, but now as I look at it, all the data are already being parsed from device tree, so I will just add s3c64xx_of_init_irq and make just one DT machine.
Best regards,
Tomasz Figa
RFC PATCH 5/7 ARM: s3c64xx: Add board file for boot using Device Tree
In reply to Tomasz FigaQuoted 3 lines · Tomasz Figa
+ * The following lookup table is used to override device names when devices
+ * are registered from device tree. This is temporarily added to enable
+ * device tree support addition for the Exynos4 architecture.
Cut'n'paste.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20130110/1b0db75f/attachment.sig>
RFC PATCH 5/7 ARM: s3c64xx: Add board file for boot using Device Tree
Hi Mark,
Quoted 6 lines · On Thursday 10 of January 2013 10:52:22 Mark Brown wrote:
Quoted 4 lines · Tomasz Figa
+ * The following lookup table is used to override device names when devices + * are registered from device tree. This is temporarily added to enable + * device tree support addition for the Exynos4 architecture.
Cut'n'paste.
Oh my, you got me. ;)
I will correct it in next version. Thanks for spotting this.
Best regards,
Tomasz Figa
RFC PATCH 6/7 ARM: dts: Add basic dts include files for Samsung S3C64xx SoCs
In reply to Tomasz FigaThis 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 | 33 +++++++++++++++++++ arch/arm/boot/dts/s3c6410.dtsi | 33 +++++++++++++++++++ arch/arm/boot/dts/s3c64xx.dtsi | 73 ++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 139 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.dtsi
arch/arm/boot/dts/s3c6400.dtsi new file +33 -0
@@ -0,0 +1,33 @@ +/* + * Samsung's S3C6400 SoC device tree source + * + * Copyright (c) 2012 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-controller at 71200000 { + interrupt-mask = <0xfffffe1f>; + wakeup-mask = <0x00200004>; + }; + + vic1: interrupt-controller at 71300000 { + interrupt-mask = <0xffffffff>; + wakeup-mask = <0x53020000>; + }; +};
arch/arm/boot/dts/s3c6410.dtsi new file +33 -0
@@ -0,0 +1,33 @@ +/* + * Samsung's S3C6410 SoC device tree source + * + * Copyright (c) 2012 Tomasz Figa <[email protected]> + * + * Samsung's S3C6410 SoC device nodes are listed in this file. S3C6410 + * 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 + * S3C6410 SoC. As device tree coverage for S3C6410 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,s3c6410"; + + vic0: interrupt-controller at 71200000 { + interrupt-mask = <0xffffff7f>; + wakeup-mask = <0x00200004>; + }; + + vic1: interrupt-controller at 71300000 { + interrupt-mask = <0xffffffff>; + wakeup-mask = <0x53020000>; + }; +};
arch/arm/boot/dts/s3c64xx.dtsi new file +73 -0
73 lines not on this page · raw message
Signature · 1 line
1.8.1
RFC PATCH 7/7 ARM: dts: Add dts file for S3C6410-based Mini6410 board
In reply to Tomasz FigaThis 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 | 44 ++++++++++++++++++++++++++++++++++ 2 files changed, 45 insertions(+) create mode 100644 arch/arm/boot/dts/s3c6410-mini6410.dts
arch/arm/boot/dts/Makefile +1 -0
@@ -120,6 +120,7 @@ dtb-$(CONFIG_ARCH_U8500) += snowball.dtb \ hrefprev60.dtb \ hrefv60plus.dtb \ ccu9540.dtb +dtb-$(CONFIG_ARCH_S3C64XX) += s3c6410-mini6410.dtb dtb-$(CONFIG_ARCH_SHMOBILE) += emev2-kzm9d.dtb \ r8a7740-armadillo800eva.dtb \ sh73a0-kzm9g.dtb \
arch/arm/boot/dts/s3c6410-mini6410.dts new file +44 -0
44 lines not on this page · raw message
Signature · 1 line
1.8.1