Skip to content

Commit 6c2a6dd

Browse files
Asmaa Mnebhibrgl
authored andcommitted
net: mellanox: mlxbf_gige: Replace non-standard interrupt handling
Since the GPIO driver (gpio-mlxbf2.c) supports interrupt handling, replace the custom routine with simple IRQ request. Signed-off-by: Asmaa Mnebhi <[email protected]> Acked-by: David S. Miller <[email protected]> Signed-off-by: Bartosz Golaszewski <[email protected]>
1 parent 2b72526 commit 6c2a6dd

File tree

4 files changed

+9
-238
lines changed

4 files changed

+9
-238
lines changed

drivers/net/ethernet/mellanox/mlxbf_gige/Makefile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
obj-$(CONFIG_MLXBF_GIGE) += mlxbf_gige.o
44

55
mlxbf_gige-y := mlxbf_gige_ethtool.o \
6-
mlxbf_gige_gpio.o \
76
mlxbf_gige_intr.o \
87
mlxbf_gige_main.o \
98
mlxbf_gige_mdio.o \

drivers/net/ethernet/mellanox/mlxbf_gige/mlxbf_gige.h

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -51,11 +51,6 @@
5151
#define MLXBF_GIGE_ERROR_INTR_IDX 0
5252
#define MLXBF_GIGE_RECEIVE_PKT_INTR_IDX 1
5353
#define MLXBF_GIGE_LLU_PLU_INTR_IDX 2
54-
#define MLXBF_GIGE_PHY_INT_N 3
55-
56-
#define MLXBF_GIGE_MDIO_DEFAULT_PHY_ADDR 0x3
57-
58-
#define MLXBF_GIGE_DEFAULT_PHY_INT_GPIO 12
5954

6055
struct mlxbf_gige_stats {
6156
u64 hw_access_errors;
@@ -81,11 +76,7 @@ struct mlxbf_gige {
8176
struct platform_device *pdev;
8277
void __iomem *mdio_io;
8378
struct mii_bus *mdiobus;
84-
void __iomem *gpio_io;
85-
struct irq_domain *irqdomain;
86-
u32 phy_int_gpio_mask;
8779
spinlock_t lock; /* for packet processing indices */
88-
spinlock_t gpio_lock; /* for GPIO bus access */
8980
u16 rx_q_entries;
9081
u16 tx_q_entries;
9182
u64 *tx_wqe_base;
@@ -184,7 +175,4 @@ int mlxbf_gige_poll(struct napi_struct *napi, int budget);
184175
extern const struct ethtool_ops mlxbf_gige_ethtool_ops;
185176
void mlxbf_gige_update_tx_wqe_next(struct mlxbf_gige *priv);
186177

187-
int mlxbf_gige_gpio_init(struct platform_device *pdev, struct mlxbf_gige *priv);
188-
void mlxbf_gige_gpio_free(struct mlxbf_gige *priv);
189-
190178
#endif /* !defined(__MLXBF_GIGE_H__) */

drivers/net/ethernet/mellanox/mlxbf_gige/mlxbf_gige_gpio.c

Lines changed: 0 additions & 212 deletions
This file was deleted.

drivers/net/ethernet/mellanox/mlxbf_gige/mlxbf_gige_main.c

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -273,8 +273,8 @@ static int mlxbf_gige_probe(struct platform_device *pdev)
273273
void __iomem *llu_base;
274274
void __iomem *plu_base;
275275
void __iomem *base;
276+
int addr, phy_irq;
276277
u64 control;
277-
int addr;
278278
int err;
279279

280280
base = devm_platform_ioremap_resource(pdev, MLXBF_GIGE_RES_MAC);
@@ -309,20 +309,12 @@ static int mlxbf_gige_probe(struct platform_device *pdev)
309309
priv->pdev = pdev;
310310

311311
spin_lock_init(&priv->lock);
312-
spin_lock_init(&priv->gpio_lock);
313312

314313
/* Attach MDIO device */
315314
err = mlxbf_gige_mdio_probe(pdev, priv);
316315
if (err)
317316
return err;
318317

319-
err = mlxbf_gige_gpio_init(pdev, priv);
320-
if (err) {
321-
dev_err(&pdev->dev, "PHY IRQ initialization failed\n");
322-
mlxbf_gige_mdio_remove(priv);
323-
return -ENODEV;
324-
}
325-
326318
priv->base = base;
327319
priv->llu_base = llu_base;
328320
priv->plu_base = plu_base;
@@ -343,15 +335,21 @@ static int mlxbf_gige_probe(struct platform_device *pdev)
343335
priv->rx_irq = platform_get_irq(pdev, MLXBF_GIGE_RECEIVE_PKT_INTR_IDX);
344336
priv->llu_plu_irq = platform_get_irq(pdev, MLXBF_GIGE_LLU_PLU_INTR_IDX);
345337

338+
phy_irq = acpi_dev_gpio_irq_get_by(ACPI_COMPANION(&pdev->dev), "phy-gpios", 0);
339+
if (phy_irq < 0) {
340+
dev_err(&pdev->dev, "Error getting PHY irq. Use polling instead");
341+
phy_irq = PHY_POLL;
342+
}
343+
346344
phydev = phy_find_first(priv->mdiobus);
347345
if (!phydev) {
348346
err = -ENODEV;
349347
goto out;
350348
}
351349

352350
addr = phydev->mdio.addr;
353-
priv->mdiobus->irq[addr] = priv->phy_irq;
354-
phydev->irq = priv->phy_irq;
351+
priv->mdiobus->irq[addr] = phy_irq;
352+
phydev->irq = phy_irq;
355353

356354
err = phy_connect_direct(netdev, phydev,
357355
mlxbf_gige_adjust_link,
@@ -387,7 +385,6 @@ static int mlxbf_gige_probe(struct platform_device *pdev)
387385
return 0;
388386

389387
out:
390-
mlxbf_gige_gpio_free(priv);
391388
mlxbf_gige_mdio_remove(priv);
392389
return err;
393390
}
@@ -398,7 +395,6 @@ static int mlxbf_gige_remove(struct platform_device *pdev)
398395

399396
unregister_netdev(priv->netdev);
400397
phy_disconnect(priv->netdev->phydev);
401-
mlxbf_gige_gpio_free(priv);
402398
mlxbf_gige_mdio_remove(priv);
403399
platform_set_drvdata(pdev, NULL);
404400

0 commit comments

Comments
 (0)