From: Corentin Labbe <clabbe.montjoie@gmail.com>
To: robh+dt@kernel.org, mark.rutland@arm.com,
maxime.ripard@free-electrons.com, wens@csie.org,
linux@armlinux.org.uk, catalin.marinas@arm.com,
will.deacon@arm.com, peppe.cavallaro@st.com,
alexandre.torgue@st.com, davem@davemloft.net
Cc: f.fainelli@gmail.com, devicetree@vger.kernel.org,
linux-kernel@vger.kernel.org, netdev@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
Corentin Labbe <clabbe.montjoie@gmail.com>
Subject: [PATCH v2 02/20] net-next: stmmac: add optional setup function
Date: Tue, 14 Mar 2017 15:18:38 +0100 [thread overview]
Message-ID: <20170314141856.24560-3-clabbe.montjoie@gmail.com> (raw)
In-Reply-To: <20170314141856.24560-1-clabbe.montjoie@gmail.com>
Instead of ading more ifthen logic for adding a new mac_device_info
setup function, it is easier to add a function pointer to the function
needed.
Signed-off-by: Corentin Labbe <clabbe.montjoie@gmail.com>
---
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 4 +++-
include/linux/stmmac.h | 3 +++
2 files changed, 6 insertions(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index 4498a38..856ac57 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -3101,7 +3101,9 @@ static int stmmac_hw_init(struct stmmac_priv *priv)
struct mac_device_info *mac;
/* Identify the MAC HW device */
- if (priv->plat->has_gmac) {
+ if (priv->plat->setup) {
+ mac = priv->plat->setup(priv);
+ } else if (priv->plat->has_gmac) {
priv->dev->priv_flags |= IFF_UNICAST_FLT;
mac = dwmac1000_setup(priv->ioaddr,
priv->plat->multicast_filter_bins,
diff --git a/include/linux/stmmac.h b/include/linux/stmmac.h
index fc273e9..8f09f18 100644
--- a/include/linux/stmmac.h
+++ b/include/linux/stmmac.h
@@ -109,6 +109,8 @@ struct stmmac_axi {
bool axi_rb;
};
+struct stmmac_priv;
+
struct plat_stmmacenet_data {
int bus_id;
int phy_addr;
@@ -136,6 +138,7 @@ struct plat_stmmacenet_data {
void (*fix_mac_speed)(void *priv, unsigned int speed);
int (*init)(struct platform_device *pdev, void *priv);
void (*exit)(struct platform_device *pdev, void *priv);
+ struct mac_device_info *(*setup)(struct stmmac_priv *priv);
void *bsp_priv;
struct clk *stmmac_clk;
struct clk *pclk;
--
2.10.2
next prev parent reply other threads:[~2017-03-14 14:28 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-03-14 14:18 [PATCH v2 00/20] net-next: stmmac: add dwmac-sun8i ethernet driver Corentin Labbe
2017-03-14 14:18 ` [PATCH v2 01/20] net-next: stmmac: export stmmac_set_mac_addr/stmmac_get_mac_addr Corentin Labbe
2017-03-14 14:18 ` Corentin Labbe [this message]
2017-03-14 14:18 ` [PATCH v2 03/20] ARM: sun8i: dt: Add DT bindings documentation for Allwinner dwmac-sun8i Corentin Labbe
2017-03-20 22:21 ` Rob Herring
2017-03-14 14:18 ` [PATCH v2 04/20] ARM: sun8i: dt: Add DT bindings documentation for Allwinner syscon Corentin Labbe
2017-03-21 1:08 ` Rob Herring
2017-03-14 14:18 ` [PATCH v2 05/20] net-next: stmmac: Add dwmac-sun8i Corentin Labbe
2017-03-14 14:18 ` [PATCH v2 06/20] ARM: dts: sunxi-h3-h5: Add dt node for the syscon control module Corentin Labbe
2017-03-14 14:18 ` [PATCH v2 07/20] ARM: dts: sunxi-h3-h5: add dwmac-sun8i ethernet driver Corentin Labbe
2017-03-14 14:18 ` [PATCH v2 08/20] ARM: dts: sun8i: Enable dwmac-sun8i on the Banana Pi M2+ Corentin Labbe
2017-03-14 14:18 ` [PATCH v2 09/20] ARM: dts: sun8i: Enable dwmac-sun8i on the Orange PI PC Corentin Labbe
2017-03-14 14:18 ` [PATCH v2 10/20] ARM: dts: sun8i: Enable dwmac-sun8i on the Orange Pi 2 Corentin Labbe
2017-03-14 14:18 ` [PATCH v2 11/20] ARM: dts: sun8i: Enable dwmac-sun8i on the Orange PI One Corentin Labbe
2017-03-14 14:18 ` [PATCH v2 12/20] ARM: dts: sun8i: Enable dwmac-sun8i on the Orange Pi plus Corentin Labbe
2017-03-14 14:18 ` [PATCH v2 13/20] ARM: dts: sun8i: orangepi-pc-plus: Set EMAC activity LEDs to active high Corentin Labbe
2017-03-14 14:18 ` [PATCH v2 14/20] ARM64: dts: sun50i-a64: Add dt node for the syscon control module Corentin Labbe
2017-03-15 11:06 ` Sergei Shtylyov
2017-03-14 14:18 ` [PATCH v2 15/20] ARM64: dts: sun50i-a64: add dwmac-sun8i Ethernet driver Corentin Labbe
2017-03-14 14:18 ` [PATCH v2 16/20] ARM: dts: sun50i-a64: enable dwmac-sun8i on pine64 Corentin Labbe
2017-03-14 18:20 ` Florian Fainelli
2017-03-14 14:18 ` [PATCH v2 17/20] ARM: dts: sun50i-a64: enable dwmac-sun8i on pine64 plus Corentin Labbe
2017-03-14 14:18 ` [PATCH v2 18/20] ARM: dts: sun50i-a64: enable dwmac-sun8i on the BananaPi M64 Corentin Labbe
2017-03-14 14:18 ` [PATCH v2 19/20] ARM: sunxi: Enable dwmac-sun8i driver on sunxi_defconfig Corentin Labbe
2017-03-14 14:18 ` [PATCH v2 20/20] ARM: sunxi: Enable dwmac-sun8i driver on multi_v7_defconfig Corentin Labbe
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170314141856.24560-3-clabbe.montjoie@gmail.com \
--to=clabbe.montjoie@gmail.com \
--cc=alexandre.torgue@st.com \
--cc=catalin.marinas@arm.com \
--cc=davem@davemloft.net \
--cc=devicetree@vger.kernel.org \
--cc=f.fainelli@gmail.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@armlinux.org.uk \
--cc=mark.rutland@arm.com \
--cc=maxime.ripard@free-electrons.com \
--cc=netdev@vger.kernel.org \
--cc=peppe.cavallaro@st.com \
--cc=robh+dt@kernel.org \
--cc=wens@csie.org \
--cc=will.deacon@arm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®