* [PATCH] net: sun4i-emac: Claim emac sram
@ 2015-08-23 18:31 Hans de Goede
2015-08-24 7:46 ` Maxime Ripard
2015-08-25 20:49 ` David Miller
0 siblings, 2 replies; 5+ messages in thread
From: Hans de Goede @ 2015-08-23 18:31 UTC (permalink / raw)
To: linux-arm-kernel
Claim the emac sram ourselves, rather then relying on the bootloader
having mapped the sram to the emac controller during boot.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
drivers/net/ethernet/allwinner/sun4i-emac.c | 13 +++++++++++--
1 file changed, 11 insertions(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/allwinner/sun4i-emac.c b/drivers/net/ethernet/allwinner/sun4i-emac.c
index bab01c84..48ce83e 100644
--- a/drivers/net/ethernet/allwinner/sun4i-emac.c
+++ b/drivers/net/ethernet/allwinner/sun4i-emac.c
@@ -28,6 +28,7 @@
#include <linux/of_platform.h>
#include <linux/platform_device.h>
#include <linux/phy.h>
+#include <linux/soc/sunxi/sunxi_sram.h>
#include "sun4i-emac.h"
@@ -857,11 +858,17 @@ static int emac_probe(struct platform_device *pdev)
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);
if (!db->phy_node) {
dev_err(&pdev->dev, "no associated PHY\n");
ret = -ENODEV;
- goto out;
+ goto out_release_sram;
}
/* Read MAC-address from DT */
@@ -893,7 +900,7 @@ static int emac_probe(struct platform_device *pdev)
if (ret) {
dev_err(&pdev->dev, "Registering netdev failed!\n");
ret = -ENODEV;
- goto out;
+ goto out_release_sram;
}
dev_info(&pdev->dev, "%s: at %p, IRQ %d MAC: %pM\n",
@@ -901,6 +908,8 @@ static int emac_probe(struct platform_device *pdev)
return 0;
+out_release_sram:
+ sunxi_sram_release(&pdev->dev);
out:
dev_err(db->dev, "not found (%d).\n", ret);
--
2.4.3
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH] net: sun4i-emac: Claim emac sram
2015-08-23 18:31 [PATCH] net: sun4i-emac: Claim emac sram Hans de Goede
@ 2015-08-24 7:46 ` Maxime Ripard
2015-08-24 9:17 ` [linux-sunxi] " Hans de Goede
2015-08-25 20:49 ` David Miller
1 sibling, 1 reply; 5+ messages in thread
From: Maxime Ripard @ 2015-08-24 7:46 UTC (permalink / raw)
To: linux-arm-kernel
Hi Hans,
On Sun, Aug 23, 2015 at 08:31:38PM +0200, Hans de Goede wrote:
> Claim the emac sram ourselves, rather then relying on the bootloader
> having mapped the sram to the emac controller during boot.
>
> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
> ---
> drivers/net/ethernet/allwinner/sun4i-emac.c | 13 +++++++++++--
> 1 file changed, 11 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/net/ethernet/allwinner/sun4i-emac.c b/drivers/net/ethernet/allwinner/sun4i-emac.c
> index bab01c84..48ce83e 100644
> --- a/drivers/net/ethernet/allwinner/sun4i-emac.c
> +++ b/drivers/net/ethernet/allwinner/sun4i-emac.c
> @@ -28,6 +28,7 @@
> #include <linux/of_platform.h>
> #include <linux/platform_device.h>
> #include <linux/phy.h>
> +#include <linux/soc/sunxi/sunxi_sram.h>
>
> #include "sun4i-emac.h"
>
> @@ -857,11 +858,17 @@ static int emac_probe(struct platform_device *pdev)
>
> 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;
Shouldn't you disable you clock too?
Thanks,
Maxime
--
Maxime Ripard, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20150824/2ab019ef/attachment.sig>
^ permalink raw reply [flat|nested] 5+ messages in thread
* [linux-sunxi] Re: [PATCH] net: sun4i-emac: Claim emac sram
2015-08-24 7:46 ` Maxime Ripard
@ 2015-08-24 9:17 ` Hans de Goede
2015-08-24 13:39 ` Maxime Ripard
0 siblings, 1 reply; 5+ messages in thread
From: Hans de Goede @ 2015-08-24 9:17 UTC (permalink / raw)
To: linux-arm-kernel
Hi,
On 24-08-15 09:46, Maxime Ripard wrote:
> Hi Hans,
>
> On Sun, Aug 23, 2015 at 08:31:38PM +0200, Hans de Goede wrote:
>> Claim the emac sram ourselves, rather then relying on the bootloader
>> having mapped the sram to the emac controller during boot.
>>
>> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
>> ---
>> drivers/net/ethernet/allwinner/sun4i-emac.c | 13 +++++++++++--
>> 1 file changed, 11 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/net/ethernet/allwinner/sun4i-emac.c b/drivers/net/ethernet/allwinner/sun4i-emac.c
>> index bab01c84..48ce83e 100644
>> --- a/drivers/net/ethernet/allwinner/sun4i-emac.c
>> +++ b/drivers/net/ethernet/allwinner/sun4i-emac.c
>> @@ -28,6 +28,7 @@
>> #include <linux/of_platform.h>
>> #include <linux/platform_device.h>
>> #include <linux/phy.h>
>> +#include <linux/soc/sunxi/sunxi_sram.h>
>>
>> #include "sun4i-emac.h"
>>
>> @@ -857,11 +858,17 @@ static int emac_probe(struct platform_device *pdev)
>>
>> 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;
>
> Shouldn't you disable you clock too?
You're right, but that is a pre-existing problem, iow an unrelated issue.
I've put doing a follow-up patch for this on my todo list.
Regards,
Hans
^ permalink raw reply [flat|nested] 5+ messages in thread
* [linux-sunxi] Re: [PATCH] net: sun4i-emac: Claim emac sram
2015-08-24 9:17 ` [linux-sunxi] " Hans de Goede
@ 2015-08-24 13:39 ` Maxime Ripard
0 siblings, 0 replies; 5+ messages in thread
From: Maxime Ripard @ 2015-08-24 13:39 UTC (permalink / raw)
To: linux-arm-kernel
On Mon, Aug 24, 2015 at 11:17:43AM +0200, Hans de Goede wrote:
> Hi,
>
> On 24-08-15 09:46, Maxime Ripard wrote:
> >Hi Hans,
> >
> >On Sun, Aug 23, 2015 at 08:31:38PM +0200, Hans de Goede wrote:
> >>Claim the emac sram ourselves, rather then relying on the bootloader
> >>having mapped the sram to the emac controller during boot.
> >>
> >>Signed-off-by: Hans de Goede <hdegoede@redhat.com>
> >>---
> >> drivers/net/ethernet/allwinner/sun4i-emac.c | 13 +++++++++++--
> >> 1 file changed, 11 insertions(+), 2 deletions(-)
> >>
> >>diff --git a/drivers/net/ethernet/allwinner/sun4i-emac.c b/drivers/net/ethernet/allwinner/sun4i-emac.c
> >>index bab01c84..48ce83e 100644
> >>--- a/drivers/net/ethernet/allwinner/sun4i-emac.c
> >>+++ b/drivers/net/ethernet/allwinner/sun4i-emac.c
> >>@@ -28,6 +28,7 @@
> >> #include <linux/of_platform.h>
> >> #include <linux/platform_device.h>
> >> #include <linux/phy.h>
> >>+#include <linux/soc/sunxi/sunxi_sram.h>
> >>
> >> #include "sun4i-emac.h"
> >>
> >>@@ -857,11 +858,17 @@ static int emac_probe(struct platform_device *pdev)
> >>
> >> 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;
> >
> >Shouldn't you disable you clock too?
>
> You're right, but that is a pre-existing problem, iow an unrelated
> issue.
>
> I've put doing a follow-up patch for this on my todo list.
Thanks.
Maxime
--
Maxime Ripard, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20150824/54747424/attachment.sig>
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH] net: sun4i-emac: Claim emac sram
2015-08-23 18:31 [PATCH] net: sun4i-emac: Claim emac sram Hans de Goede
2015-08-24 7:46 ` Maxime Ripard
@ 2015-08-25 20:49 ` David Miller
1 sibling, 0 replies; 5+ messages in thread
From: David Miller @ 2015-08-25 20:49 UTC (permalink / raw)
To: linux-arm-kernel
From: Hans de Goede <hdegoede@redhat.com>
Date: Sun, 23 Aug 2015 20:31:38 +0200
> Claim the emac sram ourselves, rather then relying on the bootloader
> having mapped the sram to the emac controller during boot.
>
> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Applied to net-next, thanks.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2015-08-25 20:49 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-08-23 18:31 [PATCH] net: sun4i-emac: Claim emac sram Hans de Goede
2015-08-24 7:46 ` Maxime Ripard
2015-08-24 9:17 ` [linux-sunxi] " Hans de Goede
2015-08-24 13:39 ` Maxime Ripard
2015-08-25 20:49 ` 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).