Discussion:
[PATCH 4/5 v2] ARM: orion5x: add gigabit ethernet device tree node
(too old to reply)
Florian Fainelli
2013-04-04 10:27:14 UTC
Permalink
This patch adds the gigabit ethernet device tree node to orion5x.dtsi.
This node is disabled by default and must be enabled on a per-board
basis. For completeness and easier testing the MDIO node is also added
and disabled by default.

Signed-off-by: Florian Fainelli <***@openwrt.org>
---
Changes since v1:
- fixed off-by 0x2000 address of the ethernet-group node

arch/arm/boot/dts/orion5x.dtsi | 23 +++++++++++++++++++++++
1 file changed, 23 insertions(+)

diff --git a/arch/arm/boot/dts/orion5x.dtsi b/arch/arm/boot/dts/orion5x.dtsi
index f7bec3b..c49503e 100644
--- a/arch/arm/boot/dts/orion5x.dtsi
+++ b/arch/arm/boot/dts/orion5x.dtsi
@@ -99,5 +99,28 @@
interrupts = <28>;
status = "okay";
};
+
+ ***@72004 {
+ #address-cells = <1>;
+ #size-cells = <0>;
+ compatible = "marvell,orion-mdio";
+ reg = <0x72004 0x84>;
+ status = "disabled";
+ };
+
+ ethernet-***@72000 {
+ #address-cells = <1>.
+ #size-cells = <0>;
+ compatible = "marvell,mv643xx-eth-block";
+ reg = <0x72000 0x4000>;
+ status = "disabled";
+
+ egiga0: ***@0 {
+ device_type = "network";
+ compatible = "marvell,mv643xx-eth";
+ reg = <0>;
+ interrupts = <21>;
+ };
+ };
};
};
--
1.7.10.4
Florian Fainelli
2013-04-04 10:27:13 UTC
Permalink
This patch modifies kirkwood.dtsi to specify the various gigabit
interfaces nodes available on kirkwood devices. They are disabled by
default and should be enabled on a per-board basis. egiga0 and egiga1
aliases are defined for convenience. The mdio node is also present and
should be enabled on a per-board basis as well.

Signed-off-by: Florian Fainelli <***@openwrt.org>
---
Changes since v1:
- dropped change to arch/arm/mach-kirkwood/common.c to avoid merge conflicts
- fixed off-by 0x2000 ethernet-group nodes address

arch/arm/boot/dts/kirkwood.dtsi | 46 +++++++++++++++++++++++++++++++++++++++
1 file changed, 46 insertions(+)

diff --git a/arch/arm/boot/dts/kirkwood.dtsi b/arch/arm/boot/dts/kirkwood.dtsi
index fada7e6..254f5a8 100644
--- a/arch/arm/boot/dts/kirkwood.dtsi
+++ b/arch/arm/boot/dts/kirkwood.dtsi
@@ -7,6 +7,8 @@
aliases {
gpio0 = &gpio0;
gpio1 = &gpio1;
+ egiga0 = &egiga0;
+ egiga1 = &egiga1;
};
intc: interrupt-controller {
compatible = "marvell,orion-intc", "marvell,intc";
@@ -202,5 +204,49 @@
clocks = <&gate_clk 4>;
status = "disabled";
};
+
+ ***@72004 {
+ #address-cells = <1>;
+ #size-cells = <0>;
+ compatible = "marvell,orion-mdio";
+ reg = <0x72004 0x84>;
+ status = "disabled";
+ };
+
+ ethernet-***@72000 {
+ #address-cells = <1>;
+ #size-cells = <0>;
+ compatible = "marvell,mv643xx-eth-block";
+ reg = <0x72000 0x4000>;
+ tx-csum-limit = <1600>;
+ status = "disabled";
+
+ egiga0: ***@0 {
+ device_type = "network";
+ compatible = "marvell,mv643xx-eth";
+ reg = <0>;
+ interrupts = <11>;
+ clocks = <&gate_clk 0>;
+ clock-names = "0";
+ };
+ };
+
+ ethernet-***@76000 {
+ #address-cells = <1>;
+ #size-cells = <0>;
+ compatible = "marvell,mv643xx-eth-block";
+ reg = <0x76000 0x4000>;
+ tx-csum-limit = <1600>;
+ status = "disabled";
+
+ egiga1: ***@0 {
+ device_type = "network";
+ compatible = "marvell,mv643xx-eth";
+ reg = <0>;
+ interrupts = <15>;
+ clocks = <&gate_clk 19>;
+ clock-names = "1";
+ };
+ };
};
};
--
1.7.10.4
Simon Baatz
2013-04-04 21:35:17 UTC
Permalink
Hi Florian,
Post by Florian Fainelli
This patch modifies kirkwood.dtsi to specify the various gigabit
interfaces nodes available on kirkwood devices. They are disabled by
default and should be enabled on a per-board basis. egiga0 and egiga1
aliases are defined for convenience. The mdio node is also present and
should be enabled on a per-board basis as well.
---
- dropped change to arch/arm/mach-kirkwood/common.c to avoid merge conflicts
I think we should remove the clock aliases in
kirkwood_legacy_clk_init() in mach-kirkwood/dt-board.c (once we have
proper clock support, see my other mail).
Post by Florian Fainelli
- fixed off-by 0x2000 ethernet-group nodes address
arch/arm/boot/dts/kirkwood.dtsi | 46 +++++++++++++++++++++++++++++++++++++++
1 file changed, 46 insertions(+)
diff --git a/arch/arm/boot/dts/kirkwood.dtsi b/arch/arm/boot/dts/kirkwood.dtsi
index fada7e6..254f5a8 100644
--- a/arch/arm/boot/dts/kirkwood.dtsi
+++ b/arch/arm/boot/dts/kirkwood.dtsi
@@ -7,6 +7,8 @@
aliases {
gpio0 = &gpio0;
gpio1 = &gpio1;
+ egiga0 = &egiga0;
+ egiga1 = &egiga1;
};
intc: interrupt-controller {
compatible = "marvell,orion-intc", "marvell,intc";
@@ -202,5 +204,49 @@
clocks = <&gate_clk 4>;
status = "disabled";
};
+
+ #address-cells = <1>;
+ #size-cells = <0>;
+ compatible = "marvell,orion-mdio";
+ reg = <0x72004 0x84>;
Don't we need to add:

interrupts = <46>;

here?


- Simon
Florian Fainelli
2013-04-05 09:21:50 UTC
Permalink
Post by Simon Baatz
Hi Florian,
Post by Florian Fainelli
This patch modifies kirkwood.dtsi to specify the various gigabit
interfaces nodes available on kirkwood devices. They are disabled by
default and should be enabled on a per-board basis. egiga0 and egiga1
aliases are defined for convenience. The mdio node is also present and
should be enabled on a per-board basis as well.
---
- dropped change to arch/arm/mach-kirkwood/common.c to avoid merge conflicts
I think we should remove the clock aliases in
kirkwood_legacy_clk_init() in mach-kirkwood/dt-board.c (once we have
proper clock support, see my other mail).
[snip]
Post by Simon Baatz
interrupts = <46>;
here?
Right this is missing, in fact it still works ok because the orion-mdio
driver can do busy waiting instead of interrupt signaling. Will fix that
in the next round, thanks!
--
Florian
Florian Fainelli
2013-04-04 10:27:15 UTC
Permalink
This patch adds the gigabit ethernet device tree nodes to dove.dtsi in a
disabled state. The gigabit ethernet device tree node must be enabled on
a per-board basis. For completeness and easier testing the MDIO node is
also added in a disabled state.

Signed-off-by: Florian Fainelli <***@openwrt.org>
---
Changes since v1:
- fixed off-by 0x2000 address of the ethernet-group node

arch/arm/boot/dts/dove.dtsi | 25 +++++++++++++++++++++++++
1 file changed, 25 insertions(+)

diff --git a/arch/arm/boot/dts/dove.dtsi b/arch/arm/boot/dts/dove.dtsi
index f7509ca..51de5f7 100644
--- a/arch/arm/boot/dts/dove.dtsi
+++ b/arch/arm/boot/dts/dove.dtsi
@@ -253,5 +253,30 @@
dmacap,xor;
};
};
+
+ ***@72004 {
+ #address-cells = <1>;
+ #size-cells = <0>;
+ compatible = "marvell,orion-mdio";
+ reg = <0x72004 0x84>;
+ status = "disabled";
+ };
+
+ ethernet-***@72000 {
+ #address-cells = <1>;
+ #size-cells = <0>;
+ compatible = "marvell,mv643xx-eth-block";
+ reg = <0x72000 0x4000>;
+ tx-csum-limit = <1600>;
+ status = "disabled";
+
+ egiga0: ***@0 {
+ device_type = "network";
+ compatible = "marvell,mv643xx-eth";
+ reg = <0>;
+ interrupts = <29>;
+ clocks = <&gate_clk 2>;
+ };
+ };
};
};
--
1.7.10.4
Florian Fainelli
2013-04-04 10:27:12 UTC
Permalink
This patch updates the Device Tree bindings documentation for the
Marvell MV643xx ethernet controller node and makes the
"local-mac-address" and "phy" properties optional instead of required.
The absence of a "phy" node is legal and describes a MAC to switch
configuration, while not specifying the "local-mac-address" allows for
reuse of the MAC address already programmed into the Ethernet
controller.

Signed-off-by: Florian Fainelli <***@openwrt.org>
---
Documentation/devicetree/bindings/marvell.txt | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/Documentation/devicetree/bindings/marvell.txt b/Documentation/devicetree/bindings/marvell.txt
index e70a013..994b933 100644
--- a/Documentation/devicetree/bindings/marvell.txt
+++ b/Documentation/devicetree/bindings/marvell.txt
@@ -141,11 +141,11 @@ prefixed with the string "marvell,", for Marvell Technology Group Ltd.
- interrupts : <a> where a is the interrupt number for the port.
- interrupt-parent : the phandle for the interrupt controller
that services interrupts for this device.
+
+ Optional properties:
- phy : the phandle for the PHY connected to this ethernet
controller.
- local-mac-address : 6 bytes, MAC address
-
- Optional properties:
- clocks : Phandle to the clock control device and gate bit
- clock-names : String describing the clock gate bit
- speed : Speed to force the link (10, 100, 1000), used when no
--
1.7.10.4
Florian Fainelli
2013-04-04 10:27:11 UTC
Permalink
This patch adds Device Tree bindings following the already defined
bindings at Documentation/devicetree/bindings/marvell.txt. The binding
documentation is also enhanced with new optionnal properties required
for supporting certain devices (RX/TX queue and SRAM). Since we now have
proper support for the orion MDIO bus driver, there is no need to fiddle
around with device tree phandles. PHY-less (MAC connected to switch)
configurations are supported by not specifying any phy phandle for an
ethernet node.

Signed-off-by: Florian Fainelli <***@openwrt.org>
---
- properly ifdef of_platform_bus_probe with CONFIG_OF
- handle of_platform_bus_probe errors and cleanup accordingly
- use of_property_read_u32 where applicable
- parse "duplex" and "speed" property in PHY-less configuration

Documentation/devicetree/bindings/marvell.txt | 25 +++++-
drivers/net/ethernet/marvell/mv643xx_eth.c | 120 ++++++++++++++++++++++++-
2 files changed, 140 insertions(+), 5 deletions(-)

diff --git a/Documentation/devicetree/bindings/marvell.txt b/Documentation/devicetree/bindings/marvell.txt
index f1533d9..e70a013 100644
--- a/Documentation/devicetree/bindings/marvell.txt
+++ b/Documentation/devicetree/bindings/marvell.txt
@@ -112,9 +112,14 @@ prefixed with the string "marvell,", for Marvell Technology Group Ltd.
Required properties:
- #address-cells : <1>
- #size-cells : <0>
- - compatible : "marvell,mv64360-eth-block"
+ - compatible : "marvell,mv64360-eth-block", "marvell,mv64360-eth-group",
+ "marvell,mv643xx-eth-block"
- reg : Offset and length of the register set for this block

+ Optional properties:
+ - tx-csum-limit : Hardware limit above which transmit checksumming
+ is disabled.
+
Example Discovery Ethernet block node:
ethernet-***@2000 {
#address-cells = <1>;
@@ -130,7 +135,7 @@ prefixed with the string "marvell,", for Marvell Technology Group Ltd.

Required properties:
- device_type : Should be "network".
- - compatible : Should be "marvell,mv64360-eth".
+ - compatible : Should be "marvell,mv64360-eth", "marvell,mv643xx-eth".
- reg : Should be <0>, <1>, or <2>, according to which registers
within the silicon block the device uses.
- interrupts : <a> where a is the interrupt number for the port.
@@ -140,6 +145,22 @@ prefixed with the string "marvell,", for Marvell Technology Group Ltd.
controller.
- local-mac-address : 6 bytes, MAC address

+ Optional properties:
+ - clocks : Phandle to the clock control device and gate bit
+ - clock-names : String describing the clock gate bit
+ - speed : Speed to force the link (10, 100, 1000), used when no
+ phy property is defined
+ - duplex : Duplex to force the link (0: half, 1: full), used when no
+ phy property is defined
+ - rx-queue-count : number of RX queues to use
+ - tx-queue-count : number of TX queues to use
+ - rx-queue-size : size of the RX queue (in bytes)
+ - tx-queue-size : size of the TX queue (in bytes)
+ - rx-sram-addr : address of the SRAM for RX path (non 0 means used)
+ - rx-sram-size : size of the SRAM for RX path (non 0 means used)
+ - tx-sram-addr : address of the SRAM for TX path (non 0 means used)
+ - tx-sram-size : size of the SRAM for TX path (non 0 means used)
+
Example Discovery Ethernet port node:
***@0 {
device_type = "network";
diff --git a/drivers/net/ethernet/marvell/mv643xx_eth.c b/drivers/net/ethernet/marvell/mv643xx_eth.c
index aedbd82..75599a8 100644
--- a/drivers/net/ethernet/marvell/mv643xx_eth.c
+++ b/drivers/net/ethernet/marvell/mv643xx_eth.c
@@ -60,6 +60,10 @@
#include <linux/inet_lro.h>
#include <linux/slab.h>
#include <linux/clk.h>
+#include <linux/stringify.h>
+#include <linux/of.h>
+#include <linux/of_platform.h>
+#include <linux/of_net.h>

static char mv643xx_eth_driver_name[] = "mv643xx_eth";
static char mv643xx_eth_driver_version[] = "1.4";
@@ -2542,14 +2546,23 @@ static void infer_hw_params(struct mv643xx_eth_shared_private *msp)
}
}

+static const struct of_device_id mv643xx_eth_match[] = {
+ { .compatible = "marvell,mv64360-eth" },
+ { .compatible = "marvell,mv643xx-eth" },
+ { /* sentinel */ },
+};
+MODULE_DEVICE_TABLE(of, mv643xx_eth_match);
+
static int mv643xx_eth_shared_probe(struct platform_device *pdev)
{
static int mv643xx_eth_version_printed;
+ struct device_node *np = pdev->dev.of_node;
struct mv643xx_eth_shared_platform_data *pd = pdev->dev.platform_data;
struct mv643xx_eth_shared_private *msp;
const struct mbus_dram_target_info *dram;
struct resource *res;
int ret;
+ int tx_csum_limit = 0;

if (!mv643xx_eth_version_printed++)
pr_notice("MV-643xx 10/100/1000 ethernet driver version %s\n",
@@ -2576,13 +2589,23 @@ static int mv643xx_eth_shared_probe(struct platform_device *pdev)
if (dram)
mv643xx_eth_conf_mbus_windows(msp, dram);

- msp->tx_csum_limit = (pd != NULL && pd->tx_csum_limit) ?
- pd->tx_csum_limit : 9 * 1024;
+ if (np)
+ of_property_read_u32(np, "tx-csum-limit", &tx_csum_limit);
+ else
+ tx_csum_limit = pd->tx_csum_limit;
+
+ msp->tx_csum_limit = tx_csum_limit ? tx_csum_limit : 9 * 1024;
infer_hw_params(msp);

platform_set_drvdata(pdev, msp);
+ ret = 0;

- return 0;
+#ifdef CONFIG_OF
+ ret = of_platform_bus_probe(np, mv643xx_eth_match, &pdev->dev);
+ if (ret)
+ goto out_free;
+#endif
+ return ret;

out_free:
kfree(msp);
@@ -2600,12 +2623,22 @@ static int mv643xx_eth_shared_remove(struct platform_device *pdev)
return 0;
}

+static const struct of_device_id mv643xx_eth_shared_match[] = {
+ { .compatible = "marvell,mv64360-eth-group" },
+ { .compatible = "marvell,mv64360-eth-block" },
+ { .compatible = "marvell,mv643xx-eth-group" },
+ { .compatible = "marvell,mv643xx-eth-block" },
+ { /* sentinel */ },
+};
+MODULE_DEVICE_TABLE(of, mv643xx_eth_shared_match);
+
static struct platform_driver mv643xx_eth_shared_driver = {
.probe = mv643xx_eth_shared_probe,
.remove = mv643xx_eth_shared_remove,
.driver = {
.name = MV643XX_ETH_SHARED_NAME,
.owner = THIS_MODULE,
+ .of_match_table = of_match_ptr(mv643xx_eth_shared_match),
},
};

@@ -2764,6 +2797,74 @@ static const struct net_device_ops mv643xx_eth_netdev_ops = {
#endif
};

+#ifdef CONFIG_OF
+static int mv643xx_eth_of_probe(struct platform_device *pdev)
+{
+ struct mv643xx_eth_platform_data *pd;
+ struct device_node *np = pdev->dev.of_node;
+ struct device_node *shared = of_get_parent(np);
+ struct device_node *phy_node;
+ const int *prop;
+ const char *mac_addr;
+
+ if (!pdev->dev.of_node)
+ return 0;
+
+ pd = kzalloc(sizeof(*pd), GFP_KERNEL);
+ if (!pd)
+ return -ENOMEM;
+
+ pdev->dev.platform_data = pd;
+
+ pd->shared = of_find_device_by_node(shared);
+ if (!pd->shared)
+ return -ENODEV;
+
+ prop = of_get_property(np, "reg", NULL);
+ if (!prop)
+ return -EINVAL;
+
+ pd->port_number = be32_to_cpup(prop);
+
+ phy_node = of_parse_phandle(np, "phy", 0);
+ if (!phy_node) {
+ pd->phy_addr = MV643XX_ETH_PHY_NONE;
+
+ of_property_read_u32(np, "speed", &pd->speed);
+ of_property_read_u32(np, "duplex", &pd->duplex);
+ } else {
+ prop = of_get_property(phy_node, "reg", NULL);
+ if (prop)
+ pd->phy_addr = be32_to_cpup(prop);
+ }
+
+ mac_addr = of_get_mac_address(np);
+ if (mac_addr)
+ memcpy(pd->mac_addr, mac_addr, ETH_ALEN);
+
+#define rx_tx_queue_sram_property(_name) \
+ prop = of_get_property(np, __stringify(_name), NULL); \
+ if (prop) \
+ pd->_name = be32_to_cpup(prop);
+
+ rx_tx_queue_sram_property(rx_queue_count);
+ rx_tx_queue_sram_property(tx_queue_count);
+ rx_tx_queue_sram_property(rx_queue_size);
+ rx_tx_queue_sram_property(tx_queue_size);
+ rx_tx_queue_sram_property(rx_sram_addr);
+ rx_tx_queue_sram_property(rx_sram_size);
+ rx_tx_queue_sram_property(tx_sram_addr);
+ rx_tx_queue_sram_property(rx_sram_size);
+
+ return 0;
+}
+#else
+static inline int mv643xx_eth_of_probe(struct platform_device *dev)
+{
+ return 0;
+}
+#endif
+
static int mv643xx_eth_probe(struct platform_device *pdev)
{
struct mv643xx_eth_platform_data *pd;
@@ -2772,7 +2873,12 @@ static int mv643xx_eth_probe(struct platform_device *pdev)
struct resource *res;
int err;

+ err = mv643xx_eth_of_probe(pdev);
+ if (err)
+ return err;
+
pd = pdev->dev.platform_data;
+
if (pd == NULL) {
dev_err(&pdev->dev, "no mv643xx_eth_platform_data\n");
return -ENODEV;
@@ -2896,6 +3002,8 @@ out:
}
#endif
free_netdev(dev);
+ if (pdev->dev.of_node)
+ kfree(pd);

return err;
}
@@ -2903,6 +3011,7 @@ out:
static int mv643xx_eth_remove(struct platform_device *pdev)
{
struct mv643xx_eth_private *mp = platform_get_drvdata(pdev);
+ struct mv643xx_eth_platform_data *pd = pdev->dev.platform_data;

unregister_netdev(mp->dev);
if (mp->phy != NULL)
@@ -2918,6 +3027,9 @@ static int mv643xx_eth_remove(struct platform_device *pdev)

free_netdev(mp->dev);

+ if (pdev->dev.of_node)
+ kfree(pd);
+
platform_set_drvdata(pdev, NULL);

return 0;
@@ -2935,6 +3047,7 @@ static void mv643xx_eth_shutdown(struct platform_device *pdev)
port_reset(mp);
}

+
static struct platform_driver mv643xx_eth_driver = {
.probe = mv643xx_eth_probe,
.remove = mv643xx_eth_remove,
@@ -2942,6 +3055,7 @@ static struct platform_driver mv643xx_eth_driver = {
.driver = {
.name = MV643XX_ETH_NAME,
.owner = THIS_MODULE,
+ .of_match_table = of_match_ptr(mv643xx_eth_match),
},
};
--
1.7.10.4
Simon Baatz
2013-04-04 21:29:06 UTC
Permalink
Hi Florian
Post by Florian Fainelli
This patch adds Device Tree bindings following the already defined
bindings at Documentation/devicetree/bindings/marvell.txt. The binding
documentation is also enhanced with new optionnal properties required
for supporting certain devices (RX/TX queue and SRAM). Since we now have
proper support for the orion MDIO bus driver, there is no need to fiddle
around with device tree phandles. PHY-less (MAC connected to switch)
configurations are supported by not specifying any phy phandle for an
ethernet node.
---
- properly ifdef of_platform_bus_probe with CONFIG_OF
- handle of_platform_bus_probe errors and cleanup accordingly
- use of_property_read_u32 where applicable
- parse "duplex" and "speed" property in PHY-less configuration
Documentation/devicetree/bindings/marvell.txt | 25 +++++-
drivers/net/ethernet/marvell/mv643xx_eth.c | 120 ++++++++++++++++++++++++-
2 files changed, 140 insertions(+), 5 deletions(-)
diff --git a/Documentation/devicetree/bindings/marvell.txt b/Documentation/devicetree/bindings/marvell.txt
index f1533d9..e70a013 100644
--- a/Documentation/devicetree/bindings/marvell.txt
+++ b/Documentation/devicetree/bindings/marvell.txt
@@ -112,9 +112,14 @@ prefixed with the string "marvell,", for Marvell Technology Group Ltd.
- #address-cells : <1>
- #size-cells : <0>
- - compatible : "marvell,mv64360-eth-block"
+ - compatible : "marvell,mv64360-eth-block", "marvell,mv64360-eth-group",
+ "marvell,mv643xx-eth-block"
- reg : Offset and length of the register set for this block
+ - tx-csum-limit : Hardware limit above which transmit checksumming
+ is disabled.
+
#address-cells = <1>;
@@ -130,7 +135,7 @@ prefixed with the string "marvell,", for Marvell Technology Group Ltd.
- device_type : Should be "network".
- - compatible : Should be "marvell,mv64360-eth".
+ - compatible : Should be "marvell,mv64360-eth", "marvell,mv643xx-eth".
- reg : Should be <0>, <1>, or <2>, according to which registers
within the silicon block the device uses.
- interrupts : <a> where a is the interrupt number for the port.
@@ -140,6 +145,22 @@ prefixed with the string "marvell,", for Marvell Technology Group Ltd.
controller.
- local-mac-address : 6 bytes, MAC address
+ - clocks : Phandle to the clock control device and gate bit
+ - clock-names : String describing the clock gate bit
+ - speed : Speed to force the link (10, 100, 1000), used when no
+ phy property is defined
+ - duplex : Duplex to force the link (0: half, 1: full), used when no
+ phy property is defined
+ - rx-queue-count : number of RX queues to use
+ - tx-queue-count : number of TX queues to use
+ - rx-queue-size : size of the RX queue (in bytes)
+ - tx-queue-size : size of the TX queue (in bytes)
+ - rx-sram-addr : address of the SRAM for RX path (non 0 means used)
+ - rx-sram-size : size of the SRAM for RX path (non 0 means used)
+ - tx-sram-addr : address of the SRAM for TX path (non 0 means used)
+ - tx-sram-size : size of the SRAM for TX path (non 0 means used)
+
device_type = "network";
diff --git a/drivers/net/ethernet/marvell/mv643xx_eth.c b/drivers/net/ethernet/marvell/mv643xx_eth.c
index aedbd82..75599a8 100644
--- a/drivers/net/ethernet/marvell/mv643xx_eth.c
+++ b/drivers/net/ethernet/marvell/mv643xx_eth.c
@@ -60,6 +60,10 @@
#include <linux/inet_lro.h>
#include <linux/slab.h>
#include <linux/clk.h>
+#include <linux/stringify.h>
+#include <linux/of.h>
+#include <linux/of_platform.h>
+#include <linux/of_net.h>
static char mv643xx_eth_driver_name[] = "mv643xx_eth";
static char mv643xx_eth_driver_version[] = "1.4";
@@ -2542,14 +2546,23 @@ static void infer_hw_params(struct mv643xx_eth_shared_private *msp)
}
}
+static const struct of_device_id mv643xx_eth_match[] = {
+ { .compatible = "marvell,mv64360-eth" },
+ { .compatible = "marvell,mv643xx-eth" },
+ { /* sentinel */ },
+};
+MODULE_DEVICE_TABLE(of, mv643xx_eth_match);
+
static int mv643xx_eth_shared_probe(struct platform_device *pdev)
{
static int mv643xx_eth_version_printed;
+ struct device_node *np = pdev->dev.of_node;
struct mv643xx_eth_shared_platform_data *pd = pdev->dev.platform_data;
struct mv643xx_eth_shared_private *msp;
const struct mbus_dram_target_info *dram;
struct resource *res;
int ret;
+ int tx_csum_limit = 0;
if (!mv643xx_eth_version_printed++)
pr_notice("MV-643xx 10/100/1000 ethernet driver version %s\n",
This is not related to your change, but there is a problem in this
function that has already been discussed in the past if I remember
correctly: The respective clock needs to be enabled here (at least
on Kirkwood), since accesses to the hardware are done below.
Enabling the clock only in mv643xx_eth_probe() is too late.

As said, this is not a problem introduced by your changes (and which
is currently circumvented by enabling the respective clocks in
kirkwood_legacy_clk_init() and kirkwood_ge0x_init()), but we might
want to fix this now to get rid of unconditionally enabling the GE
clocks in the DT case.
Post by Florian Fainelli
@@ -2576,13 +2589,23 @@ static int mv643xx_eth_shared_probe(struct platform_device *pdev)
if (dram)
mv643xx_eth_conf_mbus_windows(msp, dram);
- msp->tx_csum_limit = (pd != NULL && pd->tx_csum_limit) ?
- pd->tx_csum_limit : 9 * 1024;
+ if (np)
+ of_property_read_u32(np, "tx-csum-limit", &tx_csum_limit);
+ else
+ tx_csum_limit = pd->tx_csum_limit;
+
+ msp->tx_csum_limit = tx_csum_limit ? tx_csum_limit : 9 * 1024;
infer_hw_params(msp);
platform_set_drvdata(pdev, msp);
+ ret = 0;
- return 0;
+#ifdef CONFIG_OF
+ ret = of_platform_bus_probe(np, mv643xx_eth_match, &pdev->dev);
+ if (ret)
+ goto out_free;
+#endif
+ return ret;
kfree(msp);
@@ -2600,12 +2623,22 @@ static int mv643xx_eth_shared_remove(struct platform_device *pdev)
return 0;
}
+static const struct of_device_id mv643xx_eth_shared_match[] = {
+ { .compatible = "marvell,mv64360-eth-group" },
+ { .compatible = "marvell,mv64360-eth-block" },
+ { .compatible = "marvell,mv643xx-eth-group" },
+ { .compatible = "marvell,mv643xx-eth-block" },
+ { /* sentinel */ },
+};
+MODULE_DEVICE_TABLE(of, mv643xx_eth_shared_match);
+
static struct platform_driver mv643xx_eth_shared_driver = {
.probe = mv643xx_eth_shared_probe,
.remove = mv643xx_eth_shared_remove,
.driver = {
.name = MV643XX_ETH_SHARED_NAME,
.owner = THIS_MODULE,
+ .of_match_table = of_match_ptr(mv643xx_eth_shared_match),
},
};
@@ -2764,6 +2797,74 @@ static const struct net_device_ops mv643xx_eth_netdev_ops = {
#endif
};
+#ifdef CONFIG_OF
+static int mv643xx_eth_of_probe(struct platform_device *pdev)
+{
+ struct mv643xx_eth_platform_data *pd;
+ struct device_node *np = pdev->dev.of_node;
+ struct device_node *shared = of_get_parent(np);
+ struct device_node *phy_node;
+ const int *prop;
+ const char *mac_addr;
+
+ if (!pdev->dev.of_node)
+ return 0;
+
+ pd = kzalloc(sizeof(*pd), GFP_KERNEL);
+ if (!pd)
+ return -ENOMEM;
+
+ pdev->dev.platform_data = pd;
+
+ pd->shared = of_find_device_by_node(shared);
+ if (!pd->shared)
+ return -ENODEV;
+
+ prop = of_get_property(np, "reg", NULL);
+ if (!prop)
+ return -EINVAL;
+
+ pd->port_number = be32_to_cpup(prop);
+
+ phy_node = of_parse_phandle(np, "phy", 0);
+ if (!phy_node) {
+ pd->phy_addr = MV643XX_ETH_PHY_NONE;
+
+ of_property_read_u32(np, "speed", &pd->speed);
+ of_property_read_u32(np, "duplex", &pd->duplex);
+ } else {
+ prop = of_get_property(phy_node, "reg", NULL);
+ if (prop)
+ pd->phy_addr = be32_to_cpup(prop);
+ }
+
+ mac_addr = of_get_mac_address(np);
+ if (mac_addr)
+ memcpy(pd->mac_addr, mac_addr, ETH_ALEN);
+
+#define rx_tx_queue_sram_property(_name) \
+ prop = of_get_property(np, __stringify(_name), NULL); \
+ if (prop) \
+ pd->_name = be32_to_cpup(prop);
+
+ rx_tx_queue_sram_property(rx_queue_count);
+ rx_tx_queue_sram_property(tx_queue_count);
+ rx_tx_queue_sram_property(rx_queue_size);
+ rx_tx_queue_sram_property(tx_queue_size);
+ rx_tx_queue_sram_property(rx_sram_addr);
+ rx_tx_queue_sram_property(rx_sram_size);
+ rx_tx_queue_sram_property(tx_sram_addr);
+ rx_tx_queue_sram_property(rx_sram_size);
+
+ return 0;
+}
+#else
+static inline int mv643xx_eth_of_probe(struct platform_device *dev)
+{
+ return 0;
+}
+#endif
+
static int mv643xx_eth_probe(struct platform_device *pdev)
{
struct mv643xx_eth_platform_data *pd;
@@ -2772,7 +2873,12 @@ static int mv643xx_eth_probe(struct platform_device *pdev)
struct resource *res;
int err;
+ err = mv643xx_eth_of_probe(pdev);
+ if (err)
+ return err;
+
pd = pdev->dev.platform_data;
+
if (pd == NULL) {
dev_err(&pdev->dev, "no mv643xx_eth_platform_data\n");
return -ENODEV;
You don't change the clk initialization here:

#if defined(CONFIG_HAVE_CLK)
mp->clk = clk_get(&pdev->dev, (pdev->id ? "1" : "0"));
if (!IS_ERR(mp->clk)) {
clk_prepare_enable(mp->clk);
mp->t_clk = clk_get_rate(mp->clk);
}
#endif

Which, if I understand correctly, works in the DT case because you
assign "clock-names" to the clocks in the DTS. However, I wonder
whether this works for any but the first Ethernet device.

In the old platform device setup, the pdev->id was set when
initialiazing the platform_device structure in common.c. Where is
this done in the DT case?


In phy_scan(), the phy is searched like this:

snprintf(phy_id, sizeof(phy_id), PHY_ID_FMT,
"orion-mdio-mii", addr);

phydev = phy_connect(mp->dev, phy_id, mv643xx_eth_adjust_link,
PHY_INTERFACE_MODE_GMII);

But "orion-mdio-mii:xx" is the name of the PHY if MDIO is setup via a
platform_device. I could not get this to work if the MDIO device is
setup via DT. Am I doing something wrong?


Additionally, in phy_scan() there is this:

if (phy_addr == MV643XX_ETH_PHY_ADDR_DEFAULT) {
start = phy_addr_get(mp) & 0x1f;
num = 32;
} else {
...

MV643XX_ETH_PHY_ADDR_DEFAULT is defined as 0. However, many Kirkwood
devices use "MV643XX_ETH_PHY_ADDR(0)". If the module probe is
deferred in mv643xx_eth because the MDIO driver is not yet loaded,
all 32 PHY addresses are scanned without success. This is not needed
and clutters the log.


- Simon
Sebastian Hesselbarth
2013-04-05 13:58:03 UTC
Permalink
[snip]
Florian,

took me a while to try you patches out on Dove but now I fixed all
issues. I will
comment on all related patches but first I want to comment here.

One general note for Dove related patches: You didn't remove the registration of
ge platform_device from mach-dove/board-dt.c. That will lead to double
registration
of mdio and mv643xx_eth/shared, so you'll never be sure if DT or non-DT code is
executed. I haven't checked mach-kirkwood/board-dt.c or orion5x code.
Post by Simon Baatz
Post by Florian Fainelli
if (!mv643xx_eth_version_printed++)
pr_notice("MV-643xx 10/100/1000 ethernet driver version %s\n",
This is not related to your change, but there is a problem in this
function that has already been discussed in the past if I remember
correctly: The respective clock needs to be enabled here (at least
on Kirkwood), since accesses to the hardware are done below.
Enabling the clock only in mv643xx_eth_probe() is too late.
As said, this is not a problem introduced by your changes (and which
is currently circumvented by enabling the respective clocks in
kirkwood_legacy_clk_init() and kirkwood_ge0x_init()), but we might
want to fix this now to get rid of unconditionally enabling the GE
clocks in the DT case.
I think there may have been some confusion between the "ethernet-group"
clock and the actual Ethernet port inside the "ethernet-group". The
mv643xx_eth driver assumes we have a per-port clock gating scheme, while I
think we have a per "ethernet-group" clock gating scheme instead. Like you
said, I think this should be addressed separately.
IMHO, there should be a clocks property where ever you try to access registers,
i.e. in all three "parts" mv643xx_eth_shared (group), mv643xx_eth
(port) and mdio.
Since port depends on shared it would be ok to have it per group but that may
collide with other SoCs than Dove/Kirkwood that have per port clocks.

Is that separation (group/port) really required for any SoC?
[snip]
Post by Simon Baatz
#if defined(CONFIG_HAVE_CLK)
mp->clk = clk_get(&pdev->dev, (pdev->id ? "1" : "0"));
if (!IS_ERR(mp->clk)) {
clk_prepare_enable(mp->clk);
mp->t_clk = clk_get_rate(mp->clk);
}
#endif
Which, if I understand correctly, works in the DT case because you
assign "clock-names" to the clocks in the DTS. However, I wonder
whether this works for any but the first Ethernet device.
Yes, it does. Assigned clocks from clocks property get a clock alias for
that device name (node name). Using anything else than NULL here is
IMHO just wrong. We should rather provide proper clock aliases for non-DT case.
Post by Simon Baatz
In the old platform device setup, the pdev->id was set when
initialiazing the platform_device structure in common.c. Where is
this done in the DT case?
Looks like you are right, in the DT case, I assume that we should lookup the
clock using NULL instead of "1" or "0" so we match any clock instead of a
specific one.
Yes.
[snip]
Post by Simon Baatz
snprintf(phy_id, sizeof(phy_id), PHY_ID_FMT,
"orion-mdio-mii", addr);
phydev = phy_connect(mp->dev, phy_id,
mv643xx_eth_adjust_link,
PHY_INTERFACE_MODE_GMII);
But "orion-mdio-mii:xx" is the name of the PHY if MDIO is setup via a
platform_device. I could not get this to work if the MDIO device is
setup via DT. Am I doing something wrong?
I just missed updating this part of the code to probe for PHYs. The board I
tested with uses a "PHY_NONE" configuration. I will add the missing bits for
of_phy_connect() to be called here.
I don't think that the ethernet controller should probe the PHY's on mdio-bus
at all. At least not for DT enabled platforms. I had a look at DT and non-DT
mdio-bus sources, and realized that there is a bus scan for non-DT only.
of_mdiobus_register requires you to set (and know) the PHY address.

I prepared a patch for of_mdio_register that will allow you to probe mdio and
assign phy addresses to each node found. Currently, the heuristic for probing
is: assign each phy node the next probed phy_addr starting with 0. But that
will not allow to e.g. set some PHY addresses and probe the rest.

We had a similar discussion whether to probe or not for DT nodes, and I guess
there also will be some discussion about the above patch. OTOH we could just
(again) ask users of every kirkwood/orion5x/dove board to tell their
phy addresses
and fail to probe the phy for new boards...

I will prepare a proper patch soon and post it on the corresponding lists.
Post by Simon Baatz
if (phy_addr == MV643XX_ETH_PHY_ADDR_DEFAULT) {
start = phy_addr_get(mp) & 0x1f;
num = 32;
} else {
...
MV643XX_ETH_PHY_ADDR_DEFAULT is defined as 0. However, many Kirkwood
devices use "MV643XX_ETH_PHY_ADDR(0)". If the module probe is
deferred in mv643xx_eth because the MDIO driver is not yet loaded,
all 32 PHY addresses are scanned without success. This is not needed
and clutters the log.
Ok, I am not sure how we can circumvent the log cluttering that happens,
what would be your suggestion?
My suggestion is to change MV643XX_ETH_PHY_ADDR_DEFAULT from a valid
phy address (0)
to something invalid (32). I understand that using 0 helps if you
don't want to set it in mv643xx's platform_data
but it is always difficult to rely on that if 0 is a valid number.

Changing the above to 32 should just work because most (all?) boards
using phy_scan should also
already use MV643XX_ETH_PHY_ADDR_DEFAULT. I also suggest to rename
current define to a
better name, e.g. MV643XX_ETH_PHY_ADDR_AUTOSCAN.

Sebastian
Florian Fainelli
2013-04-05 14:23:17 UTC
Permalink
Hello Sebastian,
Post by Simon Baatz
[snip]
Florian,
took me a while to try you patches out on Dove but now I fixed all
issues. I will
comment on all related patches but first I want to comment here.
One general note for Dove related patches: You didn't remove the registration of
ge platform_device from mach-dove/board-dt.c. That will lead to double
registration
of mdio and mv643xx_eth/shared, so you'll never be sure if DT or non-DT code is
executed. I haven't checked mach-kirkwood/board-dt.c or orion5x code.
This was intentional, this patchset is just preparatory in the sense
that it does no conversion of the existing users of the mv643xx_eth
platform driver over DT (have some patches to that though). I wanted to
resume the discussion on these bindings first, then proceed with the
conversion.
Post by Simon Baatz
Post by Simon Baatz
Post by Florian Fainelli
if (!mv643xx_eth_version_printed++)
pr_notice("MV-643xx 10/100/1000 ethernet driver version %s\n",
This is not related to your change, but there is a problem in this
function that has already been discussed in the past if I remember
correctly: The respective clock needs to be enabled here (at least
on Kirkwood), since accesses to the hardware are done below.
Enabling the clock only in mv643xx_eth_probe() is too late.
As said, this is not a problem introduced by your changes (and which
is currently circumvented by enabling the respective clocks in
kirkwood_legacy_clk_init() and kirkwood_ge0x_init()), but we might
want to fix this now to get rid of unconditionally enabling the GE
clocks in the DT case.
I think there may have been some confusion between the "ethernet-group"
clock and the actual Ethernet port inside the "ethernet-group". The
mv643xx_eth driver assumes we have a per-port clock gating scheme, while I
think we have a per "ethernet-group" clock gating scheme instead. Like you
said, I think this should be addressed separately.
IMHO, there should be a clocks property where ever you try to access registers,
i.e. in all three "parts" mv643xx_eth_shared (group), mv643xx_eth
(port) and mdio.
Since port depends on shared it would be ok to have it per group but that may
collide with other SoCs than Dove/Kirkwood that have per port clocks.
Ok, which means that we should also teach mv643xx_eth_shared_probe()
about it, as well as the orion-mdio driver. I don't have any particular
objections since it should just make things safer with respect to clocking.
Post by Simon Baatz
Is that separation (group/port) really required for any SoC?
Probably not, it was not clear when I looked at mv78xx0 if it uses two
ports per group or 4 groups and 1 port. Anyway, since we are re-using
the existing Device Tree binding definition and that the hardware
present itself as ethernet groups and ports, I don't see any problem
with keeping that difference since it allows for fine-grained
representation of the hardware.
Post by Simon Baatz
[snip]
Post by Simon Baatz
#if defined(CONFIG_HAVE_CLK)
mp->clk = clk_get(&pdev->dev, (pdev->id ? "1" : "0"));
if (!IS_ERR(mp->clk)) {
clk_prepare_enable(mp->clk);
mp->t_clk = clk_get_rate(mp->clk);
}
#endif
Which, if I understand correctly, works in the DT case because you
assign "clock-names" to the clocks in the DTS. However, I wonder
whether this works for any but the first Ethernet device.
Yes, it does. Assigned clocks from clocks property get a clock alias for
that device name (node name). Using anything else than NULL here is
IMHO just wrong. We should rather provide proper clock aliases for non-DT case.
Post by Simon Baatz
In the old platform device setup, the pdev->id was set when
initialiazing the platform_device structure in common.c. Where is
this done in the DT case?
Looks like you are right, in the DT case, I assume that we should lookup the
clock using NULL instead of "1" or "0" so we match any clock instead of a
specific one.
Yes.
[snip]
Post by Simon Baatz
snprintf(phy_id, sizeof(phy_id), PHY_ID_FMT,
"orion-mdio-mii", addr);
phydev = phy_connect(mp->dev, phy_id,
mv643xx_eth_adjust_link,
PHY_INTERFACE_MODE_GMII);
But "orion-mdio-mii:xx" is the name of the PHY if MDIO is setup via a
platform_device. I could not get this to work if the MDIO device is
setup via DT. Am I doing something wrong?
I just missed updating this part of the code to probe for PHYs. The board I
tested with uses a "PHY_NONE" configuration. I will add the missing bits for
of_phy_connect() to be called here.
I don't think that the ethernet controller should probe the PHY's on mdio-bus
at all. At least not for DT enabled platforms. I had a look at DT and non-DT
mdio-bus sources, and realized that there is a bus scan for non-DT only.
of_mdiobus_register requires you to set (and know) the PHY address.
One reason the Ethernet controller could do the probing is in the case
we need to apply quirks (e.g: using phydev->flags) for instance. This
can be done even after the MDIO bus driver did probe PHY devices though.
Post by Simon Baatz
I prepared a patch for of_mdio_register that will allow you to probe mdio and
assign phy addresses to each node found. Currently, the heuristic for probing
is: assign each phy node the next probed phy_addr starting with 0. But that
will not allow to e.g. set some PHY addresses and probe the rest.
Ok, we just need to make sure that this does not break any specific use
case, I don't think it does, since it seems to be more accurate or
equivalent to Ethernet driver doing the probing.
Post by Simon Baatz
We had a similar discussion whether to probe or not for DT nodes, and I guess
there also will be some discussion about the above patch. OTOH we could just
(again) ask users of every kirkwood/orion5x/dove board to tell their
phy addresses
and fail to probe the phy for new boards...
I will prepare a proper patch soon and post it on the corresponding lists.
Cool, thanks!
Post by Simon Baatz
Post by Simon Baatz
if (phy_addr == MV643XX_ETH_PHY_ADDR_DEFAULT) {
start = phy_addr_get(mp) & 0x1f;
num = 32;
} else {
...
MV643XX_ETH_PHY_ADDR_DEFAULT is defined as 0. However, many Kirkwood
devices use "MV643XX_ETH_PHY_ADDR(0)". If the module probe is
deferred in mv643xx_eth because the MDIO driver is not yet loaded,
all 32 PHY addresses are scanned without success. This is not needed
and clutters the log.
Ok, I am not sure how we can circumvent the log cluttering that happens,
what would be your suggestion?
My suggestion is to change MV643XX_ETH_PHY_ADDR_DEFAULT from a valid
phy address (0)
to something invalid (32). I understand that using 0 helps if you
don't want to set it in mv643xx's platform_data
but it is always difficult to rely on that if 0 is a valid number.
Changing the above to 32 should just work because most (all?) boards
using phy_scan should also
already use MV643XX_ETH_PHY_ADDR_DEFAULT. I also suggest to rename
current define to a
better name, e.g. MV643XX_ETH_PHY_ADDR_AUTOSCAN.
Sounds good to me.
--
Florian
Sebastian Hesselbarth
2013-04-05 20:35:41 UTC
Permalink
Post by Sebastian Hesselbarth
I don't think that the ethernet controller should probe the PHY's on mdio-bus
at all. At least not for DT enabled platforms. I had a look at DT and non-DT
mdio-bus sources, and realized that there is a bus scan for non-DT only.
of_mdiobus_register requires you to set (and know) the PHY address.
DT platforms should have the option to use the standard phy-phandle
#address-cells =<1>;
#size-cells =<0>;
compatible = "marvell,orion-mdio";
reg =<0x72004 0x84>;
status = "disabled";
+ reg =<1>;
+ device_type = "ethernet-phy";
+ };
};
#address-cells =<1>;
#size-cells =<0>;
compatible = "marvell,mv643xx-eth-block";
reg =<0x72000 0x4000>;
tx-csum-limit =<1600>;
status = "disabled";
device_type = "network";
compatible = "marvell,mv643xx-eth";
reg =<0>;
interrupts =<29>;
clocks =<&gate_clk 2>;
+ phy-handle =<&PHY1>;
};
};
When phy-handle is present the ethernet driver should not probe/scan for
phys.
There is standard code to handle all of this - an important gain is
that the phy driver now has access to a DT node and can apply
phy-specific properties.
The above is what I use as a modification of Florian's patches.
I compared of_mdiobus_register against mdiobus_register. The difference
is that DT version does not scan the bus for attached PHYs. That is ok,
if you know the phy_address of the PHY that you pass the handle of. But
in most cases there will be only one PHY on the mdiobus and especially
for new boards probing will help here.
Post by Sebastian Hesselbarth
We had a similar discussion whether to probe or not for DT nodes,
and I guess there also will be some discussion about the above
patch. OTOH we could just (again) ask users of every
kirkwood/orion5x/dove board to tell their phy addresses and fail to
probe the phy for new boards...
Maybe print a warning and call the no-DT phy probe code if phy-handle
is nor present?
I think it would be best to spam each probing result during mdiobus
scan to encourage people to edit the DT and put in the phy_addr
directly. IMHO it will be best to have bus scan on mdiobus rather than
ethernet driver.
Not sure this should be in the common code, phy probing is sketchy, it
shouldn't be encouraged, IMHO..
Actually, it is in common code (non-DT case) and I think passing the
phy_addr by DT node like above is best. But for boards you don't
know the address (yet) probing helps a lot. If all phy nodes have their
reg property set, no probing will be performed.

For testing mdio bus probe, I used

mdio {
...
ethphy: ethernet-phy {
reg = <32>;
};
};

And 32 should be defined as OF_PHY_ADDR_AUTOSCAN. It is an invalid
address as max phy_addr is 31. I also thought about a bool property
but passing an invalid reg property in SoC file allows to overwrite
it in board file with the actual address easily.
And AFAIK bool properties cannot be removed later on by board specific
nodes.

Sebastian
Jason Gunthorpe
2013-04-05 18:04:43 UTC
Permalink
Post by Sebastian Hesselbarth
I don't think that the ethernet controller should probe the PHY's on mdio-bus
at all. At least not for DT enabled platforms. I had a look at DT and non-DT
mdio-bus sources, and realized that there is a bus scan for non-DT only.
of_mdiobus_register requires you to set (and know) the PHY address.
DT platforms should have the option to use the standard phy-phandle
connection:


***@72004 {
#address-cells = <1>;
#size-cells = <0>;
compatible = "marvell,orion-mdio";
reg = <0x72004 0x84>;
status = "disabled";

+ PHY1: ethernet-***@1 {
+ reg = <1>;
+ device_type = "ethernet-phy";
+ };
};

ethernet-***@72000 {
#address-cells = <1>;
#size-cells = <0>;
compatible = "marvell,mv643xx-eth-block";
reg = <0x72000 0x4000>;
tx-csum-limit = <1600>;
status = "disabled";

egiga0: ***@0 {
device_type = "network";
compatible = "marvell,mv643xx-eth";
reg = <0>;
interrupts = <29>;
clocks = <&gate_clk 2>;
+ phy-handle = <&PHY1>;
};
};

When phy-handle is present the ethernet driver should not probe/scan for
phys.

There is standard code to handle all of this - an important gain is
that the phy driver now has access to a DT node and can apply
phy-specific properties.
Post by Sebastian Hesselbarth
We had a similar discussion whether to probe or not for DT nodes,
and I guess there also will be some discussion about the above
patch. OTOH we could just (again) ask users of every
kirkwood/orion5x/dove board to tell their phy addresses and fail to
probe the phy for new boards...
Maybe print a warning and call the no-DT phy probe code if phy-handle
is nor present?

Not sure this should be in the common code, phy probing is sketchy, it
shouldn't be encouraged, IMHO..

Jason
Florian Fainelli
2013-04-05 09:56:48 UTC
Permalink
Hello Simon,

First of all, thanks for getting these patches a try!
Post by Simon Baatz
Hi Florian
[snip]
Post by Simon Baatz
Post by Florian Fainelli
if (!mv643xx_eth_version_printed++)
pr_notice("MV-643xx 10/100/1000 ethernet driver version %s\n",
This is not related to your change, but there is a problem in this
function that has already been discussed in the past if I remember
correctly: The respective clock needs to be enabled here (at least
on Kirkwood), since accesses to the hardware are done below.
Enabling the clock only in mv643xx_eth_probe() is too late.
As said, this is not a problem introduced by your changes (and which
is currently circumvented by enabling the respective clocks in
kirkwood_legacy_clk_init() and kirkwood_ge0x_init()), but we might
want to fix this now to get rid of unconditionally enabling the GE
clocks in the DT case.
I think there may have been some confusion between the "ethernet-group"
clock and the actual Ethernet port inside the "ethernet-group". The
mv643xx_eth driver assumes we have a per-port clock gating scheme, while
I think we have a per "ethernet-group" clock gating scheme instead. Like
you said, I think this should be addressed separately.

[snip]
Post by Simon Baatz
#if defined(CONFIG_HAVE_CLK)
mp->clk = clk_get(&pdev->dev, (pdev->id ? "1" : "0"));
if (!IS_ERR(mp->clk)) {
clk_prepare_enable(mp->clk);
mp->t_clk = clk_get_rate(mp->clk);
}
#endif
Which, if I understand correctly, works in the DT case because you
assign "clock-names" to the clocks in the DTS. However, I wonder
whether this works for any but the first Ethernet device.
In the old platform device setup, the pdev->id was set when
initialiazing the platform_device structure in common.c. Where is
this done in the DT case?
Looks like you are right, in the DT case, I assume that we should lookup
the clock using NULL instead of "1" or "0" so we match any clock instead
of a specific one.

[snip]
Post by Simon Baatz
snprintf(phy_id, sizeof(phy_id), PHY_ID_FMT,
"orion-mdio-mii", addr);
phydev = phy_connect(mp->dev, phy_id, mv643xx_eth_adjust_link,
PHY_INTERFACE_MODE_GMII);
But "orion-mdio-mii:xx" is the name of the PHY if MDIO is setup via a
platform_device. I could not get this to work if the MDIO device is
setup via DT. Am I doing something wrong?
I just missed updating this part of the code to probe for PHYs. The
board I tested with uses a "PHY_NONE" configuration. I will add the
missing bits for of_phy_connect() to be called here.
Post by Simon Baatz
if (phy_addr == MV643XX_ETH_PHY_ADDR_DEFAULT) {
start = phy_addr_get(mp) & 0x1f;
num = 32;
} else {
...
MV643XX_ETH_PHY_ADDR_DEFAULT is defined as 0. However, many Kirkwood
devices use "MV643XX_ETH_PHY_ADDR(0)". If the module probe is
deferred in mv643xx_eth because the MDIO driver is not yet loaded,
all 32 PHY addresses are scanned without success. This is not needed
and clutters the log.
Ok, I am not sure how we can circumvent the log cluttering that happens,
what would be your suggestion?
--
Florian
Jason Cooper
2013-04-11 16:53:03 UTC
Permalink
Florian,
Hi all,
This patch serie implements mv643xx_eth device tree bindings. I opted for
the reuse of the bindings already defined in
Documentation/devicetree/bindings/marvell.txt so that we do not create
any confusion.
For reference, I have included the mv643xx-eth related nodes in the
corresponding Kirkwood, Dove and Orion5x .dtsi files so you can more
easily test on your own platforms.
I tested these on a custom 88F6181-based boards.
mv643xx_eth: add Device Tree bindings
mv643xx_eth: update Device Tree bindings documentation
ARM: kirkwood: add device node entries for the gigabit interfaces
ARM: orion5x: add gigabit ethernet device tree node
ARM: dove: add gigabit device tree nodes to dove.dtsi
Documentation/devicetree/bindings/marvell.txt | 25 +++++-
arch/arm/boot/dts/dove.dtsi | 25 ++++++
arch/arm/boot/dts/kirkwood.dtsi | 46 ++++++++++
arch/arm/boot/dts/orion5x.dtsi | 23 +++++
drivers/net/ethernet/marvell/mv643xx_eth.c | 120 ++++++++++++++++++++++++-
5 files changed, 234 insertions(+), 5 deletions(-)
How is the new version of this looking? Do you think you'll be able to
get it up in time for DaveM to take it into v3.10?

With this and Thomas' pci series, we will have Kirkwood fully converted
to devicetree, can begin removing board files, and finally begin
migrating everything over to mach-mvebu/. This will lead to the removal
of five directories under arch/arm/ (plat-orion, mach-kirkwood,
mach-orion5x, mach-dove, and mach-mv78xx0).

thx,

Jason.
Sebastian Hesselbarth
2013-04-11 17:09:54 UTC
Permalink
Post by Jason Cooper
This patch serie implements mv643xx_eth device tree bindings. I opted for
the reuse of the bindings already defined in
Documentation/devicetree/bindings/marvell.txt so that we do not create
any confusion.
How is the new version of this looking? Do you think you'll be able to
get it up in time for DaveM to take it into v3.10?
With this and Thomas' pci series, we will have Kirkwood fully converted
to devicetree, can begin removing board files, and finally begin
migrating everything over to mach-mvebu/. This will lead to the removal
of five directories under arch/arm/ (plat-orion, mach-kirkwood,
mach-orion5x, mach-dove, and mach-mv78xx0).
Jason,

I sent Florian an update of some of his patches earlier, based on
cleanup patches I submitted for mv643xx_eth while testing his patch set.
I think, the patch set will play nicely on ARM but without PPC guys involved
in testing it, I guess it will break something there.

Florian is reusing the DT bindings from PPC and they are compatible, but
there parsing is also done within arch/ppc/sysdev/mv64360-dev.c and
maybe somewhere else. The current DT patches for mv643xx_eth will
reparse some properties again (and may break eth on ppc platforms
using mv643xx_eth).

Sebastian
Thomas Petazzoni
2013-04-13 15:21:26 UTC
Permalink
Dear Jason Cooper,
Post by Jason Cooper
With this and Thomas' pci series, we will have Kirkwood fully
converted to devicetree, can begin removing board files, and finally
begin migrating everything over to mach-mvebu/. This will lead to
the removal of five directories under arch/arm/ (plat-orion,
mach-kirkwood, mach-orion5x, mach-dove, and mach-mv78xx0).
No, we can't remove mach-orion5x and mach-mv78xx0 for now, they have
not been converted at all in terms of gpio/pinmux support. I've started
writing some pinmux code for orion5x but it's not ready.

I don't think we should rush in doing this merge into mach-mvebu. I'd
prefer to have the following conditions be met before a platform gets
merged into mach-mvebu:

* The mach-<foo> directory no longer depends on anything in
plat-orion. For mach-kirkwood, things are OK (for the DT platforms)
for GPIO, MPP and PCIe, but some work remains for the IRQ controller
driver and the timer driver.

* All boards have been converted to the Device Tree. For
mach-kirkwood, we're getting closer.

Once a given mach-<foo> platform meets these conditions, it will be a
clean platform, and we can merge it into mach-mvebu without any
problem.

So let's continue the cleanup work, conversion to DT, usage of drivers
in drivers/, improvement of pinmux to support orion5x/mv78xx0, and do
the move per-platform, once they are ready.

What do you think?

Thomas
--
Thomas Petazzoni, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com
Jason Cooper
2013-04-13 19:00:37 UTC
Permalink
Post by Thomas Petazzoni
Dear Jason Cooper,
Post by Jason Cooper
With this and Thomas' pci series, we will have Kirkwood fully
converted to devicetree, can begin removing board files, and finally
begin migrating everything over to mach-mvebu/. This will lead to
the removal of five directories under arch/arm/ (plat-orion,
mach-kirkwood, mach-orion5x, mach-dove, and mach-mv78xx0).
No, we can't remove mach-orion5x and mach-mv78xx0 for now, they have
not been converted at all in terms of gpio/pinmux support. I've started
writing some pinmux code for orion5x but it's not ready.
I don't think we should rush in doing this merge into mach-mvebu. I'd
prefer to have the following conditions be met before a platform gets
* The mach-<foo> directory no longer depends on anything in
plat-orion. For mach-kirkwood, things are OK (for the DT platforms)
for GPIO, MPP and PCIe, but some work remains for the IRQ controller
driver and the timer driver.
* All boards have been converted to the Device Tree. For
mach-kirkwood, we're getting closer.
Once a given mach-<foo> platform meets these conditions, it will be a
clean platform, and we can merge it into mach-mvebu without any
problem.
So let's continue the cleanup work, conversion to DT, usage of drivers
in drivers/, improvement of pinmux to support orion5x/mv78xx0, and do
the move per-platform, once they are ready.
What do you think?
I agree completely. I was simply restating the longview goal of the
work we are doing (above and beyond adding armadaXP/370). I probably
should have given a time reference for "This will lead to..." :)

Also, I have a feeling that not all legacy boards will get converted
over. If there is no interest or no way to test, certains boards may
get deprecated.

thx,

Jason.
Ben Hutchings
2013-04-15 03:07:14 UTC
Permalink
Post by Jason Cooper
Post by Thomas Petazzoni
Dear Jason Cooper,
Post by Jason Cooper
With this and Thomas' pci series, we will have Kirkwood fully
converted to devicetree, can begin removing board files, and finally
begin migrating everything over to mach-mvebu/. This will lead to
the removal of five directories under arch/arm/ (plat-orion,
mach-kirkwood, mach-orion5x, mach-dove, and mach-mv78xx0).
No, we can't remove mach-orion5x and mach-mv78xx0 for now, they have
not been converted at all in terms of gpio/pinmux support. I've started
writing some pinmux code for orion5x but it's not ready.
[...]
Post by Jason Cooper
Also, I have a feeling that not all legacy boards will get converted
over. If there is no interest or no way to test, certains boards may
get deprecated.
Debian supports many Kirkwood and Orion 5x systems. A call for testing
on the debian-***@lists.debian.org list might be worthwhile.

I would be very glad to see kirkwood, orion5x and mv78xx0 merged - we
build natively and this takes about 8 hours for each configuration.

Ben.
--
Ben Hutchings
The first rule of tautology club is the first rule of tautology club.
Jason Cooper
2013-04-15 13:43:25 UTC
Permalink
Post by Ben Hutchings
Post by Jason Cooper
Post by Thomas Petazzoni
Dear Jason Cooper,
Post by Jason Cooper
With this and Thomas' pci series, we will have Kirkwood fully
converted to devicetree, can begin removing board files, and finally
begin migrating everything over to mach-mvebu/. This will lead to
the removal of five directories under arch/arm/ (plat-orion,
mach-kirkwood, mach-orion5x, mach-dove, and mach-mv78xx0).
No, we can't remove mach-orion5x and mach-mv78xx0 for now, they have
not been converted at all in terms of gpio/pinmux support. I've started
writing some pinmux code for orion5x but it's not ready.
[...]
Post by Jason Cooper
Also, I have a feeling that not all legacy boards will get converted
over. If there is no interest or no way to test, certains boards may
get deprecated.
Debian supports many Kirkwood and Orion 5x systems. A call for testing
definitely.
Post by Ben Hutchings
I would be very glad to see kirkwood, orion5x and mv78xx0 merged - we
build natively and this takes about 8 hours for each configuration.
That's the plan, build an armv5 kernel, and dtb's for all the boards.
Then, an armv7 kernel for the armadaXP/370 boards, etc.

thx,

Jason.
Thomas Petazzoni
2013-04-15 10:00:11 UTC
Permalink
Dear Jason Cooper,
Post by Jason Cooper
Post by Thomas Petazzoni
So let's continue the cleanup work, conversion to DT, usage of
drivers in drivers/, improvement of pinmux to support
orion5x/mv78xx0, and do the move per-platform, once they are ready.
What do you think?
I agree completely. I was simply restating the longview goal of the
work we are doing (above and beyond adding armadaXP/370). I probably
should have given a time reference for "This will lead to..." :)
Ok. I definitely agree with the long-term goal.
Post by Jason Cooper
Also, I have a feeling that not all legacy boards will get converted
over. If there is no interest or no way to test, certains boards may
get deprecated.
I think for many of them, we can do a 'blind' conversion to DT, and ask
the users who have posted patches or even submitted support for those
boards to test the DT. But I don't think we should move things into
mach-mvebu if there are still legacy non-DT Kirkwood platforms
supported in mach-kirkwood. So either we convert them to the DT, or we
remove the support for them if no-one is really interested. But I
believe in most cases, converting them to DT should be quite easy.

Best regards,

Thomas
--
Thomas Petazzoni, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com
Sebastian Hesselbarth
2013-05-06 15:33:33 UTC
Permalink
This patch set picks up work by Florian Fainelli bringing full DT
support to mv643xx_eth and Marvell SoCs using it.

The current patch set drops Florian's device tree conversions for
Kirkwood, Dove, and Orion5x in favour of split patches for board
files and board descriptor files.

Device tree conversion for Dove and Kirkwood is added. Dove has
been fully tested, while Kirkwood is compile-tested only.

Florian Fainelli (2):
net: mv643xx_eth: add Device Tree bindings
net: mv643xx_eth: update Device Tree bindings documentation

Sebastian Hesselbarth (5):
ARM: dove: remove legacy mv643xx_eth setup
ARM: dove: add gigabit ethernet and mvmdio device tree nodes
ARM: kirkwood: remove legacy mv643xx_eth board setup
ARM: kirkwood: add gigabit ethernet and mvmdio device tree nodes
ARM: kirkwood: remove legacy clk alias for mv643xx_eth

Documentation/devicetree/bindings/marvell.txt | 22 ++++-
arch/arm/boot/dts/dove-cubox.dts | 8 ++
arch/arm/boot/dts/dove.dtsi | 35 +++++++
arch/arm/boot/dts/kirkwood-cloudbox.dts | 15 +++
arch/arm/boot/dts/kirkwood-dnskw.dtsi | 15 +++
arch/arm/boot/dts/kirkwood-dockstar.dts | 15 +++
arch/arm/boot/dts/kirkwood-dreamplug.dts | 26 +++++
arch/arm/boot/dts/kirkwood-goflexnet.dts | 15 +++
.../arm/boot/dts/kirkwood-guruplug-server-plus.dts | 26 +++++
arch/arm/boot/dts/kirkwood-ib62x0.dts | 15 +++
arch/arm/boot/dts/kirkwood-iconnect.dts | 15 +++
arch/arm/boot/dts/kirkwood-iomega_ix2_200.dts | 22 ++++
arch/arm/boot/dts/kirkwood-is2.dts | 2 +
arch/arm/boot/dts/kirkwood-km_kirkwood.dts | 15 +++
arch/arm/boot/dts/kirkwood-lsxl.dtsi | 26 +++++
arch/arm/boot/dts/kirkwood-mplcec4.dts | 25 +++++
.../boot/dts/kirkwood-netgear_readynas_duo_v2.dts | 15 +++
arch/arm/boot/dts/kirkwood-ns2-common.dtsi | 15 +++
arch/arm/boot/dts/kirkwood-ns2.dts | 2 +
arch/arm/boot/dts/kirkwood-ns2lite.dts | 2 +
arch/arm/boot/dts/kirkwood-ns2max.dts | 2 +
arch/arm/boot/dts/kirkwood-ns2mini.dts | 2 +
arch/arm/boot/dts/kirkwood-openblocks_a6.dts | 15 +++
arch/arm/boot/dts/kirkwood-topkick.dts | 15 +++
arch/arm/boot/dts/kirkwood-ts219-6281.dts | 4 +-
arch/arm/boot/dts/kirkwood-ts219-6282.dts | 4 +-
arch/arm/boot/dts/kirkwood-ts219.dtsi | 15 +++
arch/arm/boot/dts/kirkwood.dtsi | 52 ++++++++++
arch/arm/mach-dove/board-dt.c | 5 -
arch/arm/mach-kirkwood/board-dnskw.c | 7 --
arch/arm/mach-kirkwood/board-dockstar.c | 9 --
arch/arm/mach-kirkwood/board-dreamplug.c | 14 ---
arch/arm/mach-kirkwood/board-dt.c | 16 ---
arch/arm/mach-kirkwood/board-goflexnet.c | 9 --
arch/arm/mach-kirkwood/board-guruplug.c | 14 ---
arch/arm/mach-kirkwood/board-ib62x0.c | 9 --
arch/arm/mach-kirkwood/board-iconnect.c | 6 -
arch/arm/mach-kirkwood/board-iomega_ix2_200.c | 16 ---
arch/arm/mach-kirkwood/board-km_kirkwood.c | 7 --
arch/arm/mach-kirkwood/board-lsxl.c | 12 --
arch/arm/mach-kirkwood/board-mplcec4.c | 11 --
arch/arm/mach-kirkwood/board-ns2.c | 13 ---
arch/arm/mach-kirkwood/board-openblocks_a6.c | 9 --
arch/arm/mach-kirkwood/board-readynas.c | 6 -
arch/arm/mach-kirkwood/board-ts219.c | 13 ---
arch/arm/mach-kirkwood/board-usi_topkick.c | 9 --
drivers/net/ethernet/marvell/mv643xx_eth.c | 108 +++++++++++++++++++-
include/linux/mv643xx_eth.h | 3 +
48 files changed, 544 insertions(+), 192 deletions(-)
---
Cc: Grant Likely <grant.likely-QSEj5FYQhm4dnm+***@public.gmane.org>
Cc: Rob Herring <rob.herring-bsGFqQB8/***@public.gmane.org>
Cc: Rob Landley <rob-VoJi6FS/***@public.gmane.org>
Cc: Lennert Buytenhek <buytenh-OLH4Qvv75CYX/***@public.gmane.org>
Cc: David Miller <davem-fT/PcQaiUtIeIZ0/***@public.gmane.org>
Cc: Florian Fainelli <florian-***@public.gmane.org>
Cc: Arnaud Patard <arnaud.patard-dQbF7i+***@public.gmane.org>
Cc: Russell King <linux-lFZ/***@public.gmane.org>
Cc: Jason Cooper <jason-***@public.gmane.org>
Cc: Andrew Lunn <andrew-***@public.gmane.org>
Cc: Jean-Francois Moine <moinejf-***@public.gmane.org>
Cc: Thomas Petazzoni <thomas.petazzoni-wi1+55ScJUtKEb57/***@public.gmane.org>
Cc: Simon Guinot <simon.guinot-***@public.gmane.org>
Cc: Jamie Lentin <jm-Pj/***@public.gmane.org>
Cc: Michael Walle <michael-***@public.gmane.org>
Cc: Eric Hutter <hutter.eric-***@public.gmane.org>
Cc: Joshua Coombs <josh.coombs-***@public.gmane.org>
Cc: Willy Tarreau <***@1wt.eu>
Cc: Simon Baatz <gmbnomis-***@public.gmane.org>
Cc: Alan M Butler <alanbutty12-***@public.gmane.org>
Cc: Nigel Roberts <nigel-BZPLJ9//***@public.gmane.org>
Cc: Valentin Longchamp <valentin.longchamp-SkAbAL50j+***@public.gmane.org>
Cc: Stefan Peter <s.peter-***@public.gmane.org>
Cc: Arnaud Ebalard <arno-***@public.gmane.org>
Cc: Nobuhiro Iwamatsu <iwamatsu-+***@public.gmane.org>
Cc: netdev-***@public.gmane.org
Cc: devicetree-discuss-uLR06cmDAlY/***@public.gmane.org
Cc: linux-doc-***@public.gmane.org
Cc: linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+***@public.gmane.org
Cc: linux-kernel-***@public.gmane.org
--
1.7.2.5
Sebastian Hesselbarth
2013-05-06 15:33:34 UTC
Permalink
From: Florian Fainelli <florian-***@public.gmane.org>

This patch adds Device Tree bindings following the already defined
bindings at Documentation/devicetree/bindings/marvell.txt. The binding
documentation is also enhanced with new optionnal properties required
for supporting certain devices (RX/TX queue and SRAM). Since we now have
proper support for the orion MDIO bus driver, there is no need to fiddle
around with device tree phandles. PHY-less (MAC connected to switch)
configurations are supported by not specifying any phy phandle for an
ethernet node.

Signed-off-by: Florian Fainelli <florian-***@public.gmane.org>
Signed-off-by: Sebastian Hesselbarth <sebastian.hesselbarth-***@public.gmane.org>
---
Changelog:
v2->v3:
- rebase on top of mv643xx_eth clean-ups
- do not reparse existing platform_data
- use managed devm_kzalloc for parsed platform_data
- use of_property_read_u32 where applicable
- add phy_node to platform_data
- use of_connect_phy if DT phy node was found

v1->v2:
- properly ifdef of_platform_bus_probe with CONFIG_OF
- handle of_platform_bus_probe errors and cleanup accordingly
- use of_property_read_u32 where applicable
- parse "duplex" and "speed" property in PHY-less configuration

Cc: Grant Likely <grant.likely-QSEj5FYQhm4dnm+***@public.gmane.org>
Cc: Rob Herring <rob.herring-bsGFqQB8/***@public.gmane.org>
Cc: Rob Landley <rob-VoJi6FS/***@public.gmane.org>
Cc: Lennert Buytenhek <buytenh-OLH4Qvv75CYX/***@public.gmane.org>
Cc: David Miller <davem-fT/PcQaiUtIeIZ0/***@public.gmane.org>
Cc: Florian Fainelli <florian-***@public.gmane.org>
Cc: Arnaud Patard <arnaud.patard-dQbF7i+***@public.gmane.org>
Cc: Russell King <linux-lFZ/***@public.gmane.org>
Cc: Jason Cooper <jason-***@public.gmane.org>
Cc: Andrew Lunn <andrew-***@public.gmane.org>
Cc: Jean-Francois Moine <moinejf-***@public.gmane.org>
Cc: Thomas Petazzoni <thomas.petazzoni-wi1+55ScJUtKEb57/***@public.gmane.org>
Cc: Simon Guinot <simon.guinot-***@public.gmane.org>
Cc: Jamie Lentin <jm-Pj/***@public.gmane.org>
Cc: Michael Walle <michael-***@public.gmane.org>
Cc: Eric Hutter <hutter.eric-***@public.gmane.org>
Cc: Joshua Coombs <josh.coombs-***@public.gmane.org>
Cc: Willy Tarreau <***@1wt.eu>
Cc: Simon Baatz <gmbnomis-***@public.gmane.org>
Cc: Alan M Butler <alanbutty12-***@public.gmane.org>
Cc: Nigel Roberts <nigel-BZPLJ9//***@public.gmane.org>
Cc: Valentin Longchamp <valentin.longchamp-SkAbAL50j+***@public.gmane.org>
Cc: Stefan Peter <s.peter-***@public.gmane.org>
Cc: Arnaud Ebalard <arno-***@public.gmane.org>
Cc: Nobuhiro Iwamatsu <iwamatsu-+***@public.gmane.org>
Cc: netdev-***@public.gmane.org
Cc: devicetree-discuss-uLR06cmDAlY/***@public.gmane.org
Cc: linux-doc-***@public.gmane.org
Cc: linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+***@public.gmane.org
Cc: linux-kernel-***@public.gmane.org
---
Documentation/devicetree/bindings/marvell.txt | 22 +++++-
drivers/net/ethernet/marvell/mv643xx_eth.c | 108 ++++++++++++++++++++++++-
include/linux/mv643xx_eth.h | 3 +
3 files changed, 128 insertions(+), 5 deletions(-)

diff --git a/Documentation/devicetree/bindings/marvell.txt b/Documentation/devicetree/bindings/marvell.txt
index f7a0da6..73ea12f 100644
--- a/Documentation/devicetree/bindings/marvell.txt
+++ b/Documentation/devicetree/bindings/marvell.txt
@@ -112,11 +112,13 @@ prefixed with the string "marvell,", for Marvell Technology Group Ltd.
Required properties:
- #address-cells : <1>
- #size-cells : <0>
- - compatible : "marvell,mv64360-eth-block"
+ - compatible : "marvell,mv64360-eth-block", "marvell,mv643xx-eth-block"
- reg : Offset and length of the register set for this block

Optional properties:
- clocks : Phandle to the clock control device and gate bit
+ - tx-csum-limit : Hardware limit above which transmit checksumming
+ is disabled.

Example Discovery Ethernet block node:
ethernet-***@2000 {
@@ -133,7 +135,7 @@ prefixed with the string "marvell,", for Marvell Technology Group Ltd.

Required properties:
- device_type : Should be "network".
- - compatible : Should be "marvell,mv64360-eth".
+ - compatible : Should be "marvell,mv64360-eth", "marvell,mv643xx-eth"
- reg : Should be <0>, <1>, or <2>, according to which registers
within the silicon block the device uses.
- interrupts : <a> where a is the interrupt number for the port.
@@ -143,6 +145,22 @@ prefixed with the string "marvell,", for Marvell Technology Group Ltd.
controller.
- local-mac-address : 6 bytes, MAC address

+ Optional properties:
+ - clocks : Phandle to the clock control device and gate bit
+ - clock-names : String describing the clock gate bit
+ - speed : Speed to force the link (10, 100, 1000), used when no
+ phy property is defined
+ - duplex : Duplex to force the link (0: half, 1: full), used when no
+ phy property is defined
+ - rx-queue-count : number of RX queues to use
+ - tx-queue-count : number of TX queues to use
+ - rx-queue-size : size of the RX queue (in bytes)
+ - tx-queue-size : size of the TX queue (in bytes)
+ - rx-sram-addr : address of the SRAM for RX path (non 0 means used)
+ - rx-sram-size : size of the SRAM for RX path (non 0 means used)
+ - tx-sram-addr : address of the SRAM for TX path (non 0 means used)
+ - tx-sram-size : size of the SRAM for TX path (non 0 means used)
+
Example Discovery Ethernet port node:
***@0 {
device_type = "network";
diff --git a/drivers/net/ethernet/marvell/mv643xx_eth.c b/drivers/net/ethernet/marvell/mv643xx_eth.c
index d0afeea..efa5a2f 100644
--- a/drivers/net/ethernet/marvell/mv643xx_eth.c
+++ b/drivers/net/ethernet/marvell/mv643xx_eth.c
@@ -60,6 +60,11 @@
#include <linux/types.h>
#include <linux/slab.h>
#include <linux/clk.h>
+#include <linux/stringify.h>
+#include <linux/of.h>
+#include <linux/of_platform.h>
+#include <linux/of_mdio.h>
+#include <linux/of_net.h>

static char mv643xx_eth_driver_name[] = "mv643xx_eth";
static char mv643xx_eth_driver_version[] = "1.4";
@@ -2450,13 +2455,22 @@ static void infer_hw_params(struct mv643xx_eth_shared_private *msp)
}
}

+static const struct of_device_id mv643xx_eth_match[] = {
+ { .compatible = "marvell,mv64360-eth" },
+ { .compatible = "marvell,mv643xx-eth" },
+ { },
+};
+MODULE_DEVICE_TABLE(of, mv643xx_eth_match);
+
static int mv643xx_eth_shared_probe(struct platform_device *pdev)
{
static int mv643xx_eth_version_printed;
+ struct device_node *np = pdev->dev.of_node;
struct mv643xx_eth_shared_platform_data *pd = pdev->dev.platform_data;
struct mv643xx_eth_shared_private *msp;
const struct mbus_dram_target_info *dram;
struct resource *res;
+ int tx_csum_limit = 0;

if (!mv643xx_eth_version_printed++)
pr_notice("MV-643xx 10/100/1000 ethernet driver version %s\n",
@@ -2485,13 +2499,21 @@ static int mv643xx_eth_shared_probe(struct platform_device *pdev)
if (dram)
mv643xx_eth_conf_mbus_windows(msp, dram);

- msp->tx_csum_limit = (pd != NULL && pd->tx_csum_limit) ?
- pd->tx_csum_limit : 9 * 1024;
+ if (np)
+ of_property_read_u32(np, "tx-csum-limit", &tx_csum_limit);
+ else
+ tx_csum_limit = pd->tx_csum_limit;
+
+ msp->tx_csum_limit = tx_csum_limit ? tx_csum_limit : 9 * 1024;
infer_hw_params(msp);

platform_set_drvdata(pdev, msp);

+#ifdef CONFIG_OF
+ return of_platform_bus_probe(np, mv643xx_eth_match, &pdev->dev);
+#else
return 0;
+#endif
}

static int mv643xx_eth_shared_remove(struct platform_device *pdev)
@@ -2505,12 +2527,20 @@ static int mv643xx_eth_shared_remove(struct platform_device *pdev)
return 0;
}

+static const struct of_device_id mv643xx_eth_shared_match[] = {
+ { .compatible = "marvell,mv64360-eth-block" },
+ { .compatible = "marvell,mv643xx-eth-block" },
+ { },
+};
+MODULE_DEVICE_TABLE(of, mv643xx_eth_shared_match);
+
static struct platform_driver mv643xx_eth_shared_driver = {
.probe = mv643xx_eth_shared_probe,
.remove = mv643xx_eth_shared_remove,
.driver = {
.name = MV643XX_ETH_SHARED_NAME,
.owner = THIS_MODULE,
+ .of_match_table = of_match_ptr(mv643xx_eth_shared_match),
},
};

@@ -2669,6 +2699,68 @@ static const struct net_device_ops mv643xx_eth_netdev_ops = {
#endif
};

+#ifdef CONFIG_OF
+static int mv643xx_eth_of_probe(struct platform_device *pdev)
+{
+ struct mv643xx_eth_platform_data *pd;
+ struct device_node *np = pdev->dev.of_node;
+ struct device_node *shared = of_get_parent(np);
+ const int *prop;
+ const char *mac_addr;
+
+ if (pdev->dev.platform_data || !pdev->dev.of_node)
+ return 0;
+
+ pd = devm_kzalloc(&pdev->dev, sizeof(*pd), GFP_KERNEL);
+ if (!pd)
+ return -ENOMEM;
+
+ pdev->dev.platform_data = pd;
+
+ pd->shared = of_find_device_by_node(shared);
+ if (!pd->shared)
+ return -ENODEV;
+
+ if (of_property_read_u32(np, "reg", &pd->port_number))
+ return -EINVAL;
+
+ pd->phy_node = of_parse_phandle(np, "phy", 0);
+ if (!pd->phy_node) {
+ pd->phy_addr = MV643XX_ETH_PHY_NONE;
+
+ of_property_read_u32(np, "speed", &pd->speed);
+ of_property_read_u32(np, "duplex", &pd->duplex);
+ }
+
+ mac_addr = of_get_mac_address(np);
+ if (mac_addr)
+ memcpy(pd->mac_addr, mac_addr, ETH_ALEN);
+
+#define rx_tx_queue_sram_property(_name) \
+ do { \
+ prop = of_get_property(np, __stringify(_name), NULL); \
+ if (prop) \
+ pd->_name = be32_to_cpup(prop); \
+ } while (0)
+
+ rx_tx_queue_sram_property(rx_queue_count);
+ rx_tx_queue_sram_property(tx_queue_count);
+ rx_tx_queue_sram_property(rx_queue_size);
+ rx_tx_queue_sram_property(tx_queue_size);
+ rx_tx_queue_sram_property(rx_sram_addr);
+ rx_tx_queue_sram_property(rx_sram_size);
+ rx_tx_queue_sram_property(tx_sram_addr);
+ rx_tx_queue_sram_property(rx_sram_size);
+
+ return 0;
+}
+#else
+static inline int mv643xx_eth_of_probe(struct platform_device *dev)
+{
+ return 0;
+}
+#endif
+
static int mv643xx_eth_probe(struct platform_device *pdev)
{
struct mv643xx_eth_platform_data *pd;
@@ -2677,6 +2769,10 @@ static int mv643xx_eth_probe(struct platform_device *pdev)
struct resource *res;
int err;

+ err = mv643xx_eth_of_probe(pdev);
+ if (err)
+ return err;
+
pd = pdev->dev.platform_data;
if (pd == NULL) {
dev_err(&pdev->dev, "no mv643xx_eth_platform_data\n");
@@ -2717,7 +2813,12 @@ static int mv643xx_eth_probe(struct platform_device *pdev)
netif_set_real_num_rx_queues(dev, mp->rxq_count);

if (pd->phy_addr != MV643XX_ETH_PHY_NONE) {
- mp->phy = phy_scan(mp, pd->phy_addr);
+ if (pd->phy_node)
+ mp->phy = of_phy_connect(mp->dev, pd->phy_node,
+ mv643xx_eth_adjust_link, 0,
+ PHY_INTERFACE_MODE_GMII);
+ else
+ mp->phy = phy_scan(mp, pd->phy_addr);

if (IS_ERR(mp->phy)) {
err = PTR_ERR(mp->phy);
@@ -2837,6 +2938,7 @@ static struct platform_driver mv643xx_eth_driver = {
.driver = {
.name = MV643XX_ETH_NAME,
.owner = THIS_MODULE,
+ .of_match_table = of_match_ptr(mv643xx_eth_match),
},
};

diff --git a/include/linux/mv643xx_eth.h b/include/linux/mv643xx_eth.h
index 141d395..c006d3d 100644
--- a/include/linux/mv643xx_eth.h
+++ b/include/linux/mv643xx_eth.h
@@ -30,6 +30,8 @@ struct mv643xx_eth_shared_platform_data {
#define MV643XX_ETH_PHY_ADDR(x) (0x80 | (x))
#define MV643XX_ETH_PHY_NONE 0xff

+struct device_node;
+
struct mv643xx_eth_platform_data {
/*
* Pointer back to our parent instance, and our port number.
@@ -41,6 +43,7 @@ struct mv643xx_eth_platform_data {
* Whether a PHY is present, and if yes, at which address.
*/
int phy_addr;
+ struct device_node *phy_node;

/*
* Use this MAC address if it is valid, overriding the
--
1.7.2.5
Simon Baatz
2013-05-20 21:19:31 UTC
Permalink
Hi Sebastian,
Post by Florian Fainelli
This patch adds Device Tree bindings following the already defined
bindings at Documentation/devicetree/bindings/marvell.txt. The binding
documentation is also enhanced with new optionnal properties required
for supporting certain devices (RX/TX queue and SRAM). Since we now have
proper support for the orion MDIO bus driver, there is no need to fiddle
around with device tree phandles. PHY-less (MAC connected to switch)
configurations are supported by not specifying any phy phandle for an
ethernet node.
---
- rebase on top of mv643xx_eth clean-ups
- do not reparse existing platform_data
- use managed devm_kzalloc for parsed platform_data
- use of_property_read_u32 where applicable
- add phy_node to platform_data
- use of_connect_phy if DT phy node was found
- properly ifdef of_platform_bus_probe with CONFIG_OF
- handle of_platform_bus_probe errors and cleanup accordingly
- use of_property_read_u32 where applicable
- parse "duplex" and "speed" property in PHY-less configuration
---
Documentation/devicetree/bindings/marvell.txt | 22 +++++-
drivers/net/ethernet/marvell/mv643xx_eth.c | 108 ++++++++++++++++++++++++-
include/linux/mv643xx_eth.h | 3 +
3 files changed, 128 insertions(+), 5 deletions(-)
diff --git a/Documentation/devicetree/bindings/marvell.txt b/Documentation/devicetree/bindings/marvell.txt
index f7a0da6..73ea12f 100644
--- a/Documentation/devicetree/bindings/marvell.txt
+++ b/Documentation/devicetree/bindings/marvell.txt
@@ -112,11 +112,13 @@ prefixed with the string "marvell,", for Marvell Technology Group Ltd.
- #address-cells : <1>
- #size-cells : <0>
- - compatible : "marvell,mv64360-eth-block"
+ - compatible : "marvell,mv64360-eth-block", "marvell,mv643xx-eth-block"
- reg : Offset and length of the register set for this block
- clocks : Phandle to the clock control device and gate bit
+ - tx-csum-limit : Hardware limit above which transmit checksumming
+ is disabled.
@@ -133,7 +135,7 @@ prefixed with the string "marvell,", for Marvell Technology Group Ltd.
- device_type : Should be "network".
- - compatible : Should be "marvell,mv64360-eth".
+ - compatible : Should be "marvell,mv64360-eth", "marvell,mv643xx-eth"
- reg : Should be <0>, <1>, or <2>, according to which registers
within the silicon block the device uses.
- interrupts : <a> where a is the interrupt number for the port.
@@ -143,6 +145,22 @@ prefixed with the string "marvell,", for Marvell Technology Group Ltd.
controller.
- local-mac-address : 6 bytes, MAC address
+ - clocks : Phandle to the clock control device and gate bit
+ - clock-names : String describing the clock gate bit
+ - speed : Speed to force the link (10, 100, 1000), used when no
+ phy property is defined
+ - duplex : Duplex to force the link (0: half, 1: full), used when no
+ phy property is defined
+ - rx-queue-count : number of RX queues to use
+ - tx-queue-count : number of TX queues to use
+ - rx-queue-size : size of the RX queue (in bytes)
+ - tx-queue-size : size of the TX queue (in bytes)
+ - rx-sram-addr : address of the SRAM for RX path (non 0 means used)
+ - rx-sram-size : size of the SRAM for RX path (non 0 means used)
+ - tx-sram-addr : address of the SRAM for TX path (non 0 means used)
+ - tx-sram-size : size of the SRAM for TX path (non 0 means used)
+
device_type = "network";
diff --git a/drivers/net/ethernet/marvell/mv643xx_eth.c b/drivers/net/ethernet/marvell/mv643xx_eth.c
index d0afeea..efa5a2f 100644
--- a/drivers/net/ethernet/marvell/mv643xx_eth.c
+++ b/drivers/net/ethernet/marvell/mv643xx_eth.c
@@ -60,6 +60,11 @@
#include <linux/types.h>
#include <linux/slab.h>
#include <linux/clk.h>
+#include <linux/stringify.h>
+#include <linux/of.h>
+#include <linux/of_platform.h>
+#include <linux/of_mdio.h>
+#include <linux/of_net.h>
static char mv643xx_eth_driver_name[] = "mv643xx_eth";
static char mv643xx_eth_driver_version[] = "1.4";
@@ -2450,13 +2455,22 @@ static void infer_hw_params(struct mv643xx_eth_shared_private *msp)
}
}
+static const struct of_device_id mv643xx_eth_match[] = {
+ { .compatible = "marvell,mv64360-eth" },
+ { .compatible = "marvell,mv643xx-eth" },
+ { },
+};
+MODULE_DEVICE_TABLE(of, mv643xx_eth_match);
+
static int mv643xx_eth_shared_probe(struct platform_device *pdev)
{
static int mv643xx_eth_version_printed;
+ struct device_node *np = pdev->dev.of_node;
struct mv643xx_eth_shared_platform_data *pd = pdev->dev.platform_data;
struct mv643xx_eth_shared_private *msp;
const struct mbus_dram_target_info *dram;
struct resource *res;
+ int tx_csum_limit = 0;
if (!mv643xx_eth_version_printed++)
pr_notice("MV-643xx 10/100/1000 ethernet driver version %s\n",
@@ -2485,13 +2499,21 @@ static int mv643xx_eth_shared_probe(struct platform_device *pdev)
if (dram)
mv643xx_eth_conf_mbus_windows(msp, dram);
- msp->tx_csum_limit = (pd != NULL && pd->tx_csum_limit) ?
- pd->tx_csum_limit : 9 * 1024;
+ if (np)
+ of_property_read_u32(np, "tx-csum-limit", &tx_csum_limit);
+ else
+ tx_csum_limit = pd->tx_csum_limit;
+
+ msp->tx_csum_limit = tx_csum_limit ? tx_csum_limit : 9 * 1024;
infer_hw_params(msp);
platform_set_drvdata(pdev, msp);
+#ifdef CONFIG_OF
+ return of_platform_bus_probe(np, mv643xx_eth_match, &pdev->dev);
I have tested this on Kirkwood (Sheevaplug eSATA). When using
mv643xx_eth as a module with a built-in mvmdio the GbE port works.
However, when unloading the mv643xx_eth module and loading it again,
the second call to of_platform_bus_probe() results in a warning:

[ 190.542992] WARNING: at fs/sysfs/dir.c:530 sysfs_add_one+0x7c/0xa4()
[ 190.549372] sysfs: cannot create duplicate filename '/devices/ocp.0/f1072000.
ethernet-controller/0.ethernet-port'

(Looks more like a problem of of_platform_bus_probe() than a problem
in the driver?)
Post by Florian Fainelli
+#else
return 0;
+#endif
}
static int mv643xx_eth_shared_remove(struct platform_device *pdev)
@@ -2505,12 +2527,20 @@ static int mv643xx_eth_shared_remove(struct platform_device *pdev)
return 0;
}
+static const struct of_device_id mv643xx_eth_shared_match[] = {
+ { .compatible = "marvell,mv64360-eth-block" },
+ { .compatible = "marvell,mv643xx-eth-block" },
+ { },
+};
+MODULE_DEVICE_TABLE(of, mv643xx_eth_shared_match);
+
static struct platform_driver mv643xx_eth_shared_driver = {
.probe = mv643xx_eth_shared_probe,
.remove = mv643xx_eth_shared_remove,
.driver = {
.name = MV643XX_ETH_SHARED_NAME,
.owner = THIS_MODULE,
+ .of_match_table = of_match_ptr(mv643xx_eth_shared_match),
},
};
@@ -2669,6 +2699,68 @@ static const struct net_device_ops mv643xx_eth_netdev_ops = {
#endif
};
+#ifdef CONFIG_OF
+static int mv643xx_eth_of_probe(struct platform_device *pdev)
+{
+ struct mv643xx_eth_platform_data *pd;
+ struct device_node *np = pdev->dev.of_node;
+ struct device_node *shared = of_get_parent(np);
+ const int *prop;
+ const char *mac_addr;
+
+ if (pdev->dev.platform_data || !pdev->dev.of_node)
+ return 0;
+
+ pd = devm_kzalloc(&pdev->dev, sizeof(*pd), GFP_KERNEL);
+ if (!pd)
+ return -ENOMEM;
+
+ pdev->dev.platform_data = pd;
+
+ pd->shared = of_find_device_by_node(shared);
+ if (!pd->shared)
+ return -ENODEV;
+
+ if (of_property_read_u32(np, "reg", &pd->port_number))
+ return -EINVAL;
+
+ pd->phy_node = of_parse_phandle(np, "phy", 0);
+ if (!pd->phy_node) {
+ pd->phy_addr = MV643XX_ETH_PHY_NONE;
+
+ of_property_read_u32(np, "speed", &pd->speed);
+ of_property_read_u32(np, "duplex", &pd->duplex);
+ }
+
+ mac_addr = of_get_mac_address(np);
+ if (mac_addr)
+ memcpy(pd->mac_addr, mac_addr, ETH_ALEN);
+
+#define rx_tx_queue_sram_property(_name) \
+ do { \
+ prop = of_get_property(np, __stringify(_name), NULL); \
+ if (prop) \
+ pd->_name = be32_to_cpup(prop); \
+ } while (0)
+
+ rx_tx_queue_sram_property(rx_queue_count);
+ rx_tx_queue_sram_property(tx_queue_count);
+ rx_tx_queue_sram_property(rx_queue_size);
+ rx_tx_queue_sram_property(tx_queue_size);
+ rx_tx_queue_sram_property(rx_sram_addr);
+ rx_tx_queue_sram_property(rx_sram_size);
+ rx_tx_queue_sram_property(tx_sram_addr);
+ rx_tx_queue_sram_property(rx_sram_size);
+
+ return 0;
+}
+#else
+static inline int mv643xx_eth_of_probe(struct platform_device *dev)
+{
+ return 0;
+}
+#endif
+
static int mv643xx_eth_probe(struct platform_device *pdev)
{
struct mv643xx_eth_platform_data *pd;
@@ -2677,6 +2769,10 @@ static int mv643xx_eth_probe(struct platform_device *pdev)
struct resource *res;
int err;
+ err = mv643xx_eth_of_probe(pdev);
+ if (err)
+ return err;
+
pd = pdev->dev.platform_data;
if (pd == NULL) {
dev_err(&pdev->dev, "no mv643xx_eth_platform_data\n");
If the clock isn't already enabled (mvmdio and mv643xx_eth both built
as modules), a delay seems to be necessary in mv643xx_eth_probe()
after enabling the clock on my hardware. Otherwise the device hangs.
Andrew found the same in the past (see [1]). udelay(50) seems to be
sufficient in my case.
Post by Florian Fainelli
@@ -2717,7 +2813,12 @@ static int mv643xx_eth_probe(struct platform_device *pdev)
netif_set_real_num_rx_queues(dev, mp->rxq_count);
if (pd->phy_addr != MV643XX_ETH_PHY_NONE) {
- mp->phy = phy_scan(mp, pd->phy_addr);
+ if (pd->phy_node)
+ mp->phy = of_phy_connect(mp->dev, pd->phy_node,
+ mv643xx_eth_adjust_link, 0,
+ PHY_INTERFACE_MODE_GMII);
of_phy_connect() returns NULL in case of an error and no ERR_PTR.

- Simon

[1] http://lists.infradead.org/pipermail/linux-arm-kernel/2012-June/103521.html
Sebastian Hesselbarth
2013-05-20 21:34:40 UTC
Permalink
...
Post by Simon Baatz
Post by Sebastian Hesselbarth
@@ -2485,13 +2499,21 @@ static int mv643xx_eth_shared_probe(struct platform_device *pdev)
if (dram)
mv643xx_eth_conf_mbus_windows(msp, dram);
- msp->tx_csum_limit = (pd != NULL&& pd->tx_csum_limit) ?
- pd->tx_csum_limit : 9 * 1024;
+ if (np)
+ of_property_read_u32(np, "tx-csum-limit",&tx_csum_limit);
+ else
+ tx_csum_limit = pd->tx_csum_limit;
+
+ msp->tx_csum_limit = tx_csum_limit ? tx_csum_limit : 9 * 1024;
infer_hw_params(msp);
platform_set_drvdata(pdev, msp);
+#ifdef CONFIG_OF
+ return of_platform_bus_probe(np, mv643xx_eth_match,&pdev->dev);
I have tested this on Kirkwood (Sheevaplug eSATA). When using
mv643xx_eth as a module with a built-in mvmdio the GbE port works.
However, when unloading the mv643xx_eth module and loading it again,
[ 190.542992] WARNING: at fs/sysfs/dir.c:530 sysfs_add_one+0x7c/0xa4()
[ 190.549372] sysfs: cannot create duplicate filename '/devices/ocp.0/f1072000.
ethernet-controller/0.ethernet-port'
(Looks more like a problem of of_platform_bus_probe() than a problem
in the driver?)
Hi Simon,

thanks for the review. I am right now working on a v4 of the DT support
patches for mv643xx_eth and the above will not be there anymore. I will
test v4 for rmmod/modprobe issues before posting.
Post by Simon Baatz
Post by Sebastian Hesselbarth
@@ -2677,6 +2769,10 @@ static int mv643xx_eth_probe(struct platform_device *pdev)
struct resource *res;
int err;
+ err = mv643xx_eth_of_probe(pdev);
+ if (err)
+ return err;
+
pd = pdev->dev.platform_data;
if (pd == NULL) {
dev_err(&pdev->dev, "no mv643xx_eth_platform_data\n");
If the clock isn't already enabled (mvmdio and mv643xx_eth both built
as modules), a delay seems to be necessary in mv643xx_eth_probe()
after enabling the clock on my hardware. Otherwise the device hangs.
Andrew found the same in the past (see [1]). udelay(50) seems to be
sufficient in my case.
Hmm, I am wondering if that delay shouldn't be in the clock provider
then. I test it on Dove also and look for a way to insert the delay
if neccessary. Maybe Andrew can also comment on this.
Post by Simon Baatz
Post by Sebastian Hesselbarth
@@ -2717,7 +2813,12 @@ static int mv643xx_eth_probe(struct platform_device *pdev)
netif_set_real_num_rx_queues(dev, mp->rxq_count);
if (pd->phy_addr != MV643XX_ETH_PHY_NONE) {
- mp->phy = phy_scan(mp, pd->phy_addr);
+ if (pd->phy_node)
+ mp->phy = of_phy_connect(mp->dev, pd->phy_node,
+ mv643xx_eth_adjust_link, 0,
+ PHY_INTERFACE_MODE_GMII);
of_phy_connect() returns NULL in case of an error and no ERR_PTR.
True, will take care of that.

Sebastian
Sebastian Hesselbarth
2013-05-06 15:33:35 UTC
Permalink
From: Florian Fainelli <florian-***@public.gmane.org>

This patch updates the Device Tree bindings documentation for the
Marvell MV643xx ethernet controller node and makes the
"local-mac-address" and "phy" properties optional instead of required.
The absence of a "phy" node is legal and describes a MAC to switch
configuration, while not specifying the "local-mac-address" allows for
reuse of the MAC address already programmed into the Ethernet
controller.

Signed-off-by: Florian Fainelli <florian-***@public.gmane.org>
---
Cc: Grant Likely <grant.likely-QSEj5FYQhm4dnm+***@public.gmane.org>
Cc: Rob Herring <rob.herring-bsGFqQB8/***@public.gmane.org>
Cc: Rob Landley <rob-VoJi6FS/***@public.gmane.org>
Cc: Lennert Buytenhek <buytenh-OLH4Qvv75CYX/***@public.gmane.org>
Cc: David Miller <davem-fT/PcQaiUtIeIZ0/***@public.gmane.org>
Cc: Florian Fainelli <florian-***@public.gmane.org>
Cc: Arnaud Patard <arnaud.patard-dQbF7i+***@public.gmane.org>
Cc: Russell King <linux-lFZ/***@public.gmane.org>
Cc: Jason Cooper <jason-***@public.gmane.org>
Cc: Andrew Lunn <andrew-***@public.gmane.org>
Cc: Jean-Francois Moine <moinejf-***@public.gmane.org>
Cc: Thomas Petazzoni <thomas.petazzoni-wi1+55ScJUtKEb57/***@public.gmane.org>
Cc: Simon Guinot <simon.guinot-***@public.gmane.org>
Cc: Jamie Lentin <jm-Pj/***@public.gmane.org>
Cc: Michael Walle <michael-***@public.gmane.org>
Cc: Eric Hutter <hutter.eric-***@public.gmane.org>
Cc: Joshua Coombs <josh.coombs-***@public.gmane.org>
Cc: Willy Tarreau <***@1wt.eu>
Cc: Simon Baatz <gmbnomis-***@public.gmane.org>
Cc: Alan M Butler <alanbutty12-***@public.gmane.org>
Cc: Nigel Roberts <nigel-BZPLJ9//***@public.gmane.org>
Cc: Valentin Longchamp <valentin.longchamp-SkAbAL50j+***@public.gmane.org>
Cc: Stefan Peter <s.peter-***@public.gmane.org>
Cc: Arnaud Ebalard <arno-***@public.gmane.org>
Cc: Nobuhiro Iwamatsu <iwamatsu-+***@public.gmane.org>
Cc: netdev-***@public.gmane.org
Cc: devicetree-discuss-uLR06cmDAlY/***@public.gmane.org
Cc: linux-doc-***@public.gmane.org
Cc: linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+***@public.gmane.org
Cc: linux-kernel-***@public.gmane.org
---
Documentation/devicetree/bindings/marvell.txt | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/Documentation/devicetree/bindings/marvell.txt b/Documentation/devicetree/bindings/marvell.txt
index 73ea12f..ed4058c 100644
--- a/Documentation/devicetree/bindings/marvell.txt
+++ b/Documentation/devicetree/bindings/marvell.txt
@@ -141,11 +141,11 @@ prefixed with the string "marvell,", for Marvell Technology Group Ltd.
- interrupts : <a> where a is the interrupt number for the port.
- interrupt-parent : the phandle for the interrupt controller
that services interrupts for this device.
+
+ Optional properties:
- phy : the phandle for the PHY connected to this ethernet
controller.
- local-mac-address : 6 bytes, MAC address
-
- Optional properties:
- clocks : Phandle to the clock control device and gate bit
- clock-names : String describing the clock gate bit
- speed : Speed to force the link (10, 100, 1000), used when no
--
1.7.2.5
Sebastian Hesselbarth
2013-05-06 15:33:36 UTC
Permalink
With DT support for mv643xx_eth we do not need legacy platform_data
based setup for DT enabled boards.

Signed-off-by: Sebastian Hesselbarth <sebastian.hesselbarth-***@public.gmane.org>
---
Cc: Grant Likely <grant.likely-QSEj5FYQhm4dnm+***@public.gmane.org>
Cc: Rob Herring <rob.herring-bsGFqQB8/***@public.gmane.org>
Cc: Rob Landley <rob-VoJi6FS/***@public.gmane.org>
Cc: Lennert Buytenhek <buytenh-OLH4Qvv75CYX/***@public.gmane.org>
Cc: David Miller <davem-fT/PcQaiUtIeIZ0/***@public.gmane.org>
Cc: Florian Fainelli <florian-***@public.gmane.org>
Cc: Arnaud Patard <arnaud.patard-dQbF7i+***@public.gmane.org>
Cc: Russell King <linux-lFZ/***@public.gmane.org>
Cc: Jason Cooper <jason-***@public.gmane.org>
Cc: Andrew Lunn <andrew-***@public.gmane.org>
Cc: Jean-Francois Moine <moinejf-***@public.gmane.org>
Cc: Thomas Petazzoni <thomas.petazzoni-wi1+55ScJUtKEb57/***@public.gmane.org>
Cc: Simon Guinot <simon.guinot-***@public.gmane.org>
Cc: Jamie Lentin <jm-Pj/***@public.gmane.org>
Cc: Michael Walle <michael-***@public.gmane.org>
Cc: Eric Hutter <hutter.eric-***@public.gmane.org>
Cc: Joshua Coombs <josh.coombs-***@public.gmane.org>
Cc: Willy Tarreau <***@1wt.eu>
Cc: Simon Baatz <gmbnomis-***@public.gmane.org>
Cc: Alan M Butler <alanbutty12-***@public.gmane.org>
Cc: Nigel Roberts <nigel-BZPLJ9//***@public.gmane.org>
Cc: Valentin Longchamp <valentin.longchamp-SkAbAL50j+***@public.gmane.org>
Cc: Stefan Peter <s.peter-***@public.gmane.org>
Cc: Arnaud Ebalard <arno-***@public.gmane.org>
Cc: Nobuhiro Iwamatsu <iwamatsu-+***@public.gmane.org>
Cc: netdev-***@public.gmane.org
Cc: devicetree-discuss-uLR06cmDAlY/***@public.gmane.org
Cc: linux-doc-***@public.gmane.org
Cc: linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+***@public.gmane.org
Cc: linux-kernel-***@public.gmane.org
---
arch/arm/mach-dove/board-dt.c | 5 -----
1 files changed, 0 insertions(+), 5 deletions(-)

diff --git a/arch/arm/mach-dove/board-dt.c b/arch/arm/mach-dove/board-dt.c
index fbde1dd..3c0963d 100644
--- a/arch/arm/mach-dove/board-dt.c
+++ b/arch/arm/mach-dove/board-dt.c
@@ -34,10 +34,6 @@ static void __init dove_legacy_clk_init(void)
clkspec.np = np;
clkspec.args_count = 1;

- clkspec.args[0] = CLOCK_GATING_BIT_GBE;
- orion_clkdev_add(NULL, "mv643xx_eth_port.0",
- of_clk_get_from_provider(&clkspec));
-
clkspec.args[0] = CLOCK_GATING_BIT_PCIE0;
orion_clkdev_add("0", "pcie",
of_clk_get_from_provider(&clkspec));
@@ -70,7 +66,6 @@ static void __init dove_dt_init(void)
dove_of_clk_init();

/* Internal devices not ported to DT yet */
- dove_ge00_init(&dove_dt_ge00_data);
dove_pcie_init(1, 1);

of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
--
1.7.2.5
Sebastian Hesselbarth
2013-05-06 15:33:37 UTC
Permalink
This patch adds mv643xx_eth and mvmdio device tree nodes for DT enabled
Dove boards. As there is only one ethernet controller on Dove, a default
phy node is also added with a note to overwrite its reg property on a
per-board basis.

Signed-off-by: Sebastian Hesselbarth <sebastian.hesselbarth-***@public.gmane.org>
---
Cc: Grant Likely <grant.likely-QSEj5FYQhm4dnm+***@public.gmane.org>
Cc: Rob Herring <rob.herring-bsGFqQB8/***@public.gmane.org>
Cc: Rob Landley <rob-VoJi6FS/***@public.gmane.org>
Cc: Lennert Buytenhek <buytenh-OLH4Qvv75CYX/***@public.gmane.org>
Cc: David Miller <davem-fT/PcQaiUtIeIZ0/***@public.gmane.org>
Cc: Florian Fainelli <florian-***@public.gmane.org>
Cc: Arnaud Patard <arnaud.patard-dQbF7i+***@public.gmane.org>
Cc: Russell King <linux-lFZ/***@public.gmane.org>
Cc: Jason Cooper <jason-***@public.gmane.org>
Cc: Andrew Lunn <andrew-***@public.gmane.org>
Cc: Jean-Francois Moine <moinejf-***@public.gmane.org>
Cc: Thomas Petazzoni <thomas.petazzoni-wi1+55ScJUtKEb57/***@public.gmane.org>
Cc: Simon Guinot <simon.guinot-***@public.gmane.org>
Cc: Jamie Lentin <jm-Pj/***@public.gmane.org>
Cc: Michael Walle <michael-***@public.gmane.org>
Cc: Eric Hutter <hutter.eric-***@public.gmane.org>
Cc: Joshua Coombs <josh.coombs-***@public.gmane.org>
Cc: Willy Tarreau <***@1wt.eu>
Cc: Simon Baatz <gmbnomis-***@public.gmane.org>
Cc: Alan M Butler <alanbutty12-***@public.gmane.org>
Cc: Nigel Roberts <nigel-BZPLJ9//***@public.gmane.org>
Cc: Valentin Longchamp <valentin.longchamp-SkAbAL50j+***@public.gmane.org>
Cc: Stefan Peter <s.peter-***@public.gmane.org>
Cc: Arnaud Ebalard <arno-***@public.gmane.org>
Cc: Nobuhiro Iwamatsu <iwamatsu-+***@public.gmane.org>
Cc: netdev-***@public.gmane.org
Cc: devicetree-discuss-uLR06cmDAlY/***@public.gmane.org
Cc: linux-doc-***@public.gmane.org
Cc: linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+***@public.gmane.org
Cc: linux-kernel-***@public.gmane.org
---
arch/arm/boot/dts/dove-cubox.dts | 8 ++++++++
arch/arm/boot/dts/dove.dtsi | 35 +++++++++++++++++++++++++++++++++++
2 files changed, 43 insertions(+), 0 deletions(-)

diff --git a/arch/arm/boot/dts/dove-cubox.dts b/arch/arm/boot/dts/dove-cubox.dts
index 7e3065a..a52f016 100644
--- a/arch/arm/boot/dts/dove-cubox.dts
+++ b/arch/arm/boot/dts/dove-cubox.dts
@@ -49,6 +49,14 @@
&uart0 { status = "okay"; };
&sata0 { status = "okay"; };
&i2c0 { status = "okay"; };
+&mdio { status = "okay"; };
+&eth { status = "okay"; };
+&eth0 { status = "okay"; };
+
+&ethphy {
+ compatible = "marvell,88e1310";
+ reg = <1>;
+};

&sdio0 {
status = "okay";
diff --git a/arch/arm/boot/dts/dove.dtsi b/arch/arm/boot/dts/dove.dtsi
index 6cab468..8bb46c4 100644
--- a/arch/arm/boot/dts/dove.dtsi
+++ b/arch/arm/boot/dts/dove.dtsi
@@ -258,5 +258,40 @@
dmacap,xor;
};
};
+
+ mdio: mdio-***@72004 {
+ compatible = "marvell,orion-mdio";
+ reg = <0x72004 0x84>;
+ interrupts = <30>;
+ clocks = <&gate_clk 2>;
+ #address-cells = <1>;
+ #size-cells = <0>;
+ status = "disabled";
+
+ ethphy: ethernet-phy {
+ device_type = "ethernet-phy";
+ /* overwrite reg property in board file */
+ };
+ };
+
+ eth: ethernet-***@72000 {
+ compatible = "marvell,mv643xx-eth-block";
+ reg = <0x72000 0x4000>;
+ clocks = <&gate_clk 2>;
+ #address-cells = <1>;
+ #size-cells = <0>;
+ tx-csum-limit = <1600>;
+ status = "disabled";
+
+ eth0: ethernet-***@0 {
+ compatible = "marvell,mv643xx-eth";
+ device_type = "network";
+ reg = <0>;
+ interrupts = <29>;
+ clocks = <&gate_clk 2>;
+ phy = <&ethphy>;
+ status = "disabled";
+ };
+ };
};
};
--
1.7.2.5
Sebastian Hesselbarth
2013-05-06 15:33:38 UTC
Permalink
With DT support for mv643xx_eth we do not need legacy platform_data
based setup for DT enabled boards. This patch removes eth setup
for all kirkwood DT board files.

Signed-off-by: Sebastian Hesselbarth <sebastian.hesselbarth-***@public.gmane.org>
---
Cc: Grant Likely <grant.likely-QSEj5FYQhm4dnm+***@public.gmane.org>
Cc: Rob Herring <rob.herring-bsGFqQB8/***@public.gmane.org>
Cc: Rob Landley <rob-VoJi6FS/***@public.gmane.org>
Cc: Lennert Buytenhek <buytenh-OLH4Qvv75CYX/***@public.gmane.org>
Cc: David Miller <davem-fT/PcQaiUtIeIZ0/***@public.gmane.org>
Cc: Florian Fainelli <florian-***@public.gmane.org>
Cc: Arnaud Patard <arnaud.patard-dQbF7i+***@public.gmane.org>
Cc: Russell King <linux-lFZ/***@public.gmane.org>
Cc: Jason Cooper <jason-***@public.gmane.org>
Cc: Andrew Lunn <andrew-***@public.gmane.org>
Cc: Jean-Francois Moine <moinejf-***@public.gmane.org>
Cc: Thomas Petazzoni <thomas.petazzoni-wi1+55ScJUtKEb57/***@public.gmane.org>
Cc: Simon Guinot <simon.guinot-***@public.gmane.org>
Cc: Jamie Lentin <jm-Pj/***@public.gmane.org>
Cc: Michael Walle <michael-***@public.gmane.org>
Cc: Eric Hutter <hutter.eric-***@public.gmane.org>
Cc: Joshua Coombs <josh.coombs-***@public.gmane.org>
Cc: Willy Tarreau <***@1wt.eu>
Cc: Simon Baatz <gmbnomis-***@public.gmane.org>
Cc: Alan M Butler <alanbutty12-***@public.gmane.org>
Cc: Nigel Roberts <nigel-BZPLJ9//***@public.gmane.org>
Cc: Valentin Longchamp <valentin.longchamp-SkAbAL50j+***@public.gmane.org>
Cc: Stefan Peter <s.peter-***@public.gmane.org>
Cc: Arnaud Ebalard <arno-***@public.gmane.org>
Cc: Nobuhiro Iwamatsu <iwamatsu-+***@public.gmane.org>
Cc: netdev-***@public.gmane.org
Cc: devicetree-discuss-uLR06cmDAlY/***@public.gmane.org
Cc: linux-doc-***@public.gmane.org
Cc: linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+***@public.gmane.org
Cc: linux-kernel-***@public.gmane.org
---
arch/arm/mach-kirkwood/board-dnskw.c | 7 -------
arch/arm/mach-kirkwood/board-dockstar.c | 9 ---------
arch/arm/mach-kirkwood/board-dreamplug.c | 14 --------------
arch/arm/mach-kirkwood/board-goflexnet.c | 9 ---------
arch/arm/mach-kirkwood/board-guruplug.c | 14 --------------
arch/arm/mach-kirkwood/board-ib62x0.c | 9 ---------
arch/arm/mach-kirkwood/board-iconnect.c | 6 ------
arch/arm/mach-kirkwood/board-iomega_ix2_200.c | 16 ----------------
arch/arm/mach-kirkwood/board-km_kirkwood.c | 7 -------
arch/arm/mach-kirkwood/board-lsxl.c | 12 ------------
arch/arm/mach-kirkwood/board-mplcec4.c | 11 -----------
arch/arm/mach-kirkwood/board-ns2.c | 13 -------------
arch/arm/mach-kirkwood/board-openblocks_a6.c | 9 ---------
arch/arm/mach-kirkwood/board-readynas.c | 6 ------
arch/arm/mach-kirkwood/board-ts219.c | 13 -------------
arch/arm/mach-kirkwood/board-usi_topkick.c | 9 ---------
16 files changed, 0 insertions(+), 164 deletions(-)

diff --git a/arch/arm/mach-kirkwood/board-dnskw.c b/arch/arm/mach-kirkwood/board-dnskw.c
index a1aa87f..2af7a95 100644
--- a/arch/arm/mach-kirkwood/board-dnskw.c
+++ b/arch/arm/mach-kirkwood/board-dnskw.c
@@ -14,14 +14,9 @@
#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/platform_device.h>
-#include <linux/mv643xx_eth.h>
#include <linux/gpio.h>
#include "common.h"

-static struct mv643xx_eth_platform_data dnskw_ge00_data = {
- .phy_addr = MV643XX_ETH_PHY_ADDR(8),
-};
-
/* Register any GPIO for output and set the value */
static void __init dnskw_gpio_register(unsigned gpio, char *name, int def)
{
@@ -36,8 +31,6 @@ static void __init dnskw_gpio_register(unsigned gpio, char *name, int def)

void __init dnskw_init(void)
{
- kirkwood_ge00_init(&dnskw_ge00_data);
-
/* Set NAS to turn back on after a power failure */
dnskw_gpio_register(37, "dnskw:power:recover", 1);
}
diff --git a/arch/arm/mach-kirkwood/board-dockstar.c b/arch/arm/mach-kirkwood/board-dockstar.c
index d7196db..b78032e 100644
--- a/arch/arm/mach-kirkwood/board-dockstar.c
+++ b/arch/arm/mach-kirkwood/board-dockstar.c
@@ -16,17 +16,8 @@

#include <linux/kernel.h>
#include <linux/init.h>
-#include <linux/mv643xx_eth.h>
#include "common.h"

-static struct mv643xx_eth_platform_data dockstar_ge00_data = {
- .phy_addr = MV643XX_ETH_PHY_ADDR(0),
-};
-
void __init dockstar_dt_init(void)
{
- /*
- * Basic setup. Needs to be called early.
- */
- kirkwood_ge00_init(&dockstar_ge00_data);
}
diff --git a/arch/arm/mach-kirkwood/board-dreamplug.c b/arch/arm/mach-kirkwood/board-dreamplug.c
index 0903242..cb7823d 100644
--- a/arch/arm/mach-kirkwood/board-dreamplug.c
+++ b/arch/arm/mach-kirkwood/board-dreamplug.c
@@ -13,23 +13,9 @@

#include <linux/kernel.h>
#include <linux/init.h>
-#include <linux/mv643xx_eth.h>
#include <linux/gpio.h>
#include "common.h"

-static struct mv643xx_eth_platform_data dreamplug_ge00_data = {
- .phy_addr = MV643XX_ETH_PHY_ADDR(0),
-};
-
-static struct mv643xx_eth_platform_data dreamplug_ge01_data = {
- .phy_addr = MV643XX_ETH_PHY_ADDR(1),
-};
-
void __init dreamplug_init(void)
{
- /*
- * Basic setup. Needs to be called early.
- */
- kirkwood_ge00_init(&dreamplug_ge00_data);
- kirkwood_ge01_init(&dreamplug_ge01_data);
}
diff --git a/arch/arm/mach-kirkwood/board-goflexnet.c b/arch/arm/mach-kirkwood/board-goflexnet.c
index 9db979a..4213e20 100644
--- a/arch/arm/mach-kirkwood/board-goflexnet.c
+++ b/arch/arm/mach-kirkwood/board-goflexnet.c
@@ -18,17 +18,8 @@

#include <linux/kernel.h>
#include <linux/init.h>
-#include <linux/mv643xx_eth.h>
#include "common.h"

-static struct mv643xx_eth_platform_data goflexnet_ge00_data = {
- .phy_addr = MV643XX_ETH_PHY_ADDR(0),
-};
-
void __init goflexnet_init(void)
{
- /*
- * Basic setup. Needs to be called early.
- */
- kirkwood_ge00_init(&goflexnet_ge00_data);
}
diff --git a/arch/arm/mach-kirkwood/board-guruplug.c b/arch/arm/mach-kirkwood/board-guruplug.c
index a857163..d515f64 100644
--- a/arch/arm/mach-kirkwood/board-guruplug.c
+++ b/arch/arm/mach-kirkwood/board-guruplug.c
@@ -11,23 +11,9 @@

#include <linux/kernel.h>
#include <linux/init.h>
-#include <linux/mv643xx_eth.h>
#include <linux/gpio.h>
#include "common.h"

-static struct mv643xx_eth_platform_data guruplug_ge00_data = {
- .phy_addr = MV643XX_ETH_PHY_ADDR(0),
-};
-
-static struct mv643xx_eth_platform_data guruplug_ge01_data = {
- .phy_addr = MV643XX_ETH_PHY_ADDR(1),
-};
-
void __init guruplug_dt_init(void)
{
- /*
- * Basic setup. Needs to be called early.
- */
- kirkwood_ge00_init(&guruplug_ge00_data);
- kirkwood_ge01_init(&guruplug_ge01_data);
}
diff --git a/arch/arm/mach-kirkwood/board-ib62x0.c b/arch/arm/mach-kirkwood/board-ib62x0.c
index 9a857ae..6082373 100644
--- a/arch/arm/mach-kirkwood/board-ib62x0.c
+++ b/arch/arm/mach-kirkwood/board-ib62x0.c
@@ -13,17 +13,8 @@

#include <linux/kernel.h>
#include <linux/init.h>
-#include <linux/mv643xx_eth.h>
#include "common.h"

-static struct mv643xx_eth_platform_data ib62x0_ge00_data = {
- .phy_addr = MV643XX_ETH_PHY_ADDR(8),
-};
-
void __init ib62x0_init(void)
{
- /*
- * Basic setup. Needs to be called early.
- */
- kirkwood_ge00_init(&ib62x0_ge00_data);
}
diff --git a/arch/arm/mach-kirkwood/board-iconnect.c b/arch/arm/mach-kirkwood/board-iconnect.c
index c8ebde4..045668c 100644
--- a/arch/arm/mach-kirkwood/board-iconnect.c
+++ b/arch/arm/mach-kirkwood/board-iconnect.c
@@ -11,16 +11,10 @@
#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/of.h>
-#include <linux/mv643xx_eth.h>
#include "common.h"

-static struct mv643xx_eth_platform_data iconnect_ge00_data = {
- .phy_addr = MV643XX_ETH_PHY_ADDR(11),
-};
-
void __init iconnect_init(void)
{
- kirkwood_ge00_init(&iconnect_ge00_data);
}

static int __init iconnect_pci_init(void)
diff --git a/arch/arm/mach-kirkwood/board-iomega_ix2_200.c b/arch/arm/mach-kirkwood/board-iomega_ix2_200.c
index e5f7041..dc86cf7 100644
--- a/arch/arm/mach-kirkwood/board-iomega_ix2_200.c
+++ b/arch/arm/mach-kirkwood/board-iomega_ix2_200.c
@@ -10,25 +10,9 @@

#include <linux/kernel.h>
#include <linux/init.h>
-#include <linux/mv643xx_eth.h>
#include <linux/ethtool.h>
#include "common.h"

-static struct mv643xx_eth_platform_data iomega_ix2_200_ge00_data = {
- .phy_addr = MV643XX_ETH_PHY_NONE,
- .speed = SPEED_1000,
- .duplex = DUPLEX_FULL,
-};
-
-static struct mv643xx_eth_platform_data iomega_ix2_200_ge01_data = {
- .phy_addr = MV643XX_ETH_PHY_ADDR(11),
-};
-
void __init iomega_ix2_200_init(void)
{
- /*
- * Basic setup. Needs to be called early.
- */
- kirkwood_ge00_init(&iomega_ix2_200_ge00_data);
- kirkwood_ge01_init(&iomega_ix2_200_ge01_data);
}
diff --git a/arch/arm/mach-kirkwood/board-km_kirkwood.c b/arch/arm/mach-kirkwood/board-km_kirkwood.c
index 44e4605..6b8464b 100644
--- a/arch/arm/mach-kirkwood/board-km_kirkwood.c
+++ b/arch/arm/mach-kirkwood/board-km_kirkwood.c
@@ -14,15 +14,10 @@

#include <linux/kernel.h>
#include <linux/init.h>
-#include <linux/mv643xx_eth.h>
#include <linux/clk.h>
#include <linux/clk-private.h>
#include "common.h"

-static struct mv643xx_eth_platform_data km_kirkwood_ge00_data = {
- .phy_addr = MV643XX_ETH_PHY_ADDR(0),
-};
-
void __init km_kirkwood_init(void)
{
struct clk *sata_clk;
@@ -39,6 +34,4 @@ void __init km_kirkwood_init(void)
sata_clk = clk_get_sys("sata_mv.0", "1");
if (!IS_ERR(sata_clk))
sata_clk->flags |= CLK_IGNORE_UNUSED;
-
- kirkwood_ge00_init(&km_kirkwood_ge00_data);
}
diff --git a/arch/arm/mach-kirkwood/board-lsxl.c b/arch/arm/mach-kirkwood/board-lsxl.c
index 4ec8b7a..1cbcd56 100644
--- a/arch/arm/mach-kirkwood/board-lsxl.c
+++ b/arch/arm/mach-kirkwood/board-lsxl.c
@@ -14,17 +14,8 @@
#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/platform_device.h>
-#include <linux/mv643xx_eth.h>
#include "common.h"

-static struct mv643xx_eth_platform_data lsxl_ge00_data = {
- .phy_addr = MV643XX_ETH_PHY_ADDR(0),
-};
-
-static struct mv643xx_eth_platform_data lsxl_ge01_data = {
- .phy_addr = MV643XX_ETH_PHY_ADDR(8),
-};
-
/*
* On the LS-XHL/LS-CHLv2, the shutdown process is following:
* - Userland monitors key events until the power switch goes to off position
@@ -44,9 +35,6 @@ void __init lsxl_init(void)
* Basic setup. Needs to be called early.
*/

- kirkwood_ge00_init(&lsxl_ge00_data);
- kirkwood_ge01_init(&lsxl_ge01_data);
-
/* register power-off method */
pm_power_off = lsxl_power_off;
}
diff --git a/arch/arm/mach-kirkwood/board-mplcec4.c b/arch/arm/mach-kirkwood/board-mplcec4.c
index 7d6dc66..a337ef5 100644
--- a/arch/arm/mach-kirkwood/board-mplcec4.c
+++ b/arch/arm/mach-kirkwood/board-mplcec4.c
@@ -11,24 +11,13 @@

#include <linux/kernel.h>
#include <linux/init.h>
-#include <linux/mv643xx_eth.h>
#include "common.h"

-static struct mv643xx_eth_platform_data mplcec4_ge00_data = {
- .phy_addr = MV643XX_ETH_PHY_ADDR(1),
-};
-
-static struct mv643xx_eth_platform_data mplcec4_ge01_data = {
- .phy_addr = MV643XX_ETH_PHY_ADDR(2),
-};
-
void __init mplcec4_init(void)
{
/*
* Basic setup. Needs to be called early.
*/
- kirkwood_ge00_init(&mplcec4_ge00_data);
- kirkwood_ge01_init(&mplcec4_ge01_data);
kirkwood_pcie_init(KW_PCIE0);
}

diff --git a/arch/arm/mach-kirkwood/board-ns2.c b/arch/arm/mach-kirkwood/board-ns2.c
index f8f6605..ba3abd6 100644
--- a/arch/arm/mach-kirkwood/board-ns2.c
+++ b/arch/arm/mach-kirkwood/board-ns2.c
@@ -14,22 +14,9 @@
#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/platform_device.h>
-#include <linux/mv643xx_eth.h>
#include <linux/of.h>
#include "common.h"

-static struct mv643xx_eth_platform_data ns2_ge00_data = {
- .phy_addr = MV643XX_ETH_PHY_ADDR(8),
-};
-
void __init ns2_init(void)
{
- /*
- * Basic setup. Needs to be called early.
- */
- if (of_machine_is_compatible("lacie,cloudbox") ||
- of_machine_is_compatible("lacie,netspace_lite_v2") ||
- of_machine_is_compatible("lacie,netspace_mini_v2"))
- ns2_ge00_data.phy_addr = MV643XX_ETH_PHY_ADDR(0);
- kirkwood_ge00_init(&ns2_ge00_data);
}
diff --git a/arch/arm/mach-kirkwood/board-openblocks_a6.c b/arch/arm/mach-kirkwood/board-openblocks_a6.c
index b11d8fd..120dccf 100644
--- a/arch/arm/mach-kirkwood/board-openblocks_a6.c
+++ b/arch/arm/mach-kirkwood/board-openblocks_a6.c
@@ -10,17 +10,8 @@

#include <linux/kernel.h>
#include <linux/init.h>
-#include <linux/mv643xx_eth.h>
#include "common.h"

-static struct mv643xx_eth_platform_data openblocks_ge00_data = {
- .phy_addr = MV643XX_ETH_PHY_ADDR(0),
-};
-
void __init openblocks_a6_init(void)
{
- /*
- * Basic setup. Needs to be called early.
- */
- kirkwood_ge00_init(&openblocks_ge00_data);
}
diff --git a/arch/arm/mach-kirkwood/board-readynas.c b/arch/arm/mach-kirkwood/board-readynas.c
index fb42c20..3ab3e0e 100644
--- a/arch/arm/mach-kirkwood/board-readynas.c
+++ b/arch/arm/mach-kirkwood/board-readynas.c
@@ -13,16 +13,10 @@
#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/platform_device.h>
-#include <linux/mv643xx_eth.h>
#include <mach/kirkwood.h>
#include "common.h"

-static struct mv643xx_eth_platform_data netgear_readynas_ge00_data = {
- .phy_addr = MV643XX_ETH_PHY_ADDR(0),
-};
-
void __init netgear_readynas_init(void)
{
- kirkwood_ge00_init(&netgear_readynas_ge00_data);
kirkwood_pcie_init(KW_PCIE0);
}
diff --git a/arch/arm/mach-kirkwood/board-ts219.c b/arch/arm/mach-kirkwood/board-ts219.c
index acb0187..854d448 100644
--- a/arch/arm/mach-kirkwood/board-ts219.c
+++ b/arch/arm/mach-kirkwood/board-ts219.c
@@ -18,27 +18,14 @@
#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/platform_device.h>
-#include <linux/mv643xx_eth.h>
#include <asm/mach-types.h>
#include <asm/mach/arch.h>
#include <mach/kirkwood.h>
#include "common.h"
#include "tsx1x-common.h"

-static struct mv643xx_eth_platform_data qnap_ts219_ge00_data = {
- .phy_addr = MV643XX_ETH_PHY_ADDR(8),
-};
-
void __init qnap_dt_ts219_init(void)
{
- u32 dev, rev;
-
- kirkwood_pcie_id(&dev, &rev);
- if (dev == MV88F6282_DEV_ID)
- qnap_ts219_ge00_data.phy_addr = MV643XX_ETH_PHY_ADDR(0);
-
- kirkwood_ge00_init(&qnap_ts219_ge00_data);
-
pm_power_off = qnap_tsx1x_power_off;
}

diff --git a/arch/arm/mach-kirkwood/board-usi_topkick.c b/arch/arm/mach-kirkwood/board-usi_topkick.c
index 1cc04ec..44a8a6b 100644
--- a/arch/arm/mach-kirkwood/board-usi_topkick.c
+++ b/arch/arm/mach-kirkwood/board-usi_topkick.c
@@ -12,18 +12,9 @@

#include <linux/kernel.h>
#include <linux/init.h>
-#include <linux/mv643xx_eth.h>
#include <linux/gpio.h>
#include "common.h"

-static struct mv643xx_eth_platform_data topkick_ge00_data = {
- .phy_addr = MV643XX_ETH_PHY_ADDR(0),
-};
-
void __init usi_topkick_init(void)
{
- /*
- * Basic setup. Needs to be called early.
- */
- kirkwood_ge00_init(&topkick_ge00_data);
}
--
1.7.2.5
Thomas Petazzoni
2013-05-06 15:39:09 UTC
Permalink
Dear Sebastian Hesselbarth,
Post by Sebastian Hesselbarth
With DT support for mv643xx_eth we do not need legacy platform_data
based setup for DT enabled boards. This patch removes eth setup
for all kirkwood DT board files.
arch/arm/mach-kirkwood/board-dnskw.c | 7 -------
arch/arm/mach-kirkwood/board-dockstar.c | 9 ---------
arch/arm/mach-kirkwood/board-dreamplug.c | 14 --------------
arch/arm/mach-kirkwood/board-goflexnet.c | 9 ---------
arch/arm/mach-kirkwood/board-guruplug.c | 14 --------------
arch/arm/mach-kirkwood/board-ib62x0.c | 9 ---------
arch/arm/mach-kirkwood/board-iconnect.c | 6 ------
arch/arm/mach-kirkwood/board-iomega_ix2_200.c | 16 ----------------
arch/arm/mach-kirkwood/board-km_kirkwood.c | 7 -------
arch/arm/mach-kirkwood/board-lsxl.c | 12 ------------
arch/arm/mach-kirkwood/board-mplcec4.c | 11 -----------
arch/arm/mach-kirkwood/board-ns2.c | 13 -------------
arch/arm/mach-kirkwood/board-openblocks_a6.c | 9 ---------
arch/arm/mach-kirkwood/board-readynas.c | 6 ------
arch/arm/mach-kirkwood/board-ts219.c | 13 -------------
arch/arm/mach-kirkwood/board-usi_topkick.c | 9 ---------
I believe a good number of those files become empty once you've removed
the registration of the Ethernet devices. Shouldn't such files be
removed in this patch?

Thanks!

Thomas
--
Thomas Petazzoni, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com
Sebastian Hesselbarth
2013-05-06 15:33:39 UTC
Permalink
This patch adds mv643xx_eth and mvmdio device tree nodes for DT enabled
Kirkwood boards. Phy nodes are also added with reg property set on a
per-board basis.

Signed-off-by: Sebastian Hesselbarth <sebastian.hesselbarth-***@public.gmane.org>
---
Cc: Grant Likely <grant.likely-QSEj5FYQhm4dnm+***@public.gmane.org>
Cc: Rob Herring <rob.herring-bsGFqQB8/***@public.gmane.org>
Cc: Rob Landley <rob-VoJi6FS/***@public.gmane.org>
Cc: Lennert Buytenhek <buytenh-OLH4Qvv75CYX/***@public.gmane.org>
Cc: David Miller <davem-fT/PcQaiUtIeIZ0/***@public.gmane.org>
Cc: Florian Fainelli <florian-***@public.gmane.org>
Cc: Arnaud Patard <arnaud.patard-dQbF7i+***@public.gmane.org>
Cc: Russell King <linux-lFZ/***@public.gmane.org>
Cc: Jason Cooper <jason-***@public.gmane.org>
Cc: Andrew Lunn <andrew-***@public.gmane.org>
Cc: Jean-Francois Moine <moinejf-***@public.gmane.org>
Cc: Thomas Petazzoni <thomas.petazzoni-wi1+55ScJUtKEb57/***@public.gmane.org>
Cc: Simon Guinot <simon.guinot-***@public.gmane.org>
Cc: Jamie Lentin <jm-Pj/***@public.gmane.org>
Cc: Michael Walle <michael-***@public.gmane.org>
Cc: Eric Hutter <hutter.eric-***@public.gmane.org>
Cc: Joshua Coombs <josh.coombs-***@public.gmane.org>
Cc: Willy Tarreau <***@1wt.eu>
Cc: Simon Baatz <gmbnomis-***@public.gmane.org>
Cc: Alan M Butler <alanbutty12-***@public.gmane.org>
Cc: Nigel Roberts <nigel-BZPLJ9//***@public.gmane.org>
Cc: Valentin Longchamp <valentin.longchamp-SkAbAL50j+***@public.gmane.org>
Cc: Stefan Peter <s.peter-***@public.gmane.org>
Cc: Arnaud Ebalard <arno-***@public.gmane.org>
Cc: Nobuhiro Iwamatsu <iwamatsu-+***@public.gmane.org>
Cc: netdev-***@public.gmane.org
Cc: devicetree-discuss-uLR06cmDAlY/***@public.gmane.org
Cc: linux-doc-***@public.gmane.org
Cc: linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+***@public.gmane.org
Cc: linux-kernel-***@public.gmane.org
---
arch/arm/boot/dts/kirkwood-cloudbox.dts | 15 ++++++
arch/arm/boot/dts/kirkwood-dnskw.dtsi | 15 ++++++
arch/arm/boot/dts/kirkwood-dockstar.dts | 15 ++++++
arch/arm/boot/dts/kirkwood-dreamplug.dts | 26 ++++++++++
arch/arm/boot/dts/kirkwood-goflexnet.dts | 15 ++++++
.../arm/boot/dts/kirkwood-guruplug-server-plus.dts | 26 ++++++++++
arch/arm/boot/dts/kirkwood-ib62x0.dts | 15 ++++++
arch/arm/boot/dts/kirkwood-iconnect.dts | 15 ++++++
arch/arm/boot/dts/kirkwood-iomega_ix2_200.dts | 22 ++++++++
arch/arm/boot/dts/kirkwood-is2.dts | 2 +
arch/arm/boot/dts/kirkwood-km_kirkwood.dts | 15 ++++++
arch/arm/boot/dts/kirkwood-lsxl.dtsi | 26 ++++++++++
arch/arm/boot/dts/kirkwood-mplcec4.dts | 25 +++++++++
.../boot/dts/kirkwood-netgear_readynas_duo_v2.dts | 15 ++++++
arch/arm/boot/dts/kirkwood-ns2-common.dtsi | 15 ++++++
arch/arm/boot/dts/kirkwood-ns2.dts | 2 +
arch/arm/boot/dts/kirkwood-ns2lite.dts | 2 +
arch/arm/boot/dts/kirkwood-ns2max.dts | 2 +
arch/arm/boot/dts/kirkwood-ns2mini.dts | 2 +
arch/arm/boot/dts/kirkwood-openblocks_a6.dts | 15 ++++++
arch/arm/boot/dts/kirkwood-topkick.dts | 15 ++++++
arch/arm/boot/dts/kirkwood-ts219-6281.dts | 4 +-
arch/arm/boot/dts/kirkwood-ts219-6282.dts | 4 +-
arch/arm/boot/dts/kirkwood-ts219.dtsi | 15 ++++++
arch/arm/boot/dts/kirkwood.dtsi | 52 ++++++++++++++++++++
25 files changed, 373 insertions(+), 2 deletions(-)

diff --git a/arch/arm/boot/dts/kirkwood-cloudbox.dts b/arch/arm/boot/dts/kirkwood-cloudbox.dts
index 5f21d4e..d4f1e89 100644
--- a/arch/arm/boot/dts/kirkwood-cloudbox.dts
+++ b/arch/arm/boot/dts/kirkwood-cloudbox.dts
@@ -87,3 +87,18 @@
gpios = <&gpio0 17 0>;
};
};
+
+&eth0 { status = "okay"; };
+&egiga0 {
+ status = "okay";
+ phy = <&ethphy0>;
+};
+
+&mdio {
+ status = "okay";
+
+ ethphy0: ethernet-***@0 {
+ device_type = "ethernet-phy";
+ reg = <0>;
+ };
+};
diff --git a/arch/arm/boot/dts/kirkwood-dnskw.dtsi b/arch/arm/boot/dts/kirkwood-dnskw.dtsi
index 6875ac0..b203f07 100644
--- a/arch/arm/boot/dts/kirkwood-dnskw.dtsi
+++ b/arch/arm/boot/dts/kirkwood-dnskw.dtsi
@@ -217,3 +217,18 @@
};
};
};
+
+&eth0 { status = "okay"; };
+&egiga0 {
+ status = "okay";
+ phy = <&ethphy0>;
+};
+
+&mdio {
+ status = "okay";
+
+ ethphy0: ethernet-***@8 {
+ device_type = "ethernet-phy";
+ reg = <8>;
+ };
+};
diff --git a/arch/arm/boot/dts/kirkwood-dockstar.dts b/arch/arm/boot/dts/kirkwood-dockstar.dts
index 0196cf6..1b46882 100644
--- a/arch/arm/boot/dts/kirkwood-dockstar.dts
+++ b/arch/arm/boot/dts/kirkwood-dockstar.dts
@@ -91,3 +91,18 @@
};
};
};
+
+&eth0 { status = "okay"; };
+&egiga0 {
+ status = "okay";
+ phy = <&ethphy0>;
+};
+
+&mdio {
+ status = "okay";
+
+ ethphy0: ethernet-***@0 {
+ device_type = "ethernet-phy";
+ reg = <0>;
+ };
+};
diff --git a/arch/arm/boot/dts/kirkwood-dreamplug.dts b/arch/arm/boot/dts/kirkwood-dreamplug.dts
index 289e51d..3ce258b 100644
--- a/arch/arm/boot/dts/kirkwood-dreamplug.dts
+++ b/arch/arm/boot/dts/kirkwood-dreamplug.dts
@@ -99,3 +99,29 @@
};
};
};
+
+&eth0 { status = "okay"; };
+&egiga0 {
+ status = "okay";
+ phy = <&ethphy0>;
+};
+
+&eth1 { status = "okay"; };
+&egiga1 {
+ status = "okay";
+ phy = <&ethphy1>;
+};
+
+&mdio {
+ status = "okay";
+
+ ethphy0: ethernet-***@0 {
+ device_type = "ethernet-phy";
+ reg = <0>;
+ };
+
+ ethphy1: ethernet-***@1 {
+ device_type = "ethernet-phy";
+ reg = <1>;
+ };
+};
diff --git a/arch/arm/boot/dts/kirkwood-goflexnet.dts b/arch/arm/boot/dts/kirkwood-goflexnet.dts
index c3573be..84fe313 100644
--- a/arch/arm/boot/dts/kirkwood-goflexnet.dts
+++ b/arch/arm/boot/dts/kirkwood-goflexnet.dts
@@ -170,3 +170,18 @@
};
};
};
+
+&eth0 { status = "okay"; };
+&egiga0 {
+ status = "okay";
+ phy = <&ethphy0>;
+};
+
+&mdio {
+ status = "okay";
+
+ ethphy0: ethernet-***@0 {
+ device_type = "ethernet-phy";
+ reg = <0>;
+ };
+};
diff --git a/arch/arm/boot/dts/kirkwood-guruplug-server-plus.dts b/arch/arm/boot/dts/kirkwood-guruplug-server-plus.dts
index 44fd97d..894e658 100644
--- a/arch/arm/boot/dts/kirkwood-guruplug-server-plus.dts
+++ b/arch/arm/boot/dts/kirkwood-guruplug-server-plus.dts
@@ -96,3 +96,29 @@
};
};
};
+
+&eth0 { status = "okay"; };
+&egiga0 {
+ status = "okay";
+ phy = <&ethphy0>;
+};
+
+&eth1 { status = "okay"; };
+&egiga1 {
+ status = "okay";
+ phy = <&ethphy1>;
+};
+
+&mdio {
+ status = "okay";
+
+ ethphy0: ethernet-***@0 {
+ device_type = "ethernet-phy";
+ reg = <0>;
+ };
+
+ ethphy1: ethernet-***@1 {
+ device_type = "ethernet-phy";
+ reg = <1>;
+ };
+};
diff --git a/arch/arm/boot/dts/kirkwood-ib62x0.dts b/arch/arm/boot/dts/kirkwood-ib62x0.dts
index 5335b1a..7e7845d 100644
--- a/arch/arm/boot/dts/kirkwood-ib62x0.dts
+++ b/arch/arm/boot/dts/kirkwood-ib62x0.dts
@@ -119,3 +119,18 @@


};
+
+&eth0 { status = "okay"; };
+&egiga0 {
+ status = "okay";
+ phy = <&ethphy0>;
+};
+
+&mdio {
+ status = "okay";
+
+ ethphy0: ethernet-***@8 {
+ device_type = "ethernet-phy";
+ reg = <8>;
+ };
+};
diff --git a/arch/arm/boot/dts/kirkwood-iconnect.dts b/arch/arm/boot/dts/kirkwood-iconnect.dts
index 12ccf74..7991168 100644
--- a/arch/arm/boot/dts/kirkwood-iconnect.dts
+++ b/arch/arm/boot/dts/kirkwood-iconnect.dts
@@ -168,3 +168,18 @@
};
};
};
+
+&eth0 { status = "okay"; };
+&egiga0 {
+ status = "okay";
+ phy = <&ethphy0>;
+};
+
+&mdio {
+ status = "okay";
+
+ ethphy0: ethernet-***@11 {
+ device_type = "ethernet-phy";
+ reg = <11>;
+ };
+};
diff --git a/arch/arm/boot/dts/kirkwood-iomega_ix2_200.dts b/arch/arm/boot/dts/kirkwood-iomega_ix2_200.dts
index 3694e94..40e85aa 100644
--- a/arch/arm/boot/dts/kirkwood-iomega_ix2_200.dts
+++ b/arch/arm/boot/dts/kirkwood-iomega_ix2_200.dts
@@ -191,3 +191,25 @@
};
};
};
+
+&eth0 { status = "okay"; };
+&egiga0 {
+ status = "okay";
+ speed = <1000>;
+ duplex = <1>;
+};
+
+&eth1 { status = "okay"; };
+&egiga1 {
+ status = "okay";
+ phy = <&ethphy1>;
+};
+
+&mdio {
+ status = "okay";
+
+ ethphy1: ethernet-***@11 {
+ device_type = "ethernet-phy";
+ reg = <11>;
+ };
+};
diff --git a/arch/arm/boot/dts/kirkwood-is2.dts b/arch/arm/boot/dts/kirkwood-is2.dts
index 0bdce0a..2e5fe72 100644
--- a/arch/arm/boot/dts/kirkwood-is2.dts
+++ b/arch/arm/boot/dts/kirkwood-is2.dts
@@ -28,3 +28,5 @@
};
};
};
+
+&ethphy0 { reg = <8>; };
diff --git a/arch/arm/boot/dts/kirkwood-km_kirkwood.dts b/arch/arm/boot/dts/kirkwood-km_kirkwood.dts
index 5bbd054..fd97497 100644
--- a/arch/arm/boot/dts/kirkwood-km_kirkwood.dts
+++ b/arch/arm/boot/dts/kirkwood-km_kirkwood.dts
@@ -43,3 +43,18 @@
};
};
};
+
+&eth0 { status = "okay"; };
+&egiga0 {
+ status = "okay";
+ phy = <&ethphy0>;
+};
+
+&mdio {
+ status = "okay";
+
+ ethphy0: ethernet-***@0 {
+ device_type = "ethernet-phy";
+ reg = <0>;
+ };
+};
diff --git a/arch/arm/boot/dts/kirkwood-lsxl.dtsi b/arch/arm/boot/dts/kirkwood-lsxl.dtsi
index 37d45c4..e9d61db 100644
--- a/arch/arm/boot/dts/kirkwood-lsxl.dtsi
+++ b/arch/arm/boot/dts/kirkwood-lsxl.dtsi
@@ -201,3 +201,29 @@
};
};
};
+
+&eth0 { status = "okay"; };
+&egiga0 {
+ status = "okay";
+ phy = <&ethphy0>;
+};
+
+&eth1 { status = "okay"; };
+&egiga1 {
+ status = "okay";
+ phy = <&ethphy1>;
+};
+
+&mdio {
+ status = "okay";
+
+ ethphy0: ethernet-***@0 {
+ device_type = "ethernet-phy";
+ reg = <0>;
+ };
+
+ ethphy1: ethernet-***@8 {
+ device_type = "ethernet-phy";
+ reg = <8>;
+ };
+};
diff --git a/arch/arm/boot/dts/kirkwood-mplcec4.dts b/arch/arm/boot/dts/kirkwood-mplcec4.dts
index 7588241..326cc48 100644
--- a/arch/arm/boot/dts/kirkwood-mplcec4.dts
+++ b/arch/arm/boot/dts/kirkwood-mplcec4.dts
@@ -182,3 +182,28 @@
};
};

+&eth0 { status = "okay"; };
+&egiga0 {
+ status = "okay";
+ phy = <&ethphy0>;
+};
+
+&eth1 { status = "okay"; };
+&egiga1 {
+ status = "okay";
+ phy = <&ethphy1>;
+};
+
+&mdio {
+ status = "okay";
+
+ ethphy0: ethernet-***@1 {
+ device_type = "ethernet-phy";
+ reg = <1>;
+ };
+
+ ethphy1: ethernet-***@2 {
+ device_type = "ethernet-phy";
+ reg = <2>;
+ };
+};
diff --git a/arch/arm/boot/dts/kirkwood-netgear_readynas_duo_v2.dts b/arch/arm/boot/dts/kirkwood-netgear_readynas_duo_v2.dts
index 1ca66ab..f3b39f7 100644
--- a/arch/arm/boot/dts/kirkwood-netgear_readynas_duo_v2.dts
+++ b/arch/arm/boot/dts/kirkwood-netgear_readynas_duo_v2.dts
@@ -178,3 +178,18 @@
};
};
};
+
+&eth0 { status = "okay"; };
+&egiga0 {
+ status = "okay";
+ phy = <&ethphy0>;
+};
+
+&mdio {
+ status = "okay";
+
+ ethphy0: ethernet-***@0 {
+ device_type = "ethernet-phy";
+ reg = <0>;
+ };
+};
diff --git a/arch/arm/boot/dts/kirkwood-ns2-common.dtsi b/arch/arm/boot/dts/kirkwood-ns2-common.dtsi
index 6affd92..b205832 100644
--- a/arch/arm/boot/dts/kirkwood-ns2-common.dtsi
+++ b/arch/arm/boot/dts/kirkwood-ns2-common.dtsi
@@ -82,3 +82,18 @@
};

};
+
+&eth0 { status = "okay"; };
+&egiga0 {
+ status = "okay";
+ phy = <&ethphy0>;
+};
+
+&mdio {
+ status = "okay";
+
+ ethphy0: ethernet-phy {
+ device_type = "ethernet-phy";
+ /* overwrite reg property in board file */
+ };
+};
diff --git a/arch/arm/boot/dts/kirkwood-ns2.dts b/arch/arm/boot/dts/kirkwood-ns2.dts
index f2d36ecf..8ffd552 100644
--- a/arch/arm/boot/dts/kirkwood-ns2.dts
+++ b/arch/arm/boot/dts/kirkwood-ns2.dts
@@ -28,3 +28,5 @@
};
};
};
+
+&ethphy0 { reg = <8>; };
diff --git a/arch/arm/boot/dts/kirkwood-ns2lite.dts b/arch/arm/boot/dts/kirkwood-ns2lite.dts
index b02eb4e..16332f8 100644
--- a/arch/arm/boot/dts/kirkwood-ns2lite.dts
+++ b/arch/arm/boot/dts/kirkwood-ns2lite.dts
@@ -28,3 +28,5 @@
};
};
};
+
+&ethphy0 { reg = <0>; };
diff --git a/arch/arm/boot/dts/kirkwood-ns2max.dts b/arch/arm/boot/dts/kirkwood-ns2max.dts
index bcec4d6..68d767d 100644
--- a/arch/arm/boot/dts/kirkwood-ns2max.dts
+++ b/arch/arm/boot/dts/kirkwood-ns2max.dts
@@ -47,3 +47,5 @@
};
};
};
+
+&ethphy0 { reg = <8>; };
diff --git a/arch/arm/boot/dts/kirkwood-ns2mini.dts b/arch/arm/boot/dts/kirkwood-ns2mini.dts
index adab1ab..5b1b17b 100644
--- a/arch/arm/boot/dts/kirkwood-ns2mini.dts
+++ b/arch/arm/boot/dts/kirkwood-ns2mini.dts
@@ -48,3 +48,5 @@
};
};
};
+
+&ethphy0 { reg = <0>; };
diff --git a/arch/arm/boot/dts/kirkwood-openblocks_a6.dts b/arch/arm/boot/dts/kirkwood-openblocks_a6.dts
index d27f724..d8109f9 100644
--- a/arch/arm/boot/dts/kirkwood-openblocks_a6.dts
+++ b/arch/arm/boot/dts/kirkwood-openblocks_a6.dts
@@ -210,3 +210,18 @@
};
};
};
+
+&eth0 { status = "okay"; };
+&egiga0 {
+ status = "okay";
+ phy = <&ethphy0>;
+};
+
+&mdio {
+ status = "okay";
+
+ ethphy0: ethernet-***@0 {
+ device_type = "ethernet-phy";
+ reg = <0>;
+ };
+};
diff --git a/arch/arm/boot/dts/kirkwood-topkick.dts b/arch/arm/boot/dts/kirkwood-topkick.dts
index 66eb45b..dc3bb78 100644
--- a/arch/arm/boot/dts/kirkwood-topkick.dts
+++ b/arch/arm/boot/dts/kirkwood-topkick.dts
@@ -201,3 +201,18 @@
};
};
};
+
+&eth0 { status = "okay"; };
+&egiga0 {
+ status = "okay";
+ phy = <&ethphy0>;
+};
+
+&mdio {
+ status = "okay";
+
+ ethphy0: ethernet-***@0 {
+ device_type = "ethernet-phy";
+ reg = <0>;
+ };
+};
diff --git a/arch/arm/boot/dts/kirkwood-ts219-6281.dts b/arch/arm/boot/dts/kirkwood-ts219-6281.dts
index 8295c83..0bd67bf 100644
--- a/arch/arm/boot/dts/kirkwood-ts219-6281.dts
+++ b/arch/arm/boot/dts/kirkwood-ts219-6281.dts
@@ -49,4 +49,6 @@
gpios = <&gpio0 16 1>;
};
};
-};
\ No newline at end of file
+};
+
+&ethphy0 { reg = <8>; };
diff --git a/arch/arm/boot/dts/kirkwood-ts219-6282.dts b/arch/arm/boot/dts/kirkwood-ts219-6282.dts
index df3f95d..a1bdef6 100644
--- a/arch/arm/boot/dts/kirkwood-ts219-6282.dts
+++ b/arch/arm/boot/dts/kirkwood-ts219-6282.dts
@@ -49,4 +49,6 @@
gpios = <&gpio1 5 1>;
};
};
-};
\ No newline at end of file
+};
+
+&ethphy0 { reg = <8>; };
diff --git a/arch/arm/boot/dts/kirkwood-ts219.dtsi b/arch/arm/boot/dts/kirkwood-ts219.dtsi
index 64ea27c..5865dc5 100644
--- a/arch/arm/boot/dts/kirkwood-ts219.dtsi
+++ b/arch/arm/boot/dts/kirkwood-ts219.dtsi
@@ -76,3 +76,18 @@
};
};
};
+
+&eth0 { status = "okay"; };
+&egiga0 {
+ status = "okay";
+ phy = <&ethphy0>;
+};
+
+&mdio {
+ status = "okay";
+
+ ethphy0: ethernet-phy {
+ device_type = "ethernet-phy";
+ /* overwrite reg property in board file */
+ };
+};
diff --git a/arch/arm/boot/dts/kirkwood.dtsi b/arch/arm/boot/dts/kirkwood.dtsi
index fada7e6..c01a273 100644
--- a/arch/arm/boot/dts/kirkwood.dtsi
+++ b/arch/arm/boot/dts/kirkwood.dtsi
@@ -202,5 +202,57 @@
clocks = <&gate_clk 4>;
status = "disabled";
};
+
+ mdio: mdio-***@72004 {
+ compatible = "marvell,orion-mdio";
+ reg = <0x72004 0x84>;
+ interrupts = <11>;
+ clocks = <&gate_clk 0>;
+ #address-cells = <1>;
+ #size-cells = <0>;
+ status = "disabled";
+
+ /* add phy nodes in board file */
+ };
+
+ eth0: ethernet-***@72000 {
+ compatible = "marvell,mv643xx-eth-block";
+ reg = <0x72000 0x4000>;
+ clocks = <&gate_clk 0>;
+ #address-cells = <1>;
+ #size-cells = <0>;
+ tx-csum-limit = <1600>;
+ status = "disabled";
+
+ egiga0: ethernet-***@0 {
+ compatible = "marvell,mv643xx-eth";
+ device_type = "network";
+ reg = <0>;
+ interrupts = <11>;
+ clocks = <&gate_clk 0>;
+ /* set phy property in board file */
+ status = "disabled";
+ };
+ };
+
+ eth1: ethernet-***@76000 {
+ compatible = "marvell,mv643xx-eth-block";
+ reg = <0x76000 0x4000>;
+ clocks = <&gate_clk 19>;
+ #address-cells = <1>;
+ #size-cells = <0>;
+ tx-csum-limit = <1600>;
+ status = "disabled";
+
+ egiga1: ethernet-***@1 {
+ compatible = "marvell,mv643xx-eth";
+ device_type = "network";
+ reg = <1>;
+ interrupts = <15>;
+ clocks = <&gate_clk 19>;
+ /* set phy property in board file */
+ status = "disabled";
+ };
+ };
};
};
--
1.7.2.5
Simon Baatz
2013-05-20 21:27:08 UTC
Permalink
Hi Sebastian,
Post by Sebastian Hesselbarth
This patch adds mv643xx_eth and mvmdio device tree nodes for DT enabled
Kirkwood boards. Phy nodes are also added with reg property set on a
per-board basis.
...
Post by Sebastian Hesselbarth
diff --git a/arch/arm/boot/dts/kirkwood.dtsi b/arch/arm/boot/dts/kirkwood.dtsi
index fada7e6..c01a273 100644
--- a/arch/arm/boot/dts/kirkwood.dtsi
+++ b/arch/arm/boot/dts/kirkwood.dtsi
@@ -202,5 +202,57 @@
clocks = <&gate_clk 4>;
status = "disabled";
};
+
+ compatible = "marvell,orion-mdio";
+ reg = <0x72004 0x84>;
+ interrupts = <11>;
Shouldn't this be 46?

- Simon

--
To unsubscribe from this list: send the line "unsubscribe linux-doc" in
the body of a message to ***@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Sebastian Hesselbarth
2013-05-20 21:38:00 UTC
Permalink
Post by Simon Baatz
Hi Sebastian,
Post by Sebastian Hesselbarth
This patch adds mv643xx_eth and mvmdio device tree nodes for DT enabled
Kirkwood boards. Phy nodes are also added with reg property set on a
per-board basis.
...
Post by Sebastian Hesselbarth
diff --git a/arch/arm/boot/dts/kirkwood.dtsi b/arch/arm/boot/dts/kirkwood.dtsi
index fada7e6..c01a273 100644
--- a/arch/arm/boot/dts/kirkwood.dtsi
+++ b/arch/arm/boot/dts/kirkwood.dtsi
@@ -202,5 +202,57 @@
clocks =<&gate_clk 4>;
status = "disabled";
};
+
+ compatible = "marvell,orion-mdio";
+ reg =<0x72004 0x84>;
+ interrupts =<11>;
Shouldn't this be 46?
Yes, mdio is using GbE0Err interrupt and that is 14 on IRQ HIGH CAUSE.
I was misled by 11 on IRQ LOW CAUSE.

Sebastian
--
To unsubscribe from this list: send the line "unsubscribe linux-doc" in
the body of a message to ***@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Sebastian Hesselbarth
2013-05-06 15:33:40 UTC
Permalink
With all boards converted to DT enabled mv643xx_eth we can now
remove the clock alias for gbe clocks.

Signed-off-by: Sebastian Hesselbarth <sebastian.hesselbarth-***@public.gmane.org>
---
Cc: Grant Likely <grant.likely-QSEj5FYQhm4dnm+***@public.gmane.org>
Cc: Rob Herring <rob.herring-bsGFqQB8/***@public.gmane.org>
Cc: Rob Landley <rob-VoJi6FS/***@public.gmane.org>
Cc: Lennert Buytenhek <buytenh-OLH4Qvv75CYX/***@public.gmane.org>
Cc: David Miller <davem-fT/PcQaiUtIeIZ0/***@public.gmane.org>
Cc: Florian Fainelli <florian-***@public.gmane.org>
Cc: Arnaud Patard <arnaud.patard-dQbF7i+***@public.gmane.org>
Cc: Russell King <linux-lFZ/***@public.gmane.org>
Cc: Jason Cooper <jason-***@public.gmane.org>
Cc: Andrew Lunn <andrew-***@public.gmane.org>
Cc: Jean-Francois Moine <moinejf-***@public.gmane.org>
Cc: Thomas Petazzoni <thomas.petazzoni-wi1+55ScJUtKEb57/***@public.gmane.org>
Cc: Simon Guinot <simon.guinot-***@public.gmane.org>
Cc: Jamie Lentin <jm-Pj/***@public.gmane.org>
Cc: Michael Walle <michael-***@public.gmane.org>
Cc: Eric Hutter <hutter.eric-***@public.gmane.org>
Cc: Joshua Coombs <josh.coombs-***@public.gmane.org>
Cc: Willy Tarreau <***@1wt.eu>
Cc: Simon Baatz <gmbnomis-***@public.gmane.org>
Cc: Alan M Butler <alanbutty12-***@public.gmane.org>
Cc: Nigel Roberts <nigel-BZPLJ9//***@public.gmane.org>
Cc: Valentin Longchamp <valentin.longchamp-SkAbAL50j+***@public.gmane.org>
Cc: Stefan Peter <s.peter-***@public.gmane.org>
Cc: Arnaud Ebalard <arno-***@public.gmane.org>
Cc: Nobuhiro Iwamatsu <iwamatsu-+***@public.gmane.org>
Cc: netdev-***@public.gmane.org
Cc: devicetree-discuss-uLR06cmDAlY/***@public.gmane.org
Cc: linux-doc-***@public.gmane.org
Cc: linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+***@public.gmane.org
Cc: linux-kernel-***@public.gmane.org
---
arch/arm/mach-kirkwood/board-dt.c | 16 ----------------
1 files changed, 0 insertions(+), 16 deletions(-)

diff --git a/arch/arm/mach-kirkwood/board-dt.c b/arch/arm/mach-kirkwood/board-dt.c
index 7904758..f474cb9 100644
--- a/arch/arm/mach-kirkwood/board-dt.c
+++ b/arch/arm/mach-kirkwood/board-dt.c
@@ -42,7 +42,6 @@ static void __init kirkwood_legacy_clk_init(void)
struct device_node *np = of_find_compatible_node(
NULL, NULL, "marvell,kirkwood-gating-clock");
struct of_phandle_args clkspec;
- struct clk *clk;

clkspec.np = np;
clkspec.args_count = 1;
@@ -58,21 +57,6 @@ static void __init kirkwood_legacy_clk_init(void)
clkspec.args[0] = CGC_BIT_SDIO;
orion_clkdev_add(NULL, "mvsdio",
of_clk_get_from_provider(&clkspec));
-
- /*
- * The ethernet interfaces forget the MAC address assigned by
- * u-boot if the clocks are turned off. Until proper DT support
- * is available we always enable them for now.
- */
- clkspec.args[0] = CGC_BIT_GE0;
- clk = of_clk_get_from_provider(&clkspec);
- orion_clkdev_add(NULL, "mv643xx_eth_port.0", clk);
- clk_prepare_enable(clk);
-
- clkspec.args[0] = CGC_BIT_GE1;
- clk = of_clk_get_from_provider(&clkspec);
- orion_clkdev_add(NULL, "mv643xx_eth_port.1", clk);
- clk_prepare_enable(clk);
}

static void __init kirkwood_of_clk_init(void)
--
1.7.2.5
David Miller
2013-05-06 15:38:00 UTC
Permalink
Two things:

1) None of your postings make the mailing lists because your CC: line is
too large, and we block large ones because those are %99 of SPAM.

It really isn't reasonable to CC: so many people, and I do understand
that you're just sifting email addresses from MAINTAINERS or whatever,
but just use the appropriate mailing lists and the absolute most direct
developer(s). Probably just the person who you believe should apply
this patch.

2) Networking feature patch submissions are closed, as per:

http://marc.info/?l=linux-netdev&m=136730964130303&w=2

Therefore please resubmit this after the merge window is closed
and I have explicitly announced that the net-next tree is open again
for submissions.

Thanks.
--
To unsubscribe from this list: send the line "unsubscribe linux-doc" in
the body of a message to ***@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Jason Cooper
2013-05-06 16:07:43 UTC
Permalink
Sebastian,
Post by Sebastian Hesselbarth
This patch set picks up work by Florian Fainelli bringing full DT
support to mv643xx_eth and Marvell SoCs using it.
The current patch set drops Florian's device tree conversions for
Kirkwood, Dove, and Orion5x in favour of split patches for board
files and board descriptor files.
Device tree conversion for Dove and Kirkwood is added. Dove has
been fully tested, while Kirkwood is compile-tested only.
net: mv643xx_eth: add Device Tree bindings
net: mv643xx_eth: update Device Tree bindings documentation
Obviously, these will go through -net once the submission window opens.
(reordered for clarity)
Post by Sebastian Hesselbarth
ARM: dove: remove legacy mv643xx_eth setup
ARM: kirkwood: remove legacy mv643xx_eth board setup
ARM: kirkwood: remove legacy clk alias for mv643xx_eth
mvebu/boards or /soc.
Post by Sebastian Hesselbarth
ARM: kirkwood: add gigabit ethernet and mvmdio device tree nodes
ARM: dove: add gigabit ethernet and mvmdio device tree nodes
mvebu/dt


mvebu/dt and -net are fine. They have no dependencies. The problem is
mvebu/boards. To boot with networking, it needs -net *and* mvebu/dt.
Otherwise, the board needs to do legacy init.

I'd like to attempt to remove this dependency-hell with code. eg some
quick pseudo-code:

if (!dt_node_present("marvell,mv643xx_eth") ||
!mvebu_dt_bindings_present())
kirkwood_ge00_init();

The advantages of figuring this out are:
- *no* branch dependencies
- whole conversion done in one merge window

The drawbacks:
- need to remember to do a follow-on patch if all branches are
successfuly merged, removing the unneeded logic (after -rc1)
- considered churn?

The easy answer is to merge mvebu/dt, and -net, wait one cycle, and
merge the board stuff as you have it now (with Thomas' comment).

If we can figure this out, I'd like to do the same for the kirkwood-pcie
series.

thoughts?

thx,

Jason.
Sebastian Hesselbarth
2013-05-06 16:21:54 UTC
Permalink
Post by Florian Fainelli
Sebastian,
Post by Sebastian Hesselbarth
This patch set picks up work by Florian Fainelli bringing full DT
support to mv643xx_eth and Marvell SoCs using it.
The current patch set drops Florian's device tree conversions for
Kirkwood, Dove, and Orion5x in favour of split patches for board
files and board descriptor files.
Device tree conversion for Dove and Kirkwood is added. Dove has
been fully tested, while Kirkwood is compile-tested only.
net: mv643xx_eth: add Device Tree bindings
net: mv643xx_eth: update Device Tree bindings documentation
Obviously, these will go through -net once the submission window opens.
(reordered for clarity)
Post by Sebastian Hesselbarth
ARM: dove: remove legacy mv643xx_eth setup
ARM: kirkwood: remove legacy mv643xx_eth board setup
ARM: kirkwood: remove legacy clk alias for mv643xx_eth
mvebu/boards or /soc.
Post by Sebastian Hesselbarth
ARM: kirkwood: add gigabit ethernet and mvmdio device tree nodes
ARM: dove: add gigabit ethernet and mvmdio device tree nodes
mvebu/dt
mvebu/dt and -net are fine. They have no dependencies. The problem is
mvebu/boards. To boot with networking, it needs -net *and* mvebu/dt.
Otherwise, the board needs to do legacy init.
I'd like to attempt to remove this dependency-hell with code. eg some
if (!dt_node_present("marvell,mv643xx_eth") ||
!mvebu_dt_bindings_present())
kirkwood_ge00_init();
- *no* branch dependencies
- whole conversion done in one merge window
- need to remember to do a follow-on patch if all branches are
successfuly merged, removing the unneeded logic (after -rc1)
- considered churn?
The easy answer is to merge mvebu/dt, and -net, wait one cycle, and
merge the board stuff as you have it now (with Thomas' comment).
If we can figure this out, I'd like to do the same for the kirkwood-pcie
series.
Jason,

I suggest to take the "easy answer", i.e. merge mvebu/dt and -net and
take all board merges one cycle later.

Waiting for -net will stall irqchip but will give us enough time to
add DT timer and get rid of any legacy init code introduced for irqchip.
Also orion5x and mv78x00 can be added to mv643xx_eth conversion.

I am preparing empty board files removal as Thomas suggested.

Sebastian

P.S.: I was hoping that adding all people scripts/get_maintainers.pl
throws out, will notice all kirkwood board users ever committed to
mainline kernel. But as David Miller pointed out, it will not go through
SPAM filters that way. So have an eye open for v4 on mailing lists as
soon as -net merge window re-opens.
Valentin Longchamp
2013-05-07 09:10:24 UTC
Permalink
Sebastian,
Post by Sebastian Hesselbarth
This patch set picks up work by Florian Fainelli bringing full DT
support to mv643xx_eth and Marvell SoCs using it.
The current patch set drops Florian's device tree conversions for
Kirkwood, Dove, and Orion5x in favour of split patches for board
files and board descriptor files.
Device tree conversion for Dove and Kirkwood is added. Dove has
been fully tested, while Kirkwood is compile-tested only.
net: mv643xx_eth: add Device Tree bindings
net: mv643xx_eth: update Device Tree bindings documentation
ARM: dove: remove legacy mv643xx_eth setup
ARM: dove: add gigabit ethernet and mvmdio device tree nodes
ARM: kirkwood: remove legacy mv643xx_eth board setup
ARM: kirkwood: add gigabit ethernet and mvmdio device tree nodes
ARM: kirkwood: remove legacy clk alias for mv643xx_eth
I have successfully tested these patches on km_kirkwood, you can add my tested-by:

Tested-by: Valentin Longchamp<***@keymile.com>
Continue reading on narkive:
Loading...