net-next: stmmac: add optional setup function
authorLABBE Corentin <clabbe.montjoie@gmail.com>
Wed, 31 May 2017 07:18:33 +0000 (09:18 +0200)
committerDavid S. Miller <davem@davemloft.net>
Thu, 1 Jun 2017 18:53:03 +0000 (14:53 -0400)
Instead of adding 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>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
include/linux/stmmac.h

index f158273eab9b1a1e14b171a5dc3c09cca3635a29..c80c9c3b67db16b0d316545cf644981d3cf668ca 100644 (file)
@@ -3933,7 +3933,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,
index 3921cb9dfadb9b4a9bbe30854ccada75725b8005..8bb550bca96d2d69e6a70ca039c4eab7536a9ce1 100644 (file)
@@ -177,6 +177,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)(void *priv);
        void *bsp_priv;
        struct clk *stmmac_clk;
        struct clk *pclk;