diff mbox series

[33/35] ARM: davinci: prepare to remove mach/irqs.h

Message ID 20190131133928.17985-34-brgl@bgdev.pl (mailing list archive)
State New, archived
Headers show
Series ARM: davinci: modernize the irq support | expand

Commit Message

Bartosz Golaszewski Jan. 31, 2019, 1:39 p.m. UTC
From: Bartosz Golaszewski <bgolaszewski@baylibre.com>

Since we now select SPARSE_IRQ in davinci, the mach/irqs.h header is
no longer included from asm/irq.h. All interrupt numbers for devices
should be defined as platform device resources. Let's prepare for the
removal of mach/irqs.h by moving all defines that we want to keep to
relevant headers (davinci.h, common.h) and replacing others with
simple literals.

Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
---
 arch/arm/mach-davinci/board-da830-evm.c     |  2 +-
 arch/arm/mach-davinci/board-da850-evm.c     |  4 ++--
 arch/arm/mach-davinci/board-dm644x-evm.c    |  2 +-
 arch/arm/mach-davinci/board-dm646x-evm.c    |  2 +-
 arch/arm/mach-davinci/da830.c               |  2 +-
 arch/arm/mach-davinci/da850.c               |  2 +-
 arch/arm/mach-davinci/davinci.h             |  2 ++
 arch/arm/mach-davinci/include/mach/common.h |  5 +++++
 arch/arm/mach-davinci/include/mach/irqs.h   | 18 ------------------
 9 files changed, 14 insertions(+), 25 deletions(-)

Comments

David Lechner Feb. 5, 2019, 12:59 a.m. UTC | #1
On 1/31/19 7:39 AM, Bartosz Golaszewski wrote:
> From: Bartosz Golaszewski <bgolaszewski@baylibre.com>
> 
> Since we now select SPARSE_IRQ in davinci, the mach/irqs.h header is
> no longer included from asm/irq.h. All interrupt numbers for devices
> should be defined as platform device resources. Let's prepare for the
> removal of mach/irqs.h by moving all defines that we want to keep to
> relevant headers (davinci.h, common.h) and replacing others with
> simple literals.
> 
> Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
> ---
>   arch/arm/mach-davinci/board-da830-evm.c     |  2 +-
>   arch/arm/mach-davinci/board-da850-evm.c     |  4 ++--
>   arch/arm/mach-davinci/board-dm644x-evm.c    |  2 +-
>   arch/arm/mach-davinci/board-dm646x-evm.c    |  2 +-
>   arch/arm/mach-davinci/da830.c               |  2 +-
>   arch/arm/mach-davinci/da850.c               |  2 +-
>   arch/arm/mach-davinci/davinci.h             |  2 ++
>   arch/arm/mach-davinci/include/mach/common.h |  5 +++++
>   arch/arm/mach-davinci/include/mach/irqs.h   | 18 ------------------
>   9 files changed, 14 insertions(+), 25 deletions(-)
> 
> diff --git a/arch/arm/mach-davinci/board-da830-evm.c b/arch/arm/mach-davinci/board-da830-evm.c
> index b3a0148f7f1a..950e98e4eda5 100644
> --- a/arch/arm/mach-davinci/board-da830-evm.c
> +++ b/arch/arm/mach-davinci/board-da830-evm.c
> @@ -488,7 +488,7 @@ static int da830_evm_ui_expander_teardown(struct i2c_client *client, int gpio,
>   }
>   
>   static struct pcf857x_platform_data __initdata da830_evm_ui_expander_info = {
> -	.gpio_base	= DAVINCI_N_GPIO,
> +	.gpio_base	= 144,

I think it would be better to keep the *_N_GPIO macros.

>   	.setup		= da830_evm_ui_expander_setup,
>   	.teardown	= da830_evm_ui_expander_teardown,
>   };


...

> diff --git a/arch/arm/mach-davinci/da830.c b/arch/arm/mach-davinci/da830.c
> index 9cf9b090efeb..74cbab153e59 100644
> --- a/arch/arm/mach-davinci/da830.c
> +++ b/arch/arm/mach-davinci/da830.c
> @@ -730,7 +730,7 @@ static const struct davinci_cp_intc_config da830_cp_intc_config = {
>   		.end		= DA8XX_CP_INTC_BASE + SZ_8K,
>   		.flags		= IORESOURCE_MEM,
>   	},
> -	.num_irqs		= DA830_N_CP_INTC_IRQ,
> +	.num_irqs		= 96,

This change could be avoided by using 96 in the first place in
"ARM: davinci: cp-intc: add the new config structures for da8xx SoCs"

>   };
>   
>   void __init da830_init_irqs(void)
> diff --git a/arch/arm/mach-davinci/da850.c b/arch/arm/mach-davinci/da850.c
> index b9ebdcde68eb..644f4eec8d5c 100644
> --- a/arch/arm/mach-davinci/da850.c
> +++ b/arch/arm/mach-davinci/da850.c
> @@ -658,7 +658,7 @@ static const struct davinci_cp_intc_config da850_cp_intc_config = {
>   		.end		= DA8XX_CP_INTC_BASE + SZ_8K,
>   		.flags		= IORESOURCE_MEM,
>   	},
> -	.num_irqs		= DA850_N_CP_INTC_IRQ,
> +	.num_irqs		= 101,

same here

>   };
>   
>   void __init da850_init_irqs(void)
Sekhar Nori Feb. 7, 2019, 2:07 p.m. UTC | #2
On 31/01/19 7:09 PM, Bartosz Golaszewski wrote:
> From: Bartosz Golaszewski <bgolaszewski@baylibre.com>
> 
> Since we now select SPARSE_IRQ in davinci, the mach/irqs.h header is
> no longer included from asm/irq.h. All interrupt numbers for devices
> should be defined as platform device resources. Let's prepare for the
> removal of mach/irqs.h by moving all defines that we want to keep to
> relevant headers (davinci.h, common.h) and replacing others with
> simple literals.
> 
> Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
> ---
>  arch/arm/mach-davinci/board-da830-evm.c     |  2 +-
>  arch/arm/mach-davinci/board-da850-evm.c     |  4 ++--
>  arch/arm/mach-davinci/board-dm644x-evm.c    |  2 +-
>  arch/arm/mach-davinci/board-dm646x-evm.c    |  2 +-
>  arch/arm/mach-davinci/da830.c               |  2 +-
>  arch/arm/mach-davinci/da850.c               |  2 +-
>  arch/arm/mach-davinci/davinci.h             |  2 ++
>  arch/arm/mach-davinci/include/mach/common.h |  5 +++++
>  arch/arm/mach-davinci/include/mach/irqs.h   | 18 ------------------
>  9 files changed, 14 insertions(+), 25 deletions(-)
> 
> diff --git a/arch/arm/mach-davinci/board-da830-evm.c b/arch/arm/mach-davinci/board-da830-evm.c
> index b3a0148f7f1a..950e98e4eda5 100644
> --- a/arch/arm/mach-davinci/board-da830-evm.c
> +++ b/arch/arm/mach-davinci/board-da830-evm.c
> @@ -488,7 +488,7 @@ static int da830_evm_ui_expander_teardown(struct i2c_client *client, int gpio,
>  }
>  
>  static struct pcf857x_platform_data __initdata da830_evm_ui_expander_info = {
> -	.gpio_base	= DAVINCI_N_GPIO,
> +	.gpio_base	= 144,

Why drop DAVINCI_N_GPIO instead of just moving it to a local header file?

Thanks,
Sekhar
diff mbox series

Patch

diff --git a/arch/arm/mach-davinci/board-da830-evm.c b/arch/arm/mach-davinci/board-da830-evm.c
index b3a0148f7f1a..950e98e4eda5 100644
--- a/arch/arm/mach-davinci/board-da830-evm.c
+++ b/arch/arm/mach-davinci/board-da830-evm.c
@@ -488,7 +488,7 @@  static int da830_evm_ui_expander_teardown(struct i2c_client *client, int gpio,
 }
 
 static struct pcf857x_platform_data __initdata da830_evm_ui_expander_info = {
-	.gpio_base	= DAVINCI_N_GPIO,
+	.gpio_base	= 144,
 	.setup		= da830_evm_ui_expander_setup,
 	.teardown	= da830_evm_ui_expander_teardown,
 };
diff --git a/arch/arm/mach-davinci/board-da850-evm.c b/arch/arm/mach-davinci/board-da850-evm.c
index efc9a33da6e1..27acba6fe5f8 100644
--- a/arch/arm/mach-davinci/board-da850-evm.c
+++ b/arch/arm/mach-davinci/board-da850-evm.c
@@ -562,7 +562,7 @@  static int da850_evm_ui_expander_teardown(struct i2c_client *client,
 
 /* assign the baseboard expander's GPIOs after the UI board's */
 #define DA850_UI_EXPANDER_N_GPIOS ARRAY_SIZE(da850_evm_ui_exp)
-#define DA850_BB_EXPANDER_GPIO_BASE (DAVINCI_N_GPIO + DA850_UI_EXPANDER_N_GPIOS)
+#define DA850_BB_EXPANDER_GPIO_BASE (144 + DA850_UI_EXPANDER_N_GPIOS)
 
 enum da850_evm_bb_exp_pins {
 	DA850_EVM_BB_EXP_DEEP_SLEEP_EN = 0,
@@ -735,7 +735,7 @@  static int da850_evm_bb_expander_teardown(struct i2c_client *client,
 }
 
 static struct pca953x_platform_data da850_evm_ui_expander_info = {
-	.gpio_base	= DAVINCI_N_GPIO,
+	.gpio_base	= 144,
 	.setup		= da850_evm_ui_expander_setup,
 	.teardown	= da850_evm_ui_expander_teardown,
 	.names		= da850_evm_ui_exp,
diff --git a/arch/arm/mach-davinci/board-dm644x-evm.c b/arch/arm/mach-davinci/board-dm644x-evm.c
index f23a29e5116f..d04ce0c206b6 100644
--- a/arch/arm/mach-davinci/board-dm644x-evm.c
+++ b/arch/arm/mach-davinci/board-dm644x-evm.c
@@ -310,7 +310,7 @@  static struct platform_device rtc_dev = {
  * I2C GPIO expanders
  */
 
-#define PCF_Uxx_BASE(x)	(DAVINCI_N_GPIO + ((x) * 8))
+#define PCF_Uxx_BASE(x)	(144 + ((x) * 8))
 
 
 /* U2 -- LEDs */
diff --git a/arch/arm/mach-davinci/board-dm646x-evm.c b/arch/arm/mach-davinci/board-dm646x-evm.c
index ebf07d92224e..2ddc03a95acd 100644
--- a/arch/arm/mach-davinci/board-dm646x-evm.c
+++ b/arch/arm/mach-davinci/board-dm646x-evm.c
@@ -333,7 +333,7 @@  static int evm_pcf_teardown(struct i2c_client *client, int gpio,
 }
 
 static struct pcf857x_platform_data pcf_data = {
-	.gpio_base	= DAVINCI_N_GPIO+1,
+	.gpio_base	= 145,
 	.setup		= evm_pcf_setup,
 	.teardown	= evm_pcf_teardown,
 };
diff --git a/arch/arm/mach-davinci/da830.c b/arch/arm/mach-davinci/da830.c
index 9cf9b090efeb..74cbab153e59 100644
--- a/arch/arm/mach-davinci/da830.c
+++ b/arch/arm/mach-davinci/da830.c
@@ -730,7 +730,7 @@  static const struct davinci_cp_intc_config da830_cp_intc_config = {
 		.end		= DA8XX_CP_INTC_BASE + SZ_8K,
 		.flags		= IORESOURCE_MEM,
 	},
-	.num_irqs		= DA830_N_CP_INTC_IRQ,
+	.num_irqs		= 96,
 };
 
 void __init da830_init_irqs(void)
diff --git a/arch/arm/mach-davinci/da850.c b/arch/arm/mach-davinci/da850.c
index b9ebdcde68eb..644f4eec8d5c 100644
--- a/arch/arm/mach-davinci/da850.c
+++ b/arch/arm/mach-davinci/da850.c
@@ -658,7 +658,7 @@  static const struct davinci_cp_intc_config da850_cp_intc_config = {
 		.end		= DA8XX_CP_INTC_BASE + SZ_8K,
 		.flags		= IORESOURCE_MEM,
 	},
-	.num_irqs		= DA850_N_CP_INTC_IRQ,
+	.num_irqs		= 101,
 };
 
 void __init da850_init_irqs(void)
diff --git a/arch/arm/mach-davinci/davinci.h b/arch/arm/mach-davinci/davinci.h
index 49958cc161d7..d5bffd3751f9 100644
--- a/arch/arm/mach-davinci/davinci.h
+++ b/arch/arm/mach-davinci/davinci.h
@@ -39,6 +39,8 @@ 
 #define DAVINCI_PLL2_BASE		0x01c40c00
 #define DAVINCI_PWR_SLEEP_CNTRL_BASE	0x01c41000
 
+#define DAVINCI_ARM_INTC_BASE		0x01c48000
+
 #define DAVINCI_SYSTEM_MODULE_BASE	0x01c40000
 #define SYSMOD_VDAC_CONFIG		0x2c
 #define SYSMOD_VIDCLKCTL		0x38
diff --git a/arch/arm/mach-davinci/include/mach/common.h b/arch/arm/mach-davinci/include/mach/common.h
index 2b986d32049f..9526e5da0d33 100644
--- a/arch/arm/mach-davinci/include/mach/common.h
+++ b/arch/arm/mach-davinci/include/mach/common.h
@@ -17,6 +17,11 @@ 
 #include <linux/types.h>
 #include <linux/reboot.h>
 
+#include <asm/irq.h>
+
+#define DAVINCI_INTC_START		NR_IRQS
+#define DAVINCI_INTC_IRQ(_irqnum)	(DAVINCI_INTC_START + (_irqnum))
+
 void davinci_timer_init(struct clk *clk);
 
 struct davinci_timer_instance {
diff --git a/arch/arm/mach-davinci/include/mach/irqs.h b/arch/arm/mach-davinci/include/mach/irqs.h
index 317cbc42e5cd..27c9f89f2a7f 100644
--- a/arch/arm/mach-davinci/include/mach/irqs.h
+++ b/arch/arm/mach-davinci/include/mach/irqs.h
@@ -29,12 +29,6 @@ 
 
 #include <asm/irq.h>
 
-/* Base address */
-#define DAVINCI_ARM_INTC_BASE 0x01C48000
-
-#define DAVINCI_INTC_START		NR_IRQS
-#define DAVINCI_INTC_IRQ(_irqnum)	(DAVINCI_INTC_START + (_irqnum))
-
 /* Interrupt lines */
 #define IRQ_VDINT0       DAVINCI_INTC_IRQ(0)
 #define IRQ_VDINT1       DAVINCI_INTC_IRQ(1)
@@ -100,10 +94,6 @@ 
 #define IRQ_COMMRX       DAVINCI_INTC_IRQ(62)
 #define IRQ_EMUINT       DAVINCI_INTC_IRQ(63)
 
-#define DAVINCI_N_AINTC_IRQ	64
-
-#define ARCH_TIMER_IRQ IRQ_TINT1_TINT34
-
 /* DaVinci DM6467-specific Interrupts */
 #define IRQ_DM646X_VP_VERTINT0  DAVINCI_INTC_IRQ(0)
 #define IRQ_DM646X_VP_VERTINT1  DAVINCI_INTC_IRQ(1)
@@ -344,8 +334,6 @@ 
 #define IRQ_DA830_T12CMPINT6_1		DAVINCI_INTC_IRQ(88)
 #define IRQ_DA830_T12CMPINT7_1		DAVINCI_INTC_IRQ(89)
 
-#define DA830_N_CP_INTC_IRQ		96
-
 /* DA850 speicific interrupts */
 #define IRQ_DA850_MPUADDRERR0		DAVINCI_INTC_IRQ(27)
 #define IRQ_DA850_MPUPROTERR0		DAVINCI_INTC_IRQ(27)
@@ -401,10 +389,4 @@ 
 #define IRQ_DA850_MCBSP1RINT		DAVINCI_INTC_IRQ(99)
 #define IRQ_DA850_MCBSP1XINT		DAVINCI_INTC_IRQ(100)
 
-#define DA850_N_CP_INTC_IRQ		101
-
-/* da850 currently has the most gpio pins (144) */
-#define DAVINCI_N_GPIO			144
-/* da850 currently has the most irqs so use DA850_N_CP_INTC_IRQ */
-
 #endif /* __ASM_ARCH_IRQS_H */