From: Tony Lindgren <tony@atomide.com>
To: David Miller <davem@davemloft.net>
Cc: netdev@vger.kernel.org, linux-omap@vger.kernel.org,
Brian Hutchinson <b.hutchman@gmail.com>,
Felipe Balbi <balbi@ti.com>
Subject: [PATCH 5/6] net: davinci_emac: Fix ioremap for devices with MDIO within the EMAC address space
Date: Tue, 13 Jan 2015 11:29:27 -0800 [thread overview]
Message-ID: <1421177368-19756-6-git-send-email-tony@atomide.com> (raw)
In-Reply-To: <1421177368-19756-1-git-send-email-tony@atomide.com>
Some devices like dm816x have the MDIO registers within the first EMAC
instance address space. Let's fix the issue by allowing to pass an
optional second IO range for the EMAC control register area.
Cc: Brian Hutchinson <b.hutchman@gmail.com>
Cc: Felipe Balbi <balbi@ti.com>
Signed-off-by: Tony Lindgren <tony@atomide.com>
---
drivers/net/ethernet/ti/davinci_emac.c | 15 ++++++++++++---
1 file changed, 12 insertions(+), 3 deletions(-)
diff --git a/drivers/net/ethernet/ti/davinci_emac.c b/drivers/net/ethernet/ti/davinci_emac.c
index 4c8d82c..0342273 100644
--- a/drivers/net/ethernet/ti/davinci_emac.c
+++ b/drivers/net/ethernet/ti/davinci_emac.c
@@ -1877,7 +1877,7 @@ davinci_emac_of_get_pdata(struct platform_device *pdev, struct emac_priv *priv)
static int davinci_emac_probe(struct platform_device *pdev)
{
int rc = 0;
- struct resource *res;
+ struct resource *res, *res_ctrl;
struct net_device *ndev;
struct emac_priv *priv;
unsigned long hw_ram_addr;
@@ -1936,11 +1936,20 @@ static int davinci_emac_probe(struct platform_device *pdev)
rc = PTR_ERR(priv->remap_addr);
goto no_pdata;
}
+
+ res_ctrl = platform_get_resource(pdev, IORESOURCE_MEM, 1);
+ if (res_ctrl) {
+ priv->ctrl_base =
+ devm_ioremap_resource(&pdev->dev, res_ctrl);
+ if (IS_ERR(priv->ctrl_base))
+ goto no_pdata;
+ } else {
+ priv->ctrl_base = priv->remap_addr + pdata->ctrl_mod_reg_offset;
+ }
+
priv->emac_base = priv->remap_addr + pdata->ctrl_reg_offset;
ndev->base_addr = (unsigned long)priv->remap_addr;
- priv->ctrl_base = priv->remap_addr + pdata->ctrl_mod_reg_offset;
-
hw_ram_addr = pdata->hw_ram_addr;
if (!hw_ram_addr)
hw_ram_addr = (u32 __force)res->start + pdata->ctrl_ram_offset;
--
2.1.4
next prev parent reply other threads:[~2015-01-13 19:29 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-01-13 19:29 [PATCH 0/6] Fixes for davinci_emac Tony Lindgren
2015-01-13 19:29 ` [PATCH 1/6] net: davinci_emac: Fix hangs with interrupts Tony Lindgren
2015-01-13 19:36 ` Felipe Balbi
2015-01-13 19:45 ` Tony Lindgren
2015-01-13 19:29 ` [PATCH 2/6] net: davinci_emac: Fix runtime pm calls for davinci_emac Tony Lindgren
2015-01-13 19:51 ` Felipe Balbi
2015-01-13 20:54 ` Tony Lindgren
2015-01-13 21:03 ` Felipe Balbi
2015-01-13 23:42 ` Mark A. Greer
2015-01-13 19:29 ` [PATCH 3/6] net: davinci_emac: Free clock after checking the frequency Tony Lindgren
2015-01-13 19:48 ` Tom Lendacky
2015-01-13 19:50 ` Felipe Balbi
2015-01-13 20:15 ` Tony Lindgren
2015-01-13 19:54 ` Tony Lindgren
2015-01-13 21:05 ` David Miller
2015-01-14 19:10 ` Tony Lindgren
2015-01-13 19:29 ` [PATCH 4/6] net: davinci_emac: Fix incomplete code for getting the phy from device tree Tony Lindgren
2015-01-13 19:29 ` Tony Lindgren [this message]
2015-01-13 19:54 ` [PATCH 5/6] net: davinci_emac: Fix ioremap for devices with MDIO within the EMAC address space Felipe Balbi
2015-01-13 19:59 ` Tony Lindgren
2015-01-13 20:21 ` Felipe Balbi
2015-01-13 19:29 ` [PATCH 6/6] net: davinci_emac: Add support for emac on dm816x Tony Lindgren
-- strict thread matches above, loose matches on Subject: below --
2015-01-15 22:45 [PATCHv2 0/6] Fixes for davinci_emac Tony Lindgren
2015-01-15 22:45 ` [PATCH 5/6] net: davinci_emac: Fix ioremap for devices with MDIO within the EMAC address space Tony Lindgren
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=1421177368-19756-6-git-send-email-tony@atomide.com \
--to=tony@atomide.com \
--cc=b.hutchman@gmail.com \
--cc=balbi@ti.com \
--cc=davem@davemloft.net \
--cc=linux-omap@vger.kernel.org \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
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;
as well as URLs for NNTP newsgroup(s).