aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Walleij <linus.walleij@linaro.org>2013-01-05 19:02:42 -0500
committerLinus Walleij <linus.walleij@linaro.org>2013-01-28 17:24:40 -0500
commit2ad6e39867cf026e668a4c566725c2c65dbde406 (patch)
treebeabfde792e10dd48dfc03d07998dc34ab4cc1c3
parent6010d40320f8827441414886c46a7dbc6460439a (diff)
ARM: nomadik: convert SMSC91x ethernet to device tree
This converts the SMSC91x ethernet controller to use device tree. The existing solution from the board file, to request the GPIO triggering the ethernet IRQ from the board file is kept for the time being, but the GPIO number assignment is moved over to the device tree. Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
-rw-r--r--Documentation/devicetree/bindings/arm/ste-nomadik.txt5
-rw-r--r--arch/arm/boot/dts/ste-nomadik-s8815.dts6
-rw-r--r--arch/arm/boot/dts/ste-nomadik-stn8815.dtsi12
-rw-r--r--arch/arm/mach-nomadik/board-nhk8815.c2
-rw-r--r--arch/arm/mach-nomadik/cpu-8815.c34
5 files changed, 59 insertions, 0 deletions
diff --git a/Documentation/devicetree/bindings/arm/ste-nomadik.txt b/Documentation/devicetree/bindings/arm/ste-nomadik.txt
index 23f32bddebf9..a97316073afe 100644
--- a/Documentation/devicetree/bindings/arm/ste-nomadik.txt
+++ b/Documentation/devicetree/bindings/arm/ste-nomadik.txt
@@ -16,4 +16,9 @@ Required node: usb-s8815
16Example: 16Example:
17 17
18usb-s8815 { 18usb-s8815 {
19 ethernet-gpio {
20 gpios = <&gpio3 19 0x1>;
21 interrupts = <19 0x1>;
22 interrupt-parent = <&gpio3>;
23 };
19}; 24};
diff --git a/arch/arm/boot/dts/ste-nomadik-s8815.dts b/arch/arm/boot/dts/ste-nomadik-s8815.dts
index 97b7d1df5aaa..cc777109f98f 100644
--- a/arch/arm/boot/dts/ste-nomadik-s8815.dts
+++ b/arch/arm/boot/dts/ste-nomadik-s8815.dts
@@ -16,5 +16,11 @@
16 16
17 /* Custom board node with GPIO pins to active etc */ 17 /* Custom board node with GPIO pins to active etc */
18 usb-s8815 { 18 usb-s8815 {
19 /* The S8815 is using this very GPIO pin for the SMSC91x IRQs */
20 ethernet-gpio {
21 gpios = <&gpio3 19 0x1>;
22 interrupts = <19 0x1>;
23 interrupt-parent = <&gpio3>;
24 };
19 }; 25 };
20}; 26};
diff --git a/arch/arm/boot/dts/ste-nomadik-stn8815.dtsi b/arch/arm/boot/dts/ste-nomadik-stn8815.dtsi
index 2c8aaa5c6ac4..f129425883a4 100644
--- a/arch/arm/boot/dts/ste-nomadik-stn8815.dtsi
+++ b/arch/arm/boot/dts/ste-nomadik-stn8815.dtsi
@@ -125,6 +125,18 @@
125 }; 125 };
126 }; 126 };
127 127
128 external-bus@34000000 {
129 compatible = "simple-bus";
130 reg = <0x34000000 0x1000000>;
131 #address-cells = <1>;
132 #size-cells = <1>;
133 ranges = <0 0x34000000 0x1000000>;
134 ethernet@300 {
135 compatible = "smsc,lan91c111";
136 reg = <0x300 0x0fd00>;
137 };
138 };
139
128 amba { 140 amba {
129 compatible = "arm,amba-bus"; 141 compatible = "arm,amba-bus";
130 #address-cells = <1>; 142 #address-cells = <1>;
diff --git a/arch/arm/mach-nomadik/board-nhk8815.c b/arch/arm/mach-nomadik/board-nhk8815.c
index 2f2c96bee7df..e7b216cb6802 100644
--- a/arch/arm/mach-nomadik/board-nhk8815.c
+++ b/arch/arm/mach-nomadik/board-nhk8815.c
@@ -239,6 +239,8 @@ static int __init nhk8815_eth_init(void)
239 int gpio_nr = 115; /* hardwired in the board */ 239 int gpio_nr = 115; /* hardwired in the board */
240 int err; 240 int err;
241 241
242 if (!machine_is_nomadik())
243 return 0;
242 err = gpio_request(gpio_nr, "eth_irq"); 244 err = gpio_request(gpio_nr, "eth_irq");
243 if (!err) err = gpio_direction_input(gpio_nr); 245 if (!err) err = gpio_direction_input(gpio_nr);
244 if (err) 246 if (err)
diff --git a/arch/arm/mach-nomadik/cpu-8815.c b/arch/arm/mach-nomadik/cpu-8815.c
index 3a59459d6e9a..339496f15138 100644
--- a/arch/arm/mach-nomadik/cpu-8815.c
+++ b/arch/arm/mach-nomadik/cpu-8815.c
@@ -31,9 +31,11 @@
31#include <linux/pinctrl/machine.h> 31#include <linux/pinctrl/machine.h>
32#include <linux/platform_data/clocksource-nomadik-mtu.h> 32#include <linux/platform_data/clocksource-nomadik-mtu.h>
33#include <linux/of_irq.h> 33#include <linux/of_irq.h>
34#include <linux/of_gpio.h>
34#include <linux/of_address.h> 35#include <linux/of_address.h>
35#include <linux/of_platform.h> 36#include <linux/of_platform.h>
36#include <linux/mtd/fsmc.h> 37#include <linux/mtd/fsmc.h>
38#include <linux/gpio.h>
37 39
38#include <mach/hardware.h> 40#include <mach/hardware.h>
39#include <mach/irqs.h> 41#include <mach/irqs.h>
@@ -263,6 +265,38 @@ static struct fsmc_nand_platform_data cpu8815_nand_data = {
263 .nand_timings = &cpu8815_nand_timings, 265 .nand_timings = &cpu8815_nand_timings,
264}; 266};
265 267
268/*
269 * The SMSC911x IRQ is connected to a GPIO pin, but the driver expects
270 * to simply request an IRQ passed as a resource. So the GPIO pin needs
271 * to be requested by this hog and set as input.
272 */
273static int __init cpu8815_eth_init(void)
274{
275 struct device_node *eth;
276 int gpio, irq, err;
277
278 eth = of_find_node_by_path("/usb-s8815/ethernet-gpio");
279 if (!eth) {
280 pr_info("could not find any ethernet GPIO\n");
281 return 0;
282 }
283 gpio = of_get_gpio(eth, 0);
284 err = gpio_request(gpio, "eth_irq");
285 if (err) {
286 pr_info("failed to request ethernet GPIO\n");
287 return -ENODEV;
288 }
289 err = gpio_direction_input(gpio);
290 if (err) {
291 pr_info("failed to set ethernet GPIO as input\n");
292 return -ENODEV;
293 }
294 irq = gpio_to_irq(gpio);
295 pr_info("enabled USB-S8815 ethernet GPIO %d, IRQ %d\n", gpio, irq);
296 return 0;
297}
298device_initcall(cpu8815_eth_init);
299
266/* These are mostly to get the right device names for the clock lookups */ 300/* These are mostly to get the right device names for the clock lookups */
267static struct of_dev_auxdata cpu8815_auxdata_lookup[] __initdata = { 301static struct of_dev_auxdata cpu8815_auxdata_lookup[] __initdata = {
268 OF_DEV_AUXDATA("st,nomadik-gpio", NOMADIK_GPIO0_BASE, 302 OF_DEV_AUXDATA("st,nomadik-gpio", NOMADIK_GPIO0_BASE,