From 745ceeea7906de7bd68b9ae226e7b1296dda9642 Mon Sep 17 00:00:00 2001 From: Linus Walleij Date: Sun, 6 Jan 2013 01:02:42 +0100 Subject: [PATCH] --- yaml --- r: 355736 b: refs/heads/master c: 2ad6e39867cf026e668a4c566725c2c65dbde406 h: refs/heads/master v: v3 --- [refs] | 2 +- .../devicetree/bindings/arm/ste-nomadik.txt | 5 +++ trunk/arch/arm/boot/dts/ste-nomadik-s8815.dts | 6 ++++ .../arm/boot/dts/ste-nomadik-stn8815.dtsi | 12 +++++++ trunk/arch/arm/mach-nomadik/board-nhk8815.c | 2 ++ trunk/arch/arm/mach-nomadik/cpu-8815.c | 34 +++++++++++++++++++ 6 files changed, 60 insertions(+), 1 deletion(-) diff --git a/[refs] b/[refs] index 7c1d1d39c53e..a313bf2b1c87 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 6010d40320f8827441414886c46a7dbc6460439a +refs/heads/master: 2ad6e39867cf026e668a4c566725c2c65dbde406 diff --git a/trunk/Documentation/devicetree/bindings/arm/ste-nomadik.txt b/trunk/Documentation/devicetree/bindings/arm/ste-nomadik.txt index 23f32bddebf9..a97316073afe 100644 --- a/trunk/Documentation/devicetree/bindings/arm/ste-nomadik.txt +++ b/trunk/Documentation/devicetree/bindings/arm/ste-nomadik.txt @@ -16,4 +16,9 @@ Required node: usb-s8815 Example: usb-s8815 { + ethernet-gpio { + gpios = <&gpio3 19 0x1>; + interrupts = <19 0x1>; + interrupt-parent = <&gpio3>; + }; }; diff --git a/trunk/arch/arm/boot/dts/ste-nomadik-s8815.dts b/trunk/arch/arm/boot/dts/ste-nomadik-s8815.dts index 97b7d1df5aaa..cc777109f98f 100644 --- a/trunk/arch/arm/boot/dts/ste-nomadik-s8815.dts +++ b/trunk/arch/arm/boot/dts/ste-nomadik-s8815.dts @@ -16,5 +16,11 @@ /* Custom board node with GPIO pins to active etc */ usb-s8815 { + /* The S8815 is using this very GPIO pin for the SMSC91x IRQs */ + ethernet-gpio { + gpios = <&gpio3 19 0x1>; + interrupts = <19 0x1>; + interrupt-parent = <&gpio3>; + }; }; }; diff --git a/trunk/arch/arm/boot/dts/ste-nomadik-stn8815.dtsi b/trunk/arch/arm/boot/dts/ste-nomadik-stn8815.dtsi index 2c8aaa5c6ac4..f129425883a4 100644 --- a/trunk/arch/arm/boot/dts/ste-nomadik-stn8815.dtsi +++ b/trunk/arch/arm/boot/dts/ste-nomadik-stn8815.dtsi @@ -125,6 +125,18 @@ }; }; + external-bus@34000000 { + compatible = "simple-bus"; + reg = <0x34000000 0x1000000>; + #address-cells = <1>; + #size-cells = <1>; + ranges = <0 0x34000000 0x1000000>; + ethernet@300 { + compatible = "smsc,lan91c111"; + reg = <0x300 0x0fd00>; + }; + }; + amba { compatible = "arm,amba-bus"; #address-cells = <1>; diff --git a/trunk/arch/arm/mach-nomadik/board-nhk8815.c b/trunk/arch/arm/mach-nomadik/board-nhk8815.c index 2f2c96bee7df..e7b216cb6802 100644 --- a/trunk/arch/arm/mach-nomadik/board-nhk8815.c +++ b/trunk/arch/arm/mach-nomadik/board-nhk8815.c @@ -239,6 +239,8 @@ static int __init nhk8815_eth_init(void) int gpio_nr = 115; /* hardwired in the board */ int err; + if (!machine_is_nomadik()) + return 0; err = gpio_request(gpio_nr, "eth_irq"); if (!err) err = gpio_direction_input(gpio_nr); if (err) diff --git a/trunk/arch/arm/mach-nomadik/cpu-8815.c b/trunk/arch/arm/mach-nomadik/cpu-8815.c index 3a59459d6e9a..339496f15138 100644 --- a/trunk/arch/arm/mach-nomadik/cpu-8815.c +++ b/trunk/arch/arm/mach-nomadik/cpu-8815.c @@ -31,9 +31,11 @@ #include #include #include +#include #include #include #include +#include #include #include @@ -263,6 +265,38 @@ static struct fsmc_nand_platform_data cpu8815_nand_data = { .nand_timings = &cpu8815_nand_timings, }; +/* + * The SMSC911x IRQ is connected to a GPIO pin, but the driver expects + * to simply request an IRQ passed as a resource. So the GPIO pin needs + * to be requested by this hog and set as input. + */ +static int __init cpu8815_eth_init(void) +{ + struct device_node *eth; + int gpio, irq, err; + + eth = of_find_node_by_path("/usb-s8815/ethernet-gpio"); + if (!eth) { + pr_info("could not find any ethernet GPIO\n"); + return 0; + } + gpio = of_get_gpio(eth, 0); + err = gpio_request(gpio, "eth_irq"); + if (err) { + pr_info("failed to request ethernet GPIO\n"); + return -ENODEV; + } + err = gpio_direction_input(gpio); + if (err) { + pr_info("failed to set ethernet GPIO as input\n"); + return -ENODEV; + } + irq = gpio_to_irq(gpio); + pr_info("enabled USB-S8815 ethernet GPIO %d, IRQ %d\n", gpio, irq); + return 0; +} +device_initcall(cpu8815_eth_init); + /* These are mostly to get the right device names for the clock lookups */ static struct of_dev_auxdata cpu8815_auxdata_lookup[] __initdata = { OF_DEV_AUXDATA("st,nomadik-gpio", NOMADIK_GPIO0_BASE,