* [PATCH net-next 07/11] stmmac: convert dwmac-rk to platform driver
2015-05-14 10:10 [PATCH net-next 00/11] convert stmmac glue layers into platform drivers 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
` (2 subsequent siblings)
3 siblings, 0 replies; 8+ 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] 8+ messages in thread* Re: [PATCH net-next 00/11] convert stmmac glue layers into platform drivers
2015-05-14 10:10 [PATCH net-next 00/11] convert stmmac glue layers into platform drivers Joachim Eastwood
2015-05-14 10:11 ` [PATCH net-next 07/11] stmmac: convert dwmac-rk to platform driver Joachim Eastwood
@ 2015-05-14 15:24 ` Chen-Yu Tsai
[not found] ` <CAGb2v663efjkwgRjPdxV4CQxeesiu7jxkMf9j_oPU_bSHbNNiA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-05-14 19:53 ` Dinh Nguyen
2015-05-15 16:44 ` David Miller
3 siblings, 1 reply; 8+ 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] 8+ messages in thread* Re: [PATCH net-next 00/11] convert stmmac glue layers into platform drivers
2015-05-14 10:10 [PATCH net-next 00/11] convert stmmac glue layers into platform drivers Joachim Eastwood
2015-05-14 10:11 ` [PATCH net-next 07/11] stmmac: convert dwmac-rk to platform driver 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 19:53 ` Dinh Nguyen
2015-05-15 16:44 ` David Miller
3 siblings, 0 replies; 8+ 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] 8+ messages in thread
* Re: [PATCH net-next 00/11] convert stmmac glue layers into platform drivers
2015-05-14 10:10 [PATCH net-next 00/11] convert stmmac glue layers into platform drivers Joachim Eastwood
` (2 preceding siblings ...)
2015-05-14 19:53 ` Dinh Nguyen
@ 2015-05-15 16:44 ` David Miller
3 siblings, 0 replies; 8+ 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] 8+ messages in thread