Skip to content

Commit

Permalink
drivers: gpio: dw: handle flags differences in driver
Browse files Browse the repository at this point in the history
Towards cleaning up (and hopefully removing dts_fixup.h in the near
future).  We need to move the handling of different names for the irq
flag propety into the driver and out of dts_fixup.h.

Signed-off-by: Kumar Gala <[email protected]>
  • Loading branch information
galak authored and nashif committed Mar 17, 2020
1 parent 4b19273 commit 78ae42d
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 25 deletions.
29 changes: 25 additions & 4 deletions drivers/gpio/gpio_dw.c
Original file line number Diff line number Diff line change
Expand Up @@ -616,6 +616,11 @@ DEVICE_AND_API_INIT(gpio_dw_0, DT_INST_0_SNPS_DESIGNWARE_GPIO_LABEL,
&api_funcs);
#endif

#if defined(DT_INST_0_SNPS_DESIGNWARE_GPIO_IRQ_0_FLAGS)
#define INST_0_IRQ_FLAGS DT_INST_0_SNPS_DESIGNWARE_GPIO_IRQ_0_FLAGS
#else
#define INST_0_IRQ_FLAGS 0
#endif
static void gpio_config_0_irq(struct device *port)
{
#if (DT_INST_0_SNPS_DESIGNWARE_GPIO_IRQ_0 > 0)
Expand All @@ -625,7 +630,7 @@ static void gpio_config_0_irq(struct device *port)
IRQ_CONNECT(DT_INST_0_SNPS_DESIGNWARE_GPIO_IRQ_0,
DT_INST_0_SNPS_DESIGNWARE_GPIO_IRQ_0_PRIORITY, gpio_dw_isr,
DEVICE_GET(gpio_dw_0),
DT_INST_0_SNPS_DESIGNWARE_GPIO_IRQ_0_FLAGS);
INST_0_IRQ_FLAGS);
irq_enable(config->irq_num);
#elif defined(CONFIG_GPIO_DW_0_IRQ_SHARED)
struct device *shared_irq_dev;
Expand Down Expand Up @@ -680,6 +685,12 @@ DEVICE_AND_API_INIT(gpio_dw_1, DT_INST_1_SNPS_DESIGNWARE_GPIO_LABEL,
&api_funcs);
#endif


#if defined(DT_INST_1_SNPS_DESIGNWARE_GPIO_IRQ_0_FLAGS)
#define INST_1_IRQ_FLAGS DT_INST_1_SNPS_DESIGNWARE_GPIO_IRQ_0_FLAGS
#else
#define INST_1_IRQ_FLAGS 0
#endif
static void gpio_config_1_irq(struct device *port)
{
#if (DT_INST_1_SNPS_DESIGNWARE_GPIO_IRQ_0 > 0)
Expand All @@ -689,7 +700,7 @@ static void gpio_config_1_irq(struct device *port)
IRQ_CONNECT(DT_INST_1_SNPS_DESIGNWARE_GPIO_IRQ_0,
DT_INST_1_SNPS_DESIGNWARE_GPIO_IRQ_0_PRIORITY, gpio_dw_isr,
DEVICE_GET(gpio_dw_1),
DT_INST_1_SNPS_DESIGNWARE_GPIO_IRQ_0_FLAGS);
INST_1_IRQ_FLAGS);
irq_enable(config->irq_num);
#elif defined(CONFIG_GPIO_DW_1_IRQ_SHARED)
struct device *shared_irq_dev;
Expand Down Expand Up @@ -743,6 +754,11 @@ DEVICE_AND_API_INIT(gpio_dw_2, DT_INST_2_SNPS_DESIGNWARE_GPIO_LABEL,
&api_funcs);
#endif

#if defined(DT_INST_2_SNPS_DESIGNWARE_GPIO_IRQ_0_FLAGS)
#define INST_2_IRQ_FLAGS DT_INST_2_SNPS_DESIGNWARE_GPIO_IRQ_0_FLAGS
#else
#define INST_2_IRQ_FLAGS 0
#endif
static void gpio_config_2_irq(struct device *port)
{
#if (DT_INST_2_SNPS_DESIGNWARE_GPIO_IRQ_0 > 0)
Expand All @@ -752,7 +768,7 @@ static void gpio_config_2_irq(struct device *port)
IRQ_CONNECT(DT_INST_2_SNPS_DESIGNWARE_GPIO_IRQ_0,
DT_INST_2_SNPS_DESIGNWARE_GPIO_IRQ_0_PRIORITY, gpio_dw_isr,
DEVICE_GET(gpio_dw_2),
DT_INST_2_SNPS_DESIGNWARE_GPIO_IRQ_0_FLAGS);
INST_2_IRQ_FLAGS);
irq_enable(config->irq_num);
#elif defined(CONFIG_GPIO_DW_2_IRQ_SHARED)
struct device *shared_irq_dev;
Expand Down Expand Up @@ -806,6 +822,11 @@ DEVICE_AND_API_INIT(gpio_dw_3, DT_INST_3_SNPS_DESIGNWARE_GPIO_LABEL,
&api_funcs);
#endif

#if defined(DT_INST_3_SNPS_DESIGNWARE_GPIO_IRQ_0_FLAGS)
#define INST_3_IRQ_FLAGS DT_INST_3_SNPS_DESIGNWARE_GPIO_IRQ_0_FLAGS
#else
#define INST_3_IRQ_FLAGS 0
#endif
static void gpio_config_3_irq(struct device *port)
{
#if (DT_INST_3_SNPS_DESIGNWARE_GPIO_IRQ_0 > 0)
Expand All @@ -815,7 +836,7 @@ static void gpio_config_3_irq(struct device *port)
IRQ_CONNECT(DT_INST_3_SNPS_DESIGNWARE_GPIO_IRQ_0,
DT_INST_3_SNPS_DESIGNWARE_GPIO_IRQ_0_PRIORITY, gpio_dw_isr,
DEVICE_GET(gpio_dw_3),
DT_INST_3_SNPS_DESIGNWARE_GPIO_IRQ_0_FLAGS);
INST_3_IRQ_FLAGS);
irq_enable(config->irq_num);
#elif defined(CONFIG_GPIO_DW_3_IRQ_SHARED)
struct device *shared_irq_dev;
Expand Down
5 changes: 0 additions & 5 deletions soc/arc/snps_arc_hsdk/dts_fixup.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,6 @@

/* SoC level DTS fixup file */

/*
* GPIO configuration
*/
#define DT_INST_0_SNPS_DESIGNWARE_GPIO_IRQ_0_FLAGS 0

/*
* SPI configuration
*/
Expand Down
6 changes: 0 additions & 6 deletions soc/arc/snps_emsdp/dts_fixup.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,4 @@
#define DT_ICCM_BASE_ADDRESS DT_ARC_ICCM_60000000_BASE_ADDRESS
#define DT_ICCM_SIZE (DT_ARC_ICCM_60000000_SIZE >> 10)

/*
* GPIO configuration
*/
#define DT_INST_0_SNPS_DESIGNWARE_GPIO_IRQ_0_FLAGS 0
#define DT_INST_1_SNPS_DESIGNWARE_GPIO_IRQ_0_FLAGS 0

/* End of SoC Level DTS fixup file */
8 changes: 0 additions & 8 deletions soc/arc/snps_emsk/dts_fixup.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,6 @@
#define DT_DDR_BASE_ADDRESS DT_MMIO_SRAM_10000000_BASE_ADDRESS
#define DT_DDR_SIZE (DT_MMIO_SRAM_10000000_SIZE >> 10)

/*
* GPIO configuration
*/
#define DT_INST_0_SNPS_DESIGNWARE_GPIO_IRQ_0_FLAGS 0
#define DT_INST_1_SNPS_DESIGNWARE_GPIO_IRQ_0_FLAGS 0
#define DT_INST_2_SNPS_DESIGNWARE_GPIO_IRQ_0_FLAGS 0
#define DT_INST_3_SNPS_DESIGNWARE_GPIO_IRQ_0_FLAGS 0

/*
* SPI configuration
*/
Expand Down
2 changes: 0 additions & 2 deletions soc/xtensa/intel_s1000/dts_fixup.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,6 @@

#define DT_INST_0_SNPS_DESIGNWARE_SPI_IRQ_FLAGS 0

#define DT_INST_0_SNPS_DESIGNWARE_GPIO_IRQ_0_FLAGS 0

#define DT_PINMUX_BASE_ADDR \
DT_INTEL_S1000_PINMUX_81C30_BASE_ADDRESS
#define DT_PINMUX_CTRL_REG_COUNT \
Expand Down

0 comments on commit 78ae42d

Please sign in to comment.