aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/stmmac
diff options
context:
space:
mode:
authorGiuseppe CAVALLARO <peppe.cavallaro@st.com>2010-01-06 18:07:14 -0500
committerDavid S. Miller <davem@davemloft.net>2010-01-07 20:06:07 -0500
commitee7946a77858f417227cf57cd647729d0dd75761 (patch)
tree5aed8b954472cd29692e1b094636ee044b1c728f /drivers/net/stmmac
parent3c9732c06879d85f2fdf7ec69198c1d78da42a98 (diff)
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: Giuseppe Cavallaro <peppe.cavallaro@st.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/stmmac')
-rw-r--r--drivers/net/stmmac/stmmac.h24
-rw-r--r--drivers/net/stmmac/stmmac_main.c16
2 files changed, 33 insertions, 7 deletions
diff --git a/drivers/net/stmmac/stmmac.h b/drivers/net/stmmac/stmmac.h
index 6d2eae3040e5..0d5529fa579a 100644
--- a/drivers/net/stmmac/stmmac.h
+++ b/drivers/net/stmmac/stmmac.h
@@ -21,6 +21,7 @@
21*******************************************************************************/ 21*******************************************************************************/
22 22
23#define DRV_MODULE_VERSION "Oct_09" 23#define DRV_MODULE_VERSION "Oct_09"
24#include <linux/stmmac.h>
24 25
25#if defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE) 26#if defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE)
26#define STMMAC_VLAN_TAG_USED 27#define STMMAC_VLAN_TAG_USED
@@ -69,6 +70,7 @@ struct stmmac_priv {
69 int phy_mask; 70 int phy_mask;
70 int (*phy_reset) (void *priv); 71 int (*phy_reset) (void *priv);
71 void (*fix_mac_speed) (void *priv, unsigned int speed); 72 void (*fix_mac_speed) (void *priv, unsigned int speed);
73 void (*bus_setup)(unsigned long ioaddr);
72 void *bsp_priv; 74 void *bsp_priv;
73 75
74 int phy_irq; 76 int phy_irq;
@@ -93,6 +95,28 @@ struct stmmac_priv {
93#endif 95#endif
94}; 96};
95 97
98#ifdef CONFIG_STM_DRIVERS
99#include <linux/stm/pad.h>
100static inline int stmmac_claim_resource(struct platform_device *pdev)
101{
102 int ret = 0;
103 struct plat_stmmacenet_data *plat_dat = pdev->dev.platform_data;
104
105 /* Pad routing setup */
106 if (IS_ERR(devm_stm_pad_claim(&pdev->dev, plat_dat->pad_config,
107 dev_name(&pdev->dev)))) {
108 printk(KERN_ERR "%s: Failed to request pads!\n", __func__);
109 ret = -ENODEV;
110 }
111 return ret;
112}
113#else
114static inline int stmmac_claim_resource(struct platform_device *pdev)
115{
116 return 0;
117}
118#endif
119
96extern int stmmac_mdio_unregister(struct net_device *ndev); 120extern int stmmac_mdio_unregister(struct net_device *ndev);
97extern int stmmac_mdio_register(struct net_device *ndev); 121extern int stmmac_mdio_register(struct net_device *ndev);
98extern void stmmac_set_ethtool_ops(struct net_device *netdev); 122extern void stmmac_set_ethtool_ops(struct net_device *netdev);
diff --git a/drivers/net/stmmac/stmmac_main.c b/drivers/net/stmmac/stmmac_main.c
index 79a938117878..d50fe6f171ef 100644
--- a/drivers/net/stmmac/stmmac_main.c
+++ b/drivers/net/stmmac/stmmac_main.c
@@ -45,7 +45,6 @@
45#include <linux/phy.h> 45#include <linux/phy.h>
46#include <linux/if_vlan.h> 46#include <linux/if_vlan.h>
47#include <linux/dma-mapping.h> 47#include <linux/dma-mapping.h>
48#include <linux/stm/soc.h>
49#include "stmmac.h" 48#include "stmmac.h"
50 49
51#define STMMAC_RESOURCE_NAME "stmmaceth" 50#define STMMAC_RESOURCE_NAME "stmmaceth"
@@ -1798,8 +1797,7 @@ static int stmmac_mac_device_setup(struct net_device *dev)
1798 1797
1799static int stmmacphy_dvr_probe(struct platform_device *pdev) 1798static int stmmacphy_dvr_probe(struct platform_device *pdev)
1800{ 1799{
1801 struct plat_stmmacphy_data *plat_dat; 1800 struct plat_stmmacphy_data *plat_dat = pdev->dev.platform_data;
1802 plat_dat = (struct plat_stmmacphy_data *)((pdev->dev).platform_data);
1803 1801
1804 pr_debug("stmmacphy_dvr_probe: added phy for bus %d\n", 1802 pr_debug("stmmacphy_dvr_probe: added phy for bus %d\n",
1805 plat_dat->bus_id); 1803 plat_dat->bus_id);
@@ -1831,9 +1829,7 @@ static struct platform_driver stmmacphy_driver = {
1831static int stmmac_associate_phy(struct device *dev, void *data) 1829static int stmmac_associate_phy(struct device *dev, void *data)
1832{ 1830{
1833 struct stmmac_priv *priv = (struct stmmac_priv *)data; 1831 struct stmmac_priv *priv = (struct stmmac_priv *)data;
1834 struct plat_stmmacphy_data *plat_dat; 1832 struct plat_stmmacphy_data *plat_dat = dev->platform_data;
1835
1836 plat_dat = (struct plat_stmmacphy_data *)(dev->platform_data);
1837 1833
1838 DBG(probe, DEBUG, "%s: checking phy for bus %d\n", __func__, 1834 DBG(probe, DEBUG, "%s: checking phy for bus %d\n", __func__,
1839 plat_dat->bus_id); 1835 plat_dat->bus_id);
@@ -1923,7 +1919,7 @@ static int stmmac_dvr_probe(struct platform_device *pdev)
1923 priv = netdev_priv(ndev); 1919 priv = netdev_priv(ndev);
1924 priv->device = &(pdev->dev); 1920 priv->device = &(pdev->dev);
1925 priv->dev = ndev; 1921 priv->dev = ndev;
1926 plat_dat = (struct plat_stmmacenet_data *)((pdev->dev).platform_data); 1922 plat_dat = pdev->dev.platform_data;
1927 priv->bus_id = plat_dat->bus_id; 1923 priv->bus_id = plat_dat->bus_id;
1928 priv->pbl = plat_dat->pbl; /* TLI */ 1924 priv->pbl = plat_dat->pbl; /* TLI */
1929 priv->is_gmac = plat_dat->has_gmac; /* GMAC is on board */ 1925 priv->is_gmac = plat_dat->has_gmac; /* GMAC is on board */
@@ -1933,6 +1929,11 @@ static int stmmac_dvr_probe(struct platform_device *pdev)
1933 /* Set the I/O base addr */ 1929 /* Set the I/O base addr */
1934 ndev->base_addr = (unsigned long)addr; 1930 ndev->base_addr = (unsigned long)addr;
1935 1931
1932 /* Verify embedded resource for the platform */
1933 ret = stmmac_claim_resource(pdev);
1934 if (ret < 0)
1935 goto out;
1936
1936 /* MAC HW revice detection */ 1937 /* MAC HW revice detection */
1937 ret = stmmac_mac_device_setup(ndev); 1938 ret = stmmac_mac_device_setup(ndev);
1938 if (ret < 0) 1939 if (ret < 0)
@@ -1953,6 +1954,7 @@ static int stmmac_dvr_probe(struct platform_device *pdev)
1953 } 1954 }
1954 1955
1955 priv->fix_mac_speed = plat_dat->fix_mac_speed; 1956 priv->fix_mac_speed = plat_dat->fix_mac_speed;
1957 priv->bus_setup = plat_dat->bus_setup;
1956 priv->bsp_priv = plat_dat->bsp_priv; 1958 priv->bsp_priv = plat_dat->bsp_priv;
1957 1959
1958 pr_info("\t%s - (dev. name: %s - id: %d, IRQ #%d\n" 1960 pr_info("\t%s - (dev. name: %s - id: %d, IRQ #%d\n"