diff options
31 files changed, 1102 insertions, 19 deletions
diff --git a/Documentation/devicetree/bindings/arm/arm-boards b/Documentation/devicetree/bindings/arm/arm-boards new file mode 100644 index 000000000000..91f26148af79 --- /dev/null +++ b/Documentation/devicetree/bindings/arm/arm-boards | |||
@@ -0,0 +1,20 @@ | |||
1 | ARM Versatile Application and Platform Baseboards | ||
2 | ------------------------------------------------- | ||
3 | ARM's development hardware platform with connectors for customizable | ||
4 | core tiles. The hardware configuration of the Versatile boards is | ||
5 | highly customizable. | ||
6 | |||
7 | Required properties (in root node): | ||
8 | compatible = "arm,versatile-ab"; /* Application baseboard */ | ||
9 | compatible = "arm,versatile-pb"; /* Platform baseboard */ | ||
10 | |||
11 | Interrupt controllers: | ||
12 | - VIC required properties: | ||
13 | compatible = "arm,versatile-vic"; | ||
14 | interrupt-controller; | ||
15 | #interrupt-cells = <1>; | ||
16 | |||
17 | - SIC required properties: | ||
18 | compatible = "arm,versatile-sic"; | ||
19 | interrupt-controller; | ||
20 | #interrupt-cells = <1>; | ||
diff --git a/Documentation/devicetree/bindings/i2c/arm-versatile.txt b/Documentation/devicetree/bindings/i2c/arm-versatile.txt new file mode 100644 index 000000000000..361d31c51b6f --- /dev/null +++ b/Documentation/devicetree/bindings/i2c/arm-versatile.txt | |||
@@ -0,0 +1,10 @@ | |||
1 | i2c Controller on ARM Versatile platform: | ||
2 | |||
3 | Required properties: | ||
4 | - compatible : Must be "arm,versatile-i2c"; | ||
5 | - reg | ||
6 | - #address-cells = <1>; | ||
7 | - #size-cells = <0>; | ||
8 | |||
9 | Optional properties: | ||
10 | - Child nodes conforming to i2c bus binding | ||
diff --git a/Documentation/devicetree/bindings/mtd/arm-versatile.txt b/Documentation/devicetree/bindings/mtd/arm-versatile.txt new file mode 100644 index 000000000000..476845db94d0 --- /dev/null +++ b/Documentation/devicetree/bindings/mtd/arm-versatile.txt | |||
@@ -0,0 +1,8 @@ | |||
1 | Flash device on ARM Versatile board | ||
2 | |||
3 | Required properties: | ||
4 | - compatible : must be "arm,versatile-flash"; | ||
5 | - bank-width : width in bytes of flash interface. | ||
6 | |||
7 | Optional properties: | ||
8 | - Subnode partition map from mtd flash binding | ||
diff --git a/Documentation/devicetree/bindings/net/smsc-lan91c111.txt b/Documentation/devicetree/bindings/net/smsc-lan91c111.txt new file mode 100644 index 000000000000..953049b4248a --- /dev/null +++ b/Documentation/devicetree/bindings/net/smsc-lan91c111.txt | |||
@@ -0,0 +1,10 @@ | |||
1 | SMSC LAN91c111 Ethernet mac | ||
2 | |||
3 | Required properties: | ||
4 | - compatible = "smsc,lan91c111"; | ||
5 | - reg : physical address and size of registers | ||
6 | - interrupts : interrupt connection | ||
7 | |||
8 | Optional properties: | ||
9 | - phy-device : phandle to Ethernet phy | ||
10 | - local-mac-address : Ethernet mac address to use | ||
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index 09ebf0ba64fa..2c71a8f3535a 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig | |||
@@ -1716,6 +1716,7 @@ config USE_OF | |||
1716 | bool "Flattened Device Tree support" | 1716 | bool "Flattened Device Tree support" |
1717 | select OF | 1717 | select OF |
1718 | select OF_EARLY_FLATTREE | 1718 | select OF_EARLY_FLATTREE |
1719 | select IRQ_DOMAIN | ||
1719 | help | 1720 | help |
1720 | Include support for flattened device tree machine descriptions. | 1721 | Include support for flattened device tree machine descriptions. |
1721 | 1722 | ||
diff --git a/arch/arm/Makefile b/arch/arm/Makefile index 3a4a04b33d0f..70c424eaf7b0 100644 --- a/arch/arm/Makefile +++ b/arch/arm/Makefile | |||
@@ -282,6 +282,12 @@ zImage Image xipImage bootpImage uImage: vmlinux | |||
282 | zinstall uinstall install: vmlinux | 282 | zinstall uinstall install: vmlinux |
283 | $(Q)$(MAKE) $(build)=$(boot) MACHINE=$(MACHINE) $@ | 283 | $(Q)$(MAKE) $(build)=$(boot) MACHINE=$(MACHINE) $@ |
284 | 284 | ||
285 | %.dtb: | ||
286 | $(Q)$(MAKE) $(build)=$(boot) MACHINE=$(MACHINE) $(boot)/$@ | ||
287 | |||
288 | dtbs: | ||
289 | $(Q)$(MAKE) $(build)=$(boot) MACHINE=$(MACHINE) $(boot)/$@ | ||
290 | |||
285 | # We use MRPROPER_FILES and CLEAN_FILES now | 291 | # We use MRPROPER_FILES and CLEAN_FILES now |
286 | archclean: | 292 | archclean: |
287 | $(Q)$(MAKE) $(clean)=$(boot) | 293 | $(Q)$(MAKE) $(clean)=$(boot) |
@@ -298,6 +304,7 @@ define archhelp | |||
298 | echo ' uImage - U-Boot wrapped zImage' | 304 | echo ' uImage - U-Boot wrapped zImage' |
299 | echo ' bootpImage - Combined zImage and initial RAM disk' | 305 | echo ' bootpImage - Combined zImage and initial RAM disk' |
300 | echo ' (supply initrd image via make variable INITRD=<path>)' | 306 | echo ' (supply initrd image via make variable INITRD=<path>)' |
307 | echo ' dtbs - Build device tree blobs for enabled boards' | ||
301 | echo ' install - Install uncompressed kernel' | 308 | echo ' install - Install uncompressed kernel' |
302 | echo ' zinstall - Install compressed kernel' | 309 | echo ' zinstall - Install compressed kernel' |
303 | echo ' uinstall - Install U-Boot wrapped compressed kernel' | 310 | echo ' uinstall - Install U-Boot wrapped compressed kernel' |
diff --git a/arch/arm/boot/Makefile b/arch/arm/boot/Makefile index 9128fddf1109..a1edfd5a129a 100644 --- a/arch/arm/boot/Makefile +++ b/arch/arm/boot/Makefile | |||
@@ -59,6 +59,12 @@ $(obj)/zImage: $(obj)/compressed/vmlinux FORCE | |||
59 | 59 | ||
60 | endif | 60 | endif |
61 | 61 | ||
62 | # Rule to build device tree blobs | ||
63 | $(obj)/%.dtb: $(src)/dts/%.dts | ||
64 | $(call cmd,dtc) | ||
65 | |||
66 | $(obj)/dtbs: $(addprefix $(obj)/, $(dtb-y)) | ||
67 | |||
62 | quiet_cmd_uimage = UIMAGE $@ | 68 | quiet_cmd_uimage = UIMAGE $@ |
63 | cmd_uimage = $(CONFIG_SHELL) $(MKIMAGE) -A arm -O linux -T kernel \ | 69 | cmd_uimage = $(CONFIG_SHELL) $(MKIMAGE) -A arm -O linux -T kernel \ |
64 | -C none -a $(LOADADDR) -e $(STARTADDR) \ | 70 | -C none -a $(LOADADDR) -e $(STARTADDR) \ |
diff --git a/arch/arm/boot/dts/skeleton.dtsi b/arch/arm/boot/dts/skeleton.dtsi new file mode 100644 index 000000000000..b41d241de2cd --- /dev/null +++ b/arch/arm/boot/dts/skeleton.dtsi | |||
@@ -0,0 +1,13 @@ | |||
1 | /* | ||
2 | * Skeleton device tree; the bare minimum needed to boot; just include and | ||
3 | * add a compatible value. The bootloader will typically populate the memory | ||
4 | * node. | ||
5 | */ | ||
6 | |||
7 | / { | ||
8 | #address-cells = <1>; | ||
9 | #size-cells = <1>; | ||
10 | chosen { }; | ||
11 | aliases { }; | ||
12 | memory { device_type = "memory"; reg = <0 0>; }; | ||
13 | }; | ||
diff --git a/arch/arm/boot/dts/tegra-harmony.dts b/arch/arm/boot/dts/tegra-harmony.dts new file mode 100644 index 000000000000..4c053340ce33 --- /dev/null +++ b/arch/arm/boot/dts/tegra-harmony.dts | |||
@@ -0,0 +1,70 @@ | |||
1 | /dts-v1/; | ||
2 | |||
3 | /memreserve/ 0x1c000000 0x04000000; | ||
4 | /include/ "tegra20.dtsi" | ||
5 | |||
6 | / { | ||
7 | model = "NVIDIA Tegra2 Harmony evaluation board"; | ||
8 | compatible = "nvidia,harmony", "nvidia,tegra20"; | ||
9 | |||
10 | chosen { | ||
11 | bootargs = "vmalloc=192M video=tegrafb console=ttyS0,115200n8 root=/dev/mmcblk0p2 rw rootwait"; | ||
12 | }; | ||
13 | |||
14 | memory@0 { | ||
15 | reg = < 0x00000000 0x40000000 >; | ||
16 | }; | ||
17 | |||
18 | i2c@7000c000 { | ||
19 | clock-frequency = <400000>; | ||
20 | |||
21 | codec: wm8903@1a { | ||
22 | compatible = "wlf,wm8903"; | ||
23 | reg = <0x1a>; | ||
24 | interrupts = < 347 >; | ||
25 | |||
26 | gpio-controller; | ||
27 | #gpio-cells = <2>; | ||
28 | |||
29 | /* 0x8000 = Not configured */ | ||
30 | gpio-cfg = < 0x8000 0x8000 0 0x8000 0x8000 >; | ||
31 | }; | ||
32 | }; | ||
33 | |||
34 | i2c@7000c400 { | ||
35 | clock-frequency = <400000>; | ||
36 | }; | ||
37 | |||
38 | i2c@7000c500 { | ||
39 | clock-frequency = <400000>; | ||
40 | }; | ||
41 | |||
42 | i2c@7000d000 { | ||
43 | clock-frequency = <400000>; | ||
44 | }; | ||
45 | |||
46 | sound { | ||
47 | compatible = "nvidia,harmony-sound", "nvidia,tegra-wm8903"; | ||
48 | |||
49 | spkr-en-gpios = <&codec 2 0>; | ||
50 | hp-det-gpios = <&gpio 178 0>; | ||
51 | int-mic-en-gpios = <&gpio 184 0>; | ||
52 | ext-mic-en-gpios = <&gpio 185 0>; | ||
53 | }; | ||
54 | |||
55 | serial@70006300 { | ||
56 | clock-frequency = < 216000000 >; | ||
57 | }; | ||
58 | |||
59 | sdhci@c8000200 { | ||
60 | gpios = <&gpio 69 0>, /* cd, gpio PI5 */ | ||
61 | <&gpio 57 0>, /* wp, gpio PH1 */ | ||
62 | <&gpio 155 0>; /* power, gpio PT3 */ | ||
63 | }; | ||
64 | |||
65 | sdhci@c8000600 { | ||
66 | gpios = <&gpio 58 0>, /* cd, gpio PH2 */ | ||
67 | <&gpio 59 0>, /* wp, gpio PH3 */ | ||
68 | <&gpio 70 0>; /* power, gpio PI6 */ | ||
69 | }; | ||
70 | }; | ||
diff --git a/arch/arm/boot/dts/tegra-seaboard.dts b/arch/arm/boot/dts/tegra-seaboard.dts new file mode 100644 index 000000000000..1940cae00748 --- /dev/null +++ b/arch/arm/boot/dts/tegra-seaboard.dts | |||
@@ -0,0 +1,28 @@ | |||
1 | /dts-v1/; | ||
2 | |||
3 | /memreserve/ 0x1c000000 0x04000000; | ||
4 | /include/ "tegra20.dtsi" | ||
5 | |||
6 | / { | ||
7 | model = "NVIDIA Seaboard"; | ||
8 | compatible = "nvidia,seaboard", "nvidia,tegra20"; | ||
9 | |||
10 | chosen { | ||
11 | bootargs = "vmalloc=192M video=tegrafb console=ttyS0,115200n8 root=/dev/mmcblk1p3 rw rootwait"; | ||
12 | }; | ||
13 | |||
14 | memory { | ||
15 | device_type = "memory"; | ||
16 | reg = < 0x00000000 0x40000000 >; | ||
17 | }; | ||
18 | |||
19 | serial@70006300 { | ||
20 | clock-frequency = < 216000000 >; | ||
21 | }; | ||
22 | |||
23 | sdhci@c8000400 { | ||
24 | gpios = <&gpio 69 0>, /* cd, gpio PI5 */ | ||
25 | <&gpio 57 0>, /* wp, gpio PH1 */ | ||
26 | <&gpio 70 0>; /* power, gpio PI6 */ | ||
27 | }; | ||
28 | }; | ||
diff --git a/arch/arm/boot/dts/tegra20.dtsi b/arch/arm/boot/dts/tegra20.dtsi new file mode 100644 index 000000000000..5727595cde61 --- /dev/null +++ b/arch/arm/boot/dts/tegra20.dtsi | |||
@@ -0,0 +1,139 @@ | |||
1 | /include/ "skeleton.dtsi" | ||
2 | |||
3 | / { | ||
4 | compatible = "nvidia,tegra20"; | ||
5 | interrupt-parent = <&intc>; | ||
6 | |||
7 | intc: interrupt-controller@50041000 { | ||
8 | compatible = "nvidia,tegra20-gic"; | ||
9 | interrupt-controller; | ||
10 | #interrupt-cells = <1>; | ||
11 | reg = < 0x50041000 0x1000 >, | ||
12 | < 0x50040100 0x0100 >; | ||
13 | }; | ||
14 | |||
15 | i2c@7000c000 { | ||
16 | #address-cells = <1>; | ||
17 | #size-cells = <0>; | ||
18 | compatible = "nvidia,tegra20-i2c"; | ||
19 | reg = <0x7000C000 0x100>; | ||
20 | interrupts = < 70 >; | ||
21 | }; | ||
22 | |||
23 | i2c@7000c400 { | ||
24 | #address-cells = <1>; | ||
25 | #size-cells = <0>; | ||
26 | compatible = "nvidia,tegra20-i2c"; | ||
27 | reg = <0x7000C400 0x100>; | ||
28 | interrupts = < 116 >; | ||
29 | }; | ||
30 | |||
31 | i2c@7000c500 { | ||
32 | #address-cells = <1>; | ||
33 | #size-cells = <0>; | ||
34 | compatible = "nvidia,tegra20-i2c"; | ||
35 | reg = <0x7000C500 0x100>; | ||
36 | interrupts = < 124 >; | ||
37 | }; | ||
38 | |||
39 | i2c@7000d000 { | ||
40 | #address-cells = <1>; | ||
41 | #size-cells = <0>; | ||
42 | compatible = "nvidia,tegra20-i2c"; | ||
43 | reg = <0x7000D000 0x200>; | ||
44 | interrupts = < 85 >; | ||
45 | }; | ||
46 | |||
47 | i2s@70002800 { | ||
48 | #address-cells = <1>; | ||
49 | #size-cells = <0>; | ||
50 | compatible = "nvidia,tegra20-i2s"; | ||
51 | reg = <0x70002800 0x200>; | ||
52 | interrupts = < 45 >; | ||
53 | dma-channel = < 2 >; | ||
54 | }; | ||
55 | |||
56 | i2s@70002a00 { | ||
57 | #address-cells = <1>; | ||
58 | #size-cells = <0>; | ||
59 | compatible = "nvidia,tegra20-i2s"; | ||
60 | reg = <0x70002a00 0x200>; | ||
61 | interrupts = < 35 >; | ||
62 | dma-channel = < 1 >; | ||
63 | }; | ||
64 | |||
65 | das@70000c00 { | ||
66 | #address-cells = <1>; | ||
67 | #size-cells = <0>; | ||
68 | compatible = "nvidia,tegra20-das"; | ||
69 | reg = <0x70000c00 0x80>; | ||
70 | }; | ||
71 | |||
72 | gpio: gpio@6000d000 { | ||
73 | compatible = "nvidia,tegra20-gpio"; | ||
74 | reg = < 0x6000d000 0x1000 >; | ||
75 | interrupts = < 64 65 66 67 87 119 121 >; | ||
76 | #gpio-cells = <2>; | ||
77 | gpio-controller; | ||
78 | }; | ||
79 | |||
80 | serial@70006000 { | ||
81 | compatible = "nvidia,tegra20-uart"; | ||
82 | reg = <0x70006000 0x40>; | ||
83 | reg-shift = <2>; | ||
84 | interrupts = < 68 >; | ||
85 | }; | ||
86 | |||
87 | serial@70006040 { | ||
88 | compatible = "nvidia,tegra20-uart"; | ||
89 | reg = <0x70006040 0x40>; | ||
90 | reg-shift = <2>; | ||
91 | interrupts = < 69 >; | ||
92 | }; | ||
93 | |||
94 | serial@70006200 { | ||
95 | compatible = "nvidia,tegra20-uart"; | ||
96 | reg = <0x70006200 0x100>; | ||
97 | reg-shift = <2>; | ||
98 | interrupts = < 78 >; | ||
99 | }; | ||
100 | |||
101 | serial@70006300 { | ||
102 | compatible = "nvidia,tegra20-uart"; | ||
103 | reg = <0x70006300 0x100>; | ||
104 | reg-shift = <2>; | ||
105 | interrupts = < 122 >; | ||
106 | }; | ||
107 | |||
108 | serial@70006400 { | ||
109 | compatible = "nvidia,tegra20-uart"; | ||
110 | reg = <0x70006400 0x100>; | ||
111 | reg-shift = <2>; | ||
112 | interrupts = < 123 >; | ||
113 | }; | ||
114 | |||
115 | sdhci@c8000000 { | ||
116 | compatible = "nvidia,tegra20-sdhci"; | ||
117 | reg = <0xc8000000 0x200>; | ||
118 | interrupts = < 46 >; | ||
119 | }; | ||
120 | |||
121 | sdhci@c8000200 { | ||
122 | compatible = "nvidia,tegra20-sdhci"; | ||
123 | reg = <0xc8000200 0x200>; | ||
124 | interrupts = < 47 >; | ||
125 | }; | ||
126 | |||
127 | sdhci@c8000400 { | ||
128 | compatible = "nvidia,tegra20-sdhci"; | ||
129 | reg = <0xc8000400 0x200>; | ||
130 | interrupts = < 51 >; | ||
131 | }; | ||
132 | |||
133 | sdhci@c8000600 { | ||
134 | compatible = "nvidia,tegra20-sdhci"; | ||
135 | reg = <0xc8000600 0x200>; | ||
136 | interrupts = < 63 >; | ||
137 | }; | ||
138 | }; | ||
139 | |||
diff --git a/arch/arm/boot/dts/versatile-ab.dts b/arch/arm/boot/dts/versatile-ab.dts new file mode 100644 index 000000000000..0b32925f2147 --- /dev/null +++ b/arch/arm/boot/dts/versatile-ab.dts | |||
@@ -0,0 +1,192 @@ | |||
1 | /dts-v1/; | ||
2 | /include/ "skeleton.dtsi" | ||
3 | |||
4 | / { | ||
5 | model = "ARM Versatile AB"; | ||
6 | compatible = "arm,versatile-ab"; | ||
7 | #address-cells = <1>; | ||
8 | #size-cells = <1>; | ||
9 | interrupt-parent = <&vic>; | ||
10 | |||
11 | aliases { | ||
12 | serial0 = &uart0; | ||
13 | serial1 = &uart1; | ||
14 | serial2 = &uart2; | ||
15 | i2c0 = &i2c0; | ||
16 | }; | ||
17 | |||
18 | memory { | ||
19 | reg = <0x0 0x08000000>; | ||
20 | }; | ||
21 | |||
22 | flash@34000000 { | ||
23 | compatible = "arm,versatile-flash"; | ||
24 | reg = <0x34000000 0x4000000>; | ||
25 | bank-width = <4>; | ||
26 | }; | ||
27 | |||
28 | i2c0: i2c@10002000 { | ||
29 | #address-cells = <1>; | ||
30 | #size-cells = <0>; | ||
31 | compatible = "arm,versatile-i2c"; | ||
32 | reg = <0x10002000 0x1000>; | ||
33 | |||
34 | rtc@68 { | ||
35 | compatible = "dallas,ds1338"; | ||
36 | reg = <0x68>; | ||
37 | }; | ||
38 | }; | ||
39 | |||
40 | net@10010000 { | ||
41 | compatible = "smsc,lan91c111"; | ||
42 | reg = <0x10010000 0x10000>; | ||
43 | interrupts = <25>; | ||
44 | }; | ||
45 | |||
46 | lcd@10008000 { | ||
47 | compatible = "arm,versatile-lcd"; | ||
48 | reg = <0x10008000 0x1000>; | ||
49 | }; | ||
50 | |||
51 | amba { | ||
52 | compatible = "arm,amba-bus"; | ||
53 | #address-cells = <1>; | ||
54 | #size-cells = <1>; | ||
55 | ranges; | ||
56 | |||
57 | vic: intc@10140000 { | ||
58 | compatible = "arm,versatile-vic"; | ||
59 | interrupt-controller; | ||
60 | #interrupt-cells = <1>; | ||
61 | reg = <0x10140000 0x1000>; | ||
62 | }; | ||
63 | |||
64 | sic: intc@10003000 { | ||
65 | compatible = "arm,versatile-sic"; | ||
66 | interrupt-controller; | ||
67 | #interrupt-cells = <1>; | ||
68 | reg = <0x10003000 0x1000>; | ||
69 | interrupt-parent = <&vic>; | ||
70 | interrupts = <31>; /* Cascaded to vic */ | ||
71 | }; | ||
72 | |||
73 | dma@10130000 { | ||
74 | compatible = "arm,pl081", "arm,primecell"; | ||
75 | reg = <0x10130000 0x1000>; | ||
76 | interrupts = <17>; | ||
77 | }; | ||
78 | |||
79 | uart0: uart@101f1000 { | ||
80 | compatible = "arm,pl011", "arm,primecell"; | ||
81 | reg = <0x101f1000 0x1000>; | ||
82 | interrupts = <12>; | ||
83 | }; | ||
84 | |||
85 | uart1: uart@101f2000 { | ||
86 | compatible = "arm,pl011", "arm,primecell"; | ||
87 | reg = <0x101f2000 0x1000>; | ||
88 | interrupts = <13>; | ||
89 | }; | ||
90 | |||
91 | uart2: uart@101f3000 { | ||
92 | compatible = "arm,pl011", "arm,primecell"; | ||
93 | reg = <0x101f3000 0x1000>; | ||
94 | interrupts = <14>; | ||
95 | }; | ||
96 | |||
97 | smc@10100000 { | ||
98 | compatible = "arm,primecell"; | ||
99 | reg = <0x10100000 0x1000>; | ||
100 | }; | ||
101 | |||
102 | mpmc@10110000 { | ||
103 | compatible = "arm,primecell"; | ||
104 | reg = <0x10110000 0x1000>; | ||
105 | }; | ||
106 | |||
107 | display@10120000 { | ||
108 | compatible = "arm,pl110", "arm,primecell"; | ||
109 | reg = <0x10120000 0x1000>; | ||
110 | interrupts = <16>; | ||
111 | }; | ||
112 | |||
113 | sctl@101e0000 { | ||
114 | compatible = "arm,primecell"; | ||
115 | reg = <0x101e0000 0x1000>; | ||
116 | }; | ||
117 | |||
118 | watchdog@101e1000 { | ||
119 | compatible = "arm,primecell"; | ||
120 | reg = <0x101e1000 0x1000>; | ||
121 | interrupts = <0>; | ||
122 | }; | ||
123 | |||
124 | gpio0: gpio@101e4000 { | ||
125 | compatible = "arm,pl061", "arm,primecell"; | ||
126 | reg = <0x101e4000 0x1000>; | ||
127 | gpio-controller; | ||
128 | interrupts = <6>; | ||
129 | #gpio-cells = <2>; | ||
130 | interrupt-controller; | ||
131 | #interrupt-cells = <2>; | ||
132 | }; | ||
133 | |||
134 | gpio1: gpio@101e5000 { | ||
135 | compatible = "arm,pl061", "arm,primecell"; | ||
136 | reg = <0x101e5000 0x1000>; | ||
137 | interrupts = <7>; | ||
138 | gpio-controller; | ||
139 | #gpio-cells = <2>; | ||
140 | interrupt-controller; | ||
141 | #interrupt-cells = <2>; | ||
142 | }; | ||
143 | |||
144 | rtc@101e8000 { | ||
145 | compatible = "arm,pl030", "arm,primecell"; | ||
146 | reg = <0x101e8000 0x1000>; | ||
147 | interrupts = <10>; | ||
148 | }; | ||
149 | |||
150 | sci@101f0000 { | ||
151 | compatible = "arm,primecell"; | ||
152 | reg = <0x101f0000 0x1000>; | ||
153 | interrupts = <15>; | ||
154 | }; | ||
155 | |||
156 | ssp@101f4000 { | ||
157 | compatible = "arm,pl022", "arm,primecell"; | ||
158 | reg = <0x101f4000 0x1000>; | ||
159 | interrupts = <11>; | ||
160 | }; | ||
161 | |||
162 | fpga { | ||
163 | compatible = "arm,versatile-fpga", "simple-bus"; | ||
164 | #address-cells = <1>; | ||
165 | #size-cells = <1>; | ||
166 | ranges = <0 0x10000000 0x10000>; | ||
167 | |||
168 | aaci@4000 { | ||
169 | compatible = "arm,primecell"; | ||
170 | reg = <0x4000 0x1000>; | ||
171 | interrupts = <24>; | ||
172 | }; | ||
173 | mmc@5000 { | ||
174 | compatible = "arm,primecell"; | ||
175 | reg = < 0x5000 0x1000>; | ||
176 | interrupts = <22>; | ||
177 | }; | ||
178 | kmi@6000 { | ||
179 | compatible = "arm,pl050", "arm,primecell"; | ||
180 | reg = <0x6000 0x1000>; | ||
181 | interrupt-parent = <&sic>; | ||
182 | interrupts = <3>; | ||
183 | }; | ||
184 | kmi@7000 { | ||
185 | compatible = "arm,pl050", "arm,primecell"; | ||
186 | reg = <0x7000 0x1000>; | ||
187 | interrupt-parent = <&sic>; | ||
188 | interrupts = <4>; | ||
189 | }; | ||
190 | }; | ||
191 | }; | ||
192 | }; | ||
diff --git a/arch/arm/boot/dts/versatile-pb.dts b/arch/arm/boot/dts/versatile-pb.dts new file mode 100644 index 000000000000..8a614e398004 --- /dev/null +++ b/arch/arm/boot/dts/versatile-pb.dts | |||
@@ -0,0 +1,48 @@ | |||
1 | /include/ "versatile-ab.dts" | ||
2 | |||
3 | / { | ||
4 | model = "ARM Versatile PB"; | ||
5 | compatible = "arm,versatile-pb"; | ||
6 | |||
7 | amba { | ||
8 | gpio2: gpio@101e6000 { | ||
9 | compatible = "arm,pl061", "arm,primecell"; | ||
10 | reg = <0x101e6000 0x1000>; | ||
11 | interrupts = <8>; | ||
12 | gpio-controller; | ||
13 | #gpio-cells = <2>; | ||
14 | interrupt-controller; | ||
15 | #interrupt-cells = <2>; | ||
16 | }; | ||
17 | |||
18 | gpio3: gpio@101e7000 { | ||
19 | compatible = "arm,pl061", "arm,primecell"; | ||
20 | reg = <0x101e7000 0x1000>; | ||
21 | interrupts = <9>; | ||
22 | gpio-controller; | ||
23 | #gpio-cells = <2>; | ||
24 | interrupt-controller; | ||
25 | #interrupt-cells = <2>; | ||
26 | }; | ||
27 | |||
28 | fpga { | ||
29 | uart@9000 { | ||
30 | compatible = "arm,pl011", "arm,primecell"; | ||
31 | reg = <0x9000 0x1000>; | ||
32 | interrupt-parent = <&sic>; | ||
33 | interrupts = <6>; | ||
34 | }; | ||
35 | sci@a000 { | ||
36 | compatible = "arm,primecell"; | ||
37 | reg = <0xa000 0x1000>; | ||
38 | interrupt-parent = <&sic>; | ||
39 | interrupts = <5>; | ||
40 | }; | ||
41 | mmc@b000 { | ||
42 | compatible = "arm,primecell"; | ||
43 | reg = <0xb000 0x1000>; | ||
44 | interrupts = <23>; | ||
45 | }; | ||
46 | }; | ||
47 | }; | ||
48 | }; | ||
diff --git a/arch/arm/include/asm/mach/arch.h b/arch/arm/include/asm/mach/arch.h index 3281fb4b12e3..217aa1911dd7 100644 --- a/arch/arm/include/asm/mach/arch.h +++ b/arch/arm/include/asm/mach/arch.h | |||
@@ -74,4 +74,11 @@ static const struct machine_desc __mach_desc_##_type \ | |||
74 | #define MACHINE_END \ | 74 | #define MACHINE_END \ |
75 | }; | 75 | }; |
76 | 76 | ||
77 | #define DT_MACHINE_START(_name, _namestr) \ | ||
78 | static const struct machine_desc __mach_desc_##_name \ | ||
79 | __used \ | ||
80 | __attribute__((__section__(".arch.info.init"))) = { \ | ||
81 | .nr = ~0, \ | ||
82 | .name = _namestr, | ||
83 | |||
77 | #endif | 84 | #endif |
diff --git a/arch/arm/include/asm/prom.h b/arch/arm/include/asm/prom.h index 11b8708fc4db..6f65ca86a5ec 100644 --- a/arch/arm/include/asm/prom.h +++ b/arch/arm/include/asm/prom.h | |||
@@ -16,11 +16,6 @@ | |||
16 | #include <asm/setup.h> | 16 | #include <asm/setup.h> |
17 | #include <asm/irq.h> | 17 | #include <asm/irq.h> |
18 | 18 | ||
19 | static inline void irq_dispose_mapping(unsigned int virq) | ||
20 | { | ||
21 | return; | ||
22 | } | ||
23 | |||
24 | extern struct machine_desc *setup_machine_fdt(unsigned int dt_phys); | 19 | extern struct machine_desc *setup_machine_fdt(unsigned int dt_phys); |
25 | extern void arm_dt_memblock_reserve(void); | 20 | extern void arm_dt_memblock_reserve(void); |
26 | 21 | ||
diff --git a/arch/arm/kernel/devtree.c b/arch/arm/kernel/devtree.c index 0cdd7b456cb2..1a33e9d6bb1f 100644 --- a/arch/arm/kernel/devtree.c +++ b/arch/arm/kernel/devtree.c | |||
@@ -132,17 +132,3 @@ struct machine_desc * __init setup_machine_fdt(unsigned int dt_phys) | |||
132 | 132 | ||
133 | return mdesc_best; | 133 | return mdesc_best; |
134 | } | 134 | } |
135 | |||
136 | /** | ||
137 | * irq_create_of_mapping - Hook to resolve OF irq specifier into a Linux irq# | ||
138 | * | ||
139 | * Currently the mapping mechanism is trivial; simple flat hwirq numbers are | ||
140 | * mapped 1:1 onto Linux irq numbers. Cascaded irq controllers are not | ||
141 | * supported. | ||
142 | */ | ||
143 | unsigned int irq_create_of_mapping(struct device_node *controller, | ||
144 | const u32 *intspec, unsigned int intsize) | ||
145 | { | ||
146 | return intspec[0]; | ||
147 | } | ||
148 | EXPORT_SYMBOL_GPL(irq_create_of_mapping); | ||
diff --git a/arch/arm/mach-tegra/Kconfig b/arch/arm/mach-tegra/Kconfig index 5ec1846aa1d0..4b8abf93bd95 100644 --- a/arch/arm/mach-tegra/Kconfig +++ b/arch/arm/mach-tegra/Kconfig | |||
@@ -51,6 +51,12 @@ config MACH_SEABOARD | |||
51 | also be included for some of the derivative boards that | 51 | also be included for some of the derivative boards that |
52 | have large similarities with the seaboard design. | 52 | have large similarities with the seaboard design. |
53 | 53 | ||
54 | config MACH_TEGRA_DT | ||
55 | bool "Generic Tegra board (FDT support)" | ||
56 | select USE_OF | ||
57 | help | ||
58 | Support for generic nVidia Tegra boards using Flattened Device Tree | ||
59 | |||
54 | config MACH_TRIMSLICE | 60 | config MACH_TRIMSLICE |
55 | bool "TrimSlice board" | 61 | bool "TrimSlice board" |
56 | select TEGRA_PCI | 62 | select TEGRA_PCI |
diff --git a/arch/arm/mach-tegra/Makefile b/arch/arm/mach-tegra/Makefile index ed58ef9019b5..f11b9100114a 100644 --- a/arch/arm/mach-tegra/Makefile +++ b/arch/arm/mach-tegra/Makefile | |||
@@ -29,5 +29,8 @@ obj-${CONFIG_MACH_PAZ00} += board-paz00-pinmux.o | |||
29 | obj-${CONFIG_MACH_SEABOARD} += board-seaboard.o | 29 | obj-${CONFIG_MACH_SEABOARD} += board-seaboard.o |
30 | obj-${CONFIG_MACH_SEABOARD} += board-seaboard-pinmux.o | 30 | obj-${CONFIG_MACH_SEABOARD} += board-seaboard-pinmux.o |
31 | 31 | ||
32 | obj-${CONFIG_MACH_TEGRA_DT} += board-dt.o | ||
33 | obj-${CONFIG_MACH_TEGRA_DT} += board-harmony-pinmux.o | ||
34 | |||
32 | obj-${CONFIG_MACH_TRIMSLICE} += board-trimslice.o | 35 | obj-${CONFIG_MACH_TRIMSLICE} += board-trimslice.o |
33 | obj-${CONFIG_MACH_TRIMSLICE} += board-trimslice-pinmux.o | 36 | obj-${CONFIG_MACH_TRIMSLICE} += board-trimslice-pinmux.o |
diff --git a/arch/arm/mach-tegra/Makefile.boot b/arch/arm/mach-tegra/Makefile.boot index db52d61a7386..428ad122be03 100644 --- a/arch/arm/mach-tegra/Makefile.boot +++ b/arch/arm/mach-tegra/Makefile.boot | |||
@@ -1,3 +1,6 @@ | |||
1 | zreladdr-$(CONFIG_ARCH_TEGRA_2x_SOC) := 0x00008000 | 1 | zreladdr-$(CONFIG_ARCH_TEGRA_2x_SOC) := 0x00008000 |
2 | params_phys-$(CONFIG_ARCH_TEGRA_2x_SOC) := 0x00000100 | 2 | params_phys-$(CONFIG_ARCH_TEGRA_2x_SOC) := 0x00000100 |
3 | initrd_phys-$(CONFIG_ARCH_TEGRA_2x_SOC) := 0x00800000 | 3 | initrd_phys-$(CONFIG_ARCH_TEGRA_2x_SOC) := 0x00800000 |
4 | |||
5 | dtb-$(CONFIG_MACH_HARMONY) += tegra-harmony.dtb | ||
6 | dtb-$(CONFIG_MACH_SEABOARD) += tegra-seaboard.dtb | ||
diff --git a/arch/arm/mach-tegra/board-dt.c b/arch/arm/mach-tegra/board-dt.c new file mode 100644 index 000000000000..9f47e04446f3 --- /dev/null +++ b/arch/arm/mach-tegra/board-dt.c | |||
@@ -0,0 +1,119 @@ | |||
1 | /* | ||
2 | * nVidia Tegra device tree board support | ||
3 | * | ||
4 | * Copyright (C) 2010 Secret Lab Technologies, Ltd. | ||
5 | * Copyright (C) 2010 Google, Inc. | ||
6 | * | ||
7 | * This software is licensed under the terms of the GNU General Public | ||
8 | * License version 2, as published by the Free Software Foundation, and | ||
9 | * may be copied, distributed, and modified under those terms. | ||
10 | * | ||
11 | * This program is distributed in the hope that it will be useful, | ||
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
14 | * GNU General Public License for more details. | ||
15 | * | ||
16 | */ | ||
17 | |||
18 | #include <linux/kernel.h> | ||
19 | #include <linux/init.h> | ||
20 | #include <linux/platform_device.h> | ||
21 | #include <linux/serial_8250.h> | ||
22 | #include <linux/clk.h> | ||
23 | #include <linux/dma-mapping.h> | ||
24 | #include <linux/irqdomain.h> | ||
25 | #include <linux/of.h> | ||
26 | #include <linux/of_address.h> | ||
27 | #include <linux/of_fdt.h> | ||
28 | #include <linux/of_irq.h> | ||
29 | #include <linux/of_platform.h> | ||
30 | #include <linux/pda_power.h> | ||
31 | #include <linux/io.h> | ||
32 | #include <linux/i2c.h> | ||
33 | #include <linux/i2c-tegra.h> | ||
34 | |||
35 | #include <asm/mach-types.h> | ||
36 | #include <asm/mach/arch.h> | ||
37 | #include <asm/mach/time.h> | ||
38 | #include <asm/setup.h> | ||
39 | |||
40 | #include <mach/iomap.h> | ||
41 | #include <mach/irqs.h> | ||
42 | |||
43 | #include "board.h" | ||
44 | #include "board-harmony.h" | ||
45 | #include "clock.h" | ||
46 | #include "devices.h" | ||
47 | |||
48 | void harmony_pinmux_init(void); | ||
49 | void seaboard_pinmux_init(void); | ||
50 | |||
51 | |||
52 | struct of_dev_auxdata tegra20_auxdata_lookup[] __initdata = { | ||
53 | OF_DEV_AUXDATA("nvidia,tegra20-sdhci", TEGRA_SDMMC1_BASE, "sdhci-tegra.0", NULL), | ||
54 | OF_DEV_AUXDATA("nvidia,tegra20-sdhci", TEGRA_SDMMC2_BASE, "sdhci-tegra.1", NULL), | ||
55 | OF_DEV_AUXDATA("nvidia,tegra20-sdhci", TEGRA_SDMMC3_BASE, "sdhci-tegra.2", NULL), | ||
56 | OF_DEV_AUXDATA("nvidia,tegra20-sdhci", TEGRA_SDMMC4_BASE, "sdhci-tegra.3", NULL), | ||
57 | OF_DEV_AUXDATA("nvidia,tegra20-i2c", TEGRA_I2C_BASE, "tegra-i2c.0", NULL), | ||
58 | OF_DEV_AUXDATA("nvidia,tegra20-i2c", TEGRA_I2C2_BASE, "tegra-i2c.1", NULL), | ||
59 | OF_DEV_AUXDATA("nvidia,tegra20-i2c", TEGRA_I2C3_BASE, "tegra-i2c.2", NULL), | ||
60 | OF_DEV_AUXDATA("nvidia,tegra20-i2c", TEGRA_DVC_BASE, "tegra-i2c.3", NULL), | ||
61 | OF_DEV_AUXDATA("nvidia,tegra20-i2s", TEGRA_I2S1_BASE, "tegra-i2s.0", NULL), | ||
62 | OF_DEV_AUXDATA("nvidia,tegra20-i2s", TEGRA_I2S1_BASE, "tegra-i2s.1", NULL), | ||
63 | OF_DEV_AUXDATA("nvidia,tegra20-das", TEGRA_APB_MISC_DAS_BASE, "tegra-das", NULL), | ||
64 | {} | ||
65 | }; | ||
66 | |||
67 | static __initdata struct tegra_clk_init_table tegra_dt_clk_init_table[] = { | ||
68 | /* name parent rate enabled */ | ||
69 | { "uartd", "pll_p", 216000000, true }, | ||
70 | { NULL, NULL, 0, 0}, | ||
71 | }; | ||
72 | |||
73 | static struct of_device_id tegra_dt_match_table[] __initdata = { | ||
74 | { .compatible = "simple-bus", }, | ||
75 | {} | ||
76 | }; | ||
77 | |||
78 | static struct of_device_id tegra_dt_gic_match[] __initdata = { | ||
79 | { .compatible = "nvidia,tegra20-gic", }, | ||
80 | {} | ||
81 | }; | ||
82 | |||
83 | static void __init tegra_dt_init(void) | ||
84 | { | ||
85 | struct device_node *node; | ||
86 | |||
87 | node = of_find_matching_node_by_address(NULL, tegra_dt_gic_match, | ||
88 | TEGRA_ARM_INT_DIST_BASE); | ||
89 | if (node) | ||
90 | irq_domain_add_simple(node, INT_GIC_BASE); | ||
91 | |||
92 | tegra_clk_init_from_table(tegra_dt_clk_init_table); | ||
93 | |||
94 | if (of_machine_is_compatible("nvidia,harmony")) | ||
95 | harmony_pinmux_init(); | ||
96 | else if (of_machine_is_compatible("nvidia,seaboard")) | ||
97 | seaboard_pinmux_init(); | ||
98 | |||
99 | /* | ||
100 | * Finished with the static registrations now; fill in the missing | ||
101 | * devices | ||
102 | */ | ||
103 | of_platform_populate(NULL, tegra_dt_match_table, tegra20_auxdata_lookup, NULL); | ||
104 | } | ||
105 | |||
106 | static const char * tegra_dt_board_compat[] = { | ||
107 | "nvidia,harmony", | ||
108 | "nvidia,seaboard", | ||
109 | NULL | ||
110 | }; | ||
111 | |||
112 | DT_MACHINE_START(TEGRA_DT, "nVidia Tegra (Flattened Device Tree)") | ||
113 | .map_io = tegra_map_common_io, | ||
114 | .init_early = tegra_init_early, | ||
115 | .init_irq = tegra_init_irq, | ||
116 | .timer = &tegra_timer, | ||
117 | .init_machine = tegra_dt_init, | ||
118 | .dt_compat = tegra_dt_board_compat, | ||
119 | MACHINE_END | ||
diff --git a/arch/arm/mach-versatile/Kconfig b/arch/arm/mach-versatile/Kconfig index 9cdec5aa04a0..c1f38f6625b2 100644 --- a/arch/arm/mach-versatile/Kconfig +++ b/arch/arm/mach-versatile/Kconfig | |||
@@ -17,4 +17,12 @@ config MACH_VERSATILE_AB | |||
17 | Include support for the ARM(R) Versatile Application Baseboard | 17 | Include support for the ARM(R) Versatile Application Baseboard |
18 | for the ARM926EJ-S. | 18 | for the ARM926EJ-S. |
19 | 19 | ||
20 | config MACH_VERSATILE_DT | ||
21 | bool "Support Versatile platform from device tree" | ||
22 | select USE_OF | ||
23 | select CPU_ARM926T | ||
24 | help | ||
25 | Include support for the ARM(R) Versatile/PB platform, | ||
26 | using the device tree for discovery | ||
27 | |||
20 | endmenu | 28 | endmenu |
diff --git a/arch/arm/mach-versatile/Makefile b/arch/arm/mach-versatile/Makefile index 97cf4d831b0c..81fa3fe25e1a 100644 --- a/arch/arm/mach-versatile/Makefile +++ b/arch/arm/mach-versatile/Makefile | |||
@@ -5,4 +5,5 @@ | |||
5 | obj-y := core.o | 5 | obj-y := core.o |
6 | obj-$(CONFIG_ARCH_VERSATILE_PB) += versatile_pb.o | 6 | obj-$(CONFIG_ARCH_VERSATILE_PB) += versatile_pb.o |
7 | obj-$(CONFIG_MACH_VERSATILE_AB) += versatile_ab.o | 7 | obj-$(CONFIG_MACH_VERSATILE_AB) += versatile_ab.o |
8 | obj-$(CONFIG_MACH_VERSATILE_DT) += versatile_dt.o | ||
8 | obj-$(CONFIG_PCI) += pci.o | 9 | obj-$(CONFIG_PCI) += pci.o |
diff --git a/arch/arm/mach-versatile/core.c b/arch/arm/mach-versatile/core.c index 0c99cf076c63..e340a54251df 100644 --- a/arch/arm/mach-versatile/core.c +++ b/arch/arm/mach-versatile/core.c | |||
@@ -24,6 +24,9 @@ | |||
24 | #include <linux/platform_device.h> | 24 | #include <linux/platform_device.h> |
25 | #include <linux/sysdev.h> | 25 | #include <linux/sysdev.h> |
26 | #include <linux/interrupt.h> | 26 | #include <linux/interrupt.h> |
27 | #include <linux/irqdomain.h> | ||
28 | #include <linux/of_address.h> | ||
29 | #include <linux/of_platform.h> | ||
27 | #include <linux/amba/bus.h> | 30 | #include <linux/amba/bus.h> |
28 | #include <linux/amba/clcd.h> | 31 | #include <linux/amba/clcd.h> |
29 | #include <linux/amba/pl061.h> | 32 | #include <linux/amba/pl061.h> |
@@ -83,13 +86,26 @@ static struct fpga_irq_data sic_irq = { | |||
83 | #define PIC_MASK 0 | 86 | #define PIC_MASK 0 |
84 | #endif | 87 | #endif |
85 | 88 | ||
89 | /* Lookup table for finding a DT node that represents the vic instance */ | ||
90 | static const struct of_device_id vic_of_match[] __initconst = { | ||
91 | { .compatible = "arm,versatile-vic", }, | ||
92 | {} | ||
93 | }; | ||
94 | |||
95 | static const struct of_device_id sic_of_match[] __initconst = { | ||
96 | { .compatible = "arm,versatile-sic", }, | ||
97 | {} | ||
98 | }; | ||
99 | |||
86 | void __init versatile_init_irq(void) | 100 | void __init versatile_init_irq(void) |
87 | { | 101 | { |
88 | vic_init(VA_VIC_BASE, IRQ_VIC_START, ~0, 0); | 102 | vic_init(VA_VIC_BASE, IRQ_VIC_START, ~0, 0); |
103 | irq_domain_generate_simple(vic_of_match, VERSATILE_VIC_BASE, IRQ_VIC_START); | ||
89 | 104 | ||
90 | writel(~0, VA_SIC_BASE + SIC_IRQ_ENABLE_CLEAR); | 105 | writel(~0, VA_SIC_BASE + SIC_IRQ_ENABLE_CLEAR); |
91 | 106 | ||
92 | fpga_irq_init(IRQ_VICSOURCE31, ~PIC_MASK, &sic_irq); | 107 | fpga_irq_init(IRQ_VICSOURCE31, ~PIC_MASK, &sic_irq); |
108 | irq_domain_generate_simple(sic_of_match, VERSATILE_SIC_BASE, IRQ_SIC_START); | ||
93 | 109 | ||
94 | /* | 110 | /* |
95 | * Interrupts on secondary controller from 0 to 8 are routed to | 111 | * Interrupts on secondary controller from 0 to 8 are routed to |
@@ -646,6 +662,52 @@ static struct amba_device *amba_devs[] __initdata = { | |||
646 | &kmi1_device, | 662 | &kmi1_device, |
647 | }; | 663 | }; |
648 | 664 | ||
665 | #ifdef CONFIG_OF | ||
666 | /* | ||
667 | * Lookup table for attaching a specific name and platform_data pointer to | ||
668 | * devices as they get created by of_platform_populate(). Ideally this table | ||
669 | * would not exist, but the current clock implementation depends on some devices | ||
670 | * having a specific name. | ||
671 | */ | ||
672 | struct of_dev_auxdata versatile_auxdata_lookup[] __initdata = { | ||
673 | OF_DEV_AUXDATA("arm,primecell", VERSATILE_MMCI0_BASE, "fpga:05", NULL), | ||
674 | OF_DEV_AUXDATA("arm,primecell", VERSATILE_KMI0_BASE, "fpga:06", NULL), | ||
675 | OF_DEV_AUXDATA("arm,primecell", VERSATILE_KMI1_BASE, "fpga:07", NULL), | ||
676 | OF_DEV_AUXDATA("arm,primecell", VERSATILE_UART3_BASE, "fpga:09", NULL), | ||
677 | OF_DEV_AUXDATA("arm,primecell", VERSATILE_MMCI1_BASE, "fpga:0b", NULL), | ||
678 | |||
679 | OF_DEV_AUXDATA("arm,primecell", VERSATILE_CLCD_BASE, "dev:20", &clcd_plat_data), | ||
680 | OF_DEV_AUXDATA("arm,primecell", VERSATILE_UART0_BASE, "dev:f1", NULL), | ||
681 | OF_DEV_AUXDATA("arm,primecell", VERSATILE_UART1_BASE, "dev:f2", NULL), | ||
682 | OF_DEV_AUXDATA("arm,primecell", VERSATILE_UART2_BASE, "dev:f3", NULL), | ||
683 | OF_DEV_AUXDATA("arm,primecell", VERSATILE_SSP_BASE, "dev:f4", NULL), | ||
684 | |||
685 | #if 0 | ||
686 | /* | ||
687 | * These entries are unnecessary because no clocks referencing | ||
688 | * them. I've left them in for now as place holders in case | ||
689 | * any of them need to be added back, but they should be | ||
690 | * removed before actually committing this patch. --gcl | ||
691 | */ | ||
692 | OF_DEV_AUXDATA("arm,primecell", VERSATILE_AACI_BASE, "fpga:04", NULL), | ||
693 | OF_DEV_AUXDATA("arm,primecell", VERSATILE_SCI1_BASE, "fpga:0a", NULL), | ||
694 | OF_DEV_AUXDATA("arm,primecell", VERSATILE_SMC_BASE, "dev:00", NULL), | ||
695 | OF_DEV_AUXDATA("arm,primecell", VERSATILE_MPMC_BASE, "dev:10", NULL), | ||
696 | OF_DEV_AUXDATA("arm,primecell", VERSATILE_DMAC_BASE, "dev:30", NULL), | ||
697 | |||
698 | OF_DEV_AUXDATA("arm,primecell", VERSATILE_SCTL_BASE, "dev:e0", NULL), | ||
699 | OF_DEV_AUXDATA("arm,primecell", VERSATILE_WATCHDOG_BASE, "dev:e1", NULL), | ||
700 | OF_DEV_AUXDATA("arm,primecell", VERSATILE_GPIO0_BASE, "dev:e4", NULL), | ||
701 | OF_DEV_AUXDATA("arm,primecell", VERSATILE_GPIO1_BASE, "dev:e5", NULL), | ||
702 | OF_DEV_AUXDATA("arm,primecell", VERSATILE_GPIO2_BASE, "dev:e6", NULL), | ||
703 | OF_DEV_AUXDATA("arm,primecell", VERSATILE_GPIO3_BASE, "dev:e7", NULL), | ||
704 | OF_DEV_AUXDATA("arm,primecell", VERSATILE_RTC_BASE, "dev:e8", NULL), | ||
705 | OF_DEV_AUXDATA("arm,primecell", VERSATILE_SCI_BASE, "dev:f0", NULL), | ||
706 | #endif | ||
707 | {} | ||
708 | }; | ||
709 | #endif | ||
710 | |||
649 | #ifdef CONFIG_LEDS | 711 | #ifdef CONFIG_LEDS |
650 | #define VA_LEDS_BASE (__io_address(VERSATILE_SYS_BASE) + VERSATILE_SYS_LED_OFFSET) | 712 | #define VA_LEDS_BASE (__io_address(VERSATILE_SYS_BASE) + VERSATILE_SYS_LED_OFFSET) |
651 | 713 | ||
diff --git a/arch/arm/mach-versatile/core.h b/arch/arm/mach-versatile/core.h index fd6404e5d788..e01422700ebb 100644 --- a/arch/arm/mach-versatile/core.h +++ b/arch/arm/mach-versatile/core.h | |||
@@ -23,6 +23,7 @@ | |||
23 | #define __ASM_ARCH_VERSATILE_H | 23 | #define __ASM_ARCH_VERSATILE_H |
24 | 24 | ||
25 | #include <linux/amba/bus.h> | 25 | #include <linux/amba/bus.h> |
26 | #include <linux/of_platform.h> | ||
26 | 27 | ||
27 | extern void __init versatile_init(void); | 28 | extern void __init versatile_init(void); |
28 | extern void __init versatile_init_early(void); | 29 | extern void __init versatile_init_early(void); |
@@ -30,6 +31,9 @@ extern void __init versatile_init_irq(void); | |||
30 | extern void __init versatile_map_io(void); | 31 | extern void __init versatile_map_io(void); |
31 | extern struct sys_timer versatile_timer; | 32 | extern struct sys_timer versatile_timer; |
32 | extern unsigned int mmc_status(struct device *dev); | 33 | extern unsigned int mmc_status(struct device *dev); |
34 | #ifdef CONFIG_OF | ||
35 | extern struct of_dev_auxdata versatile_auxdata_lookup[]; | ||
36 | #endif | ||
33 | 37 | ||
34 | #define AMBA_DEVICE(name,busid,base,plat) \ | 38 | #define AMBA_DEVICE(name,busid,base,plat) \ |
35 | static struct amba_device name##_device = { \ | 39 | static struct amba_device name##_device = { \ |
diff --git a/arch/arm/mach-versatile/versatile_dt.c b/arch/arm/mach-versatile/versatile_dt.c new file mode 100644 index 000000000000..54e037c090f5 --- /dev/null +++ b/arch/arm/mach-versatile/versatile_dt.c | |||
@@ -0,0 +1,51 @@ | |||
1 | /* | ||
2 | * Versatile board support using the device tree | ||
3 | * | ||
4 | * Copyright (C) 2010 Secret Lab Technologies Ltd. | ||
5 | * Copyright (C) 2009 Jeremy Kerr <jeremy.kerr@canonical.com> | ||
6 | * Copyright (C) 2004 ARM Limited | ||
7 | * Copyright (C) 2000 Deep Blue Solutions Ltd | ||
8 | * | ||
9 | * This program is free software; you can redistribute it and/or modify | ||
10 | * it under the terms of the GNU General Public License as published by | ||
11 | * the Free Software Foundation; either version 2 of the License, or | ||
12 | * (at your option) any later version. | ||
13 | * | ||
14 | * This program is distributed in the hope that it will be useful, | ||
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
17 | * GNU General Public License for more details. | ||
18 | * | ||
19 | * You should have received a copy of the GNU General Public License | ||
20 | * along with this program; if not, write to the Free Software | ||
21 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
22 | */ | ||
23 | |||
24 | #include <linux/init.h> | ||
25 | #include <linux/of_irq.h> | ||
26 | #include <linux/of_platform.h> | ||
27 | #include <asm/mach-types.h> | ||
28 | #include <asm/mach/arch.h> | ||
29 | |||
30 | #include "core.h" | ||
31 | |||
32 | static void __init versatile_dt_init(void) | ||
33 | { | ||
34 | of_platform_populate(NULL, of_default_bus_match_table, | ||
35 | versatile_auxdata_lookup, NULL); | ||
36 | } | ||
37 | |||
38 | static const char *versatile_dt_match[] __initconst = { | ||
39 | "arm,versatile-ab", | ||
40 | "arm,versatile-pb", | ||
41 | NULL, | ||
42 | }; | ||
43 | |||
44 | DT_MACHINE_START(VERSATILE_PB, "ARM-Versatile (Device Tree Support)") | ||
45 | .map_io = versatile_map_io, | ||
46 | .init_early = versatile_init_early, | ||
47 | .init_irq = versatile_init_irq, | ||
48 | .timer = &versatile_timer, | ||
49 | .init_machine = versatile_dt_init, | ||
50 | .dt_compat = versatile_dt_match, | ||
51 | MACHINE_END | ||
diff --git a/include/linux/irq.h b/include/linux/irq.h index 5f695041090c..87a06f345bd2 100644 --- a/include/linux/irq.h +++ b/include/linux/irq.h | |||
@@ -108,14 +108,18 @@ enum { | |||
108 | }; | 108 | }; |
109 | 109 | ||
110 | struct msi_desc; | 110 | struct msi_desc; |
111 | struct irq_domain; | ||
111 | 112 | ||
112 | /** | 113 | /** |
113 | * struct irq_data - per irq and irq chip data passed down to chip functions | 114 | * struct irq_data - per irq and irq chip data passed down to chip functions |
114 | * @irq: interrupt number | 115 | * @irq: interrupt number |
116 | * @hwirq: hardware interrupt number, local to the interrupt domain | ||
115 | * @node: node index useful for balancing | 117 | * @node: node index useful for balancing |
116 | * @state_use_accessors: status information for irq chip functions. | 118 | * @state_use_accessors: status information for irq chip functions. |
117 | * Use accessor functions to deal with it | 119 | * Use accessor functions to deal with it |
118 | * @chip: low level interrupt hardware access | 120 | * @chip: low level interrupt hardware access |
121 | * @domain: Interrupt translation domain; responsible for mapping | ||
122 | * between hwirq number and linux irq number. | ||
119 | * @handler_data: per-IRQ data for the irq_chip methods | 123 | * @handler_data: per-IRQ data for the irq_chip methods |
120 | * @chip_data: platform-specific per-chip private data for the chip | 124 | * @chip_data: platform-specific per-chip private data for the chip |
121 | * methods, to allow shared chip implementations | 125 | * methods, to allow shared chip implementations |
@@ -128,9 +132,11 @@ struct msi_desc; | |||
128 | */ | 132 | */ |
129 | struct irq_data { | 133 | struct irq_data { |
130 | unsigned int irq; | 134 | unsigned int irq; |
135 | unsigned long hwirq; | ||
131 | unsigned int node; | 136 | unsigned int node; |
132 | unsigned int state_use_accessors; | 137 | unsigned int state_use_accessors; |
133 | struct irq_chip *chip; | 138 | struct irq_chip *chip; |
139 | struct irq_domain *domain; | ||
134 | void *handler_data; | 140 | void *handler_data; |
135 | void *chip_data; | 141 | void *chip_data; |
136 | struct msi_desc *msi_desc; | 142 | struct msi_desc *msi_desc; |
diff --git a/include/linux/irqdomain.h b/include/linux/irqdomain.h new file mode 100644 index 000000000000..e807ad687a07 --- /dev/null +++ b/include/linux/irqdomain.h | |||
@@ -0,0 +1,91 @@ | |||
1 | /* | ||
2 | * irq_domain - IRQ translation domains | ||
3 | * | ||
4 | * Translation infrastructure between hw and linux irq numbers. This is | ||
5 | * helpful for interrupt controllers to implement mapping between hardware | ||
6 | * irq numbers and the Linux irq number space. | ||
7 | * | ||
8 | * irq_domains also have a hook for translating device tree interrupt | ||
9 | * representation into a hardware irq number that can be mapped back to a | ||
10 | * Linux irq number without any extra platform support code. | ||
11 | * | ||
12 | * irq_domain is expected to be embedded in an interrupt controller's private | ||
13 | * data structure. | ||
14 | */ | ||
15 | #ifndef _LINUX_IRQDOMAIN_H | ||
16 | #define _LINUX_IRQDOMAIN_H | ||
17 | |||
18 | #include <linux/irq.h> | ||
19 | #include <linux/mod_devicetable.h> | ||
20 | |||
21 | #ifdef CONFIG_IRQ_DOMAIN | ||
22 | struct device_node; | ||
23 | struct irq_domain; | ||
24 | |||
25 | /** | ||
26 | * struct irq_domain_ops - Methods for irq_domain objects | ||
27 | * @to_irq: (optional) given a local hardware irq number, return the linux | ||
28 | * irq number. If to_irq is not implemented, then the irq_domain | ||
29 | * will use this translation: irq = (domain->irq_base + hwirq) | ||
30 | * @dt_translate: Given a device tree node and interrupt specifier, decode | ||
31 | * the hardware irq number and linux irq type value. | ||
32 | */ | ||
33 | struct irq_domain_ops { | ||
34 | unsigned int (*to_irq)(struct irq_domain *d, unsigned long hwirq); | ||
35 | |||
36 | #ifdef CONFIG_OF | ||
37 | int (*dt_translate)(struct irq_domain *d, struct device_node *node, | ||
38 | const u32 *intspec, unsigned int intsize, | ||
39 | unsigned long *out_hwirq, unsigned int *out_type); | ||
40 | #endif /* CONFIG_OF */ | ||
41 | }; | ||
42 | |||
43 | /** | ||
44 | * struct irq_domain - Hardware interrupt number translation object | ||
45 | * @list: Element in global irq_domain list. | ||
46 | * @irq_base: Start of irq_desc range assigned to the irq_domain. The creator | ||
47 | * of the irq_domain is responsible for allocating the array of | ||
48 | * irq_desc structures. | ||
49 | * @nr_irq: Number of irqs managed by the irq domain | ||
50 | * @ops: pointer to irq_domain methods | ||
51 | * @priv: private data pointer for use by owner. Not touched by irq_domain | ||
52 | * core code. | ||
53 | * @of_node: (optional) Pointer to device tree nodes associated with the | ||
54 | * irq_domain. Used when decoding device tree interrupt specifiers. | ||
55 | */ | ||
56 | struct irq_domain { | ||
57 | struct list_head list; | ||
58 | unsigned int irq_base; | ||
59 | unsigned int nr_irq; | ||
60 | const struct irq_domain_ops *ops; | ||
61 | void *priv; | ||
62 | struct device_node *of_node; | ||
63 | }; | ||
64 | |||
65 | /** | ||
66 | * irq_domain_to_irq() - Translate from a hardware irq to a linux irq number | ||
67 | * | ||
68 | * Returns the linux irq number associated with a hardware irq. By default, | ||
69 | * the mapping is irq == domain->irq_base + hwirq, but this mapping can | ||
70 | * be overridden if the irq_domain implements a .to_irq() hook. | ||
71 | */ | ||
72 | static inline unsigned int irq_domain_to_irq(struct irq_domain *d, | ||
73 | unsigned long hwirq) | ||
74 | { | ||
75 | return d->ops->to_irq ? d->ops->to_irq(d, hwirq) : d->irq_base + hwirq; | ||
76 | } | ||
77 | |||
78 | extern void irq_domain_add(struct irq_domain *domain); | ||
79 | extern void irq_domain_del(struct irq_domain *domain); | ||
80 | #endif /* CONFIG_IRQ_DOMAIN */ | ||
81 | |||
82 | #if defined(CONFIG_IRQ_DOMAIN) && defined(CONFIG_OF_IRQ) | ||
83 | extern void irq_domain_add_simple(struct device_node *controller, int irq_base); | ||
84 | extern void irq_domain_generate_simple(const struct of_device_id *match, | ||
85 | u64 phys_base, unsigned int irq_start); | ||
86 | #else /* CONFIG_IRQ_DOMAIN && CONFIG_OF_IRQ */ | ||
87 | static inline void irq_domain_generate_simple(const struct of_device_id *match, | ||
88 | u64 phys_base, unsigned int irq_start) { } | ||
89 | #endif /* CONFIG_IRQ_DOMAIN && CONFIG_OF_IRQ */ | ||
90 | |||
91 | #endif /* _LINUX_IRQDOMAIN_H */ | ||
diff --git a/include/linux/of_irq.h b/include/linux/of_irq.h index e6955f5d1f08..cd2e61ce4e83 100644 --- a/include/linux/of_irq.h +++ b/include/linux/of_irq.h | |||
@@ -63,6 +63,9 @@ extern int of_irq_map_one(struct device_node *device, int index, | |||
63 | extern unsigned int irq_create_of_mapping(struct device_node *controller, | 63 | extern unsigned int irq_create_of_mapping(struct device_node *controller, |
64 | const u32 *intspec, | 64 | const u32 *intspec, |
65 | unsigned int intsize); | 65 | unsigned int intsize); |
66 | #ifdef CONFIG_IRQ_DOMAIN | ||
67 | extern void irq_dispose_mapping(unsigned int irq); | ||
68 | #endif | ||
66 | extern int of_irq_to_resource(struct device_node *dev, int index, | 69 | extern int of_irq_to_resource(struct device_node *dev, int index, |
67 | struct resource *r); | 70 | struct resource *r); |
68 | extern int of_irq_count(struct device_node *dev); | 71 | extern int of_irq_count(struct device_node *dev); |
@@ -70,6 +73,7 @@ extern int of_irq_to_resource_table(struct device_node *dev, | |||
70 | struct resource *res, int nr_irqs); | 73 | struct resource *res, int nr_irqs); |
71 | extern struct device_node *of_irq_find_parent(struct device_node *child); | 74 | extern struct device_node *of_irq_find_parent(struct device_node *child); |
72 | 75 | ||
76 | |||
73 | #endif /* CONFIG_OF_IRQ */ | 77 | #endif /* CONFIG_OF_IRQ */ |
74 | #endif /* CONFIG_OF */ | 78 | #endif /* CONFIG_OF */ |
75 | #endif /* __OF_IRQ_H */ | 79 | #endif /* __OF_IRQ_H */ |
diff --git a/kernel/irq/Kconfig b/kernel/irq/Kconfig index d1d051b38e0b..5a38bf4de641 100644 --- a/kernel/irq/Kconfig +++ b/kernel/irq/Kconfig | |||
@@ -52,6 +52,10 @@ config IRQ_EDGE_EOI_HANDLER | |||
52 | config GENERIC_IRQ_CHIP | 52 | config GENERIC_IRQ_CHIP |
53 | bool | 53 | bool |
54 | 54 | ||
55 | # Generic irq_domain hw <--> linux irq number translation | ||
56 | config IRQ_DOMAIN | ||
57 | bool | ||
58 | |||
55 | # Support forced irq threading | 59 | # Support forced irq threading |
56 | config IRQ_FORCED_THREADING | 60 | config IRQ_FORCED_THREADING |
57 | bool | 61 | bool |
diff --git a/kernel/irq/Makefile b/kernel/irq/Makefile index 73290056cfb6..fff17381f0af 100644 --- a/kernel/irq/Makefile +++ b/kernel/irq/Makefile | |||
@@ -2,6 +2,7 @@ | |||
2 | obj-y := irqdesc.o handle.o manage.o spurious.o resend.o chip.o dummychip.o devres.o | 2 | obj-y := irqdesc.o handle.o manage.o spurious.o resend.o chip.o dummychip.o devres.o |
3 | obj-$(CONFIG_GENERIC_IRQ_CHIP) += generic-chip.o | 3 | obj-$(CONFIG_GENERIC_IRQ_CHIP) += generic-chip.o |
4 | obj-$(CONFIG_GENERIC_IRQ_PROBE) += autoprobe.o | 4 | obj-$(CONFIG_GENERIC_IRQ_PROBE) += autoprobe.o |
5 | obj-$(CONFIG_IRQ_DOMAIN) += irqdomain.o | ||
5 | obj-$(CONFIG_PROC_FS) += proc.o | 6 | obj-$(CONFIG_PROC_FS) += proc.o |
6 | obj-$(CONFIG_GENERIC_PENDING_IRQ) += migration.o | 7 | obj-$(CONFIG_GENERIC_PENDING_IRQ) += migration.o |
7 | obj-$(CONFIG_PM_SLEEP) += pm.o | 8 | obj-$(CONFIG_PM_SLEEP) += pm.o |
diff --git a/kernel/irq/irqdomain.c b/kernel/irq/irqdomain.c new file mode 100644 index 000000000000..d5828da3fd38 --- /dev/null +++ b/kernel/irq/irqdomain.c | |||
@@ -0,0 +1,180 @@ | |||
1 | #include <linux/irq.h> | ||
2 | #include <linux/irqdomain.h> | ||
3 | #include <linux/module.h> | ||
4 | #include <linux/mutex.h> | ||
5 | #include <linux/of.h> | ||
6 | #include <linux/of_address.h> | ||
7 | #include <linux/slab.h> | ||
8 | |||
9 | static LIST_HEAD(irq_domain_list); | ||
10 | static DEFINE_MUTEX(irq_domain_mutex); | ||
11 | |||
12 | /** | ||
13 | * irq_domain_add() - Register an irq_domain | ||
14 | * @domain: ptr to initialized irq_domain structure | ||
15 | * | ||
16 | * Registers an irq_domain structure. The irq_domain must at a minimum be | ||
17 | * initialized with an ops structure pointer, and either a ->to_irq hook or | ||
18 | * a valid irq_base value. Everything else is optional. | ||
19 | */ | ||
20 | void irq_domain_add(struct irq_domain *domain) | ||
21 | { | ||
22 | struct irq_data *d; | ||
23 | int hwirq; | ||
24 | |||
25 | /* | ||
26 | * This assumes that the irq_domain owner has already allocated | ||
27 | * the irq_descs. This block will be removed when support for dynamic | ||
28 | * allocation of irq_descs is added to irq_domain. | ||
29 | */ | ||
30 | for (hwirq = 0; hwirq < domain->nr_irq; hwirq++) { | ||
31 | d = irq_get_irq_data(irq_domain_to_irq(domain, hwirq)); | ||
32 | if (d || d->domain) { | ||
33 | /* things are broken; just report, don't clean up */ | ||
34 | WARN(1, "error: irq_desc already assigned to a domain"); | ||
35 | return; | ||
36 | } | ||
37 | d->domain = domain; | ||
38 | d->hwirq = hwirq; | ||
39 | } | ||
40 | |||
41 | mutex_lock(&irq_domain_mutex); | ||
42 | list_add(&domain->list, &irq_domain_list); | ||
43 | mutex_unlock(&irq_domain_mutex); | ||
44 | } | ||
45 | |||
46 | /** | ||
47 | * irq_domain_del() - Unregister an irq_domain | ||
48 | * @domain: ptr to registered irq_domain. | ||
49 | */ | ||
50 | void irq_domain_del(struct irq_domain *domain) | ||
51 | { | ||
52 | struct irq_data *d; | ||
53 | int hwirq; | ||
54 | |||
55 | mutex_lock(&irq_domain_mutex); | ||
56 | list_del(&domain->list); | ||
57 | mutex_unlock(&irq_domain_mutex); | ||
58 | |||
59 | /* Clear the irq_domain assignments */ | ||
60 | for (hwirq = 0; hwirq < domain->nr_irq; hwirq++) { | ||
61 | d = irq_get_irq_data(irq_domain_to_irq(domain, hwirq)); | ||
62 | d->domain = NULL; | ||
63 | } | ||
64 | } | ||
65 | |||
66 | #if defined(CONFIG_OF_IRQ) | ||
67 | /** | ||
68 | * irq_create_of_mapping() - Map a linux irq number from a DT interrupt spec | ||
69 | * | ||
70 | * Used by the device tree interrupt mapping code to translate a device tree | ||
71 | * interrupt specifier to a valid linux irq number. Returns either a valid | ||
72 | * linux IRQ number or 0. | ||
73 | * | ||
74 | * When the caller no longer need the irq number returned by this function it | ||
75 | * should arrange to call irq_dispose_mapping(). | ||
76 | */ | ||
77 | unsigned int irq_create_of_mapping(struct device_node *controller, | ||
78 | const u32 *intspec, unsigned int intsize) | ||
79 | { | ||
80 | struct irq_domain *domain; | ||
81 | unsigned long hwirq; | ||
82 | unsigned int irq, type; | ||
83 | int rc = -EINVAL; | ||
84 | |||
85 | /* Find a domain which can translate the irq spec */ | ||
86 | mutex_lock(&irq_domain_mutex); | ||
87 | list_for_each_entry(domain, &irq_domain_list, list) { | ||
88 | if (!domain->ops->dt_translate) | ||
89 | continue; | ||
90 | rc = domain->ops->dt_translate(domain, controller, | ||
91 | intspec, intsize, &hwirq, &type); | ||
92 | if (rc == 0) | ||
93 | break; | ||
94 | } | ||
95 | mutex_unlock(&irq_domain_mutex); | ||
96 | |||
97 | if (rc != 0) | ||
98 | return 0; | ||
99 | |||
100 | irq = irq_domain_to_irq(domain, hwirq); | ||
101 | if (type != IRQ_TYPE_NONE) | ||
102 | irq_set_irq_type(irq, type); | ||
103 | pr_debug("%s: mapped hwirq=%i to irq=%i, flags=%x\n", | ||
104 | controller->full_name, (int)hwirq, irq, type); | ||
105 | return irq; | ||
106 | } | ||
107 | EXPORT_SYMBOL_GPL(irq_create_of_mapping); | ||
108 | |||
109 | /** | ||
110 | * irq_dispose_mapping() - Discard a mapping created by irq_create_of_mapping() | ||
111 | * @irq: linux irq number to be discarded | ||
112 | * | ||
113 | * Calling this function indicates the caller no longer needs a reference to | ||
114 | * the linux irq number returned by a prior call to irq_create_of_mapping(). | ||
115 | */ | ||
116 | void irq_dispose_mapping(unsigned int irq) | ||
117 | { | ||
118 | /* | ||
119 | * nothing yet; will be filled when support for dynamic allocation of | ||
120 | * irq_descs is added to irq_domain | ||
121 | */ | ||
122 | } | ||
123 | EXPORT_SYMBOL_GPL(irq_dispose_mapping); | ||
124 | |||
125 | int irq_domain_simple_dt_translate(struct irq_domain *d, | ||
126 | struct device_node *controller, | ||
127 | const u32 *intspec, unsigned int intsize, | ||
128 | unsigned long *out_hwirq, unsigned int *out_type) | ||
129 | { | ||
130 | if (d->of_node != controller) | ||
131 | return -EINVAL; | ||
132 | if (intsize < 1) | ||
133 | return -EINVAL; | ||
134 | |||
135 | *out_hwirq = intspec[0]; | ||
136 | *out_type = IRQ_TYPE_NONE; | ||
137 | if (intsize > 1) | ||
138 | *out_type = intspec[1] & IRQ_TYPE_SENSE_MASK; | ||
139 | return 0; | ||
140 | } | ||
141 | |||
142 | struct irq_domain_ops irq_domain_simple_ops = { | ||
143 | .dt_translate = irq_domain_simple_dt_translate, | ||
144 | }; | ||
145 | EXPORT_SYMBOL_GPL(irq_domain_simple_ops); | ||
146 | |||
147 | /** | ||
148 | * irq_domain_create_simple() - Set up a 'simple' translation range | ||
149 | */ | ||
150 | void irq_domain_add_simple(struct device_node *controller, int irq_base) | ||
151 | { | ||
152 | struct irq_domain *domain; | ||
153 | |||
154 | domain = kzalloc(sizeof(*domain), GFP_KERNEL); | ||
155 | if (!domain) { | ||
156 | WARN_ON(1); | ||
157 | return; | ||
158 | } | ||
159 | |||
160 | domain->irq_base = irq_base; | ||
161 | domain->of_node = of_node_get(controller); | ||
162 | domain->ops = &irq_domain_simple_ops; | ||
163 | irq_domain_add(domain); | ||
164 | } | ||
165 | EXPORT_SYMBOL_GPL(irq_domain_add_simple); | ||
166 | |||
167 | void irq_domain_generate_simple(const struct of_device_id *match, | ||
168 | u64 phys_base, unsigned int irq_start) | ||
169 | { | ||
170 | struct device_node *node; | ||
171 | pr_info("looking for phys_base=%llx, irq_start=%i\n", | ||
172 | (unsigned long long) phys_base, (int) irq_start); | ||
173 | node = of_find_matching_node_by_address(NULL, match, phys_base); | ||
174 | if (node) | ||
175 | irq_domain_add_simple(node, irq_start); | ||
176 | else | ||
177 | pr_info("no node found\n"); | ||
178 | } | ||
179 | EXPORT_SYMBOL_GPL(irq_domain_generate_simple); | ||
180 | #endif /* CONFIG_OF_IRQ */ | ||