All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net-next 00/11] convert stmmac glue layers into platform drivers
@ 2015-05-14 10:10 ` Joachim Eastwood
  0 siblings, 0 replies; 37+ messages in thread
From: Joachim Eastwood @ 2015-05-14 10:10 UTC (permalink / raw)
  To: arnd, peppe.cavallaro, roger.chen, wens, srinivas.kandagatla,
	dinguyen, b.galvani
  Cc: Joachim Eastwood, netdev, davem, linux-arm-kernel, linux-rockchip

This patch set aims to convert the current dwmac glue layers into
proper platform drivers as request by Arnd[1]. These changes start
from patch 3 and onwards.

Overview:
Platform driver functions like probe and remove are exported from
the stmmac platform and then used in subsequent glue later
conversions. The conversion involes adding the platform driver
boiler plate code and adding it to the build system. The last patch
removes the driver from the stmmac platform code thus making it into
a library for common platform driver functions.

The two first patches adds glue layer for my platform. I chose to
first add old style glue layer and then convert it. The churn this
creates is just 3 lines.

I would be very nice if people could test this patch set on their
respective platform. My testing has been limited to compiling and
testing on my (LPC18xx) platform. Thanks!

Next I will look into cleaning up the stmmac platform code.

[1] http://marc.info/?l=linux-arm-kernel&m=143059524606459&w=2

Joachim Eastwood (11):
  stmmac: add dwmac glue for NXP 18xx/43xx family
  doc: dt: add documentation for nxp,lpc1850-dwmac
  stmmac: prepare stmmac platform to support stand alone drivers
  stmmac: add a generic dwmac driver
  stmmac: convert dwmac-lpc18xx to a platform driver
  stmmac: convert dwmac-meson to platform driver
  stmmac: convert dwmac-rk to platform driver
  stmmac: convert dwmac-socfpga to platform driver
  stmmac: convert dwmac-sti to platform driver
  stmmac: convert dwmac-sunxi to platform driver
  stmmac: drop driver from stmmac platform code

 .../devicetree/bindings/net/nxp,lpc1850-dwmac.txt  | 20 +++++
 drivers/net/ethernet/stmicro/stmmac/Kconfig        | 76 +++++++++++++++++
 drivers/net/ethernet/stmicro/stmmac/Makefile       | 13 ++-
 .../net/ethernet/stmicro/stmmac/dwmac-generic.c    | 41 +++++++++
 .../net/ethernet/stmicro/stmmac/dwmac-lpc18xx.c    | 99 ++++++++++++++++++++++
 drivers/net/ethernet/stmicro/stmmac/dwmac-meson.c  | 24 +++++-
 drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c     | 27 +++++-
 .../net/ethernet/stmicro/stmmac/dwmac-socfpga.c    | 21 ++++-
 drivers/net/ethernet/stmicro/stmmac/dwmac-sti.c    | 29 ++++++-
 drivers/net/ethernet/stmicro/stmmac/dwmac-sunxi.c  | 25 +++++-
 .../net/ethernet/stmicro/stmmac/stmmac_platform.c  | 49 ++---------
 .../net/ethernet/stmicro/stmmac/stmmac_platform.h  |  9 +-
 12 files changed, 378 insertions(+), 55 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/net/nxp,lpc1850-dwmac.txt
 create mode 100644 drivers/net/ethernet/stmicro/stmmac/dwmac-generic.c
 create mode 100644 drivers/net/ethernet/stmicro/stmmac/dwmac-lpc18xx.c

-- 
1.8.0

^ permalink raw reply	[flat|nested] 37+ messages in thread

* [PATCH net-next 00/11] convert stmmac glue layers into platform drivers
@ 2015-05-14 10:10 ` Joachim Eastwood
  0 siblings, 0 replies; 37+ messages in thread
From: Joachim Eastwood @ 2015-05-14 10:10 UTC (permalink / raw)
  To: linux-arm-kernel

This patch set aims to convert the current dwmac glue layers into
proper platform drivers as request by Arnd[1]. These changes start
from patch 3 and onwards.

Overview:
Platform driver functions like probe and remove are exported from
the stmmac platform and then used in subsequent glue later
conversions. The conversion involes adding the platform driver
boiler plate code and adding it to the build system. The last patch
removes the driver from the stmmac platform code thus making it into
a library for common platform driver functions.

The two first patches adds glue layer for my platform. I chose to
first add old style glue layer and then convert it. The churn this
creates is just 3 lines.

I would be very nice if people could test this patch set on their
respective platform. My testing has been limited to compiling and
testing on my (LPC18xx) platform. Thanks!

Next I will look into cleaning up the stmmac platform code.

[1] http://marc.info/?l=linux-arm-kernel&m=143059524606459&w=2

Joachim Eastwood (11):
  stmmac: add dwmac glue for NXP 18xx/43xx family
  doc: dt: add documentation for nxp,lpc1850-dwmac
  stmmac: prepare stmmac platform to support stand alone drivers
  stmmac: add a generic dwmac driver
  stmmac: convert dwmac-lpc18xx to a platform driver
  stmmac: convert dwmac-meson to platform driver
  stmmac: convert dwmac-rk to platform driver
  stmmac: convert dwmac-socfpga to platform driver
  stmmac: convert dwmac-sti to platform driver
  stmmac: convert dwmac-sunxi to platform driver
  stmmac: drop driver from stmmac platform code

 .../devicetree/bindings/net/nxp,lpc1850-dwmac.txt  | 20 +++++
 drivers/net/ethernet/stmicro/stmmac/Kconfig        | 76 +++++++++++++++++
 drivers/net/ethernet/stmicro/stmmac/Makefile       | 13 ++-
 .../net/ethernet/stmicro/stmmac/dwmac-generic.c    | 41 +++++++++
 .../net/ethernet/stmicro/stmmac/dwmac-lpc18xx.c    | 99 ++++++++++++++++++++++
 drivers/net/ethernet/stmicro/stmmac/dwmac-meson.c  | 24 +++++-
 drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c     | 27 +++++-
 .../net/ethernet/stmicro/stmmac/dwmac-socfpga.c    | 21 ++++-
 drivers/net/ethernet/stmicro/stmmac/dwmac-sti.c    | 29 ++++++-
 drivers/net/ethernet/stmicro/stmmac/dwmac-sunxi.c  | 25 +++++-
 .../net/ethernet/stmicro/stmmac/stmmac_platform.c  | 49 ++---------
 .../net/ethernet/stmicro/stmmac/stmmac_platform.h  |  9 +-
 12 files changed, 378 insertions(+), 55 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/net/nxp,lpc1850-dwmac.txt
 create mode 100644 drivers/net/ethernet/stmicro/stmmac/dwmac-generic.c
 create mode 100644 drivers/net/ethernet/stmicro/stmmac/dwmac-lpc18xx.c

-- 
1.8.0

^ permalink raw reply	[flat|nested] 37+ messages in thread

* [PATCH net-next 01/11] stmmac: add dwmac glue for NXP 18xx/43xx family
  2015-05-14 10:10 ` Joachim Eastwood
@ 2015-05-14 10:10   ` Joachim Eastwood
  -1 siblings, 0 replies; 37+ messages in thread
From: Joachim Eastwood @ 2015-05-14 10:10 UTC (permalink / raw)
  To: arnd, peppe.cavallaro; +Cc: Joachim Eastwood, netdev, davem, linux-arm-kernel

Add support for Ethernet on NXP LPC18xx and LPC43xx using the
dwmac driver. This glue is required to setup phy interface
mode, MII or RMII, on the SoC.

Signed-off-by: Joachim Eastwood <manabian@gmail.com>
---
 drivers/net/ethernet/stmicro/stmmac/Makefile       |  3 +-
 .../net/ethernet/stmicro/stmmac/dwmac-lpc18xx.c    | 74 ++++++++++++++++++++++
 .../net/ethernet/stmicro/stmmac/stmmac_platform.c  |  1 +
 .../net/ethernet/stmicro/stmmac/stmmac_platform.h  |  1 +
 4 files changed, 78 insertions(+), 1 deletion(-)
 create mode 100644 drivers/net/ethernet/stmicro/stmmac/dwmac-lpc18xx.c

diff --git a/drivers/net/ethernet/stmicro/stmmac/Makefile b/drivers/net/ethernet/stmicro/stmmac/Makefile
index 73c2715a27f3..5c165d8d7004 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-lpc18xx.o
 
 obj-$(CONFIG_STMMAC_PCI) += stmmac-pci.o
 stmmac-pci-objs:= stmmac_pci.o
diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-lpc18xx.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-lpc18xx.c
new file mode 100644
index 000000000000..be02b6a1475f
--- /dev/null
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-lpc18xx.c
@@ -0,0 +1,74 @@
+/*
+ * DWMAC glue for NXP LPC18xx/LPC43xx Ethernet
+ *
+ * Copyright (C) 2015 Joachim Eastwood <manabian@gmail.com>
+ *
+ * This file is licensed under the terms of the GNU General Public
+ * License version 2. This program is licensed "as is" without any
+ * warranty of any kind, whether express or implied.
+ */
+
+#include <linux/mfd/syscon.h>
+#include <linux/of.h>
+#include <linux/of_net.h>
+#include <linux/phy.h>
+#include <linux/regmap.h>
+#include <linux/stmmac.h>
+
+/* Register defines for CREG syscon */
+#define LPC18XX_CREG_CREG6			0x12c
+# define LPC18XX_CREG_CREG6_ETHMODE_MASK	0x7
+# define LPC18XX_CREG_CREG6_ETHMODE_MII		0x0
+# define LPC18XX_CREG_CREG6_ETHMODE_RMII	0x4
+
+struct lpc18xx_dwmac_priv_data {
+	struct regmap *reg;
+	int interface;
+};
+
+static void *lpc18xx_dwmac_setup(struct platform_device *pdev)
+{
+	struct lpc18xx_dwmac_priv_data *dwmac;
+
+	dwmac = devm_kzalloc(&pdev->dev, sizeof(*dwmac), GFP_KERNEL);
+	if (!dwmac)
+		return ERR_PTR(-ENOMEM);
+
+	dwmac->interface = of_get_phy_mode(pdev->dev.of_node);
+	if (dwmac->interface < 0)
+		return ERR_PTR(dwmac->interface);
+
+	dwmac->reg = syscon_regmap_lookup_by_compatible("nxp,lpc1850-creg");
+	if (IS_ERR(dwmac->reg)) {
+		dev_err(&pdev->dev, "Syscon lookup failed\n");
+		return dwmac->reg;
+	}
+
+	return dwmac;
+}
+
+static int lpc18xx_dwmac_init(struct platform_device *pdev, void *priv)
+{
+	struct lpc18xx_dwmac_priv_data *dwmac = priv;
+	u8 ethmode;
+
+	if (dwmac->interface == PHY_INTERFACE_MODE_MII) {
+		ethmode = LPC18XX_CREG_CREG6_ETHMODE_MII;
+	} else if (dwmac->interface == PHY_INTERFACE_MODE_RMII) {
+		ethmode = LPC18XX_CREG_CREG6_ETHMODE_RMII;
+	} else {
+		dev_err(&pdev->dev, "Only MII and RMII mode supported\n");
+		return -EINVAL;
+	}
+
+	regmap_update_bits(dwmac->reg, LPC18XX_CREG_CREG6,
+			   LPC18XX_CREG_CREG6_ETHMODE_MASK, ethmode);
+
+	return 0;
+}
+
+const struct stmmac_of_data lpc18xx_dwmac_data = {
+	.has_gmac = 1,
+	.setup = lpc18xx_dwmac_setup,
+	.init = lpc18xx_dwmac_init,
+};
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
index 68aec5c460db..1ac7c8a2c631 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
@@ -37,6 +37,7 @@ static const struct of_device_id stmmac_dt_ids[] = {
 	{ .compatible = "rockchip,rk3288-gmac", .data = &rk3288_gmac_data},
 	{ .compatible = "amlogic,meson6-dwmac", .data = &meson6_dwmac_data},
 	{ .compatible = "allwinner,sun7i-a20-gmac", .data = &sun7i_gmac_data},
+	{ .compatible = "nxp,lpc1850-dwmac", .data = &lpc18xx_dwmac_data},
 	{ .compatible = "st,stih415-dwmac", .data = &stih4xx_dwmac_data},
 	{ .compatible = "st,stih416-dwmac", .data = &stih4xx_dwmac_data},
 	{ .compatible = "st,stid127-dwmac", .data = &stid127_dwmac_data},
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.h b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.h
index 093eb99e5ffd..59fe8fb46a48 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.h
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.h
@@ -19,6 +19,7 @@
 #ifndef __STMMAC_PLATFORM_H__
 #define __STMMAC_PLATFORM_H__
 
+extern const struct stmmac_of_data lpc18xx_dwmac_data;
 extern const struct stmmac_of_data meson6_dwmac_data;
 extern const struct stmmac_of_data sun7i_gmac_data;
 extern const struct stmmac_of_data stih4xx_dwmac_data;
-- 
1.8.0

^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [PATCH net-next 01/11] stmmac: add dwmac glue for NXP 18xx/43xx family
@ 2015-05-14 10:10   ` Joachim Eastwood
  0 siblings, 0 replies; 37+ messages in thread
From: Joachim Eastwood @ 2015-05-14 10:10 UTC (permalink / raw)
  To: linux-arm-kernel

Add support for Ethernet on NXP LPC18xx and LPC43xx using the
dwmac driver. This glue is required to setup phy interface
mode, MII or RMII, on the SoC.

Signed-off-by: Joachim Eastwood <manabian@gmail.com>
---
 drivers/net/ethernet/stmicro/stmmac/Makefile       |  3 +-
 .../net/ethernet/stmicro/stmmac/dwmac-lpc18xx.c    | 74 ++++++++++++++++++++++
 .../net/ethernet/stmicro/stmmac/stmmac_platform.c  |  1 +
 .../net/ethernet/stmicro/stmmac/stmmac_platform.h  |  1 +
 4 files changed, 78 insertions(+), 1 deletion(-)
 create mode 100644 drivers/net/ethernet/stmicro/stmmac/dwmac-lpc18xx.c

diff --git a/drivers/net/ethernet/stmicro/stmmac/Makefile b/drivers/net/ethernet/stmicro/stmmac/Makefile
index 73c2715a27f3..5c165d8d7004 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-lpc18xx.o
 
 obj-$(CONFIG_STMMAC_PCI) += stmmac-pci.o
 stmmac-pci-objs:= stmmac_pci.o
diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-lpc18xx.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-lpc18xx.c
new file mode 100644
index 000000000000..be02b6a1475f
--- /dev/null
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-lpc18xx.c
@@ -0,0 +1,74 @@
+/*
+ * DWMAC glue for NXP LPC18xx/LPC43xx Ethernet
+ *
+ * Copyright (C) 2015 Joachim Eastwood <manabian@gmail.com>
+ *
+ * This file is licensed under the terms of the GNU General Public
+ * License version 2. This program is licensed "as is" without any
+ * warranty of any kind, whether express or implied.
+ */
+
+#include <linux/mfd/syscon.h>
+#include <linux/of.h>
+#include <linux/of_net.h>
+#include <linux/phy.h>
+#include <linux/regmap.h>
+#include <linux/stmmac.h>
+
+/* Register defines for CREG syscon */
+#define LPC18XX_CREG_CREG6			0x12c
+# define LPC18XX_CREG_CREG6_ETHMODE_MASK	0x7
+# define LPC18XX_CREG_CREG6_ETHMODE_MII		0x0
+# define LPC18XX_CREG_CREG6_ETHMODE_RMII	0x4
+
+struct lpc18xx_dwmac_priv_data {
+	struct regmap *reg;
+	int interface;
+};
+
+static void *lpc18xx_dwmac_setup(struct platform_device *pdev)
+{
+	struct lpc18xx_dwmac_priv_data *dwmac;
+
+	dwmac = devm_kzalloc(&pdev->dev, sizeof(*dwmac), GFP_KERNEL);
+	if (!dwmac)
+		return ERR_PTR(-ENOMEM);
+
+	dwmac->interface = of_get_phy_mode(pdev->dev.of_node);
+	if (dwmac->interface < 0)
+		return ERR_PTR(dwmac->interface);
+
+	dwmac->reg = syscon_regmap_lookup_by_compatible("nxp,lpc1850-creg");
+	if (IS_ERR(dwmac->reg)) {
+		dev_err(&pdev->dev, "Syscon lookup failed\n");
+		return dwmac->reg;
+	}
+
+	return dwmac;
+}
+
+static int lpc18xx_dwmac_init(struct platform_device *pdev, void *priv)
+{
+	struct lpc18xx_dwmac_priv_data *dwmac = priv;
+	u8 ethmode;
+
+	if (dwmac->interface == PHY_INTERFACE_MODE_MII) {
+		ethmode = LPC18XX_CREG_CREG6_ETHMODE_MII;
+	} else if (dwmac->interface == PHY_INTERFACE_MODE_RMII) {
+		ethmode = LPC18XX_CREG_CREG6_ETHMODE_RMII;
+	} else {
+		dev_err(&pdev->dev, "Only MII and RMII mode supported\n");
+		return -EINVAL;
+	}
+
+	regmap_update_bits(dwmac->reg, LPC18XX_CREG_CREG6,
+			   LPC18XX_CREG_CREG6_ETHMODE_MASK, ethmode);
+
+	return 0;
+}
+
+const struct stmmac_of_data lpc18xx_dwmac_data = {
+	.has_gmac = 1,
+	.setup = lpc18xx_dwmac_setup,
+	.init = lpc18xx_dwmac_init,
+};
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
index 68aec5c460db..1ac7c8a2c631 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
@@ -37,6 +37,7 @@ static const struct of_device_id stmmac_dt_ids[] = {
 	{ .compatible = "rockchip,rk3288-gmac", .data = &rk3288_gmac_data},
 	{ .compatible = "amlogic,meson6-dwmac", .data = &meson6_dwmac_data},
 	{ .compatible = "allwinner,sun7i-a20-gmac", .data = &sun7i_gmac_data},
+	{ .compatible = "nxp,lpc1850-dwmac", .data = &lpc18xx_dwmac_data},
 	{ .compatible = "st,stih415-dwmac", .data = &stih4xx_dwmac_data},
 	{ .compatible = "st,stih416-dwmac", .data = &stih4xx_dwmac_data},
 	{ .compatible = "st,stid127-dwmac", .data = &stid127_dwmac_data},
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.h b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.h
index 093eb99e5ffd..59fe8fb46a48 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.h
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.h
@@ -19,6 +19,7 @@
 #ifndef __STMMAC_PLATFORM_H__
 #define __STMMAC_PLATFORM_H__
 
+extern const struct stmmac_of_data lpc18xx_dwmac_data;
 extern const struct stmmac_of_data meson6_dwmac_data;
 extern const struct stmmac_of_data sun7i_gmac_data;
 extern const struct stmmac_of_data stih4xx_dwmac_data;
-- 
1.8.0

^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [PATCH net-next 02/11] doc: dt: add documentation for nxp,lpc1850-dwmac
  2015-05-14 10:10 ` Joachim Eastwood
@ 2015-05-14 10:10   ` Joachim Eastwood
  -1 siblings, 0 replies; 37+ messages in thread
From: Joachim Eastwood @ 2015-05-14 10:10 UTC (permalink / raw)
  To: arnd, peppe.cavallaro; +Cc: Joachim Eastwood, netdev, davem, linux-arm-kernel

Add device tree binding documentation for nxp,lpc1850-dwmac.

Signed-off-by: Joachim Eastwood <manabian@gmail.com>
---
 .../devicetree/bindings/net/nxp,lpc1850-dwmac.txt    | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/net/nxp,lpc1850-dwmac.txt

diff --git a/Documentation/devicetree/bindings/net/nxp,lpc1850-dwmac.txt b/Documentation/devicetree/bindings/net/nxp,lpc1850-dwmac.txt
new file mode 100644
index 000000000000..7edba1264f6f
--- /dev/null
+++ b/Documentation/devicetree/bindings/net/nxp,lpc1850-dwmac.txt
@@ -0,0 +1,20 @@
+* NXP LPC1850 GMAC ethernet controller
+
+This device is a platform glue layer for stmmac.
+Please see stmmac.txt for the other unchanged properties.
+
+Required properties:
+ - compatible:  Should contain "nxp,lpc1850-dwmac"
+
+Examples:
+
+mac: ethernet@40010000 {
+	compatible = "nxp,lpc1850-dwmac", "snps,dwmac-3.611", "snps,dwmac";
+	reg = <0x40010000 0x2000>;
+	interrupts = <5>;
+	interrupt-names = "macirq";
+	clocks = <&ccu1 CLK_CPU_ETHERNET>;
+	clock-names = "stmmaceth";
+	resets = <&rgu 22>;
+	reset-names = "stmmaceth";
+}
-- 
1.8.0

^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [PATCH net-next 02/11] doc: dt: add documentation for nxp, lpc1850-dwmac
@ 2015-05-14 10:10   ` Joachim Eastwood
  0 siblings, 0 replies; 37+ messages in thread
From: Joachim Eastwood @ 2015-05-14 10:10 UTC (permalink / raw)
  To: linux-arm-kernel

Add device tree binding documentation for nxp,lpc1850-dwmac.

Signed-off-by: Joachim Eastwood <manabian@gmail.com>
---
 .../devicetree/bindings/net/nxp,lpc1850-dwmac.txt    | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/net/nxp,lpc1850-dwmac.txt

diff --git a/Documentation/devicetree/bindings/net/nxp,lpc1850-dwmac.txt b/Documentation/devicetree/bindings/net/nxp,lpc1850-dwmac.txt
new file mode 100644
index 000000000000..7edba1264f6f
--- /dev/null
+++ b/Documentation/devicetree/bindings/net/nxp,lpc1850-dwmac.txt
@@ -0,0 +1,20 @@
+* NXP LPC1850 GMAC ethernet controller
+
+This device is a platform glue layer for stmmac.
+Please see stmmac.txt for the other unchanged properties.
+
+Required properties:
+ - compatible:  Should contain "nxp,lpc1850-dwmac"
+
+Examples:
+
+mac: ethernet at 40010000 {
+	compatible = "nxp,lpc1850-dwmac", "snps,dwmac-3.611", "snps,dwmac";
+	reg = <0x40010000 0x2000>;
+	interrupts = <5>;
+	interrupt-names = "macirq";
+	clocks = <&ccu1 CLK_CPU_ETHERNET>;
+	clock-names = "stmmaceth";
+	resets = <&rgu 22>;
+	reset-names = "stmmaceth";
+}
-- 
1.8.0

^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [PATCH net-next 03/11] stmmac: prepare stmmac platform to support stand alone drivers
  2015-05-14 10:10 ` Joachim Eastwood
@ 2015-05-14 10:10   ` Joachim Eastwood
  -1 siblings, 0 replies; 37+ messages in thread
From: Joachim Eastwood @ 2015-05-14 10:10 UTC (permalink / raw)
  To: arnd, peppe.cavallaro; +Cc: Joachim Eastwood, netdev, davem, linux-arm-kernel

Prepare the stmmac platform code to support standalone drivers
by exporting the need functions and having of_match_device use
the match table reference already present in the driver struct.

This will allow us to reuse the platform driver functions from
this code easily in other stand alone platform drivers.

Signed-off-by: Joachim Eastwood <manabian@gmail.com>
---
 drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c | 14 +++++++++-----
 drivers/net/ethernet/stmicro/stmmac/stmmac_platform.h |  4 ++++
 2 files changed, 13 insertions(+), 5 deletions(-)

diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
index 1ac7c8a2c631..0d1f1ec96bc0 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
@@ -130,11 +130,12 @@ static int stmmac_probe_config_dt(struct platform_device *pdev,
 	struct device_node *np = pdev->dev.of_node;
 	struct stmmac_dma_cfg *dma_cfg;
 	const struct of_device_id *device;
+	struct device *dev = &pdev->dev;
 
 	if (!np)
 		return -ENODEV;
 
-	device = of_match_device(stmmac_dt_ids, &pdev->dev);
+	device = of_match_device(dev->driver->of_match_table, dev);
 	if (!device)
 		return -ENODEV;
 
@@ -269,7 +270,7 @@ static int stmmac_probe_config_dt(struct platform_device *pdev,
  * the necessary platform resources, invoke custom helper (if required) and
  * invoke the main probe function.
  */
-static int stmmac_pltfr_probe(struct platform_device *pdev)
+int stmmac_pltfr_probe(struct platform_device *pdev)
 {
 	int ret = 0;
 	struct resource *res;
@@ -375,6 +376,7 @@ static int stmmac_pltfr_probe(struct platform_device *pdev)
 
 	return 0;
 }
+EXPORT_SYMBOL_GPL(stmmac_pltfr_probe);
 
 /**
  * stmmac_pltfr_remove
@@ -382,7 +384,7 @@ static int stmmac_pltfr_probe(struct platform_device *pdev)
  * Description: this function calls the main to free the net resources
  * and calls the platforms hook and release the resources (e.g. mem).
  */
-static int stmmac_pltfr_remove(struct platform_device *pdev)
+int stmmac_pltfr_remove(struct platform_device *pdev)
 {
 	struct net_device *ndev = platform_get_drvdata(pdev);
 	struct stmmac_priv *priv = netdev_priv(ndev);
@@ -396,6 +398,7 @@ static int stmmac_pltfr_remove(struct platform_device *pdev)
 
 	return ret;
 }
+EXPORT_SYMBOL_GPL(stmmac_pltfr_remove);
 
 #ifdef CONFIG_PM_SLEEP
 /**
@@ -439,8 +442,9 @@ static int stmmac_pltfr_resume(struct device *dev)
 }
 #endif /* CONFIG_PM_SLEEP */
 
-static SIMPLE_DEV_PM_OPS(stmmac_pltfr_pm_ops,
-			 stmmac_pltfr_suspend, stmmac_pltfr_resume);
+SIMPLE_DEV_PM_OPS(stmmac_pltfr_pm_ops, stmmac_pltfr_suspend,
+				       stmmac_pltfr_resume);
+EXPORT_SYMBOL_GPL(stmmac_pltfr_pm_ops);
 
 static struct platform_driver stmmac_pltfr_driver = {
 	.probe = stmmac_pltfr_probe,
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.h b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.h
index 59fe8fb46a48..5be0b101bffd 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.h
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.h
@@ -19,6 +19,10 @@
 #ifndef __STMMAC_PLATFORM_H__
 #define __STMMAC_PLATFORM_H__
 
+int stmmac_pltfr_probe(struct platform_device *pdev);
+int stmmac_pltfr_remove(struct platform_device *pdev);
+extern const struct dev_pm_ops stmmac_pltfr_pm_ops;
+
 extern const struct stmmac_of_data lpc18xx_dwmac_data;
 extern const struct stmmac_of_data meson6_dwmac_data;
 extern const struct stmmac_of_data sun7i_gmac_data;
-- 
1.8.0

^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [PATCH net-next 03/11] stmmac: prepare stmmac platform to support stand alone drivers
@ 2015-05-14 10:10   ` Joachim Eastwood
  0 siblings, 0 replies; 37+ messages in thread
From: Joachim Eastwood @ 2015-05-14 10:10 UTC (permalink / raw)
  To: linux-arm-kernel

Prepare the stmmac platform code to support standalone drivers
by exporting the need functions and having of_match_device use
the match table reference already present in the driver struct.

This will allow us to reuse the platform driver functions from
this code easily in other stand alone platform drivers.

Signed-off-by: Joachim Eastwood <manabian@gmail.com>
---
 drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c | 14 +++++++++-----
 drivers/net/ethernet/stmicro/stmmac/stmmac_platform.h |  4 ++++
 2 files changed, 13 insertions(+), 5 deletions(-)

diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
index 1ac7c8a2c631..0d1f1ec96bc0 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
@@ -130,11 +130,12 @@ static int stmmac_probe_config_dt(struct platform_device *pdev,
 	struct device_node *np = pdev->dev.of_node;
 	struct stmmac_dma_cfg *dma_cfg;
 	const struct of_device_id *device;
+	struct device *dev = &pdev->dev;
 
 	if (!np)
 		return -ENODEV;
 
-	device = of_match_device(stmmac_dt_ids, &pdev->dev);
+	device = of_match_device(dev->driver->of_match_table, dev);
 	if (!device)
 		return -ENODEV;
 
@@ -269,7 +270,7 @@ static int stmmac_probe_config_dt(struct platform_device *pdev,
  * the necessary platform resources, invoke custom helper (if required) and
  * invoke the main probe function.
  */
-static int stmmac_pltfr_probe(struct platform_device *pdev)
+int stmmac_pltfr_probe(struct platform_device *pdev)
 {
 	int ret = 0;
 	struct resource *res;
@@ -375,6 +376,7 @@ static int stmmac_pltfr_probe(struct platform_device *pdev)
 
 	return 0;
 }
+EXPORT_SYMBOL_GPL(stmmac_pltfr_probe);
 
 /**
  * stmmac_pltfr_remove
@@ -382,7 +384,7 @@ static int stmmac_pltfr_probe(struct platform_device *pdev)
  * Description: this function calls the main to free the net resources
  * and calls the platforms hook and release the resources (e.g. mem).
  */
-static int stmmac_pltfr_remove(struct platform_device *pdev)
+int stmmac_pltfr_remove(struct platform_device *pdev)
 {
 	struct net_device *ndev = platform_get_drvdata(pdev);
 	struct stmmac_priv *priv = netdev_priv(ndev);
@@ -396,6 +398,7 @@ static int stmmac_pltfr_remove(struct platform_device *pdev)
 
 	return ret;
 }
+EXPORT_SYMBOL_GPL(stmmac_pltfr_remove);
 
 #ifdef CONFIG_PM_SLEEP
 /**
@@ -439,8 +442,9 @@ static int stmmac_pltfr_resume(struct device *dev)
 }
 #endif /* CONFIG_PM_SLEEP */
 
-static SIMPLE_DEV_PM_OPS(stmmac_pltfr_pm_ops,
-			 stmmac_pltfr_suspend, stmmac_pltfr_resume);
+SIMPLE_DEV_PM_OPS(stmmac_pltfr_pm_ops, stmmac_pltfr_suspend,
+				       stmmac_pltfr_resume);
+EXPORT_SYMBOL_GPL(stmmac_pltfr_pm_ops);
 
 static struct platform_driver stmmac_pltfr_driver = {
 	.probe = stmmac_pltfr_probe,
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.h b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.h
index 59fe8fb46a48..5be0b101bffd 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.h
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.h
@@ -19,6 +19,10 @@
 #ifndef __STMMAC_PLATFORM_H__
 #define __STMMAC_PLATFORM_H__
 
+int stmmac_pltfr_probe(struct platform_device *pdev);
+int stmmac_pltfr_remove(struct platform_device *pdev);
+extern const struct dev_pm_ops stmmac_pltfr_pm_ops;
+
 extern const struct stmmac_of_data lpc18xx_dwmac_data;
 extern const struct stmmac_of_data meson6_dwmac_data;
 extern const struct stmmac_of_data sun7i_gmac_data;
-- 
1.8.0

^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [PATCH net-next 04/11] stmmac: add a generic dwmac driver
  2015-05-14 10:10 ` Joachim Eastwood
@ 2015-05-14 10:10   ` Joachim Eastwood
  -1 siblings, 0 replies; 37+ messages in thread
From: Joachim Eastwood @ 2015-05-14 10:10 UTC (permalink / raw)
  To: arnd, peppe.cavallaro; +Cc: Joachim Eastwood, netdev, davem, linux-arm-kernel

Create a new driver around the generic device tree match strings
in the stmmac platform code. This driver is intended to be used
by all platforms that doesn't require any platform specific code
to function or is using platform data.

Signed-off-by: Joachim Eastwood <manabian@gmail.com>
---
 drivers/net/ethernet/stmicro/stmmac/Kconfig        | 12 +++++++
 drivers/net/ethernet/stmicro/stmmac/Makefile       |  4 ++-
 .../net/ethernet/stmicro/stmmac/dwmac-generic.c    | 39 ++++++++++++++++++++++
 .../net/ethernet/stmicro/stmmac/stmmac_platform.c  |  5 ---
 4 files changed, 54 insertions(+), 6 deletions(-)
 create mode 100644 drivers/net/ethernet/stmicro/stmmac/dwmac-generic.c

diff --git a/drivers/net/ethernet/stmicro/stmmac/Kconfig b/drivers/net/ethernet/stmicro/stmmac/Kconfig
index 7d3af190be55..d4ed2ac3829b 100644
--- a/drivers/net/ethernet/stmicro/stmmac/Kconfig
+++ b/drivers/net/ethernet/stmicro/stmmac/Kconfig
@@ -26,6 +26,18 @@ config STMMAC_PLATFORM
 
 	  If unsure, say N.
 
+if STMMAC_PLATFORM
+
+config DWMAC_GENERIC
+	tristate "Generic driver for DWMAC"
+	default STMMAC_PLATFORM
+	---help---
+	  Generic DWMAC driver for platforms that don't require any
+	  platform specific code to function or is using platform
+	  data for setup.
+
+endif
+
 config STMMAC_PCI
 	tristate "STMMAC PCI bus support"
 	depends on STMMAC_ETH && PCI
diff --git a/drivers/net/ethernet/stmicro/stmmac/Makefile b/drivers/net/ethernet/stmicro/stmmac/Makefile
index 5c165d8d7004..89a353450182 100644
--- a/drivers/net/ethernet/stmicro/stmmac/Makefile
+++ b/drivers/net/ethernet/stmicro/stmmac/Makefile
@@ -4,7 +4,9 @@ stmmac-objs:= stmmac_main.o stmmac_ethtool.o stmmac_mdio.o ring_mode.o	\
 	      dwmac100_core.o dwmac100_dma.o enh_desc.o norm_desc.o	\
 	      mmc_core.o stmmac_hwtstamp.o stmmac_ptp.o $(stmmac-y)
 
-obj-$(CONFIG_STMMAC_PLATFORM) += stmmac-platform.o
+# Ordering matters. Generic driver must be last.
+obj-$(CONFIG_STMMAC_PLATFORM)	+= stmmac-platform.o
+obj-$(CONFIG_DWMAC_GENERIC)	+= dwmac-generic.o
 stmmac-platform-objs:= stmmac_platform.o dwmac-meson.o dwmac-sunxi.o	\
 		       dwmac-sti.o dwmac-socfpga.o dwmac-rk.o		\
 		       dwmac-lpc18xx.o
diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-generic.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-generic.c
new file mode 100644
index 000000000000..fb9623744e41
--- /dev/null
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-generic.c
@@ -0,0 +1,39 @@
+/*
+ * Generic DWMAC platform driver
+ *
+ * Copyright (C) 2015 Joachim Eastwood <manabian@gmail.com>
+ *
+ * This file is licensed under the terms of the GNU General Public
+ * License version 2. This program is licensed "as is" without any
+ * warranty of any kind, whether express or implied.
+ */
+
+#include <linux/module.h>
+#include <linux/of.h>
+#include <linux/platform_device.h>
+
+#include "stmmac_platform.h"
+
+static const struct of_device_id dwmac_generic_match[] = {
+	{ .compatible = "st,spear600-gmac"},
+	{ .compatible = "snps,dwmac-3.610"},
+	{ .compatible = "snps,dwmac-3.70a"},
+	{ .compatible = "snps,dwmac-3.710"},
+	{ .compatible = "snps,dwmac"},
+	{ }
+};
+MODULE_DEVICE_TABLE(of, dwmac_generic_match);
+
+static struct platform_driver dwmac_generic_driver = {
+	.probe  = stmmac_pltfr_probe,
+	.remove = stmmac_pltfr_remove,
+	.driver = {
+		.name           = "dwmac-generic",
+		.pm		= &stmmac_pltfr_pm_ops,
+		.of_match_table = of_match_ptr(dwmac_generic_match),
+	},
+};
+module_platform_driver(dwmac_generic_driver);
+
+MODULE_DESCRIPTION("Generic dwmac driver");
+MODULE_LICENSE("GPL v2");
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
index 0d1f1ec96bc0..1777e7124d3e 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
@@ -43,11 +43,6 @@ static const struct of_device_id stmmac_dt_ids[] = {
 	{ .compatible = "st,stid127-dwmac", .data = &stid127_dwmac_data},
 	{ .compatible = "st,stih407-dwmac", .data = &stih4xx_dwmac_data},
 	{ .compatible = "altr,socfpga-stmmac", .data = &socfpga_gmac_data },
-	{ .compatible = "st,spear600-gmac"},
-	{ .compatible = "snps,dwmac-3.610"},
-	{ .compatible = "snps,dwmac-3.70a"},
-	{ .compatible = "snps,dwmac-3.710"},
-	{ .compatible = "snps,dwmac"},
 	{ /* sentinel */ }
 };
 MODULE_DEVICE_TABLE(of, stmmac_dt_ids);
-- 
1.8.0

^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [PATCH net-next 04/11] stmmac: add a generic dwmac driver
@ 2015-05-14 10:10   ` Joachim Eastwood
  0 siblings, 0 replies; 37+ messages in thread
From: Joachim Eastwood @ 2015-05-14 10:10 UTC (permalink / raw)
  To: linux-arm-kernel

Create a new driver around the generic device tree match strings
in the stmmac platform code. This driver is intended to be used
by all platforms that doesn't require any platform specific code
to function or is using platform data.

Signed-off-by: Joachim Eastwood <manabian@gmail.com>
---
 drivers/net/ethernet/stmicro/stmmac/Kconfig        | 12 +++++++
 drivers/net/ethernet/stmicro/stmmac/Makefile       |  4 ++-
 .../net/ethernet/stmicro/stmmac/dwmac-generic.c    | 39 ++++++++++++++++++++++
 .../net/ethernet/stmicro/stmmac/stmmac_platform.c  |  5 ---
 4 files changed, 54 insertions(+), 6 deletions(-)
 create mode 100644 drivers/net/ethernet/stmicro/stmmac/dwmac-generic.c

diff --git a/drivers/net/ethernet/stmicro/stmmac/Kconfig b/drivers/net/ethernet/stmicro/stmmac/Kconfig
index 7d3af190be55..d4ed2ac3829b 100644
--- a/drivers/net/ethernet/stmicro/stmmac/Kconfig
+++ b/drivers/net/ethernet/stmicro/stmmac/Kconfig
@@ -26,6 +26,18 @@ config STMMAC_PLATFORM
 
 	  If unsure, say N.
 
+if STMMAC_PLATFORM
+
+config DWMAC_GENERIC
+	tristate "Generic driver for DWMAC"
+	default STMMAC_PLATFORM
+	---help---
+	  Generic DWMAC driver for platforms that don't require any
+	  platform specific code to function or is using platform
+	  data for setup.
+
+endif
+
 config STMMAC_PCI
 	tristate "STMMAC PCI bus support"
 	depends on STMMAC_ETH && PCI
diff --git a/drivers/net/ethernet/stmicro/stmmac/Makefile b/drivers/net/ethernet/stmicro/stmmac/Makefile
index 5c165d8d7004..89a353450182 100644
--- a/drivers/net/ethernet/stmicro/stmmac/Makefile
+++ b/drivers/net/ethernet/stmicro/stmmac/Makefile
@@ -4,7 +4,9 @@ stmmac-objs:= stmmac_main.o stmmac_ethtool.o stmmac_mdio.o ring_mode.o	\
 	      dwmac100_core.o dwmac100_dma.o enh_desc.o norm_desc.o	\
 	      mmc_core.o stmmac_hwtstamp.o stmmac_ptp.o $(stmmac-y)
 
-obj-$(CONFIG_STMMAC_PLATFORM) += stmmac-platform.o
+# Ordering matters. Generic driver must be last.
+obj-$(CONFIG_STMMAC_PLATFORM)	+= stmmac-platform.o
+obj-$(CONFIG_DWMAC_GENERIC)	+= dwmac-generic.o
 stmmac-platform-objs:= stmmac_platform.o dwmac-meson.o dwmac-sunxi.o	\
 		       dwmac-sti.o dwmac-socfpga.o dwmac-rk.o		\
 		       dwmac-lpc18xx.o
diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-generic.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-generic.c
new file mode 100644
index 000000000000..fb9623744e41
--- /dev/null
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-generic.c
@@ -0,0 +1,39 @@
+/*
+ * Generic DWMAC platform driver
+ *
+ * Copyright (C) 2015 Joachim Eastwood <manabian@gmail.com>
+ *
+ * This file is licensed under the terms of the GNU General Public
+ * License version 2. This program is licensed "as is" without any
+ * warranty of any kind, whether express or implied.
+ */
+
+#include <linux/module.h>
+#include <linux/of.h>
+#include <linux/platform_device.h>
+
+#include "stmmac_platform.h"
+
+static const struct of_device_id dwmac_generic_match[] = {
+	{ .compatible = "st,spear600-gmac"},
+	{ .compatible = "snps,dwmac-3.610"},
+	{ .compatible = "snps,dwmac-3.70a"},
+	{ .compatible = "snps,dwmac-3.710"},
+	{ .compatible = "snps,dwmac"},
+	{ }
+};
+MODULE_DEVICE_TABLE(of, dwmac_generic_match);
+
+static struct platform_driver dwmac_generic_driver = {
+	.probe  = stmmac_pltfr_probe,
+	.remove = stmmac_pltfr_remove,
+	.driver = {
+		.name           = "dwmac-generic",
+		.pm		= &stmmac_pltfr_pm_ops,
+		.of_match_table = of_match_ptr(dwmac_generic_match),
+	},
+};
+module_platform_driver(dwmac_generic_driver);
+
+MODULE_DESCRIPTION("Generic dwmac driver");
+MODULE_LICENSE("GPL v2");
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
index 0d1f1ec96bc0..1777e7124d3e 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
@@ -43,11 +43,6 @@ static const struct of_device_id stmmac_dt_ids[] = {
 	{ .compatible = "st,stid127-dwmac", .data = &stid127_dwmac_data},
 	{ .compatible = "st,stih407-dwmac", .data = &stih4xx_dwmac_data},
 	{ .compatible = "altr,socfpga-stmmac", .data = &socfpga_gmac_data },
-	{ .compatible = "st,spear600-gmac"},
-	{ .compatible = "snps,dwmac-3.610"},
-	{ .compatible = "snps,dwmac-3.70a"},
-	{ .compatible = "snps,dwmac-3.710"},
-	{ .compatible = "snps,dwmac"},
 	{ /* sentinel */ }
 };
 MODULE_DEVICE_TABLE(of, stmmac_dt_ids);
-- 
1.8.0

^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [PATCH net-next 05/11] stmmac: convert dwmac-lpc18xx to a platform driver
  2015-05-14 10:10 ` Joachim Eastwood
@ 2015-05-14 10:11   ` Joachim Eastwood
  -1 siblings, 0 replies; 37+ messages in thread
From: Joachim Eastwood @ 2015-05-14 10:11 UTC (permalink / raw)
  To: arnd, peppe.cavallaro; +Cc: Joachim Eastwood, netdev, davem, linux-arm-kernel

Convert platform glue layer into a proper platform
driver and add it to the build system.

Signed-off-by: Joachim Eastwood <manabian@gmail.com>
---
 drivers/net/ethernet/stmicro/stmmac/Kconfig        |  8 +++++++
 drivers/net/ethernet/stmicro/stmmac/Makefile       |  2 +-
 .../net/ethernet/stmicro/stmmac/dwmac-lpc18xx.c    | 27 +++++++++++++++++++++-
 .../net/ethernet/stmicro/stmmac/stmmac_platform.c  |  1 -
 .../net/ethernet/stmicro/stmmac/stmmac_platform.h  |  1 -
 5 files changed, 35 insertions(+), 4 deletions(-)

diff --git a/drivers/net/ethernet/stmicro/stmmac/Kconfig b/drivers/net/ethernet/stmicro/stmmac/Kconfig
index d4ed2ac3829b..aa03e26437e2 100644
--- a/drivers/net/ethernet/stmicro/stmmac/Kconfig
+++ b/drivers/net/ethernet/stmicro/stmmac/Kconfig
@@ -36,6 +36,14 @@ config DWMAC_GENERIC
 	  platform specific code to function or is using platform
 	  data for setup.
 
+config DWMAC_LPC18XX
+	tristate "NXP LPC18xx/43xx DWMAC support"
+	default ARCH_LPC18XX
+	depends on OF
+	select MFD_SYSCON
+	---help---
+	  Support for NXP LPC18xx/43xx DWMAC Ethernet.
+
 endif
 
 config STMMAC_PCI
diff --git a/drivers/net/ethernet/stmicro/stmmac/Makefile b/drivers/net/ethernet/stmicro/stmmac/Makefile
index 89a353450182..96a3abfc15bb 100644
--- a/drivers/net/ethernet/stmicro/stmmac/Makefile
+++ b/drivers/net/ethernet/stmicro/stmmac/Makefile
@@ -6,10 +6,10 @@ stmmac-objs:= stmmac_main.o stmmac_ethtool.o stmmac_mdio.o ring_mode.o	\
 
 # Ordering matters. Generic driver must be last.
 obj-$(CONFIG_STMMAC_PLATFORM)	+= stmmac-platform.o
+obj-$(CONFIG_DWMAC_LPC18XX)	+= dwmac-lpc18xx.o
 obj-$(CONFIG_DWMAC_GENERIC)	+= dwmac-generic.o
 stmmac-platform-objs:= stmmac_platform.o dwmac-meson.o dwmac-sunxi.o	\
 		       dwmac-sti.o dwmac-socfpga.o dwmac-rk.o		\
-		       dwmac-lpc18xx.o
 
 obj-$(CONFIG_STMMAC_PCI) += stmmac-pci.o
 stmmac-pci-objs:= stmmac_pci.o
diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-lpc18xx.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-lpc18xx.c
index be02b6a1475f..cb888d3ebbdc 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac-lpc18xx.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-lpc18xx.c
@@ -9,12 +9,16 @@
  */
 
 #include <linux/mfd/syscon.h>
+#include <linux/module.h>
 #include <linux/of.h>
 #include <linux/of_net.h>
 #include <linux/phy.h>
+#include <linux/platform_device.h>
 #include <linux/regmap.h>
 #include <linux/stmmac.h>
 
+#include "stmmac_platform.h"
+
 /* Register defines for CREG syscon */
 #define LPC18XX_CREG_CREG6			0x12c
 # define LPC18XX_CREG_CREG6_ETHMODE_MASK	0x7
@@ -67,8 +71,29 @@ static int lpc18xx_dwmac_init(struct platform_device *pdev, void *priv)
 	return 0;
 }
 
-const struct stmmac_of_data lpc18xx_dwmac_data = {
+static const struct stmmac_of_data lpc18xx_dwmac_data = {
 	.has_gmac = 1,
 	.setup = lpc18xx_dwmac_setup,
 	.init = lpc18xx_dwmac_init,
 };
+
+static const struct of_device_id lpc18xx_dwmac_match[] = {
+	{ .compatible = "nxp,lpc1850-dwmac", .data = &lpc18xx_dwmac_data },
+	{ }
+};
+MODULE_DEVICE_TABLE(of, lpc18xx_dwmac_match);
+
+static struct platform_driver lpc18xx_dwmac_driver = {
+	.probe  = stmmac_pltfr_probe,
+	.remove = stmmac_pltfr_remove,
+	.driver = {
+		.name           = "lpc18xx-dwmac",
+		.pm		= &stmmac_pltfr_pm_ops,
+		.of_match_table = lpc18xx_dwmac_match,
+	},
+};
+module_platform_driver(lpc18xx_dwmac_driver);
+
+MODULE_AUTHOR("Joachim Eastwood <manabian@gmail.com>");
+MODULE_DESCRIPTION("DWMAC glue for LPC18xx/43xx Ethernet");
+MODULE_LICENSE("GPL v2");
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
index 1777e7124d3e..1fd65e780a05 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
@@ -37,7 +37,6 @@ static const struct of_device_id stmmac_dt_ids[] = {
 	{ .compatible = "rockchip,rk3288-gmac", .data = &rk3288_gmac_data},
 	{ .compatible = "amlogic,meson6-dwmac", .data = &meson6_dwmac_data},
 	{ .compatible = "allwinner,sun7i-a20-gmac", .data = &sun7i_gmac_data},
-	{ .compatible = "nxp,lpc1850-dwmac", .data = &lpc18xx_dwmac_data},
 	{ .compatible = "st,stih415-dwmac", .data = &stih4xx_dwmac_data},
 	{ .compatible = "st,stih416-dwmac", .data = &stih4xx_dwmac_data},
 	{ .compatible = "st,stid127-dwmac", .data = &stid127_dwmac_data},
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.h b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.h
index 5be0b101bffd..23d10f6e8846 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.h
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.h
@@ -23,7 +23,6 @@ int stmmac_pltfr_probe(struct platform_device *pdev);
 int stmmac_pltfr_remove(struct platform_device *pdev);
 extern const struct dev_pm_ops stmmac_pltfr_pm_ops;
 
-extern const struct stmmac_of_data lpc18xx_dwmac_data;
 extern const struct stmmac_of_data meson6_dwmac_data;
 extern const struct stmmac_of_data sun7i_gmac_data;
 extern const struct stmmac_of_data stih4xx_dwmac_data;
-- 
1.8.0

^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [PATCH net-next 05/11] stmmac: convert dwmac-lpc18xx to a platform driver
@ 2015-05-14 10:11   ` Joachim Eastwood
  0 siblings, 0 replies; 37+ messages in thread
From: Joachim Eastwood @ 2015-05-14 10:11 UTC (permalink / raw)
  To: linux-arm-kernel

Convert platform glue layer into a proper platform
driver and add it to the build system.

Signed-off-by: Joachim Eastwood <manabian@gmail.com>
---
 drivers/net/ethernet/stmicro/stmmac/Kconfig        |  8 +++++++
 drivers/net/ethernet/stmicro/stmmac/Makefile       |  2 +-
 .../net/ethernet/stmicro/stmmac/dwmac-lpc18xx.c    | 27 +++++++++++++++++++++-
 .../net/ethernet/stmicro/stmmac/stmmac_platform.c  |  1 -
 .../net/ethernet/stmicro/stmmac/stmmac_platform.h  |  1 -
 5 files changed, 35 insertions(+), 4 deletions(-)

diff --git a/drivers/net/ethernet/stmicro/stmmac/Kconfig b/drivers/net/ethernet/stmicro/stmmac/Kconfig
index d4ed2ac3829b..aa03e26437e2 100644
--- a/drivers/net/ethernet/stmicro/stmmac/Kconfig
+++ b/drivers/net/ethernet/stmicro/stmmac/Kconfig
@@ -36,6 +36,14 @@ config DWMAC_GENERIC
 	  platform specific code to function or is using platform
 	  data for setup.
 
+config DWMAC_LPC18XX
+	tristate "NXP LPC18xx/43xx DWMAC support"
+	default ARCH_LPC18XX
+	depends on OF
+	select MFD_SYSCON
+	---help---
+	  Support for NXP LPC18xx/43xx DWMAC Ethernet.
+
 endif
 
 config STMMAC_PCI
diff --git a/drivers/net/ethernet/stmicro/stmmac/Makefile b/drivers/net/ethernet/stmicro/stmmac/Makefile
index 89a353450182..96a3abfc15bb 100644
--- a/drivers/net/ethernet/stmicro/stmmac/Makefile
+++ b/drivers/net/ethernet/stmicro/stmmac/Makefile
@@ -6,10 +6,10 @@ stmmac-objs:= stmmac_main.o stmmac_ethtool.o stmmac_mdio.o ring_mode.o	\
 
 # Ordering matters. Generic driver must be last.
 obj-$(CONFIG_STMMAC_PLATFORM)	+= stmmac-platform.o
+obj-$(CONFIG_DWMAC_LPC18XX)	+= dwmac-lpc18xx.o
 obj-$(CONFIG_DWMAC_GENERIC)	+= dwmac-generic.o
 stmmac-platform-objs:= stmmac_platform.o dwmac-meson.o dwmac-sunxi.o	\
 		       dwmac-sti.o dwmac-socfpga.o dwmac-rk.o		\
-		       dwmac-lpc18xx.o
 
 obj-$(CONFIG_STMMAC_PCI) += stmmac-pci.o
 stmmac-pci-objs:= stmmac_pci.o
diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-lpc18xx.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-lpc18xx.c
index be02b6a1475f..cb888d3ebbdc 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac-lpc18xx.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-lpc18xx.c
@@ -9,12 +9,16 @@
  */
 
 #include <linux/mfd/syscon.h>
+#include <linux/module.h>
 #include <linux/of.h>
 #include <linux/of_net.h>
 #include <linux/phy.h>
+#include <linux/platform_device.h>
 #include <linux/regmap.h>
 #include <linux/stmmac.h>
 
+#include "stmmac_platform.h"
+
 /* Register defines for CREG syscon */
 #define LPC18XX_CREG_CREG6			0x12c
 # define LPC18XX_CREG_CREG6_ETHMODE_MASK	0x7
@@ -67,8 +71,29 @@ static int lpc18xx_dwmac_init(struct platform_device *pdev, void *priv)
 	return 0;
 }
 
-const struct stmmac_of_data lpc18xx_dwmac_data = {
+static const struct stmmac_of_data lpc18xx_dwmac_data = {
 	.has_gmac = 1,
 	.setup = lpc18xx_dwmac_setup,
 	.init = lpc18xx_dwmac_init,
 };
+
+static const struct of_device_id lpc18xx_dwmac_match[] = {
+	{ .compatible = "nxp,lpc1850-dwmac", .data = &lpc18xx_dwmac_data },
+	{ }
+};
+MODULE_DEVICE_TABLE(of, lpc18xx_dwmac_match);
+
+static struct platform_driver lpc18xx_dwmac_driver = {
+	.probe  = stmmac_pltfr_probe,
+	.remove = stmmac_pltfr_remove,
+	.driver = {
+		.name           = "lpc18xx-dwmac",
+		.pm		= &stmmac_pltfr_pm_ops,
+		.of_match_table = lpc18xx_dwmac_match,
+	},
+};
+module_platform_driver(lpc18xx_dwmac_driver);
+
+MODULE_AUTHOR("Joachim Eastwood <manabian@gmail.com>");
+MODULE_DESCRIPTION("DWMAC glue for LPC18xx/43xx Ethernet");
+MODULE_LICENSE("GPL v2");
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
index 1777e7124d3e..1fd65e780a05 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
@@ -37,7 +37,6 @@ static const struct of_device_id stmmac_dt_ids[] = {
 	{ .compatible = "rockchip,rk3288-gmac", .data = &rk3288_gmac_data},
 	{ .compatible = "amlogic,meson6-dwmac", .data = &meson6_dwmac_data},
 	{ .compatible = "allwinner,sun7i-a20-gmac", .data = &sun7i_gmac_data},
-	{ .compatible = "nxp,lpc1850-dwmac", .data = &lpc18xx_dwmac_data},
 	{ .compatible = "st,stih415-dwmac", .data = &stih4xx_dwmac_data},
 	{ .compatible = "st,stih416-dwmac", .data = &stih4xx_dwmac_data},
 	{ .compatible = "st,stid127-dwmac", .data = &stid127_dwmac_data},
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.h b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.h
index 5be0b101bffd..23d10f6e8846 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.h
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.h
@@ -23,7 +23,6 @@ int stmmac_pltfr_probe(struct platform_device *pdev);
 int stmmac_pltfr_remove(struct platform_device *pdev);
 extern const struct dev_pm_ops stmmac_pltfr_pm_ops;
 
-extern const struct stmmac_of_data lpc18xx_dwmac_data;
 extern const struct stmmac_of_data meson6_dwmac_data;
 extern const struct stmmac_of_data sun7i_gmac_data;
 extern const struct stmmac_of_data stih4xx_dwmac_data;
-- 
1.8.0

^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [PATCH net-next 06/11] stmmac: convert dwmac-meson to platform driver
  2015-05-14 10:10 ` Joachim Eastwood
@ 2015-05-14 10:11   ` Joachim Eastwood
  -1 siblings, 0 replies; 37+ messages in thread
From: Joachim Eastwood @ 2015-05-14 10:11 UTC (permalink / raw)
  To: arnd, peppe.cavallaro, b.galvani
  Cc: Joachim Eastwood, netdev, davem, linux-arm-kernel

Convert platform glue layer into a proper platform
driver and add it to the build system.

Signed-off-by: Joachim Eastwood <manabian@gmail.com>
---
 drivers/net/ethernet/stmicro/stmmac/Kconfig        | 11 ++++++++++
 drivers/net/ethernet/stmicro/stmmac/Makefile       |  3 ++-
 drivers/net/ethernet/stmicro/stmmac/dwmac-meson.c  | 24 +++++++++++++++++++++-
 .../net/ethernet/stmicro/stmmac/stmmac_platform.c  |  1 -
 .../net/ethernet/stmicro/stmmac/stmmac_platform.h  |  1 -
 5 files changed, 36 insertions(+), 4 deletions(-)

diff --git a/drivers/net/ethernet/stmicro/stmmac/Kconfig b/drivers/net/ethernet/stmicro/stmmac/Kconfig
index aa03e26437e2..a5a56217a845 100644
--- a/drivers/net/ethernet/stmicro/stmmac/Kconfig
+++ b/drivers/net/ethernet/stmicro/stmmac/Kconfig
@@ -44,6 +44,17 @@ config DWMAC_LPC18XX
 	---help---
 	  Support for NXP LPC18xx/43xx DWMAC Ethernet.
 
+config DWMAC_MESON
+	tristate "Amlogic Meson dwmac support"
+	default ARCH_MESON
+	depends on OF
+	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.
+
 endif
 
 config STMMAC_PCI
diff --git a/drivers/net/ethernet/stmicro/stmmac/Makefile b/drivers/net/ethernet/stmicro/stmmac/Makefile
index 96a3abfc15bb..69cc046afd8c 100644
--- a/drivers/net/ethernet/stmicro/stmmac/Makefile
+++ b/drivers/net/ethernet/stmicro/stmmac/Makefile
@@ -7,8 +7,9 @@ stmmac-objs:= stmmac_main.o stmmac_ethtool.o stmmac_mdio.o ring_mode.o	\
 # Ordering matters. Generic driver must be last.
 obj-$(CONFIG_STMMAC_PLATFORM)	+= stmmac-platform.o
 obj-$(CONFIG_DWMAC_LPC18XX)	+= dwmac-lpc18xx.o
+obj-$(CONFIG_DWMAC_MESON)	+= dwmac-meson.o
 obj-$(CONFIG_DWMAC_GENERIC)	+= dwmac-generic.o
-stmmac-platform-objs:= stmmac_platform.o dwmac-meson.o dwmac-sunxi.o	\
+stmmac-platform-objs:= stmmac_platform.o dwmac-sunxi.o \
 		       dwmac-sti.o dwmac-socfpga.o dwmac-rk.o		\
 
 obj-$(CONFIG_STMMAC_PCI) += stmmac-pci.o
diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-meson.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-meson.c
index cca028d632f6..61a324a87d09 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac-meson.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-meson.c
@@ -15,6 +15,7 @@
 #include <linux/ethtool.h>
 #include <linux/io.h>
 #include <linux/ioport.h>
+#include <linux/module.h>
 #include <linux/platform_device.h>
 #include <linux/stmmac.h>
 
@@ -63,7 +64,28 @@ static void *meson6_dwmac_setup(struct platform_device *pdev)
 	return dwmac;
 }
 
-const struct stmmac_of_data meson6_dwmac_data = {
+static const struct stmmac_of_data meson6_dwmac_data = {
 	.setup		= meson6_dwmac_setup,
 	.fix_mac_speed	= meson6_dwmac_fix_mac_speed,
 };
+
+static const struct of_device_id meson6_dwmac_match[] = {
+	{ .compatible = "amlogic,meson6-dwmac", .data = &meson6_dwmac_data},
+	{ }
+};
+MODULE_DEVICE_TABLE(of, meson6_dwmac_match);
+
+static struct platform_driver meson6_dwmac_driver = {
+	.probe  = stmmac_pltfr_probe,
+	.remove = stmmac_pltfr_remove,
+	.driver = {
+		.name           = "meson6-dwmac",
+		.pm		= &stmmac_pltfr_pm_ops,
+		.of_match_table = meson6_dwmac_match,
+	},
+};
+module_platform_driver(meson6_dwmac_driver);
+
+MODULE_AUTHOR("Beniamino Galvani <b.galvani@gmail.com>");
+MODULE_DESCRIPTION("Amlogic Meson DWMAC glue layer");
+MODULE_LICENSE("GPL v2");
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
index 1fd65e780a05..bed31e4db7e3 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
@@ -35,7 +35,6 @@
 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 = "amlogic,meson6-dwmac", .data = &meson6_dwmac_data},
 	{ .compatible = "allwinner,sun7i-a20-gmac", .data = &sun7i_gmac_data},
 	{ .compatible = "st,stih415-dwmac", .data = &stih4xx_dwmac_data},
 	{ .compatible = "st,stih416-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 23d10f6e8846..be3e137efc55 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.h
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.h
@@ -23,7 +23,6 @@ int stmmac_pltfr_probe(struct platform_device *pdev);
 int stmmac_pltfr_remove(struct platform_device *pdev);
 extern const struct dev_pm_ops stmmac_pltfr_pm_ops;
 
-extern const struct stmmac_of_data meson6_dwmac_data;
 extern const struct stmmac_of_data sun7i_gmac_data;
 extern const struct stmmac_of_data stih4xx_dwmac_data;
 extern const struct stmmac_of_data stid127_dwmac_data;
-- 
1.8.0

^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [PATCH net-next 06/11] stmmac: convert dwmac-meson to platform driver
@ 2015-05-14 10:11   ` Joachim Eastwood
  0 siblings, 0 replies; 37+ messages in thread
From: Joachim Eastwood @ 2015-05-14 10:11 UTC (permalink / raw)
  To: linux-arm-kernel

Convert platform glue layer into a proper platform
driver and add it to the build system.

Signed-off-by: Joachim Eastwood <manabian@gmail.com>
---
 drivers/net/ethernet/stmicro/stmmac/Kconfig        | 11 ++++++++++
 drivers/net/ethernet/stmicro/stmmac/Makefile       |  3 ++-
 drivers/net/ethernet/stmicro/stmmac/dwmac-meson.c  | 24 +++++++++++++++++++++-
 .../net/ethernet/stmicro/stmmac/stmmac_platform.c  |  1 -
 .../net/ethernet/stmicro/stmmac/stmmac_platform.h  |  1 -
 5 files changed, 36 insertions(+), 4 deletions(-)

diff --git a/drivers/net/ethernet/stmicro/stmmac/Kconfig b/drivers/net/ethernet/stmicro/stmmac/Kconfig
index aa03e26437e2..a5a56217a845 100644
--- a/drivers/net/ethernet/stmicro/stmmac/Kconfig
+++ b/drivers/net/ethernet/stmicro/stmmac/Kconfig
@@ -44,6 +44,17 @@ config DWMAC_LPC18XX
 	---help---
 	  Support for NXP LPC18xx/43xx DWMAC Ethernet.
 
+config DWMAC_MESON
+	tristate "Amlogic Meson dwmac support"
+	default ARCH_MESON
+	depends on OF
+	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.
+
 endif
 
 config STMMAC_PCI
diff --git a/drivers/net/ethernet/stmicro/stmmac/Makefile b/drivers/net/ethernet/stmicro/stmmac/Makefile
index 96a3abfc15bb..69cc046afd8c 100644
--- a/drivers/net/ethernet/stmicro/stmmac/Makefile
+++ b/drivers/net/ethernet/stmicro/stmmac/Makefile
@@ -7,8 +7,9 @@ stmmac-objs:= stmmac_main.o stmmac_ethtool.o stmmac_mdio.o ring_mode.o	\
 # Ordering matters. Generic driver must be last.
 obj-$(CONFIG_STMMAC_PLATFORM)	+= stmmac-platform.o
 obj-$(CONFIG_DWMAC_LPC18XX)	+= dwmac-lpc18xx.o
+obj-$(CONFIG_DWMAC_MESON)	+= dwmac-meson.o
 obj-$(CONFIG_DWMAC_GENERIC)	+= dwmac-generic.o
-stmmac-platform-objs:= stmmac_platform.o dwmac-meson.o dwmac-sunxi.o	\
+stmmac-platform-objs:= stmmac_platform.o dwmac-sunxi.o \
 		       dwmac-sti.o dwmac-socfpga.o dwmac-rk.o		\
 
 obj-$(CONFIG_STMMAC_PCI) += stmmac-pci.o
diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-meson.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-meson.c
index cca028d632f6..61a324a87d09 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac-meson.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-meson.c
@@ -15,6 +15,7 @@
 #include <linux/ethtool.h>
 #include <linux/io.h>
 #include <linux/ioport.h>
+#include <linux/module.h>
 #include <linux/platform_device.h>
 #include <linux/stmmac.h>
 
@@ -63,7 +64,28 @@ static void *meson6_dwmac_setup(struct platform_device *pdev)
 	return dwmac;
 }
 
-const struct stmmac_of_data meson6_dwmac_data = {
+static const struct stmmac_of_data meson6_dwmac_data = {
 	.setup		= meson6_dwmac_setup,
 	.fix_mac_speed	= meson6_dwmac_fix_mac_speed,
 };
+
+static const struct of_device_id meson6_dwmac_match[] = {
+	{ .compatible = "amlogic,meson6-dwmac", .data = &meson6_dwmac_data},
+	{ }
+};
+MODULE_DEVICE_TABLE(of, meson6_dwmac_match);
+
+static struct platform_driver meson6_dwmac_driver = {
+	.probe  = stmmac_pltfr_probe,
+	.remove = stmmac_pltfr_remove,
+	.driver = {
+		.name           = "meson6-dwmac",
+		.pm		= &stmmac_pltfr_pm_ops,
+		.of_match_table = meson6_dwmac_match,
+	},
+};
+module_platform_driver(meson6_dwmac_driver);
+
+MODULE_AUTHOR("Beniamino Galvani <b.galvani@gmail.com>");
+MODULE_DESCRIPTION("Amlogic Meson DWMAC glue layer");
+MODULE_LICENSE("GPL v2");
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
index 1fd65e780a05..bed31e4db7e3 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
@@ -35,7 +35,6 @@
 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 = "amlogic,meson6-dwmac", .data = &meson6_dwmac_data},
 	{ .compatible = "allwinner,sun7i-a20-gmac", .data = &sun7i_gmac_data},
 	{ .compatible = "st,stih415-dwmac", .data = &stih4xx_dwmac_data},
 	{ .compatible = "st,stih416-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 23d10f6e8846..be3e137efc55 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.h
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.h
@@ -23,7 +23,6 @@ int stmmac_pltfr_probe(struct platform_device *pdev);
 int stmmac_pltfr_remove(struct platform_device *pdev);
 extern const struct dev_pm_ops stmmac_pltfr_pm_ops;
 
-extern const struct stmmac_of_data meson6_dwmac_data;
 extern const struct stmmac_of_data sun7i_gmac_data;
 extern const struct stmmac_of_data stih4xx_dwmac_data;
 extern const struct stmmac_of_data stid127_dwmac_data;
-- 
1.8.0

^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [PATCH net-next 07/11] stmmac: convert dwmac-rk to platform driver
  2015-05-14 10:10 ` Joachim Eastwood
@ 2015-05-14 10:11   ` Joachim Eastwood
  -1 siblings, 0 replies; 37+ messages in thread
From: Joachim Eastwood @ 2015-05-14 10:11 UTC (permalink / raw)
  To: arnd, peppe.cavallaro, roger.chen
  Cc: Joachim Eastwood, netdev, davem, linux-arm-kernel, linux-rockchip

Convert platform glue layer into a proper platform
driver and add it to the build system.

Signed-off-by: Joachim Eastwood <manabian@gmail.com>
---
 drivers/net/ethernet/stmicro/stmmac/Kconfig        | 11 +++++++++
 drivers/net/ethernet/stmicro/stmmac/Makefile       |  3 ++-
 drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c     | 27 +++++++++++++++++++++-
 .../net/ethernet/stmicro/stmmac/stmmac_platform.c  |  1 -
 .../net/ethernet/stmicro/stmmac/stmmac_platform.h  |  1 -
 5 files changed, 39 insertions(+), 4 deletions(-)

diff --git a/drivers/net/ethernet/stmicro/stmmac/Kconfig b/drivers/net/ethernet/stmicro/stmmac/Kconfig
index a5a56217a845..cb984606a819 100644
--- a/drivers/net/ethernet/stmicro/stmmac/Kconfig
+++ b/drivers/net/ethernet/stmicro/stmmac/Kconfig
@@ -55,6 +55,17 @@ config DWMAC_MESON
 	  the stmmac device driver. This driver is used for Meson6 and
 	  Meson8 SoCs.
 
+config DWMAC_ROCKCHIP
+	tristate "Rockchip dwmac support"
+	default ARCH_ROCKCHIP
+	depends on OF
+	select MFD_SYSCON
+	help
+	  Support for Ethernet controller on Rockchip RK3288 SoC.
+
+	  This selects the Rockchip RK3288 SoC glue layer support for
+	  the stmmac device driver.
+
 endif
 
 config STMMAC_PCI
diff --git a/drivers/net/ethernet/stmicro/stmmac/Makefile b/drivers/net/ethernet/stmicro/stmmac/Makefile
index 69cc046afd8c..e67dea423324 100644
--- a/drivers/net/ethernet/stmicro/stmmac/Makefile
+++ b/drivers/net/ethernet/stmicro/stmmac/Makefile
@@ -8,9 +8,10 @@ stmmac-objs:= stmmac_main.o stmmac_ethtool.o stmmac_mdio.o ring_mode.o	\
 obj-$(CONFIG_STMMAC_PLATFORM)	+= stmmac-platform.o
 obj-$(CONFIG_DWMAC_LPC18XX)	+= dwmac-lpc18xx.o
 obj-$(CONFIG_DWMAC_MESON)	+= dwmac-meson.o
+obj-$(CONFIG_DWMAC_ROCKCHIP)	+= dwmac-rk.o
 obj-$(CONFIG_DWMAC_GENERIC)	+= dwmac-generic.o
 stmmac-platform-objs:= stmmac_platform.o dwmac-sunxi.o \
-		       dwmac-sti.o dwmac-socfpga.o dwmac-rk.o		\
+		       dwmac-sti.o dwmac-socfpga.o
 
 obj-$(CONFIG_STMMAC_PCI) += stmmac-pci.o
 stmmac-pci-objs:= stmmac_pci.o
diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c
index 6249a4ec08f0..30e28f0d9a60 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c
@@ -22,13 +22,17 @@
 #include <linux/phy.h>
 #include <linux/of_net.h>
 #include <linux/gpio.h>
+#include <linux/module.h>
 #include <linux/of_gpio.h>
 #include <linux/of_device.h>
+#include <linux/platform_device.h>
 #include <linux/regulator/consumer.h>
 #include <linux/delay.h>
 #include <linux/mfd/syscon.h>
 #include <linux/regmap.h>
 
+#include "stmmac_platform.h"
+
 struct rk_priv_data {
 	struct platform_device *pdev;
 	int phy_iface;
@@ -428,10 +432,31 @@ static void rk_fix_speed(void *priv, unsigned int speed)
 		dev_err(dev, "unsupported interface %d", bsp_priv->phy_iface);
 }
 
-const struct stmmac_of_data rk3288_gmac_data = {
+static const struct stmmac_of_data rk3288_gmac_data = {
 	.has_gmac = 1,
 	.fix_mac_speed = rk_fix_speed,
 	.setup = rk_gmac_setup,
 	.init = rk_gmac_init,
 	.exit = rk_gmac_exit,
 };
+
+static const struct of_device_id rk_gmac_dwmac_match[] = {
+	{ .compatible = "rockchip,rk3288-gmac", .data = &rk3288_gmac_data},
+	{ }
+};
+MODULE_DEVICE_TABLE(of, rk_gmac_dwmac_match);
+
+static struct platform_driver rk_gmac_dwmac_driver = {
+	.probe  = stmmac_pltfr_probe,
+	.remove = stmmac_pltfr_remove,
+	.driver = {
+		.name           = "rk_gmac-dwmac",
+		.pm		= &stmmac_pltfr_pm_ops,
+		.of_match_table = rk_gmac_dwmac_match,
+	},
+};
+module_platform_driver(rk_gmac_dwmac_driver);
+
+MODULE_AUTHOR("Chen-Zhi (Roger Chen) <roger.chen@rock-chips.com>");
+MODULE_DESCRIPTION("Rockchip RK3288 DWMAC specific glue layer");
+MODULE_LICENSE("GPL");
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
index bed31e4db7e3..674f7bd1641a 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
@@ -34,7 +34,6 @@
 
 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 = "allwinner,sun7i-a20-gmac", .data = &sun7i_gmac_data},
 	{ .compatible = "st,stih415-dwmac", .data = &stih4xx_dwmac_data},
 	{ .compatible = "st,stih416-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 be3e137efc55..fff2a885ffd8 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.h
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.h
@@ -27,6 +27,5 @@ extern const struct stmmac_of_data sun7i_gmac_data;
 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;
 
 #endif /* __STMMAC_PLATFORM_H__ */
-- 
1.8.0

^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [PATCH net-next 07/11] stmmac: convert dwmac-rk to platform driver
@ 2015-05-14 10:11   ` Joachim Eastwood
  0 siblings, 0 replies; 37+ messages in thread
From: Joachim Eastwood @ 2015-05-14 10:11 UTC (permalink / raw)
  To: linux-arm-kernel

Convert platform glue layer into a proper platform
driver and add it to the build system.

Signed-off-by: Joachim Eastwood <manabian@gmail.com>
---
 drivers/net/ethernet/stmicro/stmmac/Kconfig        | 11 +++++++++
 drivers/net/ethernet/stmicro/stmmac/Makefile       |  3 ++-
 drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c     | 27 +++++++++++++++++++++-
 .../net/ethernet/stmicro/stmmac/stmmac_platform.c  |  1 -
 .../net/ethernet/stmicro/stmmac/stmmac_platform.h  |  1 -
 5 files changed, 39 insertions(+), 4 deletions(-)

diff --git a/drivers/net/ethernet/stmicro/stmmac/Kconfig b/drivers/net/ethernet/stmicro/stmmac/Kconfig
index a5a56217a845..cb984606a819 100644
--- a/drivers/net/ethernet/stmicro/stmmac/Kconfig
+++ b/drivers/net/ethernet/stmicro/stmmac/Kconfig
@@ -55,6 +55,17 @@ config DWMAC_MESON
 	  the stmmac device driver. This driver is used for Meson6 and
 	  Meson8 SoCs.
 
+config DWMAC_ROCKCHIP
+	tristate "Rockchip dwmac support"
+	default ARCH_ROCKCHIP
+	depends on OF
+	select MFD_SYSCON
+	help
+	  Support for Ethernet controller on Rockchip RK3288 SoC.
+
+	  This selects the Rockchip RK3288 SoC glue layer support for
+	  the stmmac device driver.
+
 endif
 
 config STMMAC_PCI
diff --git a/drivers/net/ethernet/stmicro/stmmac/Makefile b/drivers/net/ethernet/stmicro/stmmac/Makefile
index 69cc046afd8c..e67dea423324 100644
--- a/drivers/net/ethernet/stmicro/stmmac/Makefile
+++ b/drivers/net/ethernet/stmicro/stmmac/Makefile
@@ -8,9 +8,10 @@ stmmac-objs:= stmmac_main.o stmmac_ethtool.o stmmac_mdio.o ring_mode.o	\
 obj-$(CONFIG_STMMAC_PLATFORM)	+= stmmac-platform.o
 obj-$(CONFIG_DWMAC_LPC18XX)	+= dwmac-lpc18xx.o
 obj-$(CONFIG_DWMAC_MESON)	+= dwmac-meson.o
+obj-$(CONFIG_DWMAC_ROCKCHIP)	+= dwmac-rk.o
 obj-$(CONFIG_DWMAC_GENERIC)	+= dwmac-generic.o
 stmmac-platform-objs:= stmmac_platform.o dwmac-sunxi.o \
-		       dwmac-sti.o dwmac-socfpga.o dwmac-rk.o		\
+		       dwmac-sti.o dwmac-socfpga.o
 
 obj-$(CONFIG_STMMAC_PCI) += stmmac-pci.o
 stmmac-pci-objs:= stmmac_pci.o
diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c
index 6249a4ec08f0..30e28f0d9a60 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c
@@ -22,13 +22,17 @@
 #include <linux/phy.h>
 #include <linux/of_net.h>
 #include <linux/gpio.h>
+#include <linux/module.h>
 #include <linux/of_gpio.h>
 #include <linux/of_device.h>
+#include <linux/platform_device.h>
 #include <linux/regulator/consumer.h>
 #include <linux/delay.h>
 #include <linux/mfd/syscon.h>
 #include <linux/regmap.h>
 
+#include "stmmac_platform.h"
+
 struct rk_priv_data {
 	struct platform_device *pdev;
 	int phy_iface;
@@ -428,10 +432,31 @@ static void rk_fix_speed(void *priv, unsigned int speed)
 		dev_err(dev, "unsupported interface %d", bsp_priv->phy_iface);
 }
 
-const struct stmmac_of_data rk3288_gmac_data = {
+static const struct stmmac_of_data rk3288_gmac_data = {
 	.has_gmac = 1,
 	.fix_mac_speed = rk_fix_speed,
 	.setup = rk_gmac_setup,
 	.init = rk_gmac_init,
 	.exit = rk_gmac_exit,
 };
+
+static const struct of_device_id rk_gmac_dwmac_match[] = {
+	{ .compatible = "rockchip,rk3288-gmac", .data = &rk3288_gmac_data},
+	{ }
+};
+MODULE_DEVICE_TABLE(of, rk_gmac_dwmac_match);
+
+static struct platform_driver rk_gmac_dwmac_driver = {
+	.probe  = stmmac_pltfr_probe,
+	.remove = stmmac_pltfr_remove,
+	.driver = {
+		.name           = "rk_gmac-dwmac",
+		.pm		= &stmmac_pltfr_pm_ops,
+		.of_match_table = rk_gmac_dwmac_match,
+	},
+};
+module_platform_driver(rk_gmac_dwmac_driver);
+
+MODULE_AUTHOR("Chen-Zhi (Roger Chen) <roger.chen@rock-chips.com>");
+MODULE_DESCRIPTION("Rockchip RK3288 DWMAC specific glue layer");
+MODULE_LICENSE("GPL");
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
index bed31e4db7e3..674f7bd1641a 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
@@ -34,7 +34,6 @@
 
 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 = "allwinner,sun7i-a20-gmac", .data = &sun7i_gmac_data},
 	{ .compatible = "st,stih415-dwmac", .data = &stih4xx_dwmac_data},
 	{ .compatible = "st,stih416-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 be3e137efc55..fff2a885ffd8 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.h
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.h
@@ -27,6 +27,5 @@ extern const struct stmmac_of_data sun7i_gmac_data;
 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;
 
 #endif /* __STMMAC_PLATFORM_H__ */
-- 
1.8.0

^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [PATCH net-next 08/11] stmmac: convert dwmac-socfpga to platform driver
  2015-05-14 10:10 ` Joachim Eastwood
@ 2015-05-14 10:11   ` Joachim Eastwood
  -1 siblings, 0 replies; 37+ messages in thread
From: Joachim Eastwood @ 2015-05-14 10:11 UTC (permalink / raw)
  To: arnd, peppe.cavallaro, dinguyen
  Cc: Joachim Eastwood, netdev, davem, linux-arm-kernel

Convert platform glue layer into a proper platform
driver and add it to the build system.

Signed-off-by: Joachim Eastwood <manabian@gmail.com>
---
 drivers/net/ethernet/stmicro/stmmac/Kconfig         | 12 ++++++++++++
 drivers/net/ethernet/stmicro/stmmac/Makefile        |  3 ++-
 drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c | 21 ++++++++++++++++++++-
 .../net/ethernet/stmicro/stmmac/stmmac_platform.c   |  1 -
 .../net/ethernet/stmicro/stmmac/stmmac_platform.h   |  1 -
 5 files changed, 34 insertions(+), 4 deletions(-)

diff --git a/drivers/net/ethernet/stmicro/stmmac/Kconfig b/drivers/net/ethernet/stmicro/stmmac/Kconfig
index cb984606a819..f103e57e3ac0 100644
--- a/drivers/net/ethernet/stmicro/stmmac/Kconfig
+++ b/drivers/net/ethernet/stmicro/stmmac/Kconfig
@@ -66,6 +66,18 @@ config DWMAC_ROCKCHIP
 	  This selects the Rockchip RK3288 SoC glue layer support for
 	  the stmmac device driver.
 
+config DWMAC_SOCFPGA
+	tristate "SOCFPGA dwmac support"
+	default ARCH_SOCFPGA
+	depends on OF
+	select MFD_SYSCON
+	help
+	  Support for ethernet controller on Altera SOCFPGA
+
+	  This selects the Altera SOCFPGA SoC glue layer support
+	  for the stmmac device driver. This driver is used for
+	  arria5 and cyclone5 FPGA SoCs.
+
 endif
 
 config STMMAC_PCI
diff --git a/drivers/net/ethernet/stmicro/stmmac/Makefile b/drivers/net/ethernet/stmicro/stmmac/Makefile
index e67dea423324..690741d6fc10 100644
--- a/drivers/net/ethernet/stmicro/stmmac/Makefile
+++ b/drivers/net/ethernet/stmicro/stmmac/Makefile
@@ -9,9 +9,10 @@ obj-$(CONFIG_STMMAC_PLATFORM)	+= stmmac-platform.o
 obj-$(CONFIG_DWMAC_LPC18XX)	+= dwmac-lpc18xx.o
 obj-$(CONFIG_DWMAC_MESON)	+= dwmac-meson.o
 obj-$(CONFIG_DWMAC_ROCKCHIP)	+= dwmac-rk.o
+obj-$(CONFIG_DWMAC_SOCFPGA)	+= dwmac-socfpga.o
 obj-$(CONFIG_DWMAC_GENERIC)	+= dwmac-generic.o
 stmmac-platform-objs:= stmmac_platform.o dwmac-sunxi.o \
-		       dwmac-sti.o dwmac-socfpga.o
+		       dwmac-sti.o
 
 obj-$(CONFIG_STMMAC_PCI) += stmmac-pci.o
 stmmac-pci-objs:= stmmac_pci.o
diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c
index 5a36bd2c7837..8141c5b844ae 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c
@@ -257,9 +257,28 @@ static int socfpga_dwmac_init(struct platform_device *pdev, void *priv)
 	return ret;
 }
 
-const struct stmmac_of_data socfpga_gmac_data = {
+static const struct stmmac_of_data socfpga_gmac_data = {
 	.setup = socfpga_dwmac_probe,
 	.init = socfpga_dwmac_init,
 	.exit = socfpga_dwmac_exit,
 	.fix_mac_speed = socfpga_dwmac_fix_mac_speed,
 };
+
+static const struct of_device_id socfpga_dwmac_match[] = {
+	{ .compatible = "altr,socfpga-stmmac", .data = &socfpga_gmac_data },
+	{ }
+};
+MODULE_DEVICE_TABLE(of, socfpga_dwmac_match);
+
+static struct platform_driver socfpga_dwmac_driver = {
+	.probe  = stmmac_pltfr_probe,
+	.remove = stmmac_pltfr_remove,
+	.driver = {
+		.name           = "socfpga-dwmac",
+		.pm		= &stmmac_pltfr_pm_ops,
+		.of_match_table = socfpga_dwmac_match,
+	},
+};
+module_platform_driver(socfpga_dwmac_driver);
+
+MODULE_LICENSE("GPL v2");
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
index 674f7bd1641a..4553b50833ea 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
@@ -39,7 +39,6 @@ static const struct of_device_id stmmac_dt_ids[] = {
 	{ .compatible = "st,stih416-dwmac", .data = &stih4xx_dwmac_data},
 	{ .compatible = "st,stid127-dwmac", .data = &stid127_dwmac_data},
 	{ .compatible = "st,stih407-dwmac", .data = &stih4xx_dwmac_data},
-	{ .compatible = "altr,socfpga-stmmac", .data = &socfpga_gmac_data },
 	{ /* sentinel */ }
 };
 MODULE_DEVICE_TABLE(of, stmmac_dt_ids);
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.h b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.h
index fff2a885ffd8..3c8d7088361f 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.h
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.h
@@ -26,6 +26,5 @@ extern const struct dev_pm_ops stmmac_pltfr_pm_ops;
 extern const struct stmmac_of_data sun7i_gmac_data;
 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;
 
 #endif /* __STMMAC_PLATFORM_H__ */
-- 
1.8.0

^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [PATCH net-next 08/11] stmmac: convert dwmac-socfpga to platform driver
@ 2015-05-14 10:11   ` Joachim Eastwood
  0 siblings, 0 replies; 37+ messages in thread
From: Joachim Eastwood @ 2015-05-14 10:11 UTC (permalink / raw)
  To: linux-arm-kernel

Convert platform glue layer into a proper platform
driver and add it to the build system.

Signed-off-by: Joachim Eastwood <manabian@gmail.com>
---
 drivers/net/ethernet/stmicro/stmmac/Kconfig         | 12 ++++++++++++
 drivers/net/ethernet/stmicro/stmmac/Makefile        |  3 ++-
 drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c | 21 ++++++++++++++++++++-
 .../net/ethernet/stmicro/stmmac/stmmac_platform.c   |  1 -
 .../net/ethernet/stmicro/stmmac/stmmac_platform.h   |  1 -
 5 files changed, 34 insertions(+), 4 deletions(-)

diff --git a/drivers/net/ethernet/stmicro/stmmac/Kconfig b/drivers/net/ethernet/stmicro/stmmac/Kconfig
index cb984606a819..f103e57e3ac0 100644
--- a/drivers/net/ethernet/stmicro/stmmac/Kconfig
+++ b/drivers/net/ethernet/stmicro/stmmac/Kconfig
@@ -66,6 +66,18 @@ config DWMAC_ROCKCHIP
 	  This selects the Rockchip RK3288 SoC glue layer support for
 	  the stmmac device driver.
 
+config DWMAC_SOCFPGA
+	tristate "SOCFPGA dwmac support"
+	default ARCH_SOCFPGA
+	depends on OF
+	select MFD_SYSCON
+	help
+	  Support for ethernet controller on Altera SOCFPGA
+
+	  This selects the Altera SOCFPGA SoC glue layer support
+	  for the stmmac device driver. This driver is used for
+	  arria5 and cyclone5 FPGA SoCs.
+
 endif
 
 config STMMAC_PCI
diff --git a/drivers/net/ethernet/stmicro/stmmac/Makefile b/drivers/net/ethernet/stmicro/stmmac/Makefile
index e67dea423324..690741d6fc10 100644
--- a/drivers/net/ethernet/stmicro/stmmac/Makefile
+++ b/drivers/net/ethernet/stmicro/stmmac/Makefile
@@ -9,9 +9,10 @@ obj-$(CONFIG_STMMAC_PLATFORM)	+= stmmac-platform.o
 obj-$(CONFIG_DWMAC_LPC18XX)	+= dwmac-lpc18xx.o
 obj-$(CONFIG_DWMAC_MESON)	+= dwmac-meson.o
 obj-$(CONFIG_DWMAC_ROCKCHIP)	+= dwmac-rk.o
+obj-$(CONFIG_DWMAC_SOCFPGA)	+= dwmac-socfpga.o
 obj-$(CONFIG_DWMAC_GENERIC)	+= dwmac-generic.o
 stmmac-platform-objs:= stmmac_platform.o dwmac-sunxi.o \
-		       dwmac-sti.o dwmac-socfpga.o
+		       dwmac-sti.o
 
 obj-$(CONFIG_STMMAC_PCI) += stmmac-pci.o
 stmmac-pci-objs:= stmmac_pci.o
diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c
index 5a36bd2c7837..8141c5b844ae 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c
@@ -257,9 +257,28 @@ static int socfpga_dwmac_init(struct platform_device *pdev, void *priv)
 	return ret;
 }
 
-const struct stmmac_of_data socfpga_gmac_data = {
+static const struct stmmac_of_data socfpga_gmac_data = {
 	.setup = socfpga_dwmac_probe,
 	.init = socfpga_dwmac_init,
 	.exit = socfpga_dwmac_exit,
 	.fix_mac_speed = socfpga_dwmac_fix_mac_speed,
 };
+
+static const struct of_device_id socfpga_dwmac_match[] = {
+	{ .compatible = "altr,socfpga-stmmac", .data = &socfpga_gmac_data },
+	{ }
+};
+MODULE_DEVICE_TABLE(of, socfpga_dwmac_match);
+
+static struct platform_driver socfpga_dwmac_driver = {
+	.probe  = stmmac_pltfr_probe,
+	.remove = stmmac_pltfr_remove,
+	.driver = {
+		.name           = "socfpga-dwmac",
+		.pm		= &stmmac_pltfr_pm_ops,
+		.of_match_table = socfpga_dwmac_match,
+	},
+};
+module_platform_driver(socfpga_dwmac_driver);
+
+MODULE_LICENSE("GPL v2");
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
index 674f7bd1641a..4553b50833ea 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
@@ -39,7 +39,6 @@ static const struct of_device_id stmmac_dt_ids[] = {
 	{ .compatible = "st,stih416-dwmac", .data = &stih4xx_dwmac_data},
 	{ .compatible = "st,stid127-dwmac", .data = &stid127_dwmac_data},
 	{ .compatible = "st,stih407-dwmac", .data = &stih4xx_dwmac_data},
-	{ .compatible = "altr,socfpga-stmmac", .data = &socfpga_gmac_data },
 	{ /* sentinel */ }
 };
 MODULE_DEVICE_TABLE(of, stmmac_dt_ids);
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.h b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.h
index fff2a885ffd8..3c8d7088361f 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.h
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.h
@@ -26,6 +26,5 @@ extern const struct dev_pm_ops stmmac_pltfr_pm_ops;
 extern const struct stmmac_of_data sun7i_gmac_data;
 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;
 
 #endif /* __STMMAC_PLATFORM_H__ */
-- 
1.8.0

^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [PATCH net-next 09/11] stmmac: convert dwmac-sti to platform driver
  2015-05-14 10:10 ` Joachim Eastwood
@ 2015-05-14 10:11   ` Joachim Eastwood
  -1 siblings, 0 replies; 37+ messages in thread
From: Joachim Eastwood @ 2015-05-14 10:11 UTC (permalink / raw)
  To: arnd, peppe.cavallaro, srinivas.kandagatla
  Cc: Joachim Eastwood, netdev, davem, linux-arm-kernel

Convert platform glue layer into a proper platform
driver and add it to the build system.

Signed-off-by: Joachim Eastwood <manabian@gmail.com>
---
 drivers/net/ethernet/stmicro/stmmac/Kconfig        | 12 +++++++++
 drivers/net/ethernet/stmicro/stmmac/Makefile       |  2 +-
 drivers/net/ethernet/stmicro/stmmac/dwmac-sti.c    | 29 ++++++++++++++++++++--
 .../net/ethernet/stmicro/stmmac/stmmac_platform.c  |  4 ---
 .../net/ethernet/stmicro/stmmac/stmmac_platform.h  |  2 --
 5 files changed, 40 insertions(+), 9 deletions(-)

diff --git a/drivers/net/ethernet/stmicro/stmmac/Kconfig b/drivers/net/ethernet/stmicro/stmmac/Kconfig
index f103e57e3ac0..f5b9f051337d 100644
--- a/drivers/net/ethernet/stmicro/stmmac/Kconfig
+++ b/drivers/net/ethernet/stmicro/stmmac/Kconfig
@@ -78,6 +78,18 @@ config DWMAC_SOCFPGA
 	  for the stmmac device driver. This driver is used for
 	  arria5 and cyclone5 FPGA SoCs.
 
+config DWMAC_STI
+	tristate "STi GMAC support"
+	default ARCH_STI
+	depends on OF
+	select MFD_SYSCON
+	---help---
+	  Support for ethernet controller on STi SOCs.
+
+	  This selects STi SoC glue layer support for the stmmac
+	  device driver. This driver is used on for the STi series
+	  SOCs GMAC ethernet controller.
+
 endif
 
 config STMMAC_PCI
diff --git a/drivers/net/ethernet/stmicro/stmmac/Makefile b/drivers/net/ethernet/stmicro/stmmac/Makefile
index 690741d6fc10..f8e5ddba7fd2 100644
--- a/drivers/net/ethernet/stmicro/stmmac/Makefile
+++ b/drivers/net/ethernet/stmicro/stmmac/Makefile
@@ -10,9 +10,9 @@ obj-$(CONFIG_DWMAC_LPC18XX)	+= dwmac-lpc18xx.o
 obj-$(CONFIG_DWMAC_MESON)	+= dwmac-meson.o
 obj-$(CONFIG_DWMAC_ROCKCHIP)	+= dwmac-rk.o
 obj-$(CONFIG_DWMAC_SOCFPGA)	+= dwmac-socfpga.o
+obj-$(CONFIG_DWMAC_STI)		+= dwmac-sti.o
 obj-$(CONFIG_DWMAC_GENERIC)	+= dwmac-generic.o
 stmmac-platform-objs:= stmmac_platform.o dwmac-sunxi.o \
-		       dwmac-sti.o
 
 obj-$(CONFIG_STMMAC_PCI) += stmmac-pci.o
 stmmac-pci-objs:= stmmac_pci.o
diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-sti.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-sti.c
index bb6e2dc61bec..a2e8111c5d14 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac-sti.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-sti.c
@@ -17,6 +17,7 @@
 #include <linux/stmmac.h>
 #include <linux/phy.h>
 #include <linux/mfd/syscon.h>
+#include <linux/module.h>
 #include <linux/regmap.h>
 #include <linux/clk.h>
 #include <linux/of.h>
@@ -351,16 +352,40 @@ static void *sti_dwmac_setup(struct platform_device *pdev)
 	return dwmac;
 }
 
-const struct stmmac_of_data stih4xx_dwmac_data = {
+static const struct stmmac_of_data stih4xx_dwmac_data = {
 	.fix_mac_speed = stih4xx_fix_retime_src,
 	.setup = sti_dwmac_setup,
 	.init = stix4xx_init,
 	.exit = sti_dwmac_exit,
 };
 
-const struct stmmac_of_data stid127_dwmac_data = {
+static const struct stmmac_of_data stid127_dwmac_data = {
 	.fix_mac_speed = stid127_fix_retime_src,
 	.setup = sti_dwmac_setup,
 	.init = stid127_init,
 	.exit = sti_dwmac_exit,
 };
+
+static const struct of_device_id sti_dwmac_match[] = {
+	{ .compatible = "st,stih415-dwmac", .data = &stih4xx_dwmac_data},
+	{ .compatible = "st,stih416-dwmac", .data = &stih4xx_dwmac_data},
+	{ .compatible = "st,stid127-dwmac", .data = &stid127_dwmac_data},
+	{ .compatible = "st,stih407-dwmac", .data = &stih4xx_dwmac_data},
+	{ }
+};
+MODULE_DEVICE_TABLE(of, sti_dwmac_match);
+
+static struct platform_driver sti_dwmac_driver = {
+	.probe  = stmmac_pltfr_probe,
+	.remove = stmmac_pltfr_remove,
+	.driver = {
+		.name           = "sti-dwmac",
+		.pm		= &stmmac_pltfr_pm_ops,
+		.of_match_table = sti_dwmac_match,
+	},
+};
+module_platform_driver(sti_dwmac_driver);
+
+MODULE_AUTHOR("Srinivas Kandagatla <srinivas.kandagatla@st.com>");
+MODULE_DESCRIPTION("STMicroelectronics DWMAC Specific Glue layer");
+MODULE_LICENSE("GPL");
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
index 4553b50833ea..21a3a2c05740 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
@@ -35,10 +35,6 @@
 static const struct of_device_id stmmac_dt_ids[] = {
 	/* SoC specific glue layers should come before generic bindings */
 	{ .compatible = "allwinner,sun7i-a20-gmac", .data = &sun7i_gmac_data},
-	{ .compatible = "st,stih415-dwmac", .data = &stih4xx_dwmac_data},
-	{ .compatible = "st,stih416-dwmac", .data = &stih4xx_dwmac_data},
-	{ .compatible = "st,stid127-dwmac", .data = &stid127_dwmac_data},
-	{ .compatible = "st,stih407-dwmac", .data = &stih4xx_dwmac_data},
 	{ /* sentinel */ }
 };
 MODULE_DEVICE_TABLE(of, stmmac_dt_ids);
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.h b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.h
index 3c8d7088361f..7eb2fa8d97f3 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.h
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.h
@@ -24,7 +24,5 @@ int stmmac_pltfr_remove(struct platform_device *pdev);
 extern const struct dev_pm_ops stmmac_pltfr_pm_ops;
 
 extern const struct stmmac_of_data sun7i_gmac_data;
-extern const struct stmmac_of_data stih4xx_dwmac_data;
-extern const struct stmmac_of_data stid127_dwmac_data;
 
 #endif /* __STMMAC_PLATFORM_H__ */
-- 
1.8.0

^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [PATCH net-next 09/11] stmmac: convert dwmac-sti to platform driver
@ 2015-05-14 10:11   ` Joachim Eastwood
  0 siblings, 0 replies; 37+ messages in thread
From: Joachim Eastwood @ 2015-05-14 10:11 UTC (permalink / raw)
  To: linux-arm-kernel

Convert platform glue layer into a proper platform
driver and add it to the build system.

Signed-off-by: Joachim Eastwood <manabian@gmail.com>
---
 drivers/net/ethernet/stmicro/stmmac/Kconfig        | 12 +++++++++
 drivers/net/ethernet/stmicro/stmmac/Makefile       |  2 +-
 drivers/net/ethernet/stmicro/stmmac/dwmac-sti.c    | 29 ++++++++++++++++++++--
 .../net/ethernet/stmicro/stmmac/stmmac_platform.c  |  4 ---
 .../net/ethernet/stmicro/stmmac/stmmac_platform.h  |  2 --
 5 files changed, 40 insertions(+), 9 deletions(-)

diff --git a/drivers/net/ethernet/stmicro/stmmac/Kconfig b/drivers/net/ethernet/stmicro/stmmac/Kconfig
index f103e57e3ac0..f5b9f051337d 100644
--- a/drivers/net/ethernet/stmicro/stmmac/Kconfig
+++ b/drivers/net/ethernet/stmicro/stmmac/Kconfig
@@ -78,6 +78,18 @@ config DWMAC_SOCFPGA
 	  for the stmmac device driver. This driver is used for
 	  arria5 and cyclone5 FPGA SoCs.
 
+config DWMAC_STI
+	tristate "STi GMAC support"
+	default ARCH_STI
+	depends on OF
+	select MFD_SYSCON
+	---help---
+	  Support for ethernet controller on STi SOCs.
+
+	  This selects STi SoC glue layer support for the stmmac
+	  device driver. This driver is used on for the STi series
+	  SOCs GMAC ethernet controller.
+
 endif
 
 config STMMAC_PCI
diff --git a/drivers/net/ethernet/stmicro/stmmac/Makefile b/drivers/net/ethernet/stmicro/stmmac/Makefile
index 690741d6fc10..f8e5ddba7fd2 100644
--- a/drivers/net/ethernet/stmicro/stmmac/Makefile
+++ b/drivers/net/ethernet/stmicro/stmmac/Makefile
@@ -10,9 +10,9 @@ obj-$(CONFIG_DWMAC_LPC18XX)	+= dwmac-lpc18xx.o
 obj-$(CONFIG_DWMAC_MESON)	+= dwmac-meson.o
 obj-$(CONFIG_DWMAC_ROCKCHIP)	+= dwmac-rk.o
 obj-$(CONFIG_DWMAC_SOCFPGA)	+= dwmac-socfpga.o
+obj-$(CONFIG_DWMAC_STI)		+= dwmac-sti.o
 obj-$(CONFIG_DWMAC_GENERIC)	+= dwmac-generic.o
 stmmac-platform-objs:= stmmac_platform.o dwmac-sunxi.o \
-		       dwmac-sti.o
 
 obj-$(CONFIG_STMMAC_PCI) += stmmac-pci.o
 stmmac-pci-objs:= stmmac_pci.o
diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-sti.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-sti.c
index bb6e2dc61bec..a2e8111c5d14 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac-sti.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-sti.c
@@ -17,6 +17,7 @@
 #include <linux/stmmac.h>
 #include <linux/phy.h>
 #include <linux/mfd/syscon.h>
+#include <linux/module.h>
 #include <linux/regmap.h>
 #include <linux/clk.h>
 #include <linux/of.h>
@@ -351,16 +352,40 @@ static void *sti_dwmac_setup(struct platform_device *pdev)
 	return dwmac;
 }
 
-const struct stmmac_of_data stih4xx_dwmac_data = {
+static const struct stmmac_of_data stih4xx_dwmac_data = {
 	.fix_mac_speed = stih4xx_fix_retime_src,
 	.setup = sti_dwmac_setup,
 	.init = stix4xx_init,
 	.exit = sti_dwmac_exit,
 };
 
-const struct stmmac_of_data stid127_dwmac_data = {
+static const struct stmmac_of_data stid127_dwmac_data = {
 	.fix_mac_speed = stid127_fix_retime_src,
 	.setup = sti_dwmac_setup,
 	.init = stid127_init,
 	.exit = sti_dwmac_exit,
 };
+
+static const struct of_device_id sti_dwmac_match[] = {
+	{ .compatible = "st,stih415-dwmac", .data = &stih4xx_dwmac_data},
+	{ .compatible = "st,stih416-dwmac", .data = &stih4xx_dwmac_data},
+	{ .compatible = "st,stid127-dwmac", .data = &stid127_dwmac_data},
+	{ .compatible = "st,stih407-dwmac", .data = &stih4xx_dwmac_data},
+	{ }
+};
+MODULE_DEVICE_TABLE(of, sti_dwmac_match);
+
+static struct platform_driver sti_dwmac_driver = {
+	.probe  = stmmac_pltfr_probe,
+	.remove = stmmac_pltfr_remove,
+	.driver = {
+		.name           = "sti-dwmac",
+		.pm		= &stmmac_pltfr_pm_ops,
+		.of_match_table = sti_dwmac_match,
+	},
+};
+module_platform_driver(sti_dwmac_driver);
+
+MODULE_AUTHOR("Srinivas Kandagatla <srinivas.kandagatla@st.com>");
+MODULE_DESCRIPTION("STMicroelectronics DWMAC Specific Glue layer");
+MODULE_LICENSE("GPL");
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
index 4553b50833ea..21a3a2c05740 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
@@ -35,10 +35,6 @@
 static const struct of_device_id stmmac_dt_ids[] = {
 	/* SoC specific glue layers should come before generic bindings */
 	{ .compatible = "allwinner,sun7i-a20-gmac", .data = &sun7i_gmac_data},
-	{ .compatible = "st,stih415-dwmac", .data = &stih4xx_dwmac_data},
-	{ .compatible = "st,stih416-dwmac", .data = &stih4xx_dwmac_data},
-	{ .compatible = "st,stid127-dwmac", .data = &stid127_dwmac_data},
-	{ .compatible = "st,stih407-dwmac", .data = &stih4xx_dwmac_data},
 	{ /* sentinel */ }
 };
 MODULE_DEVICE_TABLE(of, stmmac_dt_ids);
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.h b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.h
index 3c8d7088361f..7eb2fa8d97f3 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.h
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.h
@@ -24,7 +24,5 @@ int stmmac_pltfr_remove(struct platform_device *pdev);
 extern const struct dev_pm_ops stmmac_pltfr_pm_ops;
 
 extern const struct stmmac_of_data sun7i_gmac_data;
-extern const struct stmmac_of_data stih4xx_dwmac_data;
-extern const struct stmmac_of_data stid127_dwmac_data;
 
 #endif /* __STMMAC_PLATFORM_H__ */
-- 
1.8.0

^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [PATCH net-next 10/11] stmmac: convert dwmac-sunxi to platform driver
  2015-05-14 10:10 ` Joachim Eastwood
@ 2015-05-14 10:11   ` Joachim Eastwood
  -1 siblings, 0 replies; 37+ messages in thread
From: Joachim Eastwood @ 2015-05-14 10:11 UTC (permalink / raw)
  To: arnd, peppe.cavallaro, wens
  Cc: Joachim Eastwood, netdev, davem, linux-arm-kernel

Convert platform glue layer into a proper platform
driver and add it to the build system.

Signed-off-by: Joachim Eastwood <manabian@gmail.com>
---
 drivers/net/ethernet/stmicro/stmmac/Kconfig        | 10 +++++++++
 drivers/net/ethernet/stmicro/stmmac/Makefile       |  3 ++-
 drivers/net/ethernet/stmicro/stmmac/dwmac-sunxi.c  | 25 +++++++++++++++++++++-
 .../net/ethernet/stmicro/stmmac/stmmac_platform.c  |  1 -
 .../net/ethernet/stmicro/stmmac/stmmac_platform.h  |  2 --
 5 files changed, 36 insertions(+), 5 deletions(-)

diff --git a/drivers/net/ethernet/stmicro/stmmac/Kconfig b/drivers/net/ethernet/stmicro/stmmac/Kconfig
index f5b9f051337d..731e0453a7d4 100644
--- a/drivers/net/ethernet/stmicro/stmmac/Kconfig
+++ b/drivers/net/ethernet/stmicro/stmmac/Kconfig
@@ -90,6 +90,16 @@ config DWMAC_STI
 	  device driver. This driver is used on for the STi series
 	  SOCs GMAC ethernet controller.
 
+config DWMAC_SUNXI
+	tristate "Allwinner GMAC support"
+	default ARCH_SUNXI
+	depends on OF
+	---help---
+	  Support for Allwinner A20/A31 GMAC ethernet controllers.
+
+	  This selects Allwinner SoC glue layer support for the
+	  stmmac device driver. This driver is used for A20/A31
+	  GMAC ethernet controller.
 endif
 
 config STMMAC_PCI
diff --git a/drivers/net/ethernet/stmicro/stmmac/Makefile b/drivers/net/ethernet/stmicro/stmmac/Makefile
index f8e5ddba7fd2..92e714a48367 100644
--- a/drivers/net/ethernet/stmicro/stmmac/Makefile
+++ b/drivers/net/ethernet/stmicro/stmmac/Makefile
@@ -11,8 +11,9 @@ obj-$(CONFIG_DWMAC_MESON)	+= dwmac-meson.o
 obj-$(CONFIG_DWMAC_ROCKCHIP)	+= dwmac-rk.o
 obj-$(CONFIG_DWMAC_SOCFPGA)	+= dwmac-socfpga.o
 obj-$(CONFIG_DWMAC_STI)		+= dwmac-sti.o
+obj-$(CONFIG_DWMAC_SUNXI)	+= dwmac-sunxi.o
 obj-$(CONFIG_DWMAC_GENERIC)	+= dwmac-generic.o
-stmmac-platform-objs:= stmmac_platform.o dwmac-sunxi.o \
+stmmac-platform-objs:= stmmac_platform.o
 
 obj-$(CONFIG_STMMAC_PCI) += stmmac-pci.o
 stmmac-pci-objs:= stmmac_pci.o
diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-sunxi.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-sunxi.c
index c5ea9ab75b03..15048ca39759 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac-sunxi.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-sunxi.c
@@ -18,7 +18,9 @@
 
 #include <linux/stmmac.h>
 #include <linux/clk.h>
+#include <linux/module.h>
 #include <linux/phy.h>
+#include <linux/platform_device.h>
 #include <linux/of_net.h>
 #include <linux/regulator/consumer.h>
 
@@ -132,7 +134,7 @@ static void sun7i_fix_speed(void *priv, unsigned int speed)
 
 /* of_data specifying hardware features and callbacks.
  * hardware features were copied from Allwinner drivers. */
-const struct stmmac_of_data sun7i_gmac_data = {
+static const struct stmmac_of_data sun7i_gmac_data = {
 	.has_gmac = 1,
 	.tx_coe = 1,
 	.fix_mac_speed = sun7i_fix_speed,
@@ -140,3 +142,24 @@ const struct stmmac_of_data sun7i_gmac_data = {
 	.init = sun7i_gmac_init,
 	.exit = sun7i_gmac_exit,
 };
+
+static const struct of_device_id sun7i_dwmac_match[] = {
+	{ .compatible = "allwinner,sun7i-a20-gmac", .data = &sun7i_gmac_data},
+	{ }
+};
+MODULE_DEVICE_TABLE(of, sun7i_dwmac_match);
+
+static struct platform_driver sun7i_dwmac_driver = {
+	.probe  = stmmac_pltfr_probe,
+	.remove = stmmac_pltfr_remove,
+	.driver = {
+		.name           = "sun7i-dwmac",
+		.pm		= &stmmac_pltfr_pm_ops,
+		.of_match_table = sun7i_dwmac_match,
+	},
+};
+module_platform_driver(sun7i_dwmac_driver);
+
+MODULE_AUTHOR("Chen-Yu Tsai <wens@csie.org>");
+MODULE_DESCRIPTION("Allwinner sunxi DWMAC specific glue layer");
+MODULE_LICENSE("GPL");
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
index 21a3a2c05740..e3a3c2bff86e 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
@@ -34,7 +34,6 @@
 
 static const struct of_device_id stmmac_dt_ids[] = {
 	/* SoC specific glue layers should come before generic bindings */
-	{ .compatible = "allwinner,sun7i-a20-gmac", .data = &sun7i_gmac_data},
 	{ /* sentinel */ }
 };
 MODULE_DEVICE_TABLE(of, stmmac_dt_ids);
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.h b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.h
index 7eb2fa8d97f3..71da86d7bd00 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.h
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.h
@@ -23,6 +23,4 @@ int stmmac_pltfr_probe(struct platform_device *pdev);
 int stmmac_pltfr_remove(struct platform_device *pdev);
 extern const struct dev_pm_ops stmmac_pltfr_pm_ops;
 
-extern const struct stmmac_of_data sun7i_gmac_data;
-
 #endif /* __STMMAC_PLATFORM_H__ */
-- 
1.8.0

^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [PATCH net-next 10/11] stmmac: convert dwmac-sunxi to platform driver
@ 2015-05-14 10:11   ` Joachim Eastwood
  0 siblings, 0 replies; 37+ messages in thread
From: Joachim Eastwood @ 2015-05-14 10:11 UTC (permalink / raw)
  To: linux-arm-kernel

Convert platform glue layer into a proper platform
driver and add it to the build system.

Signed-off-by: Joachim Eastwood <manabian@gmail.com>
---
 drivers/net/ethernet/stmicro/stmmac/Kconfig        | 10 +++++++++
 drivers/net/ethernet/stmicro/stmmac/Makefile       |  3 ++-
 drivers/net/ethernet/stmicro/stmmac/dwmac-sunxi.c  | 25 +++++++++++++++++++++-
 .../net/ethernet/stmicro/stmmac/stmmac_platform.c  |  1 -
 .../net/ethernet/stmicro/stmmac/stmmac_platform.h  |  2 --
 5 files changed, 36 insertions(+), 5 deletions(-)

diff --git a/drivers/net/ethernet/stmicro/stmmac/Kconfig b/drivers/net/ethernet/stmicro/stmmac/Kconfig
index f5b9f051337d..731e0453a7d4 100644
--- a/drivers/net/ethernet/stmicro/stmmac/Kconfig
+++ b/drivers/net/ethernet/stmicro/stmmac/Kconfig
@@ -90,6 +90,16 @@ config DWMAC_STI
 	  device driver. This driver is used on for the STi series
 	  SOCs GMAC ethernet controller.
 
+config DWMAC_SUNXI
+	tristate "Allwinner GMAC support"
+	default ARCH_SUNXI
+	depends on OF
+	---help---
+	  Support for Allwinner A20/A31 GMAC ethernet controllers.
+
+	  This selects Allwinner SoC glue layer support for the
+	  stmmac device driver. This driver is used for A20/A31
+	  GMAC ethernet controller.
 endif
 
 config STMMAC_PCI
diff --git a/drivers/net/ethernet/stmicro/stmmac/Makefile b/drivers/net/ethernet/stmicro/stmmac/Makefile
index f8e5ddba7fd2..92e714a48367 100644
--- a/drivers/net/ethernet/stmicro/stmmac/Makefile
+++ b/drivers/net/ethernet/stmicro/stmmac/Makefile
@@ -11,8 +11,9 @@ obj-$(CONFIG_DWMAC_MESON)	+= dwmac-meson.o
 obj-$(CONFIG_DWMAC_ROCKCHIP)	+= dwmac-rk.o
 obj-$(CONFIG_DWMAC_SOCFPGA)	+= dwmac-socfpga.o
 obj-$(CONFIG_DWMAC_STI)		+= dwmac-sti.o
+obj-$(CONFIG_DWMAC_SUNXI)	+= dwmac-sunxi.o
 obj-$(CONFIG_DWMAC_GENERIC)	+= dwmac-generic.o
-stmmac-platform-objs:= stmmac_platform.o dwmac-sunxi.o \
+stmmac-platform-objs:= stmmac_platform.o
 
 obj-$(CONFIG_STMMAC_PCI) += stmmac-pci.o
 stmmac-pci-objs:= stmmac_pci.o
diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-sunxi.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-sunxi.c
index c5ea9ab75b03..15048ca39759 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac-sunxi.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-sunxi.c
@@ -18,7 +18,9 @@
 
 #include <linux/stmmac.h>
 #include <linux/clk.h>
+#include <linux/module.h>
 #include <linux/phy.h>
+#include <linux/platform_device.h>
 #include <linux/of_net.h>
 #include <linux/regulator/consumer.h>
 
@@ -132,7 +134,7 @@ static void sun7i_fix_speed(void *priv, unsigned int speed)
 
 /* of_data specifying hardware features and callbacks.
  * hardware features were copied from Allwinner drivers. */
-const struct stmmac_of_data sun7i_gmac_data = {
+static const struct stmmac_of_data sun7i_gmac_data = {
 	.has_gmac = 1,
 	.tx_coe = 1,
 	.fix_mac_speed = sun7i_fix_speed,
@@ -140,3 +142,24 @@ const struct stmmac_of_data sun7i_gmac_data = {
 	.init = sun7i_gmac_init,
 	.exit = sun7i_gmac_exit,
 };
+
+static const struct of_device_id sun7i_dwmac_match[] = {
+	{ .compatible = "allwinner,sun7i-a20-gmac", .data = &sun7i_gmac_data},
+	{ }
+};
+MODULE_DEVICE_TABLE(of, sun7i_dwmac_match);
+
+static struct platform_driver sun7i_dwmac_driver = {
+	.probe  = stmmac_pltfr_probe,
+	.remove = stmmac_pltfr_remove,
+	.driver = {
+		.name           = "sun7i-dwmac",
+		.pm		= &stmmac_pltfr_pm_ops,
+		.of_match_table = sun7i_dwmac_match,
+	},
+};
+module_platform_driver(sun7i_dwmac_driver);
+
+MODULE_AUTHOR("Chen-Yu Tsai <wens@csie.org>");
+MODULE_DESCRIPTION("Allwinner sunxi DWMAC specific glue layer");
+MODULE_LICENSE("GPL");
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
index 21a3a2c05740..e3a3c2bff86e 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
@@ -34,7 +34,6 @@
 
 static const struct of_device_id stmmac_dt_ids[] = {
 	/* SoC specific glue layers should come before generic bindings */
-	{ .compatible = "allwinner,sun7i-a20-gmac", .data = &sun7i_gmac_data},
 	{ /* sentinel */ }
 };
 MODULE_DEVICE_TABLE(of, stmmac_dt_ids);
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.h b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.h
index 7eb2fa8d97f3..71da86d7bd00 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.h
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.h
@@ -23,6 +23,4 @@ int stmmac_pltfr_probe(struct platform_device *pdev);
 int stmmac_pltfr_remove(struct platform_device *pdev);
 extern const struct dev_pm_ops stmmac_pltfr_pm_ops;
 
-extern const struct stmmac_of_data sun7i_gmac_data;
-
 #endif /* __STMMAC_PLATFORM_H__ */
-- 
1.8.0

^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [PATCH net-next 11/11] stmmac: drop driver from stmmac platform code
  2015-05-14 10:10 ` Joachim Eastwood
@ 2015-05-14 10:11   ` Joachim Eastwood
  -1 siblings, 0 replies; 37+ messages in thread
From: Joachim Eastwood @ 2015-05-14 10:11 UTC (permalink / raw)
  To: arnd, peppe.cavallaro; +Cc: Joachim Eastwood, netdev, davem, linux-arm-kernel

The dwmac-generic replaces the driver inside the stmmac
platform code. This turns stmmac platform into a library
used by drivers for common platform driver functions.

Signed-off-by: Joachim Eastwood <manabian@gmail.com>
---
 .../net/ethernet/stmicro/stmmac/dwmac-generic.c    |  4 +++-
 .../net/ethernet/stmicro/stmmac/stmmac_platform.c  | 22 ----------------------
 2 files changed, 3 insertions(+), 23 deletions(-)

diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-generic.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-generic.c
index fb9623744e41..e817a1a44379 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac-generic.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-generic.c
@@ -1,6 +1,7 @@
 /*
  * Generic DWMAC platform driver
  *
+ * Copyright (C) 2007-2011  STMicroelectronics Ltd
  * Copyright (C) 2015 Joachim Eastwood <manabian@gmail.com>
  *
  * This file is licensed under the terms of the GNU General Public
@@ -12,6 +13,7 @@
 #include <linux/of.h>
 #include <linux/platform_device.h>
 
+#include "stmmac.h"
 #include "stmmac_platform.h"
 
 static const struct of_device_id dwmac_generic_match[] = {
@@ -28,7 +30,7 @@ static struct platform_driver dwmac_generic_driver = {
 	.probe  = stmmac_pltfr_probe,
 	.remove = stmmac_pltfr_remove,
 	.driver = {
-		.name           = "dwmac-generic",
+		.name           = STMMAC_RESOURCE_NAME,
 		.pm		= &stmmac_pltfr_pm_ops,
 		.of_match_table = of_match_ptr(dwmac_generic_match),
 	},
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
index e3a3c2bff86e..3e194c3ca297 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
@@ -32,12 +32,6 @@
 #include "stmmac.h"
 #include "stmmac_platform.h"
 
-static const struct of_device_id stmmac_dt_ids[] = {
-	/* SoC specific glue layers should come before generic bindings */
-	{ /* sentinel */ }
-};
-MODULE_DEVICE_TABLE(of, stmmac_dt_ids);
-
 #ifdef CONFIG_OF
 
 /**
@@ -431,19 +425,3 @@ static int stmmac_pltfr_resume(struct device *dev)
 SIMPLE_DEV_PM_OPS(stmmac_pltfr_pm_ops, stmmac_pltfr_suspend,
 				       stmmac_pltfr_resume);
 EXPORT_SYMBOL_GPL(stmmac_pltfr_pm_ops);
-
-static struct platform_driver stmmac_pltfr_driver = {
-	.probe = stmmac_pltfr_probe,
-	.remove = stmmac_pltfr_remove,
-	.driver = {
-		   .name = STMMAC_RESOURCE_NAME,
-		   .pm = &stmmac_pltfr_pm_ops,
-		   .of_match_table = of_match_ptr(stmmac_dt_ids),
-	},
-};
-
-module_platform_driver(stmmac_pltfr_driver);
-
-MODULE_DESCRIPTION("STMMAC 10/100/1000 Ethernet PLATFORM driver");
-MODULE_AUTHOR("Giuseppe Cavallaro <peppe.cavallaro@st.com>");
-MODULE_LICENSE("GPL");
-- 
1.8.0

^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [PATCH net-next 11/11] stmmac: drop driver from stmmac platform code
@ 2015-05-14 10:11   ` Joachim Eastwood
  0 siblings, 0 replies; 37+ messages in thread
From: Joachim Eastwood @ 2015-05-14 10:11 UTC (permalink / raw)
  To: linux-arm-kernel

The dwmac-generic replaces the driver inside the stmmac
platform code. This turns stmmac platform into a library
used by drivers for common platform driver functions.

Signed-off-by: Joachim Eastwood <manabian@gmail.com>
---
 .../net/ethernet/stmicro/stmmac/dwmac-generic.c    |  4 +++-
 .../net/ethernet/stmicro/stmmac/stmmac_platform.c  | 22 ----------------------
 2 files changed, 3 insertions(+), 23 deletions(-)

diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-generic.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-generic.c
index fb9623744e41..e817a1a44379 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac-generic.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-generic.c
@@ -1,6 +1,7 @@
 /*
  * Generic DWMAC platform driver
  *
+ * Copyright (C) 2007-2011  STMicroelectronics Ltd
  * Copyright (C) 2015 Joachim Eastwood <manabian@gmail.com>
  *
  * This file is licensed under the terms of the GNU General Public
@@ -12,6 +13,7 @@
 #include <linux/of.h>
 #include <linux/platform_device.h>
 
+#include "stmmac.h"
 #include "stmmac_platform.h"
 
 static const struct of_device_id dwmac_generic_match[] = {
@@ -28,7 +30,7 @@ static struct platform_driver dwmac_generic_driver = {
 	.probe  = stmmac_pltfr_probe,
 	.remove = stmmac_pltfr_remove,
 	.driver = {
-		.name           = "dwmac-generic",
+		.name           = STMMAC_RESOURCE_NAME,
 		.pm		= &stmmac_pltfr_pm_ops,
 		.of_match_table = of_match_ptr(dwmac_generic_match),
 	},
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
index e3a3c2bff86e..3e194c3ca297 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
@@ -32,12 +32,6 @@
 #include "stmmac.h"
 #include "stmmac_platform.h"
 
-static const struct of_device_id stmmac_dt_ids[] = {
-	/* SoC specific glue layers should come before generic bindings */
-	{ /* sentinel */ }
-};
-MODULE_DEVICE_TABLE(of, stmmac_dt_ids);
-
 #ifdef CONFIG_OF
 
 /**
@@ -431,19 +425,3 @@ static int stmmac_pltfr_resume(struct device *dev)
 SIMPLE_DEV_PM_OPS(stmmac_pltfr_pm_ops, stmmac_pltfr_suspend,
 				       stmmac_pltfr_resume);
 EXPORT_SYMBOL_GPL(stmmac_pltfr_pm_ops);
-
-static struct platform_driver stmmac_pltfr_driver = {
-	.probe = stmmac_pltfr_probe,
-	.remove = stmmac_pltfr_remove,
-	.driver = {
-		   .name = STMMAC_RESOURCE_NAME,
-		   .pm = &stmmac_pltfr_pm_ops,
-		   .of_match_table = of_match_ptr(stmmac_dt_ids),
-	},
-};
-
-module_platform_driver(stmmac_pltfr_driver);
-
-MODULE_DESCRIPTION("STMMAC 10/100/1000 Ethernet PLATFORM driver");
-MODULE_AUTHOR("Giuseppe Cavallaro <peppe.cavallaro@st.com>");
-MODULE_LICENSE("GPL");
-- 
1.8.0

^ permalink raw reply related	[flat|nested] 37+ messages in thread

* Re: [PATCH net-next 00/11] convert stmmac glue layers into platform drivers
  2015-05-14 10:10 ` Joachim Eastwood
@ 2015-05-14 15:24   ` Chen-Yu Tsai
  -1 siblings, 0 replies; 37+ messages in thread
From: Chen-Yu Tsai @ 2015-05-14 15:24 UTC (permalink / raw)
  To: Joachim Eastwood
  Cc: Arnd Bergmann, Giuseppe Cavallaro, Roger, Chen-Yu Tsai,
	Srinivas KANDAGATLA, dinguyen, b.galvani, netdev, David Miller,
	linux-arm-kernel, linux-rockchip

On Thu, May 14, 2015 at 6:10 PM, Joachim Eastwood <manabian@gmail.com> wrote:
> This patch set aims to convert the current dwmac glue layers into
> proper platform drivers as request by Arnd[1]. These changes start
> from patch 3 and onwards.
>
> Overview:
> Platform driver functions like probe and remove are exported from
> the stmmac platform and then used in subsequent glue later
> conversions. The conversion involes adding the platform driver
> boiler plate code and adding it to the build system. The last patch
> removes the driver from the stmmac platform code thus making it into
> a library for common platform driver functions.
>
> The two first patches adds glue layer for my platform. I chose to
> first add old style glue layer and then convert it. The churn this
> creates is just 3 lines.
>
> I would be very nice if people could test this patch set on their
> respective platform. My testing has been limited to compiling and
> testing on my (LPC18xx) platform. Thanks!

Tested-by: Chen-Yu Tsai <wens@csie.org>

on sunxi boards Cubietruck and Hummingbird A31.

> Next I will look into cleaning up the stmmac platform code.
>
> [1] http://marc.info/?l=linux-arm-kernel&m=143059524606459&w=2
>
> Joachim Eastwood (11):
>   stmmac: add dwmac glue for NXP 18xx/43xx family
>   doc: dt: add documentation for nxp,lpc1850-dwmac
>   stmmac: prepare stmmac platform to support stand alone drivers
>   stmmac: add a generic dwmac driver
>   stmmac: convert dwmac-lpc18xx to a platform driver
>   stmmac: convert dwmac-meson to platform driver
>   stmmac: convert dwmac-rk to platform driver
>   stmmac: convert dwmac-socfpga to platform driver
>   stmmac: convert dwmac-sti to platform driver
>   stmmac: convert dwmac-sunxi to platform driver
>   stmmac: drop driver from stmmac platform code
>
>  .../devicetree/bindings/net/nxp,lpc1850-dwmac.txt  | 20 +++++
>  drivers/net/ethernet/stmicro/stmmac/Kconfig        | 76 +++++++++++++++++
>  drivers/net/ethernet/stmicro/stmmac/Makefile       | 13 ++-
>  .../net/ethernet/stmicro/stmmac/dwmac-generic.c    | 41 +++++++++
>  .../net/ethernet/stmicro/stmmac/dwmac-lpc18xx.c    | 99 ++++++++++++++++++++++
>  drivers/net/ethernet/stmicro/stmmac/dwmac-meson.c  | 24 +++++-
>  drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c     | 27 +++++-
>  .../net/ethernet/stmicro/stmmac/dwmac-socfpga.c    | 21 ++++-
>  drivers/net/ethernet/stmicro/stmmac/dwmac-sti.c    | 29 ++++++-
>  drivers/net/ethernet/stmicro/stmmac/dwmac-sunxi.c  | 25 +++++-
>  .../net/ethernet/stmicro/stmmac/stmmac_platform.c  | 49 ++---------
>  .../net/ethernet/stmicro/stmmac/stmmac_platform.h  |  9 +-
>  12 files changed, 378 insertions(+), 55 deletions(-)
>  create mode 100644 Documentation/devicetree/bindings/net/nxp,lpc1850-dwmac.txt
>  create mode 100644 drivers/net/ethernet/stmicro/stmmac/dwmac-generic.c
>  create mode 100644 drivers/net/ethernet/stmicro/stmmac/dwmac-lpc18xx.c
>
> --
> 1.8.0
>

^ permalink raw reply	[flat|nested] 37+ messages in thread

* [PATCH net-next 00/11] convert stmmac glue layers into platform drivers
@ 2015-05-14 15:24   ` Chen-Yu Tsai
  0 siblings, 0 replies; 37+ messages in thread
From: Chen-Yu Tsai @ 2015-05-14 15:24 UTC (permalink / raw)
  To: linux-arm-kernel

On Thu, May 14, 2015 at 6:10 PM, Joachim Eastwood <manabian@gmail.com> wrote:
> This patch set aims to convert the current dwmac glue layers into
> proper platform drivers as request by Arnd[1]. These changes start
> from patch 3 and onwards.
>
> Overview:
> Platform driver functions like probe and remove are exported from
> the stmmac platform and then used in subsequent glue later
> conversions. The conversion involes adding the platform driver
> boiler plate code and adding it to the build system. The last patch
> removes the driver from the stmmac platform code thus making it into
> a library for common platform driver functions.
>
> The two first patches adds glue layer for my platform. I chose to
> first add old style glue layer and then convert it. The churn this
> creates is just 3 lines.
>
> I would be very nice if people could test this patch set on their
> respective platform. My testing has been limited to compiling and
> testing on my (LPC18xx) platform. Thanks!

Tested-by: Chen-Yu Tsai <wens@csie.org>

on sunxi boards Cubietruck and Hummingbird A31.

> Next I will look into cleaning up the stmmac platform code.
>
> [1] http://marc.info/?l=linux-arm-kernel&m=143059524606459&w=2
>
> Joachim Eastwood (11):
>   stmmac: add dwmac glue for NXP 18xx/43xx family
>   doc: dt: add documentation for nxp,lpc1850-dwmac
>   stmmac: prepare stmmac platform to support stand alone drivers
>   stmmac: add a generic dwmac driver
>   stmmac: convert dwmac-lpc18xx to a platform driver
>   stmmac: convert dwmac-meson to platform driver
>   stmmac: convert dwmac-rk to platform driver
>   stmmac: convert dwmac-socfpga to platform driver
>   stmmac: convert dwmac-sti to platform driver
>   stmmac: convert dwmac-sunxi to platform driver
>   stmmac: drop driver from stmmac platform code
>
>  .../devicetree/bindings/net/nxp,lpc1850-dwmac.txt  | 20 +++++
>  drivers/net/ethernet/stmicro/stmmac/Kconfig        | 76 +++++++++++++++++
>  drivers/net/ethernet/stmicro/stmmac/Makefile       | 13 ++-
>  .../net/ethernet/stmicro/stmmac/dwmac-generic.c    | 41 +++++++++
>  .../net/ethernet/stmicro/stmmac/dwmac-lpc18xx.c    | 99 ++++++++++++++++++++++
>  drivers/net/ethernet/stmicro/stmmac/dwmac-meson.c  | 24 +++++-
>  drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c     | 27 +++++-
>  .../net/ethernet/stmicro/stmmac/dwmac-socfpga.c    | 21 ++++-
>  drivers/net/ethernet/stmicro/stmmac/dwmac-sti.c    | 29 ++++++-
>  drivers/net/ethernet/stmicro/stmmac/dwmac-sunxi.c  | 25 +++++-
>  .../net/ethernet/stmicro/stmmac/stmmac_platform.c  | 49 ++---------
>  .../net/ethernet/stmicro/stmmac/stmmac_platform.h  |  9 +-
>  12 files changed, 378 insertions(+), 55 deletions(-)
>  create mode 100644 Documentation/devicetree/bindings/net/nxp,lpc1850-dwmac.txt
>  create mode 100644 drivers/net/ethernet/stmicro/stmmac/dwmac-generic.c
>  create mode 100644 drivers/net/ethernet/stmicro/stmmac/dwmac-lpc18xx.c
>
> --
> 1.8.0
>

^ permalink raw reply	[flat|nested] 37+ messages in thread

* Re: [PATCH net-next 00/11] convert stmmac glue layers into platform drivers
  2015-05-14 10:10 ` Joachim Eastwood
  (?)
@ 2015-05-14 19:53   ` Dinh Nguyen
  -1 siblings, 0 replies; 37+ messages in thread
From: Dinh Nguyen @ 2015-05-14 19:53 UTC (permalink / raw)
  To: Joachim Eastwood, arnd, peppe.cavallaro, roger.chen, wens,
	srinivas.kandagatla, b.galvani
  Cc: netdev, davem, linux-arm-kernel, linux-rockchip

On 05/14/2015 05:10 AM, Joachim Eastwood wrote:
> This patch set aims to convert the current dwmac glue layers into
> proper platform drivers as request by Arnd[1]. These changes start
> from patch 3 and onwards.
> 
> Overview:
> Platform driver functions like probe and remove are exported from
> the stmmac platform and then used in subsequent glue later
> conversions. The conversion involes adding the platform driver
> boiler plate code and adding it to the build system. The last patch
> removes the driver from the stmmac platform code thus making it into
> a library for common platform driver functions.
> 
> The two first patches adds glue layer for my platform. I chose to
> first add old style glue layer and then convert it. The churn this
> creates is just 3 lines.
> 
> I would be very nice if people could test this patch set on their
> respective platform. My testing has been limited to compiling and
> testing on my (LPC18xx) platform. Thanks!
> 
> Next I will look into cleaning up the stmmac platform code.
> 
> [1] http://marc.info/?l=linux-arm-kernel&m=143059524606459&w=2
> 
> Joachim Eastwood (11):
>   stmmac: add dwmac glue for NXP 18xx/43xx family
>   doc: dt: add documentation for nxp,lpc1850-dwmac
>   stmmac: prepare stmmac platform to support stand alone drivers
>   stmmac: add a generic dwmac driver
>   stmmac: convert dwmac-lpc18xx to a platform driver
>   stmmac: convert dwmac-meson to platform driver
>   stmmac: convert dwmac-rk to platform driver
>   stmmac: convert dwmac-socfpga to platform driver
>   stmmac: convert dwmac-sti to platform driver
>   stmmac: convert dwmac-sunxi to platform driver
>   stmmac: drop driver from stmmac platform code
> 
>  .../devicetree/bindings/net/nxp,lpc1850-dwmac.txt  | 20 +++++
>  drivers/net/ethernet/stmicro/stmmac/Kconfig        | 76 +++++++++++++++++
>  drivers/net/ethernet/stmicro/stmmac/Makefile       | 13 ++-
>  .../net/ethernet/stmicro/stmmac/dwmac-generic.c    | 41 +++++++++
>  .../net/ethernet/stmicro/stmmac/dwmac-lpc18xx.c    | 99 ++++++++++++++++++++++
>  drivers/net/ethernet/stmicro/stmmac/dwmac-meson.c  | 24 +++++-
>  drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c     | 27 +++++-
>  .../net/ethernet/stmicro/stmmac/dwmac-socfpga.c    | 21 ++++-
>  drivers/net/ethernet/stmicro/stmmac/dwmac-sti.c    | 29 ++++++-
>  drivers/net/ethernet/stmicro/stmmac/dwmac-sunxi.c  | 25 +++++-
>  .../net/ethernet/stmicro/stmmac/stmmac_platform.c  | 49 ++---------
>  .../net/ethernet/stmicro/stmmac/stmmac_platform.h  |  9 +-
>  12 files changed, 378 insertions(+), 55 deletions(-)
>  create mode 100644 Documentation/devicetree/bindings/net/nxp,lpc1850-dwmac.txt
>  create mode 100644 drivers/net/ethernet/stmicro/stmmac/dwmac-generic.c
>  create mode 100644 drivers/net/ethernet/stmicro/stmmac/dwmac-lpc18xx.c
> 


Tested-by: Dinh Nguyen <dinguyen@opensource.altera.com>

on SoCFPGA devkit.

Thanks,
Dinh

^ permalink raw reply	[flat|nested] 37+ messages in thread

* Re: [PATCH net-next 00/11] convert stmmac glue layers into platform drivers
@ 2015-05-14 19:53   ` Dinh Nguyen
  0 siblings, 0 replies; 37+ messages in thread
From: Dinh Nguyen @ 2015-05-14 19:53 UTC (permalink / raw)
  To: Joachim Eastwood, arnd, peppe.cavallaro, roger.chen, wens,
	srinivas.kandagatla, b.galvani
  Cc: netdev, davem, linux-arm-kernel, linux-rockchip

On 05/14/2015 05:10 AM, Joachim Eastwood wrote:
> This patch set aims to convert the current dwmac glue layers into
> proper platform drivers as request by Arnd[1]. These changes start
> from patch 3 and onwards.
> 
> Overview:
> Platform driver functions like probe and remove are exported from
> the stmmac platform and then used in subsequent glue later
> conversions. The conversion involes adding the platform driver
> boiler plate code and adding it to the build system. The last patch
> removes the driver from the stmmac platform code thus making it into
> a library for common platform driver functions.
> 
> The two first patches adds glue layer for my platform. I chose to
> first add old style glue layer and then convert it. The churn this
> creates is just 3 lines.
> 
> I would be very nice if people could test this patch set on their
> respective platform. My testing has been limited to compiling and
> testing on my (LPC18xx) platform. Thanks!
> 
> Next I will look into cleaning up the stmmac platform code.
> 
> [1] http://marc.info/?l=linux-arm-kernel&m=143059524606459&w=2
> 
> Joachim Eastwood (11):
>   stmmac: add dwmac glue for NXP 18xx/43xx family
>   doc: dt: add documentation for nxp,lpc1850-dwmac
>   stmmac: prepare stmmac platform to support stand alone drivers
>   stmmac: add a generic dwmac driver
>   stmmac: convert dwmac-lpc18xx to a platform driver
>   stmmac: convert dwmac-meson to platform driver
>   stmmac: convert dwmac-rk to platform driver
>   stmmac: convert dwmac-socfpga to platform driver
>   stmmac: convert dwmac-sti to platform driver
>   stmmac: convert dwmac-sunxi to platform driver
>   stmmac: drop driver from stmmac platform code
> 
>  .../devicetree/bindings/net/nxp,lpc1850-dwmac.txt  | 20 +++++
>  drivers/net/ethernet/stmicro/stmmac/Kconfig        | 76 +++++++++++++++++
>  drivers/net/ethernet/stmicro/stmmac/Makefile       | 13 ++-
>  .../net/ethernet/stmicro/stmmac/dwmac-generic.c    | 41 +++++++++
>  .../net/ethernet/stmicro/stmmac/dwmac-lpc18xx.c    | 99 ++++++++++++++++++++++
>  drivers/net/ethernet/stmicro/stmmac/dwmac-meson.c  | 24 +++++-
>  drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c     | 27 +++++-
>  .../net/ethernet/stmicro/stmmac/dwmac-socfpga.c    | 21 ++++-
>  drivers/net/ethernet/stmicro/stmmac/dwmac-sti.c    | 29 ++++++-
>  drivers/net/ethernet/stmicro/stmmac/dwmac-sunxi.c  | 25 +++++-
>  .../net/ethernet/stmicro/stmmac/stmmac_platform.c  | 49 ++---------
>  .../net/ethernet/stmicro/stmmac/stmmac_platform.h  |  9 +-
>  12 files changed, 378 insertions(+), 55 deletions(-)
>  create mode 100644 Documentation/devicetree/bindings/net/nxp,lpc1850-dwmac.txt
>  create mode 100644 drivers/net/ethernet/stmicro/stmmac/dwmac-generic.c
>  create mode 100644 drivers/net/ethernet/stmicro/stmmac/dwmac-lpc18xx.c
> 


Tested-by: Dinh Nguyen <dinguyen@opensource.altera.com>

on SoCFPGA devkit.

Thanks,
Dinh

^ permalink raw reply	[flat|nested] 37+ messages in thread

* [PATCH net-next 00/11] convert stmmac glue layers into platform drivers
@ 2015-05-14 19:53   ` Dinh Nguyen
  0 siblings, 0 replies; 37+ messages in thread
From: Dinh Nguyen @ 2015-05-14 19:53 UTC (permalink / raw)
  To: linux-arm-kernel

On 05/14/2015 05:10 AM, Joachim Eastwood wrote:
> This patch set aims to convert the current dwmac glue layers into
> proper platform drivers as request by Arnd[1]. These changes start
> from patch 3 and onwards.
> 
> Overview:
> Platform driver functions like probe and remove are exported from
> the stmmac platform and then used in subsequent glue later
> conversions. The conversion involes adding the platform driver
> boiler plate code and adding it to the build system. The last patch
> removes the driver from the stmmac platform code thus making it into
> a library for common platform driver functions.
> 
> The two first patches adds glue layer for my platform. I chose to
> first add old style glue layer and then convert it. The churn this
> creates is just 3 lines.
> 
> I would be very nice if people could test this patch set on their
> respective platform. My testing has been limited to compiling and
> testing on my (LPC18xx) platform. Thanks!
> 
> Next I will look into cleaning up the stmmac platform code.
> 
> [1] http://marc.info/?l=linux-arm-kernel&m=143059524606459&w=2
> 
> Joachim Eastwood (11):
>   stmmac: add dwmac glue for NXP 18xx/43xx family
>   doc: dt: add documentation for nxp,lpc1850-dwmac
>   stmmac: prepare stmmac platform to support stand alone drivers
>   stmmac: add a generic dwmac driver
>   stmmac: convert dwmac-lpc18xx to a platform driver
>   stmmac: convert dwmac-meson to platform driver
>   stmmac: convert dwmac-rk to platform driver
>   stmmac: convert dwmac-socfpga to platform driver
>   stmmac: convert dwmac-sti to platform driver
>   stmmac: convert dwmac-sunxi to platform driver
>   stmmac: drop driver from stmmac platform code
> 
>  .../devicetree/bindings/net/nxp,lpc1850-dwmac.txt  | 20 +++++
>  drivers/net/ethernet/stmicro/stmmac/Kconfig        | 76 +++++++++++++++++
>  drivers/net/ethernet/stmicro/stmmac/Makefile       | 13 ++-
>  .../net/ethernet/stmicro/stmmac/dwmac-generic.c    | 41 +++++++++
>  .../net/ethernet/stmicro/stmmac/dwmac-lpc18xx.c    | 99 ++++++++++++++++++++++
>  drivers/net/ethernet/stmicro/stmmac/dwmac-meson.c  | 24 +++++-
>  drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c     | 27 +++++-
>  .../net/ethernet/stmicro/stmmac/dwmac-socfpga.c    | 21 ++++-
>  drivers/net/ethernet/stmicro/stmmac/dwmac-sti.c    | 29 ++++++-
>  drivers/net/ethernet/stmicro/stmmac/dwmac-sunxi.c  | 25 +++++-
>  .../net/ethernet/stmicro/stmmac/stmmac_platform.c  | 49 ++---------
>  .../net/ethernet/stmicro/stmmac/stmmac_platform.h  |  9 +-
>  12 files changed, 378 insertions(+), 55 deletions(-)
>  create mode 100644 Documentation/devicetree/bindings/net/nxp,lpc1850-dwmac.txt
>  create mode 100644 drivers/net/ethernet/stmicro/stmmac/dwmac-generic.c
>  create mode 100644 drivers/net/ethernet/stmicro/stmmac/dwmac-lpc18xx.c
> 


Tested-by: Dinh Nguyen <dinguyen@opensource.altera.com>

on SoCFPGA devkit.

Thanks,
Dinh

^ permalink raw reply	[flat|nested] 37+ messages in thread

* Re: [PATCH net-next 00/11] convert stmmac glue layers into platform drivers
  2015-05-14 15:24   ` Chen-Yu Tsai
@ 2015-05-15  7:45       ` Giuseppe CAVALLARO
  -1 siblings, 0 replies; 37+ messages in thread
From: Giuseppe CAVALLARO @ 2015-05-15  7:45 UTC (permalink / raw)
  To: Chen-Yu Tsai, Joachim Eastwood, Arnd Bergmann
  Cc: netdev, b.galvani-Re5JQEeQqe8AvxtiuMwx3w,
	linux-rockchip-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, Roger,
	dinguyen-yzvPICuk2ABMcg4IHK0kFoH6Mc4MB0Vx, David Miller,
	linux-arm-kernel

Hello

On 5/14/2015 5:24 PM, Chen-Yu Tsai wrote:
> On Thu, May 14, 2015 at 6:10 PM, Joachim Eastwood <manabian-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
>> This patch set aims to convert the current dwmac glue layers into
>> proper platform drivers as request by Arnd[1]. These changes start
>> from patch 3 and onwards.
>>
>> Overview:
>> Platform driver functions like probe and remove are exported from
>> the stmmac platform and then used in subsequent glue later
>> conversions. The conversion involes adding the platform driver
>> boiler plate code and adding it to the build system. The last patch
>> removes the driver from the stmmac platform code thus making it into
>> a library for common platform driver functions.
>>
>> The two first patches adds glue layer for my platform. I chose to
>> first add old style glue layer and then convert it. The churn this
>> creates is just 3 lines.
>>
>> I would be very nice if people could test this patch set on their
>> respective platform. My testing has been limited to compiling and
>> testing on my (LPC18xx) platform. Thanks!

I wonder if this will make the compatibility with old
platforms (like SH4) not based on DT, where there was not used
any glue-logic around the driver and just the platform was the
reference.

To be honest, I prefer to not have the Kconfig options.
The device-tree compatibility will select the glue-logic
needed and we will just pay some bytes when compile.

In my opinion, the Koption(s) introduce a problem when touch
the driver and we want to guarantee that, at least,
all its parts build fine on all the platforms.

Regards,
Peppe

>
> Tested-by: Chen-Yu Tsai <wens-jdAy2FN1RRM@public.gmane.org>
>
> on sunxi boards Cubietruck and Hummingbird A31.
>
>> Next I will look into cleaning up the stmmac platform code.
>>
>> [1] http://marc.info/?l=linux-arm-kernel&m=143059524606459&w=2
>>
>> Joachim Eastwood (11):
>>    stmmac: add dwmac glue for NXP 18xx/43xx family
>>    doc: dt: add documentation for nxp,lpc1850-dwmac
>>    stmmac: prepare stmmac platform to support stand alone drivers
>>    stmmac: add a generic dwmac driver
>>    stmmac: convert dwmac-lpc18xx to a platform driver
>>    stmmac: convert dwmac-meson to platform driver
>>    stmmac: convert dwmac-rk to platform driver
>>    stmmac: convert dwmac-socfpga to platform driver
>>    stmmac: convert dwmac-sti to platform driver
>>    stmmac: convert dwmac-sunxi to platform driver
>>    stmmac: drop driver from stmmac platform code
>>
>>   .../devicetree/bindings/net/nxp,lpc1850-dwmac.txt  | 20 +++++
>>   drivers/net/ethernet/stmicro/stmmac/Kconfig        | 76 +++++++++++++++++
>>   drivers/net/ethernet/stmicro/stmmac/Makefile       | 13 ++-
>>   .../net/ethernet/stmicro/stmmac/dwmac-generic.c    | 41 +++++++++
>>   .../net/ethernet/stmicro/stmmac/dwmac-lpc18xx.c    | 99 ++++++++++++++++++++++
>>   drivers/net/ethernet/stmicro/stmmac/dwmac-meson.c  | 24 +++++-
>>   drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c     | 27 +++++-
>>   .../net/ethernet/stmicro/stmmac/dwmac-socfpga.c    | 21 ++++-
>>   drivers/net/ethernet/stmicro/stmmac/dwmac-sti.c    | 29 ++++++-
>>   drivers/net/ethernet/stmicro/stmmac/dwmac-sunxi.c  | 25 +++++-
>>   .../net/ethernet/stmicro/stmmac/stmmac_platform.c  | 49 ++---------
>>   .../net/ethernet/stmicro/stmmac/stmmac_platform.h  |  9 +-
>>   12 files changed, 378 insertions(+), 55 deletions(-)
>>   create mode 100644 Documentation/devicetree/bindings/net/nxp,lpc1850-dwmac.txt
>>   create mode 100644 drivers/net/ethernet/stmicro/stmmac/dwmac-generic.c
>>   create mode 100644 drivers/net/ethernet/stmicro/stmmac/dwmac-lpc18xx.c
>>
>> --
>> 1.8.0
>>
>

^ permalink raw reply	[flat|nested] 37+ messages in thread

* [PATCH net-next 00/11] convert stmmac glue layers into platform drivers
@ 2015-05-15  7:45       ` Giuseppe CAVALLARO
  0 siblings, 0 replies; 37+ messages in thread
From: Giuseppe CAVALLARO @ 2015-05-15  7:45 UTC (permalink / raw)
  To: linux-arm-kernel

Hello

On 5/14/2015 5:24 PM, Chen-Yu Tsai wrote:
> On Thu, May 14, 2015 at 6:10 PM, Joachim Eastwood <manabian@gmail.com> wrote:
>> This patch set aims to convert the current dwmac glue layers into
>> proper platform drivers as request by Arnd[1]. These changes start
>> from patch 3 and onwards.
>>
>> Overview:
>> Platform driver functions like probe and remove are exported from
>> the stmmac platform and then used in subsequent glue later
>> conversions. The conversion involes adding the platform driver
>> boiler plate code and adding it to the build system. The last patch
>> removes the driver from the stmmac platform code thus making it into
>> a library for common platform driver functions.
>>
>> The two first patches adds glue layer for my platform. I chose to
>> first add old style glue layer and then convert it. The churn this
>> creates is just 3 lines.
>>
>> I would be very nice if people could test this patch set on their
>> respective platform. My testing has been limited to compiling and
>> testing on my (LPC18xx) platform. Thanks!

I wonder if this will make the compatibility with old
platforms (like SH4) not based on DT, where there was not used
any glue-logic around the driver and just the platform was the
reference.

To be honest, I prefer to not have the Kconfig options.
The device-tree compatibility will select the glue-logic
needed and we will just pay some bytes when compile.

In my opinion, the Koption(s) introduce a problem when touch
the driver and we want to guarantee that, at least,
all its parts build fine on all the platforms.

Regards,
Peppe

>
> Tested-by: Chen-Yu Tsai <wens@csie.org>
>
> on sunxi boards Cubietruck and Hummingbird A31.
>
>> Next I will look into cleaning up the stmmac platform code.
>>
>> [1] http://marc.info/?l=linux-arm-kernel&m=143059524606459&w=2
>>
>> Joachim Eastwood (11):
>>    stmmac: add dwmac glue for NXP 18xx/43xx family
>>    doc: dt: add documentation for nxp,lpc1850-dwmac
>>    stmmac: prepare stmmac platform to support stand alone drivers
>>    stmmac: add a generic dwmac driver
>>    stmmac: convert dwmac-lpc18xx to a platform driver
>>    stmmac: convert dwmac-meson to platform driver
>>    stmmac: convert dwmac-rk to platform driver
>>    stmmac: convert dwmac-socfpga to platform driver
>>    stmmac: convert dwmac-sti to platform driver
>>    stmmac: convert dwmac-sunxi to platform driver
>>    stmmac: drop driver from stmmac platform code
>>
>>   .../devicetree/bindings/net/nxp,lpc1850-dwmac.txt  | 20 +++++
>>   drivers/net/ethernet/stmicro/stmmac/Kconfig        | 76 +++++++++++++++++
>>   drivers/net/ethernet/stmicro/stmmac/Makefile       | 13 ++-
>>   .../net/ethernet/stmicro/stmmac/dwmac-generic.c    | 41 +++++++++
>>   .../net/ethernet/stmicro/stmmac/dwmac-lpc18xx.c    | 99 ++++++++++++++++++++++
>>   drivers/net/ethernet/stmicro/stmmac/dwmac-meson.c  | 24 +++++-
>>   drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c     | 27 +++++-
>>   .../net/ethernet/stmicro/stmmac/dwmac-socfpga.c    | 21 ++++-
>>   drivers/net/ethernet/stmicro/stmmac/dwmac-sti.c    | 29 ++++++-
>>   drivers/net/ethernet/stmicro/stmmac/dwmac-sunxi.c  | 25 +++++-
>>   .../net/ethernet/stmicro/stmmac/stmmac_platform.c  | 49 ++---------
>>   .../net/ethernet/stmicro/stmmac/stmmac_platform.h  |  9 +-
>>   12 files changed, 378 insertions(+), 55 deletions(-)
>>   create mode 100644 Documentation/devicetree/bindings/net/nxp,lpc1850-dwmac.txt
>>   create mode 100644 drivers/net/ethernet/stmicro/stmmac/dwmac-generic.c
>>   create mode 100644 drivers/net/ethernet/stmicro/stmmac/dwmac-lpc18xx.c
>>
>> --
>> 1.8.0
>>
>

^ permalink raw reply	[flat|nested] 37+ messages in thread

* Re: [PATCH net-next 00/11] convert stmmac glue layers into platform drivers
  2015-05-15  7:45       ` Giuseppe CAVALLARO
@ 2015-05-15  8:44           ` Arnd Bergmann
  -1 siblings, 0 replies; 37+ messages in thread
From: Arnd Bergmann @ 2015-05-15  8:44 UTC (permalink / raw)
  To: Giuseppe CAVALLARO
  Cc: netdev, Joachim Eastwood, b.galvani-Re5JQEeQqe8AvxtiuMwx3w,
	linux-rockchip-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, Chen-Yu Tsai,
	Roger, dinguyen-yzvPICuk2ABMcg4IHK0kFoH6Mc4MB0Vx, David Miller,
	linux-arm-kernel

On Friday 15 May 2015 09:45:47 Giuseppe CAVALLARO wrote:
> Hello
> 
> On 5/14/2015 5:24 PM, Chen-Yu Tsai wrote:
> > On Thu, May 14, 2015 at 6:10 PM, Joachim Eastwood <manabian-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
> >> This patch set aims to convert the current dwmac glue layers into
> >> proper platform drivers as request by Arnd[1]. These changes start
> >> from patch 3 and onwards.
> >>
> >> Overview:
> >> Platform driver functions like probe and remove are exported from
> >> the stmmac platform and then used in subsequent glue later
> >> conversions. The conversion involes adding the platform driver
> >> boiler plate code and adding it to the build system. The last patch
> >> removes the driver from the stmmac platform code thus making it into
> >> a library for common platform driver functions.
> >>
> >> The two first patches adds glue layer for my platform. I chose to
> >> first add old style glue layer and then convert it. The churn this
> >> creates is just 3 lines.
> >>
> >> I would be very nice if people could test this patch set on their
> >> respective platform. My testing has been limited to compiling and
> >> testing on my (LPC18xx) platform. Thanks!
> 
> I wonder if this will make the compatibility with old
> platforms (like SH4) not based on DT, where there was not used
> any glue-logic around the driver and just the platform was the
> reference.

With patch 11, this gets handled by the dwmac-generic driver.

> To be honest, I prefer to not have the Kconfig options.
> The device-tree compatibility will select the glue-logic
> needed and we will just pay some bytes when compile.
>
> In my opinion, the Koption(s) introduce a problem when touch
> the driver and we want to guarantee that, at least,
> all its parts build fine on all the platforms.

The current model is not scalable and requires modifying the base
driver for each variation, and the change brings the driver
in line with how we do things for other platform drivers.

We should always be able to build all soc-specific glue drivers
with 'allmodconfig' for build testing, and a lot of us run that
frequently to find regressions.

	Arnd

^ permalink raw reply	[flat|nested] 37+ messages in thread

* [PATCH net-next 00/11] convert stmmac glue layers into platform drivers
@ 2015-05-15  8:44           ` Arnd Bergmann
  0 siblings, 0 replies; 37+ messages in thread
From: Arnd Bergmann @ 2015-05-15  8:44 UTC (permalink / raw)
  To: linux-arm-kernel

On Friday 15 May 2015 09:45:47 Giuseppe CAVALLARO wrote:
> Hello
> 
> On 5/14/2015 5:24 PM, Chen-Yu Tsai wrote:
> > On Thu, May 14, 2015 at 6:10 PM, Joachim Eastwood <manabian@gmail.com> wrote:
> >> This patch set aims to convert the current dwmac glue layers into
> >> proper platform drivers as request by Arnd[1]. These changes start
> >> from patch 3 and onwards.
> >>
> >> Overview:
> >> Platform driver functions like probe and remove are exported from
> >> the stmmac platform and then used in subsequent glue later
> >> conversions. The conversion involes adding the platform driver
> >> boiler plate code and adding it to the build system. The last patch
> >> removes the driver from the stmmac platform code thus making it into
> >> a library for common platform driver functions.
> >>
> >> The two first patches adds glue layer for my platform. I chose to
> >> first add old style glue layer and then convert it. The churn this
> >> creates is just 3 lines.
> >>
> >> I would be very nice if people could test this patch set on their
> >> respective platform. My testing has been limited to compiling and
> >> testing on my (LPC18xx) platform. Thanks!
> 
> I wonder if this will make the compatibility with old
> platforms (like SH4) not based on DT, where there was not used
> any glue-logic around the driver and just the platform was the
> reference.

With patch 11, this gets handled by the dwmac-generic driver.

> To be honest, I prefer to not have the Kconfig options.
> The device-tree compatibility will select the glue-logic
> needed and we will just pay some bytes when compile.
>
> In my opinion, the Koption(s) introduce a problem when touch
> the driver and we want to guarantee that, at least,
> all its parts build fine on all the platforms.

The current model is not scalable and requires modifying the base
driver for each variation, and the change brings the driver
in line with how we do things for other platform drivers.

We should always be able to build all soc-specific glue drivers
with 'allmodconfig' for build testing, and a lot of us run that
frequently to find regressions.

	Arnd

^ permalink raw reply	[flat|nested] 37+ messages in thread

* Re: [PATCH net-next 00/11] convert stmmac glue layers into platform drivers
  2015-05-15  8:44           ` Arnd Bergmann
@ 2015-05-15  9:11             ` Giuseppe CAVALLARO
  -1 siblings, 0 replies; 37+ messages in thread
From: Giuseppe CAVALLARO @ 2015-05-15  9:11 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: netdev, Joachim Eastwood, b.galvani-Re5JQEeQqe8AvxtiuMwx3w,
	linux-rockchip-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, Chen-Yu Tsai,
	Roger, dinguyen-yzvPICuk2ABMcg4IHK0kFoH6Mc4MB0Vx, David Miller,
	linux-arm-kernel

Hi Arnd

On 5/15/2015 10:44 AM, Arnd Bergmann wrote:
> On Friday 15 May 2015 09:45:47 Giuseppe CAVALLARO wrote:
>> Hello
>>
>> On 5/14/2015 5:24 PM, Chen-Yu Tsai wrote:
>>> On Thu, May 14, 2015 at 6:10 PM, Joachim Eastwood <manabian-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
>>>> This patch set aims to convert the current dwmac glue layers into
>>>> proper platform drivers as request by Arnd[1]. These changes start
>>>> from patch 3 and onwards.
>>>>
>>>> Overview:
>>>> Platform driver functions like probe and remove are exported from
>>>> the stmmac platform and then used in subsequent glue later
>>>> conversions. The conversion involes adding the platform driver
>>>> boiler plate code and adding it to the build system. The last patch
>>>> removes the driver from the stmmac platform code thus making it into
>>>> a library for common platform driver functions.
>>>>
>>>> The two first patches adds glue layer for my platform. I chose to
>>>> first add old style glue layer and then convert it. The churn this
>>>> creates is just 3 lines.
>>>>
>>>> I would be very nice if people could test this patch set on their
>>>> respective platform. My testing has been limited to compiling and
>>>> testing on my (LPC18xx) platform. Thanks!
>>
>> I wonder if this will make the compatibility with old
>> platforms (like SH4) not based on DT, where there was not used
>> any glue-logic around the driver and just the platform was the
>> reference.
>
> With patch 11, this gets handled by the dwmac-generic driver.

ok

>
>> To be honest, I prefer to not have the Kconfig options.
>> The device-tree compatibility will select the glue-logic
>> needed and we will just pay some bytes when compile.
>>
>> In my opinion, the Koption(s) introduce a problem when touch
>> the driver and we want to guarantee that, at least,
>> all its parts build fine on all the platforms.
>
> The current model is not scalable and requires modifying the base
> driver for each variation, and the change brings the driver
> in line with how we do things for other platform drivers.
>
> We should always be able to build all soc-specific glue drivers
> with 'allmodconfig' for build testing, and a lot of us run that
> frequently to find regressions.

thx for your prompt feedback

Peppe

>
> 	Arnd
>
>

^ permalink raw reply	[flat|nested] 37+ messages in thread

* [PATCH net-next 00/11] convert stmmac glue layers into platform drivers
@ 2015-05-15  9:11             ` Giuseppe CAVALLARO
  0 siblings, 0 replies; 37+ messages in thread
From: Giuseppe CAVALLARO @ 2015-05-15  9:11 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Arnd

On 5/15/2015 10:44 AM, Arnd Bergmann wrote:
> On Friday 15 May 2015 09:45:47 Giuseppe CAVALLARO wrote:
>> Hello
>>
>> On 5/14/2015 5:24 PM, Chen-Yu Tsai wrote:
>>> On Thu, May 14, 2015 at 6:10 PM, Joachim Eastwood <manabian@gmail.com> wrote:
>>>> This patch set aims to convert the current dwmac glue layers into
>>>> proper platform drivers as request by Arnd[1]. These changes start
>>>> from patch 3 and onwards.
>>>>
>>>> Overview:
>>>> Platform driver functions like probe and remove are exported from
>>>> the stmmac platform and then used in subsequent glue later
>>>> conversions. The conversion involes adding the platform driver
>>>> boiler plate code and adding it to the build system. The last patch
>>>> removes the driver from the stmmac platform code thus making it into
>>>> a library for common platform driver functions.
>>>>
>>>> The two first patches adds glue layer for my platform. I chose to
>>>> first add old style glue layer and then convert it. The churn this
>>>> creates is just 3 lines.
>>>>
>>>> I would be very nice if people could test this patch set on their
>>>> respective platform. My testing has been limited to compiling and
>>>> testing on my (LPC18xx) platform. Thanks!
>>
>> I wonder if this will make the compatibility with old
>> platforms (like SH4) not based on DT, where there was not used
>> any glue-logic around the driver and just the platform was the
>> reference.
>
> With patch 11, this gets handled by the dwmac-generic driver.

ok

>
>> To be honest, I prefer to not have the Kconfig options.
>> The device-tree compatibility will select the glue-logic
>> needed and we will just pay some bytes when compile.
>>
>> In my opinion, the Koption(s) introduce a problem when touch
>> the driver and we want to guarantee that, at least,
>> all its parts build fine on all the platforms.
>
> The current model is not scalable and requires modifying the base
> driver for each variation, and the change brings the driver
> in line with how we do things for other platform drivers.
>
> We should always be able to build all soc-specific glue drivers
> with 'allmodconfig' for build testing, and a lot of us run that
> frequently to find regressions.

thx for your prompt feedback

Peppe

>
> 	Arnd
>
>

^ permalink raw reply	[flat|nested] 37+ messages in thread

* Re: [PATCH net-next 00/11] convert stmmac glue layers into platform drivers
  2015-05-14 10:10 ` Joachim Eastwood
@ 2015-05-15 16:44   ` David Miller
  -1 siblings, 0 replies; 37+ messages in thread
From: David Miller @ 2015-05-15 16:44 UTC (permalink / raw)
  To: manabian
  Cc: arnd, peppe.cavallaro, roger.chen, wens, srinivas.kandagatla,
	dinguyen, b.galvani, netdev, linux-arm-kernel, linux-rockchip

From: Joachim Eastwood <manabian@gmail.com>
Date: Thu, 14 May 2015 12:10:55 +0200

> This patch set aims to convert the current dwmac glue layers into
> proper platform drivers as request by Arnd[1]. These changes start
> from patch 3 and onwards.
> 
> Overview:
> Platform driver functions like probe and remove are exported from
> the stmmac platform and then used in subsequent glue later
> conversions. The conversion involes adding the platform driver
> boiler plate code and adding it to the build system. The last patch
> removes the driver from the stmmac platform code thus making it into
> a library for common platform driver functions.
> 
> The two first patches adds glue layer for my platform. I chose to
> first add old style glue layer and then convert it. The churn this
> creates is just 3 lines.
> 
> I would be very nice if people could test this patch set on their
> respective platform. My testing has been limited to compiling and
> testing on my (LPC18xx) platform. Thanks!
> 
> Next I will look into cleaning up the stmmac platform code.
> 
> [1] http://marc.info/?l=linux-arm-kernel&m=143059524606459&w=2

Series applied, thanks Joachim.

^ permalink raw reply	[flat|nested] 37+ messages in thread

* [PATCH net-next 00/11] convert stmmac glue layers into platform drivers
@ 2015-05-15 16:44   ` David Miller
  0 siblings, 0 replies; 37+ messages in thread
From: David Miller @ 2015-05-15 16:44 UTC (permalink / raw)
  To: linux-arm-kernel

From: Joachim Eastwood <manabian@gmail.com>
Date: Thu, 14 May 2015 12:10:55 +0200

> This patch set aims to convert the current dwmac glue layers into
> proper platform drivers as request by Arnd[1]. These changes start
> from patch 3 and onwards.
> 
> Overview:
> Platform driver functions like probe and remove are exported from
> the stmmac platform and then used in subsequent glue later
> conversions. The conversion involes adding the platform driver
> boiler plate code and adding it to the build system. The last patch
> removes the driver from the stmmac platform code thus making it into
> a library for common platform driver functions.
> 
> The two first patches adds glue layer for my platform. I chose to
> first add old style glue layer and then convert it. The churn this
> creates is just 3 lines.
> 
> I would be very nice if people could test this patch set on their
> respective platform. My testing has been limited to compiling and
> testing on my (LPC18xx) platform. Thanks!
> 
> Next I will look into cleaning up the stmmac platform code.
> 
> [1] http://marc.info/?l=linux-arm-kernel&m=143059524606459&w=2

Series applied, thanks Joachim.

^ permalink raw reply	[flat|nested] 37+ messages in thread

end of thread, other threads:[~2015-05-15 16:44 UTC | newest]

Thread overview: 37+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-05-14 10:10 [PATCH net-next 00/11] convert stmmac glue layers into platform drivers Joachim Eastwood
2015-05-14 10:10 ` Joachim Eastwood
2015-05-14 10:10 ` [PATCH net-next 01/11] stmmac: add dwmac glue for NXP 18xx/43xx family Joachim Eastwood
2015-05-14 10:10   ` Joachim Eastwood
2015-05-14 10:10 ` [PATCH net-next 02/11] doc: dt: add documentation for nxp,lpc1850-dwmac Joachim Eastwood
2015-05-14 10:10   ` [PATCH net-next 02/11] doc: dt: add documentation for nxp, lpc1850-dwmac Joachim Eastwood
2015-05-14 10:10 ` [PATCH net-next 03/11] stmmac: prepare stmmac platform to support stand alone drivers Joachim Eastwood
2015-05-14 10:10   ` Joachim Eastwood
2015-05-14 10:10 ` [PATCH net-next 04/11] stmmac: add a generic dwmac driver Joachim Eastwood
2015-05-14 10:10   ` Joachim Eastwood
2015-05-14 10:11 ` [PATCH net-next 05/11] stmmac: convert dwmac-lpc18xx to a platform driver Joachim Eastwood
2015-05-14 10:11   ` Joachim Eastwood
2015-05-14 10:11 ` [PATCH net-next 06/11] stmmac: convert dwmac-meson to " Joachim Eastwood
2015-05-14 10:11   ` Joachim Eastwood
2015-05-14 10:11 ` [PATCH net-next 07/11] stmmac: convert dwmac-rk " Joachim Eastwood
2015-05-14 10:11   ` Joachim Eastwood
2015-05-14 10:11 ` [PATCH net-next 08/11] stmmac: convert dwmac-socfpga " Joachim Eastwood
2015-05-14 10:11   ` Joachim Eastwood
2015-05-14 10:11 ` [PATCH net-next 09/11] stmmac: convert dwmac-sti " Joachim Eastwood
2015-05-14 10:11   ` Joachim Eastwood
2015-05-14 10:11 ` [PATCH net-next 10/11] stmmac: convert dwmac-sunxi " Joachim Eastwood
2015-05-14 10:11   ` Joachim Eastwood
2015-05-14 10:11 ` [PATCH net-next 11/11] stmmac: drop driver from stmmac platform code Joachim Eastwood
2015-05-14 10:11   ` Joachim Eastwood
2015-05-14 15:24 ` [PATCH net-next 00/11] convert stmmac glue layers into platform drivers Chen-Yu Tsai
2015-05-14 15:24   ` Chen-Yu Tsai
     [not found]   ` <CAGb2v663efjkwgRjPdxV4CQxeesiu7jxkMf9j_oPU_bSHbNNiA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-05-15  7:45     ` Giuseppe CAVALLARO
2015-05-15  7:45       ` Giuseppe CAVALLARO
     [not found]       ` <5555A42B.3040205-qxv4g6HH51o@public.gmane.org>
2015-05-15  8:44         ` Arnd Bergmann
2015-05-15  8:44           ` Arnd Bergmann
2015-05-15  9:11           ` Giuseppe CAVALLARO
2015-05-15  9:11             ` Giuseppe CAVALLARO
2015-05-14 19:53 ` Dinh Nguyen
2015-05-14 19:53   ` Dinh Nguyen
2015-05-14 19:53   ` Dinh Nguyen
2015-05-15 16:44 ` David Miller
2015-05-15 16:44   ` David Miller

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.