Commit 542a64c7 authored by Hans de Goede's avatar Hans de Goede Committed by David S. Miller

net: sun4i-emac: Claim emac sram

Claim the emac sram ourselves, rather then relying on the bootloader
having mapped the sram to the emac controller during boot.
Signed-off-by: default avatarHans de Goede <hdegoede@redhat.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 2c0027cd
...@@ -28,6 +28,7 @@ ...@@ -28,6 +28,7 @@
#include <linux/of_platform.h> #include <linux/of_platform.h>
#include <linux/platform_device.h> #include <linux/platform_device.h>
#include <linux/phy.h> #include <linux/phy.h>
#include <linux/soc/sunxi/sunxi_sram.h>
#include "sun4i-emac.h" #include "sun4i-emac.h"
...@@ -857,11 +858,17 @@ static int emac_probe(struct platform_device *pdev) ...@@ -857,11 +858,17 @@ static int emac_probe(struct platform_device *pdev)
clk_prepare_enable(db->clk); clk_prepare_enable(db->clk);
ret = sunxi_sram_claim(&pdev->dev);
if (ret) {
dev_err(&pdev->dev, "Error couldn't map SRAM to device\n");
goto out;
}
db->phy_node = of_parse_phandle(np, "phy", 0); db->phy_node = of_parse_phandle(np, "phy", 0);
if (!db->phy_node) { if (!db->phy_node) {
dev_err(&pdev->dev, "no associated PHY\n"); dev_err(&pdev->dev, "no associated PHY\n");
ret = -ENODEV; ret = -ENODEV;
goto out; goto out_release_sram;
} }
/* Read MAC-address from DT */ /* Read MAC-address from DT */
...@@ -893,7 +900,7 @@ static int emac_probe(struct platform_device *pdev) ...@@ -893,7 +900,7 @@ static int emac_probe(struct platform_device *pdev)
if (ret) { if (ret) {
dev_err(&pdev->dev, "Registering netdev failed!\n"); dev_err(&pdev->dev, "Registering netdev failed!\n");
ret = -ENODEV; ret = -ENODEV;
goto out; goto out_release_sram;
} }
dev_info(&pdev->dev, "%s: at %p, IRQ %d MAC: %pM\n", dev_info(&pdev->dev, "%s: at %p, IRQ %d MAC: %pM\n",
...@@ -901,6 +908,8 @@ static int emac_probe(struct platform_device *pdev) ...@@ -901,6 +908,8 @@ static int emac_probe(struct platform_device *pdev)
return 0; return 0;
out_release_sram:
sunxi_sram_release(&pdev->dev);
out: out:
dev_err(db->dev, "not found (%d).\n", ret); dev_err(db->dev, "not found (%d).\n", ret);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment