aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2014-07-17 02:33:25 -0400
committerDavid S. Miller <davem@davemloft.net>2014-07-17 02:33:25 -0400
commitf7be2cba90c99e5f803fce2fa8e6dbf9960a9bf0 (patch)
treebada37eb1a3bca6993d078ad2d3ea98afe3e4cce
parent1373a7739e886cda3ed4848293dc9c46bc5d0d6a (diff)
parent0a0ea068728138641037daa5fce33cb06724285d (diff)
Merge branch 'davinci_mdio'
Grygorii Strashko says: ==================== net: davinci_mdio: reuse for keystone2 arch The similar MDIO HW blocks is used by keystone 2 SoCs as in Davinci SoCs: - one in Gigabit Ethernet (GbE) Switch Subsystem See http://www.ti.com/lit/ug/sprugv9d/sprugv9d.pdf - one in 10 Gigabit Ethernet Subsystem See http://www.ti.com/lit/ug/spruhj5/spruhj5.pdf Hence, reuse Davinci MDIO driver for Keystone 2 and enable TI networking for Keystone 2 devices. Also, as part of this series, enable PHY's creation from DT, because Keystone 2 supports DT boot mode only. Changes in v2: - review comments applied. Keystone 2 compatibility string changed to "ti,keystone_mdio". ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--Documentation/devicetree/bindings/net/davinci-mdio.txt8
-rw-r--r--drivers/net/ethernet/ti/Kconfig4
-rw-r--r--drivers/net/ethernet/ti/davinci_mdio.c21
3 files changed, 25 insertions, 8 deletions
diff --git a/Documentation/devicetree/bindings/net/davinci-mdio.txt b/Documentation/devicetree/bindings/net/davinci-mdio.txt
index 72efaaf764f7..0369e25aabd2 100644
--- a/Documentation/devicetree/bindings/net/davinci-mdio.txt
+++ b/Documentation/devicetree/bindings/net/davinci-mdio.txt
@@ -1,8 +1,8 @@
1TI SoC Davinci MDIO Controller Device Tree Bindings 1TI SoC Davinci/Keystone2 MDIO Controller Device Tree Bindings
2--------------------------------------------------- 2---------------------------------------------------
3 3
4Required properties: 4Required properties:
5- compatible : Should be "ti,davinci_mdio" 5- compatible : Should be "ti,davinci_mdio" or "ti,keystone_mdio"
6- reg : physical base address and size of the davinci mdio 6- reg : physical base address and size of the davinci mdio
7 registers map 7 registers map
8- bus_freq : Mdio Bus frequency 8- bus_freq : Mdio Bus frequency
@@ -19,7 +19,7 @@ file.
19Examples: 19Examples:
20 20
21 mdio: davinci_mdio@4A101000 { 21 mdio: davinci_mdio@4A101000 {
22 compatible = "ti,cpsw"; 22 compatible = "ti,davinci_mdio";
23 reg = <0x4A101000 0x1000>; 23 reg = <0x4A101000 0x1000>;
24 bus_freq = <1000000>; 24 bus_freq = <1000000>;
25 }; 25 };
@@ -27,7 +27,7 @@ Examples:
27(or) 27(or)
28 28
29 mdio: davinci_mdio@4A101000 { 29 mdio: davinci_mdio@4A101000 {
30 compatible = "ti,cpsw"; 30 compatible = "ti,davinci_mdio";
31 ti,hwmods = "davinci_mdio"; 31 ti,hwmods = "davinci_mdio";
32 bus_freq = <1000000>; 32 bus_freq = <1000000>;
33 }; 33 };
diff --git a/drivers/net/ethernet/ti/Kconfig b/drivers/net/ethernet/ti/Kconfig
index 53150c25a96b..1769700a6070 100644
--- a/drivers/net/ethernet/ti/Kconfig
+++ b/drivers/net/ethernet/ti/Kconfig
@@ -5,7 +5,7 @@
5config NET_VENDOR_TI 5config NET_VENDOR_TI
6 bool "Texas Instruments (TI) devices" 6 bool "Texas Instruments (TI) devices"
7 default y 7 default y
8 depends on PCI || EISA || AR7 || (ARM && (ARCH_DAVINCI || ARCH_OMAP3 || SOC_AM33XX)) 8 depends on PCI || EISA || AR7 || (ARM && (ARCH_DAVINCI || ARCH_OMAP3 || SOC_AM33XX || ARCH_KEYSTONE))
9 ---help--- 9 ---help---
10 If you have a network (Ethernet) card belonging to this class, say Y 10 If you have a network (Ethernet) card belonging to this class, say Y
11 and read the Ethernet-HOWTO, available from 11 and read the Ethernet-HOWTO, available from
@@ -32,7 +32,7 @@ config TI_DAVINCI_EMAC
32 32
33config TI_DAVINCI_MDIO 33config TI_DAVINCI_MDIO
34 tristate "TI DaVinci MDIO Support" 34 tristate "TI DaVinci MDIO Support"
35 depends on ARM && ( ARCH_DAVINCI || ARCH_OMAP3 || SOC_AM33XX ) 35 depends on ARM && ( ARCH_DAVINCI || ARCH_OMAP3 || SOC_AM33XX || ARCH_KEYSTONE )
36 select PHYLIB 36 select PHYLIB
37 ---help--- 37 ---help---
38 This driver supports TI's DaVinci MDIO module. 38 This driver supports TI's DaVinci MDIO module.
diff --git a/drivers/net/ethernet/ti/davinci_mdio.c b/drivers/net/ethernet/ti/davinci_mdio.c
index 735dc53d4b01..2791f6f2db11 100644
--- a/drivers/net/ethernet/ti/davinci_mdio.c
+++ b/drivers/net/ethernet/ti/davinci_mdio.c
@@ -38,6 +38,7 @@
38#include <linux/davinci_emac.h> 38#include <linux/davinci_emac.h>
39#include <linux/of.h> 39#include <linux/of.h>
40#include <linux/of_device.h> 40#include <linux/of_device.h>
41#include <linux/of_mdio.h>
41#include <linux/pinctrl/consumer.h> 42#include <linux/pinctrl/consumer.h>
42 43
43/* 44/*
@@ -95,6 +96,10 @@ struct davinci_mdio_data {
95 struct mii_bus *bus; 96 struct mii_bus *bus;
96 bool suspended; 97 bool suspended;
97 unsigned long access_time; /* jiffies */ 98 unsigned long access_time; /* jiffies */
99 /* Indicates that driver shouldn't modify phy_mask in case
100 * if MDIO bus is registered from DT.
101 */
102 bool skip_scan;
98}; 103};
99 104
100static void __davinci_mdio_reset(struct davinci_mdio_data *data) 105static void __davinci_mdio_reset(struct davinci_mdio_data *data)
@@ -144,6 +149,9 @@ static int davinci_mdio_reset(struct mii_bus *bus)
144 dev_info(data->dev, "davinci mdio revision %d.%d\n", 149 dev_info(data->dev, "davinci mdio revision %d.%d\n",
145 (ver >> 8) & 0xff, ver & 0xff); 150 (ver >> 8) & 0xff, ver & 0xff);
146 151
152 if (data->skip_scan)
153 return 0;
154
147 /* get phy mask from the alive register */ 155 /* get phy mask from the alive register */
148 phy_mask = __raw_readl(&data->regs->alive); 156 phy_mask = __raw_readl(&data->regs->alive);
149 if (phy_mask) { 157 if (phy_mask) {
@@ -369,8 +377,17 @@ static int davinci_mdio_probe(struct platform_device *pdev)
369 goto bail_out; 377 goto bail_out;
370 } 378 }
371 379
372 /* register the mii bus */ 380 /* register the mii bus
373 ret = mdiobus_register(data->bus); 381 * Create PHYs from DT only in case if PHY child nodes are explicitly
382 * defined to support backward compatibility with DTs which assume that
383 * Davinci MDIO will always scan the bus for PHYs detection.
384 */
385 if (dev->of_node && of_get_child_count(dev->of_node)) {
386 data->skip_scan = true;
387 ret = of_mdiobus_register(data->bus, dev->of_node);
388 } else {
389 ret = mdiobus_register(data->bus);
390 }
374 if (ret) 391 if (ret)
375 goto bail_out; 392 goto bail_out;
376 393