aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOlof Johansson <olof@lixom.net>2012-07-29 16:28:07 -0400
committerOlof Johansson <olof@lixom.net>2012-07-29 16:28:07 -0400
commit15a1e1bafe2c924db6d370ad892d7da6c7d83598 (patch)
tree99545a3f71307e5553b40a1082ca34714215ee4b
parent28a33cbc24e4256c143dce96c7d93bf423229f92 (diff)
parentf39c1101dd4489bca966974624fe19af1c8ebe23 (diff)
Merge branch 'marvell/dt' into late2/dt
* marvell/dt: (41 commits) ARM: Kirkwood: Replace mrvl with marvell ARM: Kirkwood: Describe GoFlex Net LEDs and SATA in DT. ARM: Kirkwood: Describe Dreamplug LEDs in DT. ARM: Kirkwood: Describe iConnects LEDs in DT. ARM: Kirkwood: Describe iConnects temperature sensor in DT. ARM: Kirkwood: Describe IB62x0 LEDs in DT. ARM: Kirkwood: Describe IB62x0 gpio-keys in DT. ARM: Kirkwood: Describe DNS32? gpio-keys in DT. ARM: Kirkwood: Move common portions into a kirkwood-dnskw.dtsi ARM: Kirkwood: Replace DNS-320/DNS-325 leds with dt bindings ARM: Kirkwood: Describe DNS325 temperature sensor in DT. ARM: Kirkwood: Use DT to configure SATA device. ARM: kirkwood: use devicetree for SPI on dreamplug ARM: kirkwood: Add LS-XHL and LS-CHLv2 support ARM: Kirkwood: Initial DTS support for Kirkwood GoFlex Net ARM: Kirkwood: Add basic device tree support for QNAP TS219. ATA: sata_mv: Add device tree support ARM: Orion: DTify the watchdog timer. ARM: Orion: Add arch support needed for I2C via DT. ARM: kirkwood: use devicetree for orion-spi ...
-rw-r--r--Documentation/devicetree/bindings/arm/mrvl/intc.txt20
-rw-r--r--Documentation/devicetree/bindings/ata/marvell.txt16
-rw-r--r--Documentation/devicetree/bindings/gpio/mrvl-gpio.txt23
-rw-r--r--Documentation/devicetree/bindings/mtd/orion-nand.txt4
-rw-r--r--Documentation/devicetree/bindings/spi/spi-orion.txt19
-rw-r--r--Documentation/devicetree/bindings/watchdog/marvel.txt14
-rw-r--r--arch/arm/Kconfig1
-rw-r--r--arch/arm/boot/dts/kirkwood-dns320.dts64
-rw-r--r--arch/arm/boot/dts/kirkwood-dns325.dts70
-rw-r--r--arch/arm/boot/dts/kirkwood-dnskw.dtsi69
-rw-r--r--arch/arm/boot/dts/kirkwood-dreamplug.dts52
-rw-r--r--arch/arm/boot/dts/kirkwood-goflexnet.dts99
-rw-r--r--arch/arm/boot/dts/kirkwood-ib62x0.dts40
-rw-r--r--arch/arm/boot/dts/kirkwood-iconnect.dts44
-rw-r--r--arch/arm/boot/dts/kirkwood-lschlv2.dts20
-rw-r--r--arch/arm/boot/dts/kirkwood-lsxhl.dts20
-rw-r--r--arch/arm/boot/dts/kirkwood-lsxl.dtsi95
-rw-r--r--arch/arm/boot/dts/kirkwood-ts219-6281.dts21
-rw-r--r--arch/arm/boot/dts/kirkwood-ts219-6282.dts21
-rw-r--r--arch/arm/boot/dts/kirkwood-ts219.dtsi78
-rw-r--r--arch/arm/boot/dts/kirkwood.dtsi66
-rw-r--r--arch/arm/mach-dove/common.c4
-rw-r--r--arch/arm/mach-dove/irq.c58
-rw-r--r--arch/arm/mach-kirkwood/Kconfig29
-rw-r--r--arch/arm/mach-kirkwood/Makefile3
-rw-r--r--arch/arm/mach-kirkwood/Makefile.boot4
-rw-r--r--arch/arm/mach-kirkwood/board-dnskw.c143
-rw-r--r--arch/arm/mach-kirkwood/board-dreamplug.c80
-rw-r--r--arch/arm/mach-kirkwood/board-dt.c29
-rw-r--r--arch/arm/mach-kirkwood/board-goflexnet.c71
-rw-r--r--arch/arm/mach-kirkwood/board-ib62x0.c72
-rw-r--r--arch/arm/mach-kirkwood/board-iconnect.c56
-rw-r--r--arch/arm/mach-kirkwood/board-lsxl.c135
-rw-r--r--arch/arm/mach-kirkwood/board-ts219.c82
-rw-r--r--arch/arm/mach-kirkwood/common.c72
-rw-r--r--arch/arm/mach-kirkwood/common.h17
-rw-r--r--arch/arm/mach-kirkwood/irq.c38
-rw-r--r--arch/arm/mach-mv78xx0/irq.c22
-rw-r--r--arch/arm/mach-orion5x/irq.c22
-rw-r--r--arch/arm/plat-orion/common.c1
-rw-r--r--arch/arm/plat-orion/gpio.c166
-rw-r--r--arch/arm/plat-orion/include/plat/gpio.h16
-rw-r--r--arch/arm/plat-orion/include/plat/irq.h3
-rw-r--r--arch/arm/plat-orion/irq.c40
-rw-r--r--drivers/ata/sata_mv.c42
-rw-r--r--drivers/crypto/mv_cesa.c4
-rw-r--r--drivers/mmc/host/mvsdio.c4
-rw-r--r--drivers/mtd/nand/orion_nand.c6
-rw-r--r--drivers/net/ethernet/marvell/mv643xx_eth.c6
-rw-r--r--drivers/rtc/rtc-mv.c2
-rw-r--r--drivers/spi/Kconfig9
-rw-r--r--drivers/spi/Makefile1
-rw-r--r--drivers/spi/spi-bcm63xx.c2
-rw-r--r--drivers/spi/spi-gpio.c3
-rw-r--r--drivers/spi/spi-imx.c14
-rw-r--r--drivers/spi/spi-omap2-mcspi.c8
-rw-r--r--drivers/spi/spi-orion.c22
-rw-r--r--drivers/spi/spi-pl022.c23
-rw-r--r--drivers/spi/spi-tegra.c89
-rw-r--r--drivers/spi/spi-xcomm.c276
-rw-r--r--drivers/spi/spi.c2
-rw-r--r--drivers/usb/host/ehci-orion.c4
-rw-r--r--drivers/watchdog/orion_wdt.c8
-rw-r--r--include/linux/amba/pl022.h9
-rw-r--r--sound/soc/kirkwood/kirkwood-i2s.c8
65 files changed, 1915 insertions, 646 deletions
diff --git a/Documentation/devicetree/bindings/arm/mrvl/intc.txt b/Documentation/devicetree/bindings/arm/mrvl/intc.txt
index 80b9a94d9a23..8b53273cb22f 100644
--- a/Documentation/devicetree/bindings/arm/mrvl/intc.txt
+++ b/Documentation/devicetree/bindings/arm/mrvl/intc.txt
@@ -38,3 +38,23 @@ Example:
38 reg-names = "mux status", "mux mask"; 38 reg-names = "mux status", "mux mask";
39 mrvl,intc-nr-irqs = <2>; 39 mrvl,intc-nr-irqs = <2>;
40 }; 40 };
41
42* Marvell Orion Interrupt controller
43
44Required properties
45- compatible : Should be "marvell,orion-intc".
46- #interrupt-cells: Specifies the number of cells needed to encode an
47 interrupt source. Supported value is <1>.
48- interrupt-controller : Declare this node to be an interrupt controller.
49- reg : Interrupt mask address. A list of 4 byte ranges, one per controller.
50 One entry in the list represents 32 interrupts.
51
52Example:
53
54 intc: interrupt-controller {
55 compatible = "marvell,orion-intc", "marvell,intc";
56 interrupt-controller;
57 #interrupt-cells = <1>;
58 reg = <0xfed20204 0x04>,
59 <0xfed20214 0x04>;
60 };
diff --git a/Documentation/devicetree/bindings/ata/marvell.txt b/Documentation/devicetree/bindings/ata/marvell.txt
new file mode 100644
index 000000000000..b5cdd20cde9c
--- /dev/null
+++ b/Documentation/devicetree/bindings/ata/marvell.txt
@@ -0,0 +1,16 @@
1* Marvell Orion SATA
2
3Required Properties:
4- compatibility : "marvell,orion-sata"
5- reg : Address range of controller
6- interrupts : Interrupt controller is using
7- nr-ports : Number of SATA ports in use.
8
9Example:
10
11 sata@80000 {
12 compatible = "marvell,orion-sata";
13 reg = <0x80000 0x5000>;
14 interrupts = <21>;
15 nr-ports = <2>;
16 }
diff --git a/Documentation/devicetree/bindings/gpio/mrvl-gpio.txt b/Documentation/devicetree/bindings/gpio/mrvl-gpio.txt
index 05428f39d9ac..e13787498bcf 100644
--- a/Documentation/devicetree/bindings/gpio/mrvl-gpio.txt
+++ b/Documentation/devicetree/bindings/gpio/mrvl-gpio.txt
@@ -27,3 +27,26 @@ Example:
27 interrupt-controller; 27 interrupt-controller;
28 #interrupt-cells = <1>; 28 #interrupt-cells = <1>;
29 }; 29 };
30
31* Marvell Orion GPIO Controller
32
33Required properties:
34- compatible : Should be "marvell,orion-gpio"
35- reg : Address and length of the register set for controller.
36- gpio-controller : So we know this is a gpio controller.
37- ngpio : How many gpios this controller has.
38- interrupts : Up to 4 Interrupts for the controller.
39
40Optional properties:
41- mask-offset : For SMP Orions, offset for Nth CPU
42
43Example:
44
45 gpio0: gpio@10100 {
46 compatible = "marvell,orion-gpio";
47 #gpio-cells = <2>;
48 gpio-controller;
49 reg = <0x10100 0x40>;
50 ngpio = <32>;
51 interrupts = <35>, <36>, <37>, <38>;
52 };
diff --git a/Documentation/devicetree/bindings/mtd/orion-nand.txt b/Documentation/devicetree/bindings/mtd/orion-nand.txt
index b2356b7d2fa4..2d6ab660e603 100644
--- a/Documentation/devicetree/bindings/mtd/orion-nand.txt
+++ b/Documentation/devicetree/bindings/mtd/orion-nand.txt
@@ -1,7 +1,7 @@
1NAND support for Marvell Orion SoC platforms 1NAND support for Marvell Orion SoC platforms
2 2
3Required properties: 3Required properties:
4- compatible : "mrvl,orion-nand". 4- compatible : "marvell,orion-nand".
5- reg : Base physical address of the NAND and length of memory mapped 5- reg : Base physical address of the NAND and length of memory mapped
6 region 6 region
7 7
@@ -24,7 +24,7 @@ nand@f4000000 {
24 ale = <1>; 24 ale = <1>;
25 bank-width = <1>; 25 bank-width = <1>;
26 chip-delay = <25>; 26 chip-delay = <25>;
27 compatible = "mrvl,orion-nand"; 27 compatible = "marvell,orion-nand";
28 reg = <0xf4000000 0x400>; 28 reg = <0xf4000000 0x400>;
29 29
30 partition@0 { 30 partition@0 {
diff --git a/Documentation/devicetree/bindings/spi/spi-orion.txt b/Documentation/devicetree/bindings/spi/spi-orion.txt
new file mode 100644
index 000000000000..a3ff50fc76fb
--- /dev/null
+++ b/Documentation/devicetree/bindings/spi/spi-orion.txt
@@ -0,0 +1,19 @@
1Marvell Orion SPI device
2
3Required properties:
4- compatible : should be "marvell,orion-spi".
5- reg : offset and length of the register set for the device
6- cell-index : Which of multiple SPI controllers is this.
7Optional properties:
8- interrupts : Is currently not used.
9
10Example:
11 spi@10600 {
12 compatible = "marvell,orion-spi";
13 #address-cells = <1>;
14 #size-cells = <0>;
15 cell-index = <0>;
16 reg = <0x10600 0x28>;
17 interrupts = <23>;
18 status = "disabled";
19 };
diff --git a/Documentation/devicetree/bindings/watchdog/marvel.txt b/Documentation/devicetree/bindings/watchdog/marvel.txt
new file mode 100644
index 000000000000..0b2503ab0a05
--- /dev/null
+++ b/Documentation/devicetree/bindings/watchdog/marvel.txt
@@ -0,0 +1,14 @@
1* Marvell Orion Watchdog Time
2
3Required Properties:
4
5- Compatibility : "marvell,orion-wdt"
6- reg : Address of the timer registers
7
8Example:
9
10 wdt@20300 {
11 compatible = "marvell,orion-wdt";
12 reg = <0x20300 0x28>;
13 status = "okay";
14 };
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index a91009c61870..39bb94112a30 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -1105,6 +1105,7 @@ config PLAT_ORION
1105 bool 1105 bool
1106 select CLKSRC_MMIO 1106 select CLKSRC_MMIO
1107 select GENERIC_IRQ_CHIP 1107 select GENERIC_IRQ_CHIP
1108 select IRQ_DOMAIN
1108 select COMMON_CLK 1109 select COMMON_CLK
1109 1110
1110config PLAT_PXA 1111config PLAT_PXA
diff --git a/arch/arm/boot/dts/kirkwood-dns320.dts b/arch/arm/boot/dts/kirkwood-dns320.dts
index dc09a735b04a..5bb0bf39d3b8 100644
--- a/arch/arm/boot/dts/kirkwood-dns320.dts
+++ b/arch/arm/boot/dts/kirkwood-dns320.dts
@@ -1,10 +1,10 @@
1/dts-v1/; 1/dts-v1/;
2 2
3/include/ "kirkwood.dtsi" 3/include/ "kirkwood-dnskw.dtsi"
4 4
5/ { 5/ {
6 model = "D-Link DNS-320 NAS (Rev A1)"; 6 model = "D-Link DNS-320 NAS (Rev A1)";
7 compatible = "dlink,dns-320-a1", "dlink,dns-320", "dlink,dns-kirkwood", "mrvl,kirkwood-88f6281", "mrvl,kirkwood"; 7 compatible = "dlink,dns-320-a1", "dlink,dns-320", "dlink,dns-kirkwood", "marvell,kirkwood-88f6281", "marvell,kirkwood";
8 8
9 memory { 9 memory {
10 device_type = "memory"; 10 device_type = "memory";
@@ -15,6 +15,31 @@
15 bootargs = "console=ttyS0,115200n8 earlyprintk"; 15 bootargs = "console=ttyS0,115200n8 earlyprintk";
16 }; 16 };
17 17
18 gpio-leds {
19 compatible = "gpio-leds";
20 blue-power {
21 label = "dns320:blue:power";
22 gpios = <&gpio0 26 1>; /* GPIO 26 Active Low */
23 linux,default-trigger = "default-on";
24 };
25 blue-usb {
26 label = "dns320:blue:usb";
27 gpios = <&gpio1 11 1>; /* GPIO 43 Active Low */
28 };
29 orange-l_hdd {
30 label = "dns320:orange:l_hdd";
31 gpios = <&gpio0 28 1>; /* GPIO 28 Active Low */
32 };
33 orange-r_hdd {
34 label = "dns320:orange:r_hdd";
35 gpios = <&gpio0 27 1>; /* GPIO 27 Active Low */
36 };
37 orange-usb {
38 label = "dns320:orange:usb";
39 gpios = <&gpio1 3 1>; /* GPIO 35 Active Low */
40 };
41 };
42
18 ocp@f1000000 { 43 ocp@f1000000 {
19 serial@12000 { 44 serial@12000 {
20 clock-frequency = <166666667>; 45 clock-frequency = <166666667>;
@@ -25,40 +50,5 @@
25 clock-frequency = <166666667>; 50 clock-frequency = <166666667>;
26 status = "okay"; 51 status = "okay";
27 }; 52 };
28
29 nand@3000000 {
30 status = "okay";
31
32 partition@0 {
33 label = "u-boot";
34 reg = <0x0000000 0x100000>;
35 read-only;
36 };
37
38 partition@100000 {
39 label = "uImage";
40 reg = <0x0100000 0x500000>;
41 };
42
43 partition@600000 {
44 label = "ramdisk";
45 reg = <0x0600000 0x500000>;
46 };
47
48 partition@b00000 {
49 label = "image";
50 reg = <0x0b00000 0x6600000>;
51 };
52
53 partition@7100000 {
54 label = "mini firmware";
55 reg = <0x7100000 0xa00000>;
56 };
57
58 partition@7b00000 {
59 label = "config";
60 reg = <0x7b00000 0x500000>;
61 };
62 };
63 }; 53 };
64}; 54};
diff --git a/arch/arm/boot/dts/kirkwood-dns325.dts b/arch/arm/boot/dts/kirkwood-dns325.dts
index c2a5562525d2..d430713ea9b9 100644
--- a/arch/arm/boot/dts/kirkwood-dns325.dts
+++ b/arch/arm/boot/dts/kirkwood-dns325.dts
@@ -1,10 +1,10 @@
1/dts-v1/; 1/dts-v1/;
2 2
3/include/ "kirkwood.dtsi" 3/include/ "kirkwood-dnskw.dtsi"
4 4
5/ { 5/ {
6 model = "D-Link DNS-325 NAS (Rev A1)"; 6 model = "D-Link DNS-325 NAS (Rev A1)";
7 compatible = "dlink,dns-325-a1", "dlink,dns-325", "dlink,dns-kirkwood", "mrvl,kirkwood-88f6281", "mrvl,kirkwood"; 7 compatible = "dlink,dns-325-a1", "dlink,dns-325", "dlink,dns-kirkwood", "marvell,kirkwood-88f6281", "marvell,kirkwood";
8 8
9 memory { 9 memory {
10 device_type = "memory"; 10 device_type = "memory";
@@ -15,45 +15,43 @@
15 bootargs = "console=ttyS0,115200n8 earlyprintk"; 15 bootargs = "console=ttyS0,115200n8 earlyprintk";
16 }; 16 };
17 17
18 ocp@f1000000 { 18 gpio-leds {
19 serial@12000 { 19 compatible = "gpio-leds";
20 clock-frequency = <200000000>; 20 white-power {
21 status = "okay"; 21 label = "dns325:white:power";
22 gpios = <&gpio0 26 1>; /* GPIO 26 Active Low */
23 linux,default-trigger = "default-on";
24 };
25 white-usb {
26 label = "dns325:white:usb";
27 gpios = <&gpio1 11 1>; /* GPIO 43 Active Low */
28 };
29 red-l_hdd {
30 label = "dns325:red:l_hdd";
31 gpios = <&gpio0 28 1>; /* GPIO 28 Active Low */
22 }; 32 };
33 red-r_hdd {
34 label = "dns325:red:r_hdd";
35 gpios = <&gpio0 27 1>; /* GPIO 27 Active Low */
36 };
37 red-usb {
38 label = "dns325:red:usb";
39 gpios = <&gpio0 29 1>; /* GPIO 29 Active Low */
40 };
41 };
23 42
24 nand@3000000 { 43 ocp@f1000000 {
44 i2c@11000 {
25 status = "okay"; 45 status = "okay";
26 46
27 partition@0 { 47 lm75: lm75@48 {
28 label = "u-boot"; 48 compatible = "national,lm75";
29 reg = <0x0000000 0x100000>; 49 reg = <0x48>;
30 read-only;
31 };
32
33 partition@100000 {
34 label = "uImage";
35 reg = <0x0100000 0x500000>;
36 };
37
38 partition@600000 {
39 label = "ramdisk";
40 reg = <0x0600000 0x500000>;
41 };
42
43 partition@b00000 {
44 label = "image";
45 reg = <0x0b00000 0x6600000>;
46 };
47
48 partition@7100000 {
49 label = "mini firmware";
50 reg = <0x7100000 0xa00000>;
51 };
52
53 partition@7b00000 {
54 label = "config";
55 reg = <0x7b00000 0x500000>;
56 }; 50 };
57 }; 51 };
52 serial@12000 {
53 clock-frequency = <200000000>;
54 status = "okay";
55 };
58 }; 56 };
59}; 57};
diff --git a/arch/arm/boot/dts/kirkwood-dnskw.dtsi b/arch/arm/boot/dts/kirkwood-dnskw.dtsi
new file mode 100644
index 000000000000..7408655f91b5
--- /dev/null
+++ b/arch/arm/boot/dts/kirkwood-dnskw.dtsi
@@ -0,0 +1,69 @@
1/include/ "kirkwood.dtsi"
2
3/ {
4 model = "D-Link DNS NASes (kirkwood-based)";
5 compatible = "dlink,dns-kirkwood", "marvell,kirkwood-88f6281", "marvell,kirkwood";
6
7 gpio_keys {
8 compatible = "gpio-keys";
9 #address-cells = <1>;
10 #size-cells = <0>;
11 button@1 {
12 label = "Power button";
13 linux,code = <116>;
14 gpios = <&gpio1 2 1>;
15 };
16 button@2 {
17 label = "USB unmount button";
18 linux,code = <161>;
19 gpios = <&gpio1 15 1>;
20 };
21 button@3 {
22 label = "Reset button";
23 linux,code = <0x198>;
24 gpios = <&gpio1 16 1>;
25 };
26 };
27
28 ocp@f1000000 {
29 sata@80000 {
30 status = "okay";
31 nr-ports = <2>;
32 };
33
34 nand@3000000 {
35 status = "okay";
36
37 partition@0 {
38 label = "u-boot";
39 reg = <0x0000000 0x100000>;
40 read-only;
41 };
42
43 partition@100000 {
44 label = "uImage";
45 reg = <0x0100000 0x500000>;
46 };
47
48 partition@600000 {
49 label = "ramdisk";
50 reg = <0x0600000 0x500000>;
51 };
52
53 partition@b00000 {
54 label = "image";
55 reg = <0x0b00000 0x6600000>;
56 };
57
58 partition@7100000 {
59 label = "mini firmware";
60 reg = <0x7100000 0xa00000>;
61 };
62
63 partition@7b00000 {
64 label = "config";
65 reg = <0x7b00000 0x500000>;
66 };
67 };
68 };
69};
diff --git a/arch/arm/boot/dts/kirkwood-dreamplug.dts b/arch/arm/boot/dts/kirkwood-dreamplug.dts
index a5376b84227f..26e281fbf6bc 100644
--- a/arch/arm/boot/dts/kirkwood-dreamplug.dts
+++ b/arch/arm/boot/dts/kirkwood-dreamplug.dts
@@ -4,7 +4,7 @@
4 4
5/ { 5/ {
6 model = "Globalscale Technologies Dreamplug"; 6 model = "Globalscale Technologies Dreamplug";
7 compatible = "globalscale,dreamplug-003-ds2001", "globalscale,dreamplug", "mrvl,kirkwood-88f6281", "mrvl,kirkwood"; 7 compatible = "globalscale,dreamplug-003-ds2001", "globalscale,dreamplug", "marvell,kirkwood-88f6281", "marvell,kirkwood";
8 8
9 memory { 9 memory {
10 device_type = "memory"; 10 device_type = "memory";
@@ -20,5 +20,55 @@
20 clock-frequency = <200000000>; 20 clock-frequency = <200000000>;
21 status = "ok"; 21 status = "ok";
22 }; 22 };
23
24 spi@10600 {
25 status = "okay";
26
27 m25p40@0 {
28 #address-cells = <1>;
29 #size-cells = <1>;
30 compatible = "mx25l1606e";
31 reg = <0>;
32 spi-max-frequency = <50000000>;
33 mode = <0>;
34
35 partition@0 {
36 reg = <0x0 0x80000>;
37 label = "u-boot";
38 };
39
40 partition@100000 {
41 reg = <0x100000 0x10000>;
42 label = "u-boot env";
43 };
44
45 partition@180000 {
46 reg = <0x180000 0x10000>;
47 label = "dtb";
48 };
49 };
50 };
51
52 sata@80000 {
53 status = "okay";
54 nr-ports = <1>;
55 };
56 };
57
58 gpio-leds {
59 compatible = "gpio-leds";
60
61 bluetooth {
62 label = "dreamplug:blue:bluetooth";
63 gpios = <&gpio1 15 1>;
64 };
65 wifi {
66 label = "dreamplug:green:wifi";
67 gpios = <&gpio1 16 1>;
68 };
69 wifi-ap {
70 label = "dreamplug:green:wifi_ap";
71 gpios = <&gpio1 17 1>;
72 };
23 }; 73 };
24}; 74};
diff --git a/arch/arm/boot/dts/kirkwood-goflexnet.dts b/arch/arm/boot/dts/kirkwood-goflexnet.dts
new file mode 100644
index 000000000000..7c8238fbb6f9
--- /dev/null
+++ b/arch/arm/boot/dts/kirkwood-goflexnet.dts
@@ -0,0 +1,99 @@
1/dts-v1/;
2
3/include/ "kirkwood.dtsi"
4
5/ {
6 model = "Seagate GoFlex Net";
7 compatible = "seagate,goflexnet", "marvell,kirkwood-88f6281", "marvell,kirkwood";
8
9 memory {
10 device_type = "memory";
11 reg = <0x00000000 0x8000000>;
12 };
13
14 chosen {
15 bootargs = "console=ttyS0,115200n8 earlyprintk root=/dev/sda1 rootdelay=10";
16 };
17
18 ocp@f1000000 {
19 serial@12000 {
20 clock-frequency = <200000000>;
21 status = "ok";
22 };
23
24 nand@3000000 {
25 status = "okay";
26
27 partition@0 {
28 label = "u-boot";
29 reg = <0x0000000 0x100000>;
30 read-only;
31 };
32
33 partition@100000 {
34 label = "uImage";
35 reg = <0x0100000 0x400000>;
36 };
37
38 partition@500000 {
39 label = "pogoplug";
40 reg = <0x0500000 0x2000000>;
41 };
42
43 partition@2500000 {
44 label = "root";
45 reg = <0x02500000 0xd800000>;
46 };
47 };
48 sata@80000 {
49 status = "okay";
50 nr-ports = <2>;
51 };
52
53 };
54 gpio-leds {
55 compatible = "gpio-leds";
56
57 health {
58 label = "status:green:health";
59 gpios = <&gpio1 14 1>;
60 linux,default-trigger = "default-on";
61 };
62 fault {
63 label = "status:orange:fault";
64 gpios = <&gpio1 15 1>;
65 };
66 left0 {
67 label = "status:white:left0";
68 gpios = <&gpio1 10 0>;
69 };
70 left1 {
71 label = "status:white:left1";
72 gpios = <&gpio1 11 0>;
73 };
74 left2 {
75 label = "status:white:left2";
76 gpios = <&gpio1 12 0>;
77 };
78 left3 {
79 label = "status:white:left3";
80 gpios = <&gpio1 13 0>;
81 };
82 right0 {
83 label = "status:white:right0";
84 gpios = <&gpio1 6 0>;
85 };
86 right1 {
87 label = "status:white:right1";
88 gpios = <&gpio1 7 0>;
89 };
90 right2 {
91 label = "status:white:right2";
92 gpios = <&gpio1 8 0>;
93 };
94 right3 {
95 label = "status:white:right3";
96 gpios = <&gpio1 9 0>;
97 };
98 };
99};
diff --git a/arch/arm/boot/dts/kirkwood-ib62x0.dts b/arch/arm/boot/dts/kirkwood-ib62x0.dts
index ada0f0c23085..66794ed75ff1 100644
--- a/arch/arm/boot/dts/kirkwood-ib62x0.dts
+++ b/arch/arm/boot/dts/kirkwood-ib62x0.dts
@@ -4,7 +4,7 @@
4 4
5/ { 5/ {
6 model = "RaidSonic ICY BOX IB-NAS62x0 (Rev B)"; 6 model = "RaidSonic ICY BOX IB-NAS62x0 (Rev B)";
7 compatible = "raidsonic,ib-nas6210-b", "raidsonic,ib-nas6220-b", "raidsonic,ib-nas6210", "raidsonic,ib-nas6220", "raidsonic,ib-nas62x0", "mrvl,kirkwood-88f6281", "mrvl,kirkwood"; 7 compatible = "raidsonic,ib-nas6210-b", "raidsonic,ib-nas6220-b", "raidsonic,ib-nas6210", "raidsonic,ib-nas6220", "raidsonic,ib-nas62x0", "marvell,kirkwood-88f6281", "marvell,kirkwood";
8 8
9 memory { 9 memory {
10 device_type = "memory"; 10 device_type = "memory";
@@ -21,6 +21,11 @@
21 status = "okay"; 21 status = "okay";
22 }; 22 };
23 23
24 sata@80000 {
25 status = "okay";
26 nr-ports = <2>;
27 };
28
24 nand@3000000 { 29 nand@3000000 {
25 status = "okay"; 30 status = "okay";
26 31
@@ -41,4 +46,37 @@
41 46
42 }; 47 };
43 }; 48 };
49
50 gpio_keys {
51 compatible = "gpio-keys";
52 #address-cells = <1>;
53 #size-cells = <0>;
54 button@1 {
55 label = "USB Copy";
56 linux,code = <133>;
57 gpios = <&gpio0 29 1>;
58 };
59 button@2 {
60 label = "Reset";
61 linux,code = <0x198>;
62 gpios = <&gpio0 28 1>;
63 };
64 };
65 gpio-leds {
66 compatible = "gpio-leds";
67
68 green-os {
69 label = "ib62x0:green:os";
70 gpios = <&gpio0 25 0>;
71 linux,default-trigger = "default-on";
72 };
73 red-os {
74 label = "ib62x0:red:os";
75 gpios = <&gpio0 22 0>;
76 };
77 usb-copy {
78 label = "ib62x0:red:usb_copy";
79 gpios = <&gpio0 27 0>;
80 };
81 };
44}; 82};
diff --git a/arch/arm/boot/dts/kirkwood-iconnect.dts b/arch/arm/boot/dts/kirkwood-iconnect.dts
index 1ba75d4adecc..52d947045106 100644
--- a/arch/arm/boot/dts/kirkwood-iconnect.dts
+++ b/arch/arm/boot/dts/kirkwood-iconnect.dts
@@ -4,7 +4,7 @@
4 4
5/ { 5/ {
6 model = "Iomega Iconnect"; 6 model = "Iomega Iconnect";
7 compatible = "iom,iconnect-1.1", "iom,iconnect", "mrvl,kirkwood-88f6281", "mrvl,kirkwood"; 7 compatible = "iom,iconnect-1.1", "iom,iconnect", "marvell,kirkwood-88f6281", "marvell,kirkwood";
8 8
9 memory { 9 memory {
10 device_type = "memory"; 10 device_type = "memory";
@@ -18,9 +18,51 @@
18 }; 18 };
19 19
20 ocp@f1000000 { 20 ocp@f1000000 {
21 i2c@11000 {
22 status = "okay";
23
24 lm63: lm63@4c {
25 compatible = "national,lm63";
26 reg = <0x4c>;
27 };
28 };
21 serial@12000 { 29 serial@12000 {
22 clock-frequency = <200000000>; 30 clock-frequency = <200000000>;
23 status = "ok"; 31 status = "ok";
24 }; 32 };
25 }; 33 };
34 gpio-leds {
35 compatible = "gpio-leds";
36
37 led-level {
38 label = "led_level";
39 gpios = <&gpio1 9 0>;
40 linux,default-trigger = "default-on";
41 };
42 power-blue {
43 label = "power:blue";
44 gpios = <&gpio1 11 0>;
45 linux,default-trigger = "timer";
46 };
47 usb1 {
48 label = "usb1:blue";
49 gpios = <&gpio1 12 0>;
50 };
51 usb2 {
52 label = "usb2:blue";
53 gpios = <&gpio1 13 0>;
54 };
55 usb3 {
56 label = "usb3:blue";
57 gpios = <&gpio1 14 0>;
58 };
59 usb4 {
60 label = "usb4:blue";
61 gpios = <&gpio1 15 0>;
62 };
63 otb {
64 label = "otb:blue";
65 gpios = <&gpio1 16 0>;
66 };
67 };
26}; 68};
diff --git a/arch/arm/boot/dts/kirkwood-lschlv2.dts b/arch/arm/boot/dts/kirkwood-lschlv2.dts
new file mode 100644
index 000000000000..9510c9ea666c
--- /dev/null
+++ b/arch/arm/boot/dts/kirkwood-lschlv2.dts
@@ -0,0 +1,20 @@
1/dts-v1/;
2
3/include/ "kirkwood-lsxl.dtsi"
4
5/ {
6 model = "Buffalo Linkstation LS-CHLv2";
7 compatible = "buffalo,lschlv2", "buffalo,lsxl", "marvell,kirkwood-88f6281", "marvell,kirkwood";
8
9 memory {
10 device_type = "memory";
11 reg = <0x00000000 0x4000000>;
12 };
13
14 ocp@f1000000 {
15 serial@12000 {
16 clock-frequency = <166666667>;
17 status = "okay";
18 };
19 };
20};
diff --git a/arch/arm/boot/dts/kirkwood-lsxhl.dts b/arch/arm/boot/dts/kirkwood-lsxhl.dts
new file mode 100644
index 000000000000..739019c4cba9
--- /dev/null
+++ b/arch/arm/boot/dts/kirkwood-lsxhl.dts
@@ -0,0 +1,20 @@
1/dts-v1/;
2
3/include/ "kirkwood-lsxl.dtsi"
4
5/ {
6 model = "Buffalo Linkstation LS-XHL";
7 compatible = "buffalo,lsxhl", "buffalo,lsxl", "marvell,kirkwood-88f6281", "marvell,kirkwood";
8
9 memory {
10 device_type = "memory";
11 reg = <0x00000000 0x10000000>;
12 };
13
14 ocp@f1000000 {
15 serial@12000 {
16 clock-frequency = <200000000>;
17 status = "okay";
18 };
19 };
20};
diff --git a/arch/arm/boot/dts/kirkwood-lsxl.dtsi b/arch/arm/boot/dts/kirkwood-lsxl.dtsi
new file mode 100644
index 000000000000..8ac51c08269d
--- /dev/null
+++ b/arch/arm/boot/dts/kirkwood-lsxl.dtsi
@@ -0,0 +1,95 @@
1/include/ "kirkwood.dtsi"
2
3/ {
4 chosen {
5 bootargs = "console=ttyS0,115200n8 earlyprintk";
6 };
7
8 ocp@f1000000 {
9 sata@80000 {
10 status = "okay";
11 nr-ports = <1>;
12 };
13
14 spi@10600 {
15 status = "okay";
16
17 m25p40@0 {
18 #address-cells = <1>;
19 #size-cells = <1>;
20 compatible = "m25p40";
21 reg = <0>;
22 spi-max-frequency = <25000000>;
23 mode = <0>;
24
25 partition@0 {
26 reg = <0x0 0x60000>;
27 label = "uboot";
28 read-only;
29 };
30
31 partition@60000 {
32 reg = <0x60000 0x10000>;
33 label = "dtb";
34 read-only;
35 };
36
37 partition@70000 {
38 reg = <0x70000 0x10000>;
39 label = "uboot_env";
40 };
41 };
42 };
43 };
44
45 gpio_keys {
46 compatible = "gpio-keys";
47 #address-cells = <1>;
48 #size-cells = <0>;
49 button@1 {
50 label = "Function Button";
51 linux,code = <132>;
52 gpios = <&gpio1 9 1>;
53 };
54 button@2 {
55 label = "Power-on Switch";
56 linux,code = <116>;
57 gpios = <&gpio1 10 1>;
58 };
59 button@3 {
60 label = "Power-auto Switch";
61 linux,code = <142>;
62 gpios = <&gpio1 11 1>;
63 };
64 };
65
66 gpio_leds {
67 compatible = "gpio-leds";
68
69 led@1 {
70 label = "lschlv2:blue:func";
71 gpios = <&gpio1 4 1>;
72 };
73
74 led@2 {
75 label = "lschlv2:red:alarm";
76 gpios = <&gpio1 5 1>;
77 };
78
79 led@3 {
80 label = "lschlv2:amber:info";
81 gpios = <&gpio1 6 1>;
82 };
83
84 led@4 {
85 label = "lschlv2:blue:power";
86 gpios = <&gpio1 7 1>;
87 linux,default-trigger = "default-on";
88 };
89
90 led@5 {
91 label = "lschlv2:red:func";
92 gpios = <&gpio1 16 1>;
93 };
94 };
95};
diff --git a/arch/arm/boot/dts/kirkwood-ts219-6281.dts b/arch/arm/boot/dts/kirkwood-ts219-6281.dts
new file mode 100644
index 000000000000..ccbf32757800
--- /dev/null
+++ b/arch/arm/boot/dts/kirkwood-ts219-6281.dts
@@ -0,0 +1,21 @@
1/dts-v1/;
2
3/include/ "kirkwood-ts219.dtsi"
4
5/ {
6 gpio_keys {
7 compatible = "gpio-keys";
8 #address-cells = <1>;
9 #size-cells = <0>;
10 button@1 {
11 label = "USB Copy";
12 linux,code = <133>;
13 gpios = <&gpio0 15 1>;
14 };
15 button@2 {
16 label = "Reset";
17 linux,code = <0x198>;
18 gpios = <&gpio0 16 1>;
19 };
20 };
21}; \ No newline at end of file
diff --git a/arch/arm/boot/dts/kirkwood-ts219-6282.dts b/arch/arm/boot/dts/kirkwood-ts219-6282.dts
new file mode 100644
index 000000000000..fbe9932161a1
--- /dev/null
+++ b/arch/arm/boot/dts/kirkwood-ts219-6282.dts
@@ -0,0 +1,21 @@
1/dts-v1/;
2
3/include/ "kirkwood-ts219.dtsi"
4
5/ {
6 gpio_keys {
7 compatible = "gpio-keys";
8 #address-cells = <1>;
9 #size-cells = <0>;
10 button@1 {
11 label = "USB Copy";
12 linux,code = <133>;
13 gpios = <&gpio1 11 1>;
14 };
15 button@2 {
16 label = "Reset";
17 linux,code = <0x198>;
18 gpios = <&gpio1 5 1>;
19 };
20 };
21}; \ No newline at end of file
diff --git a/arch/arm/boot/dts/kirkwood-ts219.dtsi b/arch/arm/boot/dts/kirkwood-ts219.dtsi
new file mode 100644
index 000000000000..64ea27cb3298
--- /dev/null
+++ b/arch/arm/boot/dts/kirkwood-ts219.dtsi
@@ -0,0 +1,78 @@
1/include/ "kirkwood.dtsi"
2
3/ {
4 model = "QNAP TS219 family";
5 compatible = "qnap,ts219", "marvell,kirkwood";
6
7 memory {
8 device_type = "memory";
9 reg = <0x00000000 0x20000000>;
10 };
11
12 chosen {
13 bootargs = "console=ttyS0,115200n8";
14 };
15
16 ocp@f1000000 {
17 i2c@11000 {
18 status = "okay";
19 clock-frequency = <400000>;
20
21 s35390a: s35390a@30 {
22 compatible = "s35390a";
23 reg = <0x30>;
24 };
25 };
26 serial@12000 {
27 clock-frequency = <200000000>;
28 status = "okay";
29 };
30 serial@12100 {
31 clock-frequency = <200000000>;
32 status = "okay";
33 };
34 spi@10600 {
35 status = "okay";
36
37 m25p128@0 {
38 #address-cells = <1>;
39 #size-cells = <1>;
40 compatible = "m25p128";
41 reg = <0>;
42 spi-max-frequency = <20000000>;
43 mode = <0>;
44
45 partition@0000000 {
46 reg = <0x00000000 0x00080000>;
47 label = "U-Boot";
48 };
49
50 partition@00200000 {
51 reg = <0x00200000 0x00200000>;
52 label = "Kernel";
53 };
54
55 partition@00400000 {
56 reg = <0x00400000 0x00900000>;
57 label = "RootFS1";
58 };
59 partition@00d00000 {
60 reg = <0x00d00000 0x00300000>;
61 label = "RootFS2";
62 };
63 partition@00040000 {
64 reg = <0x00080000 0x00040000>;
65 label = "U-Boot Config";
66 };
67 partition@000c0000 {
68 reg = <0x000c0000 0x00140000>;
69 label = "NAS Config";
70 };
71 };
72 };
73 sata@80000 {
74 status = "okay";
75 nr-ports = <2>;
76 };
77 };
78};
diff --git a/arch/arm/boot/dts/kirkwood.dtsi b/arch/arm/boot/dts/kirkwood.dtsi
index 926528b81baa..cef9616f330a 100644
--- a/arch/arm/boot/dts/kirkwood.dtsi
+++ b/arch/arm/boot/dts/kirkwood.dtsi
@@ -1,7 +1,16 @@
1/include/ "skeleton.dtsi" 1/include/ "skeleton.dtsi"
2 2
3/ { 3/ {
4 compatible = "mrvl,kirkwood"; 4 compatible = "marvell,kirkwood";
5 interrupt-parent = <&intc>;
6
7 intc: interrupt-controller {
8 compatible = "marvell,orion-intc", "marvell,intc";
9 interrupt-controller;
10 #interrupt-cells = <1>;
11 reg = <0xf1020204 0x04>,
12 <0xf1020214 0x04>;
13 };
5 14
6 ocp@f1000000 { 15 ocp@f1000000 {
7 compatible = "simple-bus"; 16 compatible = "simple-bus";
@@ -9,6 +18,24 @@
9 #address-cells = <1>; 18 #address-cells = <1>;
10 #size-cells = <1>; 19 #size-cells = <1>;
11 20
21 gpio0: gpio@10100 {
22 compatible = "marvell,orion-gpio";
23 #gpio-cells = <2>;
24 gpio-controller;
25 reg = <0x10100 0x40>;
26 ngpio = <32>;
27 interrupts = <35>, <36>, <37>, <38>;
28 };
29
30 gpio1: gpio@10140 {
31 compatible = "marvell,orion-gpio";
32 #gpio-cells = <2>;
33 gpio-controller;
34 reg = <0x10140 0x40>;
35 ngpio = <18>;
36 interrupts = <39>, <40>, <41>;
37 };
38
12 serial@12000 { 39 serial@12000 {
13 compatible = "ns16550a"; 40 compatible = "ns16550a";
14 reg = <0x12000 0x100>; 41 reg = <0x12000 0x100>;
@@ -28,22 +55,55 @@
28 }; 55 };
29 56
30 rtc@10300 { 57 rtc@10300 {
31 compatible = "mrvl,kirkwood-rtc", "mrvl,orion-rtc"; 58 compatible = "marvell,kirkwood-rtc", "marvell,orion-rtc";
32 reg = <0x10300 0x20>; 59 reg = <0x10300 0x20>;
33 interrupts = <53>; 60 interrupts = <53>;
34 }; 61 };
35 62
63 spi@10600 {
64 compatible = "marvell,orion-spi";
65 #address-cells = <1>;
66 #size-cells = <0>;
67 cell-index = <0>;
68 interrupts = <23>;
69 reg = <0x10600 0x28>;
70 status = "disabled";
71 };
72
73 wdt@20300 {
74 compatible = "marvell,orion-wdt";
75 reg = <0x20300 0x28>;
76 status = "okay";
77 };
78
79 sata@80000 {
80 compatible = "marvell,orion-sata";
81 reg = <0x80000 0x5000>;
82 interrupts = <21>;
83 status = "disabled";
84 };
85
36 nand@3000000 { 86 nand@3000000 {
37 #address-cells = <1>; 87 #address-cells = <1>;
38 #size-cells = <1>; 88 #size-cells = <1>;
39 cle = <0>; 89 cle = <0>;
40 ale = <1>; 90 ale = <1>;
41 bank-width = <1>; 91 bank-width = <1>;
42 compatible = "mrvl,orion-nand"; 92 compatible = "marvell,orion-nand";
43 reg = <0x3000000 0x400>; 93 reg = <0x3000000 0x400>;
44 chip-delay = <25>; 94 chip-delay = <25>;
45 /* set partition map and/or chip-delay in board dts */ 95 /* set partition map and/or chip-delay in board dts */
46 status = "disabled"; 96 status = "disabled";
47 }; 97 };
98
99 i2c@11000 {
100 compatible = "marvell,mv64xxx-i2c";
101 reg = <0x11000 0x20>;
102 #address-cells = <1>;
103 #size-cells = <0>;
104 interrupts = <29>;
105 clock-frequency = <100000>;
106 status = "disabled";
107 };
48 }; 108 };
49}; 109};
diff --git a/arch/arm/mach-dove/common.c b/arch/arm/mach-dove/common.c
index 9493076fc594..4db5de54b6a7 100644
--- a/arch/arm/mach-dove/common.c
+++ b/arch/arm/mach-dove/common.c
@@ -101,8 +101,8 @@ void __init dove_ehci1_init(void)
101 ****************************************************************************/ 101 ****************************************************************************/
102void __init dove_ge00_init(struct mv643xx_eth_platform_data *eth_data) 102void __init dove_ge00_init(struct mv643xx_eth_platform_data *eth_data)
103{ 103{
104 orion_ge00_init(eth_data, 104 orion_ge00_init(eth_data, DOVE_GE00_PHYS_BASE,
105 DOVE_GE00_PHYS_BASE, IRQ_DOVE_GE00_SUM, 0); 105 IRQ_DOVE_GE00_SUM, IRQ_DOVE_GE00_ERR);
106} 106}
107 107
108/***************************************************************************** 108/*****************************************************************************
diff --git a/arch/arm/mach-dove/irq.c b/arch/arm/mach-dove/irq.c
index f07fd16e0c9b..9bc97a5baaa8 100644
--- a/arch/arm/mach-dove/irq.c
+++ b/arch/arm/mach-dove/irq.c
@@ -20,22 +20,6 @@
20#include <mach/bridge-regs.h> 20#include <mach/bridge-regs.h>
21#include "common.h" 21#include "common.h"
22 22
23static void gpio_irq_handler(unsigned int irq, struct irq_desc *desc)
24{
25 int irqoff;
26 BUG_ON(irq < IRQ_DOVE_GPIO_0_7 || irq > IRQ_DOVE_HIGH_GPIO);
27
28 irqoff = irq <= IRQ_DOVE_GPIO_16_23 ? irq - IRQ_DOVE_GPIO_0_7 :
29 3 + irq - IRQ_DOVE_GPIO_24_31;
30
31 orion_gpio_irq_handler(irqoff << 3);
32 if (irq == IRQ_DOVE_HIGH_GPIO) {
33 orion_gpio_irq_handler(40);
34 orion_gpio_irq_handler(48);
35 orion_gpio_irq_handler(56);
36 }
37}
38
39static void pmu_irq_mask(struct irq_data *d) 23static void pmu_irq_mask(struct irq_data *d)
40{ 24{
41 int pin = irq_to_pmu(d->irq); 25 int pin = irq_to_pmu(d->irq);
@@ -90,6 +74,27 @@ static void pmu_irq_handler(unsigned int irq, struct irq_desc *desc)
90 } 74 }
91} 75}
92 76
77static int __initdata gpio0_irqs[4] = {
78 IRQ_DOVE_GPIO_0_7,
79 IRQ_DOVE_GPIO_8_15,
80 IRQ_DOVE_GPIO_16_23,
81 IRQ_DOVE_GPIO_24_31,
82};
83
84static int __initdata gpio1_irqs[4] = {
85 IRQ_DOVE_HIGH_GPIO,
86 0,
87 0,
88 0,
89};
90
91static int __initdata gpio2_irqs[4] = {
92 0,
93 0,
94 0,
95 0,
96};
97
93void __init dove_init_irq(void) 98void __init dove_init_irq(void)
94{ 99{
95 int i; 100 int i;
@@ -100,19 +105,14 @@ void __init dove_init_irq(void)
100 /* 105 /*
101 * Initialize gpiolib for GPIOs 0-71. 106 * Initialize gpiolib for GPIOs 0-71.
102 */ 107 */
103 orion_gpio_init(0, 32, DOVE_GPIO_LO_VIRT_BASE, 0, 108 orion_gpio_init(NULL, 0, 32, (void __iomem *)DOVE_GPIO_LO_VIRT_BASE, 0,
104 IRQ_DOVE_GPIO_START); 109 IRQ_DOVE_GPIO_START, gpio0_irqs);
105 irq_set_chained_handler(IRQ_DOVE_GPIO_0_7, gpio_irq_handler); 110
106 irq_set_chained_handler(IRQ_DOVE_GPIO_8_15, gpio_irq_handler); 111 orion_gpio_init(NULL, 32, 32, (void __iomem *)DOVE_GPIO_HI_VIRT_BASE, 0,
107 irq_set_chained_handler(IRQ_DOVE_GPIO_16_23, gpio_irq_handler); 112 IRQ_DOVE_GPIO_START + 32, gpio1_irqs);
108 irq_set_chained_handler(IRQ_DOVE_GPIO_24_31, gpio_irq_handler); 113
109 114 orion_gpio_init(NULL, 64, 8, (void __iomem *)DOVE_GPIO2_VIRT_BASE, 0,
110 orion_gpio_init(32, 32, DOVE_GPIO_HI_VIRT_BASE, 0, 115 IRQ_DOVE_GPIO_START + 64, gpio2_irqs);
111 IRQ_DOVE_GPIO_START + 32);
112 irq_set_chained_handler(IRQ_DOVE_HIGH_GPIO, gpio_irq_handler);
113
114 orion_gpio_init(64, 8, DOVE_GPIO2_VIRT_BASE, 0,
115 IRQ_DOVE_GPIO_START + 64);
116 116
117 /* 117 /*
118 * Mask and clear PMU interrupts 118 * Mask and clear PMU interrupts
diff --git a/arch/arm/mach-kirkwood/Kconfig b/arch/arm/mach-kirkwood/Kconfig
index 199764fe0fb0..ca5c15a4e626 100644
--- a/arch/arm/mach-kirkwood/Kconfig
+++ b/arch/arm/mach-kirkwood/Kconfig
@@ -80,6 +80,35 @@ config MACH_IB62X0_DT
80 RaidSonic IB-NAS6210 & IB-NAS6220 devices, using 80 RaidSonic IB-NAS6210 & IB-NAS6220 devices, using
81 Flattened Device Tree. 81 Flattened Device Tree.
82 82
83config MACH_TS219_DT
84 bool "Device Tree for QNAP TS-11X, TS-21X NAS"
85 select ARCH_KIRKWOOD_DT
86 select ARM_APPENDED_DTB
87 select ARM_ATAG_DTB_COMPAT
88 help
89 Say 'Y' here if you want your kernel to support the QNAP
90 TS-110, TS-119, TS-119P+, TS-210, TS-219, TS-219P and
91 TS-219P+ Turbo NAS devices using Fattened Device Tree.
92 There are two different Device Tree descriptions, depending
93 on if the device is based on an if the board uses the MV6281
94 or MV6282. If you have the wrong one, the buttons will not
95 work.
96
97config MACH_GOFLEXNET_DT
98 bool "Seagate GoFlex Net (Flattened Device Tree)"
99 select ARCH_KIRKWOOD_DT
100 help
101 Say 'Y' here if you want your kernel to support the
102 Seagate GoFlex Net (Flattened Device Tree).
103
104config MACH_LSXL_DT
105 bool "Buffalo Linkstation LS-XHL, LS-CHLv2 (Flattened Device Tree)"
106 select ARCH_KIRKWOOD_DT
107 help
108 Say 'Y' here if you want your kernel to support the
109 Buffalo Linkstation LS-XHL & LS-CHLv2 devices, using
110 Flattened Device Tree.
111
83config MACH_TS219 112config MACH_TS219
84 bool "QNAP TS-110, TS-119, TS-119P+, TS-210, TS-219, TS-219P and TS-219P+ Turbo NAS" 113 bool "QNAP TS-110, TS-119, TS-119P+, TS-210, TS-219, TS-219P and TS-219P+ Turbo NAS"
85 help 114 help
diff --git a/arch/arm/mach-kirkwood/Makefile b/arch/arm/mach-kirkwood/Makefile
index d2b05907b10e..055c85a1cc46 100644
--- a/arch/arm/mach-kirkwood/Makefile
+++ b/arch/arm/mach-kirkwood/Makefile
@@ -25,3 +25,6 @@ obj-$(CONFIG_MACH_DREAMPLUG_DT) += board-dreamplug.o
25obj-$(CONFIG_MACH_ICONNECT_DT) += board-iconnect.o 25obj-$(CONFIG_MACH_ICONNECT_DT) += board-iconnect.o
26obj-$(CONFIG_MACH_DLINK_KIRKWOOD_DT) += board-dnskw.o 26obj-$(CONFIG_MACH_DLINK_KIRKWOOD_DT) += board-dnskw.o
27obj-$(CONFIG_MACH_IB62X0_DT) += board-ib62x0.o 27obj-$(CONFIG_MACH_IB62X0_DT) += board-ib62x0.o
28obj-$(CONFIG_MACH_TS219_DT) += board-ts219.o tsx1x-common.o
29obj-$(CONFIG_MACH_GOFLEXNET_DT) += board-goflexnet.o
30obj-$(CONFIG_MACH_LSXL_DT) += board-lsxl.o
diff --git a/arch/arm/mach-kirkwood/Makefile.boot b/arch/arm/mach-kirkwood/Makefile.boot
index 02edbdf5b065..2a576abf409b 100644
--- a/arch/arm/mach-kirkwood/Makefile.boot
+++ b/arch/arm/mach-kirkwood/Makefile.boot
@@ -7,3 +7,7 @@ dtb-$(CONFIG_MACH_DLINK_KIRKWOOD_DT) += kirkwood-dns320.dtb
7dtb-$(CONFIG_MACH_DLINK_KIRKWOOD_DT) += kirkwood-dns325.dtb 7dtb-$(CONFIG_MACH_DLINK_KIRKWOOD_DT) += kirkwood-dns325.dtb
8dtb-$(CONFIG_MACH_ICONNECT_DT) += kirkwood-iconnect.dtb 8dtb-$(CONFIG_MACH_ICONNECT_DT) += kirkwood-iconnect.dtb
9dtb-$(CONFIG_MACH_IB62X0_DT) += kirkwood-ib62x0.dtb 9dtb-$(CONFIG_MACH_IB62X0_DT) += kirkwood-ib62x0.dtb
10dtb-$(CONFIG_MACH_TS219_DT) += kirkwood-qnap-ts219.dtb
11dtb-$(CONFIG_MACH_GOFLEXNET_DT) += kirkwood-goflexnet.dtb
12dbt-$(CONFIG_MACH_LSXL_DT) += kirkwood-lschlv2.dtb
13dbt-$(CONFIG_MACH_LSXL_DT) += kirkwood-lsxhl.dtb
diff --git a/arch/arm/mach-kirkwood/board-dnskw.c b/arch/arm/mach-kirkwood/board-dnskw.c
index 58c2d68f9443..4ab35065a144 100644
--- a/arch/arm/mach-kirkwood/board-dnskw.c
+++ b/arch/arm/mach-kirkwood/board-dnskw.c
@@ -14,13 +14,11 @@
14#include <linux/kernel.h> 14#include <linux/kernel.h>
15#include <linux/init.h> 15#include <linux/init.h>
16#include <linux/platform_device.h> 16#include <linux/platform_device.h>
17#include <linux/i2c.h>
18#include <linux/ata_platform.h> 17#include <linux/ata_platform.h>
19#include <linux/mv643xx_eth.h> 18#include <linux/mv643xx_eth.h>
20#include <linux/of.h> 19#include <linux/of.h>
21#include <linux/gpio.h> 20#include <linux/gpio.h>
22#include <linux/input.h> 21#include <linux/input.h>
23#include <linux/gpio_keys.h>
24#include <linux/gpio-fan.h> 22#include <linux/gpio-fan.h>
25#include <linux/leds.h> 23#include <linux/leds.h>
26#include <asm/mach-types.h> 24#include <asm/mach-types.h>
@@ -35,10 +33,6 @@ static struct mv643xx_eth_platform_data dnskw_ge00_data = {
35 .phy_addr = MV643XX_ETH_PHY_ADDR(8), 33 .phy_addr = MV643XX_ETH_PHY_ADDR(8),
36}; 34};
37 35
38static struct mv_sata_platform_data dnskw_sata_data = {
39 .n_ports = 2,
40};
41
42static unsigned int dnskw_mpp_config[] __initdata = { 36static unsigned int dnskw_mpp_config[] __initdata = {
43 MPP13_UART1_TXD, /* Custom ... */ 37 MPP13_UART1_TXD, /* Custom ... */
44 MPP14_UART1_RXD, /* ... Controller (DNS-320 only) */ 38 MPP14_UART1_RXD, /* ... Controller (DNS-320 only) */
@@ -73,132 +67,6 @@ static unsigned int dnskw_mpp_config[] __initdata = {
73 0 67 0
74}; 68};
75 69
76static struct gpio_led dns325_led_pins[] = {
77 {
78 .name = "dns325:white:power",
79 .gpio = 26,
80 .active_low = 1,
81 .default_trigger = "default-on",
82 },
83 {
84 .name = "dns325:white:usb",
85 .gpio = 43,
86 .active_low = 1,
87 },
88 {
89 .name = "dns325:red:l_hdd",
90 .gpio = 28,
91 .active_low = 1,
92 },
93 {
94 .name = "dns325:red:r_hdd",
95 .gpio = 27,
96 .active_low = 1,
97 },
98 {
99 .name = "dns325:red:usb",
100 .gpio = 29,
101 .active_low = 1,
102 },
103};
104
105static struct gpio_led_platform_data dns325_led_data = {
106 .num_leds = ARRAY_SIZE(dns325_led_pins),
107 .leds = dns325_led_pins,
108};
109
110static struct platform_device dns325_led_device = {
111 .name = "leds-gpio",
112 .id = -1,
113 .dev = {
114 .platform_data = &dns325_led_data,
115 },
116};
117
118static struct gpio_led dns320_led_pins[] = {
119 {
120 .name = "dns320:blue:power",
121 .gpio = 26,
122 .active_low = 1,
123 .default_trigger = "default-on",
124 },
125 {
126 .name = "dns320:blue:usb",
127 .gpio = 43,
128 .active_low = 1,
129 },
130 {
131 .name = "dns320:orange:l_hdd",
132 .gpio = 28,
133 .active_low = 1,
134 },
135 {
136 .name = "dns320:orange:r_hdd",
137 .gpio = 27,
138 .active_low = 1,
139 },
140 {
141 .name = "dns320:orange:usb",
142 .gpio = 35,
143 .active_low = 1,
144 },
145};
146
147static struct gpio_led_platform_data dns320_led_data = {
148 .num_leds = ARRAY_SIZE(dns320_led_pins),
149 .leds = dns320_led_pins,
150};
151
152static struct platform_device dns320_led_device = {
153 .name = "leds-gpio",
154 .id = -1,
155 .dev = {
156 .platform_data = &dns320_led_data,
157 },
158};
159
160static struct i2c_board_info dns325_i2c_board_info[] __initdata = {
161 {
162 I2C_BOARD_INFO("lm75", 0x48),
163 },
164 /* Something at 0x0c also */
165};
166
167static struct gpio_keys_button dnskw_button_pins[] = {
168 {
169 .code = KEY_POWER,
170 .gpio = 34,
171 .desc = "Power button",
172 .active_low = 1,
173 },
174 {
175 .code = KEY_EJECTCD,
176 .gpio = 47,
177 .desc = "USB unmount button",
178 .active_low = 1,
179 },
180 {
181 .code = KEY_RESTART,
182 .gpio = 48,
183 .desc = "Reset button",
184 .active_low = 1,
185 },
186};
187
188static struct gpio_keys_platform_data dnskw_button_data = {
189 .buttons = dnskw_button_pins,
190 .nbuttons = ARRAY_SIZE(dnskw_button_pins),
191};
192
193static struct platform_device dnskw_button_device = {
194 .name = "gpio-keys",
195 .id = -1,
196 .num_resources = 0,
197 .dev = {
198 .platform_data = &dnskw_button_data,
199 }
200};
201
202/* Fan: ADDA AD045HB-G73 40mm 6000rpm@5v */ 70/* Fan: ADDA AD045HB-G73 40mm 6000rpm@5v */
203static struct gpio_fan_speed dnskw_fan_speed[] = { 71static struct gpio_fan_speed dnskw_fan_speed[] = {
204 { 0, 0 }, 72 { 0, 0 },
@@ -245,20 +113,9 @@ void __init dnskw_init(void)
245 113
246 kirkwood_ehci_init(); 114 kirkwood_ehci_init();
247 kirkwood_ge00_init(&dnskw_ge00_data); 115 kirkwood_ge00_init(&dnskw_ge00_data);
248 kirkwood_sata_init(&dnskw_sata_data);
249 kirkwood_i2c_init();
250 116
251 platform_device_register(&dnskw_button_device);
252 platform_device_register(&dnskw_fan_device); 117 platform_device_register(&dnskw_fan_device);
253 118
254 if (of_machine_is_compatible("dlink,dns-325")) {
255 i2c_register_board_info(0, dns325_i2c_board_info,
256 ARRAY_SIZE(dns325_i2c_board_info));
257 platform_device_register(&dns325_led_device);
258
259 } else if (of_machine_is_compatible("dlink,dns-320"))
260 platform_device_register(&dns320_led_device);
261
262 /* Register power-off GPIO. */ 119 /* Register power-off GPIO. */
263 if (gpio_request(36, "dnskw:power:off") == 0 120 if (gpio_request(36, "dnskw:power:off") == 0
264 && gpio_direction_output(36, 0) == 0) 121 && gpio_direction_output(36, 0) == 0)
diff --git a/arch/arm/mach-kirkwood/board-dreamplug.c b/arch/arm/mach-kirkwood/board-dreamplug.c
index 55e357ab2923..aeb234d0d0e3 100644
--- a/arch/arm/mach-kirkwood/board-dreamplug.c
+++ b/arch/arm/mach-kirkwood/board-dreamplug.c
@@ -14,7 +14,6 @@
14#include <linux/kernel.h> 14#include <linux/kernel.h>
15#include <linux/init.h> 15#include <linux/init.h>
16#include <linux/platform_device.h> 16#include <linux/platform_device.h>
17#include <linux/mtd/partitions.h>
18#include <linux/ata_platform.h> 17#include <linux/ata_platform.h>
19#include <linux/mv643xx_eth.h> 18#include <linux/mv643xx_eth.h>
20#include <linux/of.h> 19#include <linux/of.h>
@@ -23,7 +22,6 @@
23#include <linux/of_irq.h> 22#include <linux/of_irq.h>
24#include <linux/of_platform.h> 23#include <linux/of_platform.h>
25#include <linux/gpio.h> 24#include <linux/gpio.h>
26#include <linux/leds.h>
27#include <linux/mtd/physmap.h> 25#include <linux/mtd/physmap.h>
28#include <linux/spi/flash.h> 26#include <linux/spi/flash.h>
29#include <linux/spi/spi.h> 27#include <linux/spi/spi.h>
@@ -36,42 +34,6 @@
36#include "common.h" 34#include "common.h"
37#include "mpp.h" 35#include "mpp.h"
38 36
39struct mtd_partition dreamplug_partitions[] = {
40 {
41 .name = "u-boot",
42 .size = SZ_512K,
43 .offset = 0,
44 },
45 {
46 .name = "u-boot env",
47 .size = SZ_64K,
48 .offset = SZ_512K + SZ_512K,
49 },
50 {
51 .name = "dtb",
52 .size = SZ_64K,
53 .offset = SZ_512K + SZ_512K + SZ_512K,
54 },
55};
56
57static const struct flash_platform_data dreamplug_spi_slave_data = {
58 .type = "mx25l1606e",
59 .name = "spi_flash",
60 .parts = dreamplug_partitions,
61 .nr_parts = ARRAY_SIZE(dreamplug_partitions),
62};
63
64static struct spi_board_info __initdata dreamplug_spi_slave_info[] = {
65 {
66 .modalias = "m25p80",
67 .platform_data = &dreamplug_spi_slave_data,
68 .irq = -1,
69 .max_speed_hz = 50000000,
70 .bus_num = 0,
71 .chip_select = 0,
72 },
73};
74
75static struct mv643xx_eth_platform_data dreamplug_ge00_data = { 37static struct mv643xx_eth_platform_data dreamplug_ge00_data = {
76 .phy_addr = MV643XX_ETH_PHY_ADDR(0), 38 .phy_addr = MV643XX_ETH_PHY_ADDR(0),
77}; 39};
@@ -80,45 +42,10 @@ static struct mv643xx_eth_platform_data dreamplug_ge01_data = {
80 .phy_addr = MV643XX_ETH_PHY_ADDR(1), 42 .phy_addr = MV643XX_ETH_PHY_ADDR(1),
81}; 43};
82 44
83static struct mv_sata_platform_data dreamplug_sata_data = {
84 .n_ports = 1,
85};
86
87static struct mvsdio_platform_data dreamplug_mvsdio_data = { 45static struct mvsdio_platform_data dreamplug_mvsdio_data = {
88 /* unfortunately the CD signal has not been connected */ 46 /* unfortunately the CD signal has not been connected */
89}; 47};
90 48
91static struct gpio_led dreamplug_led_pins[] = {
92 {
93 .name = "dreamplug:blue:bluetooth",
94 .gpio = 47,
95 .active_low = 1,
96 },
97 {
98 .name = "dreamplug:green:wifi",
99 .gpio = 48,
100 .active_low = 1,
101 },
102 {
103 .name = "dreamplug:green:wifi_ap",
104 .gpio = 49,
105 .active_low = 1,
106 },
107};
108
109static struct gpio_led_platform_data dreamplug_led_data = {
110 .leds = dreamplug_led_pins,
111 .num_leds = ARRAY_SIZE(dreamplug_led_pins),
112};
113
114static struct platform_device dreamplug_leds = {
115 .name = "leds-gpio",
116 .id = -1,
117 .dev = {
118 .platform_data = &dreamplug_led_data,
119 }
120};
121
122static unsigned int dreamplug_mpp_config[] __initdata = { 49static unsigned int dreamplug_mpp_config[] __initdata = {
123 MPP0_SPI_SCn, 50 MPP0_SPI_SCn,
124 MPP1_SPI_MOSI, 51 MPP1_SPI_MOSI,
@@ -137,15 +64,8 @@ void __init dreamplug_init(void)
137 */ 64 */
138 kirkwood_mpp_conf(dreamplug_mpp_config); 65 kirkwood_mpp_conf(dreamplug_mpp_config);
139 66
140 spi_register_board_info(dreamplug_spi_slave_info,
141 ARRAY_SIZE(dreamplug_spi_slave_info));
142 kirkwood_spi_init();
143
144 kirkwood_ehci_init(); 67 kirkwood_ehci_init();
145 kirkwood_ge00_init(&dreamplug_ge00_data); 68 kirkwood_ge00_init(&dreamplug_ge00_data);
146 kirkwood_ge01_init(&dreamplug_ge01_data); 69 kirkwood_ge01_init(&dreamplug_ge01_data);
147 kirkwood_sata_init(&dreamplug_sata_data);
148 kirkwood_sdio_init(&dreamplug_mvsdio_data); 70 kirkwood_sdio_init(&dreamplug_mvsdio_data);
149
150 platform_device_register(&dreamplug_leds);
151} 71}
diff --git a/arch/arm/mach-kirkwood/board-dt.c b/arch/arm/mach-kirkwood/board-dt.c
index edc3f8a9d45e..e4eb450de301 100644
--- a/arch/arm/mach-kirkwood/board-dt.c
+++ b/arch/arm/mach-kirkwood/board-dt.c
@@ -18,6 +18,7 @@
18#include <asm/mach/arch.h> 18#include <asm/mach/arch.h>
19#include <asm/mach/map.h> 19#include <asm/mach/map.h>
20#include <mach/bridge-regs.h> 20#include <mach/bridge-regs.h>
21#include <plat/irq.h>
21#include "common.h" 22#include "common.h"
22 23
23static struct of_device_id kirkwood_dt_match_table[] __initdata = { 24static struct of_device_id kirkwood_dt_match_table[] __initdata = {
@@ -25,6 +26,16 @@ static struct of_device_id kirkwood_dt_match_table[] __initdata = {
25 { } 26 { }
26}; 27};
27 28
29struct of_dev_auxdata kirkwood_auxdata_lookup[] __initdata = {
30 OF_DEV_AUXDATA("marvell,orion-spi", 0xf1010600, "orion_spi.0", NULL),
31 OF_DEV_AUXDATA("marvell,mv64xxx-i2c", 0xf1011000, "mv64xxx_i2c.0",
32 NULL),
33 OF_DEV_AUXDATA("marvell,orion-wdt", 0xf1020300, "orion_wdt", NULL),
34 OF_DEV_AUXDATA("marvell,orion-sata", 0xf1080000, "sata_mv.0", NULL),
35 OF_DEV_AUXDATA("marvell,orion-nand", 0xf4000000, "orion_nand", NULL),
36 {},
37};
38
28static void __init kirkwood_dt_init(void) 39static void __init kirkwood_dt_init(void)
29{ 40{
30 pr_info("Kirkwood: %s, TCLK=%d.\n", kirkwood_id(), kirkwood_tclk); 41 pr_info("Kirkwood: %s, TCLK=%d.\n", kirkwood_id(), kirkwood_tclk);
@@ -47,7 +58,6 @@ static void __init kirkwood_dt_init(void)
47 kirkwood_clk_init(); 58 kirkwood_clk_init();
48 59
49 /* internal devices that every board has */ 60 /* internal devices that every board has */
50 kirkwood_wdt_init();
51 kirkwood_xor0_init(); 61 kirkwood_xor0_init();
52 kirkwood_xor1_init(); 62 kirkwood_xor1_init();
53 kirkwood_crypto_init(); 63 kirkwood_crypto_init();
@@ -68,7 +78,17 @@ static void __init kirkwood_dt_init(void)
68 if (of_machine_is_compatible("raidsonic,ib-nas62x0")) 78 if (of_machine_is_compatible("raidsonic,ib-nas62x0"))
69 ib62x0_init(); 79 ib62x0_init();
70 80
71 of_platform_populate(NULL, kirkwood_dt_match_table, NULL, NULL); 81 if (of_machine_is_compatible("qnap,ts219"))
82 qnap_dt_ts219_init();
83
84 if (of_machine_is_compatible("seagate,goflexnet"))
85 goflexnet_init();
86
87 if (of_machine_is_compatible("buffalo,lsxl"))
88 lsxl_init();
89
90 of_platform_populate(NULL, kirkwood_dt_match_table,
91 kirkwood_auxdata_lookup, NULL);
72} 92}
73 93
74static const char *kirkwood_dt_board_compat[] = { 94static const char *kirkwood_dt_board_compat[] = {
@@ -77,6 +97,9 @@ static const char *kirkwood_dt_board_compat[] = {
77 "dlink,dns-325", 97 "dlink,dns-325",
78 "iom,iconnect", 98 "iom,iconnect",
79 "raidsonic,ib-nas62x0", 99 "raidsonic,ib-nas62x0",
100 "qnap,ts219",
101 "seagate,goflexnet",
102 "buffalo,lsxl",
80 NULL 103 NULL
81}; 104};
82 105
@@ -84,7 +107,7 @@ DT_MACHINE_START(KIRKWOOD_DT, "Marvell Kirkwood (Flattened Device Tree)")
84 /* Maintainer: Jason Cooper <jason@lakedaemon.net> */ 107 /* Maintainer: Jason Cooper <jason@lakedaemon.net> */
85 .map_io = kirkwood_map_io, 108 .map_io = kirkwood_map_io,
86 .init_early = kirkwood_init_early, 109 .init_early = kirkwood_init_early,
87 .init_irq = kirkwood_init_irq, 110 .init_irq = orion_dt_init_irq,
88 .timer = &kirkwood_timer, 111 .timer = &kirkwood_timer,
89 .init_machine = kirkwood_dt_init, 112 .init_machine = kirkwood_dt_init,
90 .restart = kirkwood_restart, 113 .restart = kirkwood_restart,
diff --git a/arch/arm/mach-kirkwood/board-goflexnet.c b/arch/arm/mach-kirkwood/board-goflexnet.c
new file mode 100644
index 000000000000..413e2c8ef5fe
--- /dev/null
+++ b/arch/arm/mach-kirkwood/board-goflexnet.c
@@ -0,0 +1,71 @@
1/*
2 * Copyright 2012 (C), Jason Cooper <jason@lakedaemon.net>
3 *
4 * arch/arm/mach-kirkwood/board-goflexnet.c
5 *
6 * Seagate GoFlext Net Board Init for drivers not converted to
7 * flattened device tree yet.
8 *
9 * This file is licensed under the terms of the GNU General Public
10 * License version 2. This program is licensed "as is" without any
11 * warranty of any kind, whether express or implied.
12 *
13 * Copied and modified for Seagate GoFlex Net support by
14 * Joshua Coombs <josh.coombs@gmail.com> based on ArchLinux ARM's
15 * GoFlex kernel patches.
16 *
17 */
18
19#include <linux/kernel.h>
20#include <linux/init.h>
21#include <linux/platform_device.h>
22#include <linux/ata_platform.h>
23#include <linux/mv643xx_eth.h>
24#include <linux/of.h>
25#include <linux/of_address.h>
26#include <linux/of_fdt.h>
27#include <linux/of_irq.h>
28#include <linux/of_platform.h>
29#include <linux/gpio.h>
30#include <asm/mach-types.h>
31#include <asm/mach/arch.h>
32#include <asm/mach/map.h>
33#include <mach/kirkwood.h>
34#include <mach/bridge-regs.h>
35#include <plat/mvsdio.h>
36#include "common.h"
37#include "mpp.h"
38
39static struct mv643xx_eth_platform_data goflexnet_ge00_data = {
40 .phy_addr = MV643XX_ETH_PHY_ADDR(0),
41};
42
43static unsigned int goflexnet_mpp_config[] __initdata = {
44 MPP29_GPIO, /* USB Power Enable */
45 MPP47_GPIO, /* LED Orange */
46 MPP46_GPIO, /* LED Green */
47 MPP45_GPIO, /* LED Left Capacity 3 */
48 MPP44_GPIO, /* LED Left Capacity 2 */
49 MPP43_GPIO, /* LED Left Capacity 1 */
50 MPP42_GPIO, /* LED Left Capacity 0 */
51 MPP41_GPIO, /* LED Right Capacity 3 */
52 MPP40_GPIO, /* LED Right Capacity 2 */
53 MPP39_GPIO, /* LED Right Capacity 1 */
54 MPP38_GPIO, /* LED Right Capacity 0 */
55 0
56};
57
58void __init goflexnet_init(void)
59{
60 /*
61 * Basic setup. Needs to be called early.
62 */
63 kirkwood_mpp_conf(goflexnet_mpp_config);
64
65 if (gpio_request(29, "USB Power Enable") != 0 ||
66 gpio_direction_output(29, 1) != 0)
67 pr_err("can't setup GPIO 29 (USB Power Enable)\n");
68 kirkwood_ehci_init();
69
70 kirkwood_ge00_init(&goflexnet_ge00_data);
71}
diff --git a/arch/arm/mach-kirkwood/board-ib62x0.c b/arch/arm/mach-kirkwood/board-ib62x0.c
index eddf1df8891f..cfc47f80e734 100644
--- a/arch/arm/mach-kirkwood/board-ib62x0.c
+++ b/arch/arm/mach-kirkwood/board-ib62x0.c
@@ -18,9 +18,7 @@
18#include <linux/ata_platform.h> 18#include <linux/ata_platform.h>
19#include <linux/mv643xx_eth.h> 19#include <linux/mv643xx_eth.h>
20#include <linux/gpio.h> 20#include <linux/gpio.h>
21#include <linux/gpio_keys.h>
22#include <linux/input.h> 21#include <linux/input.h>
23#include <linux/leds.h>
24#include <asm/mach-types.h> 22#include <asm/mach-types.h>
25#include <asm/mach/arch.h> 23#include <asm/mach/arch.h>
26#include <mach/kirkwood.h> 24#include <mach/kirkwood.h>
@@ -33,10 +31,6 @@ static struct mv643xx_eth_platform_data ib62x0_ge00_data = {
33 .phy_addr = MV643XX_ETH_PHY_ADDR(8), 31 .phy_addr = MV643XX_ETH_PHY_ADDR(8),
34}; 32};
35 33
36static struct mv_sata_platform_data ib62x0_sata_data = {
37 .n_ports = 2,
38};
39
40static unsigned int ib62x0_mpp_config[] __initdata = { 34static unsigned int ib62x0_mpp_config[] __initdata = {
41 MPP0_NF_IO2, 35 MPP0_NF_IO2,
42 MPP1_NF_IO3, 36 MPP1_NF_IO3,
@@ -55,69 +49,6 @@ static unsigned int ib62x0_mpp_config[] __initdata = {
55 0 49 0
56}; 50};
57 51
58static struct gpio_led ib62x0_led_pins[] = {
59 {
60 .name = "ib62x0:green:os",
61 .default_trigger = "default-on",
62 .gpio = 25,
63 .active_low = 0,
64 },
65 {
66 .name = "ib62x0:red:os",
67 .default_trigger = "none",
68 .gpio = 22,
69 .active_low = 0,
70 },
71 {
72 .name = "ib62x0:red:usb_copy",
73 .default_trigger = "none",
74 .gpio = 27,
75 .active_low = 0,
76 },
77};
78
79static struct gpio_led_platform_data ib62x0_led_data = {
80 .leds = ib62x0_led_pins,
81 .num_leds = ARRAY_SIZE(ib62x0_led_pins),
82};
83
84static struct platform_device ib62x0_led_device = {
85 .name = "leds-gpio",
86 .id = -1,
87 .dev = {
88 .platform_data = &ib62x0_led_data,
89 }
90};
91
92static struct gpio_keys_button ib62x0_button_pins[] = {
93 {
94 .code = KEY_COPY,
95 .gpio = 29,
96 .desc = "USB Copy",
97 .active_low = 1,
98 },
99 {
100 .code = KEY_RESTART,
101 .gpio = 28,
102 .desc = "Reset",
103 .active_low = 1,
104 },
105};
106
107static struct gpio_keys_platform_data ib62x0_button_data = {
108 .buttons = ib62x0_button_pins,
109 .nbuttons = ARRAY_SIZE(ib62x0_button_pins),
110};
111
112static struct platform_device ib62x0_button_device = {
113 .name = "gpio-keys",
114 .id = -1,
115 .num_resources = 0,
116 .dev = {
117 .platform_data = &ib62x0_button_data,
118 }
119};
120
121static void ib62x0_power_off(void) 52static void ib62x0_power_off(void)
122{ 53{
123 gpio_set_value(IB62X0_GPIO_POWER_OFF, 1); 54 gpio_set_value(IB62X0_GPIO_POWER_OFF, 1);
@@ -132,9 +63,6 @@ void __init ib62x0_init(void)
132 63
133 kirkwood_ehci_init(); 64 kirkwood_ehci_init();
134 kirkwood_ge00_init(&ib62x0_ge00_data); 65 kirkwood_ge00_init(&ib62x0_ge00_data);
135 kirkwood_sata_init(&ib62x0_sata_data);
136 platform_device_register(&ib62x0_led_device);
137 platform_device_register(&ib62x0_button_device);
138 if (gpio_request(IB62X0_GPIO_POWER_OFF, "ib62x0:power:off") == 0 && 66 if (gpio_request(IB62X0_GPIO_POWER_OFF, "ib62x0:power:off") == 0 &&
139 gpio_direction_output(IB62X0_GPIO_POWER_OFF, 0) == 0) 67 gpio_direction_output(IB62X0_GPIO_POWER_OFF, 0) == 0)
140 pm_power_off = ib62x0_power_off; 68 pm_power_off = ib62x0_power_off;
diff --git a/arch/arm/mach-kirkwood/board-iconnect.c b/arch/arm/mach-kirkwood/board-iconnect.c
index b0d3cc49269d..d7a9198ed300 100644
--- a/arch/arm/mach-kirkwood/board-iconnect.c
+++ b/arch/arm/mach-kirkwood/board-iconnect.c
@@ -19,8 +19,6 @@
19#include <linux/mtd/partitions.h> 19#include <linux/mtd/partitions.h>
20#include <linux/mv643xx_eth.h> 20#include <linux/mv643xx_eth.h>
21#include <linux/gpio.h> 21#include <linux/gpio.h>
22#include <linux/leds.h>
23#include <linux/i2c.h>
24#include <linux/input.h> 22#include <linux/input.h>
25#include <linux/gpio_keys.h> 23#include <linux/gpio_keys.h>
26#include <asm/mach/arch.h> 24#include <asm/mach/arch.h>
@@ -32,50 +30,6 @@ static struct mv643xx_eth_platform_data iconnect_ge00_data = {
32 .phy_addr = MV643XX_ETH_PHY_ADDR(11), 30 .phy_addr = MV643XX_ETH_PHY_ADDR(11),
33}; 31};
34 32
35static struct gpio_led iconnect_led_pins[] = {
36 {
37 .name = "led_level",
38 .gpio = 41,
39 .default_trigger = "default-on",
40 }, {
41 .name = "power:blue",
42 .gpio = 42,
43 .default_trigger = "timer",
44 }, {
45 .name = "power:red",
46 .gpio = 43,
47 }, {
48 .name = "usb1:blue",
49 .gpio = 44,
50 }, {
51 .name = "usb2:blue",
52 .gpio = 45,
53 }, {
54 .name = "usb3:blue",
55 .gpio = 46,
56 }, {
57 .name = "usb4:blue",
58 .gpio = 47,
59 }, {
60 .name = "otb:blue",
61 .gpio = 48,
62 },
63};
64
65static struct gpio_led_platform_data iconnect_led_data = {
66 .leds = iconnect_led_pins,
67 .num_leds = ARRAY_SIZE(iconnect_led_pins),
68 .gpio_blink_set = orion_gpio_led_blink_set,
69};
70
71static struct platform_device iconnect_leds = {
72 .name = "leds-gpio",
73 .id = -1,
74 .dev = {
75 .platform_data = &iconnect_led_data,
76 }
77};
78
79static unsigned int iconnect_mpp_config[] __initdata = { 33static unsigned int iconnect_mpp_config[] __initdata = {
80 MPP12_GPIO, 34 MPP12_GPIO,
81 MPP35_GPIO, 35 MPP35_GPIO,
@@ -90,12 +44,6 @@ static unsigned int iconnect_mpp_config[] __initdata = {
90 0 44 0
91}; 45};
92 46
93static struct i2c_board_info __initdata iconnect_board_info[] = {
94 {
95 I2C_BOARD_INFO("lm63", 0x4c),
96 },
97};
98
99static struct mtd_partition iconnect_nand_parts[] = { 47static struct mtd_partition iconnect_nand_parts[] = {
100 { 48 {
101 .name = "flash", 49 .name = "flash",
@@ -142,15 +90,11 @@ void __init iconnect_init(void)
142{ 90{
143 kirkwood_mpp_conf(iconnect_mpp_config); 91 kirkwood_mpp_conf(iconnect_mpp_config);
144 kirkwood_nand_init(ARRAY_AND_SIZE(iconnect_nand_parts), 25); 92 kirkwood_nand_init(ARRAY_AND_SIZE(iconnect_nand_parts), 25);
145 kirkwood_i2c_init();
146 i2c_register_board_info(0, iconnect_board_info,
147 ARRAY_SIZE(iconnect_board_info));
148 93
149 kirkwood_ehci_init(); 94 kirkwood_ehci_init();
150 kirkwood_ge00_init(&iconnect_ge00_data); 95 kirkwood_ge00_init(&iconnect_ge00_data);
151 96
152 platform_device_register(&iconnect_button_device); 97 platform_device_register(&iconnect_button_device);
153 platform_device_register(&iconnect_leds);
154} 98}
155 99
156static int __init iconnect_pci_init(void) 100static int __init iconnect_pci_init(void)
diff --git a/arch/arm/mach-kirkwood/board-lsxl.c b/arch/arm/mach-kirkwood/board-lsxl.c
new file mode 100644
index 000000000000..83d8975592f8
--- /dev/null
+++ b/arch/arm/mach-kirkwood/board-lsxl.c
@@ -0,0 +1,135 @@
1/*
2 * Copyright 2012 (C), Michael Walle <michael@walle.cc>
3 *
4 * arch/arm/mach-kirkwood/board-lsxl.c
5 *
6 * Buffalo Linkstation LS-XHL and LS-CHLv2 init for drivers not
7 * converted to flattened device tree yet.
8 *
9 * This file is licensed under the terms of the GNU General Public
10 * License version 2. This program is licensed "as is" without any
11 * warranty of any kind, whether express or implied.
12 */
13
14#include <linux/kernel.h>
15#include <linux/init.h>
16#include <linux/platform_device.h>
17#include <linux/mtd/partitions.h>
18#include <linux/ata_platform.h>
19#include <linux/spi/flash.h>
20#include <linux/spi/spi.h>
21#include <linux/mv643xx_eth.h>
22#include <linux/gpio.h>
23#include <linux/gpio-fan.h>
24#include <linux/input.h>
25#include <asm/mach-types.h>
26#include <asm/mach/arch.h>
27#include <mach/kirkwood.h>
28#include "common.h"
29#include "mpp.h"
30
31static struct mv643xx_eth_platform_data lsxl_ge00_data = {
32 .phy_addr = MV643XX_ETH_PHY_ADDR(0),
33};
34
35static struct mv643xx_eth_platform_data lsxl_ge01_data = {
36 .phy_addr = MV643XX_ETH_PHY_ADDR(8),
37};
38
39static unsigned int lsxl_mpp_config[] __initdata = {
40 MPP10_GPO, /* HDD Power Enable */
41 MPP11_GPIO, /* USB Vbus Enable */
42 MPP18_GPO, /* FAN High Enable# */
43 MPP19_GPO, /* FAN Low Enable# */
44 MPP36_GPIO, /* Function Blue LED */
45 MPP37_GPIO, /* Alarm LED */
46 MPP38_GPIO, /* Info LED */
47 MPP39_GPIO, /* Power LED */
48 MPP40_GPIO, /* Fan Lock */
49 MPP41_GPIO, /* Function Button */
50 MPP42_GPIO, /* Power Switch */
51 MPP43_GPIO, /* Power Auto Switch */
52 MPP48_GPIO, /* Function Red LED */
53 0
54};
55
56#define LSXL_GPIO_FAN_HIGH 18
57#define LSXL_GPIO_FAN_LOW 19
58#define LSXL_GPIO_FAN_LOCK 40
59
60static struct gpio_fan_alarm lsxl_alarm = {
61 .gpio = LSXL_GPIO_FAN_LOCK,
62};
63
64static struct gpio_fan_speed lsxl_speeds[] = {
65 {
66 .rpm = 0,
67 .ctrl_val = 3,
68 }, {
69 .rpm = 1500,
70 .ctrl_val = 1,
71 }, {
72 .rpm = 3250,
73 .ctrl_val = 2,
74 }, {
75 .rpm = 5000,
76 .ctrl_val = 0,
77 }
78};
79
80static int lsxl_gpio_list[] = {
81 LSXL_GPIO_FAN_HIGH, LSXL_GPIO_FAN_LOW,
82};
83
84static struct gpio_fan_platform_data lsxl_fan_data = {
85 .num_ctrl = ARRAY_SIZE(lsxl_gpio_list),
86 .ctrl = lsxl_gpio_list,
87 .alarm = &lsxl_alarm,
88 .num_speed = ARRAY_SIZE(lsxl_speeds),
89 .speed = lsxl_speeds,
90};
91
92static struct platform_device lsxl_fan_device = {
93 .name = "gpio-fan",
94 .id = -1,
95 .num_resources = 0,
96 .dev = {
97 .platform_data = &lsxl_fan_data,
98 },
99};
100
101/*
102 * On the LS-XHL/LS-CHLv2, the shutdown process is following:
103 * - Userland monitors key events until the power switch goes to off position
104 * - The board reboots
105 * - U-boot starts and goes into an idle mode waiting for the user
106 * to move the switch to ON position
107 *
108 */
109static void lsxl_power_off(void)
110{
111 kirkwood_restart('h', NULL);
112}
113
114#define LSXL_GPIO_HDD_POWER 10
115#define LSXL_GPIO_USB_POWER 11
116
117void __init lsxl_init(void)
118{
119 /*
120 * Basic setup. Needs to be called early.
121 */
122 kirkwood_mpp_conf(lsxl_mpp_config);
123
124 /* usb and sata power on */
125 gpio_set_value(LSXL_GPIO_USB_POWER, 1);
126 gpio_set_value(LSXL_GPIO_HDD_POWER, 1);
127
128 kirkwood_ehci_init();
129 kirkwood_ge00_init(&lsxl_ge00_data);
130 kirkwood_ge01_init(&lsxl_ge01_data);
131 platform_device_register(&lsxl_fan_device);
132
133 /* register power-off method */
134 pm_power_off = lsxl_power_off;
135}
diff --git a/arch/arm/mach-kirkwood/board-ts219.c b/arch/arm/mach-kirkwood/board-ts219.c
new file mode 100644
index 000000000000..1750e68506c1
--- /dev/null
+++ b/arch/arm/mach-kirkwood/board-ts219.c
@@ -0,0 +1,82 @@
1/*
2 *
3 * QNAP TS-11x/TS-21x Turbo NAS Board Setup via DT
4 *
5 * Copyright (C) 2012 Andrew Lunn <andrew@lunn.ch>
6 *
7 * Based on the board file ts219-setup.c:
8 *
9 * Copyright (C) 2009 Martin Michlmayr <tbm@cyrius.com>
10 * Copyright (C) 2008 Byron Bradley <byron.bbradley@gmail.com>
11 *
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation; either version
15 * 2 of the License, or (at your option) any later version.
16 */
17
18#include <linux/kernel.h>
19#include <linux/init.h>
20#include <linux/platform_device.h>
21#include <linux/mv643xx_eth.h>
22#include <linux/ata_platform.h>
23#include <linux/gpio_keys.h>
24#include <linux/input.h>
25#include <asm/mach-types.h>
26#include <asm/mach/arch.h>
27#include <mach/kirkwood.h>
28#include "common.h"
29#include "mpp.h"
30#include "tsx1x-common.h"
31
32static struct mv643xx_eth_platform_data qnap_ts219_ge00_data = {
33 .phy_addr = MV643XX_ETH_PHY_ADDR(8),
34};
35
36static unsigned int qnap_ts219_mpp_config[] __initdata = {
37 MPP0_SPI_SCn,
38 MPP1_SPI_MOSI,
39 MPP2_SPI_SCK,
40 MPP3_SPI_MISO,
41 MPP4_SATA1_ACTn,
42 MPP5_SATA0_ACTn,
43 MPP8_TW0_SDA,
44 MPP9_TW0_SCK,
45 MPP10_UART0_TXD,
46 MPP11_UART0_RXD,
47 MPP13_UART1_TXD, /* PIC controller */
48 MPP14_UART1_RXD, /* PIC controller */
49 MPP15_GPIO, /* USB Copy button (on devices with 88F6281) */
50 MPP16_GPIO, /* Reset button (on devices with 88F6281) */
51 MPP36_GPIO, /* RAM: 0: 256 MB, 1: 512 MB */
52 MPP37_GPIO, /* Reset button (on devices with 88F6282) */
53 MPP43_GPIO, /* USB Copy button (on devices with 88F6282) */
54 MPP44_GPIO, /* Board ID: 0: TS-11x, 1: TS-21x */
55 0
56};
57
58void __init qnap_dt_ts219_init(void)
59{
60 u32 dev, rev;
61
62 kirkwood_mpp_conf(qnap_ts219_mpp_config);
63
64 kirkwood_pcie_id(&dev, &rev);
65 if (dev == MV88F6282_DEV_ID)
66 qnap_ts219_ge00_data.phy_addr = MV643XX_ETH_PHY_ADDR(0);
67
68 kirkwood_ge00_init(&qnap_ts219_ge00_data);
69 kirkwood_ehci_init();
70
71 pm_power_off = qnap_tsx1x_power_off;
72}
73
74/* FIXME: Will not work with DT. Maybe use MPP40_GPIO? */
75static int __init ts219_pci_init(void)
76{
77 if (machine_is_ts219())
78 kirkwood_pcie_init(KW_PCIE0);
79
80 return 0;
81}
82subsys_initcall(ts219_pci_init);
diff --git a/arch/arm/mach-kirkwood/common.c b/arch/arm/mach-kirkwood/common.c
index f261cd242643..c4b64adcbfce 100644
--- a/arch/arm/mach-kirkwood/common.c
+++ b/arch/arm/mach-kirkwood/common.c
@@ -17,6 +17,7 @@
17#include <linux/dma-mapping.h> 17#include <linux/dma-mapping.h>
18#include <linux/clk-provider.h> 18#include <linux/clk-provider.h>
19#include <linux/spinlock.h> 19#include <linux/spinlock.h>
20#include <linux/mv643xx_i2c.h>
20#include <net/dsa.h> 21#include <net/dsa.h>
21#include <asm/page.h> 22#include <asm/page.h>
22#include <asm/timex.h> 23#include <asm/timex.h>
@@ -67,6 +68,14 @@ void __init kirkwood_map_io(void)
67 * CLK tree 68 * CLK tree
68 ****************************************************************************/ 69 ****************************************************************************/
69 70
71static void enable_sata0(void)
72{
73 /* Enable PLL and IVREF */
74 writel(readl(SATA0_PHY_MODE_2) | 0xf, SATA0_PHY_MODE_2);
75 /* Enable PHY */
76 writel(readl(SATA0_IF_CTRL) & ~0x200, SATA0_IF_CTRL);
77}
78
70static void disable_sata0(void) 79static void disable_sata0(void)
71{ 80{
72 /* Disable PLL and IVREF */ 81 /* Disable PLL and IVREF */
@@ -75,6 +84,14 @@ static void disable_sata0(void)
75 writel(readl(SATA0_IF_CTRL) | 0x200, SATA0_IF_CTRL); 84 writel(readl(SATA0_IF_CTRL) | 0x200, SATA0_IF_CTRL);
76} 85}
77 86
87static void enable_sata1(void)
88{
89 /* Enable PLL and IVREF */
90 writel(readl(SATA1_PHY_MODE_2) | 0xf, SATA1_PHY_MODE_2);
91 /* Enable PHY */
92 writel(readl(SATA1_IF_CTRL) & ~0x200, SATA1_IF_CTRL);
93}
94
78static void disable_sata1(void) 95static void disable_sata1(void)
79{ 96{
80 /* Disable PLL and IVREF */ 97 /* Disable PLL and IVREF */
@@ -107,23 +124,38 @@ static void disable_pcie1(void)
107 } 124 }
108} 125}
109 126
110/* An extended version of the gated clk. This calls fn() before 127/* An extended version of the gated clk. This calls fn_en()/fn_dis
111 * disabling the clock. We use this to turn off PHYs etc. */ 128 * before enabling/disabling the clock. We use this to turn on/off
129 * PHYs etc. */
112struct clk_gate_fn { 130struct clk_gate_fn {
113 struct clk_gate gate; 131 struct clk_gate gate;
114 void (*fn)(void); 132 void (*fn_en)(void);
133 void (*fn_dis)(void);
115}; 134};
116 135
117#define to_clk_gate_fn(_gate) container_of(_gate, struct clk_gate_fn, gate) 136#define to_clk_gate_fn(_gate) container_of(_gate, struct clk_gate_fn, gate)
118#define to_clk_gate(_hw) container_of(_hw, struct clk_gate, hw) 137#define to_clk_gate(_hw) container_of(_hw, struct clk_gate, hw)
119 138
139static int clk_gate_fn_enable(struct clk_hw *hw)
140{
141 struct clk_gate *gate = to_clk_gate(hw);
142 struct clk_gate_fn *gate_fn = to_clk_gate_fn(gate);
143 int ret;
144
145 ret = clk_gate_ops.enable(hw);
146 if (!ret && gate_fn->fn_en)
147 gate_fn->fn_en();
148
149 return ret;
150}
151
120static void clk_gate_fn_disable(struct clk_hw *hw) 152static void clk_gate_fn_disable(struct clk_hw *hw)
121{ 153{
122 struct clk_gate *gate = to_clk_gate(hw); 154 struct clk_gate *gate = to_clk_gate(hw);
123 struct clk_gate_fn *gate_fn = to_clk_gate_fn(gate); 155 struct clk_gate_fn *gate_fn = to_clk_gate_fn(gate);
124 156
125 if (gate_fn->fn) 157 if (gate_fn->fn_dis)
126 gate_fn->fn(); 158 gate_fn->fn_dis();
127 159
128 clk_gate_ops.disable(hw); 160 clk_gate_ops.disable(hw);
129} 161}
@@ -135,7 +167,7 @@ static struct clk __init *clk_register_gate_fn(struct device *dev,
135 const char *parent_name, unsigned long flags, 167 const char *parent_name, unsigned long flags,
136 void __iomem *reg, u8 bit_idx, 168 void __iomem *reg, u8 bit_idx,
137 u8 clk_gate_flags, spinlock_t *lock, 169 u8 clk_gate_flags, spinlock_t *lock,
138 void (*fn)(void)) 170 void (*fn_en)(void), void (*fn_dis)(void))
139{ 171{
140 struct clk_gate_fn *gate_fn; 172 struct clk_gate_fn *gate_fn;
141 struct clk *clk; 173 struct clk *clk;
@@ -159,11 +191,14 @@ static struct clk __init *clk_register_gate_fn(struct device *dev,
159 gate_fn->gate.flags = clk_gate_flags; 191 gate_fn->gate.flags = clk_gate_flags;
160 gate_fn->gate.lock = lock; 192 gate_fn->gate.lock = lock;
161 gate_fn->gate.hw.init = &init; 193 gate_fn->gate.hw.init = &init;
162 gate_fn->fn = fn; 194 gate_fn->fn_en = fn_en;
195 gate_fn->fn_dis = fn_dis;
163 196
164 /* ops is the gate ops, but with our disable function */ 197 /* ops is the gate ops, but with our enable/disable functions */
165 if (clk_gate_fn_ops.disable != clk_gate_fn_disable) { 198 if (clk_gate_fn_ops.enable != clk_gate_fn_enable ||
199 clk_gate_fn_ops.disable != clk_gate_fn_disable) {
166 clk_gate_fn_ops = clk_gate_ops; 200 clk_gate_fn_ops = clk_gate_ops;
201 clk_gate_fn_ops.enable = clk_gate_fn_enable;
167 clk_gate_fn_ops.disable = clk_gate_fn_disable; 202 clk_gate_fn_ops.disable = clk_gate_fn_disable;
168 } 203 }
169 204
@@ -187,11 +222,12 @@ static struct clk __init *kirkwood_register_gate(const char *name, u8 bit_idx)
187 222
188static struct clk __init *kirkwood_register_gate_fn(const char *name, 223static struct clk __init *kirkwood_register_gate_fn(const char *name,
189 u8 bit_idx, 224 u8 bit_idx,
190 void (*fn)(void)) 225 void (*fn_en)(void),
226 void (*fn_dis)(void))
191{ 227{
192 return clk_register_gate_fn(NULL, name, "tclk", 0, 228 return clk_register_gate_fn(NULL, name, "tclk", 0,
193 (void __iomem *)CLOCK_GATING_CTRL, 229 (void __iomem *)CLOCK_GATING_CTRL,
194 bit_idx, 0, &gating_lock, fn); 230 bit_idx, 0, &gating_lock, fn_en, fn_dis);
195} 231}
196 232
197static struct clk *ge0, *ge1; 233static struct clk *ge0, *ge1;
@@ -208,18 +244,18 @@ void __init kirkwood_clk_init(void)
208 ge0 = kirkwood_register_gate("ge0", CGC_BIT_GE0); 244 ge0 = kirkwood_register_gate("ge0", CGC_BIT_GE0);
209 ge1 = kirkwood_register_gate("ge1", CGC_BIT_GE1); 245 ge1 = kirkwood_register_gate("ge1", CGC_BIT_GE1);
210 sata0 = kirkwood_register_gate_fn("sata0", CGC_BIT_SATA0, 246 sata0 = kirkwood_register_gate_fn("sata0", CGC_BIT_SATA0,
211 disable_sata0); 247 enable_sata0, disable_sata0);
212 sata1 = kirkwood_register_gate_fn("sata1", CGC_BIT_SATA1, 248 sata1 = kirkwood_register_gate_fn("sata1", CGC_BIT_SATA1,
213 disable_sata1); 249 enable_sata1, disable_sata1);
214 usb0 = kirkwood_register_gate("usb0", CGC_BIT_USB0); 250 usb0 = kirkwood_register_gate("usb0", CGC_BIT_USB0);
215 sdio = kirkwood_register_gate("sdio", CGC_BIT_SDIO); 251 sdio = kirkwood_register_gate("sdio", CGC_BIT_SDIO);
216 crypto = kirkwood_register_gate("crypto", CGC_BIT_CRYPTO); 252 crypto = kirkwood_register_gate("crypto", CGC_BIT_CRYPTO);
217 xor0 = kirkwood_register_gate("xor0", CGC_BIT_XOR0); 253 xor0 = kirkwood_register_gate("xor0", CGC_BIT_XOR0);
218 xor1 = kirkwood_register_gate("xor1", CGC_BIT_XOR1); 254 xor1 = kirkwood_register_gate("xor1", CGC_BIT_XOR1);
219 pex0 = kirkwood_register_gate_fn("pex0", CGC_BIT_PEX0, 255 pex0 = kirkwood_register_gate_fn("pex0", CGC_BIT_PEX0,
220 disable_pcie0); 256 NULL, disable_pcie0);
221 pex1 = kirkwood_register_gate_fn("pex1", CGC_BIT_PEX1, 257 pex1 = kirkwood_register_gate_fn("pex1", CGC_BIT_PEX1,
222 disable_pcie1); 258 NULL, disable_pcie1);
223 audio = kirkwood_register_gate("audio", CGC_BIT_AUDIO); 259 audio = kirkwood_register_gate("audio", CGC_BIT_AUDIO);
224 kirkwood_register_gate("tdm", CGC_BIT_TDM); 260 kirkwood_register_gate("tdm", CGC_BIT_TDM);
225 kirkwood_register_gate("tsu", CGC_BIT_TSU); 261 kirkwood_register_gate("tsu", CGC_BIT_TSU);
@@ -241,6 +277,12 @@ void __init kirkwood_clk_init(void)
241 orion_clkdev_add("0", "pcie", pex0); 277 orion_clkdev_add("0", "pcie", pex0);
242 orion_clkdev_add("1", "pcie", pex1); 278 orion_clkdev_add("1", "pcie", pex1);
243 orion_clkdev_add(NULL, "kirkwood-i2s", audio); 279 orion_clkdev_add(NULL, "kirkwood-i2s", audio);
280 orion_clkdev_add(NULL, MV64XXX_I2C_CTLR_NAME ".0", runit);
281
282 /* Marvell says runit is used by SPI, UART, NAND, TWSI, ...,
283 * so should never be gated.
284 */
285 clk_prepare_enable(runit);
244} 286}
245 287
246/***************************************************************************** 288/*****************************************************************************
diff --git a/arch/arm/mach-kirkwood/common.h b/arch/arm/mach-kirkwood/common.h
index 9248fa2c165b..304dd1abfdca 100644
--- a/arch/arm/mach-kirkwood/common.h
+++ b/arch/arm/mach-kirkwood/common.h
@@ -58,6 +58,11 @@ void dreamplug_init(void);
58#else 58#else
59static inline void dreamplug_init(void) {}; 59static inline void dreamplug_init(void) {};
60#endif 60#endif
61#ifdef CONFIG_MACH_TS219_DT
62void qnap_dt_ts219_init(void);
63#else
64static inline void qnap_dt_ts219_init(void) {};
65#endif
61 66
62#ifdef CONFIG_MACH_DLINK_KIRKWOOD_DT 67#ifdef CONFIG_MACH_DLINK_KIRKWOOD_DT
63void dnskw_init(void); 68void dnskw_init(void);
@@ -77,6 +82,18 @@ void ib62x0_init(void);
77static inline void ib62x0_init(void) {}; 82static inline void ib62x0_init(void) {};
78#endif 83#endif
79 84
85#ifdef CONFIG_MACH_GOFLEXNET_DT
86void goflexnet_init(void);
87#else
88static inline void goflexnet_init(void) {};
89#endif
90
91#ifdef CONFIG_MACH_LSXL_DT
92void lsxl_init(void);
93#else
94static inline void lsxl_init(void) {};
95#endif
96
80/* early init functions not converted to fdt yet */ 97/* early init functions not converted to fdt yet */
81char *kirkwood_id(void); 98char *kirkwood_id(void);
82void kirkwood_l2_init(void); 99void kirkwood_l2_init(void);
diff --git a/arch/arm/mach-kirkwood/irq.c b/arch/arm/mach-kirkwood/irq.c
index c4c68e5b94f1..720063ffa19d 100644
--- a/arch/arm/mach-kirkwood/irq.c
+++ b/arch/arm/mach-kirkwood/irq.c
@@ -9,20 +9,23 @@
9 */ 9 */
10#include <linux/gpio.h> 10#include <linux/gpio.h>
11#include <linux/kernel.h> 11#include <linux/kernel.h>
12#include <linux/init.h>
13#include <linux/irq.h> 12#include <linux/irq.h>
14#include <linux/io.h>
15#include <mach/bridge-regs.h> 13#include <mach/bridge-regs.h>
16#include <plat/irq.h> 14#include <plat/irq.h>
17#include "common.h"
18 15
19static void gpio_irq_handler(unsigned int irq, struct irq_desc *desc) 16static int __initdata gpio0_irqs[4] = {
20{ 17 IRQ_KIRKWOOD_GPIO_LOW_0_7,
21 BUG_ON(irq < IRQ_KIRKWOOD_GPIO_LOW_0_7); 18 IRQ_KIRKWOOD_GPIO_LOW_8_15,
22 BUG_ON(irq > IRQ_KIRKWOOD_GPIO_HIGH_16_23); 19 IRQ_KIRKWOOD_GPIO_LOW_16_23,
20 IRQ_KIRKWOOD_GPIO_LOW_24_31,
21};
23 22
24 orion_gpio_irq_handler((irq - IRQ_KIRKWOOD_GPIO_LOW_0_7) << 3); 23static int __initdata gpio1_irqs[4] = {
25} 24 IRQ_KIRKWOOD_GPIO_HIGH_0_7,
25 IRQ_KIRKWOOD_GPIO_HIGH_8_15,
26 IRQ_KIRKWOOD_GPIO_HIGH_16_23,
27 0,
28};
26 29
27void __init kirkwood_init_irq(void) 30void __init kirkwood_init_irq(void)
28{ 31{
@@ -32,17 +35,8 @@ void __init kirkwood_init_irq(void)
32 /* 35 /*
33 * Initialize gpiolib for GPIOs 0-49. 36 * Initialize gpiolib for GPIOs 0-49.
34 */ 37 */
35 orion_gpio_init(0, 32, GPIO_LOW_VIRT_BASE, 0, 38 orion_gpio_init(NULL, 0, 32, (void __iomem *)GPIO_LOW_VIRT_BASE, 0,
36 IRQ_KIRKWOOD_GPIO_START); 39 IRQ_KIRKWOOD_GPIO_START, gpio0_irqs);
37 irq_set_chained_handler(IRQ_KIRKWOOD_GPIO_LOW_0_7, gpio_irq_handler); 40 orion_gpio_init(NULL, 32, 18, (void __iomem *)GPIO_HIGH_VIRT_BASE, 0,
38 irq_set_chained_handler(IRQ_KIRKWOOD_GPIO_LOW_8_15, gpio_irq_handler); 41 IRQ_KIRKWOOD_GPIO_START + 32, gpio1_irqs);
39 irq_set_chained_handler(IRQ_KIRKWOOD_GPIO_LOW_16_23, gpio_irq_handler);
40 irq_set_chained_handler(IRQ_KIRKWOOD_GPIO_LOW_24_31, gpio_irq_handler);
41
42 orion_gpio_init(32, 18, GPIO_HIGH_VIRT_BASE, 0,
43 IRQ_KIRKWOOD_GPIO_START + 32);
44 irq_set_chained_handler(IRQ_KIRKWOOD_GPIO_HIGH_0_7, gpio_irq_handler);
45 irq_set_chained_handler(IRQ_KIRKWOOD_GPIO_HIGH_8_15, gpio_irq_handler);
46 irq_set_chained_handler(IRQ_KIRKWOOD_GPIO_HIGH_16_23,
47 gpio_irq_handler);
48} 42}
diff --git a/arch/arm/mach-mv78xx0/irq.c b/arch/arm/mach-mv78xx0/irq.c
index e421b701663b..eff9a750bbe2 100644
--- a/arch/arm/mach-mv78xx0/irq.c
+++ b/arch/arm/mach-mv78xx0/irq.c
@@ -9,19 +9,17 @@
9 */ 9 */
10#include <linux/gpio.h> 10#include <linux/gpio.h>
11#include <linux/kernel.h> 11#include <linux/kernel.h>
12#include <linux/init.h>
13#include <linux/pci.h>
14#include <linux/irq.h> 12#include <linux/irq.h>
15#include <mach/bridge-regs.h> 13#include <mach/bridge-regs.h>
16#include <plat/irq.h> 14#include <plat/irq.h>
17#include "common.h" 15#include "common.h"
18 16
19static void gpio_irq_handler(unsigned int irq, struct irq_desc *desc) 17static int __initdata gpio0_irqs[4] = {
20{ 18 IRQ_MV78XX0_GPIO_0_7,
21 BUG_ON(irq < IRQ_MV78XX0_GPIO_0_7 || irq > IRQ_MV78XX0_GPIO_24_31); 19 IRQ_MV78XX0_GPIO_8_15,
22 20 IRQ_MV78XX0_GPIO_16_23,
23 orion_gpio_irq_handler((irq - IRQ_MV78XX0_GPIO_0_7) << 3); 21 IRQ_MV78XX0_GPIO_24_31,
24} 22};
25 23
26void __init mv78xx0_init_irq(void) 24void __init mv78xx0_init_irq(void)
27{ 25{
@@ -34,11 +32,7 @@ void __init mv78xx0_init_irq(void)
34 * registers for core #1 are at an offset of 0x18 from those of 32 * registers for core #1 are at an offset of 0x18 from those of
35 * core #0.) 33 * core #0.)
36 */ 34 */
37 orion_gpio_init(0, 32, GPIO_VIRT_BASE, 35 orion_gpio_init(NULL, 0, 32, (void __iomem *)GPIO_VIRT_BASE,
38 mv78xx0_core_index() ? 0x18 : 0, 36 mv78xx0_core_index() ? 0x18 : 0,
39 IRQ_MV78XX0_GPIO_START); 37 IRQ_MV78XX0_GPIO_START, gpio0_irqs);
40 irq_set_chained_handler(IRQ_MV78XX0_GPIO_0_7, gpio_irq_handler);
41 irq_set_chained_handler(IRQ_MV78XX0_GPIO_8_15, gpio_irq_handler);
42 irq_set_chained_handler(IRQ_MV78XX0_GPIO_16_23, gpio_irq_handler);
43 irq_set_chained_handler(IRQ_MV78XX0_GPIO_24_31, gpio_irq_handler);
44} 38}
diff --git a/arch/arm/mach-orion5x/irq.c b/arch/arm/mach-orion5x/irq.c
index b1b45fff776e..17da7091d310 100644
--- a/arch/arm/mach-orion5x/irq.c
+++ b/arch/arm/mach-orion5x/irq.c
@@ -11,19 +11,16 @@
11 */ 11 */
12#include <linux/gpio.h> 12#include <linux/gpio.h>
13#include <linux/kernel.h> 13#include <linux/kernel.h>
14#include <linux/init.h>
15#include <linux/irq.h> 14#include <linux/irq.h>
16#include <linux/io.h>
17#include <mach/bridge-regs.h> 15#include <mach/bridge-regs.h>
18#include <plat/irq.h> 16#include <plat/irq.h>
19#include "common.h"
20 17
21static void gpio_irq_handler(unsigned int irq, struct irq_desc *desc) 18static int __initdata gpio0_irqs[4] = {
22{ 19 IRQ_ORION5X_GPIO_0_7,
23 BUG_ON(irq < IRQ_ORION5X_GPIO_0_7 || irq > IRQ_ORION5X_GPIO_24_31); 20 IRQ_ORION5X_GPIO_8_15,
24 21 IRQ_ORION5X_GPIO_16_23,
25 orion_gpio_irq_handler((irq - IRQ_ORION5X_GPIO_0_7) << 3); 22 IRQ_ORION5X_GPIO_24_31,
26} 23};
27 24
28void __init orion5x_init_irq(void) 25void __init orion5x_init_irq(void)
29{ 26{
@@ -32,9 +29,6 @@ void __init orion5x_init_irq(void)
32 /* 29 /*
33 * Initialize gpiolib for GPIOs 0-31. 30 * Initialize gpiolib for GPIOs 0-31.
34 */ 31 */
35 orion_gpio_init(0, 32, GPIO_VIRT_BASE, 0, IRQ_ORION5X_GPIO_START); 32 orion_gpio_init(NULL, 0, 32, (void __iomem *)GPIO_VIRT_BASE, 0,
36 irq_set_chained_handler(IRQ_ORION5X_GPIO_0_7, gpio_irq_handler); 33 IRQ_ORION5X_GPIO_START, gpio0_irqs);
37 irq_set_chained_handler(IRQ_ORION5X_GPIO_8_15, gpio_irq_handler);
38 irq_set_chained_handler(IRQ_ORION5X_GPIO_16_23, gpio_irq_handler);
39 irq_set_chained_handler(IRQ_ORION5X_GPIO_24_31, gpio_irq_handler);
40} 34}
diff --git a/arch/arm/plat-orion/common.c b/arch/arm/plat-orion/common.c
index c1793786aea9..d245a87dc014 100644
--- a/arch/arm/plat-orion/common.c
+++ b/arch/arm/plat-orion/common.c
@@ -47,6 +47,7 @@ void __init orion_clkdev_init(struct clk *tclk)
47 orion_clkdev_add(NULL, MV643XX_ETH_NAME ".2", tclk); 47 orion_clkdev_add(NULL, MV643XX_ETH_NAME ".2", tclk);
48 orion_clkdev_add(NULL, MV643XX_ETH_NAME ".3", tclk); 48 orion_clkdev_add(NULL, MV643XX_ETH_NAME ".3", tclk);
49 orion_clkdev_add(NULL, "orion_wdt", tclk); 49 orion_clkdev_add(NULL, "orion_wdt", tclk);
50 orion_clkdev_add(NULL, MV64XXX_I2C_CTLR_NAME ".0", tclk);
50} 51}
51 52
52/* Fill in the resources structure and link it into the platform 53/* Fill in the resources structure and link it into the platform
diff --git a/arch/arm/plat-orion/gpio.c b/arch/arm/plat-orion/gpio.c
index af95af257301..dfda74fae6f2 100644
--- a/arch/arm/plat-orion/gpio.c
+++ b/arch/arm/plat-orion/gpio.c
@@ -8,15 +8,22 @@
8 * warranty of any kind, whether express or implied. 8 * warranty of any kind, whether express or implied.
9 */ 9 */
10 10
11#define DEBUG
12
11#include <linux/kernel.h> 13#include <linux/kernel.h>
12#include <linux/init.h> 14#include <linux/init.h>
13#include <linux/irq.h> 15#include <linux/irq.h>
16#include <linux/irqdomain.h>
14#include <linux/module.h> 17#include <linux/module.h>
15#include <linux/spinlock.h> 18#include <linux/spinlock.h>
16#include <linux/bitops.h> 19#include <linux/bitops.h>
17#include <linux/io.h> 20#include <linux/io.h>
18#include <linux/gpio.h> 21#include <linux/gpio.h>
19#include <linux/leds.h> 22#include <linux/leds.h>
23#include <linux/of.h>
24#include <linux/of_irq.h>
25#include <linux/of_address.h>
26#include <plat/gpio.h>
20 27
21/* 28/*
22 * GPIO unit register offsets. 29 * GPIO unit register offsets.
@@ -38,6 +45,7 @@ struct orion_gpio_chip {
38 unsigned long valid_output; 45 unsigned long valid_output;
39 int mask_offset; 46 int mask_offset;
40 int secondary_irq_base; 47 int secondary_irq_base;
48 struct irq_domain *domain;
41}; 49};
42 50
43static void __iomem *GPIO_OUT(struct orion_gpio_chip *ochip) 51static void __iomem *GPIO_OUT(struct orion_gpio_chip *ochip)
@@ -222,10 +230,10 @@ static int orion_gpio_to_irq(struct gpio_chip *chip, unsigned pin)
222 struct orion_gpio_chip *ochip = 230 struct orion_gpio_chip *ochip =
223 container_of(chip, struct orion_gpio_chip, chip); 231 container_of(chip, struct orion_gpio_chip, chip);
224 232
225 return ochip->secondary_irq_base + pin; 233 return irq_create_mapping(ochip->domain,
234 ochip->secondary_irq_base + pin);
226} 235}
227 236
228
229/* 237/*
230 * Orion-specific GPIO API extensions. 238 * Orion-specific GPIO API extensions.
231 */ 239 */
@@ -353,12 +361,10 @@ static int gpio_irq_set_type(struct irq_data *d, u32 type)
353 int pin; 361 int pin;
354 u32 u; 362 u32 u;
355 363
356 pin = d->irq - gc->irq_base; 364 pin = d->hwirq - ochip->secondary_irq_base;
357 365
358 u = readl(GPIO_IO_CONF(ochip)) & (1 << pin); 366 u = readl(GPIO_IO_CONF(ochip)) & (1 << pin);
359 if (!u) { 367 if (!u) {
360 printk(KERN_ERR "orion gpio_irq_set_type failed "
361 "(irq %d, pin %d).\n", d->irq, pin);
362 return -EINVAL; 368 return -EINVAL;
363 } 369 }
364 370
@@ -397,17 +403,53 @@ static int gpio_irq_set_type(struct irq_data *d, u32 type)
397 u &= ~(1 << pin); /* rising */ 403 u &= ~(1 << pin); /* rising */
398 writel(u, GPIO_IN_POL(ochip)); 404 writel(u, GPIO_IN_POL(ochip));
399 } 405 }
400
401 return 0; 406 return 0;
402} 407}
403 408
404void __init orion_gpio_init(int gpio_base, int ngpio, 409static void gpio_irq_handler(unsigned irq, struct irq_desc *desc)
405 u32 base, int mask_offset, int secondary_irq_base) 410{
411 struct orion_gpio_chip *ochip = irq_get_handler_data(irq);
412 u32 cause, type;
413 int i;
414
415 if (ochip == NULL)
416 return;
417
418 cause = readl(GPIO_DATA_IN(ochip)) & readl(GPIO_LEVEL_MASK(ochip));
419 cause |= readl(GPIO_EDGE_CAUSE(ochip)) & readl(GPIO_EDGE_MASK(ochip));
420
421 for (i = 0; i < ochip->chip.ngpio; i++) {
422 int irq;
423
424 irq = ochip->secondary_irq_base + i;
425
426 if (!(cause & (1 << i)))
427 continue;
428
429 type = irqd_get_trigger_type(irq_get_irq_data(irq));
430 if ((type & IRQ_TYPE_SENSE_MASK) == IRQ_TYPE_EDGE_BOTH) {
431 /* Swap polarity (race with GPIO line) */
432 u32 polarity;
433
434 polarity = readl(GPIO_IN_POL(ochip));
435 polarity ^= 1 << i;
436 writel(polarity, GPIO_IN_POL(ochip));
437 }
438 generic_handle_irq(irq);
439 }
440}
441
442void __init orion_gpio_init(struct device_node *np,
443 int gpio_base, int ngpio,
444 void __iomem *base, int mask_offset,
445 int secondary_irq_base,
446 int irqs[4])
406{ 447{
407 struct orion_gpio_chip *ochip; 448 struct orion_gpio_chip *ochip;
408 struct irq_chip_generic *gc; 449 struct irq_chip_generic *gc;
409 struct irq_chip_type *ct; 450 struct irq_chip_type *ct;
410 char gc_label[16]; 451 char gc_label[16];
452 int i;
411 453
412 if (orion_gpio_chip_count == ARRAY_SIZE(orion_gpio_chips)) 454 if (orion_gpio_chip_count == ARRAY_SIZE(orion_gpio_chips))
413 return; 455 return;
@@ -426,6 +468,10 @@ void __init orion_gpio_init(int gpio_base, int ngpio,
426 ochip->chip.base = gpio_base; 468 ochip->chip.base = gpio_base;
427 ochip->chip.ngpio = ngpio; 469 ochip->chip.ngpio = ngpio;
428 ochip->chip.can_sleep = 0; 470 ochip->chip.can_sleep = 0;
471#ifdef CONFIG_OF
472 ochip->chip.of_node = np;
473#endif
474
429 spin_lock_init(&ochip->lock); 475 spin_lock_init(&ochip->lock);
430 ochip->base = (void __iomem *)base; 476 ochip->base = (void __iomem *)base;
431 ochip->valid_input = 0; 477 ochip->valid_input = 0;
@@ -435,8 +481,6 @@ void __init orion_gpio_init(int gpio_base, int ngpio,
435 481
436 gpiochip_add(&ochip->chip); 482 gpiochip_add(&ochip->chip);
437 483
438 orion_gpio_chip_count++;
439
440 /* 484 /*
441 * Mask and clear GPIO interrupts. 485 * Mask and clear GPIO interrupts.
442 */ 486 */
@@ -444,16 +488,28 @@ void __init orion_gpio_init(int gpio_base, int ngpio,
444 writel(0, GPIO_EDGE_MASK(ochip)); 488 writel(0, GPIO_EDGE_MASK(ochip));
445 writel(0, GPIO_LEVEL_MASK(ochip)); 489 writel(0, GPIO_LEVEL_MASK(ochip));
446 490
447 gc = irq_alloc_generic_chip("orion_gpio_irq", 2, secondary_irq_base, 491 /* Setup the interrupt handlers. Each chip can have up to 4
492 * interrupt handlers, with each handler dealing with 8 GPIO
493 * pins. */
494
495 for (i = 0; i < 4; i++) {
496 if (irqs[i]) {
497 irq_set_handler_data(irqs[i], ochip);
498 irq_set_chained_handler(irqs[i], gpio_irq_handler);
499 }
500 }
501
502 gc = irq_alloc_generic_chip("orion_gpio_irq", 2,
503 secondary_irq_base,
448 ochip->base, handle_level_irq); 504 ochip->base, handle_level_irq);
449 gc->private = ochip; 505 gc->private = ochip;
450
451 ct = gc->chip_types; 506 ct = gc->chip_types;
452 ct->regs.mask = ochip->mask_offset + GPIO_LEVEL_MASK_OFF; 507 ct->regs.mask = ochip->mask_offset + GPIO_LEVEL_MASK_OFF;
453 ct->type = IRQ_TYPE_LEVEL_HIGH | IRQ_TYPE_LEVEL_LOW; 508 ct->type = IRQ_TYPE_LEVEL_HIGH | IRQ_TYPE_LEVEL_LOW;
454 ct->chip.irq_mask = irq_gc_mask_clr_bit; 509 ct->chip.irq_mask = irq_gc_mask_clr_bit;
455 ct->chip.irq_unmask = irq_gc_mask_set_bit; 510 ct->chip.irq_unmask = irq_gc_mask_set_bit;
456 ct->chip.irq_set_type = gpio_irq_set_type; 511 ct->chip.irq_set_type = gpio_irq_set_type;
512 ct->chip.name = ochip->chip.label;
457 513
458 ct++; 514 ct++;
459 ct->regs.mask = ochip->mask_offset + GPIO_EDGE_MASK_OFF; 515 ct->regs.mask = ochip->mask_offset + GPIO_EDGE_MASK_OFF;
@@ -464,41 +520,69 @@ void __init orion_gpio_init(int gpio_base, int ngpio,
464 ct->chip.irq_unmask = irq_gc_mask_set_bit; 520 ct->chip.irq_unmask = irq_gc_mask_set_bit;
465 ct->chip.irq_set_type = gpio_irq_set_type; 521 ct->chip.irq_set_type = gpio_irq_set_type;
466 ct->handler = handle_edge_irq; 522 ct->handler = handle_edge_irq;
523 ct->chip.name = ochip->chip.label;
467 524
468 irq_setup_generic_chip(gc, IRQ_MSK(ngpio), IRQ_GC_INIT_MASK_CACHE, 525 irq_setup_generic_chip(gc, IRQ_MSK(ngpio), IRQ_GC_INIT_MASK_CACHE,
469 IRQ_NOREQUEST, IRQ_LEVEL | IRQ_NOPROBE); 526 IRQ_NOREQUEST, IRQ_LEVEL | IRQ_NOPROBE);
470}
471 527
472void orion_gpio_irq_handler(int pinoff) 528 /* Setup irq domain on top of the generic chip. */
473{ 529 ochip->domain = irq_domain_add_legacy(np,
474 struct orion_gpio_chip *ochip; 530 ochip->chip.ngpio,
475 u32 cause, type; 531 ochip->secondary_irq_base,
476 int i; 532 ochip->secondary_irq_base,
477 533 &irq_domain_simple_ops,
478 ochip = orion_gpio_chip_find(pinoff); 534 ochip);
479 if (ochip == NULL) 535 if (!ochip->domain)
480 return; 536 panic("%s: couldn't allocate irq domain (DT).\n",
481 537 ochip->chip.label);
482 cause = readl(GPIO_DATA_IN(ochip)) & readl(GPIO_LEVEL_MASK(ochip));
483 cause |= readl(GPIO_EDGE_CAUSE(ochip)) & readl(GPIO_EDGE_MASK(ochip));
484
485 for (i = 0; i < ochip->chip.ngpio; i++) {
486 int irq;
487 538
488 irq = ochip->secondary_irq_base + i; 539 orion_gpio_chip_count++;
540}
489 541
490 if (!(cause & (1 << i))) 542#ifdef CONFIG_OF
491 continue; 543static void __init orion_gpio_of_init_one(struct device_node *np,
544 int irq_gpio_base)
545{
546 int ngpio, gpio_base, mask_offset;
547 void __iomem *base;
548 int ret, i;
549 int irqs[4];
550 int secondary_irq_base;
551
552 ret = of_property_read_u32(np, "ngpio", &ngpio);
553 if (ret)
554 goto out;
555 ret = of_property_read_u32(np, "mask-offset", &mask_offset);
556 if (ret == -EINVAL)
557 mask_offset = 0;
558 else
559 goto out;
560 base = of_iomap(np, 0);
561 if (!base)
562 goto out;
563
564 secondary_irq_base = irq_gpio_base + (32 * orion_gpio_chip_count);
565 gpio_base = 32 * orion_gpio_chip_count;
566
567 /* Get the interrupt numbers. Each chip can have up to 4
568 * interrupt handlers, with each handler dealing with 8 GPIO
569 * pins. */
570
571 for (i = 0; i < 4; i++)
572 irqs[i] = irq_of_parse_and_map(np, i);
573
574 orion_gpio_init(np, gpio_base, ngpio, base, mask_offset,
575 secondary_irq_base, irqs);
576 return;
577out:
578 pr_err("%s: %s: missing mandatory property\n", __func__, np->name);
579}
492 580
493 type = irqd_get_trigger_type(irq_get_irq_data(irq)); 581void __init orion_gpio_of_init(int irq_gpio_base)
494 if ((type & IRQ_TYPE_SENSE_MASK) == IRQ_TYPE_EDGE_BOTH) { 582{
495 /* Swap polarity (race with GPIO line) */ 583 struct device_node *np;
496 u32 polarity;
497 584
498 polarity = readl(GPIO_IN_POL(ochip)); 585 for_each_compatible_node(np, NULL, "marvell,orion-gpio")
499 polarity ^= 1 << i; 586 orion_gpio_of_init_one(np, irq_gpio_base);
500 writel(polarity, GPIO_IN_POL(ochip));
501 }
502 generic_handle_irq(irq);
503 }
504} 587}
588#endif
diff --git a/arch/arm/plat-orion/include/plat/gpio.h b/arch/arm/plat-orion/include/plat/gpio.h
index bec0c98ce41f..81c6fc8a7b28 100644
--- a/arch/arm/plat-orion/include/plat/gpio.h
+++ b/arch/arm/plat-orion/include/plat/gpio.h
@@ -13,7 +13,7 @@
13 13
14#include <linux/init.h> 14#include <linux/init.h>
15#include <linux/types.h> 15#include <linux/types.h>
16 16#include <linux/irqdomain.h>
17/* 17/*
18 * Orion-specific GPIO API extensions. 18 * Orion-specific GPIO API extensions.
19 */ 19 */
@@ -27,13 +27,11 @@ int orion_gpio_led_blink_set(unsigned gpio, int state,
27void orion_gpio_set_valid(unsigned pin, int mode); 27void orion_gpio_set_valid(unsigned pin, int mode);
28 28
29/* Initialize gpiolib. */ 29/* Initialize gpiolib. */
30void __init orion_gpio_init(int gpio_base, int ngpio, 30void __init orion_gpio_init(struct device_node *np,
31 u32 base, int mask_offset, int secondary_irq_base); 31 int gpio_base, int ngpio,
32 32 void __iomem *base, int mask_offset,
33/* 33 int secondary_irq_base,
34 * GPIO interrupt handling. 34 int irq[4]);
35 */
36void orion_gpio_irq_handler(int irqoff);
37
38 35
36void __init orion_gpio_of_init(int irq_gpio_base);
39#endif 37#endif
diff --git a/arch/arm/plat-orion/include/plat/irq.h b/arch/arm/plat-orion/include/plat/irq.h
index f05eeab94968..50547e417936 100644
--- a/arch/arm/plat-orion/include/plat/irq.h
+++ b/arch/arm/plat-orion/include/plat/irq.h
@@ -12,6 +12,5 @@
12#define __PLAT_IRQ_H 12#define __PLAT_IRQ_H
13 13
14void orion_irq_init(unsigned int irq_start, void __iomem *maskaddr); 14void orion_irq_init(unsigned int irq_start, void __iomem *maskaddr);
15 15void __init orion_dt_init_irq(void);
16
17#endif 16#endif
diff --git a/arch/arm/plat-orion/irq.c b/arch/arm/plat-orion/irq.c
index 2d5b9c1ef389..d751964def4c 100644
--- a/arch/arm/plat-orion/irq.c
+++ b/arch/arm/plat-orion/irq.c
@@ -11,8 +11,12 @@
11#include <linux/kernel.h> 11#include <linux/kernel.h>
12#include <linux/init.h> 12#include <linux/init.h>
13#include <linux/irq.h> 13#include <linux/irq.h>
14#include <linux/irqdomain.h>
14#include <linux/io.h> 15#include <linux/io.h>
16#include <linux/of_address.h>
17#include <linux/of_irq.h>
15#include <plat/irq.h> 18#include <plat/irq.h>
19#include <plat/gpio.h>
16 20
17void __init orion_irq_init(unsigned int irq_start, void __iomem *maskaddr) 21void __init orion_irq_init(unsigned int irq_start, void __iomem *maskaddr)
18{ 22{
@@ -32,3 +36,39 @@ void __init orion_irq_init(unsigned int irq_start, void __iomem *maskaddr)
32 irq_setup_generic_chip(gc, IRQ_MSK(32), IRQ_GC_INIT_MASK_CACHE, 36 irq_setup_generic_chip(gc, IRQ_MSK(32), IRQ_GC_INIT_MASK_CACHE,
33 IRQ_NOREQUEST, IRQ_LEVEL | IRQ_NOPROBE); 37 IRQ_NOREQUEST, IRQ_LEVEL | IRQ_NOPROBE);
34} 38}
39
40#ifdef CONFIG_OF
41static int __init orion_add_irq_domain(struct device_node *np,
42 struct device_node *interrupt_parent)
43{
44 int i = 0, irq_gpio;
45 void __iomem *base;
46
47 do {
48 base = of_iomap(np, i);
49 if (base) {
50 orion_irq_init(i * 32, base);
51 i++;
52 }
53 } while (base);
54
55 irq_domain_add_legacy(np, i * 32, 0, 0,
56 &irq_domain_simple_ops, NULL);
57
58 irq_gpio = i * 32;
59 orion_gpio_of_init(irq_gpio);
60
61 return 0;
62}
63
64static const struct of_device_id orion_irq_match[] = {
65 { .compatible = "marvell,orion-intc",
66 .data = orion_add_irq_domain, },
67 {},
68};
69
70void __init orion_dt_init_irq(void)
71{
72 of_irq_init(orion_irq_match);
73}
74#endif
diff --git a/drivers/ata/sata_mv.c b/drivers/ata/sata_mv.c
index 24712adf69df..311be18d3f03 100644
--- a/drivers/ata/sata_mv.c
+++ b/drivers/ata/sata_mv.c
@@ -65,6 +65,8 @@
65#include <linux/mbus.h> 65#include <linux/mbus.h>
66#include <linux/bitops.h> 66#include <linux/bitops.h>
67#include <linux/gfp.h> 67#include <linux/gfp.h>
68#include <linux/of.h>
69#include <linux/of_irq.h>
68#include <scsi/scsi_host.h> 70#include <scsi/scsi_host.h>
69#include <scsi/scsi_cmnd.h> 71#include <scsi/scsi_cmnd.h>
70#include <scsi/scsi_device.h> 72#include <scsi/scsi_device.h>
@@ -4026,7 +4028,7 @@ static int mv_platform_probe(struct platform_device *pdev)
4026 struct ata_host *host; 4028 struct ata_host *host;
4027 struct mv_host_priv *hpriv; 4029 struct mv_host_priv *hpriv;
4028 struct resource *res; 4030 struct resource *res;
4029 int n_ports = 0; 4031 int n_ports = 0, irq = 0;
4030 int rc; 4032 int rc;
4031#if defined(CONFIG_HAVE_CLK) 4033#if defined(CONFIG_HAVE_CLK)
4032 int port; 4034 int port;
@@ -4050,8 +4052,14 @@ static int mv_platform_probe(struct platform_device *pdev)
4050 return -EINVAL; 4052 return -EINVAL;
4051 4053
4052 /* allocate host */ 4054 /* allocate host */
4053 mv_platform_data = pdev->dev.platform_data; 4055 if (pdev->dev.of_node) {
4054 n_ports = mv_platform_data->n_ports; 4056 of_property_read_u32(pdev->dev.of_node, "nr-ports", &n_ports);
4057 irq = irq_of_parse_and_map(pdev->dev.of_node, 0);
4058 } else {
4059 mv_platform_data = pdev->dev.platform_data;
4060 n_ports = mv_platform_data->n_ports;
4061 irq = platform_get_irq(pdev, 0);
4062 }
4055 4063
4056 host = ata_host_alloc_pinfo(&pdev->dev, ppi, n_ports); 4064 host = ata_host_alloc_pinfo(&pdev->dev, ppi, n_ports);
4057 hpriv = devm_kzalloc(&pdev->dev, sizeof(*hpriv), GFP_KERNEL); 4065 hpriv = devm_kzalloc(&pdev->dev, sizeof(*hpriv), GFP_KERNEL);
@@ -4109,8 +4117,7 @@ static int mv_platform_probe(struct platform_device *pdev)
4109 dev_info(&pdev->dev, "slots %u ports %d\n", 4117 dev_info(&pdev->dev, "slots %u ports %d\n",
4110 (unsigned)MV_MAX_Q_DEPTH, host->n_ports); 4118 (unsigned)MV_MAX_Q_DEPTH, host->n_ports);
4111 4119
4112 rc = ata_host_activate(host, platform_get_irq(pdev, 0), mv_interrupt, 4120 rc = ata_host_activate(host, irq, mv_interrupt, IRQF_SHARED, &mv6_sht);
4113 IRQF_SHARED, &mv6_sht);
4114 if (!rc) 4121 if (!rc)
4115 return 0; 4122 return 0;
4116 4123
@@ -4205,15 +4212,24 @@ static int mv_platform_resume(struct platform_device *pdev)
4205#define mv_platform_resume NULL 4212#define mv_platform_resume NULL
4206#endif 4213#endif
4207 4214
4215#ifdef CONFIG_OF
4216static struct of_device_id mv_sata_dt_ids[] __devinitdata = {
4217 { .compatible = "marvell,orion-sata", },
4218 {},
4219};
4220MODULE_DEVICE_TABLE(of, mv_sata_dt_ids);
4221#endif
4222
4208static struct platform_driver mv_platform_driver = { 4223static struct platform_driver mv_platform_driver = {
4209 .probe = mv_platform_probe, 4224 .probe = mv_platform_probe,
4210 .remove = __devexit_p(mv_platform_remove), 4225 .remove = __devexit_p(mv_platform_remove),
4211 .suspend = mv_platform_suspend, 4226 .suspend = mv_platform_suspend,
4212 .resume = mv_platform_resume, 4227 .resume = mv_platform_resume,
4213 .driver = { 4228 .driver = {
4214 .name = DRV_NAME, 4229 .name = DRV_NAME,
4215 .owner = THIS_MODULE, 4230 .owner = THIS_MODULE,
4216 }, 4231 .of_match_table = of_match_ptr(mv_sata_dt_ids),
4232 },
4217}; 4233};
4218 4234
4219 4235
diff --git a/drivers/crypto/mv_cesa.c b/drivers/crypto/mv_cesa.c
index 1cc6b3f3e262..a4faa893199c 100644
--- a/drivers/crypto/mv_cesa.c
+++ b/drivers/crypto/mv_cesa.c
@@ -1098,6 +1098,10 @@ err_unreg_ecb:
1098 crypto_unregister_alg(&mv_aes_alg_ecb); 1098 crypto_unregister_alg(&mv_aes_alg_ecb);
1099err_irq: 1099err_irq:
1100 free_irq(irq, cp); 1100 free_irq(irq, cp);
1101 if (!IS_ERR(cp->clk)) {
1102 clk_disable_unprepare(cp->clk);
1103 clk_put(cp->clk);
1104 }
1101err_thread: 1105err_thread:
1102 kthread_stop(cp->queue_th); 1106 kthread_stop(cp->queue_th);
1103err_unmap_sram: 1107err_unmap_sram:
diff --git a/drivers/mmc/host/mvsdio.c b/drivers/mmc/host/mvsdio.c
index 3b9136c1a475..a61cb5fca22d 100644
--- a/drivers/mmc/host/mvsdio.c
+++ b/drivers/mmc/host/mvsdio.c
@@ -839,6 +839,10 @@ out:
839 if (r) 839 if (r)
840 release_resource(r); 840 release_resource(r);
841 if (mmc) 841 if (mmc)
842 if (!IS_ERR_OR_NULL(host->clk)) {
843 clk_disable_unprepare(host->clk);
844 clk_put(host->clk);
845 }
842 mmc_free_host(mmc); 846 mmc_free_host(mmc);
843 847
844 return ret; 848 return ret;
diff --git a/drivers/mtd/nand/orion_nand.c b/drivers/mtd/nand/orion_nand.c
index 513dc88a05ca..fc5a868c436e 100644
--- a/drivers/mtd/nand/orion_nand.c
+++ b/drivers/mtd/nand/orion_nand.c
@@ -183,6 +183,10 @@ static int __init orion_nand_probe(struct platform_device *pdev)
183 return 0; 183 return 0;
184 184
185no_dev: 185no_dev:
186 if (!IS_ERR(clk)) {
187 clk_disable_unprepare(clk);
188 clk_put(clk);
189 }
186 platform_set_drvdata(pdev, NULL); 190 platform_set_drvdata(pdev, NULL);
187 iounmap(io_base); 191 iounmap(io_base);
188no_res: 192no_res:
@@ -214,7 +218,7 @@ static int __devexit orion_nand_remove(struct platform_device *pdev)
214 218
215#ifdef CONFIG_OF 219#ifdef CONFIG_OF
216static struct of_device_id orion_nand_of_match_table[] = { 220static struct of_device_id orion_nand_of_match_table[] = {
217 { .compatible = "mrvl,orion-nand", }, 221 { .compatible = "marvell,orion-nand", },
218 {}, 222 {},
219}; 223};
220#endif 224#endif
diff --git a/drivers/net/ethernet/marvell/mv643xx_eth.c b/drivers/net/ethernet/marvell/mv643xx_eth.c
index f0f06b2bc28b..4fbba57b8ff4 100644
--- a/drivers/net/ethernet/marvell/mv643xx_eth.c
+++ b/drivers/net/ethernet/marvell/mv643xx_eth.c
@@ -2983,6 +2983,12 @@ static int mv643xx_eth_probe(struct platform_device *pdev)
2983 return 0; 2983 return 0;
2984 2984
2985out: 2985out:
2986#if defined(CONFIG_HAVE_CLK)
2987 if (!IS_ERR(mp->clk)) {
2988 clk_disable_unprepare(mp->clk);
2989 clk_put(mp->clk);
2990 }
2991#endif
2986 free_netdev(dev); 2992 free_netdev(dev);
2987 2993
2988 return err; 2994 return err;
diff --git a/drivers/rtc/rtc-mv.c b/drivers/rtc/rtc-mv.c
index b2185f4255aa..ebc1649d45d6 100644
--- a/drivers/rtc/rtc-mv.c
+++ b/drivers/rtc/rtc-mv.c
@@ -297,7 +297,7 @@ static int __exit mv_rtc_remove(struct platform_device *pdev)
297 297
298#ifdef CONFIG_OF 298#ifdef CONFIG_OF
299static struct of_device_id rtc_mv_of_match_table[] = { 299static struct of_device_id rtc_mv_of_match_table[] = {
300 { .compatible = "mrvl,orion-rtc", }, 300 { .compatible = "marvell,orion-rtc", },
301 {} 301 {}
302}; 302};
303#endif 303#endif
diff --git a/drivers/spi/Kconfig b/drivers/spi/Kconfig
index cd2fe350e724..12468e5bfef8 100644
--- a/drivers/spi/Kconfig
+++ b/drivers/spi/Kconfig
@@ -357,7 +357,7 @@ config SPI_STMP3XXX
357 357
358config SPI_TEGRA 358config SPI_TEGRA
359 tristate "Nvidia Tegra SPI controller" 359 tristate "Nvidia Tegra SPI controller"
360 depends on ARCH_TEGRA && TEGRA_SYSTEM_DMA 360 depends on ARCH_TEGRA && (TEGRA_SYSTEM_DMA || TEGRA20_APB_DMA)
361 help 361 help
362 SPI driver for NVidia Tegra SoCs 362 SPI driver for NVidia Tegra SoCs
363 363
@@ -384,6 +384,13 @@ config SPI_TXX9
384 help 384 help
385 SPI driver for Toshiba TXx9 MIPS SoCs 385 SPI driver for Toshiba TXx9 MIPS SoCs
386 386
387config SPI_XCOMM
388 tristate "Analog Devices AD-FMCOMMS1-EBZ SPI-I2C-bridge driver"
389 depends on I2C
390 help
391 Support for the SPI-I2C bridge found on the Analog Devices
392 AD-FMCOMMS1-EBZ board.
393
387config SPI_XILINX 394config SPI_XILINX
388 tristate "Xilinx SPI controller common module" 395 tristate "Xilinx SPI controller common module"
389 depends on HAS_IOMEM && EXPERIMENTAL 396 depends on HAS_IOMEM && EXPERIMENTAL
diff --git a/drivers/spi/Makefile b/drivers/spi/Makefile
index 9d75d2198ff5..273f50d1127a 100644
--- a/drivers/spi/Makefile
+++ b/drivers/spi/Makefile
@@ -61,5 +61,6 @@ obj-$(CONFIG_SPI_TI_SSP) += spi-ti-ssp.o
61obj-$(CONFIG_SPI_TLE62X0) += spi-tle62x0.o 61obj-$(CONFIG_SPI_TLE62X0) += spi-tle62x0.o
62obj-$(CONFIG_SPI_TOPCLIFF_PCH) += spi-topcliff-pch.o 62obj-$(CONFIG_SPI_TOPCLIFF_PCH) += spi-topcliff-pch.o
63obj-$(CONFIG_SPI_TXX9) += spi-txx9.o 63obj-$(CONFIG_SPI_TXX9) += spi-txx9.o
64obj-$(CONFIG_SPI_XCOMM) += spi-xcomm.o
64obj-$(CONFIG_SPI_XILINX) += spi-xilinx.o 65obj-$(CONFIG_SPI_XILINX) += spi-xilinx.o
65 66
diff --git a/drivers/spi/spi-bcm63xx.c b/drivers/spi/spi-bcm63xx.c
index 7491971139a6..6e25ef1bce91 100644
--- a/drivers/spi/spi-bcm63xx.c
+++ b/drivers/spi/spi-bcm63xx.c
@@ -129,7 +129,7 @@ static void bcm63xx_spi_setup_transfer(struct spi_device *spi,
129 129
130 /* Find the closest clock configuration */ 130 /* Find the closest clock configuration */
131 for (i = 0; i < SPI_CLK_MASK; i++) { 131 for (i = 0; i < SPI_CLK_MASK; i++) {
132 if (hz <= bcm63xx_spi_freq_table[i][0]) { 132 if (hz >= bcm63xx_spi_freq_table[i][0]) {
133 clk_cfg = bcm63xx_spi_freq_table[i][1]; 133 clk_cfg = bcm63xx_spi_freq_table[i][1];
134 break; 134 break;
135 } 135 }
diff --git a/drivers/spi/spi-gpio.c b/drivers/spi/spi-gpio.c
index 0094c645ff0d..0b56cfc71fab 100644
--- a/drivers/spi/spi-gpio.c
+++ b/drivers/spi/spi-gpio.c
@@ -235,7 +235,8 @@ static int spi_gpio_setup(struct spi_device *spi)
235 status = gpio_request(cs, dev_name(&spi->dev)); 235 status = gpio_request(cs, dev_name(&spi->dev));
236 if (status) 236 if (status)
237 return status; 237 return status;
238 status = gpio_direction_output(cs, spi->mode & SPI_CS_HIGH); 238 status = gpio_direction_output(cs,
239 !(spi->mode & SPI_CS_HIGH));
239 } 240 }
240 } 241 }
241 if (!status) 242 if (!status)
diff --git a/drivers/spi/spi-imx.c b/drivers/spi/spi-imx.c
index 47877d687614..e834ff8c0188 100644
--- a/drivers/spi/spi-imx.c
+++ b/drivers/spi/spi-imx.c
@@ -626,7 +626,7 @@ static void spi_imx_chipselect(struct spi_device *spi, int is_active)
626 int active = is_active != BITBANG_CS_INACTIVE; 626 int active = is_active != BITBANG_CS_INACTIVE;
627 int dev_is_lowactive = !(spi->mode & SPI_CS_HIGH); 627 int dev_is_lowactive = !(spi->mode & SPI_CS_HIGH);
628 628
629 if (gpio < 0) 629 if (!gpio_is_valid(gpio))
630 return; 630 return;
631 631
632 gpio_set_value(gpio, dev_is_lowactive ^ active); 632 gpio_set_value(gpio, dev_is_lowactive ^ active);
@@ -688,8 +688,6 @@ static int spi_imx_setupxfer(struct spi_device *spi,
688 config.speed_hz = spi->max_speed_hz; 688 config.speed_hz = spi->max_speed_hz;
689 if (!config.bpw) 689 if (!config.bpw)
690 config.bpw = spi->bits_per_word; 690 config.bpw = spi->bits_per_word;
691 if (!config.speed_hz)
692 config.speed_hz = spi->max_speed_hz;
693 691
694 /* Initialize the functions for transfer */ 692 /* Initialize the functions for transfer */
695 if (config.bpw <= 8) { 693 if (config.bpw <= 8) {
@@ -738,7 +736,7 @@ static int spi_imx_setup(struct spi_device *spi)
738 dev_dbg(&spi->dev, "%s: mode %d, %u bpw, %d hz\n", __func__, 736 dev_dbg(&spi->dev, "%s: mode %d, %u bpw, %d hz\n", __func__,
739 spi->mode, spi->bits_per_word, spi->max_speed_hz); 737 spi->mode, spi->bits_per_word, spi->max_speed_hz);
740 738
741 if (gpio >= 0) 739 if (gpio_is_valid(gpio))
742 gpio_direction_output(gpio, spi->mode & SPI_CS_HIGH ? 0 : 1); 740 gpio_direction_output(gpio, spi->mode & SPI_CS_HIGH ? 0 : 1);
743 741
744 spi_imx_chipselect(spi, BITBANG_CS_INACTIVE); 742 spi_imx_chipselect(spi, BITBANG_CS_INACTIVE);
@@ -791,11 +789,11 @@ static int __devinit spi_imx_probe(struct platform_device *pdev)
791 789
792 for (i = 0; i < master->num_chipselect; i++) { 790 for (i = 0; i < master->num_chipselect; i++) {
793 int cs_gpio = of_get_named_gpio(np, "cs-gpios", i); 791 int cs_gpio = of_get_named_gpio(np, "cs-gpios", i);
794 if (cs_gpio < 0 && mxc_platform_info) 792 if (!gpio_is_valid(cs_gpio) && mxc_platform_info)
795 cs_gpio = mxc_platform_info->chipselect[i]; 793 cs_gpio = mxc_platform_info->chipselect[i];
796 794
797 spi_imx->chipselect[i] = cs_gpio; 795 spi_imx->chipselect[i] = cs_gpio;
798 if (cs_gpio < 0) 796 if (!gpio_is_valid(cs_gpio))
799 continue; 797 continue;
800 798
801 ret = gpio_request(spi_imx->chipselect[i], DRIVER_NAME); 799 ret = gpio_request(spi_imx->chipselect[i], DRIVER_NAME);
@@ -897,7 +895,7 @@ out_release_mem:
897 release_mem_region(res->start, resource_size(res)); 895 release_mem_region(res->start, resource_size(res));
898out_gpio_free: 896out_gpio_free:
899 while (--i >= 0) { 897 while (--i >= 0) {
900 if (spi_imx->chipselect[i] >= 0) 898 if (gpio_is_valid(spi_imx->chipselect[i]))
901 gpio_free(spi_imx->chipselect[i]); 899 gpio_free(spi_imx->chipselect[i]);
902 } 900 }
903 spi_master_put(master); 901 spi_master_put(master);
@@ -922,7 +920,7 @@ static int __devexit spi_imx_remove(struct platform_device *pdev)
922 iounmap(spi_imx->base); 920 iounmap(spi_imx->base);
923 921
924 for (i = 0; i < master->num_chipselect; i++) 922 for (i = 0; i < master->num_chipselect; i++)
925 if (spi_imx->chipselect[i] >= 0) 923 if (gpio_is_valid(spi_imx->chipselect[i]))
926 gpio_free(spi_imx->chipselect[i]); 924 gpio_free(spi_imx->chipselect[i]);
927 925
928 spi_master_put(master); 926 spi_master_put(master);
diff --git a/drivers/spi/spi-omap2-mcspi.c b/drivers/spi/spi-omap2-mcspi.c
index 0c73dd4f43a0..7d46b15e1520 100644
--- a/drivers/spi/spi-omap2-mcspi.c
+++ b/drivers/spi/spi-omap2-mcspi.c
@@ -388,7 +388,8 @@ omap2_mcspi_txrx_dma(struct spi_device *spi, struct spi_transfer *xfer)
388 388
389 if (tx != NULL) { 389 if (tx != NULL) {
390 wait_for_completion(&mcspi_dma->dma_tx_completion); 390 wait_for_completion(&mcspi_dma->dma_tx_completion);
391 dma_unmap_single(&spi->dev, xfer->tx_dma, count, DMA_TO_DEVICE); 391 dma_unmap_single(mcspi->dev, xfer->tx_dma, count,
392 DMA_TO_DEVICE);
392 393
393 /* for TX_ONLY mode, be sure all words have shifted out */ 394 /* for TX_ONLY mode, be sure all words have shifted out */
394 if (rx == NULL) { 395 if (rx == NULL) {
@@ -403,7 +404,8 @@ omap2_mcspi_txrx_dma(struct spi_device *spi, struct spi_transfer *xfer)
403 404
404 if (rx != NULL) { 405 if (rx != NULL) {
405 wait_for_completion(&mcspi_dma->dma_rx_completion); 406 wait_for_completion(&mcspi_dma->dma_rx_completion);
406 dma_unmap_single(&spi->dev, xfer->rx_dma, count, DMA_FROM_DEVICE); 407 dma_unmap_single(mcspi->dev, xfer->rx_dma, count,
408 DMA_FROM_DEVICE);
407 omap2_mcspi_set_enable(spi, 0); 409 omap2_mcspi_set_enable(spi, 0);
408 410
409 if (l & OMAP2_MCSPI_CHCONF_TURBO) { 411 if (l & OMAP2_MCSPI_CHCONF_TURBO) {
@@ -1032,7 +1034,7 @@ static int omap2_mcspi_transfer_one_message(struct spi_master *master,
1032 return 0; 1034 return 0;
1033} 1035}
1034 1036
1035static int __init omap2_mcspi_master_setup(struct omap2_mcspi *mcspi) 1037static int __devinit omap2_mcspi_master_setup(struct omap2_mcspi *mcspi)
1036{ 1038{
1037 struct spi_master *master = mcspi->master; 1039 struct spi_master *master = mcspi->master;
1038 struct omap2_mcspi_regs *ctx = &mcspi->ctx; 1040 struct omap2_mcspi_regs *ctx = &mcspi->ctx;
diff --git a/drivers/spi/spi-orion.c b/drivers/spi/spi-orion.c
index dfd04e91fa6d..9b0caddce503 100644
--- a/drivers/spi/spi-orion.c
+++ b/drivers/spi/spi-orion.c
@@ -17,6 +17,7 @@
17#include <linux/io.h> 17#include <linux/io.h>
18#include <linux/spi/spi.h> 18#include <linux/spi/spi.h>
19#include <linux/module.h> 19#include <linux/module.h>
20#include <linux/of.h>
20#include <linux/clk.h> 21#include <linux/clk.h>
21#include <asm/unaligned.h> 22#include <asm/unaligned.h>
22 23
@@ -45,7 +46,6 @@ struct orion_spi {
45 void __iomem *base; 46 void __iomem *base;
46 unsigned int max_speed; 47 unsigned int max_speed;
47 unsigned int min_speed; 48 unsigned int min_speed;
48 struct orion_spi_info *spi_info;
49 struct clk *clk; 49 struct clk *clk;
50}; 50};
51 51
@@ -450,11 +450,10 @@ static int __init orion_spi_probe(struct platform_device *pdev)
450 struct spi_master *master; 450 struct spi_master *master;
451 struct orion_spi *spi; 451 struct orion_spi *spi;
452 struct resource *r; 452 struct resource *r;
453 struct orion_spi_info *spi_info;
454 unsigned long tclk_hz; 453 unsigned long tclk_hz;
455 int status = 0; 454 int status = 0;
456 455 const u32 *iprop;
457 spi_info = pdev->dev.platform_data; 456 int size;
458 457
459 master = spi_alloc_master(&pdev->dev, sizeof *spi); 458 master = spi_alloc_master(&pdev->dev, sizeof *spi);
460 if (master == NULL) { 459 if (master == NULL) {
@@ -464,6 +463,12 @@ static int __init orion_spi_probe(struct platform_device *pdev)
464 463
465 if (pdev->id != -1) 464 if (pdev->id != -1)
466 master->bus_num = pdev->id; 465 master->bus_num = pdev->id;
466 if (pdev->dev.of_node) {
467 iprop = of_get_property(pdev->dev.of_node, "cell-index",
468 &size);
469 if (iprop && size == sizeof(*iprop))
470 master->bus_num = *iprop;
471 }
467 472
468 /* we support only mode 0, and no options */ 473 /* we support only mode 0, and no options */
469 master->mode_bits = 0; 474 master->mode_bits = 0;
@@ -476,7 +481,6 @@ static int __init orion_spi_probe(struct platform_device *pdev)
476 481
477 spi = spi_master_get_devdata(master); 482 spi = spi_master_get_devdata(master);
478 spi->master = master; 483 spi->master = master;
479 spi->spi_info = spi_info;
480 484
481 spi->clk = clk_get(&pdev->dev, NULL); 485 spi->clk = clk_get(&pdev->dev, NULL);
482 if (IS_ERR(spi->clk)) { 486 if (IS_ERR(spi->clk)) {
@@ -511,6 +515,7 @@ static int __init orion_spi_probe(struct platform_device *pdev)
511 if (orion_spi_reset(spi) < 0) 515 if (orion_spi_reset(spi) < 0)
512 goto out_rel_mem; 516 goto out_rel_mem;
513 517
518 master->dev.of_node = pdev->dev.of_node;
514 status = spi_register_master(master); 519 status = spi_register_master(master);
515 if (status < 0) 520 if (status < 0)
516 goto out_rel_mem; 521 goto out_rel_mem;
@@ -552,10 +557,17 @@ static int __exit orion_spi_remove(struct platform_device *pdev)
552 557
553MODULE_ALIAS("platform:" DRIVER_NAME); 558MODULE_ALIAS("platform:" DRIVER_NAME);
554 559
560static const struct of_device_id orion_spi_of_match_table[] __devinitdata = {
561 { .compatible = "marvell,orion-spi", },
562 {}
563};
564MODULE_DEVICE_TABLE(of, orion_spi_of_match_table);
565
555static struct platform_driver orion_spi_driver = { 566static struct platform_driver orion_spi_driver = {
556 .driver = { 567 .driver = {
557 .name = DRIVER_NAME, 568 .name = DRIVER_NAME,
558 .owner = THIS_MODULE, 569 .owner = THIS_MODULE,
570 .of_match_table = of_match_ptr(orion_spi_of_match_table),
559 }, 571 },
560 .remove = __exit_p(orion_spi_remove), 572 .remove = __exit_p(orion_spi_remove),
561}; 573};
diff --git a/drivers/spi/spi-pl022.c b/drivers/spi/spi-pl022.c
index 400ae2121a2a..aab518ec2bbc 100644
--- a/drivers/spi/spi-pl022.c
+++ b/drivers/spi/spi-pl022.c
@@ -489,6 +489,11 @@ static void giveback(struct pl022 *pl022)
489 pl022->cur_transfer = NULL; 489 pl022->cur_transfer = NULL;
490 pl022->cur_chip = NULL; 490 pl022->cur_chip = NULL;
491 spi_finalize_current_message(pl022->master); 491 spi_finalize_current_message(pl022->master);
492
493 /* disable the SPI/SSP operation */
494 writew((readw(SSP_CR1(pl022->virtbase)) &
495 (~SSP_CR1_MASK_SSE)), SSP_CR1(pl022->virtbase));
496
492} 497}
493 498
494/** 499/**
@@ -2048,6 +2053,9 @@ pl022_probe(struct amba_device *adev, const struct amba_id *id)
2048 printk(KERN_INFO "pl022: mapped registers from 0x%08x to %p\n", 2053 printk(KERN_INFO "pl022: mapped registers from 0x%08x to %p\n",
2049 adev->res.start, pl022->virtbase); 2054 adev->res.start, pl022->virtbase);
2050 2055
2056 pm_runtime_enable(dev);
2057 pm_runtime_resume(dev);
2058
2051 pl022->clk = clk_get(&adev->dev, NULL); 2059 pl022->clk = clk_get(&adev->dev, NULL);
2052 if (IS_ERR(pl022->clk)) { 2060 if (IS_ERR(pl022->clk)) {
2053 status = PTR_ERR(pl022->clk); 2061 status = PTR_ERR(pl022->clk);
@@ -2158,6 +2166,7 @@ pl022_remove(struct amba_device *adev)
2158 clk_disable(pl022->clk); 2166 clk_disable(pl022->clk);
2159 clk_unprepare(pl022->clk); 2167 clk_unprepare(pl022->clk);
2160 clk_put(pl022->clk); 2168 clk_put(pl022->clk);
2169 pm_runtime_disable(&adev->dev);
2161 iounmap(pl022->virtbase); 2170 iounmap(pl022->virtbase);
2162 amba_release_regions(adev); 2171 amba_release_regions(adev);
2163 tasklet_disable(&pl022->pump_transfers); 2172 tasklet_disable(&pl022->pump_transfers);
@@ -2251,15 +2260,6 @@ static struct vendor_data vendor_st_pl023 = {
2251 .loopback = false, 2260 .loopback = false,
2252}; 2261};
2253 2262
2254static struct vendor_data vendor_db5500_pl023 = {
2255 .fifodepth = 32,
2256 .max_bpw = 32,
2257 .unidir = false,
2258 .extended_cr = true,
2259 .pl023 = true,
2260 .loopback = true,
2261};
2262
2263static struct amba_id pl022_ids[] = { 2263static struct amba_id pl022_ids[] = {
2264 { 2264 {
2265 /* 2265 /*
@@ -2291,11 +2291,6 @@ static struct amba_id pl022_ids[] = {
2291 .mask = 0xffffffff, 2291 .mask = 0xffffffff,
2292 .data = &vendor_st_pl023, 2292 .data = &vendor_st_pl023,
2293 }, 2293 },
2294 {
2295 .id = 0x10080023,
2296 .mask = 0xffffffff,
2297 .data = &vendor_db5500_pl023,
2298 },
2299 { 0, 0 }, 2294 { 0, 0 },
2300}; 2295};
2301 2296
diff --git a/drivers/spi/spi-tegra.c b/drivers/spi/spi-tegra.c
index ae6d78a3e912..956ff4a0827b 100644
--- a/drivers/spi/spi-tegra.c
+++ b/drivers/spi/spi-tegra.c
@@ -30,6 +30,7 @@
30#include <linux/delay.h> 30#include <linux/delay.h>
31 31
32#include <linux/spi/spi.h> 32#include <linux/spi/spi.h>
33#include <linux/dmaengine.h>
33 34
34#include <mach/dma.h> 35#include <mach/dma.h>
35 36
@@ -162,12 +163,23 @@ struct spi_tegra_data {
162 * require transfers to be 4 byte aligned we need a bounce buffer 163 * require transfers to be 4 byte aligned we need a bounce buffer
163 * for the generic case. 164 * for the generic case.
164 */ 165 */
166 int dma_req_len;
167#if defined(CONFIG_TEGRA_SYSTEM_DMA)
165 struct tegra_dma_req rx_dma_req; 168 struct tegra_dma_req rx_dma_req;
166 struct tegra_dma_channel *rx_dma; 169 struct tegra_dma_channel *rx_dma;
170#else
171 struct dma_chan *rx_dma;
172 struct dma_slave_config sconfig;
173 struct dma_async_tx_descriptor *rx_dma_desc;
174 dma_cookie_t rx_cookie;
175#endif
167 u32 *rx_bb; 176 u32 *rx_bb;
168 dma_addr_t rx_bb_phys; 177 dma_addr_t rx_bb_phys;
169}; 178};
170 179
180#if !defined(CONFIG_TEGRA_SYSTEM_DMA)
181static void tegra_spi_rx_dma_complete(void *args);
182#endif
171 183
172static inline unsigned long spi_tegra_readl(struct spi_tegra_data *tspi, 184static inline unsigned long spi_tegra_readl(struct spi_tegra_data *tspi,
173 unsigned long reg) 185 unsigned long reg)
@@ -190,10 +202,24 @@ static void spi_tegra_go(struct spi_tegra_data *tspi)
190 202
191 val = spi_tegra_readl(tspi, SLINK_DMA_CTL); 203 val = spi_tegra_readl(tspi, SLINK_DMA_CTL);
192 val &= ~SLINK_DMA_BLOCK_SIZE(~0) & ~SLINK_DMA_EN; 204 val &= ~SLINK_DMA_BLOCK_SIZE(~0) & ~SLINK_DMA_EN;
193 val |= SLINK_DMA_BLOCK_SIZE(tspi->rx_dma_req.size / 4 - 1); 205 val |= SLINK_DMA_BLOCK_SIZE(tspi->dma_req_len / 4 - 1);
194 spi_tegra_writel(tspi, val, SLINK_DMA_CTL); 206 spi_tegra_writel(tspi, val, SLINK_DMA_CTL);
195 207#if defined(CONFIG_TEGRA_SYSTEM_DMA)
208 tspi->rx_dma_req.size = tspi->dma_req_len;
196 tegra_dma_enqueue_req(tspi->rx_dma, &tspi->rx_dma_req); 209 tegra_dma_enqueue_req(tspi->rx_dma, &tspi->rx_dma_req);
210#else
211 tspi->rx_dma_desc = dmaengine_prep_slave_single(tspi->rx_dma,
212 tspi->rx_bb_phys, tspi->dma_req_len,
213 DMA_DEV_TO_MEM, DMA_PREP_INTERRUPT);
214 if (!tspi->rx_dma_desc) {
215 dev_err(&tspi->pdev->dev, "dmaengine slave prep failed\n");
216 return;
217 }
218 tspi->rx_dma_desc->callback = tegra_spi_rx_dma_complete;
219 tspi->rx_dma_desc->callback_param = tspi;
220 tspi->rx_cookie = dmaengine_submit(tspi->rx_dma_desc);
221 dma_async_issue_pending(tspi->rx_dma);
222#endif
197 223
198 val |= SLINK_DMA_EN; 224 val |= SLINK_DMA_EN;
199 spi_tegra_writel(tspi, val, SLINK_DMA_CTL); 225 spi_tegra_writel(tspi, val, SLINK_DMA_CTL);
@@ -221,7 +247,7 @@ static unsigned spi_tegra_fill_tx_fifo(struct spi_tegra_data *tspi,
221 spi_tegra_writel(tspi, val, SLINK_TX_FIFO); 247 spi_tegra_writel(tspi, val, SLINK_TX_FIFO);
222 } 248 }
223 249
224 tspi->rx_dma_req.size = len / tspi->cur_bytes_per_word * 4; 250 tspi->dma_req_len = len / tspi->cur_bytes_per_word * 4;
225 251
226 return len; 252 return len;
227} 253}
@@ -318,9 +344,8 @@ static void spi_tegra_start_message(struct spi_device *spi,
318 spi_tegra_start_transfer(spi, t); 344 spi_tegra_start_transfer(spi, t);
319} 345}
320 346
321static void tegra_spi_rx_dma_complete(struct tegra_dma_req *req) 347static void handle_spi_rx_dma_complete(struct spi_tegra_data *tspi)
322{ 348{
323 struct spi_tegra_data *tspi = req->dev;
324 unsigned long flags; 349 unsigned long flags;
325 struct spi_message *m; 350 struct spi_message *m;
326 struct spi_device *spi; 351 struct spi_device *spi;
@@ -380,6 +405,19 @@ static void tegra_spi_rx_dma_complete(struct tegra_dma_req *req)
380 405
381 spin_unlock_irqrestore(&tspi->lock, flags); 406 spin_unlock_irqrestore(&tspi->lock, flags);
382} 407}
408#if defined(CONFIG_TEGRA_SYSTEM_DMA)
409static void tegra_spi_rx_dma_complete(struct tegra_dma_req *req)
410{
411 struct spi_tegra_data *tspi = req->dev;
412 handle_spi_rx_dma_complete(tspi);
413}
414#else
415static void tegra_spi_rx_dma_complete(void *args)
416{
417 struct spi_tegra_data *tspi = args;
418 handle_spi_rx_dma_complete(tspi);
419}
420#endif
383 421
384static int spi_tegra_setup(struct spi_device *spi) 422static int spi_tegra_setup(struct spi_device *spi)
385{ 423{
@@ -471,6 +509,9 @@ static int __devinit spi_tegra_probe(struct platform_device *pdev)
471 struct spi_tegra_data *tspi; 509 struct spi_tegra_data *tspi;
472 struct resource *r; 510 struct resource *r;
473 int ret; 511 int ret;
512#if !defined(CONFIG_TEGRA_SYSTEM_DMA)
513 dma_cap_mask_t mask;
514#endif
474 515
475 master = spi_alloc_master(&pdev->dev, sizeof *tspi); 516 master = spi_alloc_master(&pdev->dev, sizeof *tspi);
476 if (master == NULL) { 517 if (master == NULL) {
@@ -522,12 +563,24 @@ static int __devinit spi_tegra_probe(struct platform_device *pdev)
522 563
523 INIT_LIST_HEAD(&tspi->queue); 564 INIT_LIST_HEAD(&tspi->queue);
524 565
566#if defined(CONFIG_TEGRA_SYSTEM_DMA)
525 tspi->rx_dma = tegra_dma_allocate_channel(TEGRA_DMA_MODE_ONESHOT); 567 tspi->rx_dma = tegra_dma_allocate_channel(TEGRA_DMA_MODE_ONESHOT);
526 if (!tspi->rx_dma) { 568 if (!tspi->rx_dma) {
527 dev_err(&pdev->dev, "can not allocate rx dma channel\n"); 569 dev_err(&pdev->dev, "can not allocate rx dma channel\n");
528 ret = -ENODEV; 570 ret = -ENODEV;
529 goto err3; 571 goto err3;
530 } 572 }
573#else
574 dma_cap_zero(mask);
575 dma_cap_set(DMA_SLAVE, mask);
576 tspi->rx_dma = dma_request_channel(mask, NULL, NULL);
577 if (!tspi->rx_dma) {
578 dev_err(&pdev->dev, "can not allocate rx dma channel\n");
579 ret = -ENODEV;
580 goto err3;
581 }
582
583#endif
531 584
532 tspi->rx_bb = dma_alloc_coherent(&pdev->dev, sizeof(u32) * BB_LEN, 585 tspi->rx_bb = dma_alloc_coherent(&pdev->dev, sizeof(u32) * BB_LEN,
533 &tspi->rx_bb_phys, GFP_KERNEL); 586 &tspi->rx_bb_phys, GFP_KERNEL);
@@ -537,6 +590,7 @@ static int __devinit spi_tegra_probe(struct platform_device *pdev)
537 goto err4; 590 goto err4;
538 } 591 }
539 592
593#if defined(CONFIG_TEGRA_SYSTEM_DMA)
540 tspi->rx_dma_req.complete = tegra_spi_rx_dma_complete; 594 tspi->rx_dma_req.complete = tegra_spi_rx_dma_complete;
541 tspi->rx_dma_req.to_memory = 1; 595 tspi->rx_dma_req.to_memory = 1;
542 tspi->rx_dma_req.dest_addr = tspi->rx_bb_phys; 596 tspi->rx_dma_req.dest_addr = tspi->rx_bb_phys;
@@ -546,6 +600,23 @@ static int __devinit spi_tegra_probe(struct platform_device *pdev)
546 tspi->rx_dma_req.source_wrap = 4; 600 tspi->rx_dma_req.source_wrap = 4;
547 tspi->rx_dma_req.req_sel = spi_tegra_req_sels[pdev->id]; 601 tspi->rx_dma_req.req_sel = spi_tegra_req_sels[pdev->id];
548 tspi->rx_dma_req.dev = tspi; 602 tspi->rx_dma_req.dev = tspi;
603#else
604 /* Dmaengine Dma slave config */
605 tspi->sconfig.src_addr = tspi->phys + SLINK_RX_FIFO;
606 tspi->sconfig.dst_addr = tspi->phys + SLINK_RX_FIFO;
607 tspi->sconfig.src_addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES;
608 tspi->sconfig.dst_addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES;
609 tspi->sconfig.slave_id = spi_tegra_req_sels[pdev->id];
610 tspi->sconfig.src_maxburst = 1;
611 tspi->sconfig.dst_maxburst = 1;
612 ret = dmaengine_device_control(tspi->rx_dma,
613 DMA_SLAVE_CONFIG, (unsigned long) &tspi->sconfig);
614 if (ret < 0) {
615 dev_err(&pdev->dev, "can not do slave configure for dma %d\n",
616 ret);
617 goto err4;
618 }
619#endif
549 620
550 master->dev.of_node = pdev->dev.of_node; 621 master->dev.of_node = pdev->dev.of_node;
551 ret = spi_register_master(master); 622 ret = spi_register_master(master);
@@ -559,7 +630,11 @@ err5:
559 dma_free_coherent(&pdev->dev, sizeof(u32) * BB_LEN, 630 dma_free_coherent(&pdev->dev, sizeof(u32) * BB_LEN,
560 tspi->rx_bb, tspi->rx_bb_phys); 631 tspi->rx_bb, tspi->rx_bb_phys);
561err4: 632err4:
633#if defined(CONFIG_TEGRA_SYSTEM_DMA)
562 tegra_dma_free_channel(tspi->rx_dma); 634 tegra_dma_free_channel(tspi->rx_dma);
635#else
636 dma_release_channel(tspi->rx_dma);
637#endif
563err3: 638err3:
564 clk_put(tspi->clk); 639 clk_put(tspi->clk);
565err2: 640err2:
@@ -581,7 +656,11 @@ static int __devexit spi_tegra_remove(struct platform_device *pdev)
581 tspi = spi_master_get_devdata(master); 656 tspi = spi_master_get_devdata(master);
582 657
583 spi_unregister_master(master); 658 spi_unregister_master(master);
659#if defined(CONFIG_TEGRA_SYSTEM_DMA)
584 tegra_dma_free_channel(tspi->rx_dma); 660 tegra_dma_free_channel(tspi->rx_dma);
661#else
662 dma_release_channel(tspi->rx_dma);
663#endif
585 664
586 dma_free_coherent(&pdev->dev, sizeof(u32) * BB_LEN, 665 dma_free_coherent(&pdev->dev, sizeof(u32) * BB_LEN,
587 tspi->rx_bb, tspi->rx_bb_phys); 666 tspi->rx_bb, tspi->rx_bb_phys);
diff --git a/drivers/spi/spi-xcomm.c b/drivers/spi/spi-xcomm.c
new file mode 100644
index 000000000000..266a847e2992
--- /dev/null
+++ b/drivers/spi/spi-xcomm.c
@@ -0,0 +1,276 @@
1/*
2 * Analog Devices AD-FMCOMMS1-EBZ board I2C-SPI bridge driver
3 *
4 * Copyright 2012 Analog Devices Inc.
5 * Author: Lars-Peter Clausen <lars@metafoo.de>
6 *
7 * Licensed under the GPL-2 or later.
8 */
9
10#include <linux/kernel.h>
11#include <linux/init.h>
12#include <linux/module.h>
13#include <linux/delay.h>
14#include <linux/i2c.h>
15#include <linux/spi/spi.h>
16#include <asm/unaligned.h>
17
18#define SPI_XCOMM_SETTINGS_LEN_OFFSET 10
19#define SPI_XCOMM_SETTINGS_3WIRE BIT(6)
20#define SPI_XCOMM_SETTINGS_CS_HIGH BIT(5)
21#define SPI_XCOMM_SETTINGS_SAMPLE_END BIT(4)
22#define SPI_XCOMM_SETTINGS_CPHA BIT(3)
23#define SPI_XCOMM_SETTINGS_CPOL BIT(2)
24#define SPI_XCOMM_SETTINGS_CLOCK_DIV_MASK 0x3
25#define SPI_XCOMM_SETTINGS_CLOCK_DIV_64 0x2
26#define SPI_XCOMM_SETTINGS_CLOCK_DIV_16 0x1
27#define SPI_XCOMM_SETTINGS_CLOCK_DIV_4 0x0
28
29#define SPI_XCOMM_CMD_UPDATE_CONFIG 0x03
30#define SPI_XCOMM_CMD_WRITE 0x04
31
32#define SPI_XCOMM_CLOCK 48000000
33
34struct spi_xcomm {
35 struct i2c_client *i2c;
36
37 uint16_t settings;
38 uint16_t chipselect;
39
40 unsigned int current_speed;
41
42 uint8_t buf[63];
43};
44
45static int spi_xcomm_sync_config(struct spi_xcomm *spi_xcomm, unsigned int len)
46{
47 uint16_t settings;
48 uint8_t *buf = spi_xcomm->buf;
49
50 settings = spi_xcomm->settings;
51 settings |= len << SPI_XCOMM_SETTINGS_LEN_OFFSET;
52
53 buf[0] = SPI_XCOMM_CMD_UPDATE_CONFIG;
54 put_unaligned_be16(settings, &buf[1]);
55 put_unaligned_be16(spi_xcomm->chipselect, &buf[3]);
56
57 return i2c_master_send(spi_xcomm->i2c, buf, 5);
58}
59
60static void spi_xcomm_chipselect(struct spi_xcomm *spi_xcomm,
61 struct spi_device *spi, int is_active)
62{
63 unsigned long cs = spi->chip_select;
64 uint16_t chipselect = spi_xcomm->chipselect;
65
66 if (is_active)
67 chipselect |= BIT(cs);
68 else
69 chipselect &= ~BIT(cs);
70
71 spi_xcomm->chipselect = chipselect;
72}
73
74static int spi_xcomm_setup_transfer(struct spi_xcomm *spi_xcomm,
75 struct spi_device *spi, struct spi_transfer *t, unsigned int *settings)
76{
77 unsigned int speed;
78
79 if ((t->bits_per_word && t->bits_per_word != 8) || t->len > 62)
80 return -EINVAL;
81
82 speed = t->speed_hz ? t->speed_hz : spi->max_speed_hz;
83
84 if (speed != spi_xcomm->current_speed) {
85 unsigned int divider = DIV_ROUND_UP(SPI_XCOMM_CLOCK, speed);
86 if (divider >= 64)
87 *settings |= SPI_XCOMM_SETTINGS_CLOCK_DIV_64;
88 else if (divider >= 16)
89 *settings |= SPI_XCOMM_SETTINGS_CLOCK_DIV_16;
90 else
91 *settings |= SPI_XCOMM_SETTINGS_CLOCK_DIV_4;
92
93 spi_xcomm->current_speed = speed;
94 }
95
96 if (spi->mode & SPI_CPOL)
97 *settings |= SPI_XCOMM_SETTINGS_CPOL;
98 else
99 *settings &= ~SPI_XCOMM_SETTINGS_CPOL;
100
101 if (spi->mode & SPI_CPHA)
102 *settings &= ~SPI_XCOMM_SETTINGS_CPHA;
103 else
104 *settings |= SPI_XCOMM_SETTINGS_CPHA;
105
106 if (spi->mode & SPI_3WIRE)
107 *settings |= SPI_XCOMM_SETTINGS_3WIRE;
108 else
109 *settings &= ~SPI_XCOMM_SETTINGS_3WIRE;
110
111 return 0;
112}
113
114static int spi_xcomm_txrx_bufs(struct spi_xcomm *spi_xcomm,
115 struct spi_device *spi, struct spi_transfer *t)
116{
117 int ret;
118
119 if (t->tx_buf) {
120 spi_xcomm->buf[0] = SPI_XCOMM_CMD_WRITE;
121 memcpy(spi_xcomm->buf + 1, t->tx_buf, t->len);
122
123 ret = i2c_master_send(spi_xcomm->i2c, spi_xcomm->buf, t->len + 1);
124 if (ret < 0)
125 return ret;
126 else if (ret != t->len + 1)
127 return -EIO;
128 } else if (t->rx_buf) {
129 ret = i2c_master_recv(spi_xcomm->i2c, t->rx_buf, t->len);
130 if (ret < 0)
131 return ret;
132 else if (ret != t->len)
133 return -EIO;
134 }
135
136 return t->len;
137}
138
139static int spi_xcomm_transfer_one(struct spi_master *master,
140 struct spi_message *msg)
141{
142 struct spi_xcomm *spi_xcomm = spi_master_get_devdata(master);
143 unsigned int settings = spi_xcomm->settings;
144 struct spi_device *spi = msg->spi;
145 unsigned cs_change = 0;
146 struct spi_transfer *t;
147 bool is_first = true;
148 int status = 0;
149 bool is_last;
150
151 is_first = true;
152
153 spi_xcomm_chipselect(spi_xcomm, spi, true);
154
155 list_for_each_entry(t, &msg->transfers, transfer_list) {
156
157 if (!t->tx_buf && !t->rx_buf && t->len) {
158 status = -EINVAL;
159 break;
160 }
161
162 status = spi_xcomm_setup_transfer(spi_xcomm, spi, t, &settings);
163 if (status < 0)
164 break;
165
166 is_last = list_is_last(&t->transfer_list, &msg->transfers);
167 cs_change = t->cs_change;
168
169 if (cs_change ^ is_last)
170 settings |= BIT(5);
171 else
172 settings &= ~BIT(5);
173
174 if (t->rx_buf) {
175 spi_xcomm->settings = settings;
176 status = spi_xcomm_sync_config(spi_xcomm, t->len);
177 if (status < 0)
178 break;
179 } else if (settings != spi_xcomm->settings || is_first) {
180 spi_xcomm->settings = settings;
181 status = spi_xcomm_sync_config(spi_xcomm, 0);
182 if (status < 0)
183 break;
184 }
185
186 if (t->len) {
187 status = spi_xcomm_txrx_bufs(spi_xcomm, spi, t);
188
189 if (status < 0)
190 break;
191
192 if (status > 0)
193 msg->actual_length += status;
194 }
195 status = 0;
196
197 if (t->delay_usecs)
198 udelay(t->delay_usecs);
199
200 is_first = false;
201 }
202
203 if (status != 0 || !cs_change)
204 spi_xcomm_chipselect(spi_xcomm, spi, false);
205
206 msg->status = status;
207 spi_finalize_current_message(master);
208
209 return status;
210}
211
212static int spi_xcomm_setup(struct spi_device *spi)
213{
214 if (spi->bits_per_word != 8)
215 return -EINVAL;
216
217 return 0;
218}
219
220static int __devinit spi_xcomm_probe(struct i2c_client *i2c,
221 const struct i2c_device_id *id)
222{
223 struct spi_xcomm *spi_xcomm;
224 struct spi_master *master;
225 int ret;
226
227 master = spi_alloc_master(&i2c->dev, sizeof(*spi_xcomm));
228 if (!master)
229 return -ENOMEM;
230
231 spi_xcomm = spi_master_get_devdata(master);
232 spi_xcomm->i2c = i2c;
233
234 master->num_chipselect = 16;
235 master->mode_bits = SPI_CPHA | SPI_CPOL | SPI_3WIRE;
236 master->flags = SPI_MASTER_HALF_DUPLEX;
237 master->setup = spi_xcomm_setup;
238 master->transfer_one_message = spi_xcomm_transfer_one;
239 master->dev.of_node = i2c->dev.of_node;
240 i2c_set_clientdata(i2c, master);
241
242 ret = spi_register_master(master);
243 if (ret < 0)
244 spi_master_put(master);
245
246 return ret;
247}
248
249static int __devexit spi_xcomm_remove(struct i2c_client *i2c)
250{
251 struct spi_master *master = i2c_get_clientdata(i2c);
252
253 spi_unregister_master(master);
254
255 return 0;
256}
257
258static const struct i2c_device_id spi_xcomm_ids[] = {
259 { "spi-xcomm" },
260 { },
261};
262
263static struct i2c_driver spi_xcomm_driver = {
264 .driver = {
265 .name = "spi-xcomm",
266 .owner = THIS_MODULE,
267 },
268 .id_table = spi_xcomm_ids,
269 .probe = spi_xcomm_probe,
270 .remove = __devexit_p(spi_xcomm_remove),
271};
272module_i2c_driver(spi_xcomm_driver);
273
274MODULE_LICENSE("GPL");
275MODULE_AUTHOR("Lars-Peter Clausen <lars@metafoo.de>");
276MODULE_DESCRIPTION("Analog Devices AD-FMCOMMS1-EBZ board I2C-SPI bridge driver");
diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c
index 1041cb83d67a..84c2861d6f4d 100644
--- a/drivers/spi/spi.c
+++ b/drivers/spi/spi.c
@@ -53,7 +53,7 @@ modalias_show(struct device *dev, struct device_attribute *a, char *buf)
53{ 53{
54 const struct spi_device *spi = to_spi_device(dev); 54 const struct spi_device *spi = to_spi_device(dev);
55 55
56 return sprintf(buf, "%s\n", spi->modalias); 56 return sprintf(buf, "%s%s\n", SPI_MODULE_PREFIX, spi->modalias);
57} 57}
58 58
59static struct device_attribute spi_dev_attrs[] = { 59static struct device_attribute spi_dev_attrs[] = {
diff --git a/drivers/usb/host/ehci-orion.c b/drivers/usb/host/ehci-orion.c
index 82de1073aa52..c6903e3af29c 100644
--- a/drivers/usb/host/ehci-orion.c
+++ b/drivers/usb/host/ehci-orion.c
@@ -298,6 +298,10 @@ static int __devinit ehci_orion_drv_probe(struct platform_device *pdev)
298err4: 298err4:
299 usb_put_hcd(hcd); 299 usb_put_hcd(hcd);
300err3: 300err3:
301 if (!IS_ERR(clk)) {
302 clk_disable_unprepare(clk);
303 clk_put(clk);
304 }
301 iounmap(regs); 305 iounmap(regs);
302err2: 306err2:
303 release_mem_region(res->start, resource_size(res)); 307 release_mem_region(res->start, resource_size(res));
diff --git a/drivers/watchdog/orion_wdt.c b/drivers/watchdog/orion_wdt.c
index 0f5736949c61..1531e0256c34 100644
--- a/drivers/watchdog/orion_wdt.c
+++ b/drivers/watchdog/orion_wdt.c
@@ -25,6 +25,7 @@
25#include <linux/io.h> 25#include <linux/io.h>
26#include <linux/spinlock.h> 26#include <linux/spinlock.h>
27#include <linux/clk.h> 27#include <linux/clk.h>
28#include <linux/of.h>
28#include <mach/bridge-regs.h> 29#include <mach/bridge-regs.h>
29 30
30/* 31/*
@@ -295,6 +296,12 @@ static void orion_wdt_shutdown(struct platform_device *pdev)
295 orion_wdt_disable(); 296 orion_wdt_disable();
296} 297}
297 298
299static const struct of_device_id orion_wdt_of_match_table[] __devinitdata = {
300 { .compatible = "marvell,orion-wdt", },
301 {},
302};
303MODULE_DEVICE_TABLE(of, orion_wdt_of_match_table);
304
298static struct platform_driver orion_wdt_driver = { 305static struct platform_driver orion_wdt_driver = {
299 .probe = orion_wdt_probe, 306 .probe = orion_wdt_probe,
300 .remove = __devexit_p(orion_wdt_remove), 307 .remove = __devexit_p(orion_wdt_remove),
@@ -302,6 +309,7 @@ static struct platform_driver orion_wdt_driver = {
302 .driver = { 309 .driver = {
303 .owner = THIS_MODULE, 310 .owner = THIS_MODULE,
304 .name = "orion_wdt", 311 .name = "orion_wdt",
312 .of_match_table = of_match_ptr(orion_wdt_of_match_table),
305 }, 313 },
306}; 314};
307 315
diff --git a/include/linux/amba/pl022.h b/include/linux/amba/pl022.h
index 76dd1b199a1b..fe1d7b283cb6 100644
--- a/include/linux/amba/pl022.h
+++ b/include/linux/amba/pl022.h
@@ -231,6 +231,7 @@ enum ssp_chip_select {
231struct dma_chan; 231struct dma_chan;
232/** 232/**
233 * struct pl022_ssp_master - device.platform_data for SPI controller devices. 233 * struct pl022_ssp_master - device.platform_data for SPI controller devices.
234 * @bus_id: identifier for this bus
234 * @num_chipselect: chipselects are used to distinguish individual 235 * @num_chipselect: chipselects are used to distinguish individual
235 * SPI slaves, and are numbered from zero to num_chipselects - 1. 236 * SPI slaves, and are numbered from zero to num_chipselects - 1.
236 * each slave has a chipselect signal, but it's common that not 237 * each slave has a chipselect signal, but it's common that not
@@ -259,19 +260,13 @@ struct pl022_ssp_controller {
259 * struct ssp_config_chip - spi_board_info.controller_data for SPI 260 * struct ssp_config_chip - spi_board_info.controller_data for SPI
260 * slave devices, copied to spi_device.controller_data. 261 * slave devices, copied to spi_device.controller_data.
261 * 262 *
262 * @lbm: used for test purpose to internally connect RX and TX
263 * @iface: Interface type(Motorola, TI, Microwire, Universal) 263 * @iface: Interface type(Motorola, TI, Microwire, Universal)
264 * @hierarchy: sets whether interface is master or slave 264 * @hierarchy: sets whether interface is master or slave
265 * @slave_tx_disable: SSPTXD is disconnected (in slave mode only) 265 * @slave_tx_disable: SSPTXD is disconnected (in slave mode only)
266 * @clk_freq: Tune freq parameters of SSP(when in master mode) 266 * @clk_freq: Tune freq parameters of SSP(when in master mode)
267 * @endian_rx: Endianess of Data in Rx FIFO
268 * @endian_tx: Endianess of Data in Tx FIFO
269 * @data_size: Width of data element(4 to 32 bits)
270 * @com_mode: communication mode: polling, Interrupt or DMA 267 * @com_mode: communication mode: polling, Interrupt or DMA
271 * @rx_lev_trig: Rx FIFO watermark level (for IT & DMA mode) 268 * @rx_lev_trig: Rx FIFO watermark level (for IT & DMA mode)
272 * @tx_lev_trig: Tx FIFO watermark level (for IT & DMA mode) 269 * @tx_lev_trig: Tx FIFO watermark level (for IT & DMA mode)
273 * @clk_phase: Motorola SPI interface Clock phase
274 * @clk_pol: Motorola SPI interface Clock polarity
275 * @ctrl_len: Microwire interface: Control length 270 * @ctrl_len: Microwire interface: Control length
276 * @wait_state: Microwire interface: Wait state 271 * @wait_state: Microwire interface: Wait state
277 * @duplex: Microwire interface: Full/Half duplex 272 * @duplex: Microwire interface: Full/Half duplex
@@ -279,8 +274,6 @@ struct pl022_ssp_controller {
279 * before sampling the incoming line 274 * before sampling the incoming line
280 * @cs_control: function pointer to board-specific function to 275 * @cs_control: function pointer to board-specific function to
281 * assert/deassert I/O port to control HW generation of devices chip-select. 276 * assert/deassert I/O port to control HW generation of devices chip-select.
282 * @dma_xfer_type: Type of DMA xfer (Mem-to-periph or Periph-to-Periph)
283 * @dma_config: DMA configuration for SSP controller and peripheral
284 */ 277 */
285struct pl022_config_chip { 278struct pl022_config_chip {
286 enum ssp_interface iface; 279 enum ssp_interface iface;
diff --git a/sound/soc/kirkwood/kirkwood-i2s.c b/sound/soc/kirkwood/kirkwood-i2s.c
index fa4556750451..7646dd7f30cb 100644
--- a/sound/soc/kirkwood/kirkwood-i2s.c
+++ b/sound/soc/kirkwood/kirkwood-i2s.c
@@ -458,7 +458,13 @@ static __devinit int kirkwood_i2s_dev_probe(struct platform_device *pdev)
458 } 458 }
459 clk_prepare_enable(priv->clk); 459 clk_prepare_enable(priv->clk);
460 460
461 return snd_soc_register_dai(&pdev->dev, &kirkwood_i2s_dai); 461 err = snd_soc_register_dai(&pdev->dev, &kirkwood_i2s_dai);
462 if (!err)
463 return 0;
464 dev_err(&pdev->dev, "snd_soc_register_dai failed\n");
465
466 clk_disable_unprepare(priv->clk);
467 clk_put(priv->clk);
462 468
463err_ioremap: 469err_ioremap:
464 iounmap(priv->io); 470 iounmap(priv->io);