diff mbox

[v1,2/4] arm: pxa: move init functions into generic.h

Message ID 1411973508-14301-2-git-send-email-robert.jarzmik@free.fr (mailing list archive)
State New, archived
Headers show

Commit Message

Robert Jarzmik Sept. 29, 2014, 6:51 a.m. UTC
In order to have a unique .c file for all pxa variants device-tree
definitions, all the initialization functions for MACHINE_START and
DT_MACHINE_START have been put together into generic.h.

The alternative would have been one pxaXXX-dt.c file per variant.

The move is necessary because each include/mach/pxaXXX.h includes the
variant register descriptions which intersects and conflicts one with
each other.

The change is a preparation for pxa-dt.c to support multiple pxa,
ie. pxa3xx and pxa27x.

The machine files including mach/pxaXXX.h all include generic.h, which
guarantees no regression should be introduced.

Signed-off-by: Robert Jarzmik <robert.jarzmik@free.fr>
---
 arch/arm/mach-pxa/generic.h             | 26 ++++++++++++++++++++------
 arch/arm/mach-pxa/include/mach/pxa25x.h |  8 --------
 arch/arm/mach-pxa/include/mach/pxa27x.h |  4 ----
 arch/arm/mach-pxa/include/mach/pxa3xx.h |  5 -----
 4 files changed, 20 insertions(+), 23 deletions(-)

Comments

Arnd Bergmann Sept. 29, 2014, 4:08 p.m. UTC | #1
On Monday 29 September 2014 08:51:46 Robert Jarzmik wrote:
> 
>  #ifdef CONFIG_PXA25x
> +#define pxa25x_handle_irq icip_handle_irq
>  extern unsigned pxa25x_get_clk_frequency_khz(int);
> +extern void __init pxa25x_init_irq(void);
> +extern void __init pxa25x_map_io(void);
> +#ifdef CONFIG_CPU_PXA26x
> +extern void __init pxa26x_init_irq(void);
> +#endif
>  #else
>  #define pxa25x_get_clk_frequency_khz(x)                (0)
>  #endif
> 

It's better to add the declarations outside of the #ifdef. I believe
the existing #ifdef is meant to provide a dummy alternative, but you
don't actually want that for the other declarations, so just add them
to a globally visible location.

	Arnd
Robert Jarzmik Sept. 29, 2014, 5:48 p.m. UTC | #2
Arnd Bergmann <arnd@arndb.de> writes:

> On Monday 29 September 2014 08:51:46 Robert Jarzmik wrote:
>> 
>>  #ifdef CONFIG_PXA25x
>> +#define pxa25x_handle_irq icip_handle_irq
>>  extern unsigned pxa25x_get_clk_frequency_khz(int);
>> +extern void __init pxa25x_init_irq(void);
>> +extern void __init pxa25x_map_io(void);
>> +#ifdef CONFIG_CPU_PXA26x
>> +extern void __init pxa26x_init_irq(void);
>> +#endif
>>  #else
>>  #define pxa25x_get_clk_frequency_khz(x)                (0)
>>  #endif
>> 
>
> It's better to add the declarations outside of the #ifdef. I believe
> the existing #ifdef is meant to provide a dummy alternative, but you
> don't actually want that for the other declarations, so just add them
> to a globally visible location.
OK for v2.

I will also put a note on my todo list to kill them. Their remaining purpose is
to provide frequency read accessor for get_clk_frequency(). Once the clock
framework will be done for all PXAs, get_clk_frequency() will become a simple
clk_get_rate(), or even better will be removed if I manage to transform viper.c
and the cpu frequency driver.

Cheers.
diff mbox

Patch

diff --git a/arch/arm/mach-pxa/generic.h b/arch/arm/mach-pxa/generic.h
index 8963984..d962ca6 100644
--- a/arch/arm/mach-pxa/generic.h
+++ b/arch/arm/mach-pxa/generic.h
@@ -13,11 +13,11 @@ 
 
 struct irq_data;
 
-extern void pxa_timer_init(void);
-
-extern void __init pxa_map_io(void);
-
 extern unsigned int get_clk_frequency_khz(int info);
+extern void __init pxa_dt_irq_init(int (*fn)(struct irq_data *,
+					     unsigned int));
+extern void __init pxa_map_io(void);
+extern void pxa_timer_init(void);
 
 #define SET_BANK(__nr,__start,__size) \
 	mi->bank[__nr].start = (__start), \
@@ -26,13 +26,23 @@  extern unsigned int get_clk_frequency_khz(int info);
 #define ARRAY_AND_SIZE(x)	(x), ARRAY_SIZE(x)
 
 #ifdef CONFIG_PXA25x
+#define pxa25x_handle_irq icip_handle_irq
 extern unsigned pxa25x_get_clk_frequency_khz(int);
+extern void __init pxa25x_init_irq(void);
+extern void __init pxa25x_map_io(void);
+#ifdef CONFIG_CPU_PXA26x
+extern void __init pxa26x_init_irq(void);
+#endif
 #else
 #define pxa25x_get_clk_frequency_khz(x)		(0)
 #endif
 
 #ifdef CONFIG_PXA27x
-extern unsigned pxa27x_get_clk_frequency_khz(int);
+#define pxa27x_handle_irq ichp_handle_irq
+extern void __init pxa27x_dt_init_irq(void);
+extern unsigned	pxa27x_get_clk_frequency_khz(int);
+extern void __init pxa27x_init_irq(void);
+extern void __init pxa27x_map_io(void);
 #else
 #define pxa27x_get_clk_frequency_khz(x)		(0)
 #endif
@@ -44,7 +54,11 @@  static inline void pxa2xx_clear_reset_status(unsigned int mask) {}
 #endif
 
 #ifdef CONFIG_PXA3xx
-extern unsigned pxa3xx_get_clk_frequency_khz(int);
+#define pxa3xx_handle_irq ichp_handle_irq
+extern void __init pxa3xx_dt_init_irq(void);
+extern unsigned	pxa3xx_get_clk_frequency_khz(int);
+extern void __init pxa3xx_init_irq(void);
+extern void __init pxa3xx_map_io(void);
 #else
 #define pxa3xx_get_clk_frequency_khz(x)		(0)
 #endif
diff --git a/arch/arm/mach-pxa/include/mach/pxa25x.h b/arch/arm/mach-pxa/include/mach/pxa25x.h
index 3ac0baa..5a34175 100644
--- a/arch/arm/mach-pxa/include/mach/pxa25x.h
+++ b/arch/arm/mach-pxa/include/mach/pxa25x.h
@@ -6,12 +6,4 @@ 
 #include <mach/mfp-pxa25x.h>
 #include <mach/irqs.h>
 
-extern void __init pxa25x_map_io(void);
-extern void __init pxa25x_init_irq(void);
-#ifdef CONFIG_CPU_PXA26x
-extern void __init pxa26x_init_irq(void);
-#endif
-
-#define pxa25x_handle_irq	icip_handle_irq
-
 #endif /* __MACH_PXA25x_H */
diff --git a/arch/arm/mach-pxa/include/mach/pxa27x.h b/arch/arm/mach-pxa/include/mach/pxa27x.h
index 7cff640..599b925 100644
--- a/arch/arm/mach-pxa/include/mach/pxa27x.h
+++ b/arch/arm/mach-pxa/include/mach/pxa27x.h
@@ -19,11 +19,7 @@ 
 #define ARB_CORE_PARK		(1<<24)	   /* Be parked with core when idle */
 #define ARB_LOCK_FLAG		(1<<23)	   /* Only Locking masters gain access to the bus */
 
-extern void __init pxa27x_map_io(void);
-extern void __init pxa27x_init_irq(void);
 extern int __init pxa27x_set_pwrmode(unsigned int mode);
 extern void pxa27x_cpu_pm_enter(suspend_state_t state);
 
-#define pxa27x_handle_irq	ichp_handle_irq
-
 #endif /* __MACH_PXA27x_H */
diff --git a/arch/arm/mach-pxa/include/mach/pxa3xx.h b/arch/arm/mach-pxa/include/mach/pxa3xx.h
index 6dd7fa1..b4143fb 100644
--- a/arch/arm/mach-pxa/include/mach/pxa3xx.h
+++ b/arch/arm/mach-pxa/include/mach/pxa3xx.h
@@ -5,9 +5,4 @@ 
 #include <mach/pxa3xx-regs.h>
 #include <mach/irqs.h>
 
-extern void __init pxa3xx_map_io(void);
-extern void __init pxa3xx_init_irq(void);
-
-#define pxa3xx_handle_irq	ichp_handle_irq
-
 #endif /* __MACH_PXA3XX_H */