* [PATCH v2 0/2] net, phy, smsc: add posibility to disable energy detect mode
@ 2015-10-17 4:04 Heiko Schocher
2015-10-17 4:04 ` [PATCH v2 1/2] drivers: net: cpsw: add phy-handle parsing Heiko Schocher
[not found] ` <1445054676-21523-1-git-send-email-hs-ynQEQJNshbs@public.gmane.org>
0 siblings, 2 replies; 4+ messages in thread
From: Heiko Schocher @ 2015-10-17 4:04 UTC (permalink / raw)
To: linux-kernel
Cc: Heiko Schocher, devicetree, Felipe Balbi, David S. Miller,
netdev, Florian Fainelli, Georg.Soffel, Tony Lindgren,
Lennart Sorensen, Mugunthan V N, Richard Cochran
On some boards the energy enable detect mode leads in
trouble with some switches, so make the enabling of
this mode configurable through DT.
Therefore the property "smsc,disable-energy-detect" is
introduced.
Patch 1 introduces phy-handle support for the ti,cpsw
driver. This is needed now for the smsc phy.
Patch 2 adds the disable energy mode functionality
to the smsc phy
Changes in v2:
- add comments from Florian Fainelli
- I did not change disable property name into enable
because I fear to break existing behaviour
- add smsc vendor prefix
- remove CONFIG_OF and use __maybe_unused
- introduce "phy-handle" ability into ti,cpsw
driver, so I can remove bogus:
if (!of_node && dev->parent->of_node)
of_node = dev->parent->of_node;
construct. Therefore new patch for the ti,cpsw
driver is necessary.
Heiko Schocher (2):
drivers: net: cpsw: add phy-handle parsing
net: phy: smsc: disable energy detect mode
Documentation/devicetree/bindings/net/cpsw.txt | 1 +
.../devicetree/bindings/net/smsc-lan87xx.txt | 24 ++++++++++++++++++++++
drivers/net/ethernet/ti/cpsw.c | 15 ++++++++++----
drivers/net/phy/smsc.c | 19 ++++++++++++-----
4 files changed, 50 insertions(+), 9 deletions(-)
create mode 100644 Documentation/devicetree/bindings/net/smsc-lan87xx.txt
--
2.1.0
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH v2 1/2] drivers: net: cpsw: add phy-handle parsing
2015-10-17 4:04 [PATCH v2 0/2] net, phy, smsc: add posibility to disable energy detect mode Heiko Schocher
@ 2015-10-17 4:04 ` Heiko Schocher
[not found] ` <1445054676-21523-1-git-send-email-hs-ynQEQJNshbs@public.gmane.org>
1 sibling, 0 replies; 4+ messages in thread
From: Heiko Schocher @ 2015-10-17 4:04 UTC (permalink / raw)
To: linux-kernel
Cc: Heiko Schocher, Felipe Balbi, David S. Miller, Tony Lindgren,
Lennart Sorensen, Mugunthan V N, Richard Cochran
add the ability to parse "phy-handle". This
is needed for phys, which have a DT node, and
need to parse DT properties.
Signed-off-by: Heiko Schocher <hs@denx.de>
---
Changes in v2: None
Documentation/devicetree/bindings/net/cpsw.txt | 1 +
drivers/net/ethernet/ti/cpsw.c | 15 +++++++++++----
2 files changed, 12 insertions(+), 4 deletions(-)
diff --git a/Documentation/devicetree/bindings/net/cpsw.txt b/Documentation/devicetree/bindings/net/cpsw.txt
index a9df21a..a2cae4e 100644
--- a/Documentation/devicetree/bindings/net/cpsw.txt
+++ b/Documentation/devicetree/bindings/net/cpsw.txt
@@ -39,6 +39,7 @@ Required properties:
Optional properties:
- dual_emac_res_vlan : Specifies VID to be used to segregate the ports
- mac-address : See ethernet.txt file in the same directory
+- phy-handle : See ethernet.txt file in the same directory
Note: "ti,hwmods" field is used to fetch the base address and irq
resources from TI, omap hwmod data base during device registration.
diff --git a/drivers/net/ethernet/ti/cpsw.c b/drivers/net/ethernet/ti/cpsw.c
index 8fc90f1..874fb29 100644
--- a/drivers/net/ethernet/ti/cpsw.c
+++ b/drivers/net/ethernet/ti/cpsw.c
@@ -30,6 +30,7 @@
#include <linux/delay.h>
#include <linux/pm_runtime.h>
#include <linux/of.h>
+#include <linux/of_mdio.h>
#include <linux/of_net.h>
#include <linux/of_device.h>
#include <linux/if_vlan.h>
@@ -365,6 +366,7 @@ struct cpsw_priv {
spinlock_t lock;
struct platform_device *pdev;
struct net_device *ndev;
+ struct device_node *phy_node;
struct napi_struct napi_rx;
struct napi_struct napi_tx;
struct device *dev;
@@ -1145,7 +1147,11 @@ static void cpsw_slave_open(struct cpsw_slave *slave, struct cpsw_priv *priv)
cpsw_ale_add_mcast(priv->ale, priv->ndev->broadcast,
1 << slave_port, 0, 0, ALE_MCAST_FWD_2);
- slave->phy = phy_connect(priv->ndev, slave->data->phy_id,
+ if (priv->phy_node)
+ slave->phy = of_phy_connect(priv->ndev, priv->phy_node,
+ &cpsw_adjust_link, 0, slave->data->phy_if);
+ else
+ slave->phy = phy_connect(priv->ndev, slave->data->phy_id,
&cpsw_adjust_link, slave->data->phy_if);
if (IS_ERR(slave->phy)) {
dev_err(priv->dev, "phy %s not found on slave %d\n",
@@ -1934,11 +1940,12 @@ static void cpsw_slave_init(struct cpsw_slave *slave, struct cpsw_priv *priv,
slave->port_vlan = data->dual_emac_res_vlan;
}
-static int cpsw_probe_dt(struct cpsw_platform_data *data,
+static int cpsw_probe_dt(struct cpsw_priv *priv,
struct platform_device *pdev)
{
struct device_node *node = pdev->dev.of_node;
struct device_node *slave_node;
+ struct cpsw_platform_data *data = &priv->data;
int i = 0, ret;
u32 prop;
@@ -2029,6 +2036,7 @@ static int cpsw_probe_dt(struct cpsw_platform_data *data,
if (strcmp(slave_node->name, "slave"))
continue;
+ priv->phy_node = of_parse_phandle(slave_node, "phy-handle", 0);
parp = of_get_property(slave_node, "phy_id", &lenp);
if ((parp == NULL) || (lenp != (sizeof(void *) * 2))) {
dev_err(&pdev->dev, "Missing slave[%d] phy_id property\n", i);
@@ -2044,7 +2052,6 @@ static int cpsw_probe_dt(struct cpsw_platform_data *data,
}
snprintf(slave_data->phy_id, sizeof(slave_data->phy_id),
PHY_ID_FMT, mdio->name, phyid);
-
slave_data->phy_if = of_get_phy_mode(slave_node);
if (slave_data->phy_if < 0) {
dev_err(&pdev->dev, "Missing or malformed slave[%d] phy-mode property\n",
@@ -2240,7 +2247,7 @@ static int cpsw_probe(struct platform_device *pdev)
/* Select default pin state */
pinctrl_pm_select_default_state(&pdev->dev);
- if (cpsw_probe_dt(&priv->data, pdev)) {
+ if (cpsw_probe_dt(priv, pdev)) {
dev_err(&pdev->dev, "cpsw: platform data missing\n");
ret = -ENODEV;
goto clean_runtime_disable_ret;
--
2.1.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH v2 2/2] net: phy: smsc: disable energy detect mode
[not found] ` <1445054676-21523-1-git-send-email-hs-ynQEQJNshbs@public.gmane.org>
@ 2015-10-17 4:04 ` Heiko Schocher
2015-10-21 13:42 ` [PATCH v2 0/2] net, phy, smsc: add posibility to " David Miller
1 sibling, 0 replies; 4+ messages in thread
From: Heiko Schocher @ 2015-10-17 4:04 UTC (permalink / raw)
To: linux-kernel-u79uwXL29TY76Z2rM5mHXA
Cc: Heiko Schocher, devicetree-u79uwXL29TY76Z2rM5mHXA,
netdev-u79uwXL29TY76Z2rM5mHXA,
Georg.Soffel-k21M0aUVSxZWk0Htik3J/w, Florian Fainelli
On some boards the energy enable detect mode leads in
trouble with some switches, so make the enabling of
this mode configurable through DT.
Signed-off-by: Heiko Schocher <hs-ynQEQJNshbs@public.gmane.org>
---
Changes in v2:
- add comments from Florian Fainelli
- I did not change disable property name into enable
because I fear to break existing behaviour
- add smsc vendor prefix
- remove CONFIG_OF and use __maybe_unused
- introduce "phy-handle" ability into ti,cpsw
driver, so I can remove bogus:
if (!of_node && dev->parent->of_node)
of_node = dev->parent->of_node;
construct. Therefore new patch for the ti,cpsw
driver is necessary.
.../devicetree/bindings/net/smsc-lan87xx.txt | 24 ++++++++++++++++++++++
drivers/net/phy/smsc.c | 19 ++++++++++++-----
2 files changed, 38 insertions(+), 5 deletions(-)
create mode 100644 Documentation/devicetree/bindings/net/smsc-lan87xx.txt
diff --git a/Documentation/devicetree/bindings/net/smsc-lan87xx.txt b/Documentation/devicetree/bindings/net/smsc-lan87xx.txt
new file mode 100644
index 0000000..974edd5
--- /dev/null
+++ b/Documentation/devicetree/bindings/net/smsc-lan87xx.txt
@@ -0,0 +1,24 @@
+SMSC LAN87xx Ethernet PHY
+
+Some boards require special tuning values. Configure them
+through an Ethernet OF device node.
+
+Optional properties:
+
+- smsc,disable-energy-detect:
+ If set, do not enable energy detect mode for the SMSC phy.
+ default: enable energy detect mode
+
+Examples:
+smsc phy with disabled energy detect mode on an am335x based board.
+&davinci_mdio {
+ pinctrl-names = "default", "sleep";
+ pinctrl-0 = <&davinci_mdio_default>;
+ pinctrl-1 = <&davinci_mdio_sleep>;
+ status = "okay";
+
+ ethernetphy0: ethernet-phy@0 {
+ reg = <0>;
+ smsc,disable-energy-detect;
+ };
+};
diff --git a/drivers/net/phy/smsc.c b/drivers/net/phy/smsc.c
index 70b0895..dc2da87 100644
--- a/drivers/net/phy/smsc.c
+++ b/drivers/net/phy/smsc.c
@@ -43,16 +43,25 @@ static int smsc_phy_ack_interrupt(struct phy_device *phydev)
static int smsc_phy_config_init(struct phy_device *phydev)
{
+ int __maybe_unused len;
+ struct device *dev __maybe_unused = &phydev->dev;
+ struct device_node *of_node __maybe_unused = dev->of_node;
int rc = phy_read(phydev, MII_LAN83C185_CTRL_STATUS);
+ int enable_energy = 1;
if (rc < 0)
return rc;
- /* Enable energy detect mode for this SMSC Transceivers */
- rc = phy_write(phydev, MII_LAN83C185_CTRL_STATUS,
- rc | MII_LAN83C185_EDPWRDOWN);
- if (rc < 0)
- return rc;
+ if (of_find_property(of_node, "smsc,disable-energy-detect", &len))
+ enable_energy = 0;
+
+ if (enable_energy) {
+ /* Enable energy detect mode for this SMSC Transceivers */
+ rc = phy_write(phydev, MII_LAN83C185_CTRL_STATUS,
+ rc | MII_LAN83C185_EDPWRDOWN);
+ if (rc < 0)
+ return rc;
+ }
return smsc_phy_ack_interrupt(phydev);
}
--
2.1.0
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH v2 0/2] net, phy, smsc: add posibility to disable energy detect mode
[not found] ` <1445054676-21523-1-git-send-email-hs-ynQEQJNshbs@public.gmane.org>
2015-10-17 4:04 ` [PATCH v2 2/2] net: phy: smsc: disable energy detect mode Heiko Schocher
@ 2015-10-21 13:42 ` David Miller
1 sibling, 0 replies; 4+ messages in thread
From: David Miller @ 2015-10-21 13:42 UTC (permalink / raw)
To: hs-ynQEQJNshbs
Cc: linux-kernel-u79uwXL29TY76Z2rM5mHXA,
devicetree-u79uwXL29TY76Z2rM5mHXA, balbi-l0cyMroinI0,
netdev-u79uwXL29TY76Z2rM5mHXA, f.fainelli-Re5JQEeQqe8AvxtiuMwx3w,
Georg.Soffel-k21M0aUVSxZWk0Htik3J/w, tony-4v6yS6AI5VpBDgjK7y7TUQ,
lsorense-1wCw9BSqJbv44Nm34jS7GywD8/FfD2ys,
mugunthanvnm-l0cyMroinI0, richardcochran-Re5JQEeQqe8AvxtiuMwx3w
From: Heiko Schocher <hs-ynQEQJNshbs@public.gmane.org>
Date: Sat, 17 Oct 2015 06:04:34 +0200
> On some boards the energy enable detect mode leads in
> trouble with some switches, so make the enabling of
> this mode configurable through DT.
> Therefore the property "smsc,disable-energy-detect" is
> introduced.
>
> Patch 1 introduces phy-handle support for the ti,cpsw
> driver. This is needed now for the smsc phy.
>
> Patch 2 adds the disable energy mode functionality
> to the smsc phy
Series applied, thanks.
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2015-10-21 13:42 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-10-17 4:04 [PATCH v2 0/2] net, phy, smsc: add posibility to disable energy detect mode Heiko Schocher
2015-10-17 4:04 ` [PATCH v2 1/2] drivers: net: cpsw: add phy-handle parsing Heiko Schocher
[not found] ` <1445054676-21523-1-git-send-email-hs-ynQEQJNshbs@public.gmane.org>
2015-10-17 4:04 ` [PATCH v2 2/2] net: phy: smsc: disable energy detect mode Heiko Schocher
2015-10-21 13:42 ` [PATCH v2 0/2] net, phy, smsc: add posibility to " David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).