@@ -1809,30 +1809,38 @@ static int rzg2l_gpio_get_gpioint(unsigned int virq, struct rzg2l_pinctrl *pctrl
18091809 return gpioint ;
18101810}
18111811
1812- static void rzg2l_gpio_irq_disable (struct irq_data * d )
1812+ static void rzg2l_gpio_irq_endisable (struct rzg2l_pinctrl * pctrl ,
1813+ unsigned int hwirq , bool enable )
18131814{
1814- struct gpio_chip * gc = irq_data_get_irq_chip_data (d );
1815- struct rzg2l_pinctrl * pctrl = container_of (gc , struct rzg2l_pinctrl , gpio_chip );
1816- unsigned int hwirq = irqd_to_hwirq (d );
18171815 const struct pinctrl_pin_desc * pin_desc = & pctrl -> desc .pins [hwirq ];
18181816 u64 * pin_data = pin_desc -> drv_data ;
18191817 u32 off = RZG2L_PIN_CFG_TO_PORT_OFFSET (* pin_data );
18201818 u8 bit = RZG2L_PIN_ID_TO_PIN (hwirq );
18211819 unsigned long flags ;
18221820 void __iomem * addr ;
18231821
1824- irq_chip_disable_parent (d );
1825-
18261822 addr = pctrl -> base + ISEL (off );
18271823 if (bit >= 4 ) {
18281824 bit -= 4 ;
18291825 addr += 4 ;
18301826 }
18311827
18321828 spin_lock_irqsave (& pctrl -> lock , flags );
1833- writel (readl (addr ) & ~BIT (bit * 8 ), addr );
1829+ if (enable )
1830+ writel (readl (addr ) | BIT (bit * 8 ), addr );
1831+ else
1832+ writel (readl (addr ) & ~BIT (bit * 8 ), addr );
18341833 spin_unlock_irqrestore (& pctrl -> lock , flags );
1834+ }
18351835
1836+ static void rzg2l_gpio_irq_disable (struct irq_data * d )
1837+ {
1838+ struct gpio_chip * gc = irq_data_get_irq_chip_data (d );
1839+ struct rzg2l_pinctrl * pctrl = container_of (gc , struct rzg2l_pinctrl , gpio_chip );
1840+ unsigned int hwirq = irqd_to_hwirq (d );
1841+
1842+ irq_chip_disable_parent (d );
1843+ rzg2l_gpio_irq_endisable (pctrl , hwirq , false);
18361844 gpiochip_disable_irq (gc , hwirq );
18371845}
18381846
@@ -1841,25 +1849,9 @@ static void rzg2l_gpio_irq_enable(struct irq_data *d)
18411849 struct gpio_chip * gc = irq_data_get_irq_chip_data (d );
18421850 struct rzg2l_pinctrl * pctrl = container_of (gc , struct rzg2l_pinctrl , gpio_chip );
18431851 unsigned int hwirq = irqd_to_hwirq (d );
1844- const struct pinctrl_pin_desc * pin_desc = & pctrl -> desc .pins [hwirq ];
1845- u64 * pin_data = pin_desc -> drv_data ;
1846- u32 off = RZG2L_PIN_CFG_TO_PORT_OFFSET (* pin_data );
1847- u8 bit = RZG2L_PIN_ID_TO_PIN (hwirq );
1848- unsigned long flags ;
1849- void __iomem * addr ;
18501852
18511853 gpiochip_enable_irq (gc , hwirq );
1852-
1853- addr = pctrl -> base + ISEL (off );
1854- if (bit >= 4 ) {
1855- bit -= 4 ;
1856- addr += 4 ;
1857- }
1858-
1859- spin_lock_irqsave (& pctrl -> lock , flags );
1860- writel (readl (addr ) | BIT (bit * 8 ), addr );
1861- spin_unlock_irqrestore (& pctrl -> lock , flags );
1862-
1854+ rzg2l_gpio_irq_endisable (pctrl , hwirq , true);
18631855 irq_chip_enable_parent (d );
18641856}
18651857
0 commit comments