ARM: integrator: convert AMBA devices to device tree
Subsystems (3)
PATCH 5/6 ARM: integrator: convert AMBA devices to device tree
This converts the AMBA (PrimeCell) devices on the Integrator/AP and Integrator/CP over to probing from the Device Tree if the kernel is compiled for Device Tree support.
We continue to #ifdef out all non-DT code and vice versa on respective boot type to get a clean cut.
We need to add a bunch of auxdata (compare to the Versatile) to handle bus names and callbacks alike.
--- arch/arm/boot/dts/integratorap.dts | 47 +++++++++++++ arch/arm/boot/dts/integratorcp.dts | 64 ++++++++++++++++++ arch/arm/mach-integrator/common.h | 2 + arch/arm/mach-integrator/core.c | 8 ++- arch/arm/mach-integrator/integrator_ap.c | 109 ++++++++++++++++++++++--------- arch/arm/mach-integrator/integrator_cp.c | 97 +++++++++++++++++---------- 6 files changed, 261 insertions(+), 66 deletions(-)
arch/arm/boot/dts/integratorap.dts +47 -0
@@ -23,4 +23,51 @@ clear-mask = <0xffffffff>; valid-mask = <0x003fffff>; }; + + fpga { + compatible = "arm,amba-bus", "simple-bus"; + #address-cells = <1>; + #size-cells = <1>; + ranges; + + rtc: rtc at 15000000 { + compatible = "arm,pl031", "arm,primecell"; + reg = <0x15000000 0x1000>; + interrupt-parent = <&pic>; + interrupts = <8>; + arm,primecell-periphid = <0x00041030>; + }; + + uart0: uart at 16000000 { + compatible = "arm,pl011", "arm,primecell"; + reg = <0x16000000 0x1000>; + interrupt-parent = <&pic>; + interrupts = <1>; + arm,primecell-periphid = <0x00041010>; + }; + + uart1: uart at 17000000 { + compatible = "arm,pl011", "arm,primecell"; + reg = <0x17000000 0x1000>; + interrupt-parent = <&pic>; + interrupts = <2>; + arm,primecell-periphid = <0x00041010>; + }; + + kmi0: kmi at 18000000 { + compatible = "arm,pl050", "arm,primecell"; + reg = <0x18000000 0x1000>; + interrupt-parent = <&pic>; + interrupts = <3>; + arm,primecell-periphid = <0x00041050>; + }; + + kmi1: kmi at 19000000 { + compatible = "arm,pl050", "arm,primecell"; + reg = <0x19000000 0x1000>; + interrupt-parent = <&pic>; + interrupts = <4>; + arm,primecell-periphid = <0x00041050>; + }; + }; };
arch/arm/boot/dts/integratorcp.dts +64 -0
68 lines not on this page · raw message
arch/arm/mach-integrator/common.h +2 -0
@@ -1,3 +1,5 @@ +#include <linux/amba/serial.h> +extern struct amba_pl010_data integrator_uart_data;void integrator_init_early (void );int integrator_init (bool is_cp);void integrator_reserve (void );
arch/arm/mach-integrator/core.c +6 -2
@@ -33,7 +33,9 @@#include <asm/mach/time.h> #include <asm/pgtable.h> -static struct amba_pl010_data integrator_uart_data; +#include "common.h" + +#ifndef CONFIG_OF #define INTEGRATOR_RTC_IRQ { IRQ_RTCINT }#define INTEGRATOR_UART0_IRQ { IRQ_UARTINT0 }
@@ -86,6 +88,8 @@ int __init integrator_init(bool is_cp) return 0; } +#endif +/* * On the Integrator platform, the port RTS and DTR are provided by * bits in the following SC_CTRLS register bits:
@@ -122,7 +126,7 @@ static void integrator_uart_set_mctrl(struct amba_device *dev, void __iomem *bas__raw_writel (ctrlc,SC_CTRLC ); } -static struct amba_pl010_data integrator_uart_data = { +struct amba_pl010_data integrator_uart_data = { .set_mctrl = integrator_uart_set_mctrl, };
arch/arm/mach-integrator/integrator_ap.c +78 -31
139 lines not on this page · raw message
arch/arm/mach-integrator/integrator_cp.c +64 -33
139 lines not on this page · raw message
Signature · 1 line
1.7.11.2
PATCH 5/6 ARM: integrator: convert AMBA devices to device tree
Quoted 248 lines · Linus Walleij
This converts the AMBA (PrimeCell) devices on the Integrator/AP and Integrator/CP over to probing from the Device Tree if the kernel is compiled for Device Tree support.
We continue to #ifdef out all non-DT code and vice versa on respective boot type to get a clean cut.
We need to add a bunch of auxdata (compare to the Versatile) to handle bus names and callbacks alike.
Signed-off-by Linus Walleij <[email protected]>--- arch/arm/boot/dts/integratorap.dts | 47 +++++++++++++ arch/arm/boot/dts/integratorcp.dts | 64 ++++++++++++++++++ arch/arm/mach-integrator/common.h | 2 + arch/arm/mach-integrator/core.c | 8 ++- arch/arm/mach-integrator/integrator_ap.c | 109 ++++++++++++++++++++++--------- arch/arm/mach-integrator/integrator_cp.c | 97 +++++++++++++++++---------- 6 files changed, 261 insertions(+), 66 deletions(-)arch/arm/boot/dts/integratorap.dts +47
-0@@ -23,4 +23,51 @@ clear-mask = <0xffffffff>; valid-mask = <0x003fffff>; }; + + fpga { + compatible = "arm,amba-bus", "simple-bus"; + #address-cells = <1>; + #size-cells = <1>; + ranges; + + rtc: rtc at 15000000 { + compatible = "arm,pl031", "arm,primecell"; + reg = <0x15000000 0x1000>; + interrupt-parent = <&pic>; + interrupts = <8>; + arm,primecell-periphid = <0x00041030>; + }; + + uart0: uart at 16000000 { + compatible = "arm,pl011", "arm,primecell"; + reg = <0x16000000 0x1000>; + interrupt-parent = <&pic>; + interrupts = <1>; + arm,primecell-periphid = <0x00041010>; + }; + + uart1: uart at 17000000 { + compatible = "arm,pl011", "arm,primecell"; + reg = <0x17000000 0x1000>; + interrupt-parent = <&pic>; + interrupts = <2>; + arm,primecell-periphid = <0x00041010>; + }; + + kmi0: kmi at 18000000 { + compatible = "arm,pl050", "arm,primecell"; + reg = <0x18000000 0x1000>; + interrupt-parent = <&pic>; + interrupts = <3>; + arm,primecell-periphid = <0x00041050>; + }; + + kmi1: kmi at 19000000 { + compatible = "arm,pl050", "arm,primecell"; + reg = <0x19000000 0x1000>; + interrupt-parent = <&pic>; + interrupts = <4>; + arm,primecell-periphid = <0x00041050>; + }; + }; };arch/arm/boot/dts/integratorcp.dts +64
-0@@ -43,4 +43,68 @@ clear-mask = <0x00000fff>; valid-mask = <0x00000fff>; }; + + fpga { + compatible = "arm,amba-bus", "simple-bus"; + #address-cells = <1>; + #size-cells = <1>; + ranges; + + rtc: rtc at 15000000 { + compatible = "arm,pl031", "arm,primecell"; + reg = <0x15000000 0x1000>; + interrupt-parent = <&pic>; + interrupts = <8>; + }; + + uart0: uart at 16000000 { + compatible = "arm,pl011", "arm,primecell"; + reg = <0x16000000 0x1000>; + interrupt-parent = <&pic>; + interrupts = <1>; + }; + + uart1: uart at 17000000 { + compatible = "arm,pl011", "arm,primecell"; + reg = <0x17000000 0x1000>; + interrupt-parent = <&pic>; + interrupts = <2>; + }; + + kmi0: kmi at 18000000 { + compatible = "arm,pl050", "arm,primecell"; + reg = <0x18000000 0x1000>; + interrupt-parent = <&pic>; + interrupts = <3>; + }; + + kmi1: kmi at 19000000 { + compatible = "arm,pl050", "arm,primecell"; + reg = <0x19000000 0x1000>; + interrupt-parent = <&pic>; + interrupts = <4>; + }; + + mmci: mmc at 1C000000 { + compatible = "arm,pl180", "arm,primecell"; + reg = <0x1C000000 0x1000>; + interrupt-parent = <&pic>; + interrupts = <23 24>; + max-frequency = <515633>; + }; + + aaci: aaci at 1D000000 { + compatible = "arm,pl041", "arm,primecell"; + reg = <0x1D000000 0x1000>; + interrupt-parent = <&pic>; + interrupts = <25>; + }; + + clcd: clcd at c0000000 { + compatible = "arm,pl110", "arm,primecell"; + reg = <0xC0000000 0x1000>; + interrupt-parent = <&pic>; + interrupts = <22>; + }; + }; };arch/arm/mach-integrator/common.h +2
-0@@ -1,3 +1,5 @@ +#include <linux/amba/serial.h> +extern struct amba_pl010_data integrator_uart_data;void integrator_init_early (void );int integrator_init (bool is_cp);void integrator_reserve (void );arch/arm/mach-integrator/core.c +6
-2@@ -33,7 +33,9 @@#include <asm/mach/time.h> #include <asm/pgtable.h> -static struct amba_pl010_data integrator_uart_data; +#include "common.h" + +#ifndef CONFIG_OF #define INTEGRATOR_RTC_IRQ { IRQ_RTCINT }#define INTEGRATOR_UART0_IRQ { IRQ_UARTINT0 }@@ -86,6 +88,8 @@ int __init integrator_init(bool is_cp) return 0; } +#endif +/* * On the Integrator platform, the port RTS and DTR are provided by * bits in the following SC_CTRLS register bits: @@ -122,7 +126,7 @@ static void integrator_uart_set_mctrl(struct amba_device *dev, void __iomem *bas__raw_writel (ctrlc,SC_CTRLC ); } -static struct amba_pl010_data integrator_uart_data = { +struct amba_pl010_data integrator_uart_data = { .set_mctrl = integrator_uart_set_mctrl, };arch/arm/mach-integrator/integrator_ap.c +4
-30@@ -35,6 +35,7 @@#include <linux/clk.h> #include <linux/platform_data/clk-integrator.h> #include <linux/of_irq.h> +#include <linux/of_platform.h> #include <video/vga.h> #include <mach/hardware.h> @@ -270,36 +271,6 @@ static struct platform_device cfi_flash_device = { .resource = &cfi_flash_resource, }; -static void __init ap_init (void ) -{ -unsigned long sc_dec; -int i; - -platform_device_register (&cfi_flash_device); - - sc_dec =readl (VA_SC_BASE +INTEGRATOR_SC_DEC_OFFSET ); -for (i =0 ; i <4 ; i++) { -struct lm_device *lmdev; - -if ((sc_dec & (16 << i)) ==0 ) -continue ; - - lmdev =kzalloc (sizeof (struct lm_device ),GFP_KERNEL ); -if (!lmdev) -continue ; - - lmdev->resource.start =0xc0000000 +0x10000000 * i; - lmdev->resource.end = lmdev->resource.start +0x0fffffff ; - lmdev->resource.flags =IORESOURCE_MEM ; - lmdev->irq =IRQ_AP_EXPINT0 + i; - lmdev->id = i; - -lm_device_register (lmdev); - } - -integrator_init (false); -} -/* * Where is the timer (VA)? */ @@ -472,6 +443,52 @@ static void __init ap_init_irq_of(void)integrator_clk_init (false); } +/* For the Device Tree, add in the UART callbacks as AUXDATA */ +static struct of_dev_auxdata ap_auxdata_lookup[]__initdata = { + OF_DEV_AUXDATA("arm,primecell", INTEGRATOR_RTC_BASE,
arch/arm/mach-integrator/integrator_ap.c static void __init ap_init_irq_of(void) · line 458
Quoted 10 lines
arch/arm/mach-integrator/integrator_ap.c +10
-0+ "rtc", NULL), +OF_DEV_AUXDATA ("arm,primecell" ,INTEGRATOR_UART0_BASE , +"uart0" , &integrator_uart_data), +OF_DEV_AUXDATA ("arm,primecell" ,INTEGRATOR_UART1_BASE , +"uart1" , &integrator_uart_data), +OF_DEV_AUXDATA ("arm,primecell" ,KMI0_BASE , +"kmi0" ,NULL ), +OF_DEV_AUXDATA ("arm,primecell" ,KMI1_BASE , + "kmi1", NULL), + { /* sentinel */ },
why that?
Best Regards,
J.
PATCH 5/6 ARM: integrator: convert AMBA devices to device tree
Quoted 16 lines · Jean-Christophe PLAGNIOL-VILLARD
arch/arm/mach-integrator/integrator_ap.c static void __init ap_init_irq_of(void) · line 458
Quoted 13 lines · Linus Walleij
arch/arm/mach-integrator/integrator_ap.c +13
-0+/* For the Device Tree, add in the UART callbacks as AUXDATA */ +static struct of_dev_auxdata ap_auxdata_lookup[]__initdata = { +OF_DEV_AUXDATA ("arm,primecell" ,INTEGRATOR_RTC_BASE , +"rtc" ,NULL ), +OF_DEV_AUXDATA ("arm,primecell" ,INTEGRATOR_UART0_BASE , +"uart0" , &integrator_uart_data), +OF_DEV_AUXDATA ("arm,primecell" ,INTEGRATOR_UART1_BASE , +"uart1" , &integrator_uart_data), +OF_DEV_AUXDATA ("arm,primecell" ,KMI0_BASE , +"kmi0" ,NULL ), +OF_DEV_AUXDATA ("arm,primecell" ,KMI1_BASE , +"kmi1" ,NULL ), + {/* sentinel */ },why that?
Based on similar code by Grant in arch/arm/mach-versatile/core.c also ending with a {}. Also at other places ... I though this terminated the list iteration, is it not needed anymore?
Yours,
Linus Walleij
PATCH 5/6 ARM: integrator: convert AMBA devices to device tree
Quoted 19 lines · Linus Walleij
Quoted 16 lines · Jean-Christophe PLAGNIOL-VILLARD
arch/arm/mach-integrator/integrator_ap.c static void __init ap_init_irq_of(void) · line 458
Quoted 13 lines · Linus Walleij
arch/arm/mach-integrator/integrator_ap.c +13
-0+/* For the Device Tree, add in the UART callbacks as AUXDATA */ +static struct of_dev_auxdata ap_auxdata_lookup[]__initdata = { +OF_DEV_AUXDATA ("arm,primecell" ,INTEGRATOR_RTC_BASE , +"rtc" ,NULL ), +OF_DEV_AUXDATA ("arm,primecell" ,INTEGRATOR_UART0_BASE , +"uart0" , &integrator_uart_data), +OF_DEV_AUXDATA ("arm,primecell" ,INTEGRATOR_UART1_BASE , +"uart1" , &integrator_uart_data), +OF_DEV_AUXDATA ("arm,primecell" ,KMI0_BASE , +"kmi0" ,NULL ), +OF_DEV_AUXDATA ("arm,primecell" ,KMI1_BASE , +"kmi1" ,NULL ), + {/* sentinel */ },why that?
Quoted 3 lines
Based on similar code by Grant in
arch/arm/mach-versatile/core.calso ending with a {}. Also at other places ... I though this terminated the list iteration, is it not needed anymore?
no I mean why
Quoted 6 lines
Quoted 6 lines
arch/arm/mach-integrator/integrator_ap.c static void __init ap_init_irq_of(void) · line 457
Quoted 6 lines
arch/arm/mach-integrator/integrator_ap.c +6
-0+OF_DEV_AUXDATA ("arm,primecell" ,INTEGRATOR_RTC_BASE , +"rtc" ,NULL ), +OF_DEV_AUXDATA ("arm,primecell" ,KMI0_BASE , +"kmi0" ,NULL ), +OF_DEV_AUXDATA ("arm,primecell" ,KMI1_BASE , + "kmi1", NULL),
no platform data why do you use the AUXDATA?
as the OF_DEV_AUXDATA is deprecated now
Bset Regards,
J.
PATCH 5/6 ARM: integrator: convert AMBA devices to device tree
Quoted 10 lines · Jean-Christophe PLAGNIOL-VILLARD
On 00:42 Sun 19 Aug , Linus Walleij wrote:
no I mean why
Quoted 6 lines
Quoted 6 lines
arch/arm/mach-integrator/integrator_ap.c static void __init ap_init_irq_of(void) · line 457
Quoted 6 lines
arch/arm/mach-integrator/integrator_ap.c +6
-0+OF_DEV_AUXDATA ("arm,primecell" ,INTEGRATOR_RTC_BASE , +"rtc" ,NULL ), +OF_DEV_AUXDATA ("arm,primecell" ,KMI0_BASE , +"kmi0" ,NULL ), +OF_DEV_AUXDATA ("arm,primecell" ,KMI1_BASE , + "kmi1", NULL),
Quoted 3 lines
no platform data why do you use the AUXDATA?
as the
OF_DEV_AUXDATAis deprecated now
OK this is to get the right bus names of the devices.
As I support boot from both device tree and without device tree, I cannot change all the names that e.g. the clock framework is tied to.
Once we switch to pure device tree this can be changed at the user sites and all auxdata be removed.
Yours,
Linus Walleij
PATCH 5/6 ARM: integrator: convert AMBA devices to device tree
In reply to Linus WalleijQuoted 19 lines · Linus Walleij
arch/arm/boot/dts/integratorap.dts +19
-0+ fpga { + compatible = "arm,amba-bus", "simple-bus"; + #address-cells = <1>; + #size-cells = <1>; + ranges; + + rtc: rtc at 15000000 { + compatible = "arm,pl031", "arm,primecell"; + reg = <0x15000000 0x1000>; + interrupt-parent = <&pic>; + interrupts = <8>; + arm,primecell-periphid = <0x00041030>; + }; + + uart0: uart at 16000000 { + compatible = "arm,pl011", "arm,primecell"; + reg = <0x16000000 0x1000>; + interrupt-parent = <&pic>; + interrupts = <1>;
arch/arm/boot/dts/integratorap.dts line 55
Quoted 10 lines
arch/arm/boot/dts/integratorap.dts +10
-0+ arm,primecell-periphid = <0x00041010>; + }; + + uart1: uart at 17000000 { + compatible = "arm,pl011", "arm,primecell"; + reg = <0x17000000 0x1000>; + interrupt-parent = <&pic>; + interrupts = <2>; + arm,primecell-periphid = <0x00041010>; + };
When all devices set the same interrupt-parent, you can just as well move that property to the fpga node.
Arnd