Commit 44d82e29 authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'dt2' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc

Pull arm-soc Marvell Orion device-tree updates from Olof Johansson:
 "This contains a set of device-tree conversions for Marvell Orion
  platforms that were staged early but took a few tries to get the
  branch into a format where it was suitable for us to pick up.

  Given that most people working on these platforms are hobbyists with
  limited time, we were a bit more flexible with merging it even though
  it came in late."

* tag 'dt2' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc: (21 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
  ...

Conflicts:
	drivers/watchdog/orion_wdt.c
parents bfdf85df 15a1e1ba
...@@ -38,3 +38,23 @@ Example: ...@@ -38,3 +38,23 @@ Example:
reg-names = "mux status", "mux mask"; reg-names = "mux status", "mux mask";
mrvl,intc-nr-irqs = <2>; mrvl,intc-nr-irqs = <2>;
}; };
* Marvell Orion Interrupt controller
Required properties
- compatible : Should be "marvell,orion-intc".
- #interrupt-cells: Specifies the number of cells needed to encode an
interrupt source. Supported value is <1>.
- interrupt-controller : Declare this node to be an interrupt controller.
- reg : Interrupt mask address. A list of 4 byte ranges, one per controller.
One entry in the list represents 32 interrupts.
Example:
intc: interrupt-controller {
compatible = "marvell,orion-intc", "marvell,intc";
interrupt-controller;
#interrupt-cells = <1>;
reg = <0xfed20204 0x04>,
<0xfed20214 0x04>;
};
* Marvell Orion SATA
Required Properties:
- compatibility : "marvell,orion-sata"
- reg : Address range of controller
- interrupts : Interrupt controller is using
- nr-ports : Number of SATA ports in use.
Example:
sata@80000 {
compatible = "marvell,orion-sata";
reg = <0x80000 0x5000>;
interrupts = <21>;
nr-ports = <2>;
}
...@@ -27,3 +27,26 @@ Example: ...@@ -27,3 +27,26 @@ Example:
interrupt-controller; interrupt-controller;
#interrupt-cells = <1>; #interrupt-cells = <1>;
}; };
* Marvell Orion GPIO Controller
Required properties:
- compatible : Should be "marvell,orion-gpio"
- reg : Address and length of the register set for controller.
- gpio-controller : So we know this is a gpio controller.
- ngpio : How many gpios this controller has.
- interrupts : Up to 4 Interrupts for the controller.
Optional properties:
- mask-offset : For SMP Orions, offset for Nth CPU
Example:
gpio0: gpio@10100 {
compatible = "marvell,orion-gpio";
#gpio-cells = <2>;
gpio-controller;
reg = <0x10100 0x40>;
ngpio = <32>;
interrupts = <35>, <36>, <37>, <38>;
};
* Marvell Orion Watchdog Time
Required Properties:
- Compatibility : "marvell,orion-wdt"
- reg : Address of the timer registers
Example:
wdt@20300 {
compatible = "marvell,orion-wdt";
reg = <0x20300 0x28>;
status = "okay";
};
...@@ -1151,6 +1151,7 @@ config PLAT_ORION ...@@ -1151,6 +1151,7 @@ config PLAT_ORION
bool bool
select CLKSRC_MMIO select CLKSRC_MMIO
select GENERIC_IRQ_CHIP select GENERIC_IRQ_CHIP
select IRQ_DOMAIN
select COMMON_CLK select COMMON_CLK
config PLAT_PXA config PLAT_PXA
......
/dts-v1/; /dts-v1/;
/include/ "kirkwood.dtsi" /include/ "kirkwood-dnskw.dtsi"
/ { / {
model = "D-Link DNS-320 NAS (Rev A1)"; model = "D-Link DNS-320 NAS (Rev A1)";
...@@ -15,50 +15,40 @@ chosen { ...@@ -15,50 +15,40 @@ chosen {
bootargs = "console=ttyS0,115200n8 earlyprintk"; bootargs = "console=ttyS0,115200n8 earlyprintk";
}; };
ocp@f1000000 { gpio-leds {
serial@12000 { compatible = "gpio-leds";
clock-frequency = <166666667>; blue-power {
status = "okay"; label = "dns320:blue:power";
gpios = <&gpio0 26 1>; /* GPIO 26 Active Low */
linux,default-trigger = "default-on";
}; };
blue-usb {
serial@12100 { label = "dns320:blue:usb";
clock-frequency = <166666667>; gpios = <&gpio1 11 1>; /* GPIO 43 Active Low */
status = "okay";
}; };
orange-l_hdd {
nand@3000000 { label = "dns320:orange:l_hdd";
status = "okay"; gpios = <&gpio0 28 1>; /* GPIO 28 Active Low */
partition@0 {
label = "u-boot";
reg = <0x0000000 0x100000>;
read-only;
}; };
orange-r_hdd {
partition@100000 { label = "dns320:orange:r_hdd";
label = "uImage"; gpios = <&gpio0 27 1>; /* GPIO 27 Active Low */
reg = <0x0100000 0x500000>;
}; };
orange-usb {
partition@600000 { label = "dns320:orange:usb";
label = "ramdisk"; gpios = <&gpio1 3 1>; /* GPIO 35 Active Low */
reg = <0x0600000 0x500000>;
}; };
partition@b00000 {
label = "image";
reg = <0x0b00000 0x6600000>;
}; };
partition@7100000 { ocp@f1000000 {
label = "mini firmware"; serial@12000 {
reg = <0x7100000 0xa00000>; clock-frequency = <166666667>;
status = "okay";
}; };
partition@7b00000 { serial@12100 {
label = "config"; clock-frequency = <166666667>;
reg = <0x7b00000 0x500000>; status = "okay";
};
}; };
}; };
}; };
/dts-v1/; /dts-v1/;
/include/ "kirkwood.dtsi" /include/ "kirkwood-dnskw.dtsi"
/ { / {
model = "D-Link DNS-325 NAS (Rev A1)"; model = "D-Link DNS-325 NAS (Rev A1)";
...@@ -15,45 +15,43 @@ chosen { ...@@ -15,45 +15,43 @@ chosen {
bootargs = "console=ttyS0,115200n8 earlyprintk"; bootargs = "console=ttyS0,115200n8 earlyprintk";
}; };
ocp@f1000000 { gpio-leds {
serial@12000 { compatible = "gpio-leds";
clock-frequency = <200000000>; white-power {
status = "okay"; label = "dns325:white:power";
gpios = <&gpio0 26 1>; /* GPIO 26 Active Low */
linux,default-trigger = "default-on";
}; };
white-usb {
nand@3000000 { label = "dns325:white:usb";
status = "okay"; gpios = <&gpio1 11 1>; /* GPIO 43 Active Low */
partition@0 {
label = "u-boot";
reg = <0x0000000 0x100000>;
read-only;
}; };
red-l_hdd {
partition@100000 { label = "dns325:red:l_hdd";
label = "uImage"; gpios = <&gpio0 28 1>; /* GPIO 28 Active Low */
reg = <0x0100000 0x500000>;
}; };
red-r_hdd {
partition@600000 { label = "dns325:red:r_hdd";
label = "ramdisk"; gpios = <&gpio0 27 1>; /* GPIO 27 Active Low */
reg = <0x0600000 0x500000>;
}; };
red-usb {
partition@b00000 { label = "dns325:red:usb";
label = "image"; gpios = <&gpio0 29 1>; /* GPIO 29 Active Low */
reg = <0x0b00000 0x6600000>;
}; };
partition@7100000 {
label = "mini firmware";
reg = <0x7100000 0xa00000>;
}; };
partition@7b00000 { ocp@f1000000 {
label = "config"; i2c@11000 {
reg = <0x7b00000 0x500000>; status = "okay";
lm75: lm75@48 {
compatible = "national,lm75";
reg = <0x48>;
}; };
}; };
serial@12000 {
clock-frequency = <200000000>;
status = "okay";
};
}; };
}; };
/include/ "kirkwood.dtsi"
/ {
model = "D-Link DNS NASes (kirkwood-based)";
compatible = "dlink,dns-kirkwood", "marvell,kirkwood-88f6281", "marvell,kirkwood";
gpio_keys {
compatible = "gpio-keys";
#address-cells = <1>;
#size-cells = <0>;
button@1 {
label = "Power button";
linux,code = <116>;
gpios = <&gpio1 2 1>;
};
button@2 {
label = "USB unmount button";
linux,code = <161>;
gpios = <&gpio1 15 1>;
};
button@3 {
label = "Reset button";
linux,code = <0x198>;
gpios = <&gpio1 16 1>;
};
};
ocp@f1000000 {
sata@80000 {
status = "okay";
nr-ports = <2>;
};
nand@3000000 {
status = "okay";
partition@0 {
label = "u-boot";
reg = <0x0000000 0x100000>;
read-only;
};
partition@100000 {
label = "uImage";
reg = <0x0100000 0x500000>;
};
partition@600000 {
label = "ramdisk";
reg = <0x0600000 0x500000>;
};
partition@b00000 {
label = "image";
reg = <0x0b00000 0x6600000>;
};
partition@7100000 {
label = "mini firmware";
reg = <0x7100000 0xa00000>;
};
partition@7b00000 {
label = "config";
reg = <0x7b00000 0x500000>;
};
};
};
};
...@@ -20,5 +20,55 @@ serial@12000 { ...@@ -20,5 +20,55 @@ serial@12000 {
clock-frequency = <200000000>; clock-frequency = <200000000>;
status = "ok"; status = "ok";
}; };
spi@10600 {
status = "okay";
m25p40@0 {
#address-cells = <1>;
#size-cells = <1>;
compatible = "mx25l1606e";
reg = <0>;
spi-max-frequency = <50000000>;
mode = <0>;
partition@0 {
reg = <0x0 0x80000>;
label = "u-boot";
};
partition@100000 {
reg = <0x100000 0x10000>;
label = "u-boot env";
};
partition@180000 {
reg = <0x180000 0x10000>;
label = "dtb";
};
};
};
sata@80000 {
status = "okay";
nr-ports = <1>;
};
};
gpio-leds {
compatible = "gpio-leds";
bluetooth {
label = "dreamplug:blue:bluetooth";
gpios = <&gpio1 15 1>;
};
wifi {
label = "dreamplug:green:wifi";
gpios = <&gpio1 16 1>;
};
wifi-ap {
label = "dreamplug:green:wifi_ap";
gpios = <&gpio1 17 1>;
};
}; };
}; };
/dts-v1/;
/include/ "kirkwood.dtsi"
/ {
model = "Seagate GoFlex Net";
compatible = "seagate,goflexnet", "marvell,kirkwood-88f6281", "marvell,kirkwood";
memory {
device_type = "memory";
reg = <0x00000000 0x8000000>;
};
chosen {
bootargs = "console=ttyS0,115200n8 earlyprintk root=/dev/sda1 rootdelay=10";
};
ocp@f1000000 {
serial@12000 {
clock-frequency = <200000000>;
status = "ok";
};
nand@3000000 {
status = "okay";
partition@0 {
label = "u-boot";
reg = <0x0000000 0x100000>;
read-only;
};
partition@100000 {
label = "uImage";
reg = <0x0100000 0x400000>;
};
partition@500000 {
label = "pogoplug";
reg = <0x0500000 0x2000000>;
};
partition@2500000 {
label = "root";
reg = <0x02500000 0xd800000>;
};
};
sata@80000 {
status = "okay";
nr-ports = <2>;
};
};
gpio-leds {
compatible = "gpio-leds";
health {
label = "status:green:health";
gpios = <&gpio1 14 1>;
linux,default-trigger = "default-on";
};
fault {
label = "status:orange:fault";
gpios = <&gpio1 15 1>;
};
left0 {
label = "status:white:left0";
gpios = <&gpio1 10 0>;
};
left1 {
label = "status:white:left1";
gpios = <&gpio1 11 0>;
};
left2 {
label = "status:white:left2";
gpios = <&gpio1 12 0>;
};
left3 {
label = "status:white:left3";
gpios = <&gpio1 13 0>;
};
right0 {
label = "status:white:right0";
gpios = <&gpio1 6 0>;
};
right1 {
label = "status:white:right1";
gpios = <&gpio1 7 0>;
};
right2 {
label = "status:white:right2";
gpios = <&gpio1 8 0>;
};
right3 {
label = "status:white:right3";
gpios = <&gpio1 9 0>;
};
};
};
...@@ -21,6 +21,11 @@ serial@12000 { ...@@ -21,6 +21,11 @@ serial@12000 {
status = "okay"; status = "okay";
}; };
sata@80000 {
status = "okay";
nr-ports = <2>;
};
nand@3000000 { nand@3000000 {
status = "okay"; status = "okay";
...@@ -41,4 +46,37 @@ partition@700000 { ...@@ -41,4 +46,37 @@ partition@700000 {
}; };
}; };
gpio_keys {
compatible = "gpio-keys";
#address-cells = <1>;
#size-cells = <0>;
button@1 {
label = "USB Copy";
linux,code = <133>;
gpios = <&gpio0 29 1>;
};
button@2 {
label = "Reset";
linux,code = <0x198>;
gpios = <&gpio0 28 1>;
};
};
gpio-leds {
compatible = "gpio-leds";
green-os {
label = "ib62x0:green:os";
gpios = <&gpio0 25 0>;
linux,default-trigger = "default-on";
};
red-os {
label = "ib62x0:red:os";
gpios = <&gpio0 22 0>;
};
usb-copy {
label = "ib62x0:red:usb_copy";
gpios = <&gpio0 27 0>;
};
};
}; };
...@@ -18,9 +18,51 @@ chosen { ...@@ -18,9 +18,51 @@ chosen {
}; };
ocp@f1000000 { ocp@f1000000 {
i2c@11000 {
status = "okay";
lm63: lm63@4c {
compatible = "national,lm63";
reg = <0x4c>;
};
};
serial@12000 { serial@12000 {
clock-frequency = <200000000>; clock-frequency = <200000000>;
status = "ok"; status = "ok";
}; };
}; };
gpio-leds {
compatible = "gpio-leds";
led-level {
label = "led_level";
gpios = <&gpio1 9 0>;
linux,default-trigger = "default-on";
};
power-blue {
label = "power:blue";
gpios = <&gpio1 11 0>;
linux,default-trigger = "timer";
};
usb1 {
label = "usb1:blue";
gpios = <&gpio1 12 0>;
};
usb2 {
label = "usb2:blue";
gpios = <&gpio1 13 0>;
};
usb3 {
label = "usb3:blue";
gpios = <&gpio1 14 0>;
};
usb4 {
label = "usb4:blue";
gpios = <&gpio1 15 0>;
};
otb {
label = "otb:blue";
gpios = <&gpio1 16 0>;
};
};
}; };
/dts-v1/;
/include/ "kirkwood-lsxl.dtsi"
/ {
model = "Buffalo Linkstation LS-CHLv2";
compatible = "buffalo,lschlv2", "buffalo,lsxl", "marvell,kirkwood-88f6281", "marvell,kirkwood";
memory {
device_type = "memory";
reg = <0x00000000 0x4000000>;
};
ocp@f1000000 {
serial@12000 {
clock-frequency = <166666667>;
status = "okay";
};
};
};
/dts-v1/;
/include/ "kirkwood-lsxl.dtsi"
/ {
model = "Buffalo Linkstation LS-XHL";
compatible = "buffalo,lsxhl", "buffalo,lsxl", "marvell,kirkwood-88f6281", "marvell,kirkwood";
memory {
device_type = "memory";
reg = <0x00000000 0x10000000>;
};
ocp@f1000000 {
serial@12000 {
clock-frequency = <200000000>;
status = "okay";
};
};
};
/include/ "kirkwood.dtsi"
/ {
chosen {
bootargs = "console=ttyS0,115200n8 earlyprintk";
};
ocp@f1000000 {
sata@80000 {
status = "okay";
nr-ports = <1>;
};
spi@10600 {
status = "okay";
m25p40@0 {
#address-cells = <1>;
#size-cells = <1>;
compatible = "m25p40";
reg = <0>;
spi-max-frequency = <25000000>;
mode = <0>;
partition@0 {
reg = <0x0 0x60000>;
label = "uboot";
read-only;
};
partition@60000 {
reg = <0x60000 0x10000>;
label = "dtb";
read-only;
};
partition@70000 {
reg = <0x70000 0x10000>;
label = "uboot_env";
};
};
};
};
gpio_keys {
compatible = "gpio-keys";
#address-cells = <1>;
#size-cells = <0>;
button@1 {
label = "Function Button";
linux,code = <132>;
gpios = <&gpio1 9 1>;
};
button@2 {
label = "Power-on Switch";
linux,code = <116>;
gpios = <&gpio1 10 1>;
};
button@3 {
label = "Power-auto Switch";
linux,code = <142>;
gpios = <&gpio1 11 1>;
};
};
gpio_leds {
compatible = "gpio-leds";
led@1 {
label = "lschlv2:blue:func";
gpios = <&gpio1 4 1>;
};
led@2 {
label = "lschlv2:red:alarm";
gpios = <&gpio1 5 1>;
};
led@3 {
label = "lschlv2:amber:info";
gpios = <&gpio1 6 1>;
};
led@4 {
label = "lschlv2:blue:power";
gpios = <&gpio1 7 1>;
linux,default-trigger = "default-on";
};
led@5 {
label = "lschlv2:red:func";
gpios = <&gpio1 16 1>;
};
};
};
/dts-v1/;
/include/ "kirkwood-ts219.dtsi"
/ {
gpio_keys {
compatible = "gpio-keys";
#address-cells = <1>;
#size-cells = <0>;
button@1 {
label = "USB Copy";
linux,code = <133>;
gpios = <&gpio0 15 1>;
};
button@2 {
label = "Reset";
linux,code = <0x198>;
gpios = <&gpio0 16 1>;
};
};
};
\ No newline at end of file
/dts-v1/;
/include/ "kirkwood-ts219.dtsi"
/ {
gpio_keys {
compatible = "gpio-keys";
#address-cells = <1>;
#size-cells = <0>;
button@1 {
label = "USB Copy";
linux,code = <133>;
gpios = <&gpio1 11 1>;
};
button@2 {
label = "Reset";
linux,code = <0x198>;
gpios = <&gpio1 5 1>;
};
};
};
\ No newline at end of file
/include/ "kirkwood.dtsi"
/ {
model = "QNAP TS219 family";
compatible = "qnap,ts219", "marvell,kirkwood";
memory {
device_type = "memory";
reg = <0x00000000 0x20000000>;
};
chosen {
bootargs = "console=ttyS0,115200n8";
};
ocp@f1000000 {
i2c@11000 {
status = "okay";
clock-frequency = <400000>;
s35390a: s35390a@30 {
compatible = "s35390a";
reg = <0x30>;
};
};
serial@12000 {
clock-frequency = <200000000>;
status = "okay";
};
serial@12100 {
clock-frequency = <200000000>;
status = "okay";
};
spi@10600 {
status = "okay";
m25p128@0 {
#address-cells = <1>;
#size-cells = <1>;
compatible = "m25p128";
reg = <0>;
spi-max-frequency = <20000000>;
mode = <0>;
partition@0000000 {
reg = <0x00000000 0x00080000>;
label = "U-Boot";
};
partition@00200000 {
reg = <0x00200000 0x00200000>;
label = "Kernel";
};
partition@00400000 {
reg = <0x00400000 0x00900000>;
label = "RootFS1";
};
partition@00d00000 {
reg = <0x00d00000 0x00300000>;
label = "RootFS2";
};
partition@00040000 {
reg = <0x00080000 0x00040000>;
label = "U-Boot Config";
};
partition@000c0000 {
reg = <0x000c0000 0x00140000>;
label = "NAS Config";
};
};
};
sata@80000 {
status = "okay";
nr-ports = <2>;
};
};
};
...@@ -2,6 +2,15 @@ ...@@ -2,6 +2,15 @@
/ { / {
compatible = "marvell,kirkwood"; compatible = "marvell,kirkwood";
interrupt-parent = <&intc>;
intc: interrupt-controller {
compatible = "marvell,orion-intc", "marvell,intc";
interrupt-controller;
#interrupt-cells = <1>;
reg = <0xf1020204 0x04>,
<0xf1020214 0x04>;
};
ocp@f1000000 { ocp@f1000000 {
compatible = "simple-bus"; compatible = "simple-bus";
...@@ -9,6 +18,24 @@ ocp@f1000000 { ...@@ -9,6 +18,24 @@ ocp@f1000000 {
#address-cells = <1>; #address-cells = <1>;
#size-cells = <1>; #size-cells = <1>;
gpio0: gpio@10100 {
compatible = "marvell,orion-gpio";
#gpio-cells = <2>;
gpio-controller;
reg = <0x10100 0x40>;
ngpio = <32>;
interrupts = <35>, <36>, <37>, <38>;
};
gpio1: gpio@10140 {
compatible = "marvell,orion-gpio";
#gpio-cells = <2>;
gpio-controller;
reg = <0x10140 0x40>;
ngpio = <18>;
interrupts = <39>, <40>, <41>;
};
serial@12000 { serial@12000 {
compatible = "ns16550a"; compatible = "ns16550a";
reg = <0x12000 0x100>; reg = <0x12000 0x100>;
...@@ -33,6 +60,29 @@ rtc@10300 { ...@@ -33,6 +60,29 @@ rtc@10300 {
interrupts = <53>; interrupts = <53>;
}; };
spi@10600 {
compatible = "marvell,orion-spi";
#address-cells = <1>;
#size-cells = <0>;
cell-index = <0>;
interrupts = <23>;
reg = <0x10600 0x28>;
status = "disabled";
};
wdt@20300 {
compatible = "marvell,orion-wdt";
reg = <0x20300 0x28>;
status = "okay";
};
sata@80000 {
compatible = "marvell,orion-sata";
reg = <0x80000 0x5000>;
interrupts = <21>;
status = "disabled";
};
nand@3000000 { nand@3000000 {
#address-cells = <1>; #address-cells = <1>;
#size-cells = <1>; #size-cells = <1>;
...@@ -45,5 +95,15 @@ nand@3000000 { ...@@ -45,5 +95,15 @@ nand@3000000 {
/* set partition map and/or chip-delay in board dts */ /* set partition map and/or chip-delay in board dts */
status = "disabled"; status = "disabled";
}; };
i2c@11000 {
compatible = "marvell,mv64xxx-i2c";
reg = <0x11000 0x20>;
#address-cells = <1>;
#size-cells = <0>;
interrupts = <29>;
clock-frequency = <100000>;
status = "disabled";
};
}; };
}; };
...@@ -20,22 +20,6 @@ ...@@ -20,22 +20,6 @@
#include <mach/bridge-regs.h> #include <mach/bridge-regs.h>
#include "common.h" #include "common.h"
static void gpio_irq_handler(unsigned int irq, struct irq_desc *desc)
{
int irqoff;
BUG_ON(irq < IRQ_DOVE_GPIO_0_7 || irq > IRQ_DOVE_HIGH_GPIO);
irqoff = irq <= IRQ_DOVE_GPIO_16_23 ? irq - IRQ_DOVE_GPIO_0_7 :
3 + irq - IRQ_DOVE_GPIO_24_31;
orion_gpio_irq_handler(irqoff << 3);
if (irq == IRQ_DOVE_HIGH_GPIO) {
orion_gpio_irq_handler(40);
orion_gpio_irq_handler(48);
orion_gpio_irq_handler(56);
}
}
static void pmu_irq_mask(struct irq_data *d) static void pmu_irq_mask(struct irq_data *d)
{ {
int pin = irq_to_pmu(d->irq); int pin = irq_to_pmu(d->irq);
...@@ -90,6 +74,27 @@ static void pmu_irq_handler(unsigned int irq, struct irq_desc *desc) ...@@ -90,6 +74,27 @@ static void pmu_irq_handler(unsigned int irq, struct irq_desc *desc)
} }
} }
static int __initdata gpio0_irqs[4] = {
IRQ_DOVE_GPIO_0_7,
IRQ_DOVE_GPIO_8_15,
IRQ_DOVE_GPIO_16_23,
IRQ_DOVE_GPIO_24_31,
};
static int __initdata gpio1_irqs[4] = {
IRQ_DOVE_HIGH_GPIO,
0,
0,
0,
};
static int __initdata gpio2_irqs[4] = {
0,
0,
0,
0,
};
void __init dove_init_irq(void) void __init dove_init_irq(void)
{ {
int i; int i;
...@@ -100,19 +105,14 @@ void __init dove_init_irq(void) ...@@ -100,19 +105,14 @@ void __init dove_init_irq(void)
/* /*
* Initialize gpiolib for GPIOs 0-71. * Initialize gpiolib for GPIOs 0-71.
*/ */
orion_gpio_init(0, 32, DOVE_GPIO_LO_VIRT_BASE, 0, orion_gpio_init(NULL, 0, 32, (void __iomem *)DOVE_GPIO_LO_VIRT_BASE, 0,
IRQ_DOVE_GPIO_START); IRQ_DOVE_GPIO_START, gpio0_irqs);
irq_set_chained_handler(IRQ_DOVE_GPIO_0_7, gpio_irq_handler);
irq_set_chained_handler(IRQ_DOVE_GPIO_8_15, gpio_irq_handler); orion_gpio_init(NULL, 32, 32, (void __iomem *)DOVE_GPIO_HI_VIRT_BASE, 0,
irq_set_chained_handler(IRQ_DOVE_GPIO_16_23, gpio_irq_handler); IRQ_DOVE_GPIO_START + 32, gpio1_irqs);
irq_set_chained_handler(IRQ_DOVE_GPIO_24_31, gpio_irq_handler);
orion_gpio_init(NULL, 64, 8, (void __iomem *)DOVE_GPIO2_VIRT_BASE, 0,
orion_gpio_init(32, 32, DOVE_GPIO_HI_VIRT_BASE, 0, IRQ_DOVE_GPIO_START + 64, gpio2_irqs);
IRQ_DOVE_GPIO_START + 32);
irq_set_chained_handler(IRQ_DOVE_HIGH_GPIO, gpio_irq_handler);
orion_gpio_init(64, 8, DOVE_GPIO2_VIRT_BASE, 0,
IRQ_DOVE_GPIO_START + 64);
/* /*
* Mask and clear PMU interrupts * Mask and clear PMU interrupts
......
...@@ -80,6 +80,35 @@ config MACH_IB62X0_DT ...@@ -80,6 +80,35 @@ config MACH_IB62X0_DT
RaidSonic IB-NAS6210 & IB-NAS6220 devices, using RaidSonic IB-NAS6210 & IB-NAS6220 devices, using
Flattened Device Tree. Flattened Device Tree.
config MACH_TS219_DT
bool "Device Tree for QNAP TS-11X, TS-21X NAS"
select ARCH_KIRKWOOD_DT
select ARM_APPENDED_DTB
select ARM_ATAG_DTB_COMPAT
help
Say 'Y' here if you want your kernel to support the QNAP
TS-110, TS-119, TS-119P+, TS-210, TS-219, TS-219P and
TS-219P+ Turbo NAS devices using Fattened Device Tree.
There are two different Device Tree descriptions, depending
on if the device is based on an if the board uses the MV6281
or MV6282. If you have the wrong one, the buttons will not
work.
config MACH_GOFLEXNET_DT
bool "Seagate GoFlex Net (Flattened Device Tree)"
select ARCH_KIRKWOOD_DT
help
Say 'Y' here if you want your kernel to support the
Seagate GoFlex Net (Flattened Device Tree).
config MACH_LSXL_DT
bool "Buffalo Linkstation LS-XHL, LS-CHLv2 (Flattened Device Tree)"
select ARCH_KIRKWOOD_DT
help
Say 'Y' here if you want your kernel to support the
Buffalo Linkstation LS-XHL & LS-CHLv2 devices, using
Flattened Device Tree.
config MACH_TS219 config MACH_TS219
bool "QNAP TS-110, TS-119, TS-119P+, TS-210, TS-219, TS-219P and TS-219P+ Turbo NAS" bool "QNAP TS-110, TS-119, TS-119P+, TS-210, TS-219, TS-219P and TS-219P+ Turbo NAS"
help help
......
...@@ -25,3 +25,6 @@ obj-$(CONFIG_MACH_DREAMPLUG_DT) += board-dreamplug.o ...@@ -25,3 +25,6 @@ obj-$(CONFIG_MACH_DREAMPLUG_DT) += board-dreamplug.o
obj-$(CONFIG_MACH_ICONNECT_DT) += board-iconnect.o obj-$(CONFIG_MACH_ICONNECT_DT) += board-iconnect.o
obj-$(CONFIG_MACH_DLINK_KIRKWOOD_DT) += board-dnskw.o obj-$(CONFIG_MACH_DLINK_KIRKWOOD_DT) += board-dnskw.o
obj-$(CONFIG_MACH_IB62X0_DT) += board-ib62x0.o obj-$(CONFIG_MACH_IB62X0_DT) += board-ib62x0.o
obj-$(CONFIG_MACH_TS219_DT) += board-ts219.o tsx1x-common.o
obj-$(CONFIG_MACH_GOFLEXNET_DT) += board-goflexnet.o
obj-$(CONFIG_MACH_LSXL_DT) += board-lsxl.o
...@@ -7,3 +7,7 @@ dtb-$(CONFIG_MACH_DLINK_KIRKWOOD_DT) += kirkwood-dns320.dtb ...@@ -7,3 +7,7 @@ dtb-$(CONFIG_MACH_DLINK_KIRKWOOD_DT) += kirkwood-dns320.dtb
dtb-$(CONFIG_MACH_DLINK_KIRKWOOD_DT) += kirkwood-dns325.dtb dtb-$(CONFIG_MACH_DLINK_KIRKWOOD_DT) += kirkwood-dns325.dtb
dtb-$(CONFIG_MACH_ICONNECT_DT) += kirkwood-iconnect.dtb dtb-$(CONFIG_MACH_ICONNECT_DT) += kirkwood-iconnect.dtb
dtb-$(CONFIG_MACH_IB62X0_DT) += kirkwood-ib62x0.dtb dtb-$(CONFIG_MACH_IB62X0_DT) += kirkwood-ib62x0.dtb
dtb-$(CONFIG_MACH_TS219_DT) += kirkwood-qnap-ts219.dtb
dtb-$(CONFIG_MACH_GOFLEXNET_DT) += kirkwood-goflexnet.dtb
dbt-$(CONFIG_MACH_LSXL_DT) += kirkwood-lschlv2.dtb
dbt-$(CONFIG_MACH_LSXL_DT) += kirkwood-lsxhl.dtb
...@@ -14,13 +14,11 @@ ...@@ -14,13 +14,11 @@
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/platform_device.h> #include <linux/platform_device.h>
#include <linux/i2c.h>
#include <linux/ata_platform.h> #include <linux/ata_platform.h>
#include <linux/mv643xx_eth.h> #include <linux/mv643xx_eth.h>
#include <linux/of.h> #include <linux/of.h>
#include <linux/gpio.h> #include <linux/gpio.h>
#include <linux/input.h> #include <linux/input.h>
#include <linux/gpio_keys.h>
#include <linux/gpio-fan.h> #include <linux/gpio-fan.h>
#include <linux/leds.h> #include <linux/leds.h>
#include <asm/mach-types.h> #include <asm/mach-types.h>
...@@ -35,10 +33,6 @@ static struct mv643xx_eth_platform_data dnskw_ge00_data = { ...@@ -35,10 +33,6 @@ static struct mv643xx_eth_platform_data dnskw_ge00_data = {
.phy_addr = MV643XX_ETH_PHY_ADDR(8), .phy_addr = MV643XX_ETH_PHY_ADDR(8),
}; };
static struct mv_sata_platform_data dnskw_sata_data = {
.n_ports = 2,
};
static unsigned int dnskw_mpp_config[] __initdata = { static unsigned int dnskw_mpp_config[] __initdata = {
MPP13_UART1_TXD, /* Custom ... */ MPP13_UART1_TXD, /* Custom ... */
MPP14_UART1_RXD, /* ... Controller (DNS-320 only) */ MPP14_UART1_RXD, /* ... Controller (DNS-320 only) */
...@@ -73,132 +67,6 @@ static unsigned int dnskw_mpp_config[] __initdata = { ...@@ -73,132 +67,6 @@ static unsigned int dnskw_mpp_config[] __initdata = {
0 0
}; };
static struct gpio_led dns325_led_pins[] = {
{
.name = "dns325:white:power",
.gpio = 26,
.active_low = 1,
.default_trigger = "default-on",
},
{
.name = "dns325:white:usb",
.gpio = 43,
.active_low = 1,
},
{
.name = "dns325:red:l_hdd",
.gpio = 28,
.active_low = 1,
},
{
.name = "dns325:red:r_hdd",
.gpio = 27,
.active_low = 1,
},
{
.name = "dns325:red:usb",
.gpio = 29,
.active_low = 1,
},
};
static struct gpio_led_platform_data dns325_led_data = {
.num_leds = ARRAY_SIZE(dns325_led_pins),
.leds = dns325_led_pins,
};
static struct platform_device dns325_led_device = {
.name = "leds-gpio",
.id = -1,
.dev = {
.platform_data = &dns325_led_data,
},
};
static struct gpio_led dns320_led_pins[] = {
{
.name = "dns320:blue:power",
.gpio = 26,
.active_low = 1,
.default_trigger = "default-on",
},
{
.name = "dns320:blue:usb",
.gpio = 43,
.active_low = 1,
},
{
.name = "dns320:orange:l_hdd",
.gpio = 28,
.active_low = 1,
},
{
.name = "dns320:orange:r_hdd",
.gpio = 27,
.active_low = 1,
},
{
.name = "dns320:orange:usb",
.gpio = 35,
.active_low = 1,
},
};
static struct gpio_led_platform_data dns320_led_data = {
.num_leds = ARRAY_SIZE(dns320_led_pins),
.leds = dns320_led_pins,
};
static struct platform_device dns320_led_device = {
.name = "leds-gpio",
.id = -1,
.dev = {
.platform_data = &dns320_led_data,
},
};
static struct i2c_board_info dns325_i2c_board_info[] __initdata = {
{
I2C_BOARD_INFO("lm75", 0x48),
},
/* Something at 0x0c also */
};
static struct gpio_keys_button dnskw_button_pins[] = {
{
.code = KEY_POWER,
.gpio = 34,
.desc = "Power button",
.active_low = 1,
},
{
.code = KEY_EJECTCD,
.gpio = 47,
.desc = "USB unmount button",
.active_low = 1,
},
{
.code = KEY_RESTART,
.gpio = 48,
.desc = "Reset button",
.active_low = 1,
},
};
static struct gpio_keys_platform_data dnskw_button_data = {
.buttons = dnskw_button_pins,
.nbuttons = ARRAY_SIZE(dnskw_button_pins),
};
static struct platform_device dnskw_button_device = {
.name = "gpio-keys",
.id = -1,
.num_resources = 0,
.dev = {
.platform_data = &dnskw_button_data,
}
};
/* Fan: ADDA AD045HB-G73 40mm 6000rpm@5v */ /* Fan: ADDA AD045HB-G73 40mm 6000rpm@5v */
static struct gpio_fan_speed dnskw_fan_speed[] = { static struct gpio_fan_speed dnskw_fan_speed[] = {
{ 0, 0 }, { 0, 0 },
...@@ -245,20 +113,9 @@ void __init dnskw_init(void) ...@@ -245,20 +113,9 @@ void __init dnskw_init(void)
kirkwood_ehci_init(); kirkwood_ehci_init();
kirkwood_ge00_init(&dnskw_ge00_data); kirkwood_ge00_init(&dnskw_ge00_data);
kirkwood_sata_init(&dnskw_sata_data);
kirkwood_i2c_init();
platform_device_register(&dnskw_button_device);
platform_device_register(&dnskw_fan_device); platform_device_register(&dnskw_fan_device);
if (of_machine_is_compatible("dlink,dns-325")) {
i2c_register_board_info(0, dns325_i2c_board_info,
ARRAY_SIZE(dns325_i2c_board_info));
platform_device_register(&dns325_led_device);
} else if (of_machine_is_compatible("dlink,dns-320"))
platform_device_register(&dns320_led_device);
/* Register power-off GPIO. */ /* Register power-off GPIO. */
if (gpio_request(36, "dnskw:power:off") == 0 if (gpio_request(36, "dnskw:power:off") == 0
&& gpio_direction_output(36, 0) == 0) && gpio_direction_output(36, 0) == 0)
......
...@@ -14,7 +14,6 @@ ...@@ -14,7 +14,6 @@
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/platform_device.h> #include <linux/platform_device.h>
#include <linux/mtd/partitions.h>
#include <linux/ata_platform.h> #include <linux/ata_platform.h>
#include <linux/mv643xx_eth.h> #include <linux/mv643xx_eth.h>
#include <linux/of.h> #include <linux/of.h>
...@@ -23,7 +22,6 @@ ...@@ -23,7 +22,6 @@
#include <linux/of_irq.h> #include <linux/of_irq.h>
#include <linux/of_platform.h> #include <linux/of_platform.h>
#include <linux/gpio.h> #include <linux/gpio.h>
#include <linux/leds.h>
#include <linux/mtd/physmap.h> #include <linux/mtd/physmap.h>
#include <linux/spi/flash.h> #include <linux/spi/flash.h>
#include <linux/spi/spi.h> #include <linux/spi/spi.h>
...@@ -36,42 +34,6 @@ ...@@ -36,42 +34,6 @@
#include "common.h" #include "common.h"
#include "mpp.h" #include "mpp.h"
struct mtd_partition dreamplug_partitions[] = {
{
.name = "u-boot",
.size = SZ_512K,
.offset = 0,
},
{
.name = "u-boot env",
.size = SZ_64K,
.offset = SZ_512K + SZ_512K,
},
{
.name = "dtb",
.size = SZ_64K,
.offset = SZ_512K + SZ_512K + SZ_512K,
},
};
static const struct flash_platform_data dreamplug_spi_slave_data = {
.type = "mx25l1606e",
.name = "spi_flash",
.parts = dreamplug_partitions,
.nr_parts = ARRAY_SIZE(dreamplug_partitions),
};
static struct spi_board_info __initdata dreamplug_spi_slave_info[] = {
{
.modalias = "m25p80",
.platform_data = &dreamplug_spi_slave_data,
.irq = -1,
.max_speed_hz = 50000000,
.bus_num = 0,
.chip_select = 0,
},
};
static struct mv643xx_eth_platform_data dreamplug_ge00_data = { static struct mv643xx_eth_platform_data dreamplug_ge00_data = {
.phy_addr = MV643XX_ETH_PHY_ADDR(0), .phy_addr = MV643XX_ETH_PHY_ADDR(0),
}; };
...@@ -80,45 +42,10 @@ static struct mv643xx_eth_platform_data dreamplug_ge01_data = { ...@@ -80,45 +42,10 @@ static struct mv643xx_eth_platform_data dreamplug_ge01_data = {
.phy_addr = MV643XX_ETH_PHY_ADDR(1), .phy_addr = MV643XX_ETH_PHY_ADDR(1),
}; };
static struct mv_sata_platform_data dreamplug_sata_data = {
.n_ports = 1,
};
static struct mvsdio_platform_data dreamplug_mvsdio_data = { static struct mvsdio_platform_data dreamplug_mvsdio_data = {
/* unfortunately the CD signal has not been connected */ /* unfortunately the CD signal has not been connected */
}; };
static struct gpio_led dreamplug_led_pins[] = {
{
.name = "dreamplug:blue:bluetooth",
.gpio = 47,
.active_low = 1,
},
{
.name = "dreamplug:green:wifi",
.gpio = 48,
.active_low = 1,
},
{
.name = "dreamplug:green:wifi_ap",
.gpio = 49,
.active_low = 1,
},
};
static struct gpio_led_platform_data dreamplug_led_data = {
.leds = dreamplug_led_pins,
.num_leds = ARRAY_SIZE(dreamplug_led_pins),
};
static struct platform_device dreamplug_leds = {
.name = "leds-gpio",
.id = -1,
.dev = {
.platform_data = &dreamplug_led_data,
}
};
static unsigned int dreamplug_mpp_config[] __initdata = { static unsigned int dreamplug_mpp_config[] __initdata = {
MPP0_SPI_SCn, MPP0_SPI_SCn,
MPP1_SPI_MOSI, MPP1_SPI_MOSI,
...@@ -137,15 +64,8 @@ void __init dreamplug_init(void) ...@@ -137,15 +64,8 @@ void __init dreamplug_init(void)
*/ */
kirkwood_mpp_conf(dreamplug_mpp_config); kirkwood_mpp_conf(dreamplug_mpp_config);
spi_register_board_info(dreamplug_spi_slave_info,
ARRAY_SIZE(dreamplug_spi_slave_info));
kirkwood_spi_init();
kirkwood_ehci_init(); kirkwood_ehci_init();
kirkwood_ge00_init(&dreamplug_ge00_data); kirkwood_ge00_init(&dreamplug_ge00_data);
kirkwood_ge01_init(&dreamplug_ge01_data); kirkwood_ge01_init(&dreamplug_ge01_data);
kirkwood_sata_init(&dreamplug_sata_data);
kirkwood_sdio_init(&dreamplug_mvsdio_data); kirkwood_sdio_init(&dreamplug_mvsdio_data);
platform_device_register(&dreamplug_leds);
} }
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
#include <asm/mach/arch.h> #include <asm/mach/arch.h>
#include <asm/mach/map.h> #include <asm/mach/map.h>
#include <mach/bridge-regs.h> #include <mach/bridge-regs.h>
#include <plat/irq.h>
#include "common.h" #include "common.h"
static struct of_device_id kirkwood_dt_match_table[] __initdata = { static struct of_device_id kirkwood_dt_match_table[] __initdata = {
...@@ -25,6 +26,16 @@ static struct of_device_id kirkwood_dt_match_table[] __initdata = { ...@@ -25,6 +26,16 @@ static struct of_device_id kirkwood_dt_match_table[] __initdata = {
{ } { }
}; };
struct of_dev_auxdata kirkwood_auxdata_lookup[] __initdata = {
OF_DEV_AUXDATA("marvell,orion-spi", 0xf1010600, "orion_spi.0", NULL),
OF_DEV_AUXDATA("marvell,mv64xxx-i2c", 0xf1011000, "mv64xxx_i2c.0",
NULL),
OF_DEV_AUXDATA("marvell,orion-wdt", 0xf1020300, "orion_wdt", NULL),
OF_DEV_AUXDATA("marvell,orion-sata", 0xf1080000, "sata_mv.0", NULL),
OF_DEV_AUXDATA("marvell,orion-nand", 0xf4000000, "orion_nand", NULL),
{},
};
static void __init kirkwood_dt_init(void) static void __init kirkwood_dt_init(void)
{ {
pr_info("Kirkwood: %s, TCLK=%d.\n", kirkwood_id(), kirkwood_tclk); pr_info("Kirkwood: %s, TCLK=%d.\n", kirkwood_id(), kirkwood_tclk);
...@@ -47,7 +58,6 @@ static void __init kirkwood_dt_init(void) ...@@ -47,7 +58,6 @@ static void __init kirkwood_dt_init(void)
kirkwood_clk_init(); kirkwood_clk_init();
/* internal devices that every board has */ /* internal devices that every board has */
kirkwood_wdt_init();
kirkwood_xor0_init(); kirkwood_xor0_init();
kirkwood_xor1_init(); kirkwood_xor1_init();
kirkwood_crypto_init(); kirkwood_crypto_init();
...@@ -68,7 +78,17 @@ static void __init kirkwood_dt_init(void) ...@@ -68,7 +78,17 @@ static void __init kirkwood_dt_init(void)
if (of_machine_is_compatible("raidsonic,ib-nas62x0")) if (of_machine_is_compatible("raidsonic,ib-nas62x0"))
ib62x0_init(); ib62x0_init();
of_platform_populate(NULL, kirkwood_dt_match_table, NULL, NULL); if (of_machine_is_compatible("qnap,ts219"))
qnap_dt_ts219_init();
if (of_machine_is_compatible("seagate,goflexnet"))
goflexnet_init();
if (of_machine_is_compatible("buffalo,lsxl"))
lsxl_init();
of_platform_populate(NULL, kirkwood_dt_match_table,
kirkwood_auxdata_lookup, NULL);
} }
static const char *kirkwood_dt_board_compat[] = { static const char *kirkwood_dt_board_compat[] = {
...@@ -77,6 +97,9 @@ static const char *kirkwood_dt_board_compat[] = { ...@@ -77,6 +97,9 @@ static const char *kirkwood_dt_board_compat[] = {
"dlink,dns-325", "dlink,dns-325",
"iom,iconnect", "iom,iconnect",
"raidsonic,ib-nas62x0", "raidsonic,ib-nas62x0",
"qnap,ts219",
"seagate,goflexnet",
"buffalo,lsxl",
NULL NULL
}; };
...@@ -84,7 +107,7 @@ DT_MACHINE_START(KIRKWOOD_DT, "Marvell Kirkwood (Flattened Device Tree)") ...@@ -84,7 +107,7 @@ DT_MACHINE_START(KIRKWOOD_DT, "Marvell Kirkwood (Flattened Device Tree)")
/* Maintainer: Jason Cooper <jason@lakedaemon.net> */ /* Maintainer: Jason Cooper <jason@lakedaemon.net> */
.map_io = kirkwood_map_io, .map_io = kirkwood_map_io,
.init_early = kirkwood_init_early, .init_early = kirkwood_init_early,
.init_irq = kirkwood_init_irq, .init_irq = orion_dt_init_irq,
.timer = &kirkwood_timer, .timer = &kirkwood_timer,
.init_machine = kirkwood_dt_init, .init_machine = kirkwood_dt_init,
.restart = kirkwood_restart, .restart = kirkwood_restart,
......
/*
* Copyright 2012 (C), Jason Cooper <jason@lakedaemon.net>
*
* arch/arm/mach-kirkwood/board-goflexnet.c
*
* Seagate GoFlext Net Board Init for drivers not converted to
* flattened device tree yet.
*
* This file is licensed under the terms of the GNU General Public
* License version 2. This program is licensed "as is" without any
* warranty of any kind, whether express or implied.
*
* Copied and modified for Seagate GoFlex Net support by
* Joshua Coombs <josh.coombs@gmail.com> based on ArchLinux ARM's
* GoFlex kernel patches.
*
*/
#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/platform_device.h>
#include <linux/ata_platform.h>
#include <linux/mv643xx_eth.h>
#include <linux/of.h>
#include <linux/of_address.h>
#include <linux/of_fdt.h>
#include <linux/of_irq.h>
#include <linux/of_platform.h>
#include <linux/gpio.h>
#include <asm/mach-types.h>
#include <asm/mach/arch.h>
#include <asm/mach/map.h>
#include <mach/kirkwood.h>
#include <mach/bridge-regs.h>
#include <plat/mvsdio.h>
#include "common.h"
#include "mpp.h"
static struct mv643xx_eth_platform_data goflexnet_ge00_data = {
.phy_addr = MV643XX_ETH_PHY_ADDR(0),
};
static unsigned int goflexnet_mpp_config[] __initdata = {
MPP29_GPIO, /* USB Power Enable */
MPP47_GPIO, /* LED Orange */
MPP46_GPIO, /* LED Green */
MPP45_GPIO, /* LED Left Capacity 3 */
MPP44_GPIO, /* LED Left Capacity 2 */
MPP43_GPIO, /* LED Left Capacity 1 */
MPP42_GPIO, /* LED Left Capacity 0 */
MPP41_GPIO, /* LED Right Capacity 3 */
MPP40_GPIO, /* LED Right Capacity 2 */
MPP39_GPIO, /* LED Right Capacity 1 */
MPP38_GPIO, /* LED Right Capacity 0 */
0
};
void __init goflexnet_init(void)
{
/*
* Basic setup. Needs to be called early.
*/
kirkwood_mpp_conf(goflexnet_mpp_config);
if (gpio_request(29, "USB Power Enable") != 0 ||
gpio_direction_output(29, 1) != 0)
pr_err("can't setup GPIO 29 (USB Power Enable)\n");
kirkwood_ehci_init();
kirkwood_ge00_init(&goflexnet_ge00_data);
}
...@@ -18,9 +18,7 @@ ...@@ -18,9 +18,7 @@
#include <linux/ata_platform.h> #include <linux/ata_platform.h>
#include <linux/mv643xx_eth.h> #include <linux/mv643xx_eth.h>
#include <linux/gpio.h> #include <linux/gpio.h>
#include <linux/gpio_keys.h>
#include <linux/input.h> #include <linux/input.h>
#include <linux/leds.h>
#include <asm/mach-types.h> #include <asm/mach-types.h>
#include <asm/mach/arch.h> #include <asm/mach/arch.h>
#include <mach/kirkwood.h> #include <mach/kirkwood.h>
...@@ -33,10 +31,6 @@ static struct mv643xx_eth_platform_data ib62x0_ge00_data = { ...@@ -33,10 +31,6 @@ static struct mv643xx_eth_platform_data ib62x0_ge00_data = {
.phy_addr = MV643XX_ETH_PHY_ADDR(8), .phy_addr = MV643XX_ETH_PHY_ADDR(8),
}; };
static struct mv_sata_platform_data ib62x0_sata_data = {
.n_ports = 2,
};
static unsigned int ib62x0_mpp_config[] __initdata = { static unsigned int ib62x0_mpp_config[] __initdata = {
MPP0_NF_IO2, MPP0_NF_IO2,
MPP1_NF_IO3, MPP1_NF_IO3,
...@@ -55,69 +49,6 @@ static unsigned int ib62x0_mpp_config[] __initdata = { ...@@ -55,69 +49,6 @@ static unsigned int ib62x0_mpp_config[] __initdata = {
0 0
}; };
static struct gpio_led ib62x0_led_pins[] = {
{
.name = "ib62x0:green:os",
.default_trigger = "default-on",
.gpio = 25,
.active_low = 0,
},
{
.name = "ib62x0:red:os",
.default_trigger = "none",
.gpio = 22,
.active_low = 0,
},
{
.name = "ib62x0:red:usb_copy",
.default_trigger = "none",
.gpio = 27,
.active_low = 0,
},
};
static struct gpio_led_platform_data ib62x0_led_data = {
.leds = ib62x0_led_pins,
.num_leds = ARRAY_SIZE(ib62x0_led_pins),
};
static struct platform_device ib62x0_led_device = {
.name = "leds-gpio",
.id = -1,
.dev = {
.platform_data = &ib62x0_led_data,
}
};
static struct gpio_keys_button ib62x0_button_pins[] = {
{
.code = KEY_COPY,
.gpio = 29,
.desc = "USB Copy",
.active_low = 1,
},
{
.code = KEY_RESTART,
.gpio = 28,
.desc = "Reset",
.active_low = 1,
},
};
static struct gpio_keys_platform_data ib62x0_button_data = {
.buttons = ib62x0_button_pins,
.nbuttons = ARRAY_SIZE(ib62x0_button_pins),
};
static struct platform_device ib62x0_button_device = {
.name = "gpio-keys",
.id = -1,
.num_resources = 0,
.dev = {
.platform_data = &ib62x0_button_data,
}
};
static void ib62x0_power_off(void) static void ib62x0_power_off(void)
{ {
gpio_set_value(IB62X0_GPIO_POWER_OFF, 1); gpio_set_value(IB62X0_GPIO_POWER_OFF, 1);
...@@ -132,9 +63,6 @@ void __init ib62x0_init(void) ...@@ -132,9 +63,6 @@ void __init ib62x0_init(void)
kirkwood_ehci_init(); kirkwood_ehci_init();
kirkwood_ge00_init(&ib62x0_ge00_data); kirkwood_ge00_init(&ib62x0_ge00_data);
kirkwood_sata_init(&ib62x0_sata_data);
platform_device_register(&ib62x0_led_device);
platform_device_register(&ib62x0_button_device);
if (gpio_request(IB62X0_GPIO_POWER_OFF, "ib62x0:power:off") == 0 && if (gpio_request(IB62X0_GPIO_POWER_OFF, "ib62x0:power:off") == 0 &&
gpio_direction_output(IB62X0_GPIO_POWER_OFF, 0) == 0) gpio_direction_output(IB62X0_GPIO_POWER_OFF, 0) == 0)
pm_power_off = ib62x0_power_off; pm_power_off = ib62x0_power_off;
......
...@@ -19,8 +19,6 @@ ...@@ -19,8 +19,6 @@
#include <linux/mtd/partitions.h> #include <linux/mtd/partitions.h>
#include <linux/mv643xx_eth.h> #include <linux/mv643xx_eth.h>
#include <linux/gpio.h> #include <linux/gpio.h>
#include <linux/leds.h>
#include <linux/i2c.h>
#include <linux/input.h> #include <linux/input.h>
#include <linux/gpio_keys.h> #include <linux/gpio_keys.h>
#include <asm/mach/arch.h> #include <asm/mach/arch.h>
...@@ -32,50 +30,6 @@ static struct mv643xx_eth_platform_data iconnect_ge00_data = { ...@@ -32,50 +30,6 @@ static struct mv643xx_eth_platform_data iconnect_ge00_data = {
.phy_addr = MV643XX_ETH_PHY_ADDR(11), .phy_addr = MV643XX_ETH_PHY_ADDR(11),
}; };
static struct gpio_led iconnect_led_pins[] = {
{
.name = "led_level",
.gpio = 41,
.default_trigger = "default-on",
}, {
.name = "power:blue",
.gpio = 42,
.default_trigger = "timer",
}, {
.name = "power:red",
.gpio = 43,
}, {
.name = "usb1:blue",
.gpio = 44,
}, {
.name = "usb2:blue",
.gpio = 45,
}, {
.name = "usb3:blue",
.gpio = 46,
}, {
.name = "usb4:blue",
.gpio = 47,
}, {
.name = "otb:blue",
.gpio = 48,
},
};
static struct gpio_led_platform_data iconnect_led_data = {
.leds = iconnect_led_pins,
.num_leds = ARRAY_SIZE(iconnect_led_pins),
.gpio_blink_set = orion_gpio_led_blink_set,
};
static struct platform_device iconnect_leds = {
.name = "leds-gpio",
.id = -1,
.dev = {
.platform_data = &iconnect_led_data,
}
};
static unsigned int iconnect_mpp_config[] __initdata = { static unsigned int iconnect_mpp_config[] __initdata = {
MPP12_GPIO, MPP12_GPIO,
MPP35_GPIO, MPP35_GPIO,
...@@ -90,12 +44,6 @@ static unsigned int iconnect_mpp_config[] __initdata = { ...@@ -90,12 +44,6 @@ static unsigned int iconnect_mpp_config[] __initdata = {
0 0
}; };
static struct i2c_board_info __initdata iconnect_board_info[] = {
{
I2C_BOARD_INFO("lm63", 0x4c),
},
};
static struct mtd_partition iconnect_nand_parts[] = { static struct mtd_partition iconnect_nand_parts[] = {
{ {
.name = "flash", .name = "flash",
...@@ -142,15 +90,11 @@ void __init iconnect_init(void) ...@@ -142,15 +90,11 @@ void __init iconnect_init(void)
{ {
kirkwood_mpp_conf(iconnect_mpp_config); kirkwood_mpp_conf(iconnect_mpp_config);
kirkwood_nand_init(ARRAY_AND_SIZE(iconnect_nand_parts), 25); kirkwood_nand_init(ARRAY_AND_SIZE(iconnect_nand_parts), 25);
kirkwood_i2c_init();
i2c_register_board_info(0, iconnect_board_info,
ARRAY_SIZE(iconnect_board_info));
kirkwood_ehci_init(); kirkwood_ehci_init();
kirkwood_ge00_init(&iconnect_ge00_data); kirkwood_ge00_init(&iconnect_ge00_data);
platform_device_register(&iconnect_button_device); platform_device_register(&iconnect_button_device);
platform_device_register(&iconnect_leds);
} }
static int __init iconnect_pci_init(void) static int __init iconnect_pci_init(void)
......
/*
* Copyright 2012 (C), Michael Walle <michael@walle.cc>
*
* arch/arm/mach-kirkwood/board-lsxl.c
*
* Buffalo Linkstation LS-XHL and LS-CHLv2 init for drivers not
* converted to flattened device tree yet.
*
* This file is licensed under the terms of the GNU General Public
* License version 2. This program is licensed "as is" without any
* warranty of any kind, whether express or implied.
*/
#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/platform_device.h>
#include <linux/mtd/partitions.h>
#include <linux/ata_platform.h>
#include <linux/spi/flash.h>
#include <linux/spi/spi.h>
#include <linux/mv643xx_eth.h>
#include <linux/gpio.h>
#include <linux/gpio-fan.h>
#include <linux/input.h>
#include <asm/mach-types.h>
#include <asm/mach/arch.h>
#include <mach/kirkwood.h>
#include "common.h"
#include "mpp.h"
static struct mv643xx_eth_platform_data lsxl_ge00_data = {
.phy_addr = MV643XX_ETH_PHY_ADDR(0),
};
static struct mv643xx_eth_platform_data lsxl_ge01_data = {
.phy_addr = MV643XX_ETH_PHY_ADDR(8),
};
static unsigned int lsxl_mpp_config[] __initdata = {
MPP10_GPO, /* HDD Power Enable */
MPP11_GPIO, /* USB Vbus Enable */
MPP18_GPO, /* FAN High Enable# */
MPP19_GPO, /* FAN Low Enable# */
MPP36_GPIO, /* Function Blue LED */
MPP37_GPIO, /* Alarm LED */
MPP38_GPIO, /* Info LED */
MPP39_GPIO, /* Power LED */
MPP40_GPIO, /* Fan Lock */
MPP41_GPIO, /* Function Button */
MPP42_GPIO, /* Power Switch */
MPP43_GPIO, /* Power Auto Switch */
MPP48_GPIO, /* Function Red LED */
0
};
#define LSXL_GPIO_FAN_HIGH 18
#define LSXL_GPIO_FAN_LOW 19
#define LSXL_GPIO_FAN_LOCK 40
static struct gpio_fan_alarm lsxl_alarm = {
.gpio = LSXL_GPIO_FAN_LOCK,
};
static struct gpio_fan_speed lsxl_speeds[] = {
{
.rpm = 0,
.ctrl_val = 3,
}, {
.rpm = 1500,
.ctrl_val = 1,
}, {
.rpm = 3250,
.ctrl_val = 2,
}, {
.rpm = 5000,
.ctrl_val = 0,
}
};
static int lsxl_gpio_list[] = {
LSXL_GPIO_FAN_HIGH, LSXL_GPIO_FAN_LOW,
};
static struct gpio_fan_platform_data lsxl_fan_data = {
.num_ctrl = ARRAY_SIZE(lsxl_gpio_list),
.ctrl = lsxl_gpio_list,
.alarm = &lsxl_alarm,
.num_speed = ARRAY_SIZE(lsxl_speeds),
.speed = lsxl_speeds,
};
static struct platform_device lsxl_fan_device = {
.name = "gpio-fan",
.id = -1,
.num_resources = 0,
.dev = {
.platform_data = &lsxl_fan_data,
},
};
/*
* On the LS-XHL/LS-CHLv2, the shutdown process is following:
* - Userland monitors key events until the power switch goes to off position
* - The board reboots
* - U-boot starts and goes into an idle mode waiting for the user
* to move the switch to ON position
*
*/
static void lsxl_power_off(void)
{
kirkwood_restart('h', NULL);
}
#define LSXL_GPIO_HDD_POWER 10
#define LSXL_GPIO_USB_POWER 11
void __init lsxl_init(void)
{
/*
* Basic setup. Needs to be called early.
*/
kirkwood_mpp_conf(lsxl_mpp_config);
/* usb and sata power on */
gpio_set_value(LSXL_GPIO_USB_POWER, 1);
gpio_set_value(LSXL_GPIO_HDD_POWER, 1);
kirkwood_ehci_init();
kirkwood_ge00_init(&lsxl_ge00_data);
kirkwood_ge01_init(&lsxl_ge01_data);
platform_device_register(&lsxl_fan_device);
/* register power-off method */
pm_power_off = lsxl_power_off;
}
/*
*
* QNAP TS-11x/TS-21x Turbo NAS Board Setup via DT
*
* Copyright (C) 2012 Andrew Lunn <andrew@lunn.ch>
*
* Based on the board file ts219-setup.c:
*
* Copyright (C) 2009 Martin Michlmayr <tbm@cyrius.com>
* Copyright (C) 2008 Byron Bradley <byron.bbradley@gmail.com>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version
* 2 of the License, or (at your option) any later version.
*/
#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/platform_device.h>
#include <linux/mv643xx_eth.h>
#include <linux/ata_platform.h>
#include <linux/gpio_keys.h>
#include <linux/input.h>
#include <asm/mach-types.h>
#include <asm/mach/arch.h>
#include <mach/kirkwood.h>
#include "common.h"
#include "mpp.h"
#include "tsx1x-common.h"
static struct mv643xx_eth_platform_data qnap_ts219_ge00_data = {
.phy_addr = MV643XX_ETH_PHY_ADDR(8),
};
static unsigned int qnap_ts219_mpp_config[] __initdata = {
MPP0_SPI_SCn,
MPP1_SPI_MOSI,
MPP2_SPI_SCK,
MPP3_SPI_MISO,
MPP4_SATA1_ACTn,
MPP5_SATA0_ACTn,
MPP8_TW0_SDA,
MPP9_TW0_SCK,
MPP10_UART0_TXD,
MPP11_UART0_RXD,
MPP13_UART1_TXD, /* PIC controller */
MPP14_UART1_RXD, /* PIC controller */
MPP15_GPIO, /* USB Copy button (on devices with 88F6281) */
MPP16_GPIO, /* Reset button (on devices with 88F6281) */
MPP36_GPIO, /* RAM: 0: 256 MB, 1: 512 MB */
MPP37_GPIO, /* Reset button (on devices with 88F6282) */
MPP43_GPIO, /* USB Copy button (on devices with 88F6282) */
MPP44_GPIO, /* Board ID: 0: TS-11x, 1: TS-21x */
0
};
void __init qnap_dt_ts219_init(void)
{
u32 dev, rev;
kirkwood_mpp_conf(qnap_ts219_mpp_config);
kirkwood_pcie_id(&dev, &rev);
if (dev == MV88F6282_DEV_ID)
qnap_ts219_ge00_data.phy_addr = MV643XX_ETH_PHY_ADDR(0);
kirkwood_ge00_init(&qnap_ts219_ge00_data);
kirkwood_ehci_init();
pm_power_off = qnap_tsx1x_power_off;
}
/* FIXME: Will not work with DT. Maybe use MPP40_GPIO? */
static int __init ts219_pci_init(void)
{
if (machine_is_ts219())
kirkwood_pcie_init(KW_PCIE0);
return 0;
}
subsys_initcall(ts219_pci_init);
...@@ -17,6 +17,7 @@ ...@@ -17,6 +17,7 @@
#include <linux/dma-mapping.h> #include <linux/dma-mapping.h>
#include <linux/clk-provider.h> #include <linux/clk-provider.h>
#include <linux/spinlock.h> #include <linux/spinlock.h>
#include <linux/mv643xx_i2c.h>
#include <net/dsa.h> #include <net/dsa.h>
#include <asm/page.h> #include <asm/page.h>
#include <asm/timex.h> #include <asm/timex.h>
...@@ -276,6 +277,7 @@ void __init kirkwood_clk_init(void) ...@@ -276,6 +277,7 @@ void __init kirkwood_clk_init(void)
orion_clkdev_add("0", "pcie", pex0); orion_clkdev_add("0", "pcie", pex0);
orion_clkdev_add("1", "pcie", pex1); orion_clkdev_add("1", "pcie", pex1);
orion_clkdev_add(NULL, "kirkwood-i2s", audio); orion_clkdev_add(NULL, "kirkwood-i2s", audio);
orion_clkdev_add(NULL, MV64XXX_I2C_CTLR_NAME ".0", runit);
/* Marvell says runit is used by SPI, UART, NAND, TWSI, ..., /* Marvell says runit is used by SPI, UART, NAND, TWSI, ...,
* so should never be gated. * so should never be gated.
......
...@@ -58,6 +58,11 @@ void dreamplug_init(void); ...@@ -58,6 +58,11 @@ void dreamplug_init(void);
#else #else
static inline void dreamplug_init(void) {}; static inline void dreamplug_init(void) {};
#endif #endif
#ifdef CONFIG_MACH_TS219_DT
void qnap_dt_ts219_init(void);
#else
static inline void qnap_dt_ts219_init(void) {};
#endif
#ifdef CONFIG_MACH_DLINK_KIRKWOOD_DT #ifdef CONFIG_MACH_DLINK_KIRKWOOD_DT
void dnskw_init(void); void dnskw_init(void);
...@@ -77,6 +82,18 @@ void ib62x0_init(void); ...@@ -77,6 +82,18 @@ void ib62x0_init(void);
static inline void ib62x0_init(void) {}; static inline void ib62x0_init(void) {};
#endif #endif
#ifdef CONFIG_MACH_GOFLEXNET_DT
void goflexnet_init(void);
#else
static inline void goflexnet_init(void) {};
#endif
#ifdef CONFIG_MACH_LSXL_DT
void lsxl_init(void);
#else
static inline void lsxl_init(void) {};
#endif
/* early init functions not converted to fdt yet */ /* early init functions not converted to fdt yet */
char *kirkwood_id(void); char *kirkwood_id(void);
void kirkwood_l2_init(void); void kirkwood_l2_init(void);
......
...@@ -9,20 +9,23 @@ ...@@ -9,20 +9,23 @@
*/ */
#include <linux/gpio.h> #include <linux/gpio.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/init.h>
#include <linux/irq.h> #include <linux/irq.h>
#include <linux/io.h>
#include <mach/bridge-regs.h> #include <mach/bridge-regs.h>
#include <plat/irq.h> #include <plat/irq.h>
#include "common.h"
static void gpio_irq_handler(unsigned int irq, struct irq_desc *desc) static int __initdata gpio0_irqs[4] = {
{ IRQ_KIRKWOOD_GPIO_LOW_0_7,
BUG_ON(irq < IRQ_KIRKWOOD_GPIO_LOW_0_7); IRQ_KIRKWOOD_GPIO_LOW_8_15,
BUG_ON(irq > IRQ_KIRKWOOD_GPIO_HIGH_16_23); IRQ_KIRKWOOD_GPIO_LOW_16_23,
IRQ_KIRKWOOD_GPIO_LOW_24_31,
};
orion_gpio_irq_handler((irq - IRQ_KIRKWOOD_GPIO_LOW_0_7) << 3); static int __initdata gpio1_irqs[4] = {
} IRQ_KIRKWOOD_GPIO_HIGH_0_7,
IRQ_KIRKWOOD_GPIO_HIGH_8_15,
IRQ_KIRKWOOD_GPIO_HIGH_16_23,
0,
};
void __init kirkwood_init_irq(void) void __init kirkwood_init_irq(void)
{ {
...@@ -32,17 +35,8 @@ void __init kirkwood_init_irq(void) ...@@ -32,17 +35,8 @@ void __init kirkwood_init_irq(void)
/* /*
* Initialize gpiolib for GPIOs 0-49. * Initialize gpiolib for GPIOs 0-49.
*/ */
orion_gpio_init(0, 32, GPIO_LOW_VIRT_BASE, 0, orion_gpio_init(NULL, 0, 32, (void __iomem *)GPIO_LOW_VIRT_BASE, 0,
IRQ_KIRKWOOD_GPIO_START); IRQ_KIRKWOOD_GPIO_START, gpio0_irqs);
irq_set_chained_handler(IRQ_KIRKWOOD_GPIO_LOW_0_7, gpio_irq_handler); orion_gpio_init(NULL, 32, 18, (void __iomem *)GPIO_HIGH_VIRT_BASE, 0,
irq_set_chained_handler(IRQ_KIRKWOOD_GPIO_LOW_8_15, gpio_irq_handler); IRQ_KIRKWOOD_GPIO_START + 32, gpio1_irqs);
irq_set_chained_handler(IRQ_KIRKWOOD_GPIO_LOW_16_23, gpio_irq_handler);
irq_set_chained_handler(IRQ_KIRKWOOD_GPIO_LOW_24_31, gpio_irq_handler);
orion_gpio_init(32, 18, GPIO_HIGH_VIRT_BASE, 0,
IRQ_KIRKWOOD_GPIO_START + 32);
irq_set_chained_handler(IRQ_KIRKWOOD_GPIO_HIGH_0_7, gpio_irq_handler);
irq_set_chained_handler(IRQ_KIRKWOOD_GPIO_HIGH_8_15, gpio_irq_handler);
irq_set_chained_handler(IRQ_KIRKWOOD_GPIO_HIGH_16_23,
gpio_irq_handler);
} }
...@@ -9,19 +9,17 @@ ...@@ -9,19 +9,17 @@
*/ */
#include <linux/gpio.h> #include <linux/gpio.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/init.h>
#include <linux/pci.h>
#include <linux/irq.h> #include <linux/irq.h>
#include <mach/bridge-regs.h> #include <mach/bridge-regs.h>
#include <plat/irq.h> #include <plat/irq.h>
#include "common.h" #include "common.h"
static void gpio_irq_handler(unsigned int irq, struct irq_desc *desc) static int __initdata gpio0_irqs[4] = {
{ IRQ_MV78XX0_GPIO_0_7,
BUG_ON(irq < IRQ_MV78XX0_GPIO_0_7 || irq > IRQ_MV78XX0_GPIO_24_31); IRQ_MV78XX0_GPIO_8_15,
IRQ_MV78XX0_GPIO_16_23,
orion_gpio_irq_handler((irq - IRQ_MV78XX0_GPIO_0_7) << 3); IRQ_MV78XX0_GPIO_24_31,
} };
void __init mv78xx0_init_irq(void) void __init mv78xx0_init_irq(void)
{ {
...@@ -34,11 +32,7 @@ void __init mv78xx0_init_irq(void) ...@@ -34,11 +32,7 @@ void __init mv78xx0_init_irq(void)
* registers for core #1 are at an offset of 0x18 from those of * registers for core #1 are at an offset of 0x18 from those of
* core #0.) * core #0.)
*/ */
orion_gpio_init(0, 32, GPIO_VIRT_BASE, orion_gpio_init(NULL, 0, 32, (void __iomem *)GPIO_VIRT_BASE,
mv78xx0_core_index() ? 0x18 : 0, mv78xx0_core_index() ? 0x18 : 0,
IRQ_MV78XX0_GPIO_START); IRQ_MV78XX0_GPIO_START, gpio0_irqs);
irq_set_chained_handler(IRQ_MV78XX0_GPIO_0_7, gpio_irq_handler);
irq_set_chained_handler(IRQ_MV78XX0_GPIO_8_15, gpio_irq_handler);
irq_set_chained_handler(IRQ_MV78XX0_GPIO_16_23, gpio_irq_handler);
irq_set_chained_handler(IRQ_MV78XX0_GPIO_24_31, gpio_irq_handler);
} }
...@@ -11,19 +11,16 @@ ...@@ -11,19 +11,16 @@
*/ */
#include <linux/gpio.h> #include <linux/gpio.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/init.h>
#include <linux/irq.h> #include <linux/irq.h>
#include <linux/io.h>
#include <mach/bridge-regs.h> #include <mach/bridge-regs.h>
#include <plat/irq.h> #include <plat/irq.h>
#include "common.h"
static void gpio_irq_handler(unsigned int irq, struct irq_desc *desc) static int __initdata gpio0_irqs[4] = {
{ IRQ_ORION5X_GPIO_0_7,
BUG_ON(irq < IRQ_ORION5X_GPIO_0_7 || irq > IRQ_ORION5X_GPIO_24_31); IRQ_ORION5X_GPIO_8_15,
IRQ_ORION5X_GPIO_16_23,
orion_gpio_irq_handler((irq - IRQ_ORION5X_GPIO_0_7) << 3); IRQ_ORION5X_GPIO_24_31,
} };
void __init orion5x_init_irq(void) void __init orion5x_init_irq(void)
{ {
...@@ -32,9 +29,6 @@ void __init orion5x_init_irq(void) ...@@ -32,9 +29,6 @@ void __init orion5x_init_irq(void)
/* /*
* Initialize gpiolib for GPIOs 0-31. * Initialize gpiolib for GPIOs 0-31.
*/ */
orion_gpio_init(0, 32, GPIO_VIRT_BASE, 0, IRQ_ORION5X_GPIO_START); orion_gpio_init(NULL, 0, 32, (void __iomem *)GPIO_VIRT_BASE, 0,
irq_set_chained_handler(IRQ_ORION5X_GPIO_0_7, gpio_irq_handler); IRQ_ORION5X_GPIO_START, gpio0_irqs);
irq_set_chained_handler(IRQ_ORION5X_GPIO_8_15, gpio_irq_handler);
irq_set_chained_handler(IRQ_ORION5X_GPIO_16_23, gpio_irq_handler);
irq_set_chained_handler(IRQ_ORION5X_GPIO_24_31, gpio_irq_handler);
} }
...@@ -47,6 +47,7 @@ void __init orion_clkdev_init(struct clk *tclk) ...@@ -47,6 +47,7 @@ void __init orion_clkdev_init(struct clk *tclk)
orion_clkdev_add(NULL, MV643XX_ETH_NAME ".2", tclk); orion_clkdev_add(NULL, MV643XX_ETH_NAME ".2", tclk);
orion_clkdev_add(NULL, MV643XX_ETH_NAME ".3", tclk); orion_clkdev_add(NULL, MV643XX_ETH_NAME ".3", tclk);
orion_clkdev_add(NULL, "orion_wdt", tclk); orion_clkdev_add(NULL, "orion_wdt", tclk);
orion_clkdev_add(NULL, MV64XXX_I2C_CTLR_NAME ".0", tclk);
} }
/* Fill in the resources structure and link it into the platform /* Fill in the resources structure and link it into the platform
......
...@@ -8,15 +8,22 @@ ...@@ -8,15 +8,22 @@
* warranty of any kind, whether express or implied. * warranty of any kind, whether express or implied.
*/ */
#define DEBUG
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/irq.h> #include <linux/irq.h>
#include <linux/irqdomain.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/spinlock.h> #include <linux/spinlock.h>
#include <linux/bitops.h> #include <linux/bitops.h>
#include <linux/io.h> #include <linux/io.h>
#include <linux/gpio.h> #include <linux/gpio.h>
#include <linux/leds.h> #include <linux/leds.h>
#include <linux/of.h>
#include <linux/of_irq.h>
#include <linux/of_address.h>
#include <plat/gpio.h>
/* /*
* GPIO unit register offsets. * GPIO unit register offsets.
...@@ -38,6 +45,7 @@ struct orion_gpio_chip { ...@@ -38,6 +45,7 @@ struct orion_gpio_chip {
unsigned long valid_output; unsigned long valid_output;
int mask_offset; int mask_offset;
int secondary_irq_base; int secondary_irq_base;
struct irq_domain *domain;
}; };
static void __iomem *GPIO_OUT(struct orion_gpio_chip *ochip) static 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,10 +230,10 @@ static int orion_gpio_to_irq(struct gpio_chip *chip, unsigned pin)
struct orion_gpio_chip *ochip = struct orion_gpio_chip *ochip =
container_of(chip, struct orion_gpio_chip, chip); container_of(chip, struct orion_gpio_chip, chip);
return ochip->secondary_irq_base + pin; return irq_create_mapping(ochip->domain,
ochip->secondary_irq_base + pin);
} }
/* /*
* Orion-specific GPIO API extensions. * Orion-specific GPIO API extensions.
*/ */
...@@ -353,12 +361,10 @@ static int gpio_irq_set_type(struct irq_data *d, u32 type) ...@@ -353,12 +361,10 @@ static int gpio_irq_set_type(struct irq_data *d, u32 type)
int pin; int pin;
u32 u; u32 u;
pin = d->irq - gc->irq_base; pin = d->hwirq - ochip->secondary_irq_base;
u = readl(GPIO_IO_CONF(ochip)) & (1 << pin); u = readl(GPIO_IO_CONF(ochip)) & (1 << pin);
if (!u) { if (!u) {
printk(KERN_ERR "orion gpio_irq_set_type failed "
"(irq %d, pin %d).\n", d->irq, pin);
return -EINVAL; return -EINVAL;
} }
...@@ -397,17 +403,53 @@ static int gpio_irq_set_type(struct irq_data *d, u32 type) ...@@ -397,17 +403,53 @@ static int gpio_irq_set_type(struct irq_data *d, u32 type)
u &= ~(1 << pin); /* rising */ u &= ~(1 << pin); /* rising */
writel(u, GPIO_IN_POL(ochip)); writel(u, GPIO_IN_POL(ochip));
} }
return 0; return 0;
} }
void __init orion_gpio_init(int gpio_base, int ngpio, static void gpio_irq_handler(unsigned irq, struct irq_desc *desc)
u32 base, int mask_offset, int secondary_irq_base) {
struct orion_gpio_chip *ochip = irq_get_handler_data(irq);
u32 cause, type;
int i;
if (ochip == NULL)
return;
cause = readl(GPIO_DATA_IN(ochip)) & readl(GPIO_LEVEL_MASK(ochip));
cause |= readl(GPIO_EDGE_CAUSE(ochip)) & readl(GPIO_EDGE_MASK(ochip));
for (i = 0; i < ochip->chip.ngpio; i++) {
int irq;
irq = ochip->secondary_irq_base + i;
if (!(cause & (1 << i)))
continue;
type = irqd_get_trigger_type(irq_get_irq_data(irq));
if ((type & IRQ_TYPE_SENSE_MASK) == IRQ_TYPE_EDGE_BOTH) {
/* Swap polarity (race with GPIO line) */
u32 polarity;
polarity = readl(GPIO_IN_POL(ochip));
polarity ^= 1 << i;
writel(polarity, GPIO_IN_POL(ochip));
}
generic_handle_irq(irq);
}
}
void __init orion_gpio_init(struct device_node *np,
int gpio_base, int ngpio,
void __iomem *base, int mask_offset,
int secondary_irq_base,
int irqs[4])
{ {
struct orion_gpio_chip *ochip; struct orion_gpio_chip *ochip;
struct irq_chip_generic *gc; struct irq_chip_generic *gc;
struct irq_chip_type *ct; struct irq_chip_type *ct;
char gc_label[16]; char gc_label[16];
int i;
if (orion_gpio_chip_count == ARRAY_SIZE(orion_gpio_chips)) if (orion_gpio_chip_count == ARRAY_SIZE(orion_gpio_chips))
return; return;
...@@ -426,6 +468,10 @@ void __init orion_gpio_init(int gpio_base, int ngpio, ...@@ -426,6 +468,10 @@ void __init orion_gpio_init(int gpio_base, int ngpio,
ochip->chip.base = gpio_base; ochip->chip.base = gpio_base;
ochip->chip.ngpio = ngpio; ochip->chip.ngpio = ngpio;
ochip->chip.can_sleep = 0; ochip->chip.can_sleep = 0;
#ifdef CONFIG_OF
ochip->chip.of_node = np;
#endif
spin_lock_init(&ochip->lock); spin_lock_init(&ochip->lock);
ochip->base = (void __iomem *)base; ochip->base = (void __iomem *)base;
ochip->valid_input = 0; ochip->valid_input = 0;
...@@ -435,8 +481,6 @@ void __init orion_gpio_init(int gpio_base, int ngpio, ...@@ -435,8 +481,6 @@ void __init orion_gpio_init(int gpio_base, int ngpio,
gpiochip_add(&ochip->chip); gpiochip_add(&ochip->chip);
orion_gpio_chip_count++;
/* /*
* Mask and clear GPIO interrupts. * Mask and clear GPIO interrupts.
*/ */
...@@ -444,16 +488,28 @@ void __init orion_gpio_init(int gpio_base, int ngpio, ...@@ -444,16 +488,28 @@ void __init orion_gpio_init(int gpio_base, int ngpio,
writel(0, GPIO_EDGE_MASK(ochip)); writel(0, GPIO_EDGE_MASK(ochip));
writel(0, GPIO_LEVEL_MASK(ochip)); writel(0, GPIO_LEVEL_MASK(ochip));
gc = irq_alloc_generic_chip("orion_gpio_irq", 2, secondary_irq_base, /* Setup the interrupt handlers. Each chip can have up to 4
* interrupt handlers, with each handler dealing with 8 GPIO
* pins. */
for (i = 0; i < 4; i++) {
if (irqs[i]) {
irq_set_handler_data(irqs[i], ochip);
irq_set_chained_handler(irqs[i], gpio_irq_handler);
}
}
gc = irq_alloc_generic_chip("orion_gpio_irq", 2,
secondary_irq_base,
ochip->base, handle_level_irq); ochip->base, handle_level_irq);
gc->private = ochip; gc->private = ochip;
ct = gc->chip_types; ct = gc->chip_types;
ct->regs.mask = ochip->mask_offset + GPIO_LEVEL_MASK_OFF; ct->regs.mask = ochip->mask_offset + GPIO_LEVEL_MASK_OFF;
ct->type = IRQ_TYPE_LEVEL_HIGH | IRQ_TYPE_LEVEL_LOW; ct->type = IRQ_TYPE_LEVEL_HIGH | IRQ_TYPE_LEVEL_LOW;
ct->chip.irq_mask = irq_gc_mask_clr_bit; ct->chip.irq_mask = irq_gc_mask_clr_bit;
ct->chip.irq_unmask = irq_gc_mask_set_bit; ct->chip.irq_unmask = irq_gc_mask_set_bit;
ct->chip.irq_set_type = gpio_irq_set_type; ct->chip.irq_set_type = gpio_irq_set_type;
ct->chip.name = ochip->chip.label;
ct++; ct++;
ct->regs.mask = ochip->mask_offset + GPIO_EDGE_MASK_OFF; 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,41 +520,69 @@ void __init orion_gpio_init(int gpio_base, int ngpio,
ct->chip.irq_unmask = irq_gc_mask_set_bit; ct->chip.irq_unmask = irq_gc_mask_set_bit;
ct->chip.irq_set_type = gpio_irq_set_type; ct->chip.irq_set_type = gpio_irq_set_type;
ct->handler = handle_edge_irq; ct->handler = handle_edge_irq;
ct->chip.name = ochip->chip.label;
irq_setup_generic_chip(gc, IRQ_MSK(ngpio), IRQ_GC_INIT_MASK_CACHE, irq_setup_generic_chip(gc, IRQ_MSK(ngpio), IRQ_GC_INIT_MASK_CACHE,
IRQ_NOREQUEST, IRQ_LEVEL | IRQ_NOPROBE); IRQ_NOREQUEST, IRQ_LEVEL | IRQ_NOPROBE);
/* Setup irq domain on top of the generic chip. */
ochip->domain = irq_domain_add_legacy(np,
ochip->chip.ngpio,
ochip->secondary_irq_base,
ochip->secondary_irq_base,
&irq_domain_simple_ops,
ochip);
if (!ochip->domain)
panic("%s: couldn't allocate irq domain (DT).\n",
ochip->chip.label);
orion_gpio_chip_count++;
} }
void orion_gpio_irq_handler(int pinoff) #ifdef CONFIG_OF
static void __init orion_gpio_of_init_one(struct device_node *np,
int irq_gpio_base)
{ {
struct orion_gpio_chip *ochip; int ngpio, gpio_base, mask_offset;
u32 cause, type; void __iomem *base;
int i; int ret, i;
int irqs[4];
int secondary_irq_base;
ochip = orion_gpio_chip_find(pinoff); ret = of_property_read_u32(np, "ngpio", &ngpio);
if (ochip == NULL) if (ret)
return; goto out;
ret = of_property_read_u32(np, "mask-offset", &mask_offset);
if (ret == -EINVAL)
mask_offset = 0;
else
goto out;
base = of_iomap(np, 0);
if (!base)
goto out;
cause = readl(GPIO_DATA_IN(ochip)) & readl(GPIO_LEVEL_MASK(ochip)); secondary_irq_base = irq_gpio_base + (32 * orion_gpio_chip_count);
cause |= readl(GPIO_EDGE_CAUSE(ochip)) & readl(GPIO_EDGE_MASK(ochip)); gpio_base = 32 * orion_gpio_chip_count;
for (i = 0; i < ochip->chip.ngpio; i++) { /* Get the interrupt numbers. Each chip can have up to 4
int irq; * interrupt handlers, with each handler dealing with 8 GPIO
* pins. */
irq = ochip->secondary_irq_base + i; for (i = 0; i < 4; i++)
irqs[i] = irq_of_parse_and_map(np, i);
if (!(cause & (1 << i))) orion_gpio_init(np, gpio_base, ngpio, base, mask_offset,
continue; secondary_irq_base, irqs);
return;
out:
pr_err("%s: %s: missing mandatory property\n", __func__, np->name);
}
type = irqd_get_trigger_type(irq_get_irq_data(irq)); void __init orion_gpio_of_init(int irq_gpio_base)
if ((type & IRQ_TYPE_SENSE_MASK) == IRQ_TYPE_EDGE_BOTH) { {
/* Swap polarity (race with GPIO line) */ struct device_node *np;
u32 polarity;
polarity = readl(GPIO_IN_POL(ochip)); for_each_compatible_node(np, NULL, "marvell,orion-gpio")
polarity ^= 1 << i; orion_gpio_of_init_one(np, irq_gpio_base);
writel(polarity, GPIO_IN_POL(ochip));
}
generic_handle_irq(irq);
}
} }
#endif
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
#include <linux/init.h> #include <linux/init.h>
#include <linux/types.h> #include <linux/types.h>
#include <linux/irqdomain.h>
/* /*
* Orion-specific GPIO API extensions. * Orion-specific GPIO API extensions.
*/ */
...@@ -27,13 +27,11 @@ int orion_gpio_led_blink_set(unsigned gpio, int state, ...@@ -27,13 +27,11 @@ int orion_gpio_led_blink_set(unsigned gpio, int state,
void orion_gpio_set_valid(unsigned pin, int mode); void orion_gpio_set_valid(unsigned pin, int mode);
/* Initialize gpiolib. */ /* Initialize gpiolib. */
void __init orion_gpio_init(int gpio_base, int ngpio, void __init orion_gpio_init(struct device_node *np,
u32 base, int mask_offset, int secondary_irq_base); int gpio_base, int ngpio,
void __iomem *base, int mask_offset,
/* int secondary_irq_base,
* GPIO interrupt handling. int irq[4]);
*/
void orion_gpio_irq_handler(int irqoff);
void __init orion_gpio_of_init(int irq_gpio_base);
#endif #endif
...@@ -12,6 +12,5 @@ ...@@ -12,6 +12,5 @@
#define __PLAT_IRQ_H #define __PLAT_IRQ_H
void orion_irq_init(unsigned int irq_start, void __iomem *maskaddr); void orion_irq_init(unsigned int irq_start, void __iomem *maskaddr);
void __init orion_dt_init_irq(void);
#endif #endif
...@@ -11,8 +11,12 @@ ...@@ -11,8 +11,12 @@
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/irq.h> #include <linux/irq.h>
#include <linux/irqdomain.h>
#include <linux/io.h> #include <linux/io.h>
#include <linux/of_address.h>
#include <linux/of_irq.h>
#include <plat/irq.h> #include <plat/irq.h>
#include <plat/gpio.h>
void __init orion_irq_init(unsigned int irq_start, void __iomem *maskaddr) void __init orion_irq_init(unsigned int irq_start, void __iomem *maskaddr)
{ {
...@@ -32,3 +36,39 @@ void __init orion_irq_init(unsigned int irq_start, void __iomem *maskaddr) ...@@ -32,3 +36,39 @@ void __init orion_irq_init(unsigned int irq_start, void __iomem *maskaddr)
irq_setup_generic_chip(gc, IRQ_MSK(32), IRQ_GC_INIT_MASK_CACHE, irq_setup_generic_chip(gc, IRQ_MSK(32), IRQ_GC_INIT_MASK_CACHE,
IRQ_NOREQUEST, IRQ_LEVEL | IRQ_NOPROBE); IRQ_NOREQUEST, IRQ_LEVEL | IRQ_NOPROBE);
} }
#ifdef CONFIG_OF
static int __init orion_add_irq_domain(struct device_node *np,
struct device_node *interrupt_parent)
{
int i = 0, irq_gpio;
void __iomem *base;
do {
base = of_iomap(np, i);
if (base) {
orion_irq_init(i * 32, base);
i++;
}
} while (base);
irq_domain_add_legacy(np, i * 32, 0, 0,
&irq_domain_simple_ops, NULL);
irq_gpio = i * 32;
orion_gpio_of_init(irq_gpio);
return 0;
}
static const struct of_device_id orion_irq_match[] = {
{ .compatible = "marvell,orion-intc",
.data = orion_add_irq_domain, },
{},
};
void __init orion_dt_init_irq(void)
{
of_irq_init(orion_irq_match);
}
#endif
...@@ -65,6 +65,8 @@ ...@@ -65,6 +65,8 @@
#include <linux/mbus.h> #include <linux/mbus.h>
#include <linux/bitops.h> #include <linux/bitops.h>
#include <linux/gfp.h> #include <linux/gfp.h>
#include <linux/of.h>
#include <linux/of_irq.h>
#include <scsi/scsi_host.h> #include <scsi/scsi_host.h>
#include <scsi/scsi_cmnd.h> #include <scsi/scsi_cmnd.h>
#include <scsi/scsi_device.h> #include <scsi/scsi_device.h>
...@@ -4026,7 +4028,7 @@ static int mv_platform_probe(struct platform_device *pdev) ...@@ -4026,7 +4028,7 @@ static int mv_platform_probe(struct platform_device *pdev)
struct ata_host *host; struct ata_host *host;
struct mv_host_priv *hpriv; struct mv_host_priv *hpriv;
struct resource *res; struct resource *res;
int n_ports = 0; int n_ports = 0, irq = 0;
int rc; int rc;
#if defined(CONFIG_HAVE_CLK) #if defined(CONFIG_HAVE_CLK)
int port; int port;
...@@ -4050,8 +4052,14 @@ static int mv_platform_probe(struct platform_device *pdev) ...@@ -4050,8 +4052,14 @@ static int mv_platform_probe(struct platform_device *pdev)
return -EINVAL; return -EINVAL;
/* allocate host */ /* allocate host */
if (pdev->dev.of_node) {
of_property_read_u32(pdev->dev.of_node, "nr-ports", &n_ports);
irq = irq_of_parse_and_map(pdev->dev.of_node, 0);
} else {
mv_platform_data = pdev->dev.platform_data; mv_platform_data = pdev->dev.platform_data;
n_ports = mv_platform_data->n_ports; n_ports = mv_platform_data->n_ports;
irq = platform_get_irq(pdev, 0);
}
host = ata_host_alloc_pinfo(&pdev->dev, ppi, n_ports); host = ata_host_alloc_pinfo(&pdev->dev, ppi, n_ports);
hpriv = devm_kzalloc(&pdev->dev, sizeof(*hpriv), GFP_KERNEL); hpriv = devm_kzalloc(&pdev->dev, sizeof(*hpriv), GFP_KERNEL);
...@@ -4109,8 +4117,7 @@ static int mv_platform_probe(struct platform_device *pdev) ...@@ -4109,8 +4117,7 @@ static int mv_platform_probe(struct platform_device *pdev)
dev_info(&pdev->dev, "slots %u ports %d\n", dev_info(&pdev->dev, "slots %u ports %d\n",
(unsigned)MV_MAX_Q_DEPTH, host->n_ports); (unsigned)MV_MAX_Q_DEPTH, host->n_ports);
rc = ata_host_activate(host, platform_get_irq(pdev, 0), mv_interrupt, rc = ata_host_activate(host, irq, mv_interrupt, IRQF_SHARED, &mv6_sht);
IRQF_SHARED, &mv6_sht);
if (!rc) if (!rc)
return 0; return 0;
...@@ -4205,6 +4212,14 @@ static int mv_platform_resume(struct platform_device *pdev) ...@@ -4205,6 +4212,14 @@ static int mv_platform_resume(struct platform_device *pdev)
#define mv_platform_resume NULL #define mv_platform_resume NULL
#endif #endif
#ifdef CONFIG_OF
static struct of_device_id mv_sata_dt_ids[] __devinitdata = {
{ .compatible = "marvell,orion-sata", },
{},
};
MODULE_DEVICE_TABLE(of, mv_sata_dt_ids);
#endif
static struct platform_driver mv_platform_driver = { static struct platform_driver mv_platform_driver = {
.probe = mv_platform_probe, .probe = mv_platform_probe,
.remove = __devexit_p(mv_platform_remove), .remove = __devexit_p(mv_platform_remove),
...@@ -4213,6 +4228,7 @@ static struct platform_driver mv_platform_driver = { ...@@ -4213,6 +4228,7 @@ static struct platform_driver mv_platform_driver = {
.driver = { .driver = {
.name = DRV_NAME, .name = DRV_NAME,
.owner = THIS_MODULE, .owner = THIS_MODULE,
.of_match_table = of_match_ptr(mv_sata_dt_ids),
}, },
}; };
......
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
#include <linux/spinlock.h> #include <linux/spinlock.h>
#include <linux/clk.h> #include <linux/clk.h>
#include <linux/err.h> #include <linux/err.h>
#include <linux/of.h>
#include <mach/bridge-regs.h> #include <mach/bridge-regs.h>
/* /*
...@@ -192,6 +193,12 @@ static void orion_wdt_shutdown(struct platform_device *pdev) ...@@ -192,6 +193,12 @@ static void orion_wdt_shutdown(struct platform_device *pdev)
orion_wdt_stop(&orion_wdt); orion_wdt_stop(&orion_wdt);
} }
static const struct of_device_id orion_wdt_of_match_table[] __devinitdata = {
{ .compatible = "marvell,orion-wdt", },
{},
};
MODULE_DEVICE_TABLE(of, orion_wdt_of_match_table);
static struct platform_driver orion_wdt_driver = { static struct platform_driver orion_wdt_driver = {
.probe = orion_wdt_probe, .probe = orion_wdt_probe,
.remove = __devexit_p(orion_wdt_remove), .remove = __devexit_p(orion_wdt_remove),
...@@ -199,6 +206,7 @@ static struct platform_driver orion_wdt_driver = { ...@@ -199,6 +206,7 @@ static struct platform_driver orion_wdt_driver = {
.driver = { .driver = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.name = "orion_wdt", .name = "orion_wdt",
.of_match_table = of_match_ptr(orion_wdt_of_match_table),
}, },
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment