aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Petazzoni <thomas.petazzoni@free-electrons.com>2014-04-22 17:26:38 -0400
committerJason Cooper <jason@lakedaemon.net>2014-04-26 15:45:22 -0400
commit065194a06b4187f9c1f4a37951904534291fb85b (patch)
tree374563dc1c2bed1cda0e403e82b1e65759f49a59
parentaeba6964788d0d8ac0a32113ffecdfdb0db7c786 (diff)
ARM: orion5x: convert RD-88F5182 to Device Tree
This commit converts the RD-88F5182 platform to the Device Tree. All devices except the PCI are converted to the Device Tree. It is worth noting that: * The PCI description for the DT case is kept in board-rd88f5182.c. * The existing non-DT support in rd88f5182-setup.c is kept as is, in order to allow testing of a given platform in both DT and non-DT cases. It will ultimately be removed, once we no longer care about non-DT support for Orion5x. Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com> Acked-by: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com> Link: https://lkml.kernel.org/r/1398202002-28530-35-git-send-email-thomas.petazzoni@free-electrons.com Cc: Ronen Shitrit <rshitrit@marvell.com> Signed-off-by: Jason Cooper <jason@lakedaemon.net>
-rw-r--r--arch/arm/boot/dts/Makefile3
-rw-r--r--arch/arm/boot/dts/orion5x-rd88f5182-nas.dts177
-rw-r--r--arch/arm/mach-orion5x/Kconfig8
-rw-r--r--arch/arm/mach-orion5x/Makefile1
-rw-r--r--arch/arm/mach-orion5x/board-rd88f5182.c116
5 files changed, 304 insertions, 1 deletions
diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile
index 35c146f31e46..f7943a8d3764 100644
--- a/arch/arm/boot/dts/Makefile
+++ b/arch/arm/boot/dts/Makefile
@@ -289,7 +289,8 @@ dtb-$(CONFIG_ARCH_OMAP2PLUS) += omap2420-h4.dtb \
289 am43x-epos-evm.dtb \ 289 am43x-epos-evm.dtb \
290 am437x-gp-evm.dtb \ 290 am437x-gp-evm.dtb \
291 dra7-evm.dtb 291 dra7-evm.dtb
292dtb-$(CONFIG_ARCH_ORION5X) += orion5x-lacie-ethernet-disk-mini-v2.dtb 292dtb-$(CONFIG_ARCH_ORION5X) += orion5x-lacie-ethernet-disk-mini-v2.dtb \
293 orion5x-rd88f5182-nas.dtb
293dtb-$(CONFIG_ARCH_PRIMA2) += prima2-evb.dtb 294dtb-$(CONFIG_ARCH_PRIMA2) += prima2-evb.dtb
294dtb-$(CONFIG_ARCH_QCOM) += qcom-msm8660-surf.dtb \ 295dtb-$(CONFIG_ARCH_QCOM) += qcom-msm8660-surf.dtb \
295 qcom-msm8960-cdp.dtb \ 296 qcom-msm8960-cdp.dtb \
diff --git a/arch/arm/boot/dts/orion5x-rd88f5182-nas.dts b/arch/arm/boot/dts/orion5x-rd88f5182-nas.dts
new file mode 100644
index 000000000000..6fb052507b36
--- /dev/null
+++ b/arch/arm/boot/dts/orion5x-rd88f5182-nas.dts
@@ -0,0 +1,177 @@
1/*
2 * Copyright (C) 2014 Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
3 *
4 * This file is licensed under the terms of the GNU General Public
5 * License version 2. This program is licensed "as is" without any
6 * warranty of any kind, whether express or implied.
7 */
8
9/dts-v1/;
10
11#include <dt-bindings/gpio/gpio.h>
12#include "orion5x-mv88f5182.dtsi"
13
14/ {
15 model = "Marvell Reference Design 88F5182 NAS";
16 compatible = "marvell,rd-88f5182-nas", "marvell,orion5x-88f5182", "marvell,orion5x";
17
18 memory {
19 reg = <0x00000000 0x4000000>; /* 64 MB */
20 };
21
22 chosen {
23 bootargs = "console=ttyS0,115200n8 earlyprintk";
24 linux,stdout-path = &uart0;
25 };
26
27 soc {
28 ranges = <MBUS_ID(0xf0, 0x01) 0 0xf1000000 0x100000>,
29 <MBUS_ID(0x09, 0x00) 0 0xf2200000 0x800>,
30 <MBUS_ID(0x01, 0x0f) 0 0xf4000000 0x80000>,
31 <MBUS_ID(0x01, 0x1d) 0 0xfc000000 0x1000000>;
32 };
33
34 gpio-leds {
35 compatible = "gpio-leds";
36 pinctrl-0 = <&pmx_debug_led>;
37 pinctrl-names = "default";
38
39 led@0 {
40 label = "rd88f5182:cpu";
41 linux,default-trigger = "heartbeat";
42 gpios = <&gpio0 0 GPIO_ACTIVE_HIGH>;
43 };
44 };
45};
46
47&devbus_bootcs {
48 status = "okay";
49
50 /* Read parameters */
51 devbus,bus-width = <8>;
52 devbus,turn-off-ps = <90000>;
53 devbus,badr-skew-ps = <0>;
54 devbus,acc-first-ps = <186000>;
55 devbus,acc-next-ps = <186000>;
56
57 /* Write parameters */
58 devbus,wr-high-ps = <90000>;
59 devbus,wr-low-ps = <90000>;
60 devbus,ale-wr-ps = <90000>;
61
62 flash@0 {
63 compatible = "cfi-flash";
64 reg = <0 0x80000>;
65 bank-width = <1>;
66 };
67};
68
69&devbus_cs1 {
70 status = "okay";
71
72 /* Read parameters */
73 devbus,bus-width = <8>;
74 devbus,turn-off-ps = <90000>;
75 devbus,badr-skew-ps = <0>;
76 devbus,acc-first-ps = <186000>;
77 devbus,acc-next-ps = <186000>;
78
79 /* Write parameters */
80 devbus,wr-high-ps = <90000>;
81 devbus,wr-low-ps = <90000>;
82 devbus,ale-wr-ps = <90000>;
83
84 flash@0 {
85 compatible = "cfi-flash";
86 reg = <0 0x1000000>;
87 bank-width = <1>;
88 };
89};
90
91&ehci0 {
92 status = "okay";
93};
94
95&ehci1 {
96 status = "okay";
97};
98
99&eth {
100 status = "okay";
101
102 ethernet-port@0 {
103 phy-handle = <&ethphy>;
104 };
105};
106
107&i2c {
108 status = "okay";
109 clock-frequency = <100000>;
110 #address-cells = <1>;
111
112 rtc@68 {
113 pinctrl-0 = <&pmx_rtc>;
114 pinctrl-names = "default";
115 compatible = "dallas,ds1338";
116 reg = <0x68>;
117 };
118};
119
120&mdio {
121 status = "okay";
122
123 ethphy: ethernet-phy {
124 reg = <8>;
125 };
126};
127
128&pinctrl {
129 pinctrl-0 = <&pmx_reset_switch &pmx_misc_gpios
130 &pmx_pci_gpios>;
131 pinctrl-names = "default";
132
133 /*
134 * MPP[20] PCI Clock to MV88F5182
135 * MPP[21] PCI Clock to mini PCI CON11
136 * MPP[22] USB 0 over current indication
137 * MPP[23] USB 1 over current indication
138 * MPP[24] USB 1 over current enable
139 * MPP[25] USB 0 over current enable
140 */
141
142 pmx_debug_led: pmx-debug_led {
143 marvell,pins = "mpp0";
144 marvell,function = "gpio";
145 };
146
147 pmx_reset_switch: pmx-reset-switch {
148 marvell,pins = "mpp1";
149 marvell,function = "gpio";
150 };
151
152 pmx_rtc: pmx-rtc {
153 marvell,pins = "mpp3";
154 marvell,function = "gpio";
155 };
156
157 pmx_misc_gpios: pmx-misc-gpios {
158 marvell,pins = "mpp4", "mpp5";
159 marvell,function = "gpio";
160 };
161
162 pmx_pci_gpios: pmx-pci-gpios {
163 marvell,pins = "mpp6", "mpp7";
164 marvell,function = "gpio";
165 };
166};
167
168&sata {
169 pinctrl-0 = <&pmx_sata0 &pmx_sata1>;
170 pinctrl-names = "default";
171 status = "okay";
172 nr-ports = <2>;
173};
174
175&uart0 {
176 status = "okay";
177};
diff --git a/arch/arm/mach-orion5x/Kconfig b/arch/arm/mach-orion5x/Kconfig
index 928f4cbdb7f3..11b0c7ea44a2 100644
--- a/arch/arm/mach-orion5x/Kconfig
+++ b/arch/arm/mach-orion5x/Kconfig
@@ -28,6 +28,14 @@ config MACH_RD88F5182
28 Say 'Y' here if you want your kernel to support the 28 Say 'Y' here if you want your kernel to support the
29 Marvell Orion-NAS (88F5182) RD2 29 Marvell Orion-NAS (88F5182) RD2
30 30
31config MACH_RD88F5182_DT
32 bool "Marvell Orion-NAS Reference Design (Flattened Device Tree)"
33 select ARCH_ORION5X_DT
34 select I2C_BOARDINFO
35 help
36 Say 'Y' here if you want your kernel to support the Marvell
37 Orion-NAS (88F5182) RD2, Flattened Device Tree.
38
31config MACH_KUROBOX_PRO 39config MACH_KUROBOX_PRO
32 bool "KuroBox Pro" 40 bool "KuroBox Pro"
33 select I2C_BOARDINFO 41 select I2C_BOARDINFO
diff --git a/arch/arm/mach-orion5x/Makefile b/arch/arm/mach-orion5x/Makefile
index e8fdbdd02e95..f40589466805 100644
--- a/arch/arm/mach-orion5x/Makefile
+++ b/arch/arm/mach-orion5x/Makefile
@@ -23,3 +23,4 @@ obj-$(CONFIG_MACH_RD88F6183AP_GE) += rd88f6183ap-ge-setup.o
23obj-$(CONFIG_MACH_LINKSTATION_LSCHL) += ls-chl-setup.o 23obj-$(CONFIG_MACH_LINKSTATION_LSCHL) += ls-chl-setup.o
24 24
25obj-$(CONFIG_ARCH_ORION5X_DT) += board-dt.o 25obj-$(CONFIG_ARCH_ORION5X_DT) += board-dt.o
26obj-$(CONFIG_MACH_RD88F5182_DT) += board-rd88f5182.o
diff --git a/arch/arm/mach-orion5x/board-rd88f5182.c b/arch/arm/mach-orion5x/board-rd88f5182.c
new file mode 100644
index 000000000000..270824b0e50f
--- /dev/null
+++ b/arch/arm/mach-orion5x/board-rd88f5182.c
@@ -0,0 +1,116 @@
1/*
2 * arch/arm/mach-orion5x/rd88f5182-setup.c
3 *
4 * Marvell Orion-NAS Reference Design Setup
5 *
6 * Maintainer: Ronen Shitrit <rshitrit@marvell.com>
7 *
8 * This file is licensed under the terms of the GNU General Public
9 * License version 2. This program is licensed "as is" without any
10 * warranty of any kind, whether express or implied.
11 */
12#include <linux/gpio.h>
13#include <linux/kernel.h>
14#include <linux/init.h>
15#include <linux/platform_device.h>
16#include <linux/pci.h>
17#include <linux/irq.h>
18#include <asm/mach-types.h>
19#include <asm/mach/arch.h>
20#include <asm/mach/pci.h>
21#include <mach/orion5x.h>
22#include "common.h"
23
24/*****************************************************************************
25 * RD-88F5182 Info
26 ****************************************************************************/
27
28/*
29 * PCI
30 */
31
32#define RD88F5182_PCI_SLOT0_OFFS 7
33#define RD88F5182_PCI_SLOT0_IRQ_A_PIN 7
34#define RD88F5182_PCI_SLOT0_IRQ_B_PIN 6
35
36/*****************************************************************************
37 * PCI
38 ****************************************************************************/
39
40static void __init rd88f5182_pci_preinit(void)
41{
42 int pin;
43
44 /*
45 * Configure PCI GPIO IRQ pins
46 */
47 pin = RD88F5182_PCI_SLOT0_IRQ_A_PIN;
48 if (gpio_request(pin, "PCI IntA") == 0) {
49 if (gpio_direction_input(pin) == 0) {
50 irq_set_irq_type(gpio_to_irq(pin), IRQ_TYPE_LEVEL_LOW);
51 } else {
52 printk(KERN_ERR "rd88f5182_pci_preinit failed to "
53 "set_irq_type pin %d\n", pin);
54 gpio_free(pin);
55 }
56 } else {
57 printk(KERN_ERR "rd88f5182_pci_preinit failed to request gpio %d\n", pin);
58 }
59
60 pin = RD88F5182_PCI_SLOT0_IRQ_B_PIN;
61 if (gpio_request(pin, "PCI IntB") == 0) {
62 if (gpio_direction_input(pin) == 0) {
63 irq_set_irq_type(gpio_to_irq(pin), IRQ_TYPE_LEVEL_LOW);
64 } else {
65 printk(KERN_ERR "rd88f5182_pci_preinit failed to "
66 "set_irq_type pin %d\n", pin);
67 gpio_free(pin);
68 }
69 } else {
70 printk(KERN_ERR "rd88f5182_pci_preinit failed to gpio_request %d\n", pin);
71 }
72}
73
74static int __init rd88f5182_pci_map_irq(const struct pci_dev *dev, u8 slot,
75 u8 pin)
76{
77 int irq;
78
79 /*
80 * Check for devices with hard-wired IRQs.
81 */
82 irq = orion5x_pci_map_irq(dev, slot, pin);
83 if (irq != -1)
84 return irq;
85
86 /*
87 * PCI IRQs are connected via GPIOs
88 */
89 switch (slot - RD88F5182_PCI_SLOT0_OFFS) {
90 case 0:
91 if (pin == 1)
92 return gpio_to_irq(RD88F5182_PCI_SLOT0_IRQ_A_PIN);
93 else
94 return gpio_to_irq(RD88F5182_PCI_SLOT0_IRQ_B_PIN);
95 default:
96 return -1;
97 }
98}
99
100static struct hw_pci rd88f5182_pci __initdata = {
101 .nr_controllers = 2,
102 .preinit = rd88f5182_pci_preinit,
103 .setup = orion5x_pci_sys_setup,
104 .scan = orion5x_pci_sys_scan_bus,
105 .map_irq = rd88f5182_pci_map_irq,
106};
107
108static int __init rd88f5182_pci_init(void)
109{
110 if (of_machine_is_compatible("marvell,rd-88f5182-nas"))
111 pci_common_init(&rd88f5182_pci);
112
113 return 0;
114}
115
116subsys_initcall(rd88f5182_pci_init);