* net: stmmac glue layer for Amlogic Meson SoCs
@ 2014-09-20 13:29 Beniamino Galvani
2014-09-20 13:29 ` [PATCH 1/2] net: stmmac: add Amlogic Meson glue layer Beniamino Galvani
` (3 more replies)
0 siblings, 4 replies; 6+ messages in thread
From: Beniamino Galvani @ 2014-09-20 13:29 UTC (permalink / raw)
To: netdev
Cc: Giuseppe Cavallaro, David S. Miller, Rob Herring, Pawel Moll,
Mark Rutland, Ian Campbell, Kumar Gala, Carlo Caione, Jerry Cao,
Victor Wan, linux-kernel, devicetree, Beniamino Galvani
Hi,
the Ethernet controller available in Amlogic Meson6 and Meson8 SoCs is
a Synopsys DesignWare MAC IP core, already supported by the stmmac
driver.
These patches add a glue layer to the driver for the platform-specific
settings required by the Amlogic variant.
This has been tested on a Amlogic S802 device with the initial Meson
support submitted by Carlo Caione [1].
[1] http://lwn.net/Articles/612000/
Beniamino Galvani (2):
net: stmmac: add Amlogic Meson glue layer
net: stmmac: meson: document device tree bindings
.../devicetree/bindings/net/meson-dwmac.txt | 25 ++++++++
drivers/net/ethernet/stmicro/stmmac/Kconfig | 10 ++++
drivers/net/ethernet/stmicro/stmmac/Makefile | 1 +
drivers/net/ethernet/stmicro/stmmac/dwmac-meson.c | 67 ++++++++++++++++++++++
drivers/net/ethernet/stmicro/stmmac/stmmac.h | 3 +
.../net/ethernet/stmicro/stmmac/stmmac_platform.c | 3 +
6 files changed, 109 insertions(+)
create mode 100644 Documentation/devicetree/bindings/net/meson-dwmac.txt
create mode 100644 drivers/net/ethernet/stmicro/stmmac/dwmac-meson.c
--
1.9.1
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 1/2] net: stmmac: add Amlogic Meson glue layer
2014-09-20 13:29 net: stmmac glue layer for Amlogic Meson SoCs Beniamino Galvani
@ 2014-09-20 13:29 ` Beniamino Galvani
2014-09-20 13:29 ` [PATCH 2/2] net: stmmac: meson: document device tree bindings Beniamino Galvani
` (2 subsequent siblings)
3 siblings, 0 replies; 6+ messages in thread
From: Beniamino Galvani @ 2014-09-20 13:29 UTC (permalink / raw)
To: netdev
Cc: Giuseppe Cavallaro, David S. Miller, Rob Herring, Pawel Moll,
Mark Rutland, Ian Campbell, Kumar Gala, Carlo Caione, Jerry Cao,
Victor Wan, linux-kernel, devicetree, Beniamino Galvani
The Ethernet controller available in Meson6 and Meson8 SoCs is a
Synopsys DesignWare MAC IP core, already supported by the stmmac
driver.
This glue layer implements some platform-specific settings needed by
the Amlogic variant.
Signed-off-by: Beniamino Galvani <b.galvani@gmail.com>
---
drivers/net/ethernet/stmicro/stmmac/Kconfig | 10 ++++
drivers/net/ethernet/stmicro/stmmac/Makefile | 1 +
drivers/net/ethernet/stmicro/stmmac/dwmac-meson.c | 67 ++++++++++++++++++++++
drivers/net/ethernet/stmicro/stmmac/stmmac.h | 3 +
.../net/ethernet/stmicro/stmmac/stmmac_platform.c | 3 +
5 files changed, 84 insertions(+)
create mode 100644 drivers/net/ethernet/stmicro/stmmac/dwmac-meson.c
diff --git a/drivers/net/ethernet/stmicro/stmmac/Kconfig b/drivers/net/ethernet/stmicro/stmmac/Kconfig
index 2d09c11..b02d4a3 100644
--- a/drivers/net/ethernet/stmicro/stmmac/Kconfig
+++ b/drivers/net/ethernet/stmicro/stmmac/Kconfig
@@ -26,6 +26,16 @@ config STMMAC_PLATFORM
If unsure, say N.
+config DWMAC_MESON
+ bool "Amlogic Meson dwmac support"
+ depends on STMMAC_PLATFORM && ARCH_MESON
+ help
+ Support for Ethernet controller on Amlogic Meson SoCs.
+
+ This selects the Amlogic Meson SoC glue layer support for
+ the stmmac device driver. This driver is used for Meson6 and
+ Meson8 SoCs.
+
config DWMAC_SOCFPGA
bool "SOCFPGA dwmac support"
depends on STMMAC_PLATFORM && MFD_SYSCON && (ARCH_SOCFPGA || COMPILE_TEST)
diff --git a/drivers/net/ethernet/stmicro/stmmac/Makefile b/drivers/net/ethernet/stmicro/stmmac/Makefile
index 18695eb..0533d0b 100644
--- a/drivers/net/ethernet/stmicro/stmmac/Makefile
+++ b/drivers/net/ethernet/stmicro/stmmac/Makefile
@@ -1,6 +1,7 @@
obj-$(CONFIG_STMMAC_ETH) += stmmac.o
stmmac-$(CONFIG_STMMAC_PLATFORM) += stmmac_platform.o
stmmac-$(CONFIG_STMMAC_PCI) += stmmac_pci.o
+stmmac-$(CONFIG_DWMAC_MESON) += dwmac-meson.o
stmmac-$(CONFIG_DWMAC_SUNXI) += dwmac-sunxi.o
stmmac-$(CONFIG_DWMAC_STI) += dwmac-sti.o
stmmac-$(CONFIG_DWMAC_SOCFPGA) += dwmac-socfpga.o
diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-meson.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-meson.c
new file mode 100644
index 0000000..d225a60
--- /dev/null
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-meson.c
@@ -0,0 +1,67 @@
+/*
+ * Amlogic Meson DWMAC glue layer
+ *
+ * Copyright (C) 2014 Beniamino Galvani <b.galvani@gmail.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <linux/device.h>
+#include <linux/ethtool.h>
+#include <linux/io.h>
+#include <linux/ioport.h>
+#include <linux/platform_device.h>
+#include <linux/stmmac.h>
+
+#define ETHMAC_SPEED_100 BIT(1)
+
+struct meson_dwmac {
+ struct device *dev;
+ void __iomem *reg;
+};
+
+static void meson6_dwmac_fix_mac_speed(void *priv, unsigned int speed)
+{
+ struct meson_dwmac *dwmac = priv;
+ unsigned int val;
+
+ val = readl(dwmac->reg);
+
+ switch (speed) {
+ case SPEED_10:
+ val &= ~ETHMAC_SPEED_100;
+ break;
+ case SPEED_100:
+ val |= ETHMAC_SPEED_100;
+ break;
+ }
+
+ writel(val, dwmac->reg);
+}
+
+static void *meson6_dwmac_setup(struct platform_device *pdev)
+{
+ struct meson_dwmac *dwmac;
+ struct resource *res;
+
+ dwmac = devm_kzalloc(&pdev->dev, sizeof(*dwmac), GFP_KERNEL);
+ if (!dwmac)
+ return ERR_PTR(-ENOMEM);
+
+ res = platform_get_resource(pdev, IORESOURCE_MEM, 1);
+ dwmac->reg = devm_ioremap_resource(&pdev->dev, res);
+ if (IS_ERR(dwmac->reg))
+ return dwmac->reg;
+
+ return dwmac;
+}
+
+const struct stmmac_of_data meson6_dwmac_data = {
+ .setup = meson6_dwmac_setup,
+ .fix_mac_speed = meson6_dwmac_fix_mac_speed,
+};
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac.h b/drivers/net/ethernet/stmicro/stmmac/stmmac.h
index 58097c0..4452889 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac.h
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac.h
@@ -137,6 +137,9 @@ void stmmac_disable_eee_mode(struct stmmac_priv *priv);
bool stmmac_eee_init(struct stmmac_priv *priv);
#ifdef CONFIG_STMMAC_PLATFORM
+#ifdef CONFIG_DWMAC_MESON
+extern const struct stmmac_of_data meson6_dwmac_data;
+#endif
#ifdef CONFIG_DWMAC_SUNXI
extern const struct stmmac_of_data sun7i_gmac_data;
#endif
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
index bb524a9..6521717 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
@@ -30,6 +30,9 @@
#include "stmmac.h"
static const struct of_device_id stmmac_dt_ids[] = {
+#ifdef CONFIG_DWMAC_MESON
+ { .compatible = "amlogic,meson6-dwmac", .data = &meson6_dwmac_data},
+#endif
#ifdef CONFIG_DWMAC_SUNXI
{ .compatible = "allwinner,sun7i-a20-gmac", .data = &sun7i_gmac_data},
#endif
--
1.9.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 2/2] net: stmmac: meson: document device tree bindings
2014-09-20 13:29 net: stmmac glue layer for Amlogic Meson SoCs Beniamino Galvani
2014-09-20 13:29 ` [PATCH 1/2] net: stmmac: add Amlogic Meson glue layer Beniamino Galvani
@ 2014-09-20 13:29 ` Beniamino Galvani
[not found] ` <1411219757-9201-1-git-send-email-b.galvani-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2014-09-26 4:13 ` David Miller
3 siblings, 0 replies; 6+ messages in thread
From: Beniamino Galvani @ 2014-09-20 13:29 UTC (permalink / raw)
To: netdev
Cc: Giuseppe Cavallaro, David S. Miller, Rob Herring, Pawel Moll,
Mark Rutland, Ian Campbell, Kumar Gala, Carlo Caione, Jerry Cao,
Victor Wan, linux-kernel, devicetree, Beniamino Galvani
Add the device tree bindings documentation for the Amlogic Meson
variant of the Synopsys DesignWare MAC.
Signed-off-by: Beniamino Galvani <b.galvani@gmail.com>
---
.../devicetree/bindings/net/meson-dwmac.txt | 25 ++++++++++++++++++++++
1 file changed, 25 insertions(+)
create mode 100644 Documentation/devicetree/bindings/net/meson-dwmac.txt
diff --git a/Documentation/devicetree/bindings/net/meson-dwmac.txt b/Documentation/devicetree/bindings/net/meson-dwmac.txt
new file mode 100644
index 0000000..ec633d7
--- /dev/null
+++ b/Documentation/devicetree/bindings/net/meson-dwmac.txt
@@ -0,0 +1,25 @@
+* Amlogic Meson DWMAC Ethernet controller
+
+The device inherits all the properties of the dwmac/stmmac devices
+described in the file net/stmmac.txt with the following changes.
+
+Required properties:
+
+- compatible: should be "amlogic,meson6-dwmac" along with "snps,dwmac"
+ and any applicable more detailed version number
+ described in net/stmmac.txt
+
+- reg: should contain a register range for the dwmac controller and
+ another one for the Amlogic specific configuration
+
+Example:
+
+ ethmac: ethernet@c9410000 {
+ compatible = "amlogic,meson6-dwmac", "snps,dwmac";
+ reg = <0xc9410000 0x10000
+ 0xc1108108 0x4>;
+ interrupts = <0 8 1>;
+ interrupt-names = "macirq";
+ clocks = <&clk81>;
+ clock-names = "stmmaceth";
+ }
--
1.9.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: net: stmmac glue layer for Amlogic Meson SoCs
[not found] ` <1411219757-9201-1-git-send-email-b.galvani-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
@ 2014-09-23 6:16 ` Giuseppe CAVALLARO
2014-09-23 11:15 ` Beniamino Galvani
0 siblings, 1 reply; 6+ messages in thread
From: Giuseppe CAVALLARO @ 2014-09-23 6:16 UTC (permalink / raw)
To: Beniamino Galvani, netdev-u79uwXL29TY76Z2rM5mHXA
Cc: David S. Miller, Rob Herring, Pawel Moll, Mark Rutland,
Ian Campbell, Kumar Gala, Carlo Caione, Jerry Cao, Victor Wan,
linux-kernel-u79uwXL29TY76Z2rM5mHXA,
devicetree-u79uwXL29TY76Z2rM5mHXA
On 9/20/2014 3:29 PM, Beniamino Galvani wrote:
> Hi,
>
> the Ethernet controller available in Amlogic Meson6 and Meson8 SoCs is
> a Synopsys DesignWare MAC IP core, already supported by the stmmac
> driver.
>
> These patches add a glue layer to the driver for the platform-specific
> settings required by the Amlogic variant.
>
> This has been tested on a Amlogic S802 device with the initial Meson
> support submitted by Carlo Caione [1].
patches look fine just a warning with checkpatch as shown below then
Acked-by: Giuseppe Cavallaro <peppe.cavallaro-qxv4g6HH51o@public.gmane.org>
[cavagiu@lxmcdt5 net.git]$ git-format-patch -2
0001-net-stmmac-add-Amlogic-Meson-glue-layer.patch
0002-net-stmmac-meson-document-device-tree-bindings.patch
[cavagiu@lxmcdt5 net.git]$ !./
./scripts/checkpatch.pl 000*
WARNING: added, moved or deleted file(s), does MAINTAINERS need updating?
#57:
new file mode 100644
WARNING: DT compatible string vendor "amlogic" appears un-documented --
check ./Documentation/devicetree/bindings/vendor-prefixes.txt
#152: FILE: drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c:34:
+ { .compatible = "amlogic,meson6-dwmac", .data = &meson6_dwmac_data},
total: 0 errors, 2 warnings, 0 checks, 108 lines checked
0001-net-stmmac-add-Amlogic-Meson-glue-layer.patch has style problems,
please review.
If any of these errors are false positives, please report
them to the maintainer, see CHECKPATCH in MAINTAINERS.
WARNING: added, moved or deleted file(s), does MAINTAINERS need updating?
#17:
new file mode 100644
total: 0 errors, 1 warnings, 25 lines checked
0002-net-stmmac-meson-document-device-tree-bindings.patch has style
problems, please review.
If any of these errors are false positives, please report
them to the maintainer, see CHECKPATCH in MAINTAINERS.
>
> [1] http://lwn.net/Articles/612000/
>
> Beniamino Galvani (2):
> net: stmmac: add Amlogic Meson glue layer
> net: stmmac: meson: document device tree bindings
>
> .../devicetree/bindings/net/meson-dwmac.txt | 25 ++++++++
> drivers/net/ethernet/stmicro/stmmac/Kconfig | 10 ++++
> drivers/net/ethernet/stmicro/stmmac/Makefile | 1 +
> drivers/net/ethernet/stmicro/stmmac/dwmac-meson.c | 67 ++++++++++++++++++++++
> drivers/net/ethernet/stmicro/stmmac/stmmac.h | 3 +
> .../net/ethernet/stmicro/stmmac/stmmac_platform.c | 3 +
> 6 files changed, 109 insertions(+)
> create mode 100644 Documentation/devicetree/bindings/net/meson-dwmac.txt
> create mode 100644 drivers/net/ethernet/stmicro/stmmac/dwmac-meson.c
>
--
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: net: stmmac glue layer for Amlogic Meson SoCs
2014-09-23 6:16 ` net: stmmac glue layer for Amlogic Meson SoCs Giuseppe CAVALLARO
@ 2014-09-23 11:15 ` Beniamino Galvani
0 siblings, 0 replies; 6+ messages in thread
From: Beniamino Galvani @ 2014-09-23 11:15 UTC (permalink / raw)
To: Giuseppe CAVALLARO
Cc: netdev, David S. Miller, Rob Herring, Pawel Moll, Mark Rutland,
Ian Campbell, Kumar Gala, Carlo Caione, Jerry Cao, Victor Wan,
linux-kernel, devicetree
On Tue, Sep 23, 2014 at 08:16:18AM +0200, Giuseppe CAVALLARO wrote:
> On 9/20/2014 3:29 PM, Beniamino Galvani wrote:
> >Hi,
> >
> >the Ethernet controller available in Amlogic Meson6 and Meson8 SoCs is
> >a Synopsys DesignWare MAC IP core, already supported by the stmmac
> >driver.
> >
> >These patches add a glue layer to the driver for the platform-specific
> >settings required by the Amlogic variant.
> >
> >This has been tested on a Amlogic S802 device with the initial Meson
> >support submitted by Carlo Caione [1].
>
> patches look fine just a warning with checkpatch as shown below then
>
> Acked-by: Giuseppe Cavallaro <peppe.cavallaro@st.com>
>
>
> [cavagiu@lxmcdt5 net.git]$ git-format-patch -2
> 0001-net-stmmac-add-Amlogic-Meson-glue-layer.patch
> 0002-net-stmmac-meson-document-device-tree-bindings.patch
> [cavagiu@lxmcdt5 net.git]$ !./
> ./scripts/checkpatch.pl 000*
> WARNING: added, moved or deleted file(s), does MAINTAINERS need updating?
> #57:
> new file mode 100644
>
> WARNING: DT compatible string vendor "amlogic" appears un-documented
> -- check ./Documentation/devicetree/bindings/vendor-prefixes.txt
> #152: FILE: drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c:34:
> + { .compatible = "amlogic,meson6-dwmac", .data = &meson6_dwmac_data},
Hi Giuseppe,
thanks for the review. The amlogic vendor prefix is documented as part
of the initial Meson support in the series reported in the cover
letter.
Beniamino
>
> total: 0 errors, 2 warnings, 0 checks, 108 lines checked
>
> 0001-net-stmmac-add-Amlogic-Meson-glue-layer.patch has style
> problems, please review.
>
> If any of these errors are false positives, please report
> them to the maintainer, see CHECKPATCH in MAINTAINERS.
> WARNING: added, moved or deleted file(s), does MAINTAINERS need updating?
> #17:
> new file mode 100644
>
> total: 0 errors, 1 warnings, 25 lines checked
>
> 0002-net-stmmac-meson-document-device-tree-bindings.patch has style
> problems, please review.
>
> If any of these errors are false positives, please report
> them to the maintainer, see CHECKPATCH in MAINTAINERS.
>
> >
> >[1] http://lwn.net/Articles/612000/
> >
> >Beniamino Galvani (2):
> > net: stmmac: add Amlogic Meson glue layer
> > net: stmmac: meson: document device tree bindings
> >
> > .../devicetree/bindings/net/meson-dwmac.txt | 25 ++++++++
> > drivers/net/ethernet/stmicro/stmmac/Kconfig | 10 ++++
> > drivers/net/ethernet/stmicro/stmmac/Makefile | 1 +
> > drivers/net/ethernet/stmicro/stmmac/dwmac-meson.c | 67 ++++++++++++++++++++++
> > drivers/net/ethernet/stmicro/stmmac/stmmac.h | 3 +
> > .../net/ethernet/stmicro/stmmac/stmmac_platform.c | 3 +
> > 6 files changed, 109 insertions(+)
> > create mode 100644 Documentation/devicetree/bindings/net/meson-dwmac.txt
> > create mode 100644 drivers/net/ethernet/stmicro/stmmac/dwmac-meson.c
> >
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: net: stmmac glue layer for Amlogic Meson SoCs
2014-09-20 13:29 net: stmmac glue layer for Amlogic Meson SoCs Beniamino Galvani
` (2 preceding siblings ...)
[not found] ` <1411219757-9201-1-git-send-email-b.galvani-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
@ 2014-09-26 4:13 ` David Miller
3 siblings, 0 replies; 6+ messages in thread
From: David Miller @ 2014-09-26 4:13 UTC (permalink / raw)
To: b.galvani
Cc: netdev, peppe.cavallaro, robh+dt, pawel.moll, mark.rutland,
ijc+devicetree, galak, carlo, jerry.cao, victor.wan, linux-kernel,
devicetree
From: Beniamino Galvani <b.galvani@gmail.com>
Date: Sat, 20 Sep 2014 15:29:15 +0200
>
> the Ethernet controller available in Amlogic Meson6 and Meson8 SoCs is
> a Synopsys DesignWare MAC IP core, already supported by the stmmac
> driver.
>
> These patches add a glue layer to the driver for the platform-specific
> settings required by the Amlogic variant.
>
> This has been tested on a Amlogic S802 device with the initial Meson
> support submitted by Carlo Caione [1].
>
> [1] http://lwn.net/Articles/612000/
Series applied to net-next, thanks.
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2014-09-26 4:13 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-09-20 13:29 net: stmmac glue layer for Amlogic Meson SoCs Beniamino Galvani
2014-09-20 13:29 ` [PATCH 1/2] net: stmmac: add Amlogic Meson glue layer Beniamino Galvani
2014-09-20 13:29 ` [PATCH 2/2] net: stmmac: meson: document device tree bindings Beniamino Galvani
[not found] ` <1411219757-9201-1-git-send-email-b.galvani-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2014-09-23 6:16 ` net: stmmac glue layer for Amlogic Meson SoCs Giuseppe CAVALLARO
2014-09-23 11:15 ` Beniamino Galvani
2014-09-26 4:13 ` 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).