net: dm9000: add support for device tree probing
Subsystems (3)
RFC PATCH v2 1/1 net: dm9000: add support for device tree probing
This patch adds support for probing the dm9000 driver through device trees.
The patch works by supplying its own platform_data struct when probed via device tree. This allows us to rely on the existing options parsing in the driver and avoid ifdeffery in the probe function.
---
Currently there are no users of this functionality, but once support for DT on OMAP3 matures, I plan to migrate the devkit8000 board to DT.
Changes since v1:
- Changed the binding with input from Grant Likely.
- Make explicit what the bindings do instead of refering to linux specific flags.
- Length check the mac address read so we don't copy random data.
- simplify parsing of the device tree.
- Add relevant driver maintainers to CC (sorry about that)
Documentation/devicetree/bindings/net/dm9000.txt | 42 +++++++++++ drivers/net/dm9000.c | 83 +++++++++++++++++++++- 2 files changed, 122 insertions(+), 3 deletions(-) create mode 100644 Documentation/devicetree/bindings/net/dm9000.txt
Documentation/devicetree/bindings/net/dm9000.txt new file +42 -0
@@ -0,0 +1,42 @@ +Davicom DM9000 ethernet controller + +Required properties: + + - compatible : Should be "davicom,dm9000" + + - interrupts : Interrupt controller specific encoding, which specifies 1 + or 2 interrupts. The first interrupt is for rx/tx and is required by the + driver to function. The second interrupt is for wake on lan support + and is optional. + + - reg : 2 Physical address specifiers, where the first specifies the address + register of device, and the second specifies the data register of the device + +Optional properties: + + - local-mac-address : Binary data specifying a mac address override + + - reg-io-width : one cell specifying the width of IO operations in bits. + valid values are 8, 16, and 32. If this property is not specified, or has + an invalid value, the driver will default to 32 bits. + + - phy-handle : phandle to external phy. + + - no-eeprom : Empty property specifying that no EEPROM is attached to the + device. + + - simple-phy : Empty property specifying that the driver should use the simple + phy polling mode + +Example: + +ethernet@2c000000 { + compatible = "davicom,dm9000"; + reg = <0x2c000000 0x04>, + <0x2c000400 0x04>; + interrupts = <185 1>; + local-mac-address = [02 65 16 01 c0 09]; + reg-io-width = <16> + phy-handle = <&phy0> + no-eeprom; +};
drivers/net/dm9000.c +80 -3
120 lines not on this page · raw message
Signature · 1 line
1.7.6
Hi Daniel,
Quoted 42 lines · Daniel Morsing
This patch adds support for probing the dm9000 driver through device trees.
The patch works by supplying its own
platform_datastruct when probed via device tree. This allows us to rely on the existing options parsing in the driver and avoid ifdeffery in the probe function.Signed-off-by Daniel Morsing <[email protected]>---
Currently there are no users of this functionality, but once support for DT on OMAP3 matures, I plan to migrate the devkit8000 board to DT.Changes since v1:
- Changed the binding with input from Grant Likely.
- Make explicit what the bindings do instead of refering to linux specific flags.
- Length check the mac address read so we don't copy random data.
- simplify parsing of the device tree.
- Add relevant driver maintainers to CC (sorry about that)Documentation/devicetree/bindings/net/dm9000.txt | 42 +++++++++++ drivers/net/dm9000.c | 83 +++++++++++++++++++++- 2 files changed, 122 insertions(+), 3 deletions(-) create mode 100644 Documentation/devicetree/bindings/net/dm9000.txtDocumentation/devicetree/bindings/net/dm9000.txt new file +11
-0@@ -0,0 +1,42 @@ +Davicom DM9000 ethernet controller + +Required properties: + + - compatible : Should be "davicom,dm9000" + + - interrupts : Interrupt controller specific encoding, which specifies 1 + or 2 interrupts. The first interrupt is for rx/tx and is required by the + driver to function. The second interrupt is for wake on lan support + and is optional. +
Documentation/devicetree/bindings/net/dm9000.txt line 21
Quoted 10 lines
Documentation/devicetree/bindings/net/dm9000.txt new file +10
-0+ - reg : 2 Physical address specifiers, where the first specifies the address + register of device, and the second specifies the data register of the device + +Optional properties: + + - local-mac-address : Binary data specifying a mac address override + + - reg-io-width : one cell specifying the width of IO operations in bits. + valid values are 8, 16, and 32. If this property is not specified, or has + an invalid value, the driver will default to 32 bits.
Minor nit, but rightly or wrongly, the of-serial binding that uses reg-io-width specifies this in bytes and it would be nice to be consistent here.
Jamie