Skip to contentSkip to conversation

ARM: nuc900: move regs-ldm.h to video driver

PATCH New Arnd Bergmann 1 participant 7 messages Jul 14, 2016

Subsystems (6)
lore
Share & tools
lore
#0 lore raw

PATCH 1/7 ARM: nuc900: move regs-ldm.h to video driver

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.

---
 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%)
arch/arm/mach-w90x900/dev.c +2 -1
index e65a80a1ac75..ea84f053bcd3 100644
@@ -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,
 };
drivers/video/fbdev/nuc900fb-regs.h renamed from arch/arm/mach-w90x900/include/mach/regs-ldm.h +0 -15
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
@@ -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)
 
drivers/video/fbdev/nuc900fb.c +3 -5
index 6680edae4696..d29777d85518 100644
@@ -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;
drivers/video/fbdev/nuc900fb.h +0 -1
index 9a1ca6dbb6b2..a904ef17c122 100644
@@ -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 {
include/linux/platform_data/video-nuc900fb.h +13 -1
index cec5ece765ed..dbce9dd7a294 100644
@@ -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;
 };
Signature · 1 line
2.9.0
#1 lore raw

PATCH 2/7 ARM: nuc900: avoid ASoC header dependency

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.

---
 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(-)
arch/arm/mach-w90x900/dev.c +1 -0
index ea84f053bcd3..9c9292feb066 100644
@@ -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,
 	}
 };
 
sound/soc/nuc900/nuc900-ac97.c +4 -2
index b6615affe571..04bb89f0b6a4 100644
@@ -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);
 
sound/soc/nuc900/nuc900-pcm.c +0 -2
index 2cca055fd806..70883ec94f89 100644
@@ -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 = {
Signature · 1 line
2.9.0
#2 lore raw

PATCH 3/7 ARM: nuc900: use MULTI_IRQ_HANDLER

In reply to Arnd Bergmann

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.

---
 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
arch/arm/Kconfig +1 -0
index 36f721c2eb97..908694886088 100644
@@ -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
arch/arm/mach-w90x900/include/mach/entry-macro.S deleted +0 -26
deleted file mode 100644
index 0ff612ac95ba..000000000000
@@ -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
arch/arm/mach-w90x900/irq.c +13 -0
index 491b317daffa..6ef0ae50a23f 100644
@@ -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++) {
Signature · 1 line
2.9.0
#3 lore raw

PATCH 4/7 ARM: nuc900: make most header files local

In reply to Arnd Bergmann

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.

---
 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%)
arch/arm/mach-w90x900/clksel.c +2 -2
index 06d867dce551..ae9d53e09b60 100644
@@ -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
arch/arm/mach-w90x900/clock.c +1 -1
index 8b196d094daa..a143d4b8ab38 100644
@@ -21,7 +21,7 @@
 #include <linux/platform_device.h>
 #include <linux/io.h>
 
-#include <mach/hardware.h>
+#include "map.h"
 
 #include "clock.h"
 
arch/arm/mach-w90x900/cpu.c +3 -3
index ca763251ffe0..d96d0e3eb7a6 100644
@@ -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"
 
arch/arm/mach-w90x900/dev.c +1 -2
index 9c9292feb066..f9f3aa46b1af 100644
@@ -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 */
arch/arm/mach-w90x900/gpio.c +1 -1
index 55d1a00dbd28..ae039e1ca465 100644
@@ -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)
arch/arm/mach-w90x900/include/mach/hardware.h deleted +0 -24
deleted file mode 100644
index fe3c6265a466..000000000000
@@ -1,24 +0,0 @@
-/*
- * arch/arm/mach-w90x900/include/mach/hardware.h
- *
- * Copyright (c) 2008 Nuvoton technology corporation
- * All rights reserved.
- *
- * Wan ZongShun <[email protected]>
- *
- * 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 */
arch/arm/mach-w90x900/include/mach/uncompress.h +3 -2
index 3855ecebda6e..a1b6ea95e658 100644
@@ -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)
arch/arm/mach-w90x900/irq.c +2 -3
index 6ef0ae50a23f..2a6fe35b76e7 100644
@@ -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 {
arch/arm/mach-w90x900/mach-nuc910evb.c +1 -1
index 92f1c978f35e..e9631784493e 100644
@@ -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)
arch/arm/mach-w90x900/mach-nuc950evb.c +1 -1
index 26f7189056e3..eb8865b09288 100644
@@ -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)
arch/arm/mach-w90x900/mach-nuc960evb.c +1 -1
index 9b4e73fe10e5..d7b97913af7b 100644
@@ -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)
arch/arm/mach-w90x900/map.h renamed from arch/arm/mach-w90x900/include/mach/map.h +0 -0
similarity index 100%
rename from arch/arm/mach-w90x900/include/mach/map.h
rename to arch/arm/mach-w90x900/map.h
arch/arm/mach-w90x900/mfp.c +1 -1
index c58d142b8a46..0d985ff0c57d 100644
@@ -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)
 
arch/arm/mach-w90x900/mfp.h renamed from arch/arm/mach-w90x900/include/mach/mfp.h +0 -0
similarity index 100%
rename from arch/arm/mach-w90x900/include/mach/mfp.h
rename to arch/arm/mach-w90x900/mfp.h
arch/arm/mach-w90x900/nuc910.c +1 -1
index 1523f4136985..59d865c6abfe 100644
@@ -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"
 
arch/arm/mach-w90x900/nuc950.c +1 -1
index 5704f74a50ee..340e1a067d3c 100644
@@ -17,7 +17,7 @@
 
 #include <linux/platform_device.h>
 #include <asm/mach/map.h>
-#include <mach/hardware.h>
+#include "map.h"
 
 #include "cpu.h"
 
arch/arm/mach-w90x900/nuc960.c +1 -1
index 8851a3a27ce2..f01571f8c1f2 100644
@@ -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 */
arch/arm/mach-w90x900/regs-clock.h renamed from arch/arm/mach-w90x900/include/mach/regs-clock.h +0 -2
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
@@ -1,6 +1,4 @@
 /*
- * arch/arm/mach-w90x900/include/mach/regs-clock.h
- *
  * Copyright (c) 2008 Nuvoton technology corporation.
  *
  * Wan ZongShun <[email protected]>
arch/arm/mach-w90x900/regs-irq.h renamed from arch/arm/mach-w90x900/include/mach/regs-irq.h +0 -2
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
@@ -1,6 +1,4 @@
 /*
- * arch/arm/mach-w90x900/include/mach/regs-irq.h
- *
  * Copyright (c) 2008 Nuvoton technology corporation
  * All rights reserved.
  *
arch/arm/mach-w90x900/regs-serial.h renamed from arch/arm/mach-w90x900/include/mach/regs-serial.h +0 -2
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
@@ -1,6 +1,4 @@
 /*
- * arch/arm/mach-w90x900/include/mach/regs-serial.h
- *
  * Copyright (c) 2008 Nuvoton technology corporation
  * All rights reserved.
  *
arch/arm/mach-w90x900/time.c +1 -2
index cda085245e34..0129f5e92f3e 100644
@@ -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
Signature · 1 line
2.9.0
#4 lore raw

PATCH 5/7 ARM: nuc900: move most of mach/irqs.h

In reply to Arnd Bergmann

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.

---
 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
arch/arm/mach-w90x900/cpu.c +1 -0
index d96d0e3eb7a6..7a9bbc75ad9b 100644
@@ -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"
arch/arm/mach-w90x900/dev.c +1 -0
index f9f3aa46b1af..027062b38626 100644
@@ -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"
 
arch/arm/mach-w90x900/include/mach/irqs.h +0 -86

91 lines not on this page · raw message

arch/arm/mach-w90x900/irq.c +1 -0
index 2a6fe35b76e7..42d9af897c42 100644
@@ -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"
arch/arm/mach-w90x900/irq.h new file +85 -0

85 lines not on this page · raw message

arch/arm/mach-w90x900/time.c +1 -0
index 0129f5e92f3e..cb45df22ce2c 100644
@@ -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"
Signature · 1 line
2.9.0
#5 lore raw

PATCH 6/7 ARM: nuc900: use SPARSE_IRQ

In reply to Arnd Bergmann

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.

---
 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
arch/arm/Kconfig +1 -0
index 908694886088..160dbf993660 100644
@@ -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
arch/arm/mach-w90x900/include/mach/irqs.h deleted +0 -5
deleted file mode 100644
index 277903857030..000000000000
@@ -1,5 +0,0 @@
-#if !defined(CONFIG_SOC_NUC900)
-#define NR_IRQS		(IRQ_ADC+1)
-#else
-#define NR_IRQS		62
-#endif
arch/arm/mach-w90x900/irq.c +21 -1
index 42d9af897c42..726f646c992b 100644
@@ -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++) {
drivers/irqchip/irq-nuc900.c +1 -1
index c4b2e39f7662..a595139f2f9c 100644
@@ -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) {
Signature · 1 line
2.9.0
#6 lore raw

PATCH 7/7 ARM: nuc900: make NUC970 multiplatform

In reply to Arnd Bergmann

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.

---
 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(-)
arch/arm/Kconfig +1 -1
index 160dbf993660..2a3113bd437a 100644
@@ -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
arch/arm/configs/nuc910_defconfig +1 -1
index 10180cfde162..bb229dab9d72 100644
@@ -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"
arch/arm/configs/nuc950_defconfig +1 -1
index 27aa8731330b..b3b43f0f2238 100644
@@ -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
arch/arm/configs/nuc960_defconfig +1 -1
index 56fd7ad0ff13..4c6b0315a49b 100644
@@ -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
arch/arm/configs/nuc970_defconfig +3 -1
index b39a406c6495..972e3286eaf8 100644
@@ -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
arch/arm/mach-w90x900/Kconfig +26 -15

54 lines not on this page · raw message

arch/arm/mach-w90x900/Makefile +5 -3
index d13ba5adb74b..f93996785494 100644
@@ -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
arch/arm/mach-w90x900/cpu.c +6 -0
index 7a9bbc75ad9b..1bc92485eca5 100644
@@ -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)
arch/arm/mach-w90x900/cpu.h +4 -0
index f8730b60bd76..407f5edd8af6 100644
@@ -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);
 
Signature · 1 line
2.9.0