Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ee7946a7 authored by Giuseppe CAVALLARO's avatar Giuseppe CAVALLARO Committed by David S. Miller
Browse files

stmmac: rewiew platform data



This patch rewiews and reorganises all the data
come from the platform removing any dependency
from the stm code.

Signed-off-by: default avatarGiuseppe Cavallaro <peppe.cavallaro@st.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 3c9732c0
Loading
Loading
Loading
Loading
+24 −0
Original line number Original line Diff line number Diff line
@@ -21,6 +21,7 @@
*******************************************************************************/
*******************************************************************************/


#define DRV_MODULE_VERSION	"Oct_09"
#define DRV_MODULE_VERSION	"Oct_09"
#include <linux/stmmac.h>


#if defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE)
#if defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE)
#define STMMAC_VLAN_TAG_USED
#define STMMAC_VLAN_TAG_USED
@@ -69,6 +70,7 @@ struct stmmac_priv {
	int phy_mask;
	int phy_mask;
	int (*phy_reset) (void *priv);
	int (*phy_reset) (void *priv);
	void (*fix_mac_speed) (void *priv, unsigned int speed);
	void (*fix_mac_speed) (void *priv, unsigned int speed);
	void (*bus_setup)(unsigned long ioaddr);
	void *bsp_priv;
	void *bsp_priv;


	int phy_irq;
	int phy_irq;
@@ -93,6 +95,28 @@ struct stmmac_priv {
#endif
#endif
};
};


#ifdef CONFIG_STM_DRIVERS
#include <linux/stm/pad.h>
static inline int stmmac_claim_resource(struct platform_device *pdev)
{
	int ret = 0;
	struct plat_stmmacenet_data *plat_dat = pdev->dev.platform_data;

	/* Pad routing setup */
	if (IS_ERR(devm_stm_pad_claim(&pdev->dev, plat_dat->pad_config,
			dev_name(&pdev->dev)))) {
		printk(KERN_ERR "%s: Failed to request pads!\n", __func__);
		ret = -ENODEV;
	}
	return ret;
}
#else
static inline int stmmac_claim_resource(struct platform_device *pdev)
{
	return 0;
}
#endif

extern int stmmac_mdio_unregister(struct net_device *ndev);
extern int stmmac_mdio_unregister(struct net_device *ndev);
extern int stmmac_mdio_register(struct net_device *ndev);
extern int stmmac_mdio_register(struct net_device *ndev);
extern void stmmac_set_ethtool_ops(struct net_device *netdev);
extern void stmmac_set_ethtool_ops(struct net_device *netdev);
+9 −7
Original line number Original line Diff line number Diff line
@@ -45,7 +45,6 @@
#include <linux/phy.h>
#include <linux/phy.h>
#include <linux/if_vlan.h>
#include <linux/if_vlan.h>
#include <linux/dma-mapping.h>
#include <linux/dma-mapping.h>
#include <linux/stm/soc.h>
#include "stmmac.h"
#include "stmmac.h"


#define STMMAC_RESOURCE_NAME	"stmmaceth"
#define STMMAC_RESOURCE_NAME	"stmmaceth"
@@ -1798,8 +1797,7 @@ static int stmmac_mac_device_setup(struct net_device *dev)


static int stmmacphy_dvr_probe(struct platform_device *pdev)
static int stmmacphy_dvr_probe(struct platform_device *pdev)
{
{
	struct plat_stmmacphy_data *plat_dat;
	struct plat_stmmacphy_data *plat_dat = pdev->dev.platform_data;
	plat_dat = (struct plat_stmmacphy_data *)((pdev->dev).platform_data);


	pr_debug("stmmacphy_dvr_probe: added phy for bus %d\n",
	pr_debug("stmmacphy_dvr_probe: added phy for bus %d\n",
	       plat_dat->bus_id);
	       plat_dat->bus_id);
@@ -1831,9 +1829,7 @@ static struct platform_driver stmmacphy_driver = {
static int stmmac_associate_phy(struct device *dev, void *data)
static int stmmac_associate_phy(struct device *dev, void *data)
{
{
	struct stmmac_priv *priv = (struct stmmac_priv *)data;
	struct stmmac_priv *priv = (struct stmmac_priv *)data;
	struct plat_stmmacphy_data *plat_dat;
	struct plat_stmmacphy_data *plat_dat = dev->platform_data;

	plat_dat = (struct plat_stmmacphy_data *)(dev->platform_data);


	DBG(probe, DEBUG, "%s: checking phy for bus %d\n", __func__,
	DBG(probe, DEBUG, "%s: checking phy for bus %d\n", __func__,
		plat_dat->bus_id);
		plat_dat->bus_id);
@@ -1923,7 +1919,7 @@ static int stmmac_dvr_probe(struct platform_device *pdev)
	priv = netdev_priv(ndev);
	priv = netdev_priv(ndev);
	priv->device = &(pdev->dev);
	priv->device = &(pdev->dev);
	priv->dev = ndev;
	priv->dev = ndev;
	plat_dat = (struct plat_stmmacenet_data *)((pdev->dev).platform_data);
	plat_dat = pdev->dev.platform_data;
	priv->bus_id = plat_dat->bus_id;
	priv->bus_id = plat_dat->bus_id;
	priv->pbl = plat_dat->pbl;	/* TLI */
	priv->pbl = plat_dat->pbl;	/* TLI */
	priv->is_gmac = plat_dat->has_gmac;	/* GMAC is on board */
	priv->is_gmac = plat_dat->has_gmac;	/* GMAC is on board */
@@ -1933,6 +1929,11 @@ static int stmmac_dvr_probe(struct platform_device *pdev)
	/* Set the I/O base addr */
	/* Set the I/O base addr */
	ndev->base_addr = (unsigned long)addr;
	ndev->base_addr = (unsigned long)addr;


	/* Verify embedded resource for the platform */
	ret = stmmac_claim_resource(pdev);
	if (ret < 0)
		goto out;

	/* MAC HW revice detection */
	/* MAC HW revice detection */
	ret = stmmac_mac_device_setup(ndev);
	ret = stmmac_mac_device_setup(ndev);
	if (ret < 0)
	if (ret < 0)
@@ -1953,6 +1954,7 @@ static int stmmac_dvr_probe(struct platform_device *pdev)
	}
	}


	priv->fix_mac_speed = plat_dat->fix_mac_speed;
	priv->fix_mac_speed = plat_dat->fix_mac_speed;
	priv->bus_setup = plat_dat->bus_setup;
	priv->bsp_priv = plat_dat->bsp_priv;
	priv->bsp_priv = plat_dat->bsp_priv;


	pr_info("\t%s - (dev. name: %s - id: %d, IRQ #%d\n"
	pr_info("\t%s - (dev. name: %s - id: %d, IRQ #%d\n"