From: Mathieu Olivari <mathieu@codeaurora•org>
To: robh+dt@kernel•org, pawel.moll@arm•com, mark.rutland@arm•com,
ijc+devicetree@hellion•org.uk, galak@codeaurora•org,
mturquette@linaro•org, sboyd@codeaurora•org,
peppe.cavallaro@st•com, mathieu@codeaurora•org,
agross@codeaurora•org, joshc@codeaurora•org,
architt@codeaurora•org, georgi.djakov@linaro•org,
wsa@the-dreams•de, rnayak@codeaurora•org, davem@davemloft•net,
vbridger@opensource•altera.com
Cc: devicetree@vger•kernel.org, linux-kernel@vger•kernel.org,
linux-clk@vger•kernel.org, netdev@vger•kernel.org
Subject: [PATCH V2 3/5] stmmac: add fixed-link device-tree support
Date: Wed, 27 May 2015 11:02:48 -0700 [thread overview]
Message-ID: <1432749770-26133-4-git-send-email-mathieu@codeaurora.org> (raw)
In-Reply-To: <1432749770-26133-1-git-send-email-mathieu@codeaurora.org>
In case DT is used, this change adds the ability to the stmmac driver to
detect a fixed-link PHY, instanciate it, and use it during
phy_connect().
Fixed link PHYs DT usage is described in:
Documentation/devicetree/bindings/net/fixed-link.txt
Signed-off-by: Mathieu Olivari <mathieu@codeaurora•org>
---
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 2 +-
drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c | 12 +++++++++++-
2 files changed, 12 insertions(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index 31c6416..c46178c 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -856,7 +856,7 @@ static int stmmac_init_phy(struct net_device *dev)
* device as well.
* Note: phydev->phy_id is the result of reading the UID PHY registers.
*/
- if (phydev->phy_id == 0) {
+ if (!priv->plat->phy_node && phydev->phy_id == 0) {
phy_disconnect(phydev);
return -ENODEV;
}
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
index 8d23155..f3918c7 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
@@ -148,6 +148,14 @@ static int stmmac_probe_config_dt(struct platform_device *pdev,
/* If we find a phy-handle property, use it as the PHY */
plat->phy_node = of_parse_phandle(np, "phy-handle", 0);
+ /* If phy-handle is not specified, check if we have a fixed-phy */
+ if (!plat->phy_node && of_phy_is_fixed_link(np)) {
+ if ((of_phy_register_fixed_link(np) < 0))
+ return -ENODEV;
+
+ plat->phy_node = of_node_get(np);
+ }
+
/* "snps,phy-addr" is not a standard property. Mark it as deprecated
* and warn of its use. Remove this when phy node support is added.
*/
@@ -212,8 +220,10 @@ static int stmmac_probe_config_dt(struct platform_device *pdev,
if (of_find_property(np, "snps,pbl", NULL)) {
dma_cfg = devm_kzalloc(&pdev->dev, sizeof(*dma_cfg),
GFP_KERNEL);
- if (!dma_cfg)
+ if (!dma_cfg) {
+ of_node_put(np);
return -ENOMEM;
+ }
plat->dma_cfg = dma_cfg;
of_property_read_u32(np, "snps,pbl", &dma_cfg->pbl);
dma_cfg->fixed_burst =
--
2.1.4
next prev parent reply other threads:[~2015-05-27 18:02 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-05-27 18:02 [PATCH V2 0/5] Add support for QCA IPQ806x Ethernet GMAC controller Mathieu Olivari
[not found] ` <1432749770-26133-1-git-send-email-mathieu-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
2015-05-27 18:02 ` [PATCH V2 1/5] clk: qcom: Add support for NSS/GMAC clocks and resets Mathieu Olivari
2015-05-27 18:02 ` [PATCH V2 2/5] stmmac: add phy-handle support to the platform layer Mathieu Olivari
2015-05-27 18:02 ` [PATCH V2 4/5] stmmac: add ipq806x glue layer Mathieu Olivari
2015-05-27 18:02 ` Mathieu Olivari [this message]
2015-05-27 18:02 ` [PATCH V2 5/5] net: stmmac: ipq806x: document device tree bindings Mathieu Olivari
2015-05-31 0:05 ` [PATCH V2 0/5] Add support for QCA IPQ806x Ethernet GMAC controller David Miller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1432749770-26133-4-git-send-email-mathieu@codeaurora.org \
--to=mathieu@codeaurora$(echo .)org \
--cc=agross@codeaurora$(echo .)org \
--cc=architt@codeaurora$(echo .)org \
--cc=davem@davemloft$(echo .)net \
--cc=devicetree@vger$(echo .)kernel.org \
--cc=galak@codeaurora$(echo .)org \
--cc=georgi.djakov@linaro$(echo .)org \
--cc=ijc+devicetree@hellion$(echo .)org.uk \
--cc=joshc@codeaurora$(echo .)org \
--cc=linux-clk@vger$(echo .)kernel.org \
--cc=linux-kernel@vger$(echo .)kernel.org \
--cc=mark.rutland@arm$(echo .)com \
--cc=mturquette@linaro$(echo .)org \
--cc=netdev@vger$(echo .)kernel.org \
--cc=pawel.moll@arm$(echo .)com \
--cc=peppe.cavallaro@st$(echo .)com \
--cc=rnayak@codeaurora$(echo .)org \
--cc=robh+dt@kernel$(echo .)org \
--cc=sboyd@codeaurora$(echo .)org \
--cc=vbridger@opensource$(echo .)altera.com \
--cc=wsa@the-dreams$(echo .)de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox