* [PATCH V2 1/2] stmmac: Add binding document for IMG Pistachio DWMAC @ 2015-04-06 21:42 Andrew Bresticker 2015-04-06 21:42 ` [PATCH V2 2/2] stmmac: Add IMG Pistachio platform glue layer Andrew Bresticker 0 siblings, 1 reply; 6+ messages in thread From: Andrew Bresticker @ 2015-04-06 21:42 UTC (permalink / raw) To: David S. Miller, Giuseppe Cavallaro Cc: devicetree-u79uwXL29TY76Z2rM5mHXA, netdev-u79uwXL29TY76Z2rM5mHXA, linux-kernel-u79uwXL29TY76Z2rM5mHXA, Andrew Bresticker, Rob Herring, Pawel Moll, Mark Rutland, Ian Campbell, Kumar Gala, James Hartley Add a binding document for the DWMAC ethernet controller found on the IMG Pistachio SoC. Signed-off-by: Andrew Bresticker <abrestic-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org> Cc: Rob Herring <robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org> Cc: Pawel Moll <pawel.moll-5wv7dgnIgG8@public.gmane.org> Cc: Mark Rutland <mark.rutland-5wv7dgnIgG8@public.gmane.org> Cc: Ian Campbell <ijc+devicetree-KcIKpvwj1kUDXYZnReoRVg@public.gmane.org> Cc: Kumar Gala <galak-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org> Cc: James Hartley <james.hartley-1AXoQHu6uovQT0dZR+AlfA@public.gmane.org> --- No changes from v1. --- .../devicetree/bindings/net/pistachio-dwmac.txt | 24 ++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 Documentation/devicetree/bindings/net/pistachio-dwmac.txt diff --git a/Documentation/devicetree/bindings/net/pistachio-dwmac.txt b/Documentation/devicetree/bindings/net/pistachio-dwmac.txt new file mode 100644 index 0000000..9781469 --- /dev/null +++ b/Documentation/devicetree/bindings/net/pistachio-dwmac.txt @@ -0,0 +1,24 @@ +IMG Pistachio Ethernet Controller +================================= + +This device is a variant of the DWMAC and inherits the properties described +in ./stmmac.txt. + +Required properties: +-------------------- + - compatible: Must contain "img,pistachio-dwmac" and "snps,dwmac". + - clocks: Must contain an entry for each entry in clock-names. + See ../clock/clock-bindings.txt for details. + - clock-names: Must include "stmmaceth" and "sys". + +Example: +-------- +ethernet@18140000 { + compatible = "img,pistachio-dwmac"; + reg = <0x18140000 0x2000>; + interrupts = <GIC_SHARED 50 IRQ_TYPE_LEVEL_HIGH>; + interrupt-names = "macirq"; + clocks = <&clk_core CLK_ENET>, <&cr_periph SYS_CLK_ENET>; + clock-names = "stmmaceth", "sys"; + phy-mode = "rmii"; +}; -- 2.2.0.rc0.207.ga3a616c -- 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] 6+ messages in thread
* [PATCH V2 2/2] stmmac: Add IMG Pistachio platform glue layer 2015-04-06 21:42 [PATCH V2 1/2] stmmac: Add binding document for IMG Pistachio DWMAC Andrew Bresticker @ 2015-04-06 21:42 ` Andrew Bresticker [not found] ` <1428356558-18367-2-git-send-email-abrestic-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org> 0 siblings, 1 reply; 6+ messages in thread From: Andrew Bresticker @ 2015-04-06 21:42 UTC (permalink / raw) To: David S. Miller, Giuseppe Cavallaro Cc: devicetree, netdev, linux-kernel, Andrew Bresticker, Govindraj Raja, James Hartley At the moment, the only additional setup required for the DWMAC on the IMG Pistachio SoC is to request and enable a separate gate clock for the register interface. Signed-off-by: Andrew Bresticker <abrestic@chromium.org> Signed-off-by: Govindraj Raja <govindraj.raja@imgtec.com> Cc: James Hartley <james.hartley@imgtec.com> --- Changes from v1: - Do not potentially assign an error pointer to pdata->sys_clk --- drivers/net/ethernet/stmicro/stmmac/Makefile | 3 +- .../net/ethernet/stmicro/stmmac/dwmac-pistachio.c | 59 ++++++++++++++++++++++ .../net/ethernet/stmicro/stmmac/stmmac_platform.c | 1 + .../net/ethernet/stmicro/stmmac/stmmac_platform.h | 1 + 4 files changed, 63 insertions(+), 1 deletion(-) create mode 100644 drivers/net/ethernet/stmicro/stmmac/dwmac-pistachio.c diff --git a/drivers/net/ethernet/stmicro/stmmac/Makefile b/drivers/net/ethernet/stmicro/stmmac/Makefile index 73c2715..8efb622 100644 --- a/drivers/net/ethernet/stmicro/stmmac/Makefile +++ b/drivers/net/ethernet/stmicro/stmmac/Makefile @@ -6,7 +6,8 @@ stmmac-objs:= stmmac_main.o stmmac_ethtool.o stmmac_mdio.o ring_mode.o \ obj-$(CONFIG_STMMAC_PLATFORM) += stmmac-platform.o stmmac-platform-objs:= stmmac_platform.o dwmac-meson.o dwmac-sunxi.o \ - dwmac-sti.o dwmac-socfpga.o dwmac-rk.o + dwmac-sti.o dwmac-socfpga.o dwmac-rk.o \ + dwmac-pistachio.o obj-$(CONFIG_STMMAC_PCI) += stmmac-pci.o stmmac-pci-objs:= stmmac_pci.o diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-pistachio.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-pistachio.c new file mode 100644 index 0000000..5e0b958 --- /dev/null +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-pistachio.c @@ -0,0 +1,59 @@ +/* + * IMG Pistachio DWMAC glue layer + * + * Copyright (C) 2015 Google, Inc. + * + * This program is free software; you can redistribute it and/or modify it + * under the terms and conditions of the GNU General Public License, + * version 2, as published by the Free Software Foundation. + */ + +#include <linux/clk.h> +#include <linux/kernel.h> +#include <linux/slab.h> +#include <linux/stmmac.h> + +struct pistachio_dwmac_priv_data { + struct clk *sys_clk; +}; + +static void *pistachio_dwmac_setup(struct platform_device *pdev) +{ + struct pistachio_dwmac_priv_data *pdata; + struct clk *clk; + + pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL); + if (!pdata) + return ERR_PTR(-ENOMEM); + + clk = devm_clk_get(&pdev->dev, "sys"); + if (IS_ERR(clk)) { + dev_err(&pdev->dev, "Failed to get sys clock: %ld\n", + PTR_ERR(clk)); + return clk; + } + pdata->sys_clk = clk; + + return pdata; +} + +static int pistachio_dwmac_init(struct platform_device *pdev, void *priv) +{ + struct pistachio_dwmac_priv_data *pdata = priv; + + return clk_prepare_enable(pdata->sys_clk); +} + +static void pistachio_dwmac_exit(struct platform_device *pdev, void *priv) +{ + struct pistachio_dwmac_priv_data *pdata = priv; + + clk_disable_unprepare(pdata->sys_clk); +} + +const struct stmmac_of_data pistachio_dwmac_data = { + .setup = pistachio_dwmac_setup, + .init = pistachio_dwmac_init, + .exit = pistachio_dwmac_exit, + .has_gmac = true, +}; diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c index f9b42f1..d5de361 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c @@ -34,6 +34,7 @@ static const struct of_device_id stmmac_dt_ids[] = { /* SoC specific glue layers should come before generic bindings */ { .compatible = "rockchip,rk3288-gmac", .data = &rk3288_gmac_data}, + { .compatible = "img,pistachio-dwmac", .data = &pistachio_dwmac_data}, { .compatible = "amlogic,meson6-dwmac", .data = &meson6_dwmac_data}, { .compatible = "allwinner,sun7i-a20-gmac", .data = &sun7i_gmac_data}, { .compatible = "st,stih415-dwmac", .data = &stih4xx_dwmac_data}, diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.h b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.h index 093eb99..101e635 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.h +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.h @@ -25,5 +25,6 @@ extern const struct stmmac_of_data stih4xx_dwmac_data; extern const struct stmmac_of_data stid127_dwmac_data; extern const struct stmmac_of_data socfpga_gmac_data; extern const struct stmmac_of_data rk3288_gmac_data; +extern const struct stmmac_of_data pistachio_dwmac_data; #endif /* __STMMAC_PLATFORM_H__ */ -- 2.2.0.rc0.207.ga3a616c ^ permalink raw reply related [flat|nested] 6+ messages in thread
[parent not found: <1428356558-18367-2-git-send-email-abrestic-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>]
* Re: [PATCH V2 2/2] stmmac: Add IMG Pistachio platform glue layer [not found] ` <1428356558-18367-2-git-send-email-abrestic-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org> @ 2015-04-06 22:10 ` Arnd Bergmann 2015-04-06 22:27 ` Andrew Bresticker 0 siblings, 1 reply; 6+ messages in thread From: Arnd Bergmann @ 2015-04-06 22:10 UTC (permalink / raw) To: Andrew Bresticker Cc: David S. Miller, Giuseppe Cavallaro, devicetree-u79uwXL29TY76Z2rM5mHXA, netdev-u79uwXL29TY76Z2rM5mHXA, linux-kernel-u79uwXL29TY76Z2rM5mHXA, Govindraj Raja, James Hartley On Monday 06 April 2015 14:42:38 Andrew Bresticker wrote: > At the moment, the only additional setup required for the DWMAC > on the IMG Pistachio SoC is to request and enable a separate gate > clock for the register interface. > > Signed-off-by: Andrew Bresticker <abrestic-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org> > Signed-off-by: Govindraj Raja <govindraj.raja-1AXoQHu6uovQT0dZR+AlfA@public.gmane.org> > Cc: James Hartley <james.hartley-1AXoQHu6uovQT0dZR+AlfA@public.gmane.org> Why do you need a special glue driver for that? Since you don't do anything special, I'd say it should be possible to handle this with just the default driver. Arnd -- 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] 6+ messages in thread
* Re: [PATCH V2 2/2] stmmac: Add IMG Pistachio platform glue layer 2015-04-06 22:10 ` Arnd Bergmann @ 2015-04-06 22:27 ` Andrew Bresticker [not found] ` <CAL1qeaFwt-VB6rUywHZ47gOx4fhd6LZLfvwqkydOtqWLkYbO8A-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org> 0 siblings, 1 reply; 6+ messages in thread From: Andrew Bresticker @ 2015-04-06 22:27 UTC (permalink / raw) To: Arnd Bergmann, James Hartley Cc: David S. Miller, Giuseppe Cavallaro, devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, netdev-u79uwXL29TY76Z2rM5mHXA, linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, Govindraj Raja On Mon, Apr 6, 2015 at 3:10 PM, Arnd Bergmann <arnd-r2nGTMty4D4@public.gmane.org> wrote: > On Monday 06 April 2015 14:42:38 Andrew Bresticker wrote: >> At the moment, the only additional setup required for the DWMAC >> on the IMG Pistachio SoC is to request and enable a separate gate >> clock for the register interface. >> >> Signed-off-by: Andrew Bresticker <abrestic-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org> >> Signed-off-by: Govindraj Raja <govindraj.raja-1AXoQHu6uovQT0dZR+AlfA@public.gmane.org> >> Cc: James Hartley <james.hartley-1AXoQHu6uovQT0dZR+AlfA@public.gmane.org> > > Why do you need a special glue driver for that? > > Since you don't do anything special, I'd say it should be possible > to handle this with just the default driver. Right, at the moment we only need to request and enable a second clock, which could be added to the core driver. If we don't expect to have to extend this driver to deal with other configurations (which IIRC there were some concerns about when I wrote this), then I'm fine with folding this change into the core driver - James? Thanks, Andrew -- 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] 6+ messages in thread
[parent not found: <CAL1qeaFwt-VB6rUywHZ47gOx4fhd6LZLfvwqkydOtqWLkYbO8A-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>]
* RE: [PATCH V2 2/2] stmmac: Add IMG Pistachio platform glue layer [not found] ` <CAL1qeaFwt-VB6rUywHZ47gOx4fhd6LZLfvwqkydOtqWLkYbO8A-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org> @ 2015-04-07 17:16 ` James Hartley 2015-04-07 20:40 ` Andrew Bresticker 0 siblings, 1 reply; 6+ messages in thread From: James Hartley @ 2015-04-07 17:16 UTC (permalink / raw) To: Andrew Bresticker, Arnd Bergmann Cc: David S. Miller, Giuseppe Cavallaro, devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, Govindraj Raja, Damien Horsley [-- Warning: decoded text below may be mangled, UTF-8 assumed --] [-- Attachment #1: Type: text/plain; charset="utf-8", Size: 1745 bytes --] > -----Original Message----- > From: abrestic@google.com [mailto:abrestic@google.com] On Behalf Of > Andrew Bresticker > Sent: 06 April 2015 23:28 > To: Arnd Bergmann; James Hartley > Cc: David S. Miller; Giuseppe Cavallaro; devicetree@vger.kernel.org; > netdev@vger.kernel.org; linux-kernel@vger.kernel.org; Govindraj Raja > Subject: Re: [PATCH V2 2/2] stmmac: Add IMG Pistachio platform glue layer > > On Mon, Apr 6, 2015 at 3:10 PM, Arnd Bergmann <arnd@arndb.de> wrote: > > On Monday 06 April 2015 14:42:38 Andrew Bresticker wrote: > >> At the moment, the only additional setup required for the DWMAC on > >> the IMG Pistachio SoC is to request and enable a separate gate clock > >> for the register interface. > >> > >> Signed-off-by: Andrew Bresticker <abrestic@chromium.org> > >> Signed-off-by: Govindraj Raja <govindraj.raja@imgtec.com> > >> Cc: James Hartley <james.hartley@imgtec.com> > > > > Why do you need a special glue driver for that? > > > > Since you don't do anything special, I'd say it should be possible to > > handle this with just the default driver. > > Right, at the moment we only need to request and enable a second clock, > which could be added to the core driver. If we don't expect to have to > extend this driver to deal with other configurations (which IIRC there were > some concerns about when I wrote this), then I'm fine with folding this change > into the core driver - James? Weren't the concerns about USB not Ethernet? I don't remember anything that would stop us extending the driver for eth. > > Thanks, > Andrew James. N§²æìr¸yúèØb²X¬¶Ç§vØ^)Þº{.nÇ+·zøzÚÞz)í æèw*\x1fjg¬±¨\x1e¶Ý¢j.ïÛ°\½½MúgjÌæa×\x02' ©Þ¢¸\f¢·¦j:+v¨wèjØm¶ÿ¾\a«êçzZ+ùÝ¢j"ú!¶i ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH V2 2/2] stmmac: Add IMG Pistachio platform glue layer 2015-04-07 17:16 ` James Hartley @ 2015-04-07 20:40 ` Andrew Bresticker 0 siblings, 0 replies; 6+ messages in thread From: Andrew Bresticker @ 2015-04-07 20:40 UTC (permalink / raw) To: James Hartley Cc: Arnd Bergmann, David S. Miller, Giuseppe Cavallaro, devicetree@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Govindraj Raja, Damien Horsley On Tue, Apr 7, 2015 at 10:16 AM, James Hartley <James.Hartley@imgtec.com> wrote: > > >> -----Original Message----- >> From: abrestic@google.com [mailto:abrestic@google.com] On Behalf Of >> Andrew Bresticker >> Sent: 06 April 2015 23:28 >> To: Arnd Bergmann; James Hartley >> Cc: David S. Miller; Giuseppe Cavallaro; devicetree@vger.kernel.org; >> netdev@vger.kernel.org; linux-kernel@vger.kernel.org; Govindraj Raja >> Subject: Re: [PATCH V2 2/2] stmmac: Add IMG Pistachio platform glue layer >> >> On Mon, Apr 6, 2015 at 3:10 PM, Arnd Bergmann <arnd@arndb.de> wrote: >> > On Monday 06 April 2015 14:42:38 Andrew Bresticker wrote: >> >> At the moment, the only additional setup required for the DWMAC on >> >> the IMG Pistachio SoC is to request and enable a separate gate clock >> >> for the register interface. >> >> >> >> Signed-off-by: Andrew Bresticker <abrestic@chromium.org> >> >> Signed-off-by: Govindraj Raja <govindraj.raja@imgtec.com> >> >> Cc: James Hartley <james.hartley@imgtec.com> >> > >> > Why do you need a special glue driver for that? >> > >> > Since you don't do anything special, I'd say it should be possible to >> > handle this with just the default driver. >> >> Right, at the moment we only need to request and enable a second clock, >> which could be added to the core driver. If we don't expect to have to >> extend this driver to deal with other configurations (which IIRC there were >> some concerns about when I wrote this), then I'm fine with folding this change >> into the core driver - James? > > Weren't the concerns about USB not Ethernet? I don't remember anything that > would stop us extending the driver for eth. OK, let's try this then: https://patchwork.kernel.org/patch/6174881/ -Andrew ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2015-04-07 20:40 UTC | newest] Thread overview: 6+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2015-04-06 21:42 [PATCH V2 1/2] stmmac: Add binding document for IMG Pistachio DWMAC Andrew Bresticker 2015-04-06 21:42 ` [PATCH V2 2/2] stmmac: Add IMG Pistachio platform glue layer Andrew Bresticker [not found] ` <1428356558-18367-2-git-send-email-abrestic-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org> 2015-04-06 22:10 ` Arnd Bergmann 2015-04-06 22:27 ` Andrew Bresticker [not found] ` <CAL1qeaFwt-VB6rUywHZ47gOx4fhd6LZLfvwqkydOtqWLkYbO8A-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org> 2015-04-07 17:16 ` James Hartley 2015-04-07 20:40 ` Andrew Bresticker
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).