linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/7] ARM: nuc900: move regs-ldm.h to video driver
@ 2016-07-14 11:11 Arnd Bergmann
  2016-07-14 11:11 ` [PATCH 2/7] ARM: nuc900: avoid ASoC header dependency Arnd Bergmann
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: Arnd Bergmann @ 2016-07-14 11:11 UTC (permalink / raw)
  To: linux-arm-kernel

This is one of only three nuc900 drivers that use mach/*.h headers,
and it's fairly easy to avoid if we separate the LCM_DCCS_VA_SRC
definition that is needed for platform data from the other registers:

The global mach/regs-ldm.h file becomes a local nuc900fb-regs.h
header, and is only used by that one driver, while the LCM_DCCS_VA_SRC
enum gets moved into the platform_data header that uses it, to let
the device definition see the values.

The only other reference to a header in the framebuffer driver is for
the pin configuration, and we can simply avoid that by passing the
address along with the data and mask.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 arch/arm/mach-w90x900/dev.c                               |  3 ++-
 .../regs-ldm.h => drivers/video/fbdev/nuc900fb-regs.h     | 15 ---------------
 drivers/video/fbdev/nuc900fb.c                            |  8 +++-----
 drivers/video/fbdev/nuc900fb.h                            |  1 -
 include/linux/platform_data/video-nuc900fb.h              | 14 +++++++++++++-
 5 files changed, 18 insertions(+), 23 deletions(-)
 rename arch/arm/mach-w90x900/include/mach/regs-ldm.h => drivers/video/fbdev/nuc900fb-regs.h (94%)

diff --git a/arch/arm/mach-w90x900/dev.c b/arch/arm/mach-w90x900/dev.c
index e65a80a1ac75..ea84f053bcd3 100644
--- a/arch/arm/mach-w90x900/dev.c
+++ b/arch/arm/mach-w90x900/dev.c
@@ -38,7 +38,6 @@
 #include <linux/platform_data/spi-nuc900.h>
 #include <mach/map.h>
 #include <linux/platform_data/video-nuc900fb.h>
-#include <mach/regs-ldm.h>
 #include <linux/platform_data/keypad-w90p910.h>
 
 #include "cpu.h"
@@ -455,8 +454,10 @@ static struct nuc900fb_mach_info nuc900_fb_info = {
 #endif
 	.num_displays		= ARRAY_SIZE(nuc900_lcd_info),
 	.default_display	= 0,
+	.gpio_dir_addr		= W90X900_VA_GPIO + 0x54,
 	.gpio_dir		= 0x00000004,
 	.gpio_dir_mask		= 0xFFFFFFFD,
+	.gpio_data_addr		= W90X900_VA_GPIO + 0x58,
 	.gpio_data		= 0x00000004,
 	.gpio_data_mask		= 0xFFFFFFFD,
 };
diff --git a/arch/arm/mach-w90x900/include/mach/regs-ldm.h b/drivers/video/fbdev/nuc900fb-regs.h
similarity index 94%
rename from arch/arm/mach-w90x900/include/mach/regs-ldm.h
rename to drivers/video/fbdev/nuc900fb-regs.h
index e9d480a5b232..c6ba567bb11f 100644
--- a/arch/arm/mach-w90x900/include/mach/regs-ldm.h
+++ b/drivers/video/fbdev/nuc900fb-regs.h
@@ -1,6 +1,4 @@
 /*
- * arch/arm/mach-w90x900/include/mach/regs-serial.h
- *
  * Copyright (c) 2009 Nuvoton technology corporation
  * All rights reserved.
  *
@@ -19,8 +17,6 @@
 #ifndef __ASM_ARM_W90X900_REGS_LDM_H
 #define __ASM_ARM_W90X900_REGS_LDM_H
 
-#include <mach/map.h>
-
 /* Display Controller Control/Status Register */
 #define REG_LCM_DCCS			(0x00)
 
@@ -33,17 +29,6 @@
 #define LCM_DCCS_FIELD_INTR		(1 << 6)
 #define LCM_DCCS_SINGLE			(1 << 7)
 
-enum LCM_DCCS_VA_SRC {
-	LCM_DCCS_VA_SRC_YUV422		= (0 << 8),
-	LCM_DCCS_VA_SRC_YCBCR422	= (1 << 8),
-	LCM_DCCS_VA_SRC_RGB888		= (2 << 8),
-	LCM_DCCS_VA_SRC_RGB666		= (3 << 8),
-	LCM_DCCS_VA_SRC_RGB565		= (4 << 8),
-	LCM_DCCS_VA_SRC_RGB444LOW	= (5 << 8),
-	LCM_DCCS_VA_SRC_RGB444HIGH 	= (7 << 8)
-};
-
-
 /* Display Device Control Register */
 #define REG_LCM_DEV_CTRL		(0x04)
 
diff --git a/drivers/video/fbdev/nuc900fb.c b/drivers/video/fbdev/nuc900fb.c
index 6680edae4696..d29777d85518 100644
--- a/drivers/video/fbdev/nuc900fb.c
+++ b/drivers/video/fbdev/nuc900fb.c
@@ -35,11 +35,9 @@
 #include <linux/pm.h>
 #include <linux/device.h>
 
-#include <mach/map.h>
-#include <mach/regs-clock.h>
-#include <mach/regs-ldm.h>
 #include <linux/platform_data/video-nuc900fb.h>
 
+#include "nuc900fb-regs.h"
 #include "nuc900fb.h"
 
 
@@ -373,9 +371,9 @@ static int nuc900fb_init_registers(struct fb_info *info)
 	writel(0, regs + REG_LCM_DEV_CTRL);
 
 	/* config gpio output */
-	modify_gpio(W90X900_VA_GPIO + 0x54, mach_info->gpio_dir,
+	modify_gpio(mach_info->gpio_dir_addr, mach_info->gpio_dir,
 		    mach_info->gpio_dir_mask);
-	modify_gpio(W90X900_VA_GPIO + 0x58, mach_info->gpio_data,
+	modify_gpio(mach_info->gpio_data_addr, mach_info->gpio_data,
 		    mach_info->gpio_data_mask);
 
 	return 0;
diff --git a/drivers/video/fbdev/nuc900fb.h b/drivers/video/fbdev/nuc900fb.h
index 9a1ca6dbb6b2..a904ef17c122 100644
--- a/drivers/video/fbdev/nuc900fb.h
+++ b/drivers/video/fbdev/nuc900fb.h
@@ -15,7 +15,6 @@
 #ifndef __NUC900FB_H
 #define __NUC900FB_H
 
-#include <mach/map.h>
 #include <linux/platform_data/video-nuc900fb.h>
 
 enum nuc900_lcddrv_type {
diff --git a/include/linux/platform_data/video-nuc900fb.h b/include/linux/platform_data/video-nuc900fb.h
index cec5ece765ed..dbce9dd7a294 100644
--- a/include/linux/platform_data/video-nuc900fb.h
+++ b/include/linux/platform_data/video-nuc900fb.h
@@ -38,10 +38,20 @@ struct nuc900fb_hw {
 	unsigned int lcd_va_stuff;
 };
 
+enum LCM_DCCS_VA_SRC {
+	LCM_DCCS_VA_SRC_YUV422		= (0 << 8),
+	LCM_DCCS_VA_SRC_YCBCR422	= (1 << 8),
+	LCM_DCCS_VA_SRC_RGB888		= (2 << 8),
+	LCM_DCCS_VA_SRC_RGB666		= (3 << 8),
+	LCM_DCCS_VA_SRC_RGB565		= (4 << 8),
+	LCM_DCCS_VA_SRC_RGB444LOW	= (5 << 8),
+	LCM_DCCS_VA_SRC_RGB444HIGH 	= (7 << 8)
+};
+
 /* LCD Display Description */
 struct nuc900fb_display {
 	/* LCD Image type */
-	unsigned type;
+	enum LCM_DCCS_VA_SRC type;
 
 	/* LCD Screen Size */
 	unsigned short width;
@@ -72,8 +82,10 @@ struct nuc900fb_mach_info {
 	unsigned num_displays;
 	unsigned default_display;
 	/* GPIO Setting  Info */
+	void __iomem *gpio_dir_addr;
 	unsigned gpio_dir;
 	unsigned gpio_dir_mask;
+	void __iomem *gpio_data_addr;
 	unsigned gpio_data;
 	unsigned gpio_data_mask;
 };
-- 
2.9.0

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 2/7] ARM: nuc900: avoid ASoC header dependency
  2016-07-14 11:11 [PATCH 1/7] ARM: nuc900: move regs-ldm.h to video driver Arnd Bergmann
@ 2016-07-14 11:11 ` Arnd Bergmann
  2016-07-14 11:11 ` [PATCH 3/7] ARM: nuc900: use MULTI_IRQ_HANDLER Arnd Bergmann
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Arnd Bergmann @ 2016-07-14 11:11 UTC (permalink / raw)
  To: linux-arm-kernel

The ac97 driver remains as one of the few places using w90x900/nuc900
mach/*.h header files for the purpose of pin configuration. We can
avoid that by passing a pointer to the one function it needs to call
as platform data.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 arch/arm/mach-w90x900/dev.c    | 1 +
 sound/soc/nuc900/nuc900-ac97.c | 6 ++++--
 sound/soc/nuc900/nuc900-pcm.c  | 2 --
 3 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/arch/arm/mach-w90x900/dev.c b/arch/arm/mach-w90x900/dev.c
index ea84f053bcd3..9c9292feb066 100644
--- a/arch/arm/mach-w90x900/dev.c
+++ b/arch/arm/mach-w90x900/dev.c
@@ -512,6 +512,7 @@ struct platform_device nuc900_device_ac97 = {
 	.dev              = {
 		.dma_mask               = &nuc900_device_audio_dmamask,
 		.coherent_dma_mask      = -1,
+		.platform_data		= mfp_set_groupg,
 	}
 };
 
diff --git a/sound/soc/nuc900/nuc900-ac97.c b/sound/soc/nuc900/nuc900-ac97.c
index b6615affe571..04bb89f0b6a4 100644
--- a/sound/soc/nuc900/nuc900-ac97.c
+++ b/sound/soc/nuc900/nuc900-ac97.c
@@ -22,8 +22,6 @@
 #include <sound/soc.h>
 #include <linux/clk.h>
 
-#include <mach/mfp.h>
-
 #include "nuc900-audio.h"
 
 static DEFINE_MUTEX(ac97_mutex);
@@ -320,6 +318,8 @@ static const struct snd_soc_component_driver nuc900_ac97_component = {
 
 static int nuc900_ac97_drvprobe(struct platform_device *pdev)
 {
+	void (*mfp_set_groupg)(struct device *dev, const char *subname);
+
 	struct nuc900_audio *nuc900_audio;
 	int ret;
 
@@ -362,6 +362,8 @@ static int nuc900_ac97_drvprobe(struct platform_device *pdev)
 	if (ret)
 		goto out;
 
+	mfp_set_groupg = platform_get_drvdata(pdev);
+
 	/* enbale ac97 multifunction pin */
 	mfp_set_groupg(nuc900_audio->dev, NULL);
 
diff --git a/sound/soc/nuc900/nuc900-pcm.c b/sound/soc/nuc900/nuc900-pcm.c
index 2cca055fd806..70883ec94f89 100644
--- a/sound/soc/nuc900/nuc900-pcm.c
+++ b/sound/soc/nuc900/nuc900-pcm.c
@@ -21,8 +21,6 @@
 #include <sound/pcm_params.h>
 #include <sound/soc.h>
 
-#include <mach/hardware.h>
-
 #include "nuc900-audio.h"
 
 static const struct snd_pcm_hardware nuc900_pcm_hardware = {
-- 
2.9.0

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 3/7] ARM: nuc900: use MULTI_IRQ_HANDLER
  2016-07-14 11:11 [PATCH 1/7] ARM: nuc900: move regs-ldm.h to video driver Arnd Bergmann
  2016-07-14 11:11 ` [PATCH 2/7] ARM: nuc900: avoid ASoC header dependency Arnd Bergmann
@ 2016-07-14 11:11 ` Arnd Bergmann
  2016-07-14 11:11 ` [PATCH 4/7] ARM: nuc900: make most header files local Arnd Bergmann
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Arnd Bergmann @ 2016-07-14 11:11 UTC (permalink / raw)
  To: linux-arm-kernel

To clean up the header files, the inline IRQ entry is being replaced
with a modern handle_irq() function doing the same thing.

This is also required for multiplatform support.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 arch/arm/Kconfig                                 |  1 +
 arch/arm/mach-w90x900/include/mach/entry-macro.S | 26 ------------------------
 arch/arm/mach-w90x900/irq.c                      | 13 ++++++++++++
 3 files changed, 14 insertions(+), 26 deletions(-)
 delete mode 100644 arch/arm/mach-w90x900/include/mach/entry-macro.S

diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 36f721c2eb97..908694886088 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -503,6 +503,7 @@ config ARCH_W90X900
 	select CPU_ARM926T
 	select GENERIC_CLOCKEVENTS
 	select GPIOLIB
+	select MULTI_IRQ_HANDLER
 	help
 	  Support for Nuvoton (Winbond logic dept.) ARM9 processor,
 	  At present, the w90x900 has been renamed nuc900, regarding
diff --git a/arch/arm/mach-w90x900/include/mach/entry-macro.S b/arch/arm/mach-w90x900/include/mach/entry-macro.S
deleted file mode 100644
index 0ff612ac95ba..000000000000
--- a/arch/arm/mach-w90x900/include/mach/entry-macro.S
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * arch/arm/mach-w90x900/include/mach/entry-macro.S
- *
- * Low-level IRQ helper macros for W90P910-based platforms
- *
- * This file is licensed under  the terms of the GNU General Public
- * License version 2. This program is licensed "as is" without any
- * warranty of any kind, whether express or implied.
- *
- */
-
-#include <mach/hardware.h>
-#include <mach/regs-irq.h>
-
-	.macro  get_irqnr_preamble, base, tmp
-	.endm
-
-	.macro	get_irqnr_and_base, irqnr, irqstat, base, tmp
-
-		mov	\base, #AIC_BA
-
-		ldr	\irqnr, [\base, #AIC_IPER]
-		ldr	\irqnr, [\base, #AIC_ISNR]
-		cmp	\irqnr, #0
-
-	.endm
diff --git a/arch/arm/mach-w90x900/irq.c b/arch/arm/mach-w90x900/irq.c
index 491b317daffa..6ef0ae50a23f 100644
--- a/arch/arm/mach-w90x900/irq.c
+++ b/arch/arm/mach-w90x900/irq.c
@@ -22,6 +22,7 @@
 #include <linux/device.h>
 #include <linux/io.h>
 
+#include <asm/exception.h>
 #include <asm/irq.h>
 #include <asm/mach/irq.h>
 
@@ -202,10 +203,22 @@ static struct irq_chip nuc900_irq_chip = {
 	.irq_unmask	= nuc900_irq_unmask,
 };
 
+static void __exception_irq_entry nuc900_handle_irq(struct pt_regs *regs)
+{
+	int hwirq;
+
+	(void)readl(REG_AIC_IPER);
+	hwirq = readl(REG_AIC_ISNR);
+
+	handle_IRQ(hwirq, regs);
+}
+
 void __init nuc900_init_irq(void)
 {
 	int irqno;
 
+	set_handle_irq(nuc900_handle_irq);
+
 	__raw_writel(0xFFFFFFFE, REG_AIC_MDCR);
 
 	for (irqno = IRQ_WDT; irqno <= IRQ_ADC; irqno++) {
-- 
2.9.0

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 4/7] ARM: nuc900: make most header files local
  2016-07-14 11:11 [PATCH 1/7] ARM: nuc900: move regs-ldm.h to video driver Arnd Bergmann
  2016-07-14 11:11 ` [PATCH 2/7] ARM: nuc900: avoid ASoC header dependency Arnd Bergmann
  2016-07-14 11:11 ` [PATCH 3/7] ARM: nuc900: use MULTI_IRQ_HANDLER Arnd Bergmann
@ 2016-07-14 11:11 ` Arnd Bergmann
  2016-07-14 11:11 ` [PATCH 5/7] ARM: nuc900: move most of mach/irqs.h Arnd Bergmann
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Arnd Bergmann @ 2016-07-14 11:11 UTC (permalink / raw)
  To: linux-arm-kernel

Once we enable CONFIG_ARCH_MULTIPLATFORM, we no longer reference the include/mach/
directory for header files, so they become invisible to the existing users.

Since all users of the headers are now in arch/arm/mach-w90x900/, we can simply
move the headers to the same place and include them using "" instead of <>.

The only exception is mach/uncompress.h, which gets included by the zImage
uncompress code for non-multiplatform configurations, so the header remains
there for the moment, and I add the few macros it actually needs there to
let it be included standalone.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 arch/arm/mach-w90x900/clksel.c                     |  4 ++--
 arch/arm/mach-w90x900/clock.c                      |  2 +-
 arch/arm/mach-w90x900/cpu.c                        |  6 +++---
 arch/arm/mach-w90x900/dev.c                        |  3 +--
 arch/arm/mach-w90x900/gpio.c                       |  2 +-
 arch/arm/mach-w90x900/include/mach/hardware.h      | 24 ----------------------
 arch/arm/mach-w90x900/include/mach/uncompress.h    |  5 +++--
 arch/arm/mach-w90x900/irq.c                        |  5 ++---
 arch/arm/mach-w90x900/mach-nuc910evb.c             |  2 +-
 arch/arm/mach-w90x900/mach-nuc950evb.c             |  2 +-
 arch/arm/mach-w90x900/mach-nuc960evb.c             |  2 +-
 arch/arm/mach-w90x900/{include/mach => }/map.h     |  0
 arch/arm/mach-w90x900/mfp.c                        |  2 +-
 arch/arm/mach-w90x900/{include/mach => }/mfp.h     |  0
 arch/arm/mach-w90x900/nuc910.c                     |  2 +-
 arch/arm/mach-w90x900/nuc950.c                     |  2 +-
 arch/arm/mach-w90x900/nuc960.c                     |  2 +-
 .../mach-w90x900/{include/mach => }/regs-clock.h   |  2 --
 .../arm/mach-w90x900/{include/mach => }/regs-irq.h |  2 --
 .../mach-w90x900/{include/mach => }/regs-serial.h  |  2 --
 arch/arm/mach-w90x900/time.c                       |  3 +--
 21 files changed, 21 insertions(+), 53 deletions(-)
 delete mode 100644 arch/arm/mach-w90x900/include/mach/hardware.h
 rename arch/arm/mach-w90x900/{include/mach => }/map.h (100%)
 rename arch/arm/mach-w90x900/{include/mach => }/mfp.h (100%)
 rename arch/arm/mach-w90x900/{include/mach => }/regs-clock.h (96%)
 rename arch/arm/mach-w90x900/{include/mach => }/regs-irq.h (96%)
 rename arch/arm/mach-w90x900/{include/mach => }/regs-serial.h (96%)

diff --git a/arch/arm/mach-w90x900/clksel.c b/arch/arm/mach-w90x900/clksel.c
index 06d867dce551..ae9d53e09b60 100644
--- a/arch/arm/mach-w90x900/clksel.c
+++ b/arch/arm/mach-w90x900/clksel.c
@@ -21,8 +21,8 @@
 #include <linux/mutex.h>
 #include <linux/io.h>
 
-#include <mach/hardware.h>
-#include <mach/regs-clock.h>
+#include "map.h"
+#include "regs-clock.h"
 
 #define PLL0		0x00
 #define PLL1		0x01
diff --git a/arch/arm/mach-w90x900/clock.c b/arch/arm/mach-w90x900/clock.c
index 8b196d094daa..a143d4b8ab38 100644
--- a/arch/arm/mach-w90x900/clock.c
+++ b/arch/arm/mach-w90x900/clock.c
@@ -21,7 +21,7 @@
 #include <linux/platform_device.h>
 #include <linux/io.h>
 
-#include <mach/hardware.h>
+#include "map.h"
 
 #include "clock.h"
 
diff --git a/arch/arm/mach-w90x900/cpu.c b/arch/arm/mach-w90x900/cpu.c
index ca763251ffe0..d96d0e3eb7a6 100644
--- a/arch/arm/mach-w90x900/cpu.c
+++ b/arch/arm/mach-w90x900/cpu.c
@@ -30,9 +30,9 @@
 #include <asm/irq.h>
 #include <asm/system_misc.h>
 
-#include <mach/hardware.h>
-#include <mach/regs-serial.h>
-#include <mach/regs-clock.h>
+#include "map.h"
+#include "regs-serial.h"
+#include "regs-clock.h"
 #include "regs-ebi.h"
 #include "regs-timer.h"
 
diff --git a/arch/arm/mach-w90x900/dev.c b/arch/arm/mach-w90x900/dev.c
index 9c9292feb066..f9f3aa46b1af 100644
--- a/arch/arm/mach-w90x900/dev.c
+++ b/arch/arm/mach-w90x900/dev.c
@@ -34,12 +34,11 @@
 #include <asm/mach/irq.h>
 #include <asm/mach-types.h>
 
-#include <mach/regs-serial.h>
 #include <linux/platform_data/spi-nuc900.h>
-#include <mach/map.h>
 #include <linux/platform_data/video-nuc900fb.h>
 #include <linux/platform_data/keypad-w90p910.h>
 
+#include "map.h"
 #include "cpu.h"
 
 /*NUC900 evb norflash driver data */
diff --git a/arch/arm/mach-w90x900/gpio.c b/arch/arm/mach-w90x900/gpio.c
index 55d1a00dbd28..ae039e1ca465 100644
--- a/arch/arm/mach-w90x900/gpio.c
+++ b/arch/arm/mach-w90x900/gpio.c
@@ -22,7 +22,7 @@
 #include <linux/io.h>
 #include <linux/gpio/driver.h>
 
-#include <mach/hardware.h>
+#include "map.h"
 
 #define GPIO_BASE 		(W90X900_VA_GPIO)
 #define GPIO_DIR		(0x04)
diff --git a/arch/arm/mach-w90x900/include/mach/hardware.h b/arch/arm/mach-w90x900/include/mach/hardware.h
deleted file mode 100644
index fe3c6265a466..000000000000
--- a/arch/arm/mach-w90x900/include/mach/hardware.h
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * arch/arm/mach-w90x900/include/mach/hardware.h
- *
- * Copyright (c) 2008 Nuvoton technology corporation
- * All rights reserved.
- *
- * Wan ZongShun <mcuos.com@gmail.com>
- *
- * Based on arch/arm/mach-s3c2410/include/mach/hardware.h
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- */
-
-#ifndef __ASM_ARCH_HARDWARE_H
-#define __ASM_ARCH_HARDWARE_H
-
-#include <asm/sizes.h>
-#include <mach/map.h>
-
-#endif /* __ASM_ARCH_HARDWARE_H */
diff --git a/arch/arm/mach-w90x900/include/mach/uncompress.h b/arch/arm/mach-w90x900/include/mach/uncompress.h
index 3855ecebda6e..a1b6ea95e658 100644
--- a/arch/arm/mach-w90x900/include/mach/uncompress.h
+++ b/arch/arm/mach-w90x900/include/mach/uncompress.h
@@ -20,11 +20,12 @@
 
 /* Defines for UART registers */
 
-#include <mach/regs-serial.h>
-#include <mach/map.h>
 #include <linux/serial_reg.h>
 
 #define TX_DONE	(UART_LSR_TEMT | UART_LSR_THRE)
+
+#define UART0_PA		W90X900_PA_UART
+#define W90X900_PA_UART		(0xB8000000)
 static volatile u32 * const uart_base = (u32 *)UART0_PA;
 
 static inline void putc(int ch)
diff --git a/arch/arm/mach-w90x900/irq.c b/arch/arm/mach-w90x900/irq.c
index 6ef0ae50a23f..2a6fe35b76e7 100644
--- a/arch/arm/mach-w90x900/irq.c
+++ b/arch/arm/mach-w90x900/irq.c
@@ -26,9 +26,8 @@
 #include <asm/irq.h>
 #include <asm/mach/irq.h>
 
-#include <mach/hardware.h>
-#include <mach/regs-irq.h>
-
+#include "map.h"
+#include "regs-irq.h"
 #include "nuc9xx.h"
 
 struct group_irq {
diff --git a/arch/arm/mach-w90x900/mach-nuc910evb.c b/arch/arm/mach-w90x900/mach-nuc910evb.c
index 92f1c978f35e..e9631784493e 100644
--- a/arch/arm/mach-w90x900/mach-nuc910evb.c
+++ b/arch/arm/mach-w90x900/mach-nuc910evb.c
@@ -17,8 +17,8 @@
 #include <asm/mach/arch.h>
 #include <asm/mach/map.h>
 #include <asm/mach-types.h>
-#include <mach/map.h>
 
+#include "map.h"
 #include "nuc910.h"
 
 static void __init nuc910evb_map_io(void)
diff --git a/arch/arm/mach-w90x900/mach-nuc950evb.c b/arch/arm/mach-w90x900/mach-nuc950evb.c
index 26f7189056e3..eb8865b09288 100644
--- a/arch/arm/mach-w90x900/mach-nuc950evb.c
+++ b/arch/arm/mach-w90x900/mach-nuc950evb.c
@@ -19,9 +19,9 @@
 #include <asm/mach/arch.h>
 #include <asm/mach/map.h>
 #include <asm/mach-types.h>
-#include <mach/map.h>
 #include <linux/platform_data/video-nuc900fb.h>
 
+#include "map.h"
 #include "nuc950.h"
 
 static void __init nuc950evb_map_io(void)
diff --git a/arch/arm/mach-w90x900/mach-nuc960evb.c b/arch/arm/mach-w90x900/mach-nuc960evb.c
index 9b4e73fe10e5..d7b97913af7b 100644
--- a/arch/arm/mach-w90x900/mach-nuc960evb.c
+++ b/arch/arm/mach-w90x900/mach-nuc960evb.c
@@ -17,8 +17,8 @@
 #include <asm/mach/arch.h>
 #include <asm/mach/map.h>
 #include <asm/mach-types.h>
-#include <mach/map.h>
 
+#include "map.h"
 #include "nuc960.h"
 
 static void __init nuc960evb_map_io(void)
diff --git a/arch/arm/mach-w90x900/include/mach/map.h b/arch/arm/mach-w90x900/map.h
similarity index 100%
rename from arch/arm/mach-w90x900/include/mach/map.h
rename to arch/arm/mach-w90x900/map.h
diff --git a/arch/arm/mach-w90x900/mfp.c b/arch/arm/mach-w90x900/mfp.c
index c58d142b8a46..0d985ff0c57d 100644
--- a/arch/arm/mach-w90x900/mfp.c
+++ b/arch/arm/mach-w90x900/mfp.c
@@ -21,7 +21,7 @@
 #include <linux/mutex.h>
 #include <linux/io.h>
 
-#include <mach/hardware.h>
+#include "map.h"
 
 #define REG_MFSEL	(W90X900_VA_GCR + 0xC)
 
diff --git a/arch/arm/mach-w90x900/include/mach/mfp.h b/arch/arm/mach-w90x900/mfp.h
similarity index 100%
rename from arch/arm/mach-w90x900/include/mach/mfp.h
rename to arch/arm/mach-w90x900/mfp.h
diff --git a/arch/arm/mach-w90x900/nuc910.c b/arch/arm/mach-w90x900/nuc910.c
index 1523f4136985..59d865c6abfe 100644
--- a/arch/arm/mach-w90x900/nuc910.c
+++ b/arch/arm/mach-w90x900/nuc910.c
@@ -17,7 +17,7 @@
 
 #include <linux/platform_device.h>
 #include <asm/mach/map.h>
-#include <mach/hardware.h>
+#include "map.h"
 #include "cpu.h"
 #include "clock.h"
 
diff --git a/arch/arm/mach-w90x900/nuc950.c b/arch/arm/mach-w90x900/nuc950.c
index 5704f74a50ee..340e1a067d3c 100644
--- a/arch/arm/mach-w90x900/nuc950.c
+++ b/arch/arm/mach-w90x900/nuc950.c
@@ -17,7 +17,7 @@
 
 #include <linux/platform_device.h>
 #include <asm/mach/map.h>
-#include <mach/hardware.h>
+#include "map.h"
 
 #include "cpu.h"
 
diff --git a/arch/arm/mach-w90x900/nuc960.c b/arch/arm/mach-w90x900/nuc960.c
index 8851a3a27ce2..f01571f8c1f2 100644
--- a/arch/arm/mach-w90x900/nuc960.c
+++ b/arch/arm/mach-w90x900/nuc960.c
@@ -17,7 +17,7 @@
 
 #include <linux/platform_device.h>
 #include <asm/mach/map.h>
-#include <mach/hardware.h>
+#include "map.h"
 #include "cpu.h"
 
 /* define specific CPU platform device */
diff --git a/arch/arm/mach-w90x900/include/mach/regs-clock.h b/arch/arm/mach-w90x900/regs-clock.h
similarity index 96%
rename from arch/arm/mach-w90x900/include/mach/regs-clock.h
rename to arch/arm/mach-w90x900/regs-clock.h
index 516d6b477b61..345a6b51e823 100644
--- a/arch/arm/mach-w90x900/include/mach/regs-clock.h
+++ b/arch/arm/mach-w90x900/regs-clock.h
@@ -1,6 +1,4 @@
 /*
- * arch/arm/mach-w90x900/include/mach/regs-clock.h
- *
  * Copyright (c) 2008 Nuvoton technology corporation.
  *
  * Wan ZongShun <mcuos.com@gmail.com>
diff --git a/arch/arm/mach-w90x900/include/mach/regs-irq.h b/arch/arm/mach-w90x900/regs-irq.h
similarity index 96%
rename from arch/arm/mach-w90x900/include/mach/regs-irq.h
rename to arch/arm/mach-w90x900/regs-irq.h
index 8a3185fbc9cf..75d7ed1bbec2 100644
--- a/arch/arm/mach-w90x900/include/mach/regs-irq.h
+++ b/arch/arm/mach-w90x900/regs-irq.h
@@ -1,6 +1,4 @@
 /*
- * arch/arm/mach-w90x900/include/mach/regs-irq.h
- *
  * Copyright (c) 2008 Nuvoton technology corporation
  * All rights reserved.
  *
diff --git a/arch/arm/mach-w90x900/include/mach/regs-serial.h b/arch/arm/mach-w90x900/regs-serial.h
similarity index 96%
rename from arch/arm/mach-w90x900/include/mach/regs-serial.h
rename to arch/arm/mach-w90x900/regs-serial.h
index f08fa0d75e11..9cfeacd90aec 100644
--- a/arch/arm/mach-w90x900/include/mach/regs-serial.h
+++ b/arch/arm/mach-w90x900/regs-serial.h
@@ -1,6 +1,4 @@
 /*
- * arch/arm/mach-w90x900/include/mach/regs-serial.h
- *
  * Copyright (c) 2008 Nuvoton technology corporation
  * All rights reserved.
  *
diff --git a/arch/arm/mach-w90x900/time.c b/arch/arm/mach-w90x900/time.c
index cda085245e34..0129f5e92f3e 100644
--- a/arch/arm/mach-w90x900/time.c
+++ b/arch/arm/mach-w90x900/time.c
@@ -30,9 +30,8 @@
 #include <asm/mach/irq.h>
 #include <asm/mach/time.h>
 
-#include <mach/map.h>
+#include "map.h"
 #include "regs-timer.h"
-
 #include "nuc9xx.h"
 
 #define RESETINT	0x1f
-- 
2.9.0

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 5/7] ARM: nuc900: move most of mach/irqs.h
  2016-07-14 11:11 [PATCH 1/7] ARM: nuc900: move regs-ldm.h to video driver Arnd Bergmann
                   ` (2 preceding siblings ...)
  2016-07-14 11:11 ` [PATCH 4/7] ARM: nuc900: make most header files local Arnd Bergmann
@ 2016-07-14 11:11 ` Arnd Bergmann
  2016-07-14 11:11 ` [PATCH 6/7] ARM: nuc900: use SPARSE_IRQ Arnd Bergmann
  2016-07-14 11:11 ` [PATCH 7/7] ARM: nuc900: make NUC970 multiplatform Arnd Bergmann
  5 siblings, 0 replies; 7+ messages in thread
From: Arnd Bergmann @ 2016-07-14 11:11 UTC (permalink / raw)
  To: linux-arm-kernel

The interrupt definitions are not used anywhere in driver code, so we
can keep them private to the machine directory. However, as long as we
don't set SPARSE_IRQ, we need a header in the old place that defines
NR_IRQS.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 arch/arm/mach-w90x900/cpu.c               |  1 +
 arch/arm/mach-w90x900/dev.c               |  1 +
 arch/arm/mach-w90x900/include/mach/irqs.h | 86 -------------------------------
 arch/arm/mach-w90x900/irq.c               |  1 +
 arch/arm/mach-w90x900/irq.h               | 85 ++++++++++++++++++++++++++++++
 arch/arm/mach-w90x900/time.c              |  1 +
 6 files changed, 89 insertions(+), 86 deletions(-)
 create mode 100644 arch/arm/mach-w90x900/irq.h

diff --git a/arch/arm/mach-w90x900/cpu.c b/arch/arm/mach-w90x900/cpu.c
index d96d0e3eb7a6..7a9bbc75ad9b 100644
--- a/arch/arm/mach-w90x900/cpu.c
+++ b/arch/arm/mach-w90x900/cpu.c
@@ -30,6 +30,7 @@
 #include <asm/irq.h>
 #include <asm/system_misc.h>
 
+#include "irq.h"
 #include "map.h"
 #include "regs-serial.h"
 #include "regs-clock.h"
diff --git a/arch/arm/mach-w90x900/dev.c b/arch/arm/mach-w90x900/dev.c
index f9f3aa46b1af..027062b38626 100644
--- a/arch/arm/mach-w90x900/dev.c
+++ b/arch/arm/mach-w90x900/dev.c
@@ -38,6 +38,7 @@
 #include <linux/platform_data/video-nuc900fb.h>
 #include <linux/platform_data/keypad-w90p910.h>
 
+#include "irq.h"
 #include "map.h"
 #include "cpu.h"
 
diff --git a/arch/arm/mach-w90x900/include/mach/irqs.h b/arch/arm/mach-w90x900/include/mach/irqs.h
index 3b035c6e8c6f..277903857030 100644
--- a/arch/arm/mach-w90x900/include/mach/irqs.h
+++ b/arch/arm/mach-w90x900/include/mach/irqs.h
@@ -1,91 +1,5 @@
-/*
- * arch/arm/mach-w90x900/include/mach/irqs.h
- *
- * Copyright (c) 2008 Nuvoton technology corporation.
- *
- * Wan ZongShun <mcuos.com@gmail.com>
- *
- * Based on arch/arm/mach-s3c2410/include/mach/irqs.h
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation;version 2 of the License.
- *
- */
-
-#ifndef __ASM_ARCH_IRQS_H
-#define __ASM_ARCH_IRQS_H
-
-/*
- * we keep the first set of CPU IRQs out of the range of
- * the ISA space, so that the PC104 has them to itself
- * and we don't end up having to do horrible things to the
- * standard ISA drivers....
- *
- */
-
-#define W90X900_IRQ(x)	(x)
-
-/* Main cpu interrupts */
-
-#define IRQ_WDT		W90X900_IRQ(1)
-#define IRQ_GROUP0	W90X900_IRQ(2)
-#define IRQ_GROUP1	W90X900_IRQ(3)
-#define IRQ_ACTL	W90X900_IRQ(4)
-#define IRQ_LCD		W90X900_IRQ(5)
-#define IRQ_RTC		W90X900_IRQ(6)
-#define IRQ_UART0	W90X900_IRQ(7)
-#define IRQ_UART1	W90X900_IRQ(8)
-#define IRQ_UART2	W90X900_IRQ(9)
-#define IRQ_UART3	W90X900_IRQ(10)
-#define IRQ_UART4	W90X900_IRQ(11)
-#define IRQ_TIMER0	W90X900_IRQ(12)
-#define IRQ_TIMER1	W90X900_IRQ(13)
-#define IRQ_T_INT_GROUP	W90X900_IRQ(14)
-#define IRQ_USBH	W90X900_IRQ(15)
-#define IRQ_EMCTX	W90X900_IRQ(16)
-#define IRQ_EMCRX	W90X900_IRQ(17)
-#define IRQ_GDMAGROUP	W90X900_IRQ(18)
-#define IRQ_DMAC	W90X900_IRQ(19)
-#define IRQ_FMI		W90X900_IRQ(20)
-#define IRQ_USBD	W90X900_IRQ(21)
-#define IRQ_ATAPI	W90X900_IRQ(22)
-#define IRQ_G2D		W90X900_IRQ(23)
-#define IRQ_PCI		W90X900_IRQ(24)
-#define IRQ_SCGROUP	W90X900_IRQ(25)
-#define IRQ_I2CGROUP	W90X900_IRQ(26)
-#define IRQ_SSP		W90X900_IRQ(27)
-#define IRQ_PWM		W90X900_IRQ(28)
-#define IRQ_KPI		W90X900_IRQ(29)
-#define IRQ_P2SGROUP	W90X900_IRQ(30)
-#define IRQ_ADC		W90X900_IRQ(31)
-
 #if !defined(CONFIG_SOC_NUC900)
 #define NR_IRQS		(IRQ_ADC+1)
 #else
 #define NR_IRQS		62
 #endif
-
-/*for irq group*/
-
-#define	IRQ_PS2_PORT0	0x10000000
-#define	IRQ_PS2_PORT1	0x20000000
-#define	IRQ_I2C_LINE0	0x04000000
-#define	IRQ_I2C_LINE1	0x08000000
-#define	IRQ_SC_CARD0	0x01000000
-#define	IRQ_SC_CARD1	0x02000000
-#define	IRQ_GDMA_CH0	0x00100000
-#define	IRQ_GDMA_CH1	0x00200000
-#define	IRQ_TIMER2	0x00010000
-#define	IRQ_TIMER3	0x00020000
-#define	IRQ_TIMER4	0x00040000
-#define	IRQ_GROUP0_IRQ0	0x00000001
-#define	IRQ_GROUP0_IRQ1	0x00000002
-#define	IRQ_GROUP0_IRQ2	0x00000004
-#define	IRQ_GROUP0_IRQ3	0x00000008
-#define	IRQ_GROUP1_IRQ4	0x00000010
-#define	IRQ_GROUP1_IRQ5	0x00000020
-#define	IRQ_GROUP1_IRQ6	0x00000040
-#define	IRQ_GROUP1_IRQ7	0x00000080
-
-#endif /* __ASM_ARCH_IRQ_H */
diff --git a/arch/arm/mach-w90x900/irq.c b/arch/arm/mach-w90x900/irq.c
index 2a6fe35b76e7..42d9af897c42 100644
--- a/arch/arm/mach-w90x900/irq.c
+++ b/arch/arm/mach-w90x900/irq.c
@@ -26,6 +26,7 @@
 #include <asm/irq.h>
 #include <asm/mach/irq.h>
 
+#include "irq.h"
 #include "map.h"
 #include "regs-irq.h"
 #include "nuc9xx.h"
diff --git a/arch/arm/mach-w90x900/irq.h b/arch/arm/mach-w90x900/irq.h
new file mode 100644
index 000000000000..9dc88bb62692
--- /dev/null
+++ b/arch/arm/mach-w90x900/irq.h
@@ -0,0 +1,85 @@
+/*
+ * arch/arm/mach-w90x900/include/mach/irqs.h
+ *
+ * Copyright (c) 2008 Nuvoton technology corporation.
+ *
+ * Wan ZongShun <mcuos.com@gmail.com>
+ *
+ * Based on arch/arm/mach-s3c2410/include/mach/irqs.h
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation;version 2 of the License.
+ *
+ */
+
+#ifndef __ASM_ARCH_IRQS_H
+#define __ASM_ARCH_IRQS_H
+
+/*
+ * we keep the first set of CPU IRQs out of the range of
+ * the ISA space, so that the PC104 has them to itself
+ * and we don't end up having to do horrible things to the
+ * standard ISA drivers....
+ *
+ */
+
+#define W90X900_IRQ(x)	(x)
+
+/* Main cpu interrupts */
+
+#define IRQ_WDT		W90X900_IRQ(1)
+#define IRQ_GROUP0	W90X900_IRQ(2)
+#define IRQ_GROUP1	W90X900_IRQ(3)
+#define IRQ_ACTL	W90X900_IRQ(4)
+#define IRQ_LCD		W90X900_IRQ(5)
+#define IRQ_RTC		W90X900_IRQ(6)
+#define IRQ_UART0	W90X900_IRQ(7)
+#define IRQ_UART1	W90X900_IRQ(8)
+#define IRQ_UART2	W90X900_IRQ(9)
+#define IRQ_UART3	W90X900_IRQ(10)
+#define IRQ_UART4	W90X900_IRQ(11)
+#define IRQ_TIMER0	W90X900_IRQ(12)
+#define IRQ_TIMER1	W90X900_IRQ(13)
+#define IRQ_T_INT_GROUP	W90X900_IRQ(14)
+#define IRQ_USBH	W90X900_IRQ(15)
+#define IRQ_EMCTX	W90X900_IRQ(16)
+#define IRQ_EMCRX	W90X900_IRQ(17)
+#define IRQ_GDMAGROUP	W90X900_IRQ(18)
+#define IRQ_DMAC	W90X900_IRQ(19)
+#define IRQ_FMI		W90X900_IRQ(20)
+#define IRQ_USBD	W90X900_IRQ(21)
+#define IRQ_ATAPI	W90X900_IRQ(22)
+#define IRQ_G2D		W90X900_IRQ(23)
+#define IRQ_PCI		W90X900_IRQ(24)
+#define IRQ_SCGROUP	W90X900_IRQ(25)
+#define IRQ_I2CGROUP	W90X900_IRQ(26)
+#define IRQ_SSP		W90X900_IRQ(27)
+#define IRQ_PWM		W90X900_IRQ(28)
+#define IRQ_KPI		W90X900_IRQ(29)
+#define IRQ_P2SGROUP	W90X900_IRQ(30)
+#define IRQ_ADC		W90X900_IRQ(31)
+
+/*for irq group*/
+
+#define	IRQ_PS2_PORT0	0x10000000
+#define	IRQ_PS2_PORT1	0x20000000
+#define	IRQ_I2C_LINE0	0x04000000
+#define	IRQ_I2C_LINE1	0x08000000
+#define	IRQ_SC_CARD0	0x01000000
+#define	IRQ_SC_CARD1	0x02000000
+#define	IRQ_GDMA_CH0	0x00100000
+#define	IRQ_GDMA_CH1	0x00200000
+#define	IRQ_TIMER2	0x00010000
+#define	IRQ_TIMER3	0x00020000
+#define	IRQ_TIMER4	0x00040000
+#define	IRQ_GROUP0_IRQ0	0x00000001
+#define	IRQ_GROUP0_IRQ1	0x00000002
+#define	IRQ_GROUP0_IRQ2	0x00000004
+#define	IRQ_GROUP0_IRQ3	0x00000008
+#define	IRQ_GROUP1_IRQ4	0x00000010
+#define	IRQ_GROUP1_IRQ5	0x00000020
+#define	IRQ_GROUP1_IRQ6	0x00000040
+#define	IRQ_GROUP1_IRQ7	0x00000080
+
+#endif /* __ASM_ARCH_IRQ_H */
diff --git a/arch/arm/mach-w90x900/time.c b/arch/arm/mach-w90x900/time.c
index 0129f5e92f3e..cb45df22ce2c 100644
--- a/arch/arm/mach-w90x900/time.c
+++ b/arch/arm/mach-w90x900/time.c
@@ -30,6 +30,7 @@
 #include <asm/mach/irq.h>
 #include <asm/mach/time.h>
 
+#include "irq.h"
 #include "map.h"
 #include "regs-timer.h"
 #include "nuc9xx.h"
-- 
2.9.0

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 6/7] ARM: nuc900: use SPARSE_IRQ
  2016-07-14 11:11 [PATCH 1/7] ARM: nuc900: move regs-ldm.h to video driver Arnd Bergmann
                   ` (3 preceding siblings ...)
  2016-07-14 11:11 ` [PATCH 5/7] ARM: nuc900: move most of mach/irqs.h Arnd Bergmann
@ 2016-07-14 11:11 ` Arnd Bergmann
  2016-07-14 11:11 ` [PATCH 7/7] ARM: nuc900: make NUC970 multiplatform Arnd Bergmann
  5 siblings, 0 replies; 7+ messages in thread
From: Arnd Bergmann @ 2016-07-14 11:11 UTC (permalink / raw)
  To: linux-arm-kernel

ARCH_MULTIPLATFORM implies sparse IRQs, so in we first have to make sure that actually
works. This enables CONFIG_SPARSE_IRQ for all of mach-w90x900.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 arch/arm/Kconfig                          |  1 +
 arch/arm/mach-w90x900/include/mach/irqs.h |  5 -----
 arch/arm/mach-w90x900/irq.c               | 22 +++++++++++++++++++++-
 drivers/irqchip/irq-nuc900.c              |  2 +-
 4 files changed, 23 insertions(+), 7 deletions(-)
 delete mode 100644 arch/arm/mach-w90x900/include/mach/irqs.h

diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 908694886088..160dbf993660 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -504,6 +504,7 @@ config ARCH_W90X900
 	select GENERIC_CLOCKEVENTS
 	select GPIOLIB
 	select MULTI_IRQ_HANDLER
+	select SPARSE_IRQ
 	help
 	  Support for Nuvoton (Winbond logic dept.) ARM9 processor,
 	  At present, the w90x900 has been renamed nuc900, regarding
diff --git a/arch/arm/mach-w90x900/include/mach/irqs.h b/arch/arm/mach-w90x900/include/mach/irqs.h
deleted file mode 100644
index 277903857030..000000000000
--- a/arch/arm/mach-w90x900/include/mach/irqs.h
+++ /dev/null
@@ -1,5 +0,0 @@
-#if !defined(CONFIG_SOC_NUC900)
-#define NR_IRQS		(IRQ_ADC+1)
-#else
-#define NR_IRQS		62
-#endif
diff --git a/arch/arm/mach-w90x900/irq.c b/arch/arm/mach-w90x900/irq.c
index 42d9af897c42..726f646c992b 100644
--- a/arch/arm/mach-w90x900/irq.c
+++ b/arch/arm/mach-w90x900/irq.c
@@ -20,6 +20,7 @@
 #include <linux/ioport.h>
 #include <linux/ptrace.h>
 #include <linux/device.h>
+#include <linux/irqdomain.h>
 #include <linux/io.h>
 
 #include <asm/exception.h>
@@ -203,6 +204,8 @@ static struct irq_chip nuc900_irq_chip = {
 	.irq_unmask	= nuc900_irq_unmask,
 };
 
+static struct irq_domain *aic_domain;
+
 static void __exception_irq_entry nuc900_handle_irq(struct pt_regs *regs)
 {
 	int hwirq;
@@ -210,15 +213,32 @@ static void __exception_irq_entry nuc900_handle_irq(struct pt_regs *regs)
 	(void)readl(REG_AIC_IPER);
 	hwirq = readl(REG_AIC_ISNR);
 
-	handle_IRQ(hwirq, regs);
+	handle_domain_irq(aic_domain, hwirq, regs);
 }
 
+static int aic_irq_domain_map(struct irq_domain *d, unsigned int virq,
+			      irq_hw_number_t hw)
+{
+	irq_set_chip_and_handler(virq, &nuc900_irq_chip, handle_level_irq);
+	irq_clear_status_flags(virq, IRQ_NOREQUEST);
+
+	return 0;
+}
+
+static struct irq_domain_ops aic_irq_domain_ops = {
+	.map = aic_irq_domain_map,
+	.xlate = irq_domain_xlate_onecell,
+};
+
 void __init nuc900_init_irq(void)
 {
 	int irqno;
 
 	set_handle_irq(nuc900_handle_irq);
 
+	aic_domain = irq_domain_add_simple(NULL, 31, 1,
+					   &aic_irq_domain_ops, NULL);
+
 	__raw_writel(0xFFFFFFFE, REG_AIC_MDCR);
 
 	for (irqno = IRQ_WDT; irqno <= IRQ_ADC; irqno++) {
diff --git a/drivers/irqchip/irq-nuc900.c b/drivers/irqchip/irq-nuc900.c
index c4b2e39f7662..a595139f2f9c 100644
--- a/drivers/irqchip/irq-nuc900.c
+++ b/drivers/irqchip/irq-nuc900.c
@@ -129,7 +129,7 @@ static int __init aic_of_init(struct device_node *node,
 	writel(0xFFFFFFFC, aic_base + REG_AIC_MDCR);
 	writel(0xFFFFFFFF, aic_base + REG_AIC_MDCRH);
 
-	aic_domain = irq_domain_add_linear(node, NR_IRQS,
+	aic_domain = irq_domain_add_linear(node, 64,
 					   &aic_irq_domain_ops, NULL);
 
 	if (!aic_domain) {
-- 
2.9.0

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 7/7] ARM: nuc900: make NUC970 multiplatform
  2016-07-14 11:11 [PATCH 1/7] ARM: nuc900: move regs-ldm.h to video driver Arnd Bergmann
                   ` (4 preceding siblings ...)
  2016-07-14 11:11 ` [PATCH 6/7] ARM: nuc900: use SPARSE_IRQ Arnd Bergmann
@ 2016-07-14 11:11 ` Arnd Bergmann
  5 siblings, 0 replies; 7+ messages in thread
From: Arnd Bergmann @ 2016-07-14 11:11 UTC (permalink / raw)
  To: linux-arm-kernel

This enables multiplatform support for NUC9xx, which should work fine
for NUC970, though the others are still lacking a common-clk driver
to actually work.

As a consequence, I'm leaving both options present -- separate builds
using ARCH_W90X900_SINGLE and a multiplatform build using the new
ARCH_NUC900 option.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 arch/arm/Kconfig                  |  2 +-
 arch/arm/configs/nuc910_defconfig |  2 +-
 arch/arm/configs/nuc950_defconfig |  2 +-
 arch/arm/configs/nuc960_defconfig |  2 +-
 arch/arm/configs/nuc970_defconfig |  4 +++-
 arch/arm/mach-w90x900/Kconfig     | 41 +++++++++++++++++++++++++--------------
 arch/arm/mach-w90x900/Makefile    |  8 +++++---
 arch/arm/mach-w90x900/cpu.c       |  6 ++++++
 arch/arm/mach-w90x900/cpu.h       |  4 ++++
 9 files changed, 48 insertions(+), 23 deletions(-)

diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 160dbf993660..2a3113bd437a 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -496,7 +496,7 @@ config ARCH_KS8695
 	  Support for Micrel/Kendin KS8695 "Centaur" (ARM922T) based
 	  System-on-Chip devices.
 
-config ARCH_W90X900
+config ARCH_W90X900_SINGLE
 	bool "Nuvoton W90X900 CPU"
 	select CLKDEV_LOOKUP
 	select CLKSRC_MMIO
diff --git a/arch/arm/configs/nuc910_defconfig b/arch/arm/configs/nuc910_defconfig
index 10180cfde162..bb229dab9d72 100644
--- a/arch/arm/configs/nuc910_defconfig
+++ b/arch/arm/configs/nuc910_defconfig
@@ -8,7 +8,7 @@ CONFIG_USER_NS=y
 CONFIG_BLK_DEV_INITRD=y
 CONFIG_KALLSYMS_EXTRA_PASS=y
 CONFIG_SLAB=y
-CONFIG_ARCH_W90X900=y
+CONFIG_ARCH_W90X900_SINGLE=y
 CONFIG_PREEMPT=y
 CONFIG_AEABI=y
 CONFIG_CMDLINE="root=/dev/ram0 console=ttyS0,115200n8 rdinit=/sbin/init mem=64M"
diff --git a/arch/arm/configs/nuc950_defconfig b/arch/arm/configs/nuc950_defconfig
index 27aa8731330b..b3b43f0f2238 100644
--- a/arch/arm/configs/nuc950_defconfig
+++ b/arch/arm/configs/nuc950_defconfig
@@ -8,7 +8,7 @@ CONFIG_USER_NS=y
 CONFIG_BLK_DEV_INITRD=y
 CONFIG_KALLSYMS_EXTRA_PASS=y
 CONFIG_SLAB=y
-CONFIG_ARCH_W90X900=y
+CONFIG_ARCH_W90X900_SINGLE=y
 # CONFIG_MACH_W90P910EVB is not set
 CONFIG_MACH_W90P950EVB=y
 CONFIG_NO_HZ=y
diff --git a/arch/arm/configs/nuc960_defconfig b/arch/arm/configs/nuc960_defconfig
index 56fd7ad0ff13..4c6b0315a49b 100644
--- a/arch/arm/configs/nuc960_defconfig
+++ b/arch/arm/configs/nuc960_defconfig
@@ -8,7 +8,7 @@ CONFIG_USER_NS=y
 CONFIG_BLK_DEV_INITRD=y
 CONFIG_KALLSYMS_EXTRA_PASS=y
 CONFIG_SLAB=y
-CONFIG_ARCH_W90X900=y
+CONFIG_ARCH_W90X900_SINGLE=y
 # CONFIG_MACH_W90P910EVB is not set
 CONFIG_MACH_W90N960EVB=y
 CONFIG_NO_HZ=y
diff --git a/arch/arm/configs/nuc970_defconfig b/arch/arm/configs/nuc970_defconfig
index b39a406c6495..972e3286eaf8 100644
--- a/arch/arm/configs/nuc970_defconfig
+++ b/arch/arm/configs/nuc970_defconfig
@@ -19,7 +19,9 @@ CONFIG_PERF_EVENTS=y
 # CONFIG_COMPAT_BRK is not set
 CONFIG_MODULES=y
 CONFIG_MODULE_UNLOAD=y
-CONFIG_ARCH_W90X900=y
+CONFIG_ARCH_MULTIPLATFORM=y
+CONFIG_ARCH_MULTI_V5=y
+# CONFIG_ARCH_MULTI_V7 is not set
 CONFIG_SOC_NUC970=y
 # CONFIG_MACH_W90P910EVB is not set
 CONFIG_PREEMPT=y
diff --git a/arch/arm/mach-w90x900/Kconfig b/arch/arm/mach-w90x900/Kconfig
index 56f19aac6dab..3cfb29fc2abe 100644
--- a/arch/arm/mach-w90x900/Kconfig
+++ b/arch/arm/mach-w90x900/Kconfig
@@ -1,22 +1,12 @@
-if ARCH_W90X900
+menuconfig ARCH_NUC900
+	bool "Nuvoton CPU_W90P910/NUC9xx support"
+	depends on ARCH_MULTI_V5
 
-config CPU_W90P910
-	bool
-	help
-	  Support for W90P910 of Nuvoton W90X900 CPUs.
-
-config CPU_NUC950
-	bool
-	help
-	  Support for NUCP950 of Nuvoton NUC900 CPUs.
-
-config CPU_NUC960
-	bool
-	help
-	  Support for NUCP960 of Nuvoton NUC900 CPUs.
+if ARCH_NUC900 || ARCH_W90X900_SINGLE
 
 config SOC_NUC970
 	bool "Nuvoton NUC970 SoC support"
+	select ARCH_W90X900
 	select COMMON_CLK
 	select GENERIC_IRQ_CHIP
 	select HAVE_CLK_PREPARE
@@ -35,6 +25,27 @@ config SOC_NUC970
 	  https://github.com/zswan/nuc900-document/blob/master/
 	  NUC970_TechnicalReferenceManual_EN_Rev1.30.pdf
 
+config ARCH_W90X900
+	def_bool ARCH_W90X900_SINGLE || ARCH_NUC900
+
+config CPU_W90P910
+	bool
+	select ARCH_W90X900
+	help
+	  Support for W90P910 of Nuvoton W90X900 CPUs.
+
+config CPU_NUC950
+	bool
+	select ARCH_W90X900
+	help
+	  Support for NUCP950 of Nuvoton NUC900 CPUs.
+
+config CPU_NUC960
+	bool
+	select ARCH_W90X900
+	help
+	  Support for NUCP960 of Nuvoton NUC900 CPUs.
+
 menu "W90P910 Machines"
 
 config MACH_W90P910EVB
diff --git a/arch/arm/mach-w90x900/Makefile b/arch/arm/mach-w90x900/Makefile
index d13ba5adb74b..f93996785494 100644
--- a/arch/arm/mach-w90x900/Makefile
+++ b/arch/arm/mach-w90x900/Makefile
@@ -4,10 +4,12 @@
 
 # Object file lists.
 
-ifeq ($(CONFIG_SOC_NUC970),)
-obj-y				:= irq.o time.o mfp.o gpio.o clock.o
-obj-y				+= clksel.o dev.o cpu.o
+obj-y				+= mfp.o irq.o time.o gpio.o dev.o cpu.o
+
+ifndef CONFIG_COMMON_CLK
+obj-y				+= clksel.o clock.o
 endif
+
 # W90X900 CPU support files
 
 obj-$(CONFIG_CPU_W90P910)	+= nuc910.o
diff --git a/arch/arm/mach-w90x900/cpu.c b/arch/arm/mach-w90x900/cpu.c
index 7a9bbc75ad9b..1bc92485eca5 100644
--- a/arch/arm/mach-w90x900/cpu.c
+++ b/arch/arm/mach-w90x900/cpu.c
@@ -52,6 +52,7 @@ static struct map_desc nuc900_iodesc[] __initdata = {
 	IODESC_ENT(GPIO),
 };
 
+#ifndef CONFIG_COMMON_CLK
 /* Initial clock declarations. */
 static DEFINE_CLK(lcd, 0);
 static DEFINE_CLK(audio, 1);
@@ -106,6 +107,7 @@ static struct clk_lookup nuc900_clkregs[] = {
 	DEF_CLKLOOK(&clk_timer3, NULL, "timer3"),
 	DEF_CLKLOOK(&clk_timer4, NULL, "timer4"),
 };
+#endif
 
 /* Initial serial platform data */
 
@@ -122,6 +124,7 @@ struct platform_device nuc900_serial_device = {
 	},
 };
 
+#ifndef CONFIG_COMMON_CLK
 /*Set NUC900 series cpu frequence*/
 static int __init nuc900_set_clkval(unsigned int cpufreq)
 {
@@ -199,6 +202,7 @@ static int __init nuc900_set_cpufreq(char *str)
 }
 
 __setup("cpufreq=", nuc900_set_cpufreq);
+#endif
 
 /*Init NUC900 evb io*/
 
@@ -222,10 +226,12 @@ void __init nuc900_map_io(struct map_desc *mach_desc, int mach_size)
 
 /*Init NUC900 clock*/
 
+#ifndef CONFIG_COMMON_CLK
 void __init nuc900_init_clocks(void)
 {
 	clkdev_add_table(nuc900_clkregs, ARRAY_SIZE(nuc900_clkregs));
 }
+#endif
 
 #define	WTCR	(TMR_BA + 0x1C)
 #define	WTCLK	(1 << 10)
diff --git a/arch/arm/mach-w90x900/cpu.h b/arch/arm/mach-w90x900/cpu.h
index f8730b60bd76..407f5edd8af6 100644
--- a/arch/arm/mach-w90x900/cpu.h
+++ b/arch/arm/mach-w90x900/cpu.h
@@ -46,7 +46,11 @@
 /* extern file from cpu.c */
 
 extern void nuc900_clock_source(struct device *dev, unsigned char *src);
+#ifdef CONFIG_COMMON_CLK
+static inline void nuc900_init_clocks(void) {}
+#else
 extern void nuc900_init_clocks(void);
+#endif
 extern void nuc900_map_io(struct map_desc *mach_desc, int mach_size);
 extern void nuc900_board_init(struct platform_device **device, int size);
 
-- 
2.9.0

^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2016-07-14 11:11 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-07-14 11:11 [PATCH 1/7] ARM: nuc900: move regs-ldm.h to video driver Arnd Bergmann
2016-07-14 11:11 ` [PATCH 2/7] ARM: nuc900: avoid ASoC header dependency Arnd Bergmann
2016-07-14 11:11 ` [PATCH 3/7] ARM: nuc900: use MULTI_IRQ_HANDLER Arnd Bergmann
2016-07-14 11:11 ` [PATCH 4/7] ARM: nuc900: make most header files local Arnd Bergmann
2016-07-14 11:11 ` [PATCH 5/7] ARM: nuc900: move most of mach/irqs.h Arnd Bergmann
2016-07-14 11:11 ` [PATCH 6/7] ARM: nuc900: use SPARSE_IRQ Arnd Bergmann
2016-07-14 11:11 ` [PATCH 7/7] ARM: nuc900: make NUC970 multiplatform Arnd Bergmann

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).