2
0
mirror of https://github.com/edk2-porting/linux-next.git synced 2024-12-21 11:44:01 +08:00

dm9000: Fix irq trigger type setup on non-dt platforms

Commit b5a099c67a "net: ethernet: davicom: fix devicetree irq
resource" causes an interrupt storm after the ethernet interface
is activated on S3C24XX platform (ARM non-dt), due to the interrupt
trigger type not being set properly.

It seems, after adding parsing of IRQ flags in commit 7085a7401b
"drivers: platform: parse IRQ flags from resources", there is no path
for non-dt platforms where irq_set_type callback could be invoked when
we don't pass the trigger type flags to the request_irq() call.

In case of a board where the regression is seen the interrupt trigger
type flags are passed through a platform device's resource and it is
not currently handled properly without passing the irq trigger type
flags to the request_irq() call.  In case of OF an of_irq_get() call
within platform_get_irq() function seems to be ensuring required irq_chip
setup, but there is no equivalent code for non OF/ACPI platforms.

This patch mostly restores irq trigger type setting code which has been
removed in commit ("net: ethernet: davicom: fix devicetree irq resource").

Fixes: b5a099c67a ("net: ethernet: davicom: fix devicetree irq resource")

Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Acked-by: Robert Jarzmik <robert.jarzmik@free.fr>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
Sylwester Nawrocki 2016-08-09 18:00:08 +02:00 committed by David S. Miller
parent 0d039f337f
commit a96d3b7593

View File

@ -1299,6 +1299,7 @@ static int
dm9000_open(struct net_device *dev) dm9000_open(struct net_device *dev)
{ {
struct board_info *db = netdev_priv(dev); struct board_info *db = netdev_priv(dev);
unsigned int irq_flags = irq_get_trigger_type(dev->irq);
if (netif_msg_ifup(db)) if (netif_msg_ifup(db))
dev_dbg(db->dev, "enabling %s\n", dev->name); dev_dbg(db->dev, "enabling %s\n", dev->name);
@ -1306,9 +1307,11 @@ dm9000_open(struct net_device *dev)
/* If there is no IRQ type specified, tell the user that this is a /* If there is no IRQ type specified, tell the user that this is a
* problem * problem
*/ */
if (irq_get_trigger_type(dev->irq) == IRQF_TRIGGER_NONE) if (irq_flags == IRQF_TRIGGER_NONE)
dev_warn(db->dev, "WARNING: no IRQ resource flags set.\n"); dev_warn(db->dev, "WARNING: no IRQ resource flags set.\n");
irq_flags |= IRQF_SHARED;
/* GPIO0 on pre-activate PHY, Reg 1F is not set by reset */ /* GPIO0 on pre-activate PHY, Reg 1F is not set by reset */
iow(db, DM9000_GPR, 0); /* REG_1F bit0 activate phyxcer */ iow(db, DM9000_GPR, 0); /* REG_1F bit0 activate phyxcer */
mdelay(1); /* delay needs by DM9000B */ mdelay(1); /* delay needs by DM9000B */
@ -1316,8 +1319,7 @@ dm9000_open(struct net_device *dev)
/* Initialize DM9000 board */ /* Initialize DM9000 board */
dm9000_init_dm9000(dev); dm9000_init_dm9000(dev);
if (request_irq(dev->irq, dm9000_interrupt, IRQF_SHARED, if (request_irq(dev->irq, dm9000_interrupt, irq_flags, dev->name, dev))
dev->name, dev))
return -EAGAIN; return -EAGAIN;
/* Now that we have an interrupt handler hooked up we can unmask /* Now that we have an interrupt handler hooked up we can unmask
* our interrupts * our interrupts