Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

net: txgbe: fix GPIO interrupt blocking

The register of GPIO interrupt status is masked before MAC IRQ
is enabled. This is because of hardware deficiency. So manually
clear the interrupt status before using them. Otherwise, GPIO
interrupts will never be reported again. There is a workaround for
clearing interrupts to set GPIO EOI in txgbe_up_complete().

Fixes: aefd013624a1 ("net: txgbe: use irq_domain for interrupt controller")
Signed-off-by: Jiawen Wu <jiawenwu@trustnetic.com>
Link: https://lore.kernel.org/r/20240301092956.18544-1-jiawenwu@trustnetic.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com>

authored by

Jiawen Wu and committed by
Paolo Abeni
b4a2496c b307e25d

+29
+1
drivers/net/ethernet/wangxun/txgbe/txgbe_main.c
··· 81 81 { 82 82 struct net_device *netdev = wx->netdev; 83 83 84 + txgbe_reinit_gpio_intr(wx); 84 85 wx_control_hw(wx, true); 85 86 wx_configure_vectors(wx); 86 87
+27
drivers/net/ethernet/wangxun/txgbe/txgbe_phy.c
··· 489 489 return IRQ_HANDLED; 490 490 } 491 491 492 + void txgbe_reinit_gpio_intr(struct wx *wx) 493 + { 494 + struct txgbe *txgbe = wx->priv; 495 + irq_hw_number_t hwirq; 496 + unsigned long gpioirq; 497 + struct gpio_chip *gc; 498 + unsigned long flags; 499 + 500 + /* for gpio interrupt pending before irq enable */ 501 + gpioirq = rd32(wx, WX_GPIO_INTSTATUS); 502 + 503 + gc = txgbe->gpio; 504 + for_each_set_bit(hwirq, &gpioirq, gc->ngpio) { 505 + int gpio = irq_find_mapping(gc->irq.domain, hwirq); 506 + struct irq_data *d = irq_get_irq_data(gpio); 507 + u32 irq_type = irq_get_trigger_type(gpio); 508 + 509 + txgbe_gpio_irq_ack(d); 510 + 511 + if ((irq_type & IRQ_TYPE_SENSE_MASK) == IRQ_TYPE_EDGE_BOTH) { 512 + raw_spin_lock_irqsave(&wx->gpio_lock, flags); 513 + txgbe_toggle_trigger(gc, hwirq); 514 + raw_spin_unlock_irqrestore(&wx->gpio_lock, flags); 515 + } 516 + } 517 + } 518 + 492 519 static int txgbe_gpio_init(struct txgbe *txgbe) 493 520 { 494 521 struct gpio_irq_chip *girq;
+1
drivers/net/ethernet/wangxun/txgbe/txgbe_phy.h
··· 5 5 #define _TXGBE_PHY_H_ 6 6 7 7 irqreturn_t txgbe_gpio_irq_handler(int irq, void *data); 8 + void txgbe_reinit_gpio_intr(struct wx *wx); 8 9 irqreturn_t txgbe_link_irq_handler(int irq, void *data); 9 10 int txgbe_init_phy(struct txgbe *txgbe); 10 11 void txgbe_remove_phy(struct txgbe *txgbe);