[PATCH 05/10] ARM: s3c64xx: enable sparse IRQ support

2015-11-25 Thread Arnd Bergmann
This is another prerequisite for enabling multiplatform
support, and it is the part I am least certain about.

I assume it will cause the extra boot message "Cannot
allocate irq_descs @ IRQ%d, assuming pre-allocated" to
be printed, but otherwise work ok. This definitely needs
to be tested on real hardware to see if it works.

Signed-off-by: Arnd Bergmann 
---
 arch/arm/Kconfig |  1 +
 arch/arm/mach-s3c64xx/common.c   |  1 +
 arch/arm/mach-s3c64xx/dev-uart.c |  1 +
 arch/arm/mach-s3c64xx/include/mach/irqs.h| 20 +++-
 arch/arm/mach-s3c64xx/include/mach/pm-core.h |  1 +
 arch/arm/mach-s3c64xx/mach-anw6410.c |  3 ++-
 arch/arm/mach-s3c64xx/mach-crag6410-module.c |  2 ++
 arch/arm/mach-s3c64xx/mach-crag6410.c|  2 ++
 arch/arm/mach-s3c64xx/mach-hmt.c |  2 ++
 arch/arm/mach-s3c64xx/mach-mini6410.c|  2 ++
 arch/arm/mach-s3c64xx/mach-ncp.c |  2 ++
 arch/arm/mach-s3c64xx/mach-real6410.c|  3 ++-
 arch/arm/mach-s3c64xx/mach-smartq5.c |  2 ++
 arch/arm/mach-s3c64xx/mach-smartq7.c |  2 ++
 arch/arm/mach-s3c64xx/mach-smdk6400.c|  3 ++-
 arch/arm/mach-s3c64xx/mach-smdk6410.c|  3 ++-
 arch/arm/plat-samsung/gpio-samsung.c |  1 +
 17 files changed, 30 insertions(+), 21 deletions(-)

diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 83f42877328d..1ec6a153d8e5 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -649,6 +649,7 @@ config ARCH_S3C64XX
select SAMSUNG_ATAGS
select SAMSUNG_WAKEMASK
select SAMSUNG_WDT_RESET
+   select SPARSE_IRQ
help
  Samsung S3C64XX series based systems
 
diff --git a/arch/arm/mach-s3c64xx/common.c b/arch/arm/mach-s3c64xx/common.c
index 3dea4a4ef165..7c66ce1a6bb6 100644
--- a/arch/arm/mach-s3c64xx/common.c
+++ b/arch/arm/mach-s3c64xx/common.c
@@ -39,6 +39,7 @@
 #include 
 
 #include 
+#include 
 #include 
 #include 
 #include 
diff --git a/arch/arm/mach-s3c64xx/dev-uart.c b/arch/arm/mach-s3c64xx/dev-uart.c
index 46e18d77ea93..a0b4f0329811 100644
--- a/arch/arm/mach-s3c64xx/dev-uart.c
+++ b/arch/arm/mach-s3c64xx/dev-uart.c
@@ -23,6 +23,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 
diff --git a/arch/arm/mach-s3c64xx/include/mach/irqs.h 
b/arch/arm/mach-s3c64xx/include/mach/irqs.h
index 67bbd1dd04c2..3ceb00b5de07 100644
--- a/arch/arm/mach-s3c64xx/include/mach/irqs.h
+++ b/arch/arm/mach-s3c64xx/include/mach/irqs.h
@@ -156,25 +156,11 @@
 
 #define IRQ_EINT_GROUP(group, no)  (IRQ_EINT_GROUP##group##_BASE + (no))
 
-/* Define a group of interrupts for board-specific use (eg, for MFD
- * interrupt controllers). */
+/* Some boards have their own IRQs behind this */
 #define IRQ_BOARD_START (IRQ_EINT_GROUP9_BASE + IRQ_EINT_GROUP9_NR + 1)
 
-#ifdef CONFIG_MACH_WLF_CRAGG_6410
-#define IRQ_BOARD_NR 160
-#elif defined(CONFIG_SMDK6410_WM1190_EV1)
-#define IRQ_BOARD_NR 64
-#elif defined(CONFIG_SMDK6410_WM1192_EV1)
-#define IRQ_BOARD_NR 64
-#else
-#define IRQ_BOARD_NR 16
-#endif
-
-#define IRQ_BOARD_END (IRQ_BOARD_START + IRQ_BOARD_NR)
-
-/* Set the default NR_IRQS */
-
-#define NR_IRQS(IRQ_BOARD_END + 1)
+/* Set the default nr_irqs, boards can override if necessary */
+#define S3C64XX_NR_IRQSIRQ_BOARD_START
 
 /* Compatibility */
 
diff --git a/arch/arm/mach-s3c64xx/include/mach/pm-core.h 
b/arch/arm/mach-s3c64xx/include/mach/pm-core.h
index a30a1e3ffc6a..32d2ff54f82d 100644
--- a/arch/arm/mach-s3c64xx/include/mach/pm-core.h
+++ b/arch/arm/mach-s3c64xx/include/mach/pm-core.h
@@ -18,6 +18,7 @@
 #include 
 
 #include 
+#include 
 
 static inline void s3c_pm_debug_init_uart(void)
 {
diff --git a/arch/arm/mach-s3c64xx/mach-anw6410.c 
b/arch/arm/mach-s3c64xx/mach-anw6410.c
index 6224c67f5061..347ce6009a8c 100644
--- a/arch/arm/mach-s3c64xx/mach-anw6410.c
+++ b/arch/arm/mach-s3c64xx/mach-anw6410.c
@@ -47,6 +47,7 @@
 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -229,7 +230,7 @@ static void __init anw6410_machine_init(void)
 MACHINE_START(ANW6410, "A")
/* Maintainer: Kwangwoo Lee  */
.atag_offset= 0x100,
-
+   .nr_irqs= S3C64XX_NR_IRQS,
.init_irq   = s3c6410_init_irq,
.map_io = anw6410_map_io,
.init_machine   = anw6410_machine_init,
diff --git a/arch/arm/mach-s3c64xx/mach-crag6410-module.c 
b/arch/arm/mach-s3c64xx/mach-crag6410-module.c
index be21f06e6b3f..571f95cc5a53 100644
--- a/arch/arm/mach-s3c64xx/mach-crag6410-module.c
+++ b/arch/arm/mach-s3c64xx/mach-crag6410-module.c
@@ -30,6 +30,8 @@
 #include 
 
 #include 
+#include 
+
 #include "crag6410.h"
 
 static struct s3c64xx_spi_csinfo wm0010_spi_csinfo = {
diff --git a/arch/arm/mach-s3c64xx/mach-crag6410.c 
b/arch/arm/mach-s3c64xx/mach-crag6410.c
index f776adcdaee8..a237b9b117b5 100644
--- a/arch/arm/mach-s3c64xx/mach-crag6410.c
+++ b/arch/arm/mach-s3c64xx/mach-crag6410.c
@@ -52,6 

Re: [PATCH 05/10] ARM: s3c64xx: enable sparse IRQ support

2015-03-21 Thread Charles Keepax
On Wed, Mar 18, 2015 at 12:02:34AM +, Mark Brown wrote:
 On Sun, Mar 08, 2015 at 10:42:59PM +0100, Arnd Bergmann wrote:
  On Friday 06 March 2015 17:43:16 Charles Keepax wrote:
  diff --git a/arch/arm/mach-s3c64xx/mach-crag6410.c 
  b/arch/arm/mach-s3c64xx/mach-crag6410.c
  index f395a5617142..cbe353a5450e 100644
  --- a/arch/arm/mach-s3c64xx/mach-crag6410.c
  +++ b/arch/arm/mach-s3c64xx/mach-crag6410.c
  @@ -855,7 +855,7 @@ static void __init crag6410_machine_init(void)
   MACHINE_START(WLF_CRAGG_6410, Wolfson Cragganmore 6410)
  /* Maintainer: Mark Brown broo...@opensource.wolfsonmicro.com */
  .atag_offset= 0x100,
  -   .nr_irqs= S3C64XX_NR_IRQS + 160,
  +   .nr_irqs= S3C64XX_NR_IRQS,
  .init_irq   = s3c6410_init_irq,
  .map_io = crag6410_map_io,
  .init_machine   = crag6410_machine_init,
 
  The samsung-gpio driver does not allocate irq descriptors for itself
  though, otherwise we could make the S3C64XX_NR_IRQS number smaller.
 
 That's not the only thing, I'm still seeing an issue even with the
 change above.  The VICs are also complaining about preallocated
 descriptors, but they just assume the descriptors were preallocated and
 carry on happily.  I'd also expect this to be affecting both wm831xs but
 it's only affecting the WM8311 on the base board, not the primary
 WM8312, so this seems to be a red herring.
 
 I rather suspect that the issue is at least partly that the interrupt
 numbering is off - the CODEC has 24 interrupts allocated to it in
 crag6410.h which is nowhere near enough and the PMICs have 32 each
 rather than the 58 they need.  This is broken for the existing code too
 so we should get a fix to make that right in before anything else.  A
 trivial change to fix that doesn't seem to have helped though but I
 probably just miscounted or something.

Ok guys very sorry about the massive delay in looking at this
again, I have been a bit swamped lately. I think I see what is
going on here.

The fix from Arnd there definitely helped, but still doesn't
quite work and those defines you are talking about there are
actually for the GPIOs so they are a bit of a red herring. There
are two PMICs as you mention one of which is given a fixed IRQ
base and the other which allocates it own. The problem appears to
be that the one which allocates its own IRQ base takes the space
that is specified as the fixed base for the other PMIC. Which
then fails to allocate its IRQs.

So adding a bit of an offset into the PMIC with the fixed IRQ
base fixes the problem. Although I am not sure if it would be
better to move both PMICs onto a fixed IRQ base so there is no
chance of the clashing. Any thoughts?

Thanks,
Charles

Applying this diff, on top of Arnd's fixup, gets everything
working for me:

diff --git a/arch/arm/mach-s3c64xx/crag6410.h
b/arch/arm/mach-s3c64xx/crag6410.h
index 7bc6668..59c5f44 100644
--- a/arch/arm/mach-s3c64xx/crag6410.h
+++ b/arch/arm/mach-s3c64xx/crag6410.h
@@ -13,7 +13,7 @@

 #include mach/gpio-samsung.h

-#define GLENFARCLAS_PMIC_IRQ_BASE  IRQ_BOARD_START
+#define GLENFARCLAS_PMIC_IRQ_BASE  IRQ_BOARD_START + 256
--
To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 05/10] ARM: s3c64xx: enable sparse IRQ support

2015-03-21 Thread Mark Brown
On Sat, Mar 21, 2015 at 04:38:21PM +, Charles Keepax wrote:

 So adding a bit of an offset into the PMIC with the fixed IRQ
 base fixes the problem. Although I am not sure if it would be
 better to move both PMICs onto a fixed IRQ base so there is no
 chance of the clashing. Any thoughts?

Yes, that sounds like the safest thing.


signature.asc
Description: Digital signature


Re: [PATCH 05/10] ARM: s3c64xx: enable sparse IRQ support

2015-03-21 Thread Arnd Bergmann
On Wednesday 18 March 2015, Mark Brown wrote:
 On Sun, Mar 08, 2015 at 10:42:59PM +0100, Arnd Bergmann wrote:

  diff --git a/arch/arm/mach-s3c64xx/mach-crag6410.c 
  b/arch/arm/mach-s3c64xx/mach-crag6410.c
  index f395a5617142..cbe353a5450e 100644
  --- a/arch/arm/mach-s3c64xx/mach-crag6410.c
  +++ b/arch/arm/mach-s3c64xx/mach-crag6410.c
  @@ -855,7 +855,7 @@ static void __init crag6410_machine_init(void)
   MACHINE_START(WLF_CRAGG_6410, Wolfson Cragganmore 6410)
/* Maintainer: Mark Brown broo...@opensource.wolfsonmicro.com */
.atag_offset= 0x100,
  - .nr_irqs= S3C64XX_NR_IRQS + 160,
  + .nr_irqs= S3C64XX_NR_IRQS,
.init_irq   = s3c6410_init_irq,
.map_io = crag6410_map_io,
.init_machine   = crag6410_machine_init,
 
  The samsung-gpio driver does not allocate irq descriptors for itself
  though, otherwise we could make the S3C64XX_NR_IRQS number smaller.
 
 That's not the only thing, I'm still seeing an issue even with the
 change above.  The VICs are also complaining about preallocated
 descriptors, but they just assume the descriptors were preallocated and
 carry on happily.

Yes, that is the behavior I expected to see. The VIC driver would be
fine in theory with allocating the descriptors dynamically, but
the secondary irqchip (s3c_irq_eint) would need significant changes.

IIRC, another problem is the way that the first NR_IRQS_LEGACY interrupts
are always preallocated, but would not need to, once we fix the eint.
Arnd
--
To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 05/10] ARM: s3c64xx: enable sparse IRQ support

2015-03-17 Thread Mark Brown
On Sun, Mar 08, 2015 at 10:42:59PM +0100, Arnd Bergmann wrote:
 On Friday 06 March 2015 17:43:16 Charles Keepax wrote:

  This one appears to cause some problems with the IRQs on
  Cragganmore, I need to look into it a bit more but it looks like
  one of the PMICs can't allocate its IRQs:

  [0.961455] wm831x 1-0034: WM8311 revision C
  [0.965066] wm831x 1-0034: Failed to allocate IRQs: -17

  And the CODEC can't request its IRQ:

  [4.252735] arizona spi0.1: WM5102 revision C
  [4.269763] arizona spi0.1: Failed to request primary IRQ 263: -22

  Hopefully I can look into this a little more next week.

 My interpretation is that I mistakenly set the .nr_irqs value for
 craggamore to include all irqs that the board has, while the
 wm831x tries to allocate the irq descriptors itself and fails if
 they are already allocated. If that is the only problem here, it
 would get fixed by this change:

 diff --git a/arch/arm/mach-s3c64xx/mach-crag6410.c 
 b/arch/arm/mach-s3c64xx/mach-crag6410.c
 index f395a5617142..cbe353a5450e 100644
 --- a/arch/arm/mach-s3c64xx/mach-crag6410.c
 +++ b/arch/arm/mach-s3c64xx/mach-crag6410.c
 @@ -855,7 +855,7 @@ static void __init crag6410_machine_init(void)
  MACHINE_START(WLF_CRAGG_6410, Wolfson Cragganmore 6410)
   /* Maintainer: Mark Brown broo...@opensource.wolfsonmicro.com */
   .atag_offset= 0x100,
 - .nr_irqs= S3C64XX_NR_IRQS + 160,
 + .nr_irqs= S3C64XX_NR_IRQS,
   .init_irq   = s3c6410_init_irq,
   .map_io = crag6410_map_io,
   .init_machine   = crag6410_machine_init,

 The samsung-gpio driver does not allocate irq descriptors for itself
 though, otherwise we could make the S3C64XX_NR_IRQS number smaller.

That's not the only thing, I'm still seeing an issue even with the
change above.  The VICs are also complaining about preallocated
descriptors, but they just assume the descriptors were preallocated and
carry on happily.  I'd also expect this to be affecting both wm831xs but
it's only affecting the WM8311 on the base board, not the primary
WM8312, so this seems to be a red herring.

I rather suspect that the issue is at least partly that the interrupt
numbering is off - the CODEC has 24 interrupts allocated to it in
crag6410.h which is nowhere near enough and the PMICs have 32 each
rather than the 58 they need.  This is broken for the existing code too
so we should get a fix to make that right in before anything else.  A
trivial change to fix that doesn't seem to have helped though but I
probably just miscounted or something.


signature.asc
Description: Digital signature


Re: [PATCH 05/10] ARM: s3c64xx: enable sparse IRQ support

2015-03-08 Thread Arnd Bergmann
On Friday 06 March 2015 17:43:16 Charles Keepax wrote:
 On Mon, Mar 02, 2015 at 01:35:58PM +0100, Arnd Bergmann wrote:
  This is another prerequisite for enabling multiplatform
  support, and it is the part I am least certain about.
  
  I assume it will cause the extra boot message Cannot
  allocate irq_descs @ IRQ%d, assuming pre-allocated to
  be printed, but otherwise work ok. This definitely needs
  to be tested on real hardware to see if it works.
  
  Signed-off-by: Arnd Bergmann a...@arndb.de
  ---
 
 This one appears to cause some problems with the IRQs on
 Cragganmore, I need to look into it a bit more but it looks like
 one of the PMICs can't allocate its IRQs:
 
 [0.961455] wm831x 1-0034: WM8311 revision C
 [0.965066] wm831x 1-0034: Failed to allocate IRQs: -17
 
 And the CODEC can't request its IRQ:
 
 [4.252735] arizona spi0.1: WM5102 revision C
 [4.269763] arizona spi0.1: Failed to request primary IRQ 263: -22
 
 Hopefully I can look into this a little more next week.
 

My interpretation is that I mistakenly set the .nr_irqs value for
craggamore to include all irqs that the board has, while the
wm831x tries to allocate the irq descriptors itself and fails if
they are already allocated. If that is the only problem here, it
would get fixed by this change:

diff --git a/arch/arm/mach-s3c64xx/mach-crag6410.c 
b/arch/arm/mach-s3c64xx/mach-crag6410.c
index f395a5617142..cbe353a5450e 100644
--- a/arch/arm/mach-s3c64xx/mach-crag6410.c
+++ b/arch/arm/mach-s3c64xx/mach-crag6410.c
@@ -855,7 +855,7 @@ static void __init crag6410_machine_init(void)
 MACHINE_START(WLF_CRAGG_6410, Wolfson Cragganmore 6410)
/* Maintainer: Mark Brown broo...@opensource.wolfsonmicro.com */
.atag_offset= 0x100,
-   .nr_irqs= S3C64XX_NR_IRQS + 160,
+   .nr_irqs= S3C64XX_NR_IRQS,
.init_irq   = s3c6410_init_irq,
.map_io = crag6410_map_io,
.init_machine   = crag6410_machine_init,

The samsung-gpio driver does not allocate irq descriptors for itself
though, otherwise we could make the S3C64XX_NR_IRQS number smaller.

Arnd
--
To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 05/10] ARM: s3c64xx: enable sparse IRQ support

2015-03-08 Thread Mark Brown
On Fri, Mar 06, 2015 at 05:43:16PM +, Charles Keepax wrote:

 Cragganmore, I need to look into it a bit more but it looks like
 one of the PMICs can't allocate its IRQs:

 [0.961455] wm831x 1-0034: WM8311 revision C
 [0.965066] wm831x 1-0034: Failed to allocate IRQs: -17

 And the CODEC can't request its IRQ:

 [4.252735] arizona spi0.1: WM5102 revision C
 [4.269763] arizona spi0.1: Failed to request primary IRQ 263: -22

 Hopefully I can look into this a little more next week.

The second is a knock on from the first - the CODEC interrupt line is
connected to the PMIC so since the PMIC can't allocate its IRQ range the
CODEC can't request it.


signature.asc
Description: Digital signature


Re: [PATCH 05/10] ARM: s3c64xx: enable sparse IRQ support

2015-03-06 Thread Charles Keepax
On Mon, Mar 02, 2015 at 01:35:58PM +0100, Arnd Bergmann wrote:
 This is another prerequisite for enabling multiplatform
 support, and it is the part I am least certain about.
 
 I assume it will cause the extra boot message Cannot
 allocate irq_descs @ IRQ%d, assuming pre-allocated to
 be printed, but otherwise work ok. This definitely needs
 to be tested on real hardware to see if it works.
 
 Signed-off-by: Arnd Bergmann a...@arndb.de
 ---

This one appears to cause some problems with the IRQs on
Cragganmore, I need to look into it a bit more but it looks like
one of the PMICs can't allocate its IRQs:

[0.961455] wm831x 1-0034: WM8311 revision C
[0.965066] wm831x 1-0034: Failed to allocate IRQs: -17

And the CODEC can't request its IRQ:

[4.252735] arizona spi0.1: WM5102 revision C
[4.269763] arizona spi0.1: Failed to request primary IRQ 263: -22

Hopefully I can look into this a little more next week.

Thanks,
Charles
--
To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 05/10] ARM: s3c64xx: enable sparse IRQ support

2015-03-02 Thread Arnd Bergmann
This is another prerequisite for enabling multiplatform
support, and it is the part I am least certain about.

I assume it will cause the extra boot message Cannot
allocate irq_descs @ IRQ%d, assuming pre-allocated to
be printed, but otherwise work ok. This definitely needs
to be tested on real hardware to see if it works.

Signed-off-by: Arnd Bergmann a...@arndb.de
---
 arch/arm/Kconfig |  1 +
 arch/arm/mach-s3c64xx/common.c   |  1 +
 arch/arm/mach-s3c64xx/dev-uart.c |  1 +
 arch/arm/mach-s3c64xx/include/mach/irqs.h| 20 +++-
 arch/arm/mach-s3c64xx/include/mach/pm-core.h |  1 +
 arch/arm/mach-s3c64xx/mach-anw6410.c |  3 ++-
 arch/arm/mach-s3c64xx/mach-crag6410-module.c |  2 ++
 arch/arm/mach-s3c64xx/mach-crag6410.c|  2 ++
 arch/arm/mach-s3c64xx/mach-hmt.c |  2 ++
 arch/arm/mach-s3c64xx/mach-mini6410.c|  2 ++
 arch/arm/mach-s3c64xx/mach-ncp.c |  2 ++
 arch/arm/mach-s3c64xx/mach-real6410.c|  3 ++-
 arch/arm/mach-s3c64xx/mach-smartq5.c |  2 ++
 arch/arm/mach-s3c64xx/mach-smartq7.c |  2 ++
 arch/arm/mach-s3c64xx/mach-smdk6400.c|  3 ++-
 arch/arm/mach-s3c64xx/mach-smdk6410.c|  3 ++-
 arch/arm/plat-samsung/gpio-samsung.c |  1 +
 17 files changed, 30 insertions(+), 21 deletions(-)

diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 98f113833465..a6f71e402b38 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -709,6 +709,7 @@ config ARCH_S3C64XX
select SAMSUNG_ATAGS
select SAMSUNG_WAKEMASK
select SAMSUNG_WDT_RESET
+   select SPARSE_IRQ
help
  Samsung S3C64XX series based systems
 
diff --git a/arch/arm/mach-s3c64xx/common.c b/arch/arm/mach-s3c64xx/common.c
index cca29aa49fd3..971b4799f16d 100644
--- a/arch/arm/mach-s3c64xx/common.c
+++ b/arch/arm/mach-s3c64xx/common.c
@@ -40,6 +40,7 @@
 #include asm/system_misc.h
 
 #include mach/map.h
+#include mach/irqs.h
 #include mach/hardware.h
 #include mach/regs-gpio.h
 #include mach/gpio-samsung.h
diff --git a/arch/arm/mach-s3c64xx/dev-uart.c b/arch/arm/mach-s3c64xx/dev-uart.c
index 46e18d77ea93..a0b4f0329811 100644
--- a/arch/arm/mach-s3c64xx/dev-uart.c
+++ b/arch/arm/mach-s3c64xx/dev-uart.c
@@ -23,6 +23,7 @@
 #include asm/mach/irq.h
 #include mach/hardware.h
 #include mach/map.h
+#include mach/irqs.h
 
 #include plat/devs.h
 
diff --git a/arch/arm/mach-s3c64xx/include/mach/irqs.h 
b/arch/arm/mach-s3c64xx/include/mach/irqs.h
index 67bbd1dd04c2..3ceb00b5de07 100644
--- a/arch/arm/mach-s3c64xx/include/mach/irqs.h
+++ b/arch/arm/mach-s3c64xx/include/mach/irqs.h
@@ -156,25 +156,11 @@
 
 #define IRQ_EINT_GROUP(group, no)  (IRQ_EINT_GROUP##group##_BASE + (no))
 
-/* Define a group of interrupts for board-specific use (eg, for MFD
- * interrupt controllers). */
+/* Some boards have their own IRQs behind this */
 #define IRQ_BOARD_START (IRQ_EINT_GROUP9_BASE + IRQ_EINT_GROUP9_NR + 1)
 
-#ifdef CONFIG_MACH_WLF_CRAGG_6410
-#define IRQ_BOARD_NR 160
-#elif defined(CONFIG_SMDK6410_WM1190_EV1)
-#define IRQ_BOARD_NR 64
-#elif defined(CONFIG_SMDK6410_WM1192_EV1)
-#define IRQ_BOARD_NR 64
-#else
-#define IRQ_BOARD_NR 16
-#endif
-
-#define IRQ_BOARD_END (IRQ_BOARD_START + IRQ_BOARD_NR)
-
-/* Set the default NR_IRQS */
-
-#define NR_IRQS(IRQ_BOARD_END + 1)
+/* Set the default nr_irqs, boards can override if necessary */
+#define S3C64XX_NR_IRQSIRQ_BOARD_START
 
 /* Compatibility */
 
diff --git a/arch/arm/mach-s3c64xx/include/mach/pm-core.h 
b/arch/arm/mach-s3c64xx/include/mach/pm-core.h
index a30a1e3ffc6a..32d2ff54f82d 100644
--- a/arch/arm/mach-s3c64xx/include/mach/pm-core.h
+++ b/arch/arm/mach-s3c64xx/include/mach/pm-core.h
@@ -18,6 +18,7 @@
 #include linux/serial_s3c.h
 
 #include mach/regs-gpio.h
+#include mach/regs-clock.h
 
 static inline void s3c_pm_debug_init_uart(void)
 {
diff --git a/arch/arm/mach-s3c64xx/mach-anw6410.c 
b/arch/arm/mach-s3c64xx/mach-anw6410.c
index 6224c67f5061..347ce6009a8c 100644
--- a/arch/arm/mach-s3c64xx/mach-anw6410.c
+++ b/arch/arm/mach-s3c64xx/mach-anw6410.c
@@ -47,6 +47,7 @@
 
 #include plat/devs.h
 #include plat/cpu.h
+#include mach/irqs.h
 #include mach/regs-gpio.h
 #include mach/gpio-samsung.h
 #include plat/samsung-time.h
@@ -229,7 +230,7 @@ static void __init anw6410_machine_init(void)
 MACHINE_START(ANW6410, AW6410)
/* Maintainer: Kwangwoo Lee kwangwoo@gmail.com */
.atag_offset= 0x100,
-
+   .nr_irqs= S3C64XX_NR_IRQS,
.init_irq   = s3c6410_init_irq,
.map_io = anw6410_map_io,
.init_machine   = anw6410_machine_init,
diff --git a/arch/arm/mach-s3c64xx/mach-crag6410-module.c 
b/arch/arm/mach-s3c64xx/mach-crag6410-module.c
index be21f06e6b3f..571f95cc5a53 100644
--- a/arch/arm/mach-s3c64xx/mach-crag6410-module.c
+++ b/arch/arm/mach-s3c64xx/mach-crag6410-module.c
@@ -30,6 +30,8 @@
 #include linux/platform_data/spi-s3c64xx.h
 
 #include plat/cpu.h