aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Documentation/devicetree/bindings/arm/arm-boards20
-rw-r--r--Documentation/devicetree/bindings/dma/fsl-imx-sdma.txt17
-rw-r--r--Documentation/devicetree/bindings/i2c/arm-versatile.txt10
-rw-r--r--Documentation/devicetree/bindings/mmc/fsl-imx-esdhc.txt34
-rw-r--r--Documentation/devicetree/bindings/mtd/arm-versatile.txt8
-rw-r--r--Documentation/devicetree/bindings/net/fsl-fec.txt24
-rw-r--r--Documentation/devicetree/bindings/net/smsc-lan91c111.txt10
-rw-r--r--Documentation/devicetree/bindings/tty/serial/fsl-imx-uart.txt19
-rw-r--r--arch/arm/Kconfig1
-rw-r--r--arch/arm/Makefile7
-rw-r--r--arch/arm/boot/Makefile6
-rw-r--r--arch/arm/boot/dts/skeleton.dtsi13
-rw-r--r--arch/arm/boot/dts/tegra-harmony.dts70
-rw-r--r--arch/arm/boot/dts/tegra-seaboard.dts28
-rw-r--r--arch/arm/boot/dts/tegra20.dtsi139
-rw-r--r--arch/arm/boot/dts/versatile-ab.dts192
-rw-r--r--arch/arm/boot/dts/versatile-pb.dts48
-rw-r--r--arch/arm/include/asm/mach/arch.h7
-rw-r--r--arch/arm/include/asm/prom.h5
-rw-r--r--arch/arm/kernel/devtree.c14
-rw-r--r--arch/arm/mach-imx/clock-imx1.c6
-rw-r--r--arch/arm/mach-imx/clock-imx21.c8
-rw-r--r--arch/arm/mach-imx/clock-imx25.c20
-rw-r--r--arch/arm/mach-imx/clock-imx27.c15
-rw-r--r--arch/arm/mach-imx/clock-imx31.c13
-rw-r--r--arch/arm/mach-imx/clock-imx35.c18
-rw-r--r--arch/arm/mach-imx/eukrea_mbimxsd25-baseboard.c3
-rw-r--r--arch/arm/mach-imx/eukrea_mbimxsd35-baseboard.c3
-rw-r--r--arch/arm/mach-imx/mach-mx25_3ds.c2
-rw-r--r--arch/arm/mach-imx/mach-pcm043.c2
-rw-r--r--arch/arm/mach-imx/mm-imx25.c4
-rw-r--r--arch/arm/mach-imx/mm-imx31.c3
-rw-r--r--arch/arm/mach-imx/mm-imx35.c3
-rw-r--r--arch/arm/mach-mx5/board-mx51_babbage.c14
-rw-r--r--arch/arm/mach-mx5/board-mx53_loco.c4
-rw-r--r--arch/arm/mach-mx5/clock-mx51-mx53.c46
-rw-r--r--arch/arm/mach-mx5/mm.c8
-rw-r--r--arch/arm/mach-mx5/mx51_efika.c4
-rw-r--r--arch/arm/mach-tegra/Kconfig6
-rw-r--r--arch/arm/mach-tegra/Makefile3
-rw-r--r--arch/arm/mach-tegra/Makefile.boot3
-rw-r--r--arch/arm/mach-tegra/board-dt.c119
-rw-r--r--arch/arm/mach-versatile/Kconfig8
-rw-r--r--arch/arm/mach-versatile/Makefile1
-rw-r--r--arch/arm/mach-versatile/core.c62
-rw-r--r--arch/arm/mach-versatile/core.h4
-rw-r--r--arch/arm/mach-versatile/versatile_dt.c51
-rw-r--r--arch/arm/plat-mxc/devices/platform-fec.c21
-rw-r--r--arch/arm/plat-mxc/devices/platform-imx-dma.c4
-rw-r--r--arch/arm/plat-mxc/devices/platform-imx-uart.c7
-rw-r--r--arch/arm/plat-mxc/devices/platform-sdhci-esdhc-imx.c29
-rw-r--r--arch/arm/plat-mxc/include/mach/devices-common.h4
-rw-r--r--arch/arm/plat-mxc/include/mach/dma.h3
-rw-r--r--arch/arm/plat-mxc/include/mach/esdhc.h25
-rw-r--r--arch/arm/plat-mxc/include/mach/sdma.h2
-rw-r--r--drivers/dma/imx-sdma.c94
-rw-r--r--drivers/mmc/host/sdhci-esdhc-imx.c261
-rw-r--r--drivers/mmc/host/sdhci-pltfm.c3
-rw-r--r--drivers/net/fec.c125
-rw-r--r--drivers/net/ibm_newemac/core.c33
-rw-r--r--drivers/net/ibm_newemac/emac.h19
-rw-r--r--drivers/net/ibm_newemac/phy.c7
-rw-r--r--drivers/of/of_net.c45
-rw-r--r--drivers/tty/serial/imx.c166
-rw-r--r--include/linux/irq.h6
-rw-r--r--include/linux/irqdomain.h91
-rw-r--r--include/linux/of_irq.h4
-rw-r--r--include/linux/of_net.h1
-rw-r--r--include/linux/phy.h4
-rw-r--r--kernel/irq/Kconfig4
-rw-r--r--kernel/irq/Makefile1
-rw-r--r--kernel/irq/irqdomain.c180
72 files changed, 1963 insertions, 281 deletions
diff --git a/Documentation/devicetree/bindings/arm/arm-boards b/Documentation/devicetree/bindings/arm/arm-boards
new file mode 100644
index 00000000000..91f26148af7
--- /dev/null
+++ b/Documentation/devicetree/bindings/arm/arm-boards
@@ -0,0 +1,20 @@
1ARM Versatile Application and Platform Baseboards
2-------------------------------------------------
3ARM's development hardware platform with connectors for customizable
4core tiles. The hardware configuration of the Versatile boards is
5highly customizable.
6
7Required properties (in root node):
8 compatible = "arm,versatile-ab"; /* Application baseboard */
9 compatible = "arm,versatile-pb"; /* Platform baseboard */
10
11Interrupt 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/dma/fsl-imx-sdma.txt b/Documentation/devicetree/bindings/dma/fsl-imx-sdma.txt
new file mode 100644
index 00000000000..d1e3f443e20
--- /dev/null
+++ b/Documentation/devicetree/bindings/dma/fsl-imx-sdma.txt
@@ -0,0 +1,17 @@
1* Freescale Smart Direct Memory Access (SDMA) Controller for i.MX
2
3Required properties:
4- compatible : Should be "fsl,<chip>-sdma"
5- reg : Should contain SDMA registers location and length
6- interrupts : Should contain SDMA interrupt
7- fsl,sdma-ram-script-name : Should contain the full path of SDMA RAM
8 scripts firmware
9
10Examples:
11
12sdma@83fb0000 {
13 compatible = "fsl,imx51-sdma", "fsl,imx35-sdma";
14 reg = <0x83fb0000 0x4000>;
15 interrupts = <6>;
16 fsl,sdma-ram-script-name = "sdma-imx51.bin";
17};
diff --git a/Documentation/devicetree/bindings/i2c/arm-versatile.txt b/Documentation/devicetree/bindings/i2c/arm-versatile.txt
new file mode 100644
index 00000000000..361d31c51b6
--- /dev/null
+++ b/Documentation/devicetree/bindings/i2c/arm-versatile.txt
@@ -0,0 +1,10 @@
1i2c Controller on ARM Versatile platform:
2
3Required properties:
4- compatible : Must be "arm,versatile-i2c";
5- reg
6- #address-cells = <1>;
7- #size-cells = <0>;
8
9Optional properties:
10- Child nodes conforming to i2c bus binding
diff --git a/Documentation/devicetree/bindings/mmc/fsl-imx-esdhc.txt b/Documentation/devicetree/bindings/mmc/fsl-imx-esdhc.txt
new file mode 100644
index 00000000000..ab22fe6e73a
--- /dev/null
+++ b/Documentation/devicetree/bindings/mmc/fsl-imx-esdhc.txt
@@ -0,0 +1,34 @@
1* Freescale Enhanced Secure Digital Host Controller (eSDHC) for i.MX
2
3The Enhanced Secure Digital Host Controller on Freescale i.MX family
4provides an interface for MMC, SD, and SDIO types of memory cards.
5
6Required properties:
7- compatible : Should be "fsl,<chip>-esdhc"
8- reg : Should contain eSDHC registers location and length
9- interrupts : Should contain eSDHC interrupt
10
11Optional properties:
12- fsl,card-wired : Indicate the card is wired to host permanently
13- fsl,cd-internal : Indicate to use controller internal card detection
14- fsl,wp-internal : Indicate to use controller internal write protection
15- cd-gpios : Specify GPIOs for card detection
16- wp-gpios : Specify GPIOs for write protection
17
18Examples:
19
20esdhc@70004000 {
21 compatible = "fsl,imx51-esdhc";
22 reg = <0x70004000 0x4000>;
23 interrupts = <1>;
24 fsl,cd-internal;
25 fsl,wp-internal;
26};
27
28esdhc@70008000 {
29 compatible = "fsl,imx51-esdhc";
30 reg = <0x70008000 0x4000>;
31 interrupts = <2>;
32 cd-gpios = <&gpio0 6 0>; /* GPIO1_6 */
33 wp-gpios = <&gpio0 5 0>; /* GPIO1_5 */
34};
diff --git a/Documentation/devicetree/bindings/mtd/arm-versatile.txt b/Documentation/devicetree/bindings/mtd/arm-versatile.txt
new file mode 100644
index 00000000000..476845db94d
--- /dev/null
+++ b/Documentation/devicetree/bindings/mtd/arm-versatile.txt
@@ -0,0 +1,8 @@
1Flash device on ARM Versatile board
2
3Required properties:
4- compatible : must be "arm,versatile-flash";
5- bank-width : width in bytes of flash interface.
6
7Optional properties:
8- Subnode partition map from mtd flash binding
diff --git a/Documentation/devicetree/bindings/net/fsl-fec.txt b/Documentation/devicetree/bindings/net/fsl-fec.txt
new file mode 100644
index 00000000000..de439517dff
--- /dev/null
+++ b/Documentation/devicetree/bindings/net/fsl-fec.txt
@@ -0,0 +1,24 @@
1* Freescale Fast Ethernet Controller (FEC)
2
3Required properties:
4- compatible : Should be "fsl,<soc>-fec"
5- reg : Address and length of the register set for the device
6- interrupts : Should contain fec interrupt
7- phy-mode : String, operation mode of the PHY interface.
8 Supported values are: "mii", "gmii", "sgmii", "tbi", "rmii",
9 "rgmii", "rgmii-id", "rgmii-rxid", "rgmii-txid", "rtbi", "smii".
10- phy-reset-gpios : Should specify the gpio for phy reset
11
12Optional properties:
13- local-mac-address : 6 bytes, mac address
14
15Example:
16
17fec@83fec000 {
18 compatible = "fsl,imx51-fec", "fsl,imx27-fec";
19 reg = <0x83fec000 0x4000>;
20 interrupts = <87>;
21 phy-mode = "mii";
22 phy-reset-gpios = <&gpio1 14 0>; /* GPIO2_14 */
23 local-mac-address = [00 04 9F 01 1B B9];
24};
diff --git a/Documentation/devicetree/bindings/net/smsc-lan91c111.txt b/Documentation/devicetree/bindings/net/smsc-lan91c111.txt
new file mode 100644
index 00000000000..953049b4248
--- /dev/null
+++ b/Documentation/devicetree/bindings/net/smsc-lan91c111.txt
@@ -0,0 +1,10 @@
1SMSC LAN91c111 Ethernet mac
2
3Required properties:
4- compatible = "smsc,lan91c111";
5- reg : physical address and size of registers
6- interrupts : interrupt connection
7
8Optional properties:
9- phy-device : phandle to Ethernet phy
10- local-mac-address : Ethernet mac address to use
diff --git a/Documentation/devicetree/bindings/tty/serial/fsl-imx-uart.txt b/Documentation/devicetree/bindings/tty/serial/fsl-imx-uart.txt
new file mode 100644
index 00000000000..a9c0406280e
--- /dev/null
+++ b/Documentation/devicetree/bindings/tty/serial/fsl-imx-uart.txt
@@ -0,0 +1,19 @@
1* Freescale i.MX Universal Asynchronous Receiver/Transmitter (UART)
2
3Required properties:
4- compatible : Should be "fsl,<soc>-uart"
5- reg : Address and length of the register set for the device
6- interrupts : Should contain uart interrupt
7
8Optional properties:
9- fsl,uart-has-rtscts : Indicate the uart has rts and cts
10- fsl,irda-mode : Indicate the uart supports irda mode
11
12Example:
13
14uart@73fbc000 {
15 compatible = "fsl,imx51-uart", "fsl,imx21-uart";
16 reg = <0x73fbc000 0x4000>;
17 interrupts = <31>;
18 fsl,uart-has-rtscts;
19};
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 09ebf0ba64f..2c71a8f3535 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 3a4a04b33d0..70c424eaf7b 100644
--- a/arch/arm/Makefile
+++ b/arch/arm/Makefile
@@ -282,6 +282,12 @@ zImage Image xipImage bootpImage uImage: vmlinux
282zinstall uinstall install: vmlinux 282zinstall 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
288dtbs:
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
286archclean: 292archclean:
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 9128fddf110..a1edfd5a129 100644
--- a/arch/arm/boot/Makefile
+++ b/arch/arm/boot/Makefile
@@ -59,6 +59,12 @@ $(obj)/zImage: $(obj)/compressed/vmlinux FORCE
59 59
60endif 60endif
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
62quiet_cmd_uimage = UIMAGE $@ 68quiet_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 00000000000..b41d241de2c
--- /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 00000000000..4c053340ce3
--- /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 00000000000..1940cae0074
--- /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 00000000000..5727595cde6
--- /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 00000000000..0b32925f214
--- /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 00000000000..8a614e39800
--- /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 3281fb4b12e..217aa1911dd 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) \
78static 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 11b8708fc4d..6f65ca86a5e 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
19static inline void irq_dispose_mapping(unsigned int virq)
20{
21 return;
22}
23
24extern struct machine_desc *setup_machine_fdt(unsigned int dt_phys); 19extern struct machine_desc *setup_machine_fdt(unsigned int dt_phys);
25extern void arm_dt_memblock_reserve(void); 20extern void arm_dt_memblock_reserve(void);
26 21
diff --git a/arch/arm/kernel/devtree.c b/arch/arm/kernel/devtree.c
index 0cdd7b456cb..1a33e9d6bb1 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 */
143unsigned int irq_create_of_mapping(struct device_node *controller,
144 const u32 *intspec, unsigned int intsize)
145{
146 return intspec[0];
147}
148EXPORT_SYMBOL_GPL(irq_create_of_mapping);
diff --git a/arch/arm/mach-imx/clock-imx1.c b/arch/arm/mach-imx/clock-imx1.c
index dcc41728fe7..4aabeb24156 100644
--- a/arch/arm/mach-imx/clock-imx1.c
+++ b/arch/arm/mach-imx/clock-imx1.c
@@ -587,9 +587,9 @@ static struct clk_lookup lookups[] __initdata = {
587 _REGISTER_CLOCK(NULL, "mma", mma_clk) 587 _REGISTER_CLOCK(NULL, "mma", mma_clk)
588 _REGISTER_CLOCK("imx_udc.0", NULL, usbd_clk) 588 _REGISTER_CLOCK("imx_udc.0", NULL, usbd_clk)
589 _REGISTER_CLOCK(NULL, "gpt", gpt_clk) 589 _REGISTER_CLOCK(NULL, "gpt", gpt_clk)
590 _REGISTER_CLOCK("imx-uart.0", NULL, uart_clk) 590 _REGISTER_CLOCK("imx1-uart.0", NULL, uart_clk)
591 _REGISTER_CLOCK("imx-uart.1", NULL, uart_clk) 591 _REGISTER_CLOCK("imx1-uart.1", NULL, uart_clk)
592 _REGISTER_CLOCK("imx-uart.2", NULL, uart_clk) 592 _REGISTER_CLOCK("imx1-uart.2", NULL, uart_clk)
593 _REGISTER_CLOCK("imx-i2c.0", NULL, i2c_clk) 593 _REGISTER_CLOCK("imx-i2c.0", NULL, i2c_clk)
594 _REGISTER_CLOCK("imx1-cspi.0", NULL, spi_clk) 594 _REGISTER_CLOCK("imx1-cspi.0", NULL, spi_clk)
595 _REGISTER_CLOCK("imx1-cspi.1", NULL, spi_clk) 595 _REGISTER_CLOCK("imx1-cspi.1", NULL, spi_clk)
diff --git a/arch/arm/mach-imx/clock-imx21.c b/arch/arm/mach-imx/clock-imx21.c
index bf30a8c7ce6..ee15d8c9db0 100644
--- a/arch/arm/mach-imx/clock-imx21.c
+++ b/arch/arm/mach-imx/clock-imx21.c
@@ -1162,10 +1162,10 @@ static struct clk_lookup lookups[] = {
1162 _REGISTER_CLOCK(NULL, "perclk3", per_clk[2]) 1162 _REGISTER_CLOCK(NULL, "perclk3", per_clk[2])
1163 _REGISTER_CLOCK(NULL, "perclk4", per_clk[3]) 1163 _REGISTER_CLOCK(NULL, "perclk4", per_clk[3])
1164 _REGISTER_CLOCK(NULL, "clko", clko_clk) 1164 _REGISTER_CLOCK(NULL, "clko", clko_clk)
1165 _REGISTER_CLOCK("imx-uart.0", NULL, uart_clk[0]) 1165 _REGISTER_CLOCK("imx21-uart.0", NULL, uart_clk[0])
1166 _REGISTER_CLOCK("imx-uart.1", NULL, uart_clk[1]) 1166 _REGISTER_CLOCK("imx21-uart.1", NULL, uart_clk[1])
1167 _REGISTER_CLOCK("imx-uart.2", NULL, uart_clk[2]) 1167 _REGISTER_CLOCK("imx21-uart.2", NULL, uart_clk[2])
1168 _REGISTER_CLOCK("imx-uart.3", NULL, uart_clk[3]) 1168 _REGISTER_CLOCK("imx21-uart.3", NULL, uart_clk[3])
1169 _REGISTER_CLOCK(NULL, "gpt1", gpt_clk[0]) 1169 _REGISTER_CLOCK(NULL, "gpt1", gpt_clk[0])
1170 _REGISTER_CLOCK(NULL, "gpt1", gpt_clk[1]) 1170 _REGISTER_CLOCK(NULL, "gpt1", gpt_clk[1])
1171 _REGISTER_CLOCK(NULL, "gpt1", gpt_clk[2]) 1171 _REGISTER_CLOCK(NULL, "gpt1", gpt_clk[2])
diff --git a/arch/arm/mach-imx/clock-imx25.c b/arch/arm/mach-imx/clock-imx25.c
index af1c580b06b..0fc7ba56d61 100644
--- a/arch/arm/mach-imx/clock-imx25.c
+++ b/arch/arm/mach-imx/clock-imx25.c
@@ -272,11 +272,12 @@ DEFINE_CLOCK(can2_clk, 1, CCM_CGCR1, 3, get_rate_ipg, NULL, NULL);
272 }, 272 },
273 273
274static struct clk_lookup lookups[] = { 274static struct clk_lookup lookups[] = {
275 _REGISTER_CLOCK("imx-uart.0", NULL, uart1_clk) 275 /* i.mx25 has the i.mx21 type uart */
276 _REGISTER_CLOCK("imx-uart.1", NULL, uart2_clk) 276 _REGISTER_CLOCK("imx21-uart.0", NULL, uart1_clk)
277 _REGISTER_CLOCK("imx-uart.2", NULL, uart3_clk) 277 _REGISTER_CLOCK("imx21-uart.1", NULL, uart2_clk)
278 _REGISTER_CLOCK("imx-uart.3", NULL, uart4_clk) 278 _REGISTER_CLOCK("imx21-uart.2", NULL, uart3_clk)
279 _REGISTER_CLOCK("imx-uart.4", NULL, uart5_clk) 279 _REGISTER_CLOCK("imx21-uart.3", NULL, uart4_clk)
280 _REGISTER_CLOCK("imx21-uart.4", NULL, uart5_clk)
280 _REGISTER_CLOCK("mxc-ehci.0", "usb", usbotg_clk) 281 _REGISTER_CLOCK("mxc-ehci.0", "usb", usbotg_clk)
281 _REGISTER_CLOCK("mxc-ehci.1", "usb", usbotg_clk) 282 _REGISTER_CLOCK("mxc-ehci.1", "usb", usbotg_clk)
282 _REGISTER_CLOCK("mxc-ehci.2", "usb", usbotg_clk) 283 _REGISTER_CLOCK("mxc-ehci.2", "usb", usbotg_clk)
@@ -295,19 +296,20 @@ static struct clk_lookup lookups[] = {
295 _REGISTER_CLOCK("imx-i2c.0", NULL, i2c_clk) 296 _REGISTER_CLOCK("imx-i2c.0", NULL, i2c_clk)
296 _REGISTER_CLOCK("imx-i2c.1", NULL, i2c_clk) 297 _REGISTER_CLOCK("imx-i2c.1", NULL, i2c_clk)
297 _REGISTER_CLOCK("imx-i2c.2", NULL, i2c_clk) 298 _REGISTER_CLOCK("imx-i2c.2", NULL, i2c_clk)
298 _REGISTER_CLOCK("fec.0", NULL, fec_clk) 299 _REGISTER_CLOCK("imx25-fec.0", NULL, fec_clk)
299 _REGISTER_CLOCK("imxdi_rtc.0", NULL, dryice_clk) 300 _REGISTER_CLOCK("imxdi_rtc.0", NULL, dryice_clk)
300 _REGISTER_CLOCK("imx-fb.0", NULL, lcdc_clk) 301 _REGISTER_CLOCK("imx-fb.0", NULL, lcdc_clk)
301 _REGISTER_CLOCK("imx2-wdt.0", NULL, wdt_clk) 302 _REGISTER_CLOCK("imx2-wdt.0", NULL, wdt_clk)
302 _REGISTER_CLOCK("imx-ssi.0", NULL, ssi1_clk) 303 _REGISTER_CLOCK("imx-ssi.0", NULL, ssi1_clk)
303 _REGISTER_CLOCK("imx-ssi.1", NULL, ssi2_clk) 304 _REGISTER_CLOCK("imx-ssi.1", NULL, ssi2_clk)
304 _REGISTER_CLOCK("sdhci-esdhc-imx.0", NULL, esdhc1_clk) 305 _REGISTER_CLOCK("sdhci-esdhc-imx25.0", NULL, esdhc1_clk)
305 _REGISTER_CLOCK("sdhci-esdhc-imx.1", NULL, esdhc2_clk) 306 _REGISTER_CLOCK("sdhci-esdhc-imx25.1", NULL, esdhc2_clk)
306 _REGISTER_CLOCK("mx2-camera.0", NULL, csi_clk) 307 _REGISTER_CLOCK("mx2-camera.0", NULL, csi_clk)
307 _REGISTER_CLOCK(NULL, "audmux", audmux_clk) 308 _REGISTER_CLOCK(NULL, "audmux", audmux_clk)
308 _REGISTER_CLOCK("flexcan.0", NULL, can1_clk) 309 _REGISTER_CLOCK("flexcan.0", NULL, can1_clk)
309 _REGISTER_CLOCK("flexcan.1", NULL, can2_clk) 310 _REGISTER_CLOCK("flexcan.1", NULL, can2_clk)
310 _REGISTER_CLOCK("imx-sdma", NULL, sdma_clk) 311 /* i.mx25 has the i.mx35 type sdma */
312 _REGISTER_CLOCK("imx35-sdma", NULL, sdma_clk)
311}; 313};
312 314
313int __init mx25_clocks_init(void) 315int __init mx25_clocks_init(void)
diff --git a/arch/arm/mach-imx/clock-imx27.c b/arch/arm/mach-imx/clock-imx27.c
index 583f2515c1d..6912b821b37 100644
--- a/arch/arm/mach-imx/clock-imx27.c
+++ b/arch/arm/mach-imx/clock-imx27.c
@@ -624,12 +624,13 @@ DEFINE_CLOCK1(csi_clk, 0, NULL, 0, parent, &csi_clk1, &per4_clk);
624 }, 624 },
625 625
626static struct clk_lookup lookups[] = { 626static struct clk_lookup lookups[] = {
627 _REGISTER_CLOCK("imx-uart.0", NULL, uart1_clk) 627 /* i.mx27 has the i.mx21 type uart */
628 _REGISTER_CLOCK("imx-uart.1", NULL, uart2_clk) 628 _REGISTER_CLOCK("imx21-uart.0", NULL, uart1_clk)
629 _REGISTER_CLOCK("imx-uart.2", NULL, uart3_clk) 629 _REGISTER_CLOCK("imx21-uart.1", NULL, uart2_clk)
630 _REGISTER_CLOCK("imx-uart.3", NULL, uart4_clk) 630 _REGISTER_CLOCK("imx21-uart.2", NULL, uart3_clk)
631 _REGISTER_CLOCK("imx-uart.4", NULL, uart5_clk) 631 _REGISTER_CLOCK("imx21-uart.3", NULL, uart4_clk)
632 _REGISTER_CLOCK("imx-uart.5", NULL, uart6_clk) 632 _REGISTER_CLOCK("imx21-uart.4", NULL, uart5_clk)
633 _REGISTER_CLOCK("imx21-uart.5", NULL, uart6_clk)
633 _REGISTER_CLOCK(NULL, "gpt1", gpt1_clk) 634 _REGISTER_CLOCK(NULL, "gpt1", gpt1_clk)
634 _REGISTER_CLOCK(NULL, "gpt2", gpt2_clk) 635 _REGISTER_CLOCK(NULL, "gpt2", gpt2_clk)
635 _REGISTER_CLOCK(NULL, "gpt3", gpt3_clk) 636 _REGISTER_CLOCK(NULL, "gpt3", gpt3_clk)
@@ -662,7 +663,7 @@ static struct clk_lookup lookups[] = {
662 _REGISTER_CLOCK(NULL, "brom", brom_clk) 663 _REGISTER_CLOCK(NULL, "brom", brom_clk)
663 _REGISTER_CLOCK(NULL, "emma", emma_clk) 664 _REGISTER_CLOCK(NULL, "emma", emma_clk)
664 _REGISTER_CLOCK(NULL, "slcdc", slcdc_clk) 665 _REGISTER_CLOCK(NULL, "slcdc", slcdc_clk)
665 _REGISTER_CLOCK("fec.0", NULL, fec_clk) 666 _REGISTER_CLOCK("imx27-fec.0", NULL, fec_clk)
666 _REGISTER_CLOCK(NULL, "emi", emi_clk) 667 _REGISTER_CLOCK(NULL, "emi", emi_clk)
667 _REGISTER_CLOCK(NULL, "sahara2", sahara2_clk) 668 _REGISTER_CLOCK(NULL, "sahara2", sahara2_clk)
668 _REGISTER_CLOCK(NULL, "ata", ata_clk) 669 _REGISTER_CLOCK(NULL, "ata", ata_clk)
diff --git a/arch/arm/mach-imx/clock-imx31.c b/arch/arm/mach-imx/clock-imx31.c
index 25f343fca2b..d973770b1f9 100644
--- a/arch/arm/mach-imx/clock-imx31.c
+++ b/arch/arm/mach-imx/clock-imx31.c
@@ -547,11 +547,12 @@ static struct clk_lookup lookups[] = {
547 _REGISTER_CLOCK("fsl-usb2-udc", "usb", usb_clk1) 547 _REGISTER_CLOCK("fsl-usb2-udc", "usb", usb_clk1)
548 _REGISTER_CLOCK("fsl-usb2-udc", "usb_ahb", usb_clk2) 548 _REGISTER_CLOCK("fsl-usb2-udc", "usb_ahb", usb_clk2)
549 _REGISTER_CLOCK("mx3-camera.0", NULL, csi_clk) 549 _REGISTER_CLOCK("mx3-camera.0", NULL, csi_clk)
550 _REGISTER_CLOCK("imx-uart.0", NULL, uart1_clk) 550 /* i.mx31 has the i.mx21 type uart */
551 _REGISTER_CLOCK("imx-uart.1", NULL, uart2_clk) 551 _REGISTER_CLOCK("imx21-uart.0", NULL, uart1_clk)
552 _REGISTER_CLOCK("imx-uart.2", NULL, uart3_clk) 552 _REGISTER_CLOCK("imx21-uart.1", NULL, uart2_clk)
553 _REGISTER_CLOCK("imx-uart.3", NULL, uart4_clk) 553 _REGISTER_CLOCK("imx21-uart.2", NULL, uart3_clk)
554 _REGISTER_CLOCK("imx-uart.4", NULL, uart5_clk) 554 _REGISTER_CLOCK("imx21-uart.3", NULL, uart4_clk)
555 _REGISTER_CLOCK("imx21-uart.4", NULL, uart5_clk)
555 _REGISTER_CLOCK("imx-i2c.0", NULL, i2c1_clk) 556 _REGISTER_CLOCK("imx-i2c.0", NULL, i2c1_clk)
556 _REGISTER_CLOCK("imx-i2c.1", NULL, i2c2_clk) 557 _REGISTER_CLOCK("imx-i2c.1", NULL, i2c2_clk)
557 _REGISTER_CLOCK("imx-i2c.2", NULL, i2c3_clk) 558 _REGISTER_CLOCK("imx-i2c.2", NULL, i2c3_clk)
@@ -564,7 +565,7 @@ static struct clk_lookup lookups[] = {
564 _REGISTER_CLOCK(NULL, "ata", ata_clk) 565 _REGISTER_CLOCK(NULL, "ata", ata_clk)
565 _REGISTER_CLOCK(NULL, "rtic", rtic_clk) 566 _REGISTER_CLOCK(NULL, "rtic", rtic_clk)
566 _REGISTER_CLOCK(NULL, "rng", rng_clk) 567 _REGISTER_CLOCK(NULL, "rng", rng_clk)
567 _REGISTER_CLOCK("imx-sdma", NULL, sdma_clk1) 568 _REGISTER_CLOCK("imx31-sdma", NULL, sdma_clk1)
568 _REGISTER_CLOCK(NULL, "sdma_ipg", sdma_clk2) 569 _REGISTER_CLOCK(NULL, "sdma_ipg", sdma_clk2)
569 _REGISTER_CLOCK(NULL, "mstick", mstick1_clk) 570 _REGISTER_CLOCK(NULL, "mstick", mstick1_clk)
570 _REGISTER_CLOCK(NULL, "mstick", mstick2_clk) 571 _REGISTER_CLOCK(NULL, "mstick", mstick2_clk)
diff --git a/arch/arm/mach-imx/clock-imx35.c b/arch/arm/mach-imx/clock-imx35.c
index 5a4cc1ea405..88b62a071ae 100644
--- a/arch/arm/mach-imx/clock-imx35.c
+++ b/arch/arm/mach-imx/clock-imx35.c
@@ -458,10 +458,11 @@ static struct clk_lookup lookups[] = {
458 _REGISTER_CLOCK("imx-epit.0", NULL, epit1_clk) 458 _REGISTER_CLOCK("imx-epit.0", NULL, epit1_clk)
459 _REGISTER_CLOCK("imx-epit.1", NULL, epit2_clk) 459 _REGISTER_CLOCK("imx-epit.1", NULL, epit2_clk)
460 _REGISTER_CLOCK(NULL, "esai", esai_clk) 460 _REGISTER_CLOCK(NULL, "esai", esai_clk)
461 _REGISTER_CLOCK("sdhci-esdhc-imx.0", NULL, esdhc1_clk) 461 _REGISTER_CLOCK("sdhci-esdhc-imx35.0", NULL, esdhc1_clk)
462 _REGISTER_CLOCK("sdhci-esdhc-imx.1", NULL, esdhc2_clk) 462 _REGISTER_CLOCK("sdhci-esdhc-imx35.1", NULL, esdhc2_clk)
463 _REGISTER_CLOCK("sdhci-esdhc-imx.2", NULL, esdhc3_clk) 463 _REGISTER_CLOCK("sdhci-esdhc-imx35.2", NULL, esdhc3_clk)
464 _REGISTER_CLOCK("fec.0", NULL, fec_clk) 464 /* i.mx35 has the i.mx27 type fec */
465 _REGISTER_CLOCK("imx27-fec.0", NULL, fec_clk)
465 _REGISTER_CLOCK(NULL, "gpio", gpio1_clk) 466 _REGISTER_CLOCK(NULL, "gpio", gpio1_clk)
466 _REGISTER_CLOCK(NULL, "gpio", gpio2_clk) 467 _REGISTER_CLOCK(NULL, "gpio", gpio2_clk)
467 _REGISTER_CLOCK(NULL, "gpio", gpio3_clk) 468 _REGISTER_CLOCK(NULL, "gpio", gpio3_clk)
@@ -481,14 +482,15 @@ static struct clk_lookup lookups[] = {
481 _REGISTER_CLOCK(NULL, "rtc", rtc_clk) 482 _REGISTER_CLOCK(NULL, "rtc", rtc_clk)
482 _REGISTER_CLOCK(NULL, "rtic", rtic_clk) 483 _REGISTER_CLOCK(NULL, "rtic", rtic_clk)
483 _REGISTER_CLOCK(NULL, "scc", scc_clk) 484 _REGISTER_CLOCK(NULL, "scc", scc_clk)
484 _REGISTER_CLOCK("imx-sdma", NULL, sdma_clk) 485 _REGISTER_CLOCK("imx35-sdma", NULL, sdma_clk)
485 _REGISTER_CLOCK(NULL, "spba", spba_clk) 486 _REGISTER_CLOCK(NULL, "spba", spba_clk)
486 _REGISTER_CLOCK(NULL, "spdif", spdif_clk) 487 _REGISTER_CLOCK(NULL, "spdif", spdif_clk)
487 _REGISTER_CLOCK("imx-ssi.0", NULL, ssi1_clk) 488 _REGISTER_CLOCK("imx-ssi.0", NULL, ssi1_clk)
488 _REGISTER_CLOCK("imx-ssi.1", NULL, ssi2_clk) 489 _REGISTER_CLOCK("imx-ssi.1", NULL, ssi2_clk)
489 _REGISTER_CLOCK("imx-uart.0", NULL, uart1_clk) 490 /* i.mx35 has the i.mx21 type uart */
490 _REGISTER_CLOCK("imx-uart.1", NULL, uart2_clk) 491 _REGISTER_CLOCK("imx21-uart.0", NULL, uart1_clk)
491 _REGISTER_CLOCK("imx-uart.2", NULL, uart3_clk) 492 _REGISTER_CLOCK("imx21-uart.1", NULL, uart2_clk)
493 _REGISTER_CLOCK("imx21-uart.2", NULL, uart3_clk)
492 _REGISTER_CLOCK("mxc-ehci.0", "usb", usbotg_clk) 494 _REGISTER_CLOCK("mxc-ehci.0", "usb", usbotg_clk)
493 _REGISTER_CLOCK("mxc-ehci.1", "usb", usbotg_clk) 495 _REGISTER_CLOCK("mxc-ehci.1", "usb", usbotg_clk)
494 _REGISTER_CLOCK("mxc-ehci.2", "usb", usbotg_clk) 496 _REGISTER_CLOCK("mxc-ehci.2", "usb", usbotg_clk)
diff --git a/arch/arm/mach-imx/eukrea_mbimxsd25-baseboard.c b/arch/arm/mach-imx/eukrea_mbimxsd25-baseboard.c
index 01ebcb31e48..66e8726253f 100644
--- a/arch/arm/mach-imx/eukrea_mbimxsd25-baseboard.c
+++ b/arch/arm/mach-imx/eukrea_mbimxsd25-baseboard.c
@@ -225,7 +225,8 @@ struct imx_ssi_platform_data eukrea_mbimxsd_ssi_pdata __initconst = {
225 225
226static struct esdhc_platform_data sd1_pdata = { 226static struct esdhc_platform_data sd1_pdata = {
227 .cd_gpio = GPIO_SD1CD, 227 .cd_gpio = GPIO_SD1CD,
228 .wp_gpio = -EINVAL, 228 .cd_type = ESDHC_CD_GPIO,
229 .wp_type = ESDHC_WP_NONE,
229}; 230};
230 231
231/* 232/*
diff --git a/arch/arm/mach-imx/eukrea_mbimxsd35-baseboard.c b/arch/arm/mach-imx/eukrea_mbimxsd35-baseboard.c
index 558eb526ba5..0f0af02b318 100644
--- a/arch/arm/mach-imx/eukrea_mbimxsd35-baseboard.c
+++ b/arch/arm/mach-imx/eukrea_mbimxsd35-baseboard.c
@@ -236,7 +236,8 @@ struct imx_ssi_platform_data eukrea_mbimxsd_ssi_pdata __initconst = {
236 236
237static struct esdhc_platform_data sd1_pdata = { 237static struct esdhc_platform_data sd1_pdata = {
238 .cd_gpio = GPIO_SD1CD, 238 .cd_gpio = GPIO_SD1CD,
239 .wp_gpio = -EINVAL, 239 .cd_type = ESDHC_CD_GPIO,
240 .wp_type = ESDHC_WP_NONE,
240}; 241};
241 242
242/* 243/*
diff --git a/arch/arm/mach-imx/mach-mx25_3ds.c b/arch/arm/mach-imx/mach-mx25_3ds.c
index 01534bb6130..7f66a91df36 100644
--- a/arch/arm/mach-imx/mach-mx25_3ds.c
+++ b/arch/arm/mach-imx/mach-mx25_3ds.c
@@ -215,6 +215,8 @@ static const struct imxi2c_platform_data mx25_3ds_i2c0_data __initconst = {
215static const struct esdhc_platform_data mx25pdk_esdhc_pdata __initconst = { 215static const struct esdhc_platform_data mx25pdk_esdhc_pdata __initconst = {
216 .wp_gpio = SD1_GPIO_WP, 216 .wp_gpio = SD1_GPIO_WP,
217 .cd_gpio = SD1_GPIO_CD, 217 .cd_gpio = SD1_GPIO_CD,
218 .wp_type = ESDHC_WP_GPIO,
219 .cd_type = ESDHC_CD_GPIO,
218}; 220};
219 221
220static void __init mx25pdk_init(void) 222static void __init mx25pdk_init(void)
diff --git a/arch/arm/mach-imx/mach-pcm043.c b/arch/arm/mach-imx/mach-pcm043.c
index 163cc318caf..660ec3e80cf 100644
--- a/arch/arm/mach-imx/mach-pcm043.c
+++ b/arch/arm/mach-imx/mach-pcm043.c
@@ -349,6 +349,8 @@ __setup("otg_mode=", pcm043_otg_mode);
349static struct esdhc_platform_data sd1_pdata = { 349static struct esdhc_platform_data sd1_pdata = {
350 .wp_gpio = SD1_GPIO_WP, 350 .wp_gpio = SD1_GPIO_WP,
351 .cd_gpio = SD1_GPIO_CD, 351 .cd_gpio = SD1_GPIO_CD,
352 .wp_type = ESDHC_WP_GPIO,
353 .cd_type = ESDHC_CD_GPIO,
352}; 354};
353 355
354/* 356/*
diff --git a/arch/arm/mach-imx/mm-imx25.c b/arch/arm/mach-imx/mm-imx25.c
index 8bf02916465..cc4d152bd9b 100644
--- a/arch/arm/mach-imx/mm-imx25.c
+++ b/arch/arm/mach-imx/mm-imx25.c
@@ -79,7 +79,6 @@ static struct sdma_script_start_addrs imx25_sdma_script __initdata = {
79}; 79};
80 80
81static struct sdma_platform_data imx25_sdma_pdata __initdata = { 81static struct sdma_platform_data imx25_sdma_pdata __initdata = {
82 .sdma_version = 2,
83 .fw_name = "sdma-imx25.bin", 82 .fw_name = "sdma-imx25.bin",
84 .script_addrs = &imx25_sdma_script, 83 .script_addrs = &imx25_sdma_script,
85}; 84};
@@ -92,5 +91,6 @@ void __init imx25_soc_init(void)
92 mxc_register_gpio("imx31-gpio", 2, MX25_GPIO3_BASE_ADDR, SZ_16K, MX25_INT_GPIO3, 0); 91 mxc_register_gpio("imx31-gpio", 2, MX25_GPIO3_BASE_ADDR, SZ_16K, MX25_INT_GPIO3, 0);
93 mxc_register_gpio("imx31-gpio", 3, MX25_GPIO4_BASE_ADDR, SZ_16K, MX25_INT_GPIO4, 0); 92 mxc_register_gpio("imx31-gpio", 3, MX25_GPIO4_BASE_ADDR, SZ_16K, MX25_INT_GPIO4, 0);
94 93
95 imx_add_imx_sdma(MX25_SDMA_BASE_ADDR, MX25_INT_SDMA, &imx25_sdma_pdata); 94 /* i.mx25 has the i.mx35 type sdma */
95 imx_add_imx_sdma("imx35-sdma", MX25_SDMA_BASE_ADDR, MX25_INT_SDMA, &imx25_sdma_pdata);
96} 96}
diff --git a/arch/arm/mach-imx/mm-imx31.c b/arch/arm/mach-imx/mm-imx31.c
index 61bff38cb95..b7c55e7db00 100644
--- a/arch/arm/mach-imx/mm-imx31.c
+++ b/arch/arm/mach-imx/mm-imx31.c
@@ -69,7 +69,6 @@ static struct sdma_script_start_addrs imx31_to2_sdma_script __initdata = {
69}; 69};
70 70
71static struct sdma_platform_data imx31_sdma_pdata __initdata = { 71static struct sdma_platform_data imx31_sdma_pdata __initdata = {
72 .sdma_version = 1,
73 .fw_name = "sdma-imx31-to2.bin", 72 .fw_name = "sdma-imx31-to2.bin",
74 .script_addrs = &imx31_to2_sdma_script, 73 .script_addrs = &imx31_to2_sdma_script,
75}; 74};
@@ -88,5 +87,5 @@ void __init imx31_soc_init(void)
88 imx31_sdma_pdata.script_addrs = &imx31_to1_sdma_script; 87 imx31_sdma_pdata.script_addrs = &imx31_to1_sdma_script;
89 } 88 }
90 89
91 imx_add_imx_sdma(MX31_SDMA_BASE_ADDR, MX31_INT_SDMA, &imx31_sdma_pdata); 90 imx_add_imx_sdma("imx31-sdma", MX31_SDMA_BASE_ADDR, MX31_INT_SDMA, &imx31_sdma_pdata);
92} 91}
diff --git a/arch/arm/mach-imx/mm-imx35.c b/arch/arm/mach-imx/mm-imx35.c
index 98769ae3437..f49bac7a1ed 100644
--- a/arch/arm/mach-imx/mm-imx35.c
+++ b/arch/arm/mach-imx/mm-imx35.c
@@ -86,7 +86,6 @@ static struct sdma_script_start_addrs imx35_to2_sdma_script __initdata = {
86}; 86};
87 87
88static struct sdma_platform_data imx35_sdma_pdata __initdata = { 88static struct sdma_platform_data imx35_sdma_pdata __initdata = {
89 .sdma_version = 2,
90 .fw_name = "sdma-imx35-to2.bin", 89 .fw_name = "sdma-imx35-to2.bin",
91 .script_addrs = &imx35_to2_sdma_script, 90 .script_addrs = &imx35_to2_sdma_script,
92}; 91};
@@ -106,5 +105,5 @@ void __init imx35_soc_init(void)
106 imx35_sdma_pdata.script_addrs = &imx35_to1_sdma_script; 105 imx35_sdma_pdata.script_addrs = &imx35_to1_sdma_script;
107 } 106 }
108 107
109 imx_add_imx_sdma(MX35_SDMA_BASE_ADDR, MX35_INT_SDMA, &imx35_sdma_pdata); 108 imx_add_imx_sdma("imx35-sdma", MX35_SDMA_BASE_ADDR, MX35_INT_SDMA, &imx35_sdma_pdata);
110} 109}
diff --git a/arch/arm/mach-mx5/board-mx51_babbage.c b/arch/arm/mach-mx5/board-mx51_babbage.c
index 15c600026ae..e400b09109c 100644
--- a/arch/arm/mach-mx5/board-mx51_babbage.c
+++ b/arch/arm/mach-mx5/board-mx51_babbage.c
@@ -41,8 +41,6 @@
41#define BABBAGE_POWER_KEY IMX_GPIO_NR(2, 21) 41#define BABBAGE_POWER_KEY IMX_GPIO_NR(2, 21)
42#define BABBAGE_ECSPI1_CS0 IMX_GPIO_NR(4, 24) 42#define BABBAGE_ECSPI1_CS0 IMX_GPIO_NR(4, 24)
43#define BABBAGE_ECSPI1_CS1 IMX_GPIO_NR(4, 25) 43#define BABBAGE_ECSPI1_CS1 IMX_GPIO_NR(4, 25)
44#define BABBAGE_SD1_CD IMX_GPIO_NR(1, 0)
45#define BABBAGE_SD1_WP IMX_GPIO_NR(1, 1)
46#define BABBAGE_SD2_CD IMX_GPIO_NR(1, 6) 44#define BABBAGE_SD2_CD IMX_GPIO_NR(1, 6)
47#define BABBAGE_SD2_WP IMX_GPIO_NR(1, 5) 45#define BABBAGE_SD2_WP IMX_GPIO_NR(1, 5)
48 46
@@ -146,8 +144,9 @@ static iomux_v3_cfg_t mx51babbage_pads[] = {
146 MX51_PAD_SD1_DATA1__SD1_DATA1, 144 MX51_PAD_SD1_DATA1__SD1_DATA1,
147 MX51_PAD_SD1_DATA2__SD1_DATA2, 145 MX51_PAD_SD1_DATA2__SD1_DATA2,
148 MX51_PAD_SD1_DATA3__SD1_DATA3, 146 MX51_PAD_SD1_DATA3__SD1_DATA3,
149 MX51_PAD_GPIO1_0__GPIO1_0, 147 /* CD/WP from controller */
150 MX51_PAD_GPIO1_1__GPIO1_1, 148 MX51_PAD_GPIO1_0__SD1_CD,
149 MX51_PAD_GPIO1_1__SD1_WP,
151 150
152 /* SD 2 */ 151 /* SD 2 */
153 MX51_PAD_SD2_CMD__SD2_CMD, 152 MX51_PAD_SD2_CMD__SD2_CMD,
@@ -156,6 +155,7 @@ static iomux_v3_cfg_t mx51babbage_pads[] = {
156 MX51_PAD_SD2_DATA1__SD2_DATA1, 155 MX51_PAD_SD2_DATA1__SD2_DATA1,
157 MX51_PAD_SD2_DATA2__SD2_DATA2, 156 MX51_PAD_SD2_DATA2__SD2_DATA2,
158 MX51_PAD_SD2_DATA3__SD2_DATA3, 157 MX51_PAD_SD2_DATA3__SD2_DATA3,
158 /* CD/WP gpio */
159 MX51_PAD_GPIO1_6__GPIO1_6, 159 MX51_PAD_GPIO1_6__GPIO1_6,
160 MX51_PAD_GPIO1_5__GPIO1_5, 160 MX51_PAD_GPIO1_5__GPIO1_5,
161 161
@@ -340,13 +340,15 @@ static const struct spi_imx_master mx51_babbage_spi_pdata __initconst = {
340}; 340};
341 341
342static const struct esdhc_platform_data mx51_babbage_sd1_data __initconst = { 342static const struct esdhc_platform_data mx51_babbage_sd1_data __initconst = {
343 .cd_gpio = BABBAGE_SD1_CD, 343 .cd_type = ESDHC_CD_CONTROLLER,
344 .wp_gpio = BABBAGE_SD1_WP, 344 .wp_type = ESDHC_WP_CONTROLLER,
345}; 345};
346 346
347static const struct esdhc_platform_data mx51_babbage_sd2_data __initconst = { 347static const struct esdhc_platform_data mx51_babbage_sd2_data __initconst = {
348 .cd_gpio = BABBAGE_SD2_CD, 348 .cd_gpio = BABBAGE_SD2_CD,
349 .wp_gpio = BABBAGE_SD2_WP, 349 .wp_gpio = BABBAGE_SD2_WP,
350 .cd_type = ESDHC_CD_GPIO,
351 .wp_type = ESDHC_WP_GPIO,
350}; 352};
351 353
352/* 354/*
diff --git a/arch/arm/mach-mx5/board-mx53_loco.c b/arch/arm/mach-mx5/board-mx53_loco.c
index 54be525e2bd..4e1d51d252d 100644
--- a/arch/arm/mach-mx5/board-mx53_loco.c
+++ b/arch/arm/mach-mx5/board-mx53_loco.c
@@ -210,11 +210,15 @@ static const struct gpio_keys_platform_data loco_button_data __initconst = {
210 210
211static const struct esdhc_platform_data mx53_loco_sd1_data __initconst = { 211static const struct esdhc_platform_data mx53_loco_sd1_data __initconst = {
212 .cd_gpio = LOCO_SD1_CD, 212 .cd_gpio = LOCO_SD1_CD,
213 .cd_type = ESDHC_CD_GPIO,
214 .wp_type = ESDHC_WP_NONE,
213}; 215};
214 216
215static const struct esdhc_platform_data mx53_loco_sd3_data __initconst = { 217static const struct esdhc_platform_data mx53_loco_sd3_data __initconst = {
216 .cd_gpio = LOCO_SD3_CD, 218 .cd_gpio = LOCO_SD3_CD,
217 .wp_gpio = LOCO_SD3_WP, 219 .wp_gpio = LOCO_SD3_WP,
220 .cd_type = ESDHC_CD_GPIO,
221 .wp_type = ESDHC_WP_GPIO,
218}; 222};
219 223
220static inline void mx53_loco_fec_reset(void) 224static inline void mx53_loco_fec_reset(void)
diff --git a/arch/arm/mach-mx5/clock-mx51-mx53.c b/arch/arm/mach-mx5/clock-mx51-mx53.c
index 23cd809fa8b..7f20308c4db 100644
--- a/arch/arm/mach-mx5/clock-mx51-mx53.c
+++ b/arch/arm/mach-mx5/clock-mx51-mx53.c
@@ -1422,11 +1422,13 @@ DEFINE_CLOCK(ipu_di1_clk, 0, MXC_CCM_CCGR6, MXC_CCM_CCGRx_CG6_OFFSET,
1422 }, 1422 },
1423 1423
1424static struct clk_lookup mx51_lookups[] = { 1424static struct clk_lookup mx51_lookups[] = {
1425 _REGISTER_CLOCK("imx-uart.0", NULL, uart1_clk) 1425 /* i.mx51 has the i.mx21 type uart */
1426 _REGISTER_CLOCK("imx-uart.1", NULL, uart2_clk) 1426 _REGISTER_CLOCK("imx21-uart.0", NULL, uart1_clk)
1427 _REGISTER_CLOCK("imx-uart.2", NULL, uart3_clk) 1427 _REGISTER_CLOCK("imx21-uart.1", NULL, uart2_clk)
1428 _REGISTER_CLOCK("imx21-uart.2", NULL, uart3_clk)
1428 _REGISTER_CLOCK(NULL, "gpt", gpt_clk) 1429 _REGISTER_CLOCK(NULL, "gpt", gpt_clk)
1429 _REGISTER_CLOCK("fec.0", NULL, fec_clk) 1430 /* i.mx51 has the i.mx27 type fec */
1431 _REGISTER_CLOCK("imx27-fec.0", NULL, fec_clk)
1430 _REGISTER_CLOCK("mxc_pwm.0", "pwm", pwm1_clk) 1432 _REGISTER_CLOCK("mxc_pwm.0", "pwm", pwm1_clk)
1431 _REGISTER_CLOCK("mxc_pwm.1", "pwm", pwm2_clk) 1433 _REGISTER_CLOCK("mxc_pwm.1", "pwm", pwm2_clk)
1432 _REGISTER_CLOCK("imx-i2c.0", NULL, i2c1_clk) 1434 _REGISTER_CLOCK("imx-i2c.0", NULL, i2c1_clk)
@@ -1446,7 +1448,8 @@ static struct clk_lookup mx51_lookups[] = {
1446 _REGISTER_CLOCK("imx-ssi.0", NULL, ssi1_clk) 1448 _REGISTER_CLOCK("imx-ssi.0", NULL, ssi1_clk)
1447 _REGISTER_CLOCK("imx-ssi.1", NULL, ssi2_clk) 1449 _REGISTER_CLOCK("imx-ssi.1", NULL, ssi2_clk)
1448 _REGISTER_CLOCK("imx-ssi.2", NULL, ssi3_clk) 1450 _REGISTER_CLOCK("imx-ssi.2", NULL, ssi3_clk)
1449 _REGISTER_CLOCK("imx-sdma", NULL, sdma_clk) 1451 /* i.mx51 has the i.mx35 type sdma */
1452 _REGISTER_CLOCK("imx35-sdma", NULL, sdma_clk)
1450 _REGISTER_CLOCK(NULL, "ckih", ckih_clk) 1453 _REGISTER_CLOCK(NULL, "ckih", ckih_clk)
1451 _REGISTER_CLOCK(NULL, "ckih2", ckih2_clk) 1454 _REGISTER_CLOCK(NULL, "ckih2", ckih2_clk)
1452 _REGISTER_CLOCK(NULL, "gpt_32k", gpt_32k_clk) 1455 _REGISTER_CLOCK(NULL, "gpt_32k", gpt_32k_clk)
@@ -1454,10 +1457,10 @@ static struct clk_lookup mx51_lookups[] = {
1454 _REGISTER_CLOCK("imx51-ecspi.1", NULL, ecspi2_clk) 1457 _REGISTER_CLOCK("imx51-ecspi.1", NULL, ecspi2_clk)
1455 /* i.mx51 has the i.mx35 type cspi */ 1458 /* i.mx51 has the i.mx35 type cspi */
1456 _REGISTER_CLOCK("imx35-cspi.0", NULL, cspi_clk) 1459 _REGISTER_CLOCK("imx35-cspi.0", NULL, cspi_clk)
1457 _REGISTER_CLOCK("sdhci-esdhc-imx.0", NULL, esdhc1_clk) 1460 _REGISTER_CLOCK("sdhci-esdhc-imx51.0", NULL, esdhc1_clk)
1458 _REGISTER_CLOCK("sdhci-esdhc-imx.1", NULL, esdhc2_clk) 1461 _REGISTER_CLOCK("sdhci-esdhc-imx51.1", NULL, esdhc2_clk)
1459 _REGISTER_CLOCK("sdhci-esdhc-imx.2", NULL, esdhc3_clk) 1462 _REGISTER_CLOCK("sdhci-esdhc-imx51.2", NULL, esdhc3_clk)
1460 _REGISTER_CLOCK("sdhci-esdhc-imx.3", NULL, esdhc4_clk) 1463 _REGISTER_CLOCK("sdhci-esdhc-imx51.3", NULL, esdhc4_clk)
1461 _REGISTER_CLOCK(NULL, "cpu_clk", cpu_clk) 1464 _REGISTER_CLOCK(NULL, "cpu_clk", cpu_clk)
1462 _REGISTER_CLOCK(NULL, "iim_clk", iim_clk) 1465 _REGISTER_CLOCK(NULL, "iim_clk", iim_clk)
1463 _REGISTER_CLOCK("imx2-wdt.0", NULL, dummy_clk) 1466 _REGISTER_CLOCK("imx2-wdt.0", NULL, dummy_clk)
@@ -1470,29 +1473,32 @@ static struct clk_lookup mx51_lookups[] = {
1470}; 1473};
1471 1474
1472static struct clk_lookup mx53_lookups[] = { 1475static struct clk_lookup mx53_lookups[] = {
1473 _REGISTER_CLOCK("imx-uart.0", NULL, uart1_clk) 1476 /* i.mx53 has the i.mx21 type uart */
1474 _REGISTER_CLOCK("imx-uart.1", NULL, uart2_clk) 1477 _REGISTER_CLOCK("imx21-uart.0", NULL, uart1_clk)
1475 _REGISTER_CLOCK("imx-uart.2", NULL, uart3_clk) 1478 _REGISTER_CLOCK("imx21-uart.1", NULL, uart2_clk)
1476 _REGISTER_CLOCK("imx-uart.3", NULL, uart4_clk) 1479 _REGISTER_CLOCK("imx21-uart.2", NULL, uart3_clk)
1477 _REGISTER_CLOCK("imx-uart.4", NULL, uart5_clk) 1480 _REGISTER_CLOCK("imx21-uart.3", NULL, uart4_clk)
1481 _REGISTER_CLOCK("imx21-uart.4", NULL, uart5_clk)
1478 _REGISTER_CLOCK(NULL, "gpt", gpt_clk) 1482 _REGISTER_CLOCK(NULL, "gpt", gpt_clk)
1479 _REGISTER_CLOCK("fec.0", NULL, fec_clk) 1483 /* i.mx53 has the i.mx25 type fec */
1484 _REGISTER_CLOCK("imx25-fec.0", NULL, fec_clk)
1480 _REGISTER_CLOCK(NULL, "iim_clk", iim_clk) 1485 _REGISTER_CLOCK(NULL, "iim_clk", iim_clk)
1481 _REGISTER_CLOCK("imx-i2c.0", NULL, i2c1_clk) 1486 _REGISTER_CLOCK("imx-i2c.0", NULL, i2c1_clk)
1482 _REGISTER_CLOCK("imx-i2c.1", NULL, i2c2_clk) 1487 _REGISTER_CLOCK("imx-i2c.1", NULL, i2c2_clk)
1483 _REGISTER_CLOCK("imx-i2c.2", NULL, i2c3_mx53_clk) 1488 _REGISTER_CLOCK("imx-i2c.2", NULL, i2c3_mx53_clk)
1484 _REGISTER_CLOCK("sdhci-esdhc-imx.0", NULL, esdhc1_clk)
1485 _REGISTER_CLOCK("sdhci-esdhc-imx.1", NULL, esdhc2_mx53_clk)
1486 _REGISTER_CLOCK("sdhci-esdhc-imx.2", NULL, esdhc3_mx53_clk)
1487 _REGISTER_CLOCK("sdhci-esdhc-imx.3", NULL, esdhc4_mx53_clk)
1488 /* i.mx53 has the i.mx51 type ecspi */ 1489 /* i.mx53 has the i.mx51 type ecspi */
1489 _REGISTER_CLOCK("imx51-ecspi.0", NULL, ecspi1_clk) 1490 _REGISTER_CLOCK("imx51-ecspi.0", NULL, ecspi1_clk)
1490 _REGISTER_CLOCK("imx51-ecspi.1", NULL, ecspi2_clk) 1491 _REGISTER_CLOCK("imx51-ecspi.1", NULL, ecspi2_clk)
1491 /* i.mx53 has the i.mx25 type cspi */ 1492 /* i.mx53 has the i.mx25 type cspi */
1492 _REGISTER_CLOCK("imx35-cspi.0", NULL, cspi_clk) 1493 _REGISTER_CLOCK("imx35-cspi.0", NULL, cspi_clk)
1494 _REGISTER_CLOCK("sdhci-esdhc-imx53.0", NULL, esdhc1_clk)
1495 _REGISTER_CLOCK("sdhci-esdhc-imx53.1", NULL, esdhc2_mx53_clk)
1496 _REGISTER_CLOCK("sdhci-esdhc-imx53.2", NULL, esdhc3_mx53_clk)
1497 _REGISTER_CLOCK("sdhci-esdhc-imx53.3", NULL, esdhc4_mx53_clk)
1493 _REGISTER_CLOCK("imx2-wdt.0", NULL, dummy_clk) 1498 _REGISTER_CLOCK("imx2-wdt.0", NULL, dummy_clk)
1494 _REGISTER_CLOCK("imx2-wdt.1", NULL, dummy_clk) 1499 _REGISTER_CLOCK("imx2-wdt.1", NULL, dummy_clk)
1495 _REGISTER_CLOCK("imx-sdma", NULL, sdma_clk) 1500 /* i.mx53 has the i.mx35 type sdma */
1501 _REGISTER_CLOCK("imx35-sdma", NULL, sdma_clk)
1496 _REGISTER_CLOCK("imx-ssi.0", NULL, ssi1_clk) 1502 _REGISTER_CLOCK("imx-ssi.0", NULL, ssi1_clk)
1497 _REGISTER_CLOCK("imx-ssi.1", NULL, ssi2_clk) 1503 _REGISTER_CLOCK("imx-ssi.1", NULL, ssi2_clk)
1498 _REGISTER_CLOCK("imx-ssi.2", NULL, ssi3_clk) 1504 _REGISTER_CLOCK("imx-ssi.2", NULL, ssi3_clk)
diff --git a/arch/arm/mach-mx5/mm.c b/arch/arm/mach-mx5/mm.c
index ef8aec9319b..baea6e5cddd 100644
--- a/arch/arm/mach-mx5/mm.c
+++ b/arch/arm/mach-mx5/mm.c
@@ -115,7 +115,6 @@ static struct sdma_script_start_addrs imx51_sdma_script __initdata = {
115}; 115};
116 116
117static struct sdma_platform_data imx51_sdma_pdata __initdata = { 117static struct sdma_platform_data imx51_sdma_pdata __initdata = {
118 .sdma_version = 2,
119 .fw_name = "sdma-imx51.bin", 118 .fw_name = "sdma-imx51.bin",
120 .script_addrs = &imx51_sdma_script, 119 .script_addrs = &imx51_sdma_script,
121}; 120};
@@ -135,7 +134,6 @@ static struct sdma_script_start_addrs imx53_sdma_script __initdata = {
135}; 134};
136 135
137static struct sdma_platform_data imx53_sdma_pdata __initdata = { 136static struct sdma_platform_data imx53_sdma_pdata __initdata = {
138 .sdma_version = 2,
139 .fw_name = "sdma-imx53.bin", 137 .fw_name = "sdma-imx53.bin",
140 .script_addrs = &imx53_sdma_script, 138 .script_addrs = &imx53_sdma_script,
141}; 139};
@@ -148,7 +146,8 @@ void __init imx51_soc_init(void)
148 mxc_register_gpio("imx31-gpio", 2, MX51_GPIO3_BASE_ADDR, SZ_16K, MX51_MXC_INT_GPIO3_LOW, MX51_MXC_INT_GPIO3_HIGH); 146 mxc_register_gpio("imx31-gpio", 2, MX51_GPIO3_BASE_ADDR, SZ_16K, MX51_MXC_INT_GPIO3_LOW, MX51_MXC_INT_GPIO3_HIGH);
149 mxc_register_gpio("imx31-gpio", 3, MX51_GPIO4_BASE_ADDR, SZ_16K, MX51_MXC_INT_GPIO4_LOW, MX51_MXC_INT_GPIO4_HIGH); 147 mxc_register_gpio("imx31-gpio", 3, MX51_GPIO4_BASE_ADDR, SZ_16K, MX51_MXC_INT_GPIO4_LOW, MX51_MXC_INT_GPIO4_HIGH);
150 148
151 imx_add_imx_sdma(MX51_SDMA_BASE_ADDR, MX51_INT_SDMA, &imx51_sdma_pdata); 149 /* i.mx51 has the i.mx35 type sdma */
150 imx_add_imx_sdma("imx35-sdma", MX51_SDMA_BASE_ADDR, MX51_INT_SDMA, &imx51_sdma_pdata);
152} 151}
153 152
154void __init imx53_soc_init(void) 153void __init imx53_soc_init(void)
@@ -162,5 +161,6 @@ void __init imx53_soc_init(void)
162 mxc_register_gpio("imx31-gpio", 5, MX53_GPIO6_BASE_ADDR, SZ_16K, MX53_INT_GPIO6_LOW, MX53_INT_GPIO6_HIGH); 161 mxc_register_gpio("imx31-gpio", 5, MX53_GPIO6_BASE_ADDR, SZ_16K, MX53_INT_GPIO6_LOW, MX53_INT_GPIO6_HIGH);
163 mxc_register_gpio("imx31-gpio", 6, MX53_GPIO7_BASE_ADDR, SZ_16K, MX53_INT_GPIO7_LOW, MX53_INT_GPIO7_HIGH); 162 mxc_register_gpio("imx31-gpio", 6, MX53_GPIO7_BASE_ADDR, SZ_16K, MX53_INT_GPIO7_LOW, MX53_INT_GPIO7_HIGH);
164 163
165 imx_add_imx_sdma(MX53_SDMA_BASE_ADDR, MX53_INT_SDMA, &imx53_sdma_pdata); 164 /* i.mx53 has the i.mx35 type sdma */
165 imx_add_imx_sdma("imx35-sdma", MX53_SDMA_BASE_ADDR, MX53_INT_SDMA, &imx53_sdma_pdata);
166} 166}
diff --git a/arch/arm/mach-mx5/mx51_efika.c b/arch/arm/mach-mx5/mx51_efika.c
index 56739c23aca..4435e03cea5 100644
--- a/arch/arm/mach-mx5/mx51_efika.c
+++ b/arch/arm/mach-mx5/mx51_efika.c
@@ -260,8 +260,8 @@ static struct regulator_consumer_supply vvideo_consumers[] = {
260}; 260};
261 261
262static struct regulator_consumer_supply vsd_consumers[] = { 262static struct regulator_consumer_supply vsd_consumers[] = {
263 REGULATOR_SUPPLY("vmmc", "sdhci-esdhc-imx.0"), 263 REGULATOR_SUPPLY("vmmc", "sdhci-esdhc-imx51.0"),
264 REGULATOR_SUPPLY("vmmc", "sdhci-esdhc-imx.1"), 264 REGULATOR_SUPPLY("vmmc", "sdhci-esdhc-imx51.1"),
265}; 265};
266 266
267static struct regulator_consumer_supply pwgt1_consumer[] = { 267static struct regulator_consumer_supply pwgt1_consumer[] = {
diff --git a/arch/arm/mach-tegra/Kconfig b/arch/arm/mach-tegra/Kconfig
index fec64f3aa68..d82ebab50e1 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
54config 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
54config MACH_TRIMSLICE 60config 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 ed58ef9019b..f11b9100114 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
29obj-${CONFIG_MACH_SEABOARD} += board-seaboard.o 29obj-${CONFIG_MACH_SEABOARD} += board-seaboard.o
30obj-${CONFIG_MACH_SEABOARD} += board-seaboard-pinmux.o 30obj-${CONFIG_MACH_SEABOARD} += board-seaboard-pinmux.o
31 31
32obj-${CONFIG_MACH_TEGRA_DT} += board-dt.o
33obj-${CONFIG_MACH_TEGRA_DT} += board-harmony-pinmux.o
34
32obj-${CONFIG_MACH_TRIMSLICE} += board-trimslice.o 35obj-${CONFIG_MACH_TRIMSLICE} += board-trimslice.o
33obj-${CONFIG_MACH_TRIMSLICE} += board-trimslice-pinmux.o 36obj-${CONFIG_MACH_TRIMSLICE} += board-trimslice-pinmux.o
diff --git a/arch/arm/mach-tegra/Makefile.boot b/arch/arm/mach-tegra/Makefile.boot
index db52d61a738..428ad122be0 100644
--- a/arch/arm/mach-tegra/Makefile.boot
+++ b/arch/arm/mach-tegra/Makefile.boot
@@ -1,3 +1,6 @@
1zreladdr-$(CONFIG_ARCH_TEGRA_2x_SOC) := 0x00008000 1zreladdr-$(CONFIG_ARCH_TEGRA_2x_SOC) := 0x00008000
2params_phys-$(CONFIG_ARCH_TEGRA_2x_SOC) := 0x00000100 2params_phys-$(CONFIG_ARCH_TEGRA_2x_SOC) := 0x00000100
3initrd_phys-$(CONFIG_ARCH_TEGRA_2x_SOC) := 0x00800000 3initrd_phys-$(CONFIG_ARCH_TEGRA_2x_SOC) := 0x00800000
4
5dtb-$(CONFIG_MACH_HARMONY) += tegra-harmony.dtb
6dtb-$(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 00000000000..9f47e04446f
--- /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
48void harmony_pinmux_init(void);
49void seaboard_pinmux_init(void);
50
51
52struct 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
67static __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
73static struct of_device_id tegra_dt_match_table[] __initdata = {
74 { .compatible = "simple-bus", },
75 {}
76};
77
78static struct of_device_id tegra_dt_gic_match[] __initdata = {
79 { .compatible = "nvidia,tegra20-gic", },
80 {}
81};
82
83static 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
106static const char * tegra_dt_board_compat[] = {
107 "nvidia,harmony",
108 "nvidia,seaboard",
109 NULL
110};
111
112DT_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,
119MACHINE_END
diff --git a/arch/arm/mach-versatile/Kconfig b/arch/arm/mach-versatile/Kconfig
index 9cdec5aa04a..c1f38f6625b 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
20config 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
20endmenu 28endmenu
diff --git a/arch/arm/mach-versatile/Makefile b/arch/arm/mach-versatile/Makefile
index 97cf4d831b0..81fa3fe25e1 100644
--- a/arch/arm/mach-versatile/Makefile
+++ b/arch/arm/mach-versatile/Makefile
@@ -5,4 +5,5 @@
5obj-y := core.o 5obj-y := core.o
6obj-$(CONFIG_ARCH_VERSATILE_PB) += versatile_pb.o 6obj-$(CONFIG_ARCH_VERSATILE_PB) += versatile_pb.o
7obj-$(CONFIG_MACH_VERSATILE_AB) += versatile_ab.o 7obj-$(CONFIG_MACH_VERSATILE_AB) += versatile_ab.o
8obj-$(CONFIG_MACH_VERSATILE_DT) += versatile_dt.o
8obj-$(CONFIG_PCI) += pci.o 9obj-$(CONFIG_PCI) += pci.o
diff --git a/arch/arm/mach-versatile/core.c b/arch/arm/mach-versatile/core.c
index 0c99cf076c6..e340a54251d 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 */
90static const struct of_device_id vic_of_match[] __initconst = {
91 { .compatible = "arm,versatile-vic", },
92 {}
93};
94
95static const struct of_device_id sic_of_match[] __initconst = {
96 { .compatible = "arm,versatile-sic", },
97 {}
98};
99
86void __init versatile_init_irq(void) 100void __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 */
672struct 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 fd6404e5d78..e01422700eb 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
27extern void __init versatile_init(void); 28extern void __init versatile_init(void);
28extern void __init versatile_init_early(void); 29extern void __init versatile_init_early(void);
@@ -30,6 +31,9 @@ extern void __init versatile_init_irq(void);
30extern void __init versatile_map_io(void); 31extern void __init versatile_map_io(void);
31extern struct sys_timer versatile_timer; 32extern struct sys_timer versatile_timer;
32extern unsigned int mmc_status(struct device *dev); 33extern unsigned int mmc_status(struct device *dev);
34#ifdef CONFIG_OF
35extern 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) \
35static struct amba_device name##_device = { \ 39static 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 00000000000..54e037c090f
--- /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
32static void __init versatile_dt_init(void)
33{
34 of_platform_populate(NULL, of_default_bus_match_table,
35 versatile_auxdata_lookup, NULL);
36}
37
38static const char *versatile_dt_match[] __initconst = {
39 "arm,versatile-ab",
40 "arm,versatile-pb",
41 NULL,
42};
43
44DT_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,
51MACHINE_END
diff --git a/arch/arm/plat-mxc/devices/platform-fec.c b/arch/arm/plat-mxc/devices/platform-fec.c
index 4fc6ffc2a13..0bae44e890d 100644
--- a/arch/arm/plat-mxc/devices/platform-fec.c
+++ b/arch/arm/plat-mxc/devices/platform-fec.c
@@ -11,40 +11,45 @@
11#include <mach/hardware.h> 11#include <mach/hardware.h>
12#include <mach/devices-common.h> 12#include <mach/devices-common.h>
13 13
14#define imx_fec_data_entry_single(soc) \ 14#define imx_fec_data_entry_single(soc, _devid) \
15 { \ 15 { \
16 .devid = _devid, \
16 .iobase = soc ## _FEC_BASE_ADDR, \ 17 .iobase = soc ## _FEC_BASE_ADDR, \
17 .irq = soc ## _INT_FEC, \ 18 .irq = soc ## _INT_FEC, \
18 } 19 }
19 20
20#ifdef CONFIG_SOC_IMX25 21#ifdef CONFIG_SOC_IMX25
21const struct imx_fec_data imx25_fec_data __initconst = 22const struct imx_fec_data imx25_fec_data __initconst =
22 imx_fec_data_entry_single(MX25); 23 imx_fec_data_entry_single(MX25, "imx25-fec");
23#endif /* ifdef CONFIG_SOC_IMX25 */ 24#endif /* ifdef CONFIG_SOC_IMX25 */
24 25
25#ifdef CONFIG_SOC_IMX27 26#ifdef CONFIG_SOC_IMX27
26const struct imx_fec_data imx27_fec_data __initconst = 27const struct imx_fec_data imx27_fec_data __initconst =
27 imx_fec_data_entry_single(MX27); 28 imx_fec_data_entry_single(MX27, "imx27-fec");
28#endif /* ifdef CONFIG_SOC_IMX27 */ 29#endif /* ifdef CONFIG_SOC_IMX27 */
29 30
30#ifdef CONFIG_SOC_IMX35 31#ifdef CONFIG_SOC_IMX35
32/* i.mx35 has the i.mx27 type fec */
31const struct imx_fec_data imx35_fec_data __initconst = 33const struct imx_fec_data imx35_fec_data __initconst =
32 imx_fec_data_entry_single(MX35); 34 imx_fec_data_entry_single(MX35, "imx27-fec");
33#endif 35#endif
34 36
35#ifdef CONFIG_SOC_IMX50 37#ifdef CONFIG_SOC_IMX50
38/* i.mx50 has the i.mx25 type fec */
36const struct imx_fec_data imx50_fec_data __initconst = 39const struct imx_fec_data imx50_fec_data __initconst =
37 imx_fec_data_entry_single(MX50); 40 imx_fec_data_entry_single(MX50, "imx25-fec");
38#endif 41#endif
39 42
40#ifdef CONFIG_SOC_IMX51 43#ifdef CONFIG_SOC_IMX51
44/* i.mx51 has the i.mx27 type fec */
41const struct imx_fec_data imx51_fec_data __initconst = 45const struct imx_fec_data imx51_fec_data __initconst =
42 imx_fec_data_entry_single(MX51); 46 imx_fec_data_entry_single(MX51, "imx27-fec");
43#endif 47#endif
44 48
45#ifdef CONFIG_SOC_IMX53 49#ifdef CONFIG_SOC_IMX53
50/* i.mx53 has the i.mx25 type fec */
46const struct imx_fec_data imx53_fec_data __initconst = 51const struct imx_fec_data imx53_fec_data __initconst =
47 imx_fec_data_entry_single(MX53); 52 imx_fec_data_entry_single(MX53, "imx25-fec");
48#endif 53#endif
49 54
50struct platform_device *__init imx_add_fec( 55struct platform_device *__init imx_add_fec(
@@ -63,7 +68,7 @@ struct platform_device *__init imx_add_fec(
63 }, 68 },
64 }; 69 };
65 70
66 return imx_add_platform_device_dmamask("fec", 0, 71 return imx_add_platform_device_dmamask(data->devid, 0,
67 res, ARRAY_SIZE(res), 72 res, ARRAY_SIZE(res),
68 pdata, sizeof(*pdata), DMA_BIT_MASK(32)); 73 pdata, sizeof(*pdata), DMA_BIT_MASK(32));
69} 74}
diff --git a/arch/arm/plat-mxc/devices/platform-imx-dma.c b/arch/arm/plat-mxc/devices/platform-imx-dma.c
index 2b0fdb23beb..7fa7e9c9246 100644
--- a/arch/arm/plat-mxc/devices/platform-imx-dma.c
+++ b/arch/arm/plat-mxc/devices/platform-imx-dma.c
@@ -14,7 +14,7 @@ struct platform_device __init __maybe_unused *imx_add_imx_dma(void)
14 "imx-dma", -1, NULL, 0, NULL, 0); 14 "imx-dma", -1, NULL, 0, NULL, 0);
15} 15}
16 16
17struct platform_device __init __maybe_unused *imx_add_imx_sdma( 17struct platform_device __init __maybe_unused *imx_add_imx_sdma(char *name,
18 resource_size_t iobase, int irq, struct sdma_platform_data *pdata) 18 resource_size_t iobase, int irq, struct sdma_platform_data *pdata)
19{ 19{
20 struct resource res[] = { 20 struct resource res[] = {
@@ -29,6 +29,6 @@ struct platform_device __init __maybe_unused *imx_add_imx_sdma(
29 }, 29 },
30 }; 30 };
31 31
32 return platform_device_register_resndata(&mxc_ahb_bus, "imx-sdma", 32 return platform_device_register_resndata(&mxc_ahb_bus, name,
33 -1, res, ARRAY_SIZE(res), pdata, sizeof(*pdata)); 33 -1, res, ARRAY_SIZE(res), pdata, sizeof(*pdata));
34} 34}
diff --git a/arch/arm/plat-mxc/devices/platform-imx-uart.c b/arch/arm/plat-mxc/devices/platform-imx-uart.c
index cfce8c918b7..2020d84956c 100644
--- a/arch/arm/plat-mxc/devices/platform-imx-uart.c
+++ b/arch/arm/plat-mxc/devices/platform-imx-uart.c
@@ -152,7 +152,7 @@ struct platform_device *__init imx_add_imx_uart_3irq(
152 }, 152 },
153 }; 153 };
154 154
155 return imx_add_platform_device("imx-uart", data->id, res, 155 return imx_add_platform_device("imx1-uart", data->id, res,
156 ARRAY_SIZE(res), pdata, sizeof(*pdata)); 156 ARRAY_SIZE(res), pdata, sizeof(*pdata));
157} 157}
158 158
@@ -172,6 +172,7 @@ struct platform_device *__init imx_add_imx_uart_1irq(
172 }, 172 },
173 }; 173 };
174 174
175 return imx_add_platform_device("imx-uart", data->id, res, ARRAY_SIZE(res), 175 /* i.mx21 type uart runs on all i.mx except i.mx1 */
176 pdata, sizeof(*pdata)); 176 return imx_add_platform_device("imx21-uart", data->id,
177 res, ARRAY_SIZE(res), pdata, sizeof(*pdata));
177} 178}
diff --git a/arch/arm/plat-mxc/devices/platform-sdhci-esdhc-imx.c b/arch/arm/plat-mxc/devices/platform-sdhci-esdhc-imx.c
index 6b2940b93d9..5955f5da82e 100644
--- a/arch/arm/plat-mxc/devices/platform-sdhci-esdhc-imx.c
+++ b/arch/arm/plat-mxc/devices/platform-sdhci-esdhc-imx.c
@@ -10,21 +10,22 @@
10#include <mach/devices-common.h> 10#include <mach/devices-common.h>
11#include <mach/esdhc.h> 11#include <mach/esdhc.h>
12 12
13#define imx_sdhci_esdhc_imx_data_entry_single(soc, _id, hwid) \ 13#define imx_sdhci_esdhc_imx_data_entry_single(soc, _devid, _id, hwid) \
14 { \ 14 { \
15 .devid = _devid, \
15 .id = _id, \ 16 .id = _id, \
16 .iobase = soc ## _ESDHC ## hwid ## _BASE_ADDR, \ 17 .iobase = soc ## _ESDHC ## hwid ## _BASE_ADDR, \
17 .irq = soc ## _INT_ESDHC ## hwid, \ 18 .irq = soc ## _INT_ESDHC ## hwid, \
18 } 19 }
19 20
20#define imx_sdhci_esdhc_imx_data_entry(soc, id, hwid) \ 21#define imx_sdhci_esdhc_imx_data_entry(soc, devid, id, hwid) \
21 [id] = imx_sdhci_esdhc_imx_data_entry_single(soc, id, hwid) 22 [id] = imx_sdhci_esdhc_imx_data_entry_single(soc, devid, id, hwid)
22 23
23#ifdef CONFIG_SOC_IMX25 24#ifdef CONFIG_SOC_IMX25
24const struct imx_sdhci_esdhc_imx_data 25const struct imx_sdhci_esdhc_imx_data
25imx25_sdhci_esdhc_imx_data[] __initconst = { 26imx25_sdhci_esdhc_imx_data[] __initconst = {
26#define imx25_sdhci_esdhc_imx_data_entry(_id, _hwid) \ 27#define imx25_sdhci_esdhc_imx_data_entry(_id, _hwid) \
27 imx_sdhci_esdhc_imx_data_entry(MX25, _id, _hwid) 28 imx_sdhci_esdhc_imx_data_entry(MX25, "sdhci-esdhc-imx25", _id, _hwid)
28 imx25_sdhci_esdhc_imx_data_entry(0, 1), 29 imx25_sdhci_esdhc_imx_data_entry(0, 1),
29 imx25_sdhci_esdhc_imx_data_entry(1, 2), 30 imx25_sdhci_esdhc_imx_data_entry(1, 2),
30}; 31};
@@ -34,7 +35,7 @@ imx25_sdhci_esdhc_imx_data[] __initconst = {
34const struct imx_sdhci_esdhc_imx_data 35const struct imx_sdhci_esdhc_imx_data
35imx35_sdhci_esdhc_imx_data[] __initconst = { 36imx35_sdhci_esdhc_imx_data[] __initconst = {
36#define imx35_sdhci_esdhc_imx_data_entry(_id, _hwid) \ 37#define imx35_sdhci_esdhc_imx_data_entry(_id, _hwid) \
37 imx_sdhci_esdhc_imx_data_entry(MX35, _id, _hwid) 38 imx_sdhci_esdhc_imx_data_entry(MX35, "sdhci-esdhc-imx35", _id, _hwid)
38 imx35_sdhci_esdhc_imx_data_entry(0, 1), 39 imx35_sdhci_esdhc_imx_data_entry(0, 1),
39 imx35_sdhci_esdhc_imx_data_entry(1, 2), 40 imx35_sdhci_esdhc_imx_data_entry(1, 2),
40 imx35_sdhci_esdhc_imx_data_entry(2, 3), 41 imx35_sdhci_esdhc_imx_data_entry(2, 3),
@@ -45,7 +46,7 @@ imx35_sdhci_esdhc_imx_data[] __initconst = {
45const struct imx_sdhci_esdhc_imx_data 46const struct imx_sdhci_esdhc_imx_data
46imx51_sdhci_esdhc_imx_data[] __initconst = { 47imx51_sdhci_esdhc_imx_data[] __initconst = {
47#define imx51_sdhci_esdhc_imx_data_entry(_id, _hwid) \ 48#define imx51_sdhci_esdhc_imx_data_entry(_id, _hwid) \
48 imx_sdhci_esdhc_imx_data_entry(MX51, _id, _hwid) 49 imx_sdhci_esdhc_imx_data_entry(MX51, "sdhci-esdhc-imx51", _id, _hwid)
49 imx51_sdhci_esdhc_imx_data_entry(0, 1), 50 imx51_sdhci_esdhc_imx_data_entry(0, 1),
50 imx51_sdhci_esdhc_imx_data_entry(1, 2), 51 imx51_sdhci_esdhc_imx_data_entry(1, 2),
51 imx51_sdhci_esdhc_imx_data_entry(2, 3), 52 imx51_sdhci_esdhc_imx_data_entry(2, 3),
@@ -57,7 +58,7 @@ imx51_sdhci_esdhc_imx_data[] __initconst = {
57const struct imx_sdhci_esdhc_imx_data 58const struct imx_sdhci_esdhc_imx_data
58imx53_sdhci_esdhc_imx_data[] __initconst = { 59imx53_sdhci_esdhc_imx_data[] __initconst = {
59#define imx53_sdhci_esdhc_imx_data_entry(_id, _hwid) \ 60#define imx53_sdhci_esdhc_imx_data_entry(_id, _hwid) \
60 imx_sdhci_esdhc_imx_data_entry(MX53, _id, _hwid) 61 imx_sdhci_esdhc_imx_data_entry(MX53, "sdhci-esdhc-imx53", _id, _hwid)
61 imx53_sdhci_esdhc_imx_data_entry(0, 1), 62 imx53_sdhci_esdhc_imx_data_entry(0, 1),
62 imx53_sdhci_esdhc_imx_data_entry(1, 2), 63 imx53_sdhci_esdhc_imx_data_entry(1, 2),
63 imx53_sdhci_esdhc_imx_data_entry(2, 3), 64 imx53_sdhci_esdhc_imx_data_entry(2, 3),
@@ -65,6 +66,11 @@ imx53_sdhci_esdhc_imx_data[] __initconst = {
65}; 66};
66#endif /* ifdef CONFIG_SOC_IMX53 */ 67#endif /* ifdef CONFIG_SOC_IMX53 */
67 68
69static const struct esdhc_platform_data default_esdhc_pdata __initconst = {
70 .wp_type = ESDHC_WP_NONE,
71 .cd_type = ESDHC_CD_NONE,
72};
73
68struct platform_device *__init imx_add_sdhci_esdhc_imx( 74struct platform_device *__init imx_add_sdhci_esdhc_imx(
69 const struct imx_sdhci_esdhc_imx_data *data, 75 const struct imx_sdhci_esdhc_imx_data *data,
70 const struct esdhc_platform_data *pdata) 76 const struct esdhc_platform_data *pdata)
@@ -81,6 +87,13 @@ struct platform_device *__init imx_add_sdhci_esdhc_imx(
81 }, 87 },
82 }; 88 };
83 89
84 return imx_add_platform_device("sdhci-esdhc-imx", data->id, res, 90 /*
91 * If machine does not provide pdata, use the default one
92 * which means no WP/CD support
93 */
94 if (!pdata)
95 pdata = &default_esdhc_pdata;
96
97 return imx_add_platform_device(data->devid, data->id, res,
85 ARRAY_SIZE(res), pdata, sizeof(*pdata)); 98 ARRAY_SIZE(res), pdata, sizeof(*pdata));
86} 99}
diff --git a/arch/arm/plat-mxc/include/mach/devices-common.h b/arch/arm/plat-mxc/include/mach/devices-common.h
index bf93820ab61..524538aabc4 100644
--- a/arch/arm/plat-mxc/include/mach/devices-common.h
+++ b/arch/arm/plat-mxc/include/mach/devices-common.h
@@ -30,6 +30,7 @@ static inline struct platform_device *imx_add_platform_device(
30 30
31#include <linux/fec.h> 31#include <linux/fec.h>
32struct imx_fec_data { 32struct imx_fec_data {
33 const char *devid;
33 resource_size_t iobase; 34 resource_size_t iobase;
34 resource_size_t irq; 35 resource_size_t irq;
35}; 36};
@@ -276,6 +277,7 @@ struct platform_device *__init imx_add_mxc_w1(
276 277
277#include <mach/esdhc.h> 278#include <mach/esdhc.h>
278struct imx_sdhci_esdhc_imx_data { 279struct imx_sdhci_esdhc_imx_data {
280 const char *devid;
279 int id; 281 int id;
280 resource_size_t iobase; 282 resource_size_t iobase;
281 resource_size_t irq; 283 resource_size_t irq;
@@ -297,5 +299,5 @@ struct platform_device *__init imx_add_spi_imx(
297 const struct spi_imx_master *pdata); 299 const struct spi_imx_master *pdata);
298 300
299struct platform_device *imx_add_imx_dma(void); 301struct platform_device *imx_add_imx_dma(void);
300struct platform_device *imx_add_imx_sdma( 302struct platform_device *imx_add_imx_sdma(char *name,
301 resource_size_t iobase, int irq, struct sdma_platform_data *pdata); 303 resource_size_t iobase, int irq, struct sdma_platform_data *pdata);
diff --git a/arch/arm/plat-mxc/include/mach/dma.h b/arch/arm/plat-mxc/include/mach/dma.h
index ef7751546f5..233d0a5e2d6 100644
--- a/arch/arm/plat-mxc/include/mach/dma.h
+++ b/arch/arm/plat-mxc/include/mach/dma.h
@@ -60,7 +60,8 @@ static inline int imx_dma_is_ipu(struct dma_chan *chan)
60 60
61static inline int imx_dma_is_general_purpose(struct dma_chan *chan) 61static inline int imx_dma_is_general_purpose(struct dma_chan *chan)
62{ 62{
63 return !strcmp(dev_name(chan->device->dev), "imx-sdma") || 63 return !strcmp(dev_name(chan->device->dev), "imx31-sdma") ||
64 !strcmp(dev_name(chan->device->dev), "imx35-sdma") ||
64 !strcmp(dev_name(chan->device->dev), "imx-dma"); 65 !strcmp(dev_name(chan->device->dev), "imx-dma");
65} 66}
66 67
diff --git a/arch/arm/plat-mxc/include/mach/esdhc.h b/arch/arm/plat-mxc/include/mach/esdhc.h
index 86003f41175..aaf97481f41 100644
--- a/arch/arm/plat-mxc/include/mach/esdhc.h
+++ b/arch/arm/plat-mxc/include/mach/esdhc.h
@@ -10,17 +10,34 @@
10#ifndef __ASM_ARCH_IMX_ESDHC_H 10#ifndef __ASM_ARCH_IMX_ESDHC_H
11#define __ASM_ARCH_IMX_ESDHC_H 11#define __ASM_ARCH_IMX_ESDHC_H
12 12
13enum wp_types {
14 ESDHC_WP_NONE, /* no WP, neither controller nor gpio */
15 ESDHC_WP_CONTROLLER, /* mmc controller internal WP */
16 ESDHC_WP_GPIO, /* external gpio pin for WP */
17};
18
19enum cd_types {
20 ESDHC_CD_NONE, /* no CD, neither controller nor gpio */
21 ESDHC_CD_CONTROLLER, /* mmc controller internal CD */
22 ESDHC_CD_GPIO, /* external gpio pin for CD */
23 ESDHC_CD_PERMANENT, /* no CD, card permanently wired to host */
24};
25
13/** 26/**
14 * struct esdhc_platform_data - optional platform data for esdhc on i.MX 27 * struct esdhc_platform_data - platform data for esdhc on i.MX
15 * 28 *
16 * strongly recommended for i.MX25/35, not needed for other variants 29 * ESDHC_WP(CD)_CONTROLLER type is not available on i.MX25/35.
17 * 30 *
18 * @wp_gpio: gpio for write_protect (-EINVAL if unused) 31 * @wp_gpio: gpio for write_protect
19 * @cd_gpio: gpio for card_detect interrupt (-EINVAL if unused) 32 * @cd_gpio: gpio for card_detect interrupt
33 * @wp_type: type of write_protect method (see wp_types enum above)
34 * @cd_type: type of card_detect method (see cd_types enum above)
20 */ 35 */
21 36
22struct esdhc_platform_data { 37struct esdhc_platform_data {
23 unsigned int wp_gpio; 38 unsigned int wp_gpio;
24 unsigned int cd_gpio; 39 unsigned int cd_gpio;
40 enum wp_types wp_type;
41 enum cd_types cd_type;
25}; 42};
26#endif /* __ASM_ARCH_IMX_ESDHC_H */ 43#endif /* __ASM_ARCH_IMX_ESDHC_H */
diff --git a/arch/arm/plat-mxc/include/mach/sdma.h b/arch/arm/plat-mxc/include/mach/sdma.h
index f495c87c113..3a3942823c2 100644
--- a/arch/arm/plat-mxc/include/mach/sdma.h
+++ b/arch/arm/plat-mxc/include/mach/sdma.h
@@ -48,12 +48,10 @@ struct sdma_script_start_addrs {
48/** 48/**
49 * struct sdma_platform_data - platform specific data for SDMA engine 49 * struct sdma_platform_data - platform specific data for SDMA engine
50 * 50 *
51 * @sdma_version The version of this SDMA engine
52 * @fw_name The firmware name 51 * @fw_name The firmware name
53 * @script_addrs SDMA scripts addresses in SDMA ROM 52 * @script_addrs SDMA scripts addresses in SDMA ROM
54 */ 53 */
55struct sdma_platform_data { 54struct sdma_platform_data {
56 int sdma_version;
57 char *fw_name; 55 char *fw_name;
58 struct sdma_script_start_addrs *script_addrs; 56 struct sdma_script_start_addrs *script_addrs;
59}; 57};
diff --git a/drivers/dma/imx-sdma.c b/drivers/dma/imx-sdma.c
index 1ea47db2ff0..1eb60ded2f0 100644
--- a/drivers/dma/imx-sdma.c
+++ b/drivers/dma/imx-sdma.c
@@ -32,6 +32,8 @@
32#include <linux/slab.h> 32#include <linux/slab.h>
33#include <linux/platform_device.h> 33#include <linux/platform_device.h>
34#include <linux/dmaengine.h> 34#include <linux/dmaengine.h>
35#include <linux/of.h>
36#include <linux/of_device.h>
35 37
36#include <asm/irq.h> 38#include <asm/irq.h>
37#include <mach/sdma.h> 39#include <mach/sdma.h>
@@ -65,8 +67,8 @@
65#define SDMA_ONCE_RTB 0x060 67#define SDMA_ONCE_RTB 0x060
66#define SDMA_XTRIG_CONF1 0x070 68#define SDMA_XTRIG_CONF1 0x070
67#define SDMA_XTRIG_CONF2 0x074 69#define SDMA_XTRIG_CONF2 0x074
68#define SDMA_CHNENBL0_V2 0x200 70#define SDMA_CHNENBL0_IMX35 0x200
69#define SDMA_CHNENBL0_V1 0x080 71#define SDMA_CHNENBL0_IMX31 0x080
70#define SDMA_CHNPRI_0 0x100 72#define SDMA_CHNPRI_0 0x100
71 73
72/* 74/*
@@ -299,13 +301,18 @@ struct sdma_firmware_header {
299 u32 ram_code_size; 301 u32 ram_code_size;
300}; 302};
301 303
304enum sdma_devtype {
305 IMX31_SDMA, /* runs on i.mx31 */
306 IMX35_SDMA, /* runs on i.mx35 and later */
307};
308
302struct sdma_engine { 309struct sdma_engine {
303 struct device *dev; 310 struct device *dev;
304 struct device_dma_parameters dma_parms; 311 struct device_dma_parameters dma_parms;
305 struct sdma_channel channel[MAX_DMA_CHANNELS]; 312 struct sdma_channel channel[MAX_DMA_CHANNELS];
306 struct sdma_channel_control *channel_control; 313 struct sdma_channel_control *channel_control;
307 void __iomem *regs; 314 void __iomem *regs;
308 unsigned int version; 315 enum sdma_devtype devtype;
309 unsigned int num_events; 316 unsigned int num_events;
310 struct sdma_context_data *context; 317 struct sdma_context_data *context;
311 dma_addr_t context_phys; 318 dma_addr_t context_phys;
@@ -314,6 +321,26 @@ struct sdma_engine {
314 struct sdma_script_start_addrs *script_addrs; 321 struct sdma_script_start_addrs *script_addrs;
315}; 322};
316 323
324static struct platform_device_id sdma_devtypes[] = {
325 {
326 .name = "imx31-sdma",
327 .driver_data = IMX31_SDMA,
328 }, {
329 .name = "imx35-sdma",
330 .driver_data = IMX35_SDMA,
331 }, {
332 /* sentinel */
333 }
334};
335MODULE_DEVICE_TABLE(platform, sdma_devtypes);
336
337static const struct of_device_id sdma_dt_ids[] = {
338 { .compatible = "fsl,imx31-sdma", .data = &sdma_devtypes[IMX31_SDMA], },
339 { .compatible = "fsl,imx35-sdma", .data = &sdma_devtypes[IMX35_SDMA], },
340 { /* sentinel */ }
341};
342MODULE_DEVICE_TABLE(of, sdma_dt_ids);
343
317#define SDMA_H_CONFIG_DSPDMA (1 << 12) /* indicates if the DSPDMA is used */ 344#define SDMA_H_CONFIG_DSPDMA (1 << 12) /* indicates if the DSPDMA is used */
318#define SDMA_H_CONFIG_RTD_PINS (1 << 11) /* indicates if Real-Time Debug pins are enabled */ 345#define SDMA_H_CONFIG_RTD_PINS (1 << 11) /* indicates if Real-Time Debug pins are enabled */
319#define SDMA_H_CONFIG_ACR (1 << 4) /* indicates if AHB freq /core freq = 2 or 1 */ 346#define SDMA_H_CONFIG_ACR (1 << 4) /* indicates if AHB freq /core freq = 2 or 1 */
@@ -321,8 +348,8 @@ struct sdma_engine {
321 348
322static inline u32 chnenbl_ofs(struct sdma_engine *sdma, unsigned int event) 349static inline u32 chnenbl_ofs(struct sdma_engine *sdma, unsigned int event)
323{ 350{
324 u32 chnenbl0 = (sdma->version == 2 ? SDMA_CHNENBL0_V2 : SDMA_CHNENBL0_V1); 351 u32 chnenbl0 = (sdma->devtype == IMX31_SDMA ? SDMA_CHNENBL0_IMX31 :
325 352 SDMA_CHNENBL0_IMX35);
326 return chnenbl0 + event * 4; 353 return chnenbl0 + event * 4;
327} 354}
328 355
@@ -1108,22 +1135,14 @@ static int __init sdma_get_firmware(struct sdma_engine *sdma,
1108 const char *fw_name) 1135 const char *fw_name)
1109{ 1136{
1110 const struct firmware *fw; 1137 const struct firmware *fw;
1111 char *fwname;
1112 const struct sdma_firmware_header *header; 1138 const struct sdma_firmware_header *header;
1113 int ret; 1139 int ret;
1114 const struct sdma_script_start_addrs *addr; 1140 const struct sdma_script_start_addrs *addr;
1115 unsigned short *ram_code; 1141 unsigned short *ram_code;
1116 1142
1117 fwname = kasprintf(GFP_KERNEL, "%s", fw_name); 1143 ret = request_firmware(&fw, fw_name, sdma->dev);
1118 if (!fwname) 1144 if (ret)
1119 return -ENOMEM;
1120
1121 ret = request_firmware(&fw, fwname, sdma->dev);
1122 if (ret) {
1123 kfree(fwname);
1124 return ret; 1145 return ret;
1125 }
1126 kfree(fwname);
1127 1146
1128 if (fw->size < sizeof(*header)) 1147 if (fw->size < sizeof(*header))
1129 goto err_firmware; 1148 goto err_firmware;
@@ -1162,15 +1181,16 @@ static int __init sdma_init(struct sdma_engine *sdma)
1162 int i, ret; 1181 int i, ret;
1163 dma_addr_t ccb_phys; 1182 dma_addr_t ccb_phys;
1164 1183
1165 switch (sdma->version) { 1184 switch (sdma->devtype) {
1166 case 1: 1185 case IMX31_SDMA:
1167 sdma->num_events = 32; 1186 sdma->num_events = 32;
1168 break; 1187 break;
1169 case 2: 1188 case IMX35_SDMA:
1170 sdma->num_events = 48; 1189 sdma->num_events = 48;
1171 break; 1190 break;
1172 default: 1191 default:
1173 dev_err(sdma->dev, "Unknown version %d. aborting\n", sdma->version); 1192 dev_err(sdma->dev, "Unknown sdma type %d. aborting\n",
1193 sdma->devtype);
1174 return -ENODEV; 1194 return -ENODEV;
1175 } 1195 }
1176 1196
@@ -1239,6 +1259,10 @@ err_dma_alloc:
1239 1259
1240static int __init sdma_probe(struct platform_device *pdev) 1260static int __init sdma_probe(struct platform_device *pdev)
1241{ 1261{
1262 const struct of_device_id *of_id =
1263 of_match_device(sdma_dt_ids, &pdev->dev);
1264 struct device_node *np = pdev->dev.of_node;
1265 const char *fw_name;
1242 int ret; 1266 int ret;
1243 int irq; 1267 int irq;
1244 struct resource *iores; 1268 struct resource *iores;
@@ -1254,7 +1278,7 @@ static int __init sdma_probe(struct platform_device *pdev)
1254 1278
1255 iores = platform_get_resource(pdev, IORESOURCE_MEM, 0); 1279 iores = platform_get_resource(pdev, IORESOURCE_MEM, 0);
1256 irq = platform_get_irq(pdev, 0); 1280 irq = platform_get_irq(pdev, 0);
1257 if (!iores || irq < 0 || !pdata) { 1281 if (!iores || irq < 0) {
1258 ret = -EINVAL; 1282 ret = -EINVAL;
1259 goto err_irq; 1283 goto err_irq;
1260 } 1284 }
@@ -1284,7 +1308,9 @@ static int __init sdma_probe(struct platform_device *pdev)
1284 if (!sdma->script_addrs) 1308 if (!sdma->script_addrs)
1285 goto err_alloc; 1309 goto err_alloc;
1286 1310
1287 sdma->version = pdata->sdma_version; 1311 if (of_id)
1312 pdev->id_entry = of_id->data;
1313 sdma->devtype = pdev->id_entry->driver_data;
1288 1314
1289 dma_cap_set(DMA_SLAVE, sdma->dma_device.cap_mask); 1315 dma_cap_set(DMA_SLAVE, sdma->dma_device.cap_mask);
1290 dma_cap_set(DMA_CYCLIC, sdma->dma_device.cap_mask); 1316 dma_cap_set(DMA_CYCLIC, sdma->dma_device.cap_mask);
@@ -1314,10 +1340,30 @@ static int __init sdma_probe(struct platform_device *pdev)
1314 if (ret) 1340 if (ret)
1315 goto err_init; 1341 goto err_init;
1316 1342
1317 if (pdata->script_addrs) 1343 if (pdata && pdata->script_addrs)
1318 sdma_add_scripts(sdma, pdata->script_addrs); 1344 sdma_add_scripts(sdma, pdata->script_addrs);
1319 1345
1320 sdma_get_firmware(sdma, pdata->fw_name); 1346 if (pdata) {
1347 sdma_get_firmware(sdma, pdata->fw_name);
1348 } else {
1349 /*
1350 * Because that device tree does not encode ROM script address,
1351 * the RAM script in firmware is mandatory for device tree
1352 * probe, otherwise it fails.
1353 */
1354 ret = of_property_read_string(np, "fsl,sdma-ram-script-name",
1355 &fw_name);
1356 if (ret) {
1357 dev_err(&pdev->dev, "failed to get firmware name\n");
1358 goto err_init;
1359 }
1360
1361 ret = sdma_get_firmware(sdma, fw_name);
1362 if (ret) {
1363 dev_err(&pdev->dev, "failed to get firmware\n");
1364 goto err_init;
1365 }
1366 }
1321 1367
1322 sdma->dma_device.dev = &pdev->dev; 1368 sdma->dma_device.dev = &pdev->dev;
1323 1369
@@ -1365,7 +1411,9 @@ static int __exit sdma_remove(struct platform_device *pdev)
1365static struct platform_driver sdma_driver = { 1411static struct platform_driver sdma_driver = {
1366 .driver = { 1412 .driver = {
1367 .name = "imx-sdma", 1413 .name = "imx-sdma",
1414 .of_match_table = sdma_dt_ids,
1368 }, 1415 },
1416 .id_table = sdma_devtypes,
1369 .remove = __exit_p(sdma_remove), 1417 .remove = __exit_p(sdma_remove),
1370}; 1418};
1371 1419
diff --git a/drivers/mmc/host/sdhci-esdhc-imx.c b/drivers/mmc/host/sdhci-esdhc-imx.c
index 710b706f4fc..9ebfb4b482f 100644
--- a/drivers/mmc/host/sdhci-esdhc-imx.c
+++ b/drivers/mmc/host/sdhci-esdhc-imx.c
@@ -20,7 +20,9 @@
20#include <linux/mmc/host.h> 20#include <linux/mmc/host.h>
21#include <linux/mmc/mmc.h> 21#include <linux/mmc/mmc.h>
22#include <linux/mmc/sdio.h> 22#include <linux/mmc/sdio.h>
23#include <mach/hardware.h> 23#include <linux/of.h>
24#include <linux/of_device.h>
25#include <linux/of_gpio.h>
24#include <mach/esdhc.h> 26#include <mach/esdhc.h>
25#include "sdhci-pltfm.h" 27#include "sdhci-pltfm.h"
26#include "sdhci-esdhc.h" 28#include "sdhci-esdhc.h"
@@ -29,7 +31,6 @@
29#define SDHCI_VENDOR_SPEC 0xC0 31#define SDHCI_VENDOR_SPEC 0xC0
30#define SDHCI_VENDOR_SPEC_SDIO_QUIRK 0x00000002 32#define SDHCI_VENDOR_SPEC_SDIO_QUIRK 0x00000002
31 33
32#define ESDHC_FLAG_GPIO_FOR_CD (1 << 0)
33/* 34/*
34 * The CMDTYPE of the CMD register (offset 0xE) should be set to 35 * The CMDTYPE of the CMD register (offset 0xE) should be set to
35 * "11" when the STOP CMD12 is issued on imx53 to abort one 36 * "11" when the STOP CMD12 is issued on imx53 to abort one
@@ -43,10 +44,67 @@
43 */ 44 */
44#define ESDHC_FLAG_MULTIBLK_NO_INT (1 << 1) 45#define ESDHC_FLAG_MULTIBLK_NO_INT (1 << 1)
45 46
47enum imx_esdhc_type {
48 IMX25_ESDHC,
49 IMX35_ESDHC,
50 IMX51_ESDHC,
51 IMX53_ESDHC,
52};
53
46struct pltfm_imx_data { 54struct pltfm_imx_data {
47 int flags; 55 int flags;
48 u32 scratchpad; 56 u32 scratchpad;
57 enum imx_esdhc_type devtype;
58 struct esdhc_platform_data boarddata;
59};
60
61static struct platform_device_id imx_esdhc_devtype[] = {
62 {
63 .name = "sdhci-esdhc-imx25",
64 .driver_data = IMX25_ESDHC,
65 }, {
66 .name = "sdhci-esdhc-imx35",
67 .driver_data = IMX35_ESDHC,
68 }, {
69 .name = "sdhci-esdhc-imx51",
70 .driver_data = IMX51_ESDHC,
71 }, {
72 .name = "sdhci-esdhc-imx53",
73 .driver_data = IMX53_ESDHC,
74 }, {
75 /* sentinel */
76 }
49}; 77};
78MODULE_DEVICE_TABLE(platform, imx_esdhc_devtype);
79
80static const struct of_device_id imx_esdhc_dt_ids[] = {
81 { .compatible = "fsl,imx25-esdhc", .data = &imx_esdhc_devtype[IMX25_ESDHC], },
82 { .compatible = "fsl,imx35-esdhc", .data = &imx_esdhc_devtype[IMX35_ESDHC], },
83 { .compatible = "fsl,imx51-esdhc", .data = &imx_esdhc_devtype[IMX51_ESDHC], },
84 { .compatible = "fsl,imx53-esdhc", .data = &imx_esdhc_devtype[IMX53_ESDHC], },
85 { /* sentinel */ }
86};
87MODULE_DEVICE_TABLE(of, imx_esdhc_dt_ids);
88
89static inline int is_imx25_esdhc(struct pltfm_imx_data *data)
90{
91 return data->devtype == IMX25_ESDHC;
92}
93
94static inline int is_imx35_esdhc(struct pltfm_imx_data *data)
95{
96 return data->devtype == IMX35_ESDHC;
97}
98
99static inline int is_imx51_esdhc(struct pltfm_imx_data *data)
100{
101 return data->devtype == IMX51_ESDHC;
102}
103
104static inline int is_imx53_esdhc(struct pltfm_imx_data *data)
105{
106 return data->devtype == IMX53_ESDHC;
107}
50 108
51static inline void esdhc_clrset_le(struct sdhci_host *host, u32 mask, u32 val, int reg) 109static inline void esdhc_clrset_le(struct sdhci_host *host, u32 mask, u32 val, int reg)
52{ 110{
@@ -60,17 +118,14 @@ static u32 esdhc_readl_le(struct sdhci_host *host, int reg)
60{ 118{
61 struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host); 119 struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
62 struct pltfm_imx_data *imx_data = pltfm_host->priv; 120 struct pltfm_imx_data *imx_data = pltfm_host->priv;
121 struct esdhc_platform_data *boarddata = &imx_data->boarddata;
63 122
64 /* fake CARD_PRESENT flag on mx25/35 */ 123 /* fake CARD_PRESENT flag */
65 u32 val = readl(host->ioaddr + reg); 124 u32 val = readl(host->ioaddr + reg);
66 125
67 if (unlikely((reg == SDHCI_PRESENT_STATE) 126 if (unlikely((reg == SDHCI_PRESENT_STATE)
68 && (imx_data->flags & ESDHC_FLAG_GPIO_FOR_CD))) { 127 && gpio_is_valid(boarddata->cd_gpio))) {
69 struct esdhc_platform_data *boarddata = 128 if (gpio_get_value(boarddata->cd_gpio))
70 host->mmc->parent->platform_data;
71
72 if (boarddata && gpio_is_valid(boarddata->cd_gpio)
73 && gpio_get_value(boarddata->cd_gpio))
74 /* no card, if a valid gpio says so... */ 129 /* no card, if a valid gpio says so... */
75 val &= ~SDHCI_CARD_PRESENT; 130 val &= ~SDHCI_CARD_PRESENT;
76 else 131 else
@@ -85,12 +140,12 @@ static void esdhc_writel_le(struct sdhci_host *host, u32 val, int reg)
85{ 140{
86 struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host); 141 struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
87 struct pltfm_imx_data *imx_data = pltfm_host->priv; 142 struct pltfm_imx_data *imx_data = pltfm_host->priv;
143 struct esdhc_platform_data *boarddata = &imx_data->boarddata;
88 144
89 if (unlikely((reg == SDHCI_INT_ENABLE || reg == SDHCI_SIGNAL_ENABLE) 145 if (unlikely((reg == SDHCI_INT_ENABLE || reg == SDHCI_SIGNAL_ENABLE)
90 && (imx_data->flags & ESDHC_FLAG_GPIO_FOR_CD))) 146 && (boarddata->cd_type == ESDHC_CD_GPIO)))
91 /* 147 /*
92 * these interrupts won't work with a custom card_detect gpio 148 * these interrupts won't work with a custom card_detect gpio
93 * (only applied to mx25/35)
94 */ 149 */
95 val &= ~(SDHCI_INT_CARD_REMOVE | SDHCI_INT_CARD_INSERT); 150 val &= ~(SDHCI_INT_CARD_REMOVE | SDHCI_INT_CARD_INSERT);
96 151
@@ -173,6 +228,17 @@ static void esdhc_writeb_le(struct sdhci_host *host, u8 val, int reg)
173 return; 228 return;
174 } 229 }
175 esdhc_clrset_le(host, 0xff, val, reg); 230 esdhc_clrset_le(host, 0xff, val, reg);
231
232 /*
233 * The esdhc has a design violation to SDHC spec which tells
234 * that software reset should not affect card detection circuit.
235 * But esdhc clears its SYSCTL register bits [0..2] during the
236 * software reset. This will stop those clocks that card detection
237 * circuit relies on. To work around it, we turn the clocks on back
238 * to keep card detection circuit functional.
239 */
240 if ((reg == SDHCI_SOFTWARE_RESET) && (val & 1))
241 esdhc_clrset_le(host, 0x7, 0x7, ESDHC_SYSTEM_CONTROL);
176} 242}
177 243
178static unsigned int esdhc_pltfm_get_max_clock(struct sdhci_host *host) 244static unsigned int esdhc_pltfm_get_max_clock(struct sdhci_host *host)
@@ -189,6 +255,26 @@ static unsigned int esdhc_pltfm_get_min_clock(struct sdhci_host *host)
189 return clk_get_rate(pltfm_host->clk) / 256 / 16; 255 return clk_get_rate(pltfm_host->clk) / 256 / 16;
190} 256}
191 257
258static unsigned int esdhc_pltfm_get_ro(struct sdhci_host *host)
259{
260 struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
261 struct pltfm_imx_data *imx_data = pltfm_host->priv;
262 struct esdhc_platform_data *boarddata = &imx_data->boarddata;
263
264 switch (boarddata->wp_type) {
265 case ESDHC_WP_GPIO:
266 if (gpio_is_valid(boarddata->wp_gpio))
267 return gpio_get_value(boarddata->wp_gpio);
268 case ESDHC_WP_CONTROLLER:
269 return !(readl(host->ioaddr + SDHCI_PRESENT_STATE) &
270 SDHCI_WRITE_PROTECT);
271 case ESDHC_WP_NONE:
272 break;
273 }
274
275 return -ENOSYS;
276}
277
192static struct sdhci_ops sdhci_esdhc_ops = { 278static struct sdhci_ops sdhci_esdhc_ops = {
193 .read_l = esdhc_readl_le, 279 .read_l = esdhc_readl_le,
194 .read_w = esdhc_readw_le, 280 .read_w = esdhc_readw_le,
@@ -198,6 +284,7 @@ static struct sdhci_ops sdhci_esdhc_ops = {
198 .set_clock = esdhc_set_clock, 284 .set_clock = esdhc_set_clock,
199 .get_max_clock = esdhc_pltfm_get_max_clock, 285 .get_max_clock = esdhc_pltfm_get_max_clock,
200 .get_min_clock = esdhc_pltfm_get_min_clock, 286 .get_min_clock = esdhc_pltfm_get_min_clock,
287 .get_ro = esdhc_pltfm_get_ro,
201}; 288};
202 289
203static struct sdhci_pltfm_data sdhci_esdhc_imx_pdata = { 290static struct sdhci_pltfm_data sdhci_esdhc_imx_pdata = {
@@ -207,17 +294,6 @@ static struct sdhci_pltfm_data sdhci_esdhc_imx_pdata = {
207 .ops = &sdhci_esdhc_ops, 294 .ops = &sdhci_esdhc_ops,
208}; 295};
209 296
210static unsigned int esdhc_pltfm_get_ro(struct sdhci_host *host)
211{
212 struct esdhc_platform_data *boarddata =
213 host->mmc->parent->platform_data;
214
215 if (boarddata && gpio_is_valid(boarddata->wp_gpio))
216 return gpio_get_value(boarddata->wp_gpio);
217 else
218 return -ENOSYS;
219}
220
221static irqreturn_t cd_irq(int irq, void *data) 297static irqreturn_t cd_irq(int irq, void *data)
222{ 298{
223 struct sdhci_host *sdhost = (struct sdhci_host *)data; 299 struct sdhci_host *sdhost = (struct sdhci_host *)data;
@@ -226,8 +302,48 @@ static irqreturn_t cd_irq(int irq, void *data)
226 return IRQ_HANDLED; 302 return IRQ_HANDLED;
227}; 303};
228 304
305#ifdef CONFIG_OF
306static int __devinit
307sdhci_esdhc_imx_probe_dt(struct platform_device *pdev,
308 struct esdhc_platform_data *boarddata)
309{
310 struct device_node *np = pdev->dev.of_node;
311
312 if (!np)
313 return -ENODEV;
314
315 if (of_get_property(np, "fsl,card-wired", NULL))
316 boarddata->cd_type = ESDHC_CD_PERMANENT;
317
318 if (of_get_property(np, "fsl,cd-controller", NULL))
319 boarddata->cd_type = ESDHC_CD_CONTROLLER;
320
321 if (of_get_property(np, "fsl,wp-controller", NULL))
322 boarddata->wp_type = ESDHC_WP_CONTROLLER;
323
324 boarddata->cd_gpio = of_get_named_gpio(np, "cd-gpios", 0);
325 if (gpio_is_valid(boarddata->cd_gpio))
326 boarddata->cd_type = ESDHC_CD_GPIO;
327
328 boarddata->wp_gpio = of_get_named_gpio(np, "wp-gpios", 0);
329 if (gpio_is_valid(boarddata->wp_gpio))
330 boarddata->wp_type = ESDHC_WP_GPIO;
331
332 return 0;
333}
334#else
335static inline int
336sdhci_esdhc_imx_probe_dt(struct platform_device *pdev,
337 struct esdhc_platform_data *boarddata)
338{
339 return -ENODEV;
340}
341#endif
342
229static int __devinit sdhci_esdhc_imx_probe(struct platform_device *pdev) 343static int __devinit sdhci_esdhc_imx_probe(struct platform_device *pdev)
230{ 344{
345 const struct of_device_id *of_id =
346 of_match_device(imx_esdhc_dt_ids, &pdev->dev);
231 struct sdhci_pltfm_host *pltfm_host; 347 struct sdhci_pltfm_host *pltfm_host;
232 struct sdhci_host *host; 348 struct sdhci_host *host;
233 struct esdhc_platform_data *boarddata; 349 struct esdhc_platform_data *boarddata;
@@ -242,8 +358,14 @@ static int __devinit sdhci_esdhc_imx_probe(struct platform_device *pdev)
242 pltfm_host = sdhci_priv(host); 358 pltfm_host = sdhci_priv(host);
243 359
244 imx_data = kzalloc(sizeof(struct pltfm_imx_data), GFP_KERNEL); 360 imx_data = kzalloc(sizeof(struct pltfm_imx_data), GFP_KERNEL);
245 if (!imx_data) 361 if (!imx_data) {
246 return -ENOMEM; 362 err = -ENOMEM;
363 goto err_imx_data;
364 }
365
366 if (of_id)
367 pdev->id_entry = of_id->data;
368 imx_data->devtype = pdev->id_entry->driver_data;
247 pltfm_host->priv = imx_data; 369 pltfm_host->priv = imx_data;
248 370
249 clk = clk_get(mmc_dev(host->mmc), NULL); 371 clk = clk_get(mmc_dev(host->mmc), NULL);
@@ -255,50 +377,72 @@ static int __devinit sdhci_esdhc_imx_probe(struct platform_device *pdev)
255 clk_enable(clk); 377 clk_enable(clk);
256 pltfm_host->clk = clk; 378 pltfm_host->clk = clk;
257 379
258 if (!cpu_is_mx25()) 380 if (!is_imx25_esdhc(imx_data))
259 host->quirks |= SDHCI_QUIRK_BROKEN_TIMEOUT_VAL; 381 host->quirks |= SDHCI_QUIRK_BROKEN_TIMEOUT_VAL;
260 382
261 if (cpu_is_mx25() || cpu_is_mx35()) { 383 if (is_imx25_esdhc(imx_data) || is_imx35_esdhc(imx_data))
262 /* Fix errata ENGcm07207 present on i.MX25 and i.MX35 */ 384 /* Fix errata ENGcm07207 present on i.MX25 and i.MX35 */
263 host->quirks |= SDHCI_QUIRK_NO_MULTIBLOCK; 385 host->quirks |= SDHCI_QUIRK_NO_MULTIBLOCK;
264 /* write_protect can't be routed to controller, use gpio */
265 sdhci_esdhc_ops.get_ro = esdhc_pltfm_get_ro;
266 }
267 386
268 if (!(cpu_is_mx25() || cpu_is_mx35() || cpu_is_mx51())) 387 if (is_imx53_esdhc(imx_data))
269 imx_data->flags |= ESDHC_FLAG_MULTIBLK_NO_INT; 388 imx_data->flags |= ESDHC_FLAG_MULTIBLK_NO_INT;
270 389
271 boarddata = host->mmc->parent->platform_data; 390 boarddata = &imx_data->boarddata;
272 if (boarddata) { 391 if (sdhci_esdhc_imx_probe_dt(pdev, boarddata) < 0) {
392 if (!host->mmc->parent->platform_data) {
393 dev_err(mmc_dev(host->mmc), "no board data!\n");
394 err = -EINVAL;
395 goto no_board_data;
396 }
397 imx_data->boarddata = *((struct esdhc_platform_data *)
398 host->mmc->parent->platform_data);
399 }
400
401 /* write_protect */
402 if (boarddata->wp_type == ESDHC_WP_GPIO) {
273 err = gpio_request_one(boarddata->wp_gpio, GPIOF_IN, "ESDHC_WP"); 403 err = gpio_request_one(boarddata->wp_gpio, GPIOF_IN, "ESDHC_WP");
274 if (err) { 404 if (err) {
275 dev_warn(mmc_dev(host->mmc), 405 dev_warn(mmc_dev(host->mmc),
276 "no write-protect pin available!\n"); 406 "no write-protect pin available!\n");
277 boarddata->wp_gpio = err; 407 boarddata->wp_gpio = -EINVAL;
278 } 408 }
409 } else {
410 boarddata->wp_gpio = -EINVAL;
411 }
412
413 /* card_detect */
414 if (boarddata->cd_type != ESDHC_CD_GPIO)
415 boarddata->cd_gpio = -EINVAL;
279 416
417 switch (boarddata->cd_type) {
418 case ESDHC_CD_GPIO:
280 err = gpio_request_one(boarddata->cd_gpio, GPIOF_IN, "ESDHC_CD"); 419 err = gpio_request_one(boarddata->cd_gpio, GPIOF_IN, "ESDHC_CD");
281 if (err) { 420 if (err) {
282 dev_warn(mmc_dev(host->mmc), 421 dev_err(mmc_dev(host->mmc),
283 "no card-detect pin available!\n"); 422 "no card-detect pin available!\n");
284 goto no_card_detect_pin; 423 goto no_card_detect_pin;
285 } 424 }
286 425
287 /* i.MX5x has issues to be researched */
288 if (!cpu_is_mx25() && !cpu_is_mx35())
289 goto not_supported;
290
291 err = request_irq(gpio_to_irq(boarddata->cd_gpio), cd_irq, 426 err = request_irq(gpio_to_irq(boarddata->cd_gpio), cd_irq,
292 IRQF_TRIGGER_FALLING | IRQF_TRIGGER_RISING, 427 IRQF_TRIGGER_FALLING | IRQF_TRIGGER_RISING,
293 mmc_hostname(host->mmc), host); 428 mmc_hostname(host->mmc), host);
294 if (err) { 429 if (err) {
295 dev_warn(mmc_dev(host->mmc), "request irq error\n"); 430 dev_err(mmc_dev(host->mmc), "request irq error\n");
296 goto no_card_detect_irq; 431 goto no_card_detect_irq;
297 } 432 }
433 /* fall through */
298 434
299 imx_data->flags |= ESDHC_FLAG_GPIO_FOR_CD; 435 case ESDHC_CD_CONTROLLER:
300 /* Now we have a working card_detect again */ 436 /* we have a working card_detect back */
301 host->quirks &= ~SDHCI_QUIRK_BROKEN_CARD_DETECTION; 437 host->quirks &= ~SDHCI_QUIRK_BROKEN_CARD_DETECTION;
438 break;
439
440 case ESDHC_CD_PERMANENT:
441 host->mmc->caps = MMC_CAP_NONREMOVABLE;
442 break;
443
444 case ESDHC_CD_NONE:
445 break;
302 } 446 }
303 447
304 err = sdhci_add_host(host); 448 err = sdhci_add_host(host);
@@ -307,16 +451,21 @@ static int __devinit sdhci_esdhc_imx_probe(struct platform_device *pdev)
307 451
308 return 0; 452 return 0;
309 453
310 no_card_detect_irq: 454err_add_host:
311 gpio_free(boarddata->cd_gpio); 455 if (gpio_is_valid(boarddata->cd_gpio))
312 no_card_detect_pin: 456 free_irq(gpio_to_irq(boarddata->cd_gpio), host);
313 boarddata->cd_gpio = err; 457no_card_detect_irq:
314 not_supported: 458 if (gpio_is_valid(boarddata->cd_gpio))
315 kfree(imx_data); 459 gpio_free(boarddata->cd_gpio);
316 err_add_host: 460 if (gpio_is_valid(boarddata->wp_gpio))
461 gpio_free(boarddata->wp_gpio);
462no_card_detect_pin:
463no_board_data:
317 clk_disable(pltfm_host->clk); 464 clk_disable(pltfm_host->clk);
318 clk_put(pltfm_host->clk); 465 clk_put(pltfm_host->clk);
319 err_clk_get: 466err_clk_get:
467 kfree(imx_data);
468err_imx_data:
320 sdhci_pltfm_free(pdev); 469 sdhci_pltfm_free(pdev);
321 return err; 470 return err;
322} 471}
@@ -325,20 +474,18 @@ static int __devexit sdhci_esdhc_imx_remove(struct platform_device *pdev)
325{ 474{
326 struct sdhci_host *host = platform_get_drvdata(pdev); 475 struct sdhci_host *host = platform_get_drvdata(pdev);
327 struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host); 476 struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
328 struct esdhc_platform_data *boarddata = host->mmc->parent->platform_data;
329 struct pltfm_imx_data *imx_data = pltfm_host->priv; 477 struct pltfm_imx_data *imx_data = pltfm_host->priv;
478 struct esdhc_platform_data *boarddata = &imx_data->boarddata;
330 int dead = (readl(host->ioaddr + SDHCI_INT_STATUS) == 0xffffffff); 479 int dead = (readl(host->ioaddr + SDHCI_INT_STATUS) == 0xffffffff);
331 480
332 sdhci_remove_host(host, dead); 481 sdhci_remove_host(host, dead);
333 482
334 if (boarddata && gpio_is_valid(boarddata->wp_gpio)) 483 if (gpio_is_valid(boarddata->wp_gpio))
335 gpio_free(boarddata->wp_gpio); 484 gpio_free(boarddata->wp_gpio);
336 485
337 if (boarddata && gpio_is_valid(boarddata->cd_gpio)) { 486 if (gpio_is_valid(boarddata->cd_gpio)) {
487 free_irq(gpio_to_irq(boarddata->cd_gpio), host);
338 gpio_free(boarddata->cd_gpio); 488 gpio_free(boarddata->cd_gpio);
339
340 if (!(host->quirks & SDHCI_QUIRK_BROKEN_CARD_DETECTION))
341 free_irq(gpio_to_irq(boarddata->cd_gpio), host);
342 } 489 }
343 490
344 clk_disable(pltfm_host->clk); 491 clk_disable(pltfm_host->clk);
@@ -354,7 +501,9 @@ static struct platform_driver sdhci_esdhc_imx_driver = {
354 .driver = { 501 .driver = {
355 .name = "sdhci-esdhc-imx", 502 .name = "sdhci-esdhc-imx",
356 .owner = THIS_MODULE, 503 .owner = THIS_MODULE,
504 .of_match_table = imx_esdhc_dt_ids,
357 }, 505 },
506 .id_table = imx_esdhc_devtype,
358 .probe = sdhci_esdhc_imx_probe, 507 .probe = sdhci_esdhc_imx_probe,
359 .remove = __devexit_p(sdhci_esdhc_imx_remove), 508 .remove = __devexit_p(sdhci_esdhc_imx_remove),
360#ifdef CONFIG_PM 509#ifdef CONFIG_PM
diff --git a/drivers/mmc/host/sdhci-pltfm.c b/drivers/mmc/host/sdhci-pltfm.c
index 71c0ce1f6db..6414efeddca 100644
--- a/drivers/mmc/host/sdhci-pltfm.c
+++ b/drivers/mmc/host/sdhci-pltfm.c
@@ -85,6 +85,7 @@ struct sdhci_host *sdhci_pltfm_init(struct platform_device *pdev,
85{ 85{
86 struct sdhci_host *host; 86 struct sdhci_host *host;
87 struct sdhci_pltfm_host *pltfm_host; 87 struct sdhci_pltfm_host *pltfm_host;
88 struct device_node *np = pdev->dev.of_node;
88 struct resource *iomem; 89 struct resource *iomem;
89 int ret; 90 int ret;
90 91
@@ -98,7 +99,7 @@ struct sdhci_host *sdhci_pltfm_init(struct platform_device *pdev,
98 dev_err(&pdev->dev, "Invalid iomem size!\n"); 99 dev_err(&pdev->dev, "Invalid iomem size!\n");
99 100
100 /* Some PCI-based MFD need the parent here */ 101 /* Some PCI-based MFD need the parent here */
101 if (pdev->dev.parent != &platform_bus) 102 if (pdev->dev.parent != &platform_bus && !np)
102 host = sdhci_alloc_host(pdev->dev.parent, sizeof(*pltfm_host)); 103 host = sdhci_alloc_host(pdev->dev.parent, sizeof(*pltfm_host));
103 else 104 else
104 host = sdhci_alloc_host(&pdev->dev, sizeof(*pltfm_host)); 105 host = sdhci_alloc_host(&pdev->dev, sizeof(*pltfm_host));
diff --git a/drivers/net/fec.c b/drivers/net/fec.c
index 5b631fe7473..e8266ccf818 100644
--- a/drivers/net/fec.c
+++ b/drivers/net/fec.c
@@ -44,6 +44,10 @@
44#include <linux/platform_device.h> 44#include <linux/platform_device.h>
45#include <linux/phy.h> 45#include <linux/phy.h>
46#include <linux/fec.h> 46#include <linux/fec.h>
47#include <linux/of.h>
48#include <linux/of_device.h>
49#include <linux/of_gpio.h>
50#include <linux/of_net.h>
47 51
48#include <asm/cacheflush.h> 52#include <asm/cacheflush.h>
49 53
@@ -66,17 +70,42 @@
66#define FEC_QUIRK_ENET_MAC (1 << 0) 70#define FEC_QUIRK_ENET_MAC (1 << 0)
67/* Controller needs driver to swap frame */ 71/* Controller needs driver to swap frame */
68#define FEC_QUIRK_SWAP_FRAME (1 << 1) 72#define FEC_QUIRK_SWAP_FRAME (1 << 1)
73/* Controller uses gasket */
74#define FEC_QUIRK_USE_GASKET (1 << 2)
69 75
70static struct platform_device_id fec_devtype[] = { 76static struct platform_device_id fec_devtype[] = {
71 { 77 {
78 /* keep it for coldfire */
72 .name = DRIVER_NAME, 79 .name = DRIVER_NAME,
73 .driver_data = 0, 80 .driver_data = 0,
74 }, { 81 }, {
82 .name = "imx25-fec",
83 .driver_data = FEC_QUIRK_USE_GASKET,
84 }, {
85 .name = "imx27-fec",
86 .driver_data = 0,
87 }, {
75 .name = "imx28-fec", 88 .name = "imx28-fec",
76 .driver_data = FEC_QUIRK_ENET_MAC | FEC_QUIRK_SWAP_FRAME, 89 .driver_data = FEC_QUIRK_ENET_MAC | FEC_QUIRK_SWAP_FRAME,
77 }, 90 }, {
78 { } 91 /* sentinel */
92 }
79}; 93};
94MODULE_DEVICE_TABLE(platform, fec_devtype);
95
96enum imx_fec_type {
97 IMX25_FEC = 1, /* runs on i.mx25/50/53 */
98 IMX27_FEC, /* runs on i.mx27/35/51 */
99 IMX28_FEC,
100};
101
102static const struct of_device_id fec_dt_ids[] = {
103 { .compatible = "fsl,imx25-fec", .data = &fec_devtype[IMX25_FEC], },
104 { .compatible = "fsl,imx27-fec", .data = &fec_devtype[IMX27_FEC], },
105 { .compatible = "fsl,imx28-fec", .data = &fec_devtype[IMX28_FEC], },
106 { /* sentinel */ }
107};
108MODULE_DEVICE_TABLE(of, fec_dt_ids);
80 109
81static unsigned char macaddr[ETH_ALEN]; 110static unsigned char macaddr[ETH_ALEN];
82module_param_array(macaddr, byte, NULL, 0); 111module_param_array(macaddr, byte, NULL, 0);
@@ -427,7 +456,7 @@ fec_restart(struct net_device *ndev, int duplex)
427 456
428 } else { 457 } else {
429#ifdef FEC_MIIGSK_ENR 458#ifdef FEC_MIIGSK_ENR
430 if (fep->phy_interface == PHY_INTERFACE_MODE_RMII) { 459 if (id_entry->driver_data & FEC_QUIRK_USE_GASKET) {
431 /* disable the gasket and wait */ 460 /* disable the gasket and wait */
432 writel(0, fep->hwp + FEC_MIIGSK_ENR); 461 writel(0, fep->hwp + FEC_MIIGSK_ENR);
433 while (readl(fep->hwp + FEC_MIIGSK_ENR) & 4) 462 while (readl(fep->hwp + FEC_MIIGSK_ENR) & 4)
@@ -436,8 +465,11 @@ fec_restart(struct net_device *ndev, int duplex)
436 /* 465 /*
437 * configure the gasket: 466 * configure the gasket:
438 * RMII, 50 MHz, no loopback, no echo 467 * RMII, 50 MHz, no loopback, no echo
468 * MII, 25 MHz, no loopback, no echo
439 */ 469 */
440 writel(1, fep->hwp + FEC_MIIGSK_CFGR); 470 writel((fep->phy_interface == PHY_INTERFACE_MODE_RMII) ?
471 1 : 0, fep->hwp + FEC_MIIGSK_CFGR);
472
441 473
442 /* re-enable the gasket */ 474 /* re-enable the gasket */
443 writel(2, fep->hwp + FEC_MIIGSK_ENR); 475 writel(2, fep->hwp + FEC_MIIGSK_ENR);
@@ -734,8 +766,22 @@ static void __inline__ fec_get_mac(struct net_device *ndev)
734 */ 766 */
735 iap = macaddr; 767 iap = macaddr;
736 768
769#ifdef CONFIG_OF
737 /* 770 /*
738 * 2) from flash or fuse (via platform data) 771 * 2) from device tree data
772 */
773 if (!is_valid_ether_addr(iap)) {
774 struct device_node *np = fep->pdev->dev.of_node;
775 if (np) {
776 const char *mac = of_get_mac_address(np);
777 if (mac)
778 iap = (unsigned char *) mac;
779 }
780 }
781#endif
782
783 /*
784 * 3) from flash or fuse (via platform data)
739 */ 785 */
740 if (!is_valid_ether_addr(iap)) { 786 if (!is_valid_ether_addr(iap)) {
741#ifdef CONFIG_M5272 787#ifdef CONFIG_M5272
@@ -748,7 +794,7 @@ static void __inline__ fec_get_mac(struct net_device *ndev)
748 } 794 }
749 795
750 /* 796 /*
751 * 3) FEC mac registers set by bootloader 797 * 4) FEC mac registers set by bootloader
752 */ 798 */
753 if (!is_valid_ether_addr(iap)) { 799 if (!is_valid_ether_addr(iap)) {
754 *((unsigned long *) &tmpaddr[0]) = 800 *((unsigned long *) &tmpaddr[0]) =
@@ -1354,6 +1400,52 @@ static int fec_enet_init(struct net_device *ndev)
1354 return 0; 1400 return 0;
1355} 1401}
1356 1402
1403#ifdef CONFIG_OF
1404static int __devinit fec_get_phy_mode_dt(struct platform_device *pdev)
1405{
1406 struct device_node *np = pdev->dev.of_node;
1407
1408 if (np)
1409 return of_get_phy_mode(np);
1410
1411 return -ENODEV;
1412}
1413
1414static int __devinit fec_reset_phy(struct platform_device *pdev)
1415{
1416 int err, phy_reset;
1417 struct device_node *np = pdev->dev.of_node;
1418
1419 if (!np)
1420 return -ENODEV;
1421
1422 phy_reset = of_get_named_gpio(np, "phy-reset-gpios", 0);
1423 err = gpio_request_one(phy_reset, GPIOF_OUT_INIT_LOW, "phy-reset");
1424 if (err) {
1425 pr_warn("FEC: failed to get gpio phy-reset: %d\n", err);
1426 return err;
1427 }
1428 msleep(1);
1429 gpio_set_value(phy_reset, 1);
1430
1431 return 0;
1432}
1433#else /* CONFIG_OF */
1434static inline int fec_get_phy_mode_dt(struct platform_device *pdev)
1435{
1436 return -ENODEV;
1437}
1438
1439static inline int fec_reset_phy(struct platform_device *pdev)
1440{
1441 /*
1442 * In case of platform probe, the reset has been done
1443 * by machine code.
1444 */
1445 return 0;
1446}
1447#endif /* CONFIG_OF */
1448
1357static int __devinit 1449static int __devinit
1358fec_probe(struct platform_device *pdev) 1450fec_probe(struct platform_device *pdev)
1359{ 1451{
@@ -1362,6 +1454,11 @@ fec_probe(struct platform_device *pdev)
1362 struct net_device *ndev; 1454 struct net_device *ndev;
1363 int i, irq, ret = 0; 1455 int i, irq, ret = 0;
1364 struct resource *r; 1456 struct resource *r;
1457 const struct of_device_id *of_id;
1458
1459 of_id = of_match_device(fec_dt_ids, &pdev->dev);
1460 if (of_id)
1461 pdev->id_entry = of_id->data;
1365 1462
1366 r = platform_get_resource(pdev, IORESOURCE_MEM, 0); 1463 r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
1367 if (!r) 1464 if (!r)
@@ -1393,9 +1490,18 @@ fec_probe(struct platform_device *pdev)
1393 1490
1394 platform_set_drvdata(pdev, ndev); 1491 platform_set_drvdata(pdev, ndev);
1395 1492
1396 pdata = pdev->dev.platform_data; 1493 ret = fec_get_phy_mode_dt(pdev);
1397 if (pdata) 1494 if (ret < 0) {
1398 fep->phy_interface = pdata->phy; 1495 pdata = pdev->dev.platform_data;
1496 if (pdata)
1497 fep->phy_interface = pdata->phy;
1498 else
1499 fep->phy_interface = PHY_INTERFACE_MODE_MII;
1500 } else {
1501 fep->phy_interface = ret;
1502 }
1503
1504 fec_reset_phy(pdev);
1399 1505
1400 /* This device has up to three irqs on some platforms */ 1506 /* This device has up to three irqs on some platforms */
1401 for (i = 0; i < 3; i++) { 1507 for (i = 0; i < 3; i++) {
@@ -1530,6 +1636,7 @@ static struct platform_driver fec_driver = {
1530#ifdef CONFIG_PM 1636#ifdef CONFIG_PM
1531 .pm = &fec_pm_ops, 1637 .pm = &fec_pm_ops,
1532#endif 1638#endif
1639 .of_match_table = fec_dt_ids,
1533 }, 1640 },
1534 .id_table = fec_devtype, 1641 .id_table = fec_devtype,
1535 .probe = fec_probe, 1642 .probe = fec_probe,
diff --git a/drivers/net/ibm_newemac/core.c b/drivers/net/ibm_newemac/core.c
index 725399ea069..70cb7d8a3b5 100644
--- a/drivers/net/ibm_newemac/core.c
+++ b/drivers/net/ibm_newemac/core.c
@@ -39,6 +39,7 @@
39#include <linux/bitops.h> 39#include <linux/bitops.h>
40#include <linux/workqueue.h> 40#include <linux/workqueue.h>
41#include <linux/of.h> 41#include <linux/of.h>
42#include <linux/of_net.h>
42#include <linux/slab.h> 43#include <linux/slab.h>
43 44
44#include <asm/processor.h> 45#include <asm/processor.h>
@@ -2506,18 +2507,6 @@ static int __devinit emac_init_config(struct emac_instance *dev)
2506{ 2507{
2507 struct device_node *np = dev->ofdev->dev.of_node; 2508 struct device_node *np = dev->ofdev->dev.of_node;
2508 const void *p; 2509 const void *p;
2509 unsigned int plen;
2510 const char *pm, *phy_modes[] = {
2511 [PHY_MODE_NA] = "",
2512 [PHY_MODE_MII] = "mii",
2513 [PHY_MODE_RMII] = "rmii",
2514 [PHY_MODE_SMII] = "smii",
2515 [PHY_MODE_RGMII] = "rgmii",
2516 [PHY_MODE_TBI] = "tbi",
2517 [PHY_MODE_GMII] = "gmii",
2518 [PHY_MODE_RTBI] = "rtbi",
2519 [PHY_MODE_SGMII] = "sgmii",
2520 };
2521 2510
2522 /* Read config from device-tree */ 2511 /* Read config from device-tree */
2523 if (emac_read_uint_prop(np, "mal-device", &dev->mal_ph, 1)) 2512 if (emac_read_uint_prop(np, "mal-device", &dev->mal_ph, 1))
@@ -2566,23 +2555,9 @@ static int __devinit emac_init_config(struct emac_instance *dev)
2566 dev->mal_burst_size = 256; 2555 dev->mal_burst_size = 256;
2567 2556
2568 /* PHY mode needs some decoding */ 2557 /* PHY mode needs some decoding */
2569 dev->phy_mode = PHY_MODE_NA; 2558 dev->phy_mode = of_get_phy_mode(np);
2570 pm = of_get_property(np, "phy-mode", &plen); 2559 if (dev->phy_mode < 0)
2571 if (pm != NULL) { 2560 dev->phy_mode = PHY_MODE_NA;
2572 int i;
2573 for (i = 0; i < ARRAY_SIZE(phy_modes); i++)
2574 if (!strcasecmp(pm, phy_modes[i])) {
2575 dev->phy_mode = i;
2576 break;
2577 }
2578 }
2579
2580 /* Backward compat with non-final DT */
2581 if (dev->phy_mode == PHY_MODE_NA && pm != NULL && plen == 4) {
2582 u32 nmode = *(const u32 *)pm;
2583 if (nmode > PHY_MODE_NA && nmode <= PHY_MODE_SGMII)
2584 dev->phy_mode = nmode;
2585 }
2586 2561
2587 /* Check EMAC version */ 2562 /* Check EMAC version */
2588 if (of_device_is_compatible(np, "ibm,emac4sync")) { 2563 if (of_device_is_compatible(np, "ibm,emac4sync")) {
diff --git a/drivers/net/ibm_newemac/emac.h b/drivers/net/ibm_newemac/emac.h
index 8a61b597a16..1568278d759 100644
--- a/drivers/net/ibm_newemac/emac.h
+++ b/drivers/net/ibm_newemac/emac.h
@@ -26,6 +26,7 @@
26#define __IBM_NEWEMAC_H 26#define __IBM_NEWEMAC_H
27 27
28#include <linux/types.h> 28#include <linux/types.h>
29#include <linux/phy.h>
29 30
30/* EMAC registers Write Access rules */ 31/* EMAC registers Write Access rules */
31struct emac_regs { 32struct emac_regs {
@@ -106,15 +107,15 @@ struct emac_regs {
106/* 107/*
107 * PHY mode settings (EMAC <-> ZMII/RGMII bridge <-> PHY) 108 * PHY mode settings (EMAC <-> ZMII/RGMII bridge <-> PHY)
108 */ 109 */
109#define PHY_MODE_NA 0 110#define PHY_MODE_NA PHY_INTERFACE_MODE_NA
110#define PHY_MODE_MII 1 111#define PHY_MODE_MII PHY_INTERFACE_MODE_MII
111#define PHY_MODE_RMII 2 112#define PHY_MODE_RMII PHY_INTERFACE_MODE_RMII
112#define PHY_MODE_SMII 3 113#define PHY_MODE_SMII PHY_INTERFACE_MODE_SMII
113#define PHY_MODE_RGMII 4 114#define PHY_MODE_RGMII PHY_INTERFACE_MODE_RGMII
114#define PHY_MODE_TBI 5 115#define PHY_MODE_TBI PHY_INTERFACE_MODE_TBI
115#define PHY_MODE_GMII 6 116#define PHY_MODE_GMII PHY_INTERFACE_MODE_GMII
116#define PHY_MODE_RTBI 7 117#define PHY_MODE_RTBI PHY_INTERFACE_MODE_RTBI
117#define PHY_MODE_SGMII 8 118#define PHY_MODE_SGMII PHY_INTERFACE_MODE_SGMII
118 119
119/* EMACx_MR0 */ 120/* EMACx_MR0 */
120#define EMAC_MR0_RXI 0x80000000 121#define EMAC_MR0_RXI 0x80000000
diff --git a/drivers/net/ibm_newemac/phy.c b/drivers/net/ibm_newemac/phy.c
index ac9d964e59e..ab4e5969fe6 100644
--- a/drivers/net/ibm_newemac/phy.c
+++ b/drivers/net/ibm_newemac/phy.c
@@ -28,12 +28,15 @@
28#include "emac.h" 28#include "emac.h"
29#include "phy.h" 29#include "phy.h"
30 30
31static inline int phy_read(struct mii_phy *phy, int reg) 31#define phy_read _phy_read
32#define phy_write _phy_write
33
34static inline int _phy_read(struct mii_phy *phy, int reg)
32{ 35{
33 return phy->mdio_read(phy->dev, phy->address, reg); 36 return phy->mdio_read(phy->dev, phy->address, reg);
34} 37}
35 38
36static inline void phy_write(struct mii_phy *phy, int reg, int val) 39static inline void _phy_write(struct mii_phy *phy, int reg, int val)
37{ 40{
38 phy->mdio_write(phy->dev, phy->address, reg, val); 41 phy->mdio_write(phy->dev, phy->address, reg, val);
39} 42}
diff --git a/drivers/of/of_net.c b/drivers/of/of_net.c
index 86f334a2769..bb184717588 100644
--- a/drivers/of/of_net.c
+++ b/drivers/of/of_net.c
@@ -8,6 +8,51 @@
8#include <linux/etherdevice.h> 8#include <linux/etherdevice.h>
9#include <linux/kernel.h> 9#include <linux/kernel.h>
10#include <linux/of_net.h> 10#include <linux/of_net.h>
11#include <linux/phy.h>
12
13/**
14 * It maps 'enum phy_interface_t' found in include/linux/phy.h
15 * into the device tree binding of 'phy-mode', so that Ethernet
16 * device driver can get phy interface from device tree.
17 */
18static const char *phy_modes[] = {
19 [PHY_INTERFACE_MODE_NA] = "",
20 [PHY_INTERFACE_MODE_MII] = "mii",
21 [PHY_INTERFACE_MODE_GMII] = "gmii",
22 [PHY_INTERFACE_MODE_SGMII] = "sgmii",
23 [PHY_INTERFACE_MODE_TBI] = "tbi",
24 [PHY_INTERFACE_MODE_RMII] = "rmii",
25 [PHY_INTERFACE_MODE_RGMII] = "rgmii",
26 [PHY_INTERFACE_MODE_RGMII_ID] = "rgmii-id",
27 [PHY_INTERFACE_MODE_RGMII_RXID] = "rgmii-rxid",
28 [PHY_INTERFACE_MODE_RGMII_TXID] = "rgmii-txid",
29 [PHY_INTERFACE_MODE_RTBI] = "rtbi",
30 [PHY_INTERFACE_MODE_SMII] = "smii",
31};
32
33/**
34 * of_get_phy_mode - Get phy mode for given device_node
35 * @np: Pointer to the given device_node
36 *
37 * The function gets phy interface string from property 'phy-mode',
38 * and return its index in phy_modes table, or errno in error case.
39 */
40const int of_get_phy_mode(struct device_node *np)
41{
42 const char *pm;
43 int err, i;
44
45 err = of_property_read_string(np, "phy-mode", &pm);
46 if (err < 0)
47 return err;
48
49 for (i = 0; i < ARRAY_SIZE(phy_modes); i++)
50 if (!strcasecmp(pm, phy_modes[i]))
51 return i;
52
53 return -ENODEV;
54}
55EXPORT_SYMBOL_GPL(of_get_phy_mode);
11 56
12/** 57/**
13 * Search the device tree for the best MAC address to use. 'mac-address' is 58 * Search the device tree for the best MAC address to use. 'mac-address' is
diff --git a/drivers/tty/serial/imx.c b/drivers/tty/serial/imx.c
index 22fe801cce3..827db765459 100644
--- a/drivers/tty/serial/imx.c
+++ b/drivers/tty/serial/imx.c
@@ -45,10 +45,11 @@
45#include <linux/delay.h> 45#include <linux/delay.h>
46#include <linux/rational.h> 46#include <linux/rational.h>
47#include <linux/slab.h> 47#include <linux/slab.h>
48#include <linux/of.h>
49#include <linux/of_device.h>
48 50
49#include <asm/io.h> 51#include <asm/io.h>
50#include <asm/irq.h> 52#include <asm/irq.h>
51#include <mach/hardware.h>
52#include <mach/imx-uart.h> 53#include <mach/imx-uart.h>
53 54
54/* Register definitions */ 55/* Register definitions */
@@ -66,8 +67,9 @@
66#define UBIR 0xa4 /* BRM Incremental Register */ 67#define UBIR 0xa4 /* BRM Incremental Register */
67#define UBMR 0xa8 /* BRM Modulator Register */ 68#define UBMR 0xa8 /* BRM Modulator Register */
68#define UBRC 0xac /* Baud Rate Count Register */ 69#define UBRC 0xac /* Baud Rate Count Register */
69#define MX2_ONEMS 0xb0 /* One Millisecond register */ 70#define IMX21_ONEMS 0xb0 /* One Millisecond register */
70#define UTS (cpu_is_mx1() ? 0xd0 : 0xb4) /* UART Test Register */ 71#define IMX1_UTS 0xd0 /* UART Test Register on i.mx1 */
72#define IMX21_UTS 0xb4 /* UART Test Register on all other i.mx*/
71 73
72/* UART Control Register Bit Fields.*/ 74/* UART Control Register Bit Fields.*/
73#define URXD_CHARRDY (1<<15) 75#define URXD_CHARRDY (1<<15)
@@ -87,7 +89,7 @@
87#define UCR1_RTSDEN (1<<5) /* RTS delta interrupt enable */ 89#define UCR1_RTSDEN (1<<5) /* RTS delta interrupt enable */
88#define UCR1_SNDBRK (1<<4) /* Send break */ 90#define UCR1_SNDBRK (1<<4) /* Send break */
89#define UCR1_TDMAEN (1<<3) /* Transmitter ready DMA enable */ 91#define UCR1_TDMAEN (1<<3) /* Transmitter ready DMA enable */
90#define MX1_UCR1_UARTCLKEN (1<<2) /* UART clock enabled, mx1 only */ 92#define IMX1_UCR1_UARTCLKEN (1<<2) /* UART clock enabled, i.mx1 only */
91#define UCR1_DOZE (1<<1) /* Doze */ 93#define UCR1_DOZE (1<<1) /* Doze */
92#define UCR1_UARTEN (1<<0) /* UART enabled */ 94#define UCR1_UARTEN (1<<0) /* UART enabled */
93#define UCR2_ESCI (1<<15) /* Escape seq interrupt enable */ 95#define UCR2_ESCI (1<<15) /* Escape seq interrupt enable */
@@ -113,9 +115,7 @@
113#define UCR3_RXDSEN (1<<6) /* Receive status interrupt enable */ 115#define UCR3_RXDSEN (1<<6) /* Receive status interrupt enable */
114#define UCR3_AIRINTEN (1<<5) /* Async IR wake interrupt enable */ 116#define UCR3_AIRINTEN (1<<5) /* Async IR wake interrupt enable */
115#define UCR3_AWAKEN (1<<4) /* Async wake interrupt enable */ 117#define UCR3_AWAKEN (1<<4) /* Async wake interrupt enable */
116#define MX1_UCR3_REF25 (1<<3) /* Ref freq 25 MHz, only on mx1 */ 118#define IMX21_UCR3_RXDMUXSEL (1<<2) /* RXD Muxed Input Select */
117#define MX1_UCR3_REF30 (1<<2) /* Ref Freq 30 MHz, only on mx1 */
118#define MX2_UCR3_RXDMUXSEL (1<<2) /* RXD Muxed Input Select, on mx2/mx3 */
119#define UCR3_INVT (1<<1) /* Inverted Infrared transmission */ 119#define UCR3_INVT (1<<1) /* Inverted Infrared transmission */
120#define UCR3_BPEN (1<<0) /* Preset registers enable */ 120#define UCR3_BPEN (1<<0) /* Preset registers enable */
121#define UCR4_CTSTL_SHF 10 /* CTS trigger level shift */ 121#define UCR4_CTSTL_SHF 10 /* CTS trigger level shift */
@@ -181,6 +181,18 @@
181 181
182#define UART_NR 8 182#define UART_NR 8
183 183
184/* i.mx21 type uart runs on all i.mx except i.mx1 */
185enum imx_uart_type {
186 IMX1_UART,
187 IMX21_UART,
188};
189
190/* device type dependent stuff */
191struct imx_uart_data {
192 unsigned uts_reg;
193 enum imx_uart_type devtype;
194};
195
184struct imx_port { 196struct imx_port {
185 struct uart_port port; 197 struct uart_port port;
186 struct timer_list timer; 198 struct timer_list timer;
@@ -192,6 +204,7 @@ struct imx_port {
192 unsigned int irda_inv_tx:1; 204 unsigned int irda_inv_tx:1;
193 unsigned short trcv_delay; /* transceiver delay */ 205 unsigned short trcv_delay; /* transceiver delay */
194 struct clk *clk; 206 struct clk *clk;
207 struct imx_uart_data *devdata;
195}; 208};
196 209
197#ifdef CONFIG_IRDA 210#ifdef CONFIG_IRDA
@@ -200,6 +213,52 @@ struct imx_port {
200#define USE_IRDA(sport) (0) 213#define USE_IRDA(sport) (0)
201#endif 214#endif
202 215
216static struct imx_uart_data imx_uart_devdata[] = {
217 [IMX1_UART] = {
218 .uts_reg = IMX1_UTS,
219 .devtype = IMX1_UART,
220 },
221 [IMX21_UART] = {
222 .uts_reg = IMX21_UTS,
223 .devtype = IMX21_UART,
224 },
225};
226
227static struct platform_device_id imx_uart_devtype[] = {
228 {
229 .name = "imx1-uart",
230 .driver_data = (kernel_ulong_t) &imx_uart_devdata[IMX1_UART],
231 }, {
232 .name = "imx21-uart",
233 .driver_data = (kernel_ulong_t) &imx_uart_devdata[IMX21_UART],
234 }, {
235 /* sentinel */
236 }
237};
238MODULE_DEVICE_TABLE(platform, imx_uart_devtype);
239
240static struct of_device_id imx_uart_dt_ids[] = {
241 { .compatible = "fsl,imx1-uart", .data = &imx_uart_devdata[IMX1_UART], },
242 { .compatible = "fsl,imx21-uart", .data = &imx_uart_devdata[IMX21_UART], },
243 { /* sentinel */ }
244};
245MODULE_DEVICE_TABLE(of, imx_uart_dt_ids);
246
247static inline unsigned uts_reg(struct imx_port *sport)
248{
249 return sport->devdata->uts_reg;
250}
251
252static inline int is_imx1_uart(struct imx_port *sport)
253{
254 return sport->devdata->devtype == IMX1_UART;
255}
256
257static inline int is_imx21_uart(struct imx_port *sport)
258{
259 return sport->devdata->devtype == IMX21_UART;
260}
261
203/* 262/*
204 * Handle any change of modem status signal since we were last called. 263 * Handle any change of modem status signal since we were last called.
205 */ 264 */
@@ -326,7 +385,8 @@ static inline void imx_transmit_buffer(struct imx_port *sport)
326 struct circ_buf *xmit = &sport->port.state->xmit; 385 struct circ_buf *xmit = &sport->port.state->xmit;
327 386
328 while (!uart_circ_empty(xmit) && 387 while (!uart_circ_empty(xmit) &&
329 !(readl(sport->port.membase + UTS) & UTS_TXFULL)) { 388 !(readl(sport->port.membase + uts_reg(sport))
389 & UTS_TXFULL)) {
330 /* send xmit->buf[xmit->tail] 390 /* send xmit->buf[xmit->tail]
331 * out the port here */ 391 * out the port here */
332 writel(xmit->buf[xmit->tail], sport->port.membase + URTX0); 392 writel(xmit->buf[xmit->tail], sport->port.membase + URTX0);
@@ -373,7 +433,7 @@ static void imx_start_tx(struct uart_port *port)
373 writel(temp, sport->port.membase + UCR4); 433 writel(temp, sport->port.membase + UCR4);
374 } 434 }
375 435
376 if (readl(sport->port.membase + UTS) & UTS_TXEMPTY) 436 if (readl(sport->port.membase + uts_reg(sport)) & UTS_TXEMPTY)
377 imx_transmit_buffer(sport); 437 imx_transmit_buffer(sport);
378} 438}
379 439
@@ -689,9 +749,9 @@ static int imx_startup(struct uart_port *port)
689 } 749 }
690 } 750 }
691 751
692 if (!cpu_is_mx1()) { 752 if (is_imx21_uart(sport)) {
693 temp = readl(sport->port.membase + UCR3); 753 temp = readl(sport->port.membase + UCR3);
694 temp |= MX2_UCR3_RXDMUXSEL; 754 temp |= IMX21_UCR3_RXDMUXSEL;
695 writel(temp, sport->port.membase + UCR3); 755 writel(temp, sport->port.membase + UCR3);
696 } 756 }
697 757
@@ -923,9 +983,9 @@ imx_set_termios(struct uart_port *port, struct ktermios *termios,
923 writel(num, sport->port.membase + UBIR); 983 writel(num, sport->port.membase + UBIR);
924 writel(denom, sport->port.membase + UBMR); 984 writel(denom, sport->port.membase + UBMR);
925 985
926 if (!cpu_is_mx1()) 986 if (is_imx21_uart(sport))
927 writel(sport->port.uartclk / div / 1000, 987 writel(sport->port.uartclk / div / 1000,
928 sport->port.membase + MX2_ONEMS); 988 sport->port.membase + IMX21_ONEMS);
929 989
930 writel(old_ucr1, sport->port.membase + UCR1); 990 writel(old_ucr1, sport->port.membase + UCR1);
931 991
@@ -1041,7 +1101,7 @@ static void imx_console_putchar(struct uart_port *port, int ch)
1041{ 1101{
1042 struct imx_port *sport = (struct imx_port *)port; 1102 struct imx_port *sport = (struct imx_port *)port;
1043 1103
1044 while (readl(sport->port.membase + UTS) & UTS_TXFULL) 1104 while (readl(sport->port.membase + uts_reg(sport)) & UTS_TXFULL)
1045 barrier(); 1105 barrier();
1046 1106
1047 writel(ch, sport->port.membase + URTX0); 1107 writel(ch, sport->port.membase + URTX0);
@@ -1062,8 +1122,8 @@ imx_console_write(struct console *co, const char *s, unsigned int count)
1062 ucr1 = old_ucr1 = readl(sport->port.membase + UCR1); 1122 ucr1 = old_ucr1 = readl(sport->port.membase + UCR1);
1063 old_ucr2 = readl(sport->port.membase + UCR2); 1123 old_ucr2 = readl(sport->port.membase + UCR2);
1064 1124
1065 if (cpu_is_mx1()) 1125 if (is_imx1_uart(sport))
1066 ucr1 |= MX1_UCR1_UARTCLKEN; 1126 ucr1 |= IMX1_UCR1_UARTCLKEN;
1067 ucr1 |= UCR1_UARTEN; 1127 ucr1 |= UCR1_UARTEN;
1068 ucr1 &= ~(UCR1_TXMPTYEN | UCR1_RRDYEN | UCR1_RTSDEN); 1128 ucr1 &= ~(UCR1_TXMPTYEN | UCR1_RRDYEN | UCR1_RTSDEN);
1069 1129
@@ -1222,6 +1282,63 @@ static int serial_imx_resume(struct platform_device *dev)
1222 return 0; 1282 return 0;
1223} 1283}
1224 1284
1285#ifdef CONFIG_OF
1286static int serial_imx_probe_dt(struct imx_port *sport,
1287 struct platform_device *pdev)
1288{
1289 struct device_node *np = pdev->dev.of_node;
1290 const struct of_device_id *of_id =
1291 of_match_device(imx_uart_dt_ids, &pdev->dev);
1292 int ret;
1293
1294 if (!np)
1295 return -ENODEV;
1296
1297 ret = of_alias_get_id(np, "serial");
1298 if (ret < 0) {
1299 pr_err("%s: failed to get alias id, errno %d\n",
1300 __func__, ret);
1301 return -ENODEV;
1302 } else {
1303 sport->port.line = ret;
1304 }
1305
1306 if (of_get_property(np, "fsl,uart-has-rtscts", NULL))
1307 sport->have_rtscts = 1;
1308
1309 if (of_get_property(np, "fsl,irda-mode", NULL))
1310 sport->use_irda = 1;
1311
1312 sport->devdata = of_id->data;
1313
1314 return 0;
1315}
1316#else
1317static inline int serial_imx_probe_dt(struct imx_port *sport,
1318 struct platform_device *pdev)
1319{
1320 return -ENODEV;
1321}
1322#endif
1323
1324static void serial_imx_probe_pdata(struct imx_port *sport,
1325 struct platform_device *pdev)
1326{
1327 struct imxuart_platform_data *pdata = pdev->dev.platform_data;
1328
1329 sport->port.line = pdev->id;
1330 sport->devdata = (struct imx_uart_data *) pdev->id_entry->driver_data;
1331
1332 if (!pdata)
1333 return;
1334
1335 if (pdata->flags & IMXUART_HAVE_RTSCTS)
1336 sport->have_rtscts = 1;
1337
1338 if (pdata->flags & IMXUART_IRDA)
1339 sport->use_irda = 1;
1340}
1341
1225static int serial_imx_probe(struct platform_device *pdev) 1342static int serial_imx_probe(struct platform_device *pdev)
1226{ 1343{
1227 struct imx_port *sport; 1344 struct imx_port *sport;
@@ -1234,6 +1351,10 @@ static int serial_imx_probe(struct platform_device *pdev)
1234 if (!sport) 1351 if (!sport)
1235 return -ENOMEM; 1352 return -ENOMEM;
1236 1353
1354 ret = serial_imx_probe_dt(sport, pdev);
1355 if (ret == -ENODEV)
1356 serial_imx_probe_pdata(sport, pdev);
1357
1237 res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 1358 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
1238 if (!res) { 1359 if (!res) {
1239 ret = -ENODEV; 1360 ret = -ENODEV;
@@ -1258,7 +1379,6 @@ static int serial_imx_probe(struct platform_device *pdev)
1258 sport->port.fifosize = 32; 1379 sport->port.fifosize = 32;
1259 sport->port.ops = &imx_pops; 1380 sport->port.ops = &imx_pops;
1260 sport->port.flags = UPF_BOOT_AUTOCONF; 1381 sport->port.flags = UPF_BOOT_AUTOCONF;
1261 sport->port.line = pdev->id;
1262 init_timer(&sport->timer); 1382 init_timer(&sport->timer);
1263 sport->timer.function = imx_timeout; 1383 sport->timer.function = imx_timeout;
1264 sport->timer.data = (unsigned long)sport; 1384 sport->timer.data = (unsigned long)sport;
@@ -1272,17 +1392,9 @@ static int serial_imx_probe(struct platform_device *pdev)
1272 1392
1273 sport->port.uartclk = clk_get_rate(sport->clk); 1393 sport->port.uartclk = clk_get_rate(sport->clk);
1274 1394
1275 imx_ports[pdev->id] = sport; 1395 imx_ports[sport->port.line] = sport;
1276 1396
1277 pdata = pdev->dev.platform_data; 1397 pdata = pdev->dev.platform_data;
1278 if (pdata && (pdata->flags & IMXUART_HAVE_RTSCTS))
1279 sport->have_rtscts = 1;
1280
1281#ifdef CONFIG_IRDA
1282 if (pdata && (pdata->flags & IMXUART_IRDA))
1283 sport->use_irda = 1;
1284#endif
1285
1286 if (pdata && pdata->init) { 1398 if (pdata && pdata->init) {
1287 ret = pdata->init(pdev); 1399 ret = pdata->init(pdev);
1288 if (ret) 1400 if (ret)
@@ -1340,9 +1452,11 @@ static struct platform_driver serial_imx_driver = {
1340 1452
1341 .suspend = serial_imx_suspend, 1453 .suspend = serial_imx_suspend,
1342 .resume = serial_imx_resume, 1454 .resume = serial_imx_resume,
1455 .id_table = imx_uart_devtype,
1343 .driver = { 1456 .driver = {
1344 .name = "imx-uart", 1457 .name = "imx-uart",
1345 .owner = THIS_MODULE, 1458 .owner = THIS_MODULE,
1459 .of_match_table = imx_uart_dt_ids,
1346 }, 1460 },
1347}; 1461};
1348 1462
diff --git a/include/linux/irq.h b/include/linux/irq.h
index 5f695041090..87a06f345bd 100644
--- a/include/linux/irq.h
+++ b/include/linux/irq.h
@@ -108,14 +108,18 @@ enum {
108}; 108};
109 109
110struct msi_desc; 110struct msi_desc;
111struct 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 */
129struct irq_data { 133struct 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 00000000000..e807ad687a0
--- /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
22struct device_node;
23struct 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 */
33struct 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 */
56struct 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 */
72static 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
78extern void irq_domain_add(struct irq_domain *domain);
79extern void irq_domain_del(struct irq_domain *domain);
80#endif /* CONFIG_IRQ_DOMAIN */
81
82#if defined(CONFIG_IRQ_DOMAIN) && defined(CONFIG_OF_IRQ)
83extern void irq_domain_add_simple(struct device_node *controller, int irq_base);
84extern 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 */
87static 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 e6955f5d1f0..cd2e61ce4e8 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,
63extern unsigned int irq_create_of_mapping(struct device_node *controller, 63extern 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
67extern void irq_dispose_mapping(unsigned int irq);
68#endif
66extern int of_irq_to_resource(struct device_node *dev, int index, 69extern int of_irq_to_resource(struct device_node *dev, int index,
67 struct resource *r); 70 struct resource *r);
68extern int of_irq_count(struct device_node *dev); 71extern 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);
71extern struct device_node *of_irq_find_parent(struct device_node *child); 74extern 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/include/linux/of_net.h b/include/linux/of_net.h
index e913081fb52..f4746418871 100644
--- a/include/linux/of_net.h
+++ b/include/linux/of_net.h
@@ -9,6 +9,7 @@
9 9
10#ifdef CONFIG_OF_NET 10#ifdef CONFIG_OF_NET
11#include <linux/of.h> 11#include <linux/of.h>
12extern const int of_get_phy_mode(struct device_node *np);
12extern const void *of_get_mac_address(struct device_node *np); 13extern const void *of_get_mac_address(struct device_node *np);
13#endif 14#endif
14 15
diff --git a/include/linux/phy.h b/include/linux/phy.h
index ad5186354d9..54fc4138955 100644
--- a/include/linux/phy.h
+++ b/include/linux/phy.h
@@ -53,6 +53,7 @@
53 53
54/* Interface Mode definitions */ 54/* Interface Mode definitions */
55typedef enum { 55typedef enum {
56 PHY_INTERFACE_MODE_NA,
56 PHY_INTERFACE_MODE_MII, 57 PHY_INTERFACE_MODE_MII,
57 PHY_INTERFACE_MODE_GMII, 58 PHY_INTERFACE_MODE_GMII,
58 PHY_INTERFACE_MODE_SGMII, 59 PHY_INTERFACE_MODE_SGMII,
@@ -62,7 +63,8 @@ typedef enum {
62 PHY_INTERFACE_MODE_RGMII_ID, 63 PHY_INTERFACE_MODE_RGMII_ID,
63 PHY_INTERFACE_MODE_RGMII_RXID, 64 PHY_INTERFACE_MODE_RGMII_RXID,
64 PHY_INTERFACE_MODE_RGMII_TXID, 65 PHY_INTERFACE_MODE_RGMII_TXID,
65 PHY_INTERFACE_MODE_RTBI 66 PHY_INTERFACE_MODE_RTBI,
67 PHY_INTERFACE_MODE_SMII,
66} phy_interface_t; 68} phy_interface_t;
67 69
68 70
diff --git a/kernel/irq/Kconfig b/kernel/irq/Kconfig
index d1d051b38e0..5a38bf4de64 100644
--- a/kernel/irq/Kconfig
+++ b/kernel/irq/Kconfig
@@ -52,6 +52,10 @@ config IRQ_EDGE_EOI_HANDLER
52config GENERIC_IRQ_CHIP 52config GENERIC_IRQ_CHIP
53 bool 53 bool
54 54
55# Generic irq_domain hw <--> linux irq number translation
56config IRQ_DOMAIN
57 bool
58
55# Support forced irq threading 59# Support forced irq threading
56config IRQ_FORCED_THREADING 60config IRQ_FORCED_THREADING
57 bool 61 bool
diff --git a/kernel/irq/Makefile b/kernel/irq/Makefile
index 73290056cfb..fff17381f0a 100644
--- a/kernel/irq/Makefile
+++ b/kernel/irq/Makefile
@@ -2,6 +2,7 @@
2obj-y := irqdesc.o handle.o manage.o spurious.o resend.o chip.o dummychip.o devres.o 2obj-y := irqdesc.o handle.o manage.o spurious.o resend.o chip.o dummychip.o devres.o
3obj-$(CONFIG_GENERIC_IRQ_CHIP) += generic-chip.o 3obj-$(CONFIG_GENERIC_IRQ_CHIP) += generic-chip.o
4obj-$(CONFIG_GENERIC_IRQ_PROBE) += autoprobe.o 4obj-$(CONFIG_GENERIC_IRQ_PROBE) += autoprobe.o
5obj-$(CONFIG_IRQ_DOMAIN) += irqdomain.o
5obj-$(CONFIG_PROC_FS) += proc.o 6obj-$(CONFIG_PROC_FS) += proc.o
6obj-$(CONFIG_GENERIC_PENDING_IRQ) += migration.o 7obj-$(CONFIG_GENERIC_PENDING_IRQ) += migration.o
7obj-$(CONFIG_PM_SLEEP) += pm.o 8obj-$(CONFIG_PM_SLEEP) += pm.o
diff --git a/kernel/irq/irqdomain.c b/kernel/irq/irqdomain.c
new file mode 100644
index 00000000000..d5828da3fd3
--- /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
9static LIST_HEAD(irq_domain_list);
10static 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 */
20void 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 */
50void 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 */
77unsigned 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}
107EXPORT_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 */
116void 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}
123EXPORT_SYMBOL_GPL(irq_dispose_mapping);
124
125int 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
142struct irq_domain_ops irq_domain_simple_ops = {
143 .dt_translate = irq_domain_simple_dt_translate,
144};
145EXPORT_SYMBOL_GPL(irq_domain_simple_ops);
146
147/**
148 * irq_domain_create_simple() - Set up a 'simple' translation range
149 */
150void 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}
165EXPORT_SYMBOL_GPL(irq_domain_add_simple);
166
167void 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}
179EXPORT_SYMBOL_GPL(irq_domain_generate_simple);
180#endif /* CONFIG_OF_IRQ */