Message ID | 20221121123803.3786-1-zhuyinbo@loongson.cn |
---|---|
State | New |
Headers | show |
Series | [v5,1/3] gpio: loongson2ef: move driver to original location | expand |
On Mon, Dec 12, 2022 at 9:13 AM Yinbo Zhu <zhuyinbo@loongson.cn> wrote: > mask_irq/unmask_irq/irq_ack/ function always be called by > handle_level_irq/handle_edge_irq in current irq domain. and the > handle_level_irq/handle_edge_irq will be called by handle_irq_desc that > ask know which irq is. > > when a peripheral need to use a gpio irq that gpio irq driver need know > irq status and call irq desc->irq_handler. > > so I don't got it about which case it is unnecessary to know which irq. Sorry I don't understand what you are asking, can you elaborate? Do you mean that you don't know which driver will not call ->to_irq() on the gpiochip? That would be any driver that takes an IRQ directly in the device tree: gpio: gpio { interrupt-controller; #interrupt-cells = <2>; .... }; device { interrupts = <&gpio 14 IRQ_TYPE_LEVEL_HIGH>; .... }; This case will only call the irqchip callbacks and will never call the .to_irq() on the gpio_chip. > > You find an example of a hierarchical GPIO irqchip using the > > GPIOLIB_IRQCHIP in drivers/gpio/gpio-ixp4xx.c. > > Loongson-2 gpio irq hardware only a enable register, and when a gpio irq > happen, then will has a such flow: "cpuintc -> liointc -> gpioinc -> > generic_handle_domain_irq -> handle_level_irq -> > peripheral-action(action->handler)" > > generic_handle_domain_irq need rely on specific hwirq that ask gpio irq > hardware has a status register but Loongson-2 gpio irq hardware doesn't > have it. > > so I still think it wasn't appropriate that for loongson-2 gpio driver > add a irq chip. generic_handle_domain_irq() is of no concern, what matters is if your interrupt is hierarchical or not, the callback in the GPIO chip can be a simple remapping of the numberspace followed by a call to the parent callbacks. Yours, Linus Walleij
diff --git a/MAINTAINERS b/MAINTAINERS index 916b2d9cffc0..7b80a64b70b9 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -13881,7 +13881,7 @@ M: Jiaxun Yang <jiaxun.yang@flygoat.com> L: linux-mips@vger.kernel.org S: Maintained F: arch/mips/include/asm/mach-loongson2ef/ -F: arch/mips/loongson2ef/ +F: arch/mips/loongson2ef/* F: drivers/cpufreq/loongson2_cpufreq.c MIPS/LOONGSON64 ARCHITECTURE diff --git a/arch/loongarch/configs/loongson3_defconfig b/arch/loongarch/configs/loongson3_defconfig index 3540e9c0a631..d576d802ffd0 100644 --- a/arch/loongarch/configs/loongson3_defconfig +++ b/arch/loongarch/configs/loongson3_defconfig @@ -601,7 +601,6 @@ CONFIG_I2C_PIIX4=y CONFIG_I2C_GPIO=y CONFIG_SPI=y CONFIG_GPIO_SYSFS=y -CONFIG_GPIO_LOONGSON=y CONFIG_SENSORS_LM75=m CONFIG_SENSORS_LM93=m CONFIG_SENSORS_W83795=m diff --git a/arch/loongarch/include/asm/loongson.h b/arch/loongarch/include/asm/loongson.h index 00db93edae1b..87587688fab8 100644 --- a/arch/loongarch/include/asm/loongson.h +++ b/arch/loongarch/include/asm/loongson.h @@ -29,12 +29,6 @@ #define LOONGSON_REG_SIZE 0x00100000 /* 1M */ #define LOONGSON_REG_TOP (LOONGSON_REG_BASE+LOONGSON_REG_SIZE-1) -/* GPIO Regs - r/w */ - -#define LOONGSON_GPIODATA LOONGSON_REG(0x11c) -#define LOONGSON_GPIOIE LOONGSON_REG(0x120) -#define LOONGSON_REG_GPIO_BASE (LOONGSON_REG_BASE + 0x11c) - #define MAX_PACKAGES 16 #define xconf_readl(addr) readl(addr) diff --git a/arch/mips/configs/lemote2f_defconfig b/arch/mips/configs/lemote2f_defconfig index 7e598d338979..81264ccaacfc 100644 --- a/arch/mips/configs/lemote2f_defconfig +++ b/arch/mips/configs/lemote2f_defconfig @@ -127,7 +127,6 @@ CONFIG_SERIAL_8250_EXTENDED=y CONFIG_SERIAL_8250_MANY_PORTS=y CONFIG_SERIAL_8250_FOURPORT=y CONFIG_HW_RANDOM=y -CONFIG_GPIO_LOONGSON=y CONFIG_THERMAL=y CONFIG_MEDIA_SUPPORT=m CONFIG_FB=y diff --git a/arch/mips/configs/loongson2k_defconfig b/arch/mips/configs/loongson2k_defconfig index 728bef666f7a..f11be40ccb4e 100644 --- a/arch/mips/configs/loongson2k_defconfig +++ b/arch/mips/configs/loongson2k_defconfig @@ -230,7 +230,6 @@ CONFIG_SERIAL_NONSTANDARD=y CONFIG_HW_RANDOM=y CONFIG_I2C_CHARDEV=y CONFIG_I2C_PIIX4=y -CONFIG_GPIO_LOONGSON=y CONFIG_SENSORS_LM75=m CONFIG_SENSORS_LM93=m CONFIG_SENSORS_W83627HF=m diff --git a/arch/mips/configs/loongson3_defconfig b/arch/mips/configs/loongson3_defconfig index aca66a5f330d..82de65130722 100644 --- a/arch/mips/configs/loongson3_defconfig +++ b/arch/mips/configs/loongson3_defconfig @@ -269,7 +269,6 @@ CONFIG_VIRTIO_CONSOLE=y CONFIG_HW_RANDOM=y CONFIG_I2C_CHARDEV=y CONFIG_I2C_PIIX4=y -CONFIG_GPIO_LOONGSON=y CONFIG_SENSORS_LM75=m CONFIG_SENSORS_LM93=m CONFIG_SENSORS_W83627HF=m diff --git a/arch/mips/include/asm/mach-loongson64/loongson.h b/arch/mips/include/asm/mach-loongson64/loongson.h index f7c3ab6d724e..51ee80d98742 100644 --- a/arch/mips/include/asm/mach-loongson64/loongson.h +++ b/arch/mips/include/asm/mach-loongson64/loongson.h @@ -177,11 +177,6 @@ extern int mach_i8259_irq(void); #define LOONGSON_PCIMEMBASECFG LOONGSON_REG(LOONGSON_REGBASE + 0x14) #define LOONGSON_PCIMAP_CFG LOONGSON_REG(LOONGSON_REGBASE + 0x18) -/* GPIO Regs - r/w */ - -#define LOONGSON_GPIODATA LOONGSON_REG(LOONGSON_REGBASE + 0x1c) -#define LOONGSON_GPIOIE LOONGSON_REG(LOONGSON_REGBASE + 0x20) - /* ICU Configuration Regs - r/w */ #define LOONGSON_INTEDGE LOONGSON_REG(LOONGSON_REGBASE + 0x24) diff --git a/arch/mips/loongson2ef/common/Makefile b/arch/mips/loongson2ef/common/Makefile index 30ea8b5ca685..4d4063f90cc5 100644 --- a/arch/mips/loongson2ef/common/Makefile +++ b/arch/mips/loongson2ef/common/Makefile @@ -14,6 +14,7 @@ obj-$(CONFIG_LOONGSON_UART_BASE) += serial.o obj-$(CONFIG_EARLY_PRINTK) += serial.o obj-$(CONFIG_LOONGSON_UART_BASE) += uart_base.o obj-$(CONFIG_LOONGSON_MC146818) += rtc.o +obj-$(CONFIG_GPIOLIB) += gpio.o # # Enable CS5536 Virtual Support Module(VSM) to virtulize the PCI configure diff --git a/drivers/gpio/gpio-loongson.c b/arch/mips/loongson2ef/common/gpio.c similarity index 98% rename from drivers/gpio/gpio-loongson.c rename to arch/mips/loongson2ef/common/gpio.c index a42145873cc9..0d3e7aef46d3 100644 --- a/drivers/gpio/gpio-loongson.c +++ b/arch/mips/loongson2ef/common/gpio.c @@ -1,6 +1,6 @@ // SPDX-License-Identifier: GPL-2.0-or-later /* - * Loongson-2F/3A/3B GPIO Support + * Loongson-2F GPIO Support * * Copyright (c) 2008 Richard Liu, STMicroelectronics <richard.liu@st.com> * Copyright (c) 2008-2010 Arnaud Patard <apatard@mandriva.com> diff --git a/drivers/gpio/Kconfig b/drivers/gpio/Kconfig index a01af1180616..bc55b80f212a 100644 --- a/drivers/gpio/Kconfig +++ b/drivers/gpio/Kconfig @@ -375,12 +375,6 @@ config GPIO_LOGICVC Say yes here to support GPIO functionality of the Xylon LogiCVC programmable logic block. -config GPIO_LOONGSON - bool "Loongson-2/3 GPIO support" - depends on CPU_LOONGSON2EF || CPU_LOONGSON64 - help - Driver for GPIO functionality on Loongson-2F/3A/3B processors. - config GPIO_LPC18XX tristate "NXP LPC18XX/43XX GPIO support" default y if ARCH_LPC18XX diff --git a/drivers/gpio/Makefile b/drivers/gpio/Makefile index 29e3beb6548c..cfd298e00737 100644 --- a/drivers/gpio/Makefile +++ b/drivers/gpio/Makefile @@ -77,7 +77,6 @@ obj-$(CONFIG_GPIO_JANZ_TTL) += gpio-janz-ttl.o obj-$(CONFIG_GPIO_KEMPLD) += gpio-kempld.o obj-$(CONFIG_GPIO_LOGICVC) += gpio-logicvc.o obj-$(CONFIG_GPIO_LOONGSON1) += gpio-loongson1.o -obj-$(CONFIG_GPIO_LOONGSON) += gpio-loongson.o obj-$(CONFIG_GPIO_LP3943) += gpio-lp3943.o obj-$(CONFIG_GPIO_LP873X) += gpio-lp873x.o obj-$(CONFIG_GPIO_LP87565) += gpio-lp87565.o
This gpio driver doesn't cover CPU_LOONGSON64 platforms, because of gpio address was wrong and I don't plan to support it thus move this driver to arch/mips/loongson2ef/ so that I can drop the shackles of the legacy driver and add a new driver that supports dts/acpi to support LoongArch platforms. Signed-off-by: Yinbo Zhu <zhuyinbo@loongson.cn> --- MAINTAINERS | 2 +- arch/loongarch/configs/loongson3_defconfig | 1 - arch/loongarch/include/asm/loongson.h | 6 ------ arch/mips/configs/lemote2f_defconfig | 1 - arch/mips/configs/loongson2k_defconfig | 1 - arch/mips/configs/loongson3_defconfig | 1 - arch/mips/include/asm/mach-loongson64/loongson.h | 5 ----- arch/mips/loongson2ef/common/Makefile | 1 + .../gpio-loongson.c => arch/mips/loongson2ef/common/gpio.c | 2 +- drivers/gpio/Kconfig | 6 ------ drivers/gpio/Makefile | 1 - 11 files changed, 3 insertions(+), 24 deletions(-) rename drivers/gpio/gpio-loongson.c => arch/mips/loongson2ef/common/gpio.c (98%)