diff options
Diffstat (limited to 'drivers/net/ethernet/stmicro')
-rw-r--r-- | drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c | 11 | ||||
-rw-r--r-- | drivers/net/ethernet/stmicro/stmmac/stmmac_pci.c | 1 | ||||
-rw-r--r-- | drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c | 39 |
3 files changed, 14 insertions, 37 deletions
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c index ade108232048..0376a5e6b2bf 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c | |||
@@ -177,7 +177,7 @@ int stmmac_mdio_register(struct net_device *ndev) | |||
177 | new_bus->write = &stmmac_mdio_write; | 177 | new_bus->write = &stmmac_mdio_write; |
178 | new_bus->reset = &stmmac_mdio_reset; | 178 | new_bus->reset = &stmmac_mdio_reset; |
179 | snprintf(new_bus->id, MII_BUS_ID_SIZE, "%s-%x", | 179 | snprintf(new_bus->id, MII_BUS_ID_SIZE, "%s-%x", |
180 | new_bus->name, mdio_bus_data->bus_id); | 180 | new_bus->name, priv->plat->bus_id); |
181 | new_bus->priv = ndev; | 181 | new_bus->priv = ndev; |
182 | new_bus->irq = irqlist; | 182 | new_bus->irq = irqlist; |
183 | new_bus->phy_mask = mdio_bus_data->phy_mask; | 183 | new_bus->phy_mask = mdio_bus_data->phy_mask; |
@@ -213,12 +213,10 @@ int stmmac_mdio_register(struct net_device *ndev) | |||
213 | * and no PHY number was provided to the MAC, | 213 | * and no PHY number was provided to the MAC, |
214 | * use the one probed here. | 214 | * use the one probed here. |
215 | */ | 215 | */ |
216 | if ((priv->plat->bus_id == mdio_bus_data->bus_id) && | 216 | if (priv->plat->phy_addr == -1) |
217 | (priv->plat->phy_addr == -1)) | ||
218 | priv->plat->phy_addr = addr; | 217 | priv->plat->phy_addr = addr; |
219 | 218 | ||
220 | act = (priv->plat->bus_id == mdio_bus_data->bus_id) && | 219 | act = (priv->plat->phy_addr == addr); |
221 | (priv->plat->phy_addr == addr); | ||
222 | switch (phydev->irq) { | 220 | switch (phydev->irq) { |
223 | case PHY_POLL: | 221 | case PHY_POLL: |
224 | irq_str = "POLL"; | 222 | irq_str = "POLL"; |
@@ -258,6 +256,9 @@ int stmmac_mdio_unregister(struct net_device *ndev) | |||
258 | { | 256 | { |
259 | struct stmmac_priv *priv = netdev_priv(ndev); | 257 | struct stmmac_priv *priv = netdev_priv(ndev); |
260 | 258 | ||
259 | if (!priv->mii) | ||
260 | return 0; | ||
261 | |||
261 | mdiobus_unregister(priv->mii); | 262 | mdiobus_unregister(priv->mii); |
262 | priv->mii->priv = NULL; | 263 | priv->mii->priv = NULL; |
263 | mdiobus_free(priv->mii); | 264 | mdiobus_free(priv->mii); |
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_pci.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_pci.c index 13afb8edfadc..1f069b0f6af5 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_pci.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_pci.c | |||
@@ -40,7 +40,6 @@ static void stmmac_default_data(void) | |||
40 | plat_dat.has_gmac = 1; | 40 | plat_dat.has_gmac = 1; |
41 | plat_dat.force_sf_dma_mode = 1; | 41 | plat_dat.force_sf_dma_mode = 1; |
42 | 42 | ||
43 | mdio_data.bus_id = 1; | ||
44 | mdio_data.phy_reset = NULL; | 43 | mdio_data.phy_reset = NULL; |
45 | mdio_data.phy_mask = 0; | 44 | mdio_data.phy_mask = 0; |
46 | plat_dat.mdio_bus_data = &mdio_data; | 45 | plat_dat.mdio_bus_data = &mdio_data; |
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c index b93245c11995..ed112b55ae7f 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c | |||
@@ -78,6 +78,7 @@ static int __devinit stmmac_pltfr_probe(struct platform_device *pdev) | |||
78 | { | 78 | { |
79 | int ret = 0; | 79 | int ret = 0; |
80 | struct resource *res; | 80 | struct resource *res; |
81 | struct device *dev = &pdev->dev; | ||
81 | void __iomem *addr = NULL; | 82 | void __iomem *addr = NULL; |
82 | struct stmmac_priv *priv = NULL; | 83 | struct stmmac_priv *priv = NULL; |
83 | struct plat_stmmacenet_data *plat_dat = NULL; | 84 | struct plat_stmmacenet_data *plat_dat = NULL; |
@@ -87,18 +88,10 @@ static int __devinit stmmac_pltfr_probe(struct platform_device *pdev) | |||
87 | if (!res) | 88 | if (!res) |
88 | return -ENODEV; | 89 | return -ENODEV; |
89 | 90 | ||
90 | if (!request_mem_region(res->start, resource_size(res), pdev->name)) { | 91 | addr = devm_request_and_ioremap(dev, res); |
91 | pr_err("%s: ERROR: memory allocation failed" | ||
92 | "cannot get the I/O addr 0x%x\n", | ||
93 | __func__, (unsigned int)res->start); | ||
94 | return -EBUSY; | ||
95 | } | ||
96 | |||
97 | addr = ioremap(res->start, resource_size(res)); | ||
98 | if (!addr) { | 92 | if (!addr) { |
99 | pr_err("%s: ERROR: memory mapping failed", __func__); | 93 | pr_err("%s: ERROR: memory mapping failed", __func__); |
100 | ret = -ENOMEM; | 94 | return -ENOMEM; |
101 | goto out_release_region; | ||
102 | } | 95 | } |
103 | 96 | ||
104 | if (pdev->dev.of_node) { | 97 | if (pdev->dev.of_node) { |
@@ -107,14 +100,13 @@ static int __devinit stmmac_pltfr_probe(struct platform_device *pdev) | |||
107 | GFP_KERNEL); | 100 | GFP_KERNEL); |
108 | if (!plat_dat) { | 101 | if (!plat_dat) { |
109 | pr_err("%s: ERROR: no memory", __func__); | 102 | pr_err("%s: ERROR: no memory", __func__); |
110 | ret = -ENOMEM; | 103 | return -ENOMEM; |
111 | goto out_unmap; | ||
112 | } | 104 | } |
113 | 105 | ||
114 | ret = stmmac_probe_config_dt(pdev, plat_dat, &mac); | 106 | ret = stmmac_probe_config_dt(pdev, plat_dat, &mac); |
115 | if (ret) { | 107 | if (ret) { |
116 | pr_err("%s: main dt probe failed", __func__); | 108 | pr_err("%s: main dt probe failed", __func__); |
117 | goto out_unmap; | 109 | return ret; |
118 | } | 110 | } |
119 | } else { | 111 | } else { |
120 | plat_dat = pdev->dev.platform_data; | 112 | plat_dat = pdev->dev.platform_data; |
@@ -124,13 +116,13 @@ static int __devinit stmmac_pltfr_probe(struct platform_device *pdev) | |||
124 | if (plat_dat->init) { | 116 | if (plat_dat->init) { |
125 | ret = plat_dat->init(pdev); | 117 | ret = plat_dat->init(pdev); |
126 | if (unlikely(ret)) | 118 | if (unlikely(ret)) |
127 | goto out_unmap; | 119 | return ret; |
128 | } | 120 | } |
129 | 121 | ||
130 | priv = stmmac_dvr_probe(&(pdev->dev), plat_dat, addr); | 122 | priv = stmmac_dvr_probe(&(pdev->dev), plat_dat, addr); |
131 | if (!priv) { | 123 | if (!priv) { |
132 | pr_err("%s: main driver probe failed", __func__); | 124 | pr_err("%s: main driver probe failed", __func__); |
133 | goto out_unmap; | 125 | return -ENODEV; |
134 | } | 126 | } |
135 | 127 | ||
136 | /* Get MAC address if available (DT) */ | 128 | /* Get MAC address if available (DT) */ |
@@ -142,8 +134,7 @@ static int __devinit stmmac_pltfr_probe(struct platform_device *pdev) | |||
142 | if (priv->dev->irq == -ENXIO) { | 134 | if (priv->dev->irq == -ENXIO) { |
143 | pr_err("%s: ERROR: MAC IRQ configuration " | 135 | pr_err("%s: ERROR: MAC IRQ configuration " |
144 | "information not found\n", __func__); | 136 | "information not found\n", __func__); |
145 | ret = -ENXIO; | 137 | return -ENXIO; |
146 | goto out_unmap; | ||
147 | } | 138 | } |
148 | 139 | ||
149 | /* | 140 | /* |
@@ -165,15 +156,6 @@ static int __devinit stmmac_pltfr_probe(struct platform_device *pdev) | |||
165 | pr_debug("STMMAC platform driver registration completed"); | 156 | pr_debug("STMMAC platform driver registration completed"); |
166 | 157 | ||
167 | return 0; | 158 | return 0; |
168 | |||
169 | out_unmap: | ||
170 | iounmap(addr); | ||
171 | platform_set_drvdata(pdev, NULL); | ||
172 | |||
173 | out_release_region: | ||
174 | release_mem_region(res->start, resource_size(res)); | ||
175 | |||
176 | return ret; | ||
177 | } | 159 | } |
178 | 160 | ||
179 | /** | 161 | /** |
@@ -186,7 +168,6 @@ static int stmmac_pltfr_remove(struct platform_device *pdev) | |||
186 | { | 168 | { |
187 | struct net_device *ndev = platform_get_drvdata(pdev); | 169 | struct net_device *ndev = platform_get_drvdata(pdev); |
188 | struct stmmac_priv *priv = netdev_priv(ndev); | 170 | struct stmmac_priv *priv = netdev_priv(ndev); |
189 | struct resource *res; | ||
190 | int ret = stmmac_dvr_remove(ndev); | 171 | int ret = stmmac_dvr_remove(ndev); |
191 | 172 | ||
192 | if (priv->plat->exit) | 173 | if (priv->plat->exit) |
@@ -194,10 +175,6 @@ static int stmmac_pltfr_remove(struct platform_device *pdev) | |||
194 | 175 | ||
195 | platform_set_drvdata(pdev, NULL); | 176 | platform_set_drvdata(pdev, NULL); |
196 | 177 | ||
197 | iounmap((void __force __iomem *)priv->ioaddr); | ||
198 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | ||
199 | release_mem_region(res->start, resource_size(res)); | ||
200 | |||
201 | return ret; | 178 | return ret; |
202 | } | 179 | } |
203 | 180 | ||