Skip to content

Commit

Permalink
drivers: spi: 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 <kumar.gala@linaro.org>
  • Loading branch information
galak authored and nashif committed Mar 17, 2020
1 parent 78ae42d commit 47968e3
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 30 deletions.
28 changes: 24 additions & 4 deletions drivers/spi/spi_dw.c
Original file line number Diff line number Diff line change
Expand Up @@ -570,10 +570,15 @@ DEVICE_AND_API_INIT(spi_dw_port_0, DT_INST_0_SNPS_DESIGNWARE_SPI_LABEL,
void spi_config_0_irq(void)
{
#ifdef CONFIG_SPI_DW_PORT_0_INTERRUPT_SINGLE_LINE
#if defined(DT_INST_0_SNPS_DESIGNWARE_SPI_IRQ_FLAGS)
#define INST_0_IRQ_FLAGS DT_INST_0_SNPS_DESIGNWARE_SPI_IRQ_FLAGS
#else
#define INST_0_IRQ_FLAGS 0
#endif
IRQ_CONNECT(DT_INST_0_SNPS_DESIGNWARE_SPI_IRQ_0,
DT_INST_0_SNPS_DESIGNWARE_SPI_IRQ_0_PRIORITY,
spi_dw_isr, DEVICE_GET(spi_dw_port_0),
DT_INST_0_SNPS_DESIGNWARE_SPI_IRQ_FLAGS);
INST_0_IRQ_FLAGS);
irq_enable(DT_INST_0_SNPS_DESIGNWARE_SPI_IRQ_0);
#else
IRQ_CONNECT(DT_INST_0_SNPS_DESIGNWARE_SPI_IRQ_RX_AVAIL,
Expand Down Expand Up @@ -631,10 +636,15 @@ DEVICE_AND_API_INIT(spi_dw_port_1, DT_INST_1_SNPS_DESIGNWARE_SPI_LABEL,
void spi_config_1_irq(void)
{
#ifdef CONFIG_SPI_DW_PORT_1_INTERRUPT_SINGLE_LINE
#if defined(DT_INST_1_SNPS_DESIGNWARE_SPI_IRQ_FLAGS)
#define INST_1_IRQ_FLAGS DT_INST_1_SNPS_DESIGNWARE_SPI_IRQ_FLAGS
#else
#define INST_1_IRQ_FLAGS 0
#endif
IRQ_CONNECT(DT_INST_1_SNPS_DESIGNWARE_SPI_IRQ_0,
DT_INST_1_SNPS_DESIGNWARE_SPI_IRQ_0_PRIORITY,
spi_dw_isr, DEVICE_GET(spi_dw_port_1),
DT_INST_1_SNPS_DESIGNWARE_SPI_IRQ_FLAGS);
INST_1_IRQ_FLAGS);
irq_enable(DT_INST_1_SNPS_DESIGNWARE_SPI_IRQ_0);
#else
IRQ_CONNECT(DT_INST_1_SNPS_DESIGNWARE_SPI_IRQ_RX_AVAIL,
Expand Down Expand Up @@ -692,10 +702,15 @@ DEVICE_AND_API_INIT(spi_dw_port_2, DT_INST_2_SNPS_DESIGNWARE_SPI_LABEL,
void spi_config_2_irq(void)
{
#ifdef CONFIG_SPI_DW_PORT_2_INTERRUPT_SINGLE_LINE
#if defined(DT_INST_2_SNPS_DESIGNWARE_SPI_IRQ_FLAGS)
#define INST_2_IRQ_FLAGS DT_INST_2_SNPS_DESIGNWARE_SPI_IRQ_FLAGS
#else
#define INST_2_IRQ_FLAGS 0
#endif
IRQ_CONNECT(DT_INST_2_SNPS_DESIGNWARE_SPI_IRQ_0,
DT_INST_2_SNPS_DESIGNWARE_SPI_IRQ_0_PRIORITY,
spi_dw_isr, DEVICE_GET(spi_dw_port_2),
DT_INST_2_SNPS_DESIGNWARE_SPI_IRQ_FLAGS);
INST_2_IRQ_FLAGS);
irq_enable(DT_INST_2_SNPS_DESIGNWARE_SPI_IRQ_0);
#else
IRQ_CONNECT(DT_INST_2_SNPS_DESIGNWARE_SPI_IRQ_RX_AVAIL,
Expand Down Expand Up @@ -753,10 +768,15 @@ DEVICE_AND_API_INIT(spi_dw_port_3, DT_INST_3_SNPS_DESIGNWARE_SPI_LABEL,
void spi_config_3_irq(void)
{
#ifdef CONFIG_SPI_DW_PORT_3_INTERRUPT_SINGLE_LINE
#if defined(DT_INST_3_SNPS_DESIGNWARE_SPI_IRQ_FLAGS)
#define INST_3_IRQ_FLAGS DT_INST_3_SNPS_DESIGNWARE_SPI_IRQ_FLAGS
#else
#define INST_3_IRQ_FLAGS 0
#endif
IRQ_CONNECT(DT_INST_3_SNPS_DESIGNWARE_SPI_IRQ_0,
DT_INST_3_SNPS_DESIGNWARE_SPI_IRQ_0_PRIORITY,
spi_dw_isr, DEVICE_GET(spi_dw_port_3),
DT_INST_3_SNPS_DESIGNWARE_SPI_IRQ_FLAGS);
INST_3_IRQ_FLAGS);
irq_enable(DT_INST_3_SNPS_DESIGNWARE_SPI_IRQ_0);
#else
IRQ_CONNECT(DT_INST_3_SNPS_DESIGNWARE_SPI_IRQ_RX_AVAIL,
Expand Down
17 changes: 0 additions & 17 deletions soc/arc/snps_arc_hsdk/dts_fixup.h

This file was deleted.

7 changes: 0 additions & 7 deletions soc/arc/snps_emsk/dts_fixup.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,4 @@
#define DT_DDR_BASE_ADDRESS DT_MMIO_SRAM_10000000_BASE_ADDRESS
#define DT_DDR_SIZE (DT_MMIO_SRAM_10000000_SIZE >> 10)

/*
* SPI configuration
*/

#define DT_INST_0_SNPS_DESIGNWARE_SPI_IRQ_FLAGS 0
#define DT_INST_1_SNPS_DESIGNWARE_SPI_IRQ_FLAGS 0

/* End of SoC Level DTS fixup file */
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 @@ -27,8 +27,6 @@
#define DT_CAVS_ICTL_3_IRQ_PRI DT_INTEL_CAVS_INTC_78830_IRQ_0_PRIORITY
#define DT_CAVS_ICTL_3_IRQ_FLAGS DT_INTEL_CAVS_INTC_78830_IRQ_0_SENSE

#define DT_INST_0_SNPS_DESIGNWARE_SPI_IRQ_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 47968e3

Please sign in to comment.