Skip to contentSkip to conversation

net: smc91x: add DT flags for legacy platforms

PATCH In review Nishanth Menon 2 participants 5 messages Dec 11, 2013

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

cover net: smc91x: add DT flags for legacy platforms

Hi,

SMC91x driver has been converted to device tree, however users of older lan91c94 based platform need description provided previously by platform_data. Without this, ethernet fails to function on these platforms.

For example, on SDP2430:
Before: http://pastebin.mozilla.org/3753793
After: http://pastebin.mozilla.org/3753792

Nishanth Menon (2):
net: smc91x: Read hardware behavior flags from device tree
ARM: dts: omap2430-sdp: add flags for ethernet functionality

 Documentation/devicetree/bindings/net/smsc91x.txt |   45 +++++++++
 arch/arm/boot/dts/omap2430-sdp.dts                |    5 +
 drivers/net/ethernet/smsc/smc91x.c                |  106 ++++++++++++++++++++-
 3 files changed, 155 insertions(+), 1 deletion(-)
 create mode 100644 Documentation/devicetree/bindings/net/smsc91x.txt

Regards,
Nishanth Menon

Signature · 1 line
1.7.9.5
#1 lore raw

PATCH 1/2 net: smc91x: Read hardware behavior flags from device tree

commit 682a169 (smc91x: add devicetree support) introduced basic device tree support in the form of identifier match. However, platform_data flags equivalent was not introduced, nor was an appropriate bindings document introduced.

In many legacy platforms such as Texas Instrument's SDP2430, platform_data flags have been used to describe the hardware behavior.

So, introduce the legacy equivalent flags and bindings document to handle the transition to device tree enabled boot.

---
I am open to the suggestion to make smsc,leda|b macro based value instead of the current string based option.

If it is prefered, i could move the bindings off to it's own patch as well. Currently this is squashed as it makes more sense to read in context.

 Documentation/devicetree/bindings/net/smsc91x.txt |   45 +++++++++
 drivers/net/ethernet/smsc/smc91x.c                |  106 ++++++++++++++++++++-
 2 files changed, 150 insertions(+), 1 deletion(-)
 create mode 100644 Documentation/devicetree/bindings/net/smsc91x.txt
Documentation/devicetree/bindings/net/smsc91x.txt new file +45 -0
new file mode 100644
index 0000000..389b807
@@ -0,0 +1,45 @@
+* Smart Mixed-Signal Connectivity (SMSC) LAN91c94/91c111 Controller
+
+Required properties:
+- compatible : Should be one of:
+	"smsc,lan91c94"
+	"smsc,lan91c111"
+- reg : Address and length of the io space for SMSC LAN
+- interrupts : Should contain SMSC LAN interrupt line
+- interrupt-parent : Should be the phandle for the interrupt controller
+  that services interrupts for this device
+
+Optional properties:
+- reg-shift : Specify the quantity to shift the register offsets by
+- reg-io-width : Specify the size (in bytes) of the IO accesses that
+  should be performed on the device.  Valid value for SMSC LAN is
+  1, 2 or 4.
+- smsc,nowait : bool for fast accesses and no extra wait cycles
+- "smsc,leda" "smsc,ledb": string indicating when to glow led a or b, one of:
+	"100_10"	: 100Mbps OR's with 10Mbps link detect
+	"10"		: 10Mbps link detect
+	"100"		: 100Mbps link detect
+	"FD"		: Full Duplex Mode
+	"TX_RX"		: TX or RX packet occurred
+	"TX"		: TX packet occurred
+	"RX"		: RX packet occurred
+
+Examples:
+
+ethernet at gpmc {
+	compatible = "smsc,lan91c94";
+	reg = <5 0x300 0xf>;
+	reg-io-width = <2>;
+	interrupt-parent = <&gpio5>;
+	interrupts = <21 IRQ_TYPE_LEVEL_LOW>;	/* gpio149 */
+	smsc,nowait;
+	smsc,leda = "100_10";
+	smsc,ledb = "TX_RX";
+};
+
+ethernet at c8000000 {
+	compatible = "smsc,lan91c111";
+	reg = <0xc8000000 0x10>;
+	interrupt-parent = <&pic>;
+	interrupts = <27>;
+};
drivers/net/ethernet/smsc/smc91x.c +105 -1

124 lines not on this page · raw message

Signature · 1 line
1.7.9.5
#2 lore raw

Re: [PATCH 1/2] net: smc91x: Read hardware behavior flags from device tree

Quoted 9 lines · Nishanth Menon
Documentation/devicetree/bindings/net/smsc91x.txt new file +6 -0
@@ -0,0 +1,45 @@
+* Smart Mixed-Signal Connectivity (SMSC) LAN91c94/91c111 Controller
+
+Required properties:
+- compatible : Should be one of:
+	"smsc,lan91c94"
+	"smsc,lan91c111"

Documentation/devicetree/bindings/net/smsc91x.txt line 16

Quoted 10 lines
Documentation/devicetree/bindings/net/smsc91x.txt new file +10 -0
+- reg : Address and length of the io space for SMSC LAN
+- interrupts : Should contain SMSC LAN interrupt line
+- interrupt-parent : Should be the phandle for the interrupt controller
+  that services interrupts for this device
+
+Optional properties:
+- reg-shift : Specify the quantity to shift the register offsets by
+- reg-io-width : Specify the size (in bytes) of the IO accesses that
+  should be performed on the device.  Valid value for SMSC LAN is
+  1, 2 or 4.

I posted a minimal regression fix for this a few weeks ago that we should merge to the v3.13-rc cycle:

http://www.spinics.net/lists/netdev/msg258913.html

Care to ack that one? Then if that works for you, maybe rebase these on that one for the upcoming merge window?

Note that for the -rc cycle we don't need these extra properties as we can get the interrupts from the struct resource after fix 4a43d686fe336c (of/irq: Pass trigger type in IRQ resource flags) got merged.

Regards,

Tony

#3 lore raw

Re: [PATCH 1/2] net: smc91x: Read hardware behavior flags from device tree

Quoted 24 lines · Tony Lindgren
Quoted 9 lines · Nishanth Menon
Documentation/devicetree/bindings/net/smsc91x.txt new file +6 -0
@@ -0,0 +1,45 @@
+* Smart Mixed-Signal Connectivity (SMSC) LAN91c94/91c111 Controller
+
+Required properties:
+- compatible : Should be one of:
+     "smsc,lan91c94"
+     "smsc,lan91c111"

Documentation/devicetree/bindings/net/smsc91x.txt line 16

Quoted 10 lines
Documentation/devicetree/bindings/net/smsc91x.txt new file +10 -0
+- reg : Address and length of the io space for SMSC LAN
+- interrupts : Should contain SMSC LAN interrupt line
+- interrupt-parent : Should be the phandle for the interrupt controller
+  that services interrupts for this device
+
+Optional properties:
+- reg-shift : Specify the quantity to shift the register offsets by
+- reg-io-width : Specify the size (in bytes) of the IO accesses that
+  should be performed on the device.  Valid value for SMSC LAN is
+  1, 2 or 4.

I posted a minimal regression fix for this a few weeks ago that we should merge to the v3.13-rc cycle:

Quoted 3 lines

http://www.spinics.net/lists/netdev/msg258913.html

Care to ack that one?

Done.

Quoted 2 lines

Then if that works for you, maybe rebase these on
that one for the upcoming merge window?

it seems like omap is the only folks who are currently using this driver in dt form, I kinda proposed to do these as add on changes to your patch, lets see if anyone cares about it.

but I agree to drop my series at this point,

Regards,
Nishanth Menon

#4 lore raw

PATCH 2/2 ARM: dts: omap2430-sdp: add flags for ethernet functionality

In reply to Nishanth Menon

Ethernet transition from board file to dts missed the required pdata conversion. So fix the same.

---
 arch/arm/boot/dts/omap2430-sdp.dts |    5 +++++
 1 file changed, 5 insertions(+)
arch/arm/boot/dts/omap2430-sdp.dts +5 -0
index 2c90d29..ec9263a 100644
@@ -39,6 +39,11 @@
 	ranges = <5 0 0x08000000 0x01000000>;
 	ethernet at gpmc {
 		compatible = "smsc,lan91c94";
+		reg-io-width = <2>;
+		smsc,nowait;
+		smsc,leda = "100_10";
+		smsc,ledb = "TX_RX";
+
 		interrupt-parent = <&gpio5>;
 		interrupts = <21 IRQ_TYPE_LEVEL_LOW>;	/* gpio149 */
 		reg = <5 0x300 0xf>;
Signature · 1 line
1.7.9.5