* [RFC PATCH 0/4] ARM: S3C24XX: irq move to drivers and first steps to dt
@ 2012-11-12 13:46 Heiko Stübner
2012-11-12 13:47 ` [RFC PATCH 1/4] ARM: S3C24XX: move s3c24xx-irq to drivers/irqchip Heiko Stübner
` (3 more replies)
0 siblings, 4 replies; 7+ messages in thread
From: Heiko Stübner @ 2012-11-12 13:46 UTC (permalink / raw)
To: linux-arm-kernel
On the way back from Barcelona I've started the move of the common
s3c24xx irq-code to drivers/irqchip and also modifications to enable
using it in a devicetree context at some point.
So, as I'm also missing the now probably famous tail-lights in this, it
would be cool to have some feedback if I'm moving in the right
direction here or am thinking wrong somewhere.
The whole endeavour is of course not finished yet, but should not
break anything in its current form.
Tested on a s3c2416 based machine.
Heiko Stuebner (4):
ARM: S3C24XX: move s3c24xx-irq to drivers/irqchip
irqchip: s3c24xx: add irq_domains for the interrupt registers
ARM: S3C24XX: irq_data conversion for s3c_irqsub_* functions
ARM: S3C24XX: First part converting irq code to use hwirq
arch/arm/Kconfig | 1 +
arch/arm/mach-s3c24xx/irq-pm.c | 4 +-
arch/arm/mach-s3c24xx/irq-s3c2412.c | 6 +-
arch/arm/mach-s3c24xx/irq-s3c2416.c | 24 ++--
arch/arm/mach-s3c24xx/irq-s3c2440.c | 6 +-
arch/arm/mach-s3c24xx/irq-s3c2443.c | 30 ++--
arch/arm/mach-s3c24xx/irq-s3c244x.c | 6 +-
arch/arm/plat-s3c24xx/Makefile | 1 -
arch/arm/plat-samsung/include/plat/irq.h | 18 ++--
drivers/irqchip/Kconfig | 4 +
drivers/irqchip/Makefile | 1 +
.../irq.c => drivers/irqchip/irq-s3c24xx.c | 147 ++++++++++++--------
12 files changed, 144 insertions(+), 104 deletions(-)
rename arch/arm/plat-s3c24xx/irq.c => drivers/irqchip/irq-s3c24xx.c (84%)
--
1.7.2.3
^ permalink raw reply [flat|nested] 7+ messages in thread
* [RFC PATCH 1/4] ARM: S3C24XX: move s3c24xx-irq to drivers/irqchip
2012-11-12 13:46 [RFC PATCH 0/4] ARM: S3C24XX: irq move to drivers and first steps to dt Heiko Stübner
@ 2012-11-12 13:47 ` Heiko Stübner
2012-11-12 17:05 ` Stephen Warren
2012-11-12 13:48 ` [RFC PATCH 2/4] irqchip: s3c24xx: add irq_domains for the interrupt registers Heiko Stübner
` (2 subsequent siblings)
3 siblings, 1 reply; 7+ messages in thread
From: Heiko Stübner @ 2012-11-12 13:47 UTC (permalink / raw)
To: linux-arm-kernel
Removes another part from plat-s3c24xx and also enables further
improvements happening in the correct location.
Signed-off-by: Heiko Stuebner <heiko@sntech.de>
---
arch/arm/Kconfig | 1 +
arch/arm/plat-s3c24xx/Makefile | 1 -
drivers/irqchip/Kconfig | 3 +++
drivers/irqchip/Makefile | 1 +
.../irq.c => drivers/irqchip/irq-s3c24xx.c | 0
5 files changed, 5 insertions(+), 1 deletions(-)
rename arch/arm/plat-s3c24xx/irq.c => drivers/irqchip/irq-s3c24xx.c (100%)
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 48eea16..7db6b91 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -742,6 +742,7 @@ config ARCH_S3C24XX
select HAVE_S3C_RTC if RTC_CLASS
select NEED_MACH_GPIO_H
select NEED_MACH_IO_H
+ select S3C24XX_IRQ
help
Samsung S3C2410, S3C2412, S3C2413, S3C2416, S3C2440, S3C2442, S3C2443
and S3C2450 SoCs based systems, such as the Simtec Electronics BAST
diff --git a/arch/arm/plat-s3c24xx/Makefile b/arch/arm/plat-s3c24xx/Makefile
index 9f60549c..6472416 100644
--- a/arch/arm/plat-s3c24xx/Makefile
+++ b/arch/arm/plat-s3c24xx/Makefile
@@ -12,7 +12,6 @@ obj- :=
# Core files
-obj-y += irq.o
obj-$(CONFIG_S3C24XX_DCLK) += clock-dclk.o
obj-$(CONFIG_CPU_FREQ_S3C24XX) += cpu-freq.o
diff --git a/drivers/irqchip/Kconfig b/drivers/irqchip/Kconfig
index 62ca575..860d45d 100644
--- a/drivers/irqchip/Kconfig
+++ b/drivers/irqchip/Kconfig
@@ -1,3 +1,6 @@
+config S3C24XX_IRQ
+ bool
+
config VERSATILE_FPGA_IRQ
bool
select IRQ_DOMAIN
diff --git a/drivers/irqchip/Makefile b/drivers/irqchip/Makefile
index e2e6eb5..5c20f85 100644
--- a/drivers/irqchip/Makefile
+++ b/drivers/irqchip/Makefile
@@ -1,2 +1,3 @@
obj-$(CONFIG_ARCH_BCM2835) += irq-bcm2835.o
+obj-$(CONFIG_S3C24XX_IRQ) += irq-s3c24xx.o
obj-$(CONFIG_VERSATILE_FPGA_IRQ) += irq-versatile-fpga.o
diff --git a/arch/arm/plat-s3c24xx/irq.c b/drivers/irqchip/irq-s3c24xx.c
similarity index 100%
rename from arch/arm/plat-s3c24xx/irq.c
rename to drivers/irqchip/irq-s3c24xx.c
--
1.7.2.3
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [RFC PATCH 2/4] irqchip: s3c24xx: add irq_domains for the interrupt registers
2012-11-12 13:46 [RFC PATCH 0/4] ARM: S3C24XX: irq move to drivers and first steps to dt Heiko Stübner
2012-11-12 13:47 ` [RFC PATCH 1/4] ARM: S3C24XX: move s3c24xx-irq to drivers/irqchip Heiko Stübner
@ 2012-11-12 13:48 ` Heiko Stübner
2012-11-12 13:49 ` [RFC PATCH 3/4] ARM: S3C24XX: irq_data conversion for s3c_irqsub_* functions Heiko Stübner
2012-11-12 13:50 ` [RFC PATCH 4/4] ARM: S3C24XX: First part converting irq code to use hwirq Heiko Stübner
3 siblings, 0 replies; 7+ messages in thread
From: Heiko Stübner @ 2012-11-12 13:48 UTC (permalink / raw)
To: linux-arm-kernel
Add irqdomains for the three register sets in use for base, external
and sub-interrupts. This also pouplates the hwirq value for further
improvements.
Signed-off-by: Heiko Stuebner <heiko@sntech.de>
---
drivers/irqchip/Kconfig | 1 +
drivers/irqchip/irq-s3c24xx.c | 14 ++++++++++++++
2 files changed, 15 insertions(+), 0 deletions(-)
diff --git a/drivers/irqchip/Kconfig b/drivers/irqchip/Kconfig
index 860d45d..e30feca 100644
--- a/drivers/irqchip/Kconfig
+++ b/drivers/irqchip/Kconfig
@@ -1,5 +1,6 @@
config S3C24XX_IRQ
bool
+ select IRQ_DOMAIN
config VERSATILE_FPGA_IRQ
bool
diff --git a/drivers/irqchip/irq-s3c24xx.c b/drivers/irqchip/irq-s3c24xx.c
index fe57bbb..cf9d04d 100644
--- a/drivers/irqchip/irq-s3c24xx.c
+++ b/drivers/irqchip/irq-s3c24xx.c
@@ -25,6 +25,8 @@
#include <linux/device.h>
#include <linux/syscore_ops.h>
+#include <linux/irqdomain.h>
+
#include <asm/irq.h>
#include <asm/mach/irq.h>
@@ -667,6 +669,18 @@ void __init s3c24xx_init_irq(void)
set_irq_flags(irqno, IRQF_VALID);
}
+ /* basic interrupt register */
+ irq_domain_add_legacy(NULL, 32, IRQ_EINT0, 0, &irq_domain_simple_ops,
+ NULL);
+
+ /* extint register, irqs begin at bit4 */
+ irq_domain_add_legacy(NULL, 20, IRQ_EINT4, 4, &irq_domain_simple_ops,
+ NULL);
+
+ /* subint register, 29 to fit subints of all SoCs */
+ irq_domain_add_legacy(NULL, 29, IRQ_S3CUART_RX0, 0,
+ &irq_domain_simple_ops, NULL);
+
irqdbf("s3c2410: registered interrupt handlers\n");
}
--
1.7.2.3
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [RFC PATCH 3/4] ARM: S3C24XX: irq_data conversion for s3c_irqsub_* functions
2012-11-12 13:46 [RFC PATCH 0/4] ARM: S3C24XX: irq move to drivers and first steps to dt Heiko Stübner
2012-11-12 13:47 ` [RFC PATCH 1/4] ARM: S3C24XX: move s3c24xx-irq to drivers/irqchip Heiko Stübner
2012-11-12 13:48 ` [RFC PATCH 2/4] irqchip: s3c24xx: add irq_domains for the interrupt registers Heiko Stübner
@ 2012-11-12 13:49 ` Heiko Stübner
2012-11-12 13:50 ` [RFC PATCH 4/4] ARM: S3C24XX: First part converting irq code to use hwirq Heiko Stübner
3 siblings, 0 replies; 7+ messages in thread
From: Heiko Stübner @ 2012-11-12 13:49 UTC (permalink / raw)
To: linux-arm-kernel
Don't strip off the rest of the irq_data struct when calling one of
the s3c_irqsub_* functions. This enables using its hwirq field
later on.
Signed-off-by: Heiko Stuebner <heiko@sntech.de>
---
arch/arm/mach-s3c24xx/irq-s3c2412.c | 6 +++---
arch/arm/mach-s3c24xx/irq-s3c2416.c | 24 ++++++++++++------------
arch/arm/mach-s3c24xx/irq-s3c2440.c | 6 +++---
arch/arm/mach-s3c24xx/irq-s3c2443.c | 30 +++++++++++++++---------------
arch/arm/mach-s3c24xx/irq-s3c244x.c | 6 +++---
arch/arm/plat-samsung/include/plat/irq.h | 18 +++++++++---------
drivers/irqchip/irq-s3c24xx.c | 24 ++++++++++++------------
7 files changed, 57 insertions(+), 57 deletions(-)
diff --git a/arch/arm/mach-s3c24xx/irq-s3c2412.c b/arch/arm/mach-s3c24xx/irq-s3c2412.c
index e65619d..2cee386 100644
--- a/arch/arm/mach-s3c24xx/irq-s3c2412.c
+++ b/arch/arm/mach-s3c24xx/irq-s3c2412.c
@@ -134,17 +134,17 @@ static void s3c2412_irq_demux_cfsdi(unsigned int irq, struct irq_desc *desc)
static void s3c2412_irq_cfsdi_mask(struct irq_data *data)
{
- s3c_irqsub_mask(data->irq, INTMSK_CFSDI, SUBMSK_CFSDI);
+ s3c_irqsub_mask(data, INTMSK_CFSDI, SUBMSK_CFSDI);
}
static void s3c2412_irq_cfsdi_unmask(struct irq_data *data)
{
- s3c_irqsub_unmask(data->irq, INTMSK_CFSDI);
+ s3c_irqsub_unmask(data, INTMSK_CFSDI);
}
static void s3c2412_irq_cfsdi_ack(struct irq_data *data)
{
- s3c_irqsub_maskack(data->irq, INTMSK_CFSDI, SUBMSK_CFSDI);
+ s3c_irqsub_maskack(data, INTMSK_CFSDI, SUBMSK_CFSDI);
}
static struct irq_chip s3c2412_irq_cfsdi = {
diff --git a/arch/arm/mach-s3c24xx/irq-s3c2416.c b/arch/arm/mach-s3c24xx/irq-s3c2416.c
index ff141b0..149d406 100644
--- a/arch/arm/mach-s3c24xx/irq-s3c2416.c
+++ b/arch/arm/mach-s3c24xx/irq-s3c2416.c
@@ -80,17 +80,17 @@ static void s3c2416_irq_demux_wdtac97(unsigned int irq, struct irq_desc *desc)
static void s3c2416_irq_wdtac97_mask(struct irq_data *data)
{
- s3c_irqsub_mask(data->irq, INTMSK_WDTAC97, SUBMSK_WDTAC97);
+ s3c_irqsub_mask(data, INTMSK_WDTAC97, SUBMSK_WDTAC97);
}
static void s3c2416_irq_wdtac97_unmask(struct irq_data *data)
{
- s3c_irqsub_unmask(data->irq, INTMSK_WDTAC97);
+ s3c_irqsub_unmask(data, INTMSK_WDTAC97);
}
static void s3c2416_irq_wdtac97_ack(struct irq_data *data)
{
- s3c_irqsub_maskack(data->irq, INTMSK_WDTAC97, SUBMSK_WDTAC97);
+ s3c_irqsub_maskack(data, INTMSK_WDTAC97, SUBMSK_WDTAC97);
}
static struct irq_chip s3c2416_irq_wdtac97 = {
@@ -111,17 +111,17 @@ static void s3c2416_irq_demux_lcd(unsigned int irq, struct irq_desc *desc)
static void s3c2416_irq_lcd_mask(struct irq_data *data)
{
- s3c_irqsub_mask(data->irq, INTMSK_LCD, SUBMSK_LCD);
+ s3c_irqsub_mask(data, INTMSK_LCD, SUBMSK_LCD);
}
static void s3c2416_irq_lcd_unmask(struct irq_data *data)
{
- s3c_irqsub_unmask(data->irq, INTMSK_LCD);
+ s3c_irqsub_unmask(data, INTMSK_LCD);
}
static void s3c2416_irq_lcd_ack(struct irq_data *data)
{
- s3c_irqsub_maskack(data->irq, INTMSK_LCD, SUBMSK_LCD);
+ s3c_irqsub_maskack(data, INTMSK_LCD, SUBMSK_LCD);
}
static struct irq_chip s3c2416_irq_lcd = {
@@ -143,17 +143,17 @@ static void s3c2416_irq_demux_dma(unsigned int irq, struct irq_desc *desc)
static void s3c2416_irq_dma_mask(struct irq_data *data)
{
- s3c_irqsub_mask(data->irq, INTMSK_DMA, SUBMSK_DMA);
+ s3c_irqsub_mask(data, INTMSK_DMA, SUBMSK_DMA);
}
static void s3c2416_irq_dma_unmask(struct irq_data *data)
{
- s3c_irqsub_unmask(data->irq, INTMSK_DMA);
+ s3c_irqsub_unmask(data, INTMSK_DMA);
}
static void s3c2416_irq_dma_ack(struct irq_data *data)
{
- s3c_irqsub_maskack(data->irq, INTMSK_DMA, SUBMSK_DMA);
+ s3c_irqsub_maskack(data, INTMSK_DMA, SUBMSK_DMA);
}
static struct irq_chip s3c2416_irq_dma = {
@@ -174,17 +174,17 @@ static void s3c2416_irq_demux_uart3(unsigned int irq, struct irq_desc *desc)
static void s3c2416_irq_uart3_mask(struct irq_data *data)
{
- s3c_irqsub_mask(data->irq, INTMSK_UART3, SUBMSK_UART3);
+ s3c_irqsub_mask(data, INTMSK_UART3, SUBMSK_UART3);
}
static void s3c2416_irq_uart3_unmask(struct irq_data *data)
{
- s3c_irqsub_unmask(data->irq, INTMSK_UART3);
+ s3c_irqsub_unmask(data, INTMSK_UART3);
}
static void s3c2416_irq_uart3_ack(struct irq_data *data)
{
- s3c_irqsub_maskack(data->irq, INTMSK_UART3, SUBMSK_UART3);
+ s3c_irqsub_maskack(data, INTMSK_UART3, SUBMSK_UART3);
}
static struct irq_chip s3c2416_irq_uart3 = {
diff --git a/arch/arm/mach-s3c24xx/irq-s3c2440.c b/arch/arm/mach-s3c24xx/irq-s3c2440.c
index 4a18cde..99fada9 100644
--- a/arch/arm/mach-s3c24xx/irq-s3c2440.c
+++ b/arch/arm/mach-s3c24xx/irq-s3c2440.c
@@ -71,19 +71,19 @@ static void s3c_irq_demux_wdtac97(unsigned int irq,
static void
s3c_irq_wdtac97_mask(struct irq_data *data)
{
- s3c_irqsub_mask(data->irq, INTMSK_WDT, 3 << 13);
+ s3c_irqsub_mask(data, INTMSK_WDT, 3 << 13);
}
static void
s3c_irq_wdtac97_unmask(struct irq_data *data)
{
- s3c_irqsub_unmask(data->irq, INTMSK_WDT);
+ s3c_irqsub_unmask(data, INTMSK_WDT);
}
static void
s3c_irq_wdtac97_ack(struct irq_data *data)
{
- s3c_irqsub_maskack(data->irq, INTMSK_WDT, 3 << 13);
+ s3c_irqsub_maskack(data, INTMSK_WDT, 3 << 13);
}
static struct irq_chip s3c_irq_wdtac97 = {
diff --git a/arch/arm/mach-s3c24xx/irq-s3c2443.c b/arch/arm/mach-s3c24xx/irq-s3c2443.c
index 5e69109..0d9f77a 100644
--- a/arch/arm/mach-s3c24xx/irq-s3c2443.c
+++ b/arch/arm/mach-s3c24xx/irq-s3c2443.c
@@ -77,17 +77,17 @@ static void s3c2443_irq_demux_wdtac97(unsigned int irq, struct irq_desc *desc)
static void s3c2443_irq_wdtac97_mask(struct irq_data *data)
{
- s3c_irqsub_mask(data->irq, INTMSK_WDTAC97, SUBMSK_WDTAC97);
+ s3c_irqsub_mask(data, INTMSK_WDTAC97, SUBMSK_WDTAC97);
}
static void s3c2443_irq_wdtac97_unmask(struct irq_data *data)
{
- s3c_irqsub_unmask(data->irq, INTMSK_WDTAC97);
+ s3c_irqsub_unmask(data, INTMSK_WDTAC97);
}
static void s3c2443_irq_wdtac97_ack(struct irq_data *data)
{
- s3c_irqsub_maskack(data->irq, INTMSK_WDTAC97, SUBMSK_WDTAC97);
+ s3c_irqsub_maskack(data, INTMSK_WDTAC97, SUBMSK_WDTAC97);
}
static struct irq_chip s3c2443_irq_wdtac97 = {
@@ -108,17 +108,17 @@ static void s3c2443_irq_demux_lcd(unsigned int irq, struct irq_desc *desc)
static void s3c2443_irq_lcd_mask(struct irq_data *data)
{
- s3c_irqsub_mask(data->irq, INTMSK_LCD, SUBMSK_LCD);
+ s3c_irqsub_mask(data, INTMSK_LCD, SUBMSK_LCD);
}
static void s3c2443_irq_lcd_unmask(struct irq_data *data)
{
- s3c_irqsub_unmask(data->irq, INTMSK_LCD);
+ s3c_irqsub_unmask(data, INTMSK_LCD);
}
static void s3c2443_irq_lcd_ack(struct irq_data *data)
{
- s3c_irqsub_maskack(data->irq, INTMSK_LCD, SUBMSK_LCD);
+ s3c_irqsub_maskack(data, INTMSK_LCD, SUBMSK_LCD);
}
static struct irq_chip s3c2443_irq_lcd = {
@@ -139,17 +139,17 @@ static void s3c2443_irq_demux_dma(unsigned int irq, struct irq_desc *desc)
static void s3c2443_irq_dma_mask(struct irq_data *data)
{
- s3c_irqsub_mask(data->irq, INTMSK_DMA, SUBMSK_DMA);
+ s3c_irqsub_mask(data, INTMSK_DMA, SUBMSK_DMA);
}
static void s3c2443_irq_dma_unmask(struct irq_data *data)
{
- s3c_irqsub_unmask(data->irq, INTMSK_DMA);
+ s3c_irqsub_unmask(data, INTMSK_DMA);
}
static void s3c2443_irq_dma_ack(struct irq_data *data)
{
- s3c_irqsub_maskack(data->irq, INTMSK_DMA, SUBMSK_DMA);
+ s3c_irqsub_maskack(data, INTMSK_DMA, SUBMSK_DMA);
}
static struct irq_chip s3c2443_irq_dma = {
@@ -170,17 +170,17 @@ static void s3c2443_irq_demux_uart3(unsigned int irq, struct irq_desc *desc)
static void s3c2443_irq_uart3_mask(struct irq_data *data)
{
- s3c_irqsub_mask(data->irq, INTMSK_UART3, SUBMSK_UART3);
+ s3c_irqsub_mask(data, INTMSK_UART3, SUBMSK_UART3);
}
static void s3c2443_irq_uart3_unmask(struct irq_data *data)
{
- s3c_irqsub_unmask(data->irq, INTMSK_UART3);
+ s3c_irqsub_unmask(data, INTMSK_UART3);
}
static void s3c2443_irq_uart3_ack(struct irq_data *data)
{
- s3c_irqsub_maskack(data->irq, INTMSK_UART3, SUBMSK_UART3);
+ s3c_irqsub_maskack(data, INTMSK_UART3, SUBMSK_UART3);
}
static struct irq_chip s3c2443_irq_uart3 = {
@@ -201,17 +201,17 @@ static void s3c2443_irq_demux_cam(unsigned int irq, struct irq_desc *desc)
static void s3c2443_irq_cam_mask(struct irq_data *data)
{
- s3c_irqsub_mask(data->irq, INTMSK_CAM, SUBMSK_CAM);
+ s3c_irqsub_mask(data, INTMSK_CAM, SUBMSK_CAM);
}
static void s3c2443_irq_cam_unmask(struct irq_data *data)
{
- s3c_irqsub_unmask(data->irq, INTMSK_CAM);
+ s3c_irqsub_unmask(data, INTMSK_CAM);
}
static void s3c2443_irq_cam_ack(struct irq_data *data)
{
- s3c_irqsub_maskack(data->irq, INTMSK_CAM, SUBMSK_CAM);
+ s3c_irqsub_maskack(data, INTMSK_CAM, SUBMSK_CAM);
}
static struct irq_chip s3c2443_irq_cam = {
diff --git a/arch/arm/mach-s3c24xx/irq-s3c244x.c b/arch/arm/mach-s3c24xx/irq-s3c244x.c
index 5fe8e58..7a3f53d 100644
--- a/arch/arm/mach-s3c24xx/irq-s3c244x.c
+++ b/arch/arm/mach-s3c24xx/irq-s3c244x.c
@@ -70,19 +70,19 @@ static void s3c_irq_demux_cam(unsigned int irq,
static void
s3c_irq_cam_mask(struct irq_data *data)
{
- s3c_irqsub_mask(data->irq, INTMSK_CAM, 3 << 11);
+ s3c_irqsub_mask(data, INTMSK_CAM, 3 << 11);
}
static void
s3c_irq_cam_unmask(struct irq_data *data)
{
- s3c_irqsub_unmask(data->irq, INTMSK_CAM);
+ s3c_irqsub_unmask(data, INTMSK_CAM);
}
static void
s3c_irq_cam_ack(struct irq_data *data)
{
- s3c_irqsub_maskack(data->irq, INTMSK_CAM, 3 << 11);
+ s3c_irqsub_maskack(data, INTMSK_CAM, 3 << 11);
}
static struct irq_chip s3c_irq_cam = {
diff --git a/arch/arm/plat-samsung/include/plat/irq.h b/arch/arm/plat-samsung/include/plat/irq.h
index e21a89b..3ae54dc 100644
--- a/arch/arm/plat-samsung/include/plat/irq.h
+++ b/arch/arm/plat-samsung/include/plat/irq.h
@@ -25,7 +25,7 @@
extern struct irq_chip s3c_irq_level_chip;
extern struct irq_chip s3c_irq_chip;
-static inline void s3c_irqsub_mask(unsigned int irqno,
+static inline void s3c_irqsub_mask(struct irq_data *data,
unsigned int parentbit,
int subcheck)
{
@@ -35,7 +35,7 @@ static inline void s3c_irqsub_mask(unsigned int irqno,
submask = __raw_readl(S3C2410_INTSUBMSK);
mask = __raw_readl(S3C2410_INTMSK);
- submask |= (1UL << (irqno - IRQ_S3CUART_RX0));
+ submask |= (1UL << (data->irq - IRQ_S3CUART_RX0));
/* check to see if we need to mask the parent IRQ */
@@ -47,7 +47,7 @@ static inline void s3c_irqsub_mask(unsigned int irqno,
}
-static inline void s3c_irqsub_unmask(unsigned int irqno,
+static inline void s3c_irqsub_unmask(struct irq_data *data,
unsigned int parentbit)
{
unsigned long mask;
@@ -56,7 +56,7 @@ static inline void s3c_irqsub_unmask(unsigned int irqno,
submask = __raw_readl(S3C2410_INTSUBMSK);
mask = __raw_readl(S3C2410_INTMSK);
- submask &= ~(1UL << (irqno - IRQ_S3CUART_RX0));
+ submask &= ~(1UL << (data->irq - IRQ_S3CUART_RX0));
mask &= ~parentbit;
/* write back masks */
@@ -65,13 +65,13 @@ static inline void s3c_irqsub_unmask(unsigned int irqno,
}
-static inline void s3c_irqsub_maskack(unsigned int irqno,
+static inline void s3c_irqsub_maskack(struct irq_data *data,
unsigned int parentmask,
unsigned int group)
{
- unsigned int bit = 1UL << (irqno - IRQ_S3CUART_RX0);
+ unsigned int bit = 1UL << (data->irq - IRQ_S3CUART_RX0);
- s3c_irqsub_mask(irqno, parentmask, group);
+ s3c_irqsub_mask(data, parentmask, group);
__raw_writel(bit, S3C2410_SUBSRCPND);
@@ -86,11 +86,11 @@ static inline void s3c_irqsub_maskack(unsigned int irqno,
}
}
-static inline void s3c_irqsub_ack(unsigned int irqno,
+static inline void s3c_irqsub_ack(struct irq_data *data,
unsigned int parentmask,
unsigned int group)
{
- unsigned int bit = 1UL << (irqno - IRQ_S3CUART_RX0);
+ unsigned int bit = 1UL << (data->irq - IRQ_S3CUART_RX0);
__raw_writel(bit, S3C2410_SUBSRCPND);
diff --git a/drivers/irqchip/irq-s3c24xx.c b/drivers/irqchip/irq-s3c24xx.c
index cf9d04d..073e614 100644
--- a/drivers/irqchip/irq-s3c24xx.c
+++ b/drivers/irqchip/irq-s3c24xx.c
@@ -258,19 +258,19 @@ static struct irq_chip s3c_irq_eint0t4 = {
static void
s3c_irq_uart0_mask(struct irq_data *data)
{
- s3c_irqsub_mask(data->irq, INTMSK_UART0, 7);
+ s3c_irqsub_mask(data, INTMSK_UART0, 7);
}
static void
s3c_irq_uart0_unmask(struct irq_data *data)
{
- s3c_irqsub_unmask(data->irq, INTMSK_UART0);
+ s3c_irqsub_unmask(data, INTMSK_UART0);
}
static void
s3c_irq_uart0_ack(struct irq_data *data)
{
- s3c_irqsub_maskack(data->irq, INTMSK_UART0, 7);
+ s3c_irqsub_maskack(data, INTMSK_UART0, 7);
}
static struct irq_chip s3c_irq_uart0 = {
@@ -285,19 +285,19 @@ static struct irq_chip s3c_irq_uart0 = {
static void
s3c_irq_uart1_mask(struct irq_data *data)
{
- s3c_irqsub_mask(data->irq, INTMSK_UART1, 7 << 3);
+ s3c_irqsub_mask(data, INTMSK_UART1, 7 << 3);
}
static void
s3c_irq_uart1_unmask(struct irq_data *data)
{
- s3c_irqsub_unmask(data->irq, INTMSK_UART1);
+ s3c_irqsub_unmask(data, INTMSK_UART1);
}
static void
s3c_irq_uart1_ack(struct irq_data *data)
{
- s3c_irqsub_maskack(data->irq, INTMSK_UART1, 7 << 3);
+ s3c_irqsub_maskack(data, INTMSK_UART1, 7 << 3);
}
static struct irq_chip s3c_irq_uart1 = {
@@ -312,19 +312,19 @@ static struct irq_chip s3c_irq_uart1 = {
static void
s3c_irq_uart2_mask(struct irq_data *data)
{
- s3c_irqsub_mask(data->irq, INTMSK_UART2, 7 << 6);
+ s3c_irqsub_mask(data, INTMSK_UART2, 7 << 6);
}
static void
s3c_irq_uart2_unmask(struct irq_data *data)
{
- s3c_irqsub_unmask(data->irq, INTMSK_UART2);
+ s3c_irqsub_unmask(data, INTMSK_UART2);
}
static void
s3c_irq_uart2_ack(struct irq_data *data)
{
- s3c_irqsub_maskack(data->irq, INTMSK_UART2, 7 << 6);
+ s3c_irqsub_maskack(data, INTMSK_UART2, 7 << 6);
}
static struct irq_chip s3c_irq_uart2 = {
@@ -339,19 +339,19 @@ static struct irq_chip s3c_irq_uart2 = {
static void
s3c_irq_adc_mask(struct irq_data *d)
{
- s3c_irqsub_mask(d->irq, INTMSK_ADCPARENT, 3 << 9);
+ s3c_irqsub_mask(d, INTMSK_ADCPARENT, 3 << 9);
}
static void
s3c_irq_adc_unmask(struct irq_data *d)
{
- s3c_irqsub_unmask(d->irq, INTMSK_ADCPARENT);
+ s3c_irqsub_unmask(d, INTMSK_ADCPARENT);
}
static void
s3c_irq_adc_ack(struct irq_data *d)
{
- s3c_irqsub_ack(d->irq, INTMSK_ADCPARENT, 3 << 9);
+ s3c_irqsub_ack(d, INTMSK_ADCPARENT, 3 << 9);
}
static struct irq_chip s3c_irq_adc = {
--
1.7.2.3
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [RFC PATCH 4/4] ARM: S3C24XX: First part converting irq code to use hwirq
2012-11-12 13:46 [RFC PATCH 0/4] ARM: S3C24XX: irq move to drivers and first steps to dt Heiko Stübner
` (2 preceding siblings ...)
2012-11-12 13:49 ` [RFC PATCH 3/4] ARM: S3C24XX: irq_data conversion for s3c_irqsub_* functions Heiko Stübner
@ 2012-11-12 13:50 ` Heiko Stübner
3 siblings, 0 replies; 7+ messages in thread
From: Heiko Stübner @ 2012-11-12 13:50 UTC (permalink / raw)
To: linux-arm-kernel
Use the newly introduced irq_domains to let the basic ack, mask and unmask
functions use its hwirq field. This also includes the external irq sources
and removes all offset calculations based on the static irq numbers from
these parts.
Signed-off-by: Heiko Stuebner <heiko@sntech.de>
---
arch/arm/mach-s3c24xx/irq-pm.c | 4 +-
arch/arm/plat-samsung/include/plat/irq.h | 8 +-
drivers/irqchip/irq-s3c24xx.c | 109 ++++++++++++++++++------------
3 files changed, 71 insertions(+), 50 deletions(-)
diff --git a/arch/arm/mach-s3c24xx/irq-pm.c b/arch/arm/mach-s3c24xx/irq-pm.c
index 0efb2e2..5aa7e28 100644
--- a/arch/arm/mach-s3c24xx/irq-pm.c
+++ b/arch/arm/mach-s3c24xx/irq-pm.c
@@ -29,12 +29,12 @@
* set bit to 1 in allow bitfield to enable the wakeup settings on it
*/
-unsigned long s3c_irqwake_intallow = 1L << (IRQ_RTC - IRQ_EINT0) | 0xfL;
+unsigned long s3c_irqwake_intallow = 1L << 30 | 0xfL;
unsigned long s3c_irqwake_eintallow = 0x0000fff0L;
int s3c_irq_wake(struct irq_data *data, unsigned int state)
{
- unsigned long irqbit = 1 << (data->irq - IRQ_EINT0);
+ unsigned long irqbit = 1 << (data->hwirq);
if (!(s3c_irqwake_intallow & irqbit))
return -ENOENT;
diff --git a/arch/arm/plat-samsung/include/plat/irq.h b/arch/arm/plat-samsung/include/plat/irq.h
index 3ae54dc..d024d7a 100644
--- a/arch/arm/plat-samsung/include/plat/irq.h
+++ b/arch/arm/plat-samsung/include/plat/irq.h
@@ -35,7 +35,7 @@ static inline void s3c_irqsub_mask(struct irq_data *data,
submask = __raw_readl(S3C2410_INTSUBMSK);
mask = __raw_readl(S3C2410_INTMSK);
- submask |= (1UL << (data->irq - IRQ_S3CUART_RX0));
+ submask |= (1UL << data->hwirq);
/* check to see if we need to mask the parent IRQ */
@@ -56,7 +56,7 @@ static inline void s3c_irqsub_unmask(struct irq_data *data,
submask = __raw_readl(S3C2410_INTSUBMSK);
mask = __raw_readl(S3C2410_INTMSK);
- submask &= ~(1UL << (data->irq - IRQ_S3CUART_RX0));
+ submask &= ~(1UL << data->hwirq);
mask &= ~parentbit;
/* write back masks */
@@ -69,7 +69,7 @@ static inline void s3c_irqsub_maskack(struct irq_data *data,
unsigned int parentmask,
unsigned int group)
{
- unsigned int bit = 1UL << (data->irq - IRQ_S3CUART_RX0);
+ unsigned int bit = 1UL << data->hwirq;
s3c_irqsub_mask(data, parentmask, group);
@@ -90,7 +90,7 @@ static inline void s3c_irqsub_ack(struct irq_data *data,
unsigned int parentmask,
unsigned int group)
{
- unsigned int bit = 1UL << (data->irq - IRQ_S3CUART_RX0);
+ unsigned int bit = 1UL << data->hwirq;
__raw_writel(bit, S3C2410_SUBSRCPND);
diff --git a/drivers/irqchip/irq-s3c24xx.c b/drivers/irqchip/irq-s3c24xx.c
index 073e614..804fda1 100644
--- a/drivers/irqchip/irq-s3c24xx.c
+++ b/drivers/irqchip/irq-s3c24xx.c
@@ -39,18 +39,17 @@
static void
s3c_irq_mask(struct irq_data *data)
{
- unsigned int irqno = data->irq - IRQ_EINT0;
unsigned long mask;
mask = __raw_readl(S3C2410_INTMSK);
- mask |= 1UL << irqno;
+ mask |= 1UL << data->hwirq;
__raw_writel(mask, S3C2410_INTMSK);
}
static inline void
s3c_irq_ack(struct irq_data *data)
{
- unsigned long bitval = 1UL << (data->irq - IRQ_EINT0);
+ unsigned long bitval = 1UL << data->hwirq;
__raw_writel(bitval, S3C2410_SRCPND);
__raw_writel(bitval, S3C2410_INTPND);
@@ -59,7 +58,7 @@ s3c_irq_ack(struct irq_data *data)
static inline void
s3c_irq_maskack(struct irq_data *data)
{
- unsigned long bitval = 1UL << (data->irq - IRQ_EINT0);
+ unsigned long bitval = 1UL << data->hwirq;
unsigned long mask;
mask = __raw_readl(S3C2410_INTMSK);
@@ -79,10 +78,8 @@ s3c_irq_unmask(struct irq_data *data)
if (irqno != IRQ_TIMER4 && irqno != IRQ_EINT8t23)
irqdbf2("s3c_irq_unmask %d\n", irqno);
- irqno -= IRQ_EINT0;
-
mask = __raw_readl(S3C2410_INTMSK);
- mask &= ~(1UL << irqno);
+ mask &= ~(1UL << data->hwirq);
__raw_writel(mask, S3C2410_INTMSK);
}
@@ -105,11 +102,10 @@ struct irq_chip s3c_irq_chip = {
static void
s3c_irqext_mask(struct irq_data *data)
{
- unsigned int irqno = data->irq - EXTINT_OFF;
unsigned long mask;
mask = __raw_readl(S3C24XX_EINTMASK);
- mask |= ( 1UL << irqno);
+ mask |= ( 1UL << data->hwirq);
__raw_writel(mask, S3C24XX_EINTMASK);
}
@@ -120,7 +116,7 @@ s3c_irqext_ack(struct irq_data *data)
unsigned long bit;
unsigned long mask;
- bit = 1UL << (data->irq - EXTINT_OFF);
+ bit = 1UL << data->hwirq;
mask = __raw_readl(S3C24XX_EINTMASK);
@@ -132,10 +128,10 @@ s3c_irqext_ack(struct irq_data *data)
/* not sure if we should be acking the parent irq... */
if (data->irq <= IRQ_EINT7) {
- if ((req & 0xf0) == 0)
+ if ((req & 0xf0) == 0) /* FIXME: use parent irq-domain */
s3c_irq_ack(irq_get_irq_data(IRQ_EINT4t7));
} else {
- if ((req >> 8) == 0)
+ if ((req >> 8) == 0) /* FIXME: use parent irq-domain */
s3c_irq_ack(irq_get_irq_data(IRQ_EINT8t23));
}
}
@@ -143,46 +139,21 @@ s3c_irqext_ack(struct irq_data *data)
static void
s3c_irqext_unmask(struct irq_data *data)
{
- unsigned int irqno = data->irq - EXTINT_OFF;
unsigned long mask;
mask = __raw_readl(S3C24XX_EINTMASK);
- mask &= ~(1UL << irqno);
+ mask &= ~(1UL << data->hwirq);
__raw_writel(mask, S3C24XX_EINTMASK);
}
-int
-s3c_irqext_type(struct irq_data *data, unsigned int type)
+static int s3c_irqext_set_type(void __iomem *gpcon_reg,
+ void __iomem *extint_reg,
+ unsigned long gpcon_offset,
+ unsigned long extint_offset,
+ unsigned int type)
{
- void __iomem *extint_reg;
- void __iomem *gpcon_reg;
- unsigned long gpcon_offset, extint_offset;
unsigned long newvalue = 0, value;
- if ((data->irq >= IRQ_EINT0) && (data->irq <= IRQ_EINT3)) {
- gpcon_reg = S3C2410_GPFCON;
- extint_reg = S3C24XX_EXTINT0;
- gpcon_offset = (data->irq - IRQ_EINT0) * 2;
- extint_offset = (data->irq - IRQ_EINT0) * 4;
- } else if ((data->irq >= IRQ_EINT4) && (data->irq <= IRQ_EINT7)) {
- gpcon_reg = S3C2410_GPFCON;
- extint_reg = S3C24XX_EXTINT0;
- gpcon_offset = (data->irq - (EXTINT_OFF)) * 2;
- extint_offset = (data->irq - (EXTINT_OFF)) * 4;
- } else if ((data->irq >= IRQ_EINT8) && (data->irq <= IRQ_EINT15)) {
- gpcon_reg = S3C2410_GPGCON;
- extint_reg = S3C24XX_EXTINT1;
- gpcon_offset = (data->irq - IRQ_EINT8) * 2;
- extint_offset = (data->irq - IRQ_EINT8) * 4;
- } else if ((data->irq >= IRQ_EINT16) && (data->irq <= IRQ_EINT23)) {
- gpcon_reg = S3C2410_GPGCON;
- extint_reg = S3C24XX_EXTINT2;
- gpcon_offset = (data->irq - IRQ_EINT8) * 2;
- extint_offset = (data->irq - IRQ_EINT16) * 4;
- } else {
- return -1;
- }
-
/* Set the GPIO to external interrupt mode */
value = __raw_readl(gpcon_reg);
value = (value & ~(3 << gpcon_offset)) | (0x02 << gpcon_offset);
@@ -227,6 +198,56 @@ s3c_irqext_type(struct irq_data *data, unsigned int type)
return 0;
}
+int
+s3c_irqext_type(struct irq_data *data, unsigned int type)
+{
+ void __iomem *extint_reg;
+ void __iomem *gpcon_reg;
+ unsigned long gpcon_offset, extint_offset;
+
+ if ((data->hwirq >= 4) && (data->hwirq <= 7)) {
+ gpcon_reg = S3C2410_GPFCON;
+ extint_reg = S3C24XX_EXTINT0;
+ gpcon_offset = (data->hwirq) * 2;
+ extint_offset = (data->hwirq) * 4;
+ } else if ((data->hwirq >= 8) && (data->hwirq <= 15)) {
+ gpcon_reg = S3C2410_GPGCON;
+ extint_reg = S3C24XX_EXTINT1;
+ gpcon_offset = (data->hwirq - 8) * 2;
+ extint_offset = (data->hwirq - 8) * 4;
+ } else if ((data->hwirq >= 16) && (data->hwirq <= 23)) {
+ gpcon_reg = S3C2410_GPGCON;
+ extint_reg = S3C24XX_EXTINT2;
+ gpcon_offset = (data->hwirq - 8) * 2;
+ extint_offset = (data->hwirq - 16) * 4;
+ } else {
+ return -EINVAL;
+ }
+
+ return s3c_irqext_set_type(gpcon_reg, extint_reg, gpcon_offset,
+ extint_offset, type);
+}
+
+int
+s3c_irqext0_type(struct irq_data *data, unsigned int type)
+{
+ void __iomem *extint_reg;
+ void __iomem *gpcon_reg;
+ unsigned long gpcon_offset, extint_offset;
+
+ if ((data->hwirq >= 0) && (data->hwirq <= 3)) {
+ gpcon_reg = S3C2410_GPFCON;
+ extint_reg = S3C24XX_EXTINT0;
+ gpcon_offset = (data->hwirq) * 2;
+ extint_offset = (data->hwirq) * 4;
+ } else {
+ return -EINVAL;
+ }
+
+ return s3c_irqext_set_type(gpcon_reg, extint_reg, gpcon_offset,
+ extint_offset, type);
+}
+
static struct irq_chip s3c_irqext_chip = {
.name = "s3c-ext",
.irq_mask = s3c_irqext_mask,
@@ -242,7 +263,7 @@ static struct irq_chip s3c_irq_eint0t4 = {
.irq_mask = s3c_irq_mask,
.irq_unmask = s3c_irq_unmask,
.irq_set_wake = s3c_irq_wake,
- .irq_set_type = s3c_irqext_type,
+ .irq_set_type = s3c_irqext0_type,
};
/* mask values for the parent registers for each of the interrupt types */
--
1.7.2.3
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [RFC PATCH 1/4] ARM: S3C24XX: move s3c24xx-irq to drivers/irqchip
2012-11-12 13:47 ` [RFC PATCH 1/4] ARM: S3C24XX: move s3c24xx-irq to drivers/irqchip Heiko Stübner
@ 2012-11-12 17:05 ` Stephen Warren
2012-11-12 18:15 ` Heiko Stübner
0 siblings, 1 reply; 7+ messages in thread
From: Stephen Warren @ 2012-11-12 17:05 UTC (permalink / raw)
To: linux-arm-kernel
On 11/12/2012 06:47 AM, Heiko St?bner wrote:
> Removes another part from plat-s3c24xx and also enables further
> improvements happening in the correct location.
>
> Signed-off-by: Heiko Stuebner <heiko@sntech.de>
> ---
> arch/arm/Kconfig | 1 +
> arch/arm/plat-s3c24xx/Makefile | 1 -
> drivers/irqchip/Kconfig | 3 +++
> drivers/irqchip/Makefile | 1 +
> .../irq.c => drivers/irqchip/irq-s3c24xx.c | 0
> 5 files changed, 5 insertions(+), 1 deletions(-)
> rename arch/arm/plat-s3c24xx/irq.c => drivers/irqchip/irq-s3c24xx.c (100%)
Presumably there's a header file somewhere that defines the interface to
irq-s3c24xx.c that other code in arch/arm/plat-s3c24xx is using to
initialize it. That header should be moved somewhere public (i.e.
outside {mach,plat}-*/include/{mach,plat}). However, you then end up
with a header file per IRQ driver in that public location. So, Thomas
Petazzoni started working on a solution for that:
> http://lists.arm.linux.org.uk/lurker/message/20121027.164514.11eb86db.en.html
^ permalink raw reply [flat|nested] 7+ messages in thread
* [RFC PATCH 1/4] ARM: S3C24XX: move s3c24xx-irq to drivers/irqchip
2012-11-12 17:05 ` Stephen Warren
@ 2012-11-12 18:15 ` Heiko Stübner
0 siblings, 0 replies; 7+ messages in thread
From: Heiko Stübner @ 2012-11-12 18:15 UTC (permalink / raw)
To: linux-arm-kernel
Am Montag, 12. November 2012, 18:05:39 schrieb Stephen Warren:
> On 11/12/2012 06:47 AM, Heiko St?bner wrote:
> > Removes another part from plat-s3c24xx and also enables further
> > improvements happening in the correct location.
> >
> > Signed-off-by: Heiko Stuebner <heiko@sntech.de>
> > ---
> >
> > arch/arm/Kconfig | 1 +
> > arch/arm/plat-s3c24xx/Makefile | 1 -
> > drivers/irqchip/Kconfig | 3 +++
> > drivers/irqchip/Makefile | 1 +
> > .../irq.c => drivers/irqchip/irq-s3c24xx.c | 0
> > 5 files changed, 5 insertions(+), 1 deletions(-)
> > rename arch/arm/plat-s3c24xx/irq.c => drivers/irqchip/irq-s3c24xx.c
> > (100%)
>
> Presumably there's a header file somewhere that defines the interface to
> irq-s3c24xx.c that other code in arch/arm/plat-s3c24xx is using to
> initialize it. That header should be moved somewhere public (i.e.
> outside {mach,plat}-*/include/{mach,plat}). However, you then end up
> with a header file per IRQ driver in that public location. So, Thomas
>
> Petazzoni started working on a solution for that:
> > http://lists.arm.linux.org.uk/lurker/message/20121027.164514.11eb86db.en.
> > html
cool, thanks for the pointer :-) .
For the headers, yes they are present and still in mach/plat. My intention was
to first clean it up and then move the remaing necessary header.
I'm not sure what is the policy for adding stuff to drivers/irqchip (dt-
only?), because _all_ s3c24xx subtypes using devicetree seems very very far in
the future, if at all.
So when thinking a bit more about it, it might be better to keep the irq code
in arch/arm for the time being?
Because non-dt init code will probably be necessary for a lot more time.
Heiko
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2012-11-12 18:15 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-11-12 13:46 [RFC PATCH 0/4] ARM: S3C24XX: irq move to drivers and first steps to dt Heiko Stübner
2012-11-12 13:47 ` [RFC PATCH 1/4] ARM: S3C24XX: move s3c24xx-irq to drivers/irqchip Heiko Stübner
2012-11-12 17:05 ` Stephen Warren
2012-11-12 18:15 ` Heiko Stübner
2012-11-12 13:48 ` [RFC PATCH 2/4] irqchip: s3c24xx: add irq_domains for the interrupt registers Heiko Stübner
2012-11-12 13:49 ` [RFC PATCH 3/4] ARM: S3C24XX: irq_data conversion for s3c_irqsub_* functions Heiko Stübner
2012-11-12 13:50 ` [RFC PATCH 4/4] ARM: S3C24XX: First part converting irq code to use hwirq Heiko Stübner
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).