drivers/interrupt_controller: shared_irq: configure by device tree
This allows the shared_irq driver to be configured by device tree. With previous implementation, only the board configuration can override the IRQ trigger, as the trigger config is a "choice" rather than "config". With this patch, the driver can be fully configued at the SoC level. Signed-off-by: Daniel Leung <daniel.leung@intel.com>
This commit is contained in:
parent
1e968a1976
commit
7695a72e3c
|
@ -42,3 +42,7 @@
|
|||
&spi0 {
|
||||
status = "ok";
|
||||
};
|
||||
|
||||
&sharedirq0 {
|
||||
status = "ok";
|
||||
};
|
||||
|
|
|
@ -21,7 +21,5 @@ CONFIG_GPIO_SCH=y
|
|||
CONFIG_GPIO_SCH_0=y
|
||||
CONFIG_GPIO_SCH_1=y
|
||||
CONFIG_SHARED_IRQ=y
|
||||
CONFIG_SHARED_IRQ_0_LEVEL_LOW=y
|
||||
CONFIG_ETH_DW=y
|
||||
CONFIG_ETH_DW_0=y
|
||||
CONFIG_ETH_DW_0_IRQ_SHARED_NAME="SHARED_IRQ0"
|
||||
|
|
|
@ -45,14 +45,6 @@ config ETH_DW_0_IRQ_SHARED
|
|||
|
||||
endchoice
|
||||
|
||||
config ETH_DW_0_IRQ_SHARED_NAME
|
||||
string "Device name for Shared IRQ"
|
||||
depends on ETH_DW_0 && ETH_DW_0_IRQ_SHARED
|
||||
help
|
||||
Specify the device name for the shared IRQ driver. It is used to register
|
||||
this driver with the shared IRQ driver, so interrupts can be dispatched
|
||||
correctly.
|
||||
|
||||
config ETH_DW_0_IRQ_PRI
|
||||
int "Controller interrupt priority"
|
||||
depends on ETH_DW_0 && ETH_DW_0_IRQ_DIRECT
|
||||
|
|
|
@ -69,14 +69,6 @@ config GPIO_DW_0_IRQ_SHARED
|
|||
|
||||
endchoice
|
||||
|
||||
config GPIO_DW_0_IRQ_SHARED_NAME
|
||||
string "Device name for Shared IRQ"
|
||||
depends on GPIO_DW_0 && GPIO_DW_0_IRQ_SHARED
|
||||
help
|
||||
Specify the device name for the shared IRQ driver. It is used to register
|
||||
this driver with the shared IRQ driver, so interrupts can be dispatched
|
||||
correctly.
|
||||
|
||||
if !HAS_DTS
|
||||
config GPIO_DW_0_IRQ_PRI
|
||||
int "Controller interrupt priority"
|
||||
|
@ -121,14 +113,6 @@ config GPIO_DW_1_IRQ_SHARED
|
|||
|
||||
endchoice
|
||||
|
||||
config GPIO_DW_1_IRQ_SHARED_NAME
|
||||
string "Device name for Shared IRQ"
|
||||
depends on GPIO_DW_1_IRQ_SHARED
|
||||
help
|
||||
Specify the device name for the shared IRQ driver. It is used to register
|
||||
this driver with the shared IRQ driver, so interrupts can be dispatched
|
||||
correctly.
|
||||
|
||||
if !HAS_DTS
|
||||
config GPIO_DW_1_IRQ_PRI
|
||||
int "Controller interrupt priority"
|
||||
|
@ -173,14 +157,6 @@ config GPIO_DW_2_IRQ_SHARED
|
|||
|
||||
endchoice
|
||||
|
||||
config GPIO_DW_2_IRQ_SHARED_NAME
|
||||
string "Device name for Shared IRQ"
|
||||
depends on GPIO_DW_2_IRQ_SHARED
|
||||
help
|
||||
Specify the device name for the shared IRQ driver. It is used to register
|
||||
this driver with the shared IRQ driver, so interrupts can be dispatched
|
||||
correctly.
|
||||
|
||||
if !HAS_DTS
|
||||
config GPIO_DW_2_IRQ_PRI
|
||||
int "Controller interrupt priority"
|
||||
|
@ -225,14 +201,6 @@ config GPIO_DW_3_IRQ_SHARED
|
|||
|
||||
endchoice
|
||||
|
||||
config GPIO_DW_3_IRQ_SHARED_NAME
|
||||
string "Device name for Shared IRQ"
|
||||
depends on GPIO_DW_3_IRQ_SHARED
|
||||
help
|
||||
Specify the device name for the shared IRQ driver. It is used to register
|
||||
this driver with the shared IRQ driver, so interrupts can be dispatched
|
||||
correctly.
|
||||
|
||||
if !HAS_DTS
|
||||
config GPIO_DW_3_IRQ_PRI
|
||||
int "Controller interrupt priority"
|
||||
|
|
|
@ -46,12 +46,4 @@ config I2C_DW_0_IRQ_SHARED
|
|||
|
||||
endchoice
|
||||
|
||||
config I2C_DW_0_IRQ_SHARED_NAME
|
||||
string "Device name for Shared IRQ"
|
||||
depends on I2C_0 && I2C_DW_0_IRQ_SHARED
|
||||
help
|
||||
Specify the device name for the shared IRQ driver. It is used
|
||||
to register this driver with the shared IRQ driver, so interrupts
|
||||
can be dispatched correctly.
|
||||
|
||||
endif # I2C_DW
|
||||
|
|
|
@ -36,99 +36,9 @@ config SHARED_IRQ_0
|
|||
Provide an instance of the shared interrupt driver when system
|
||||
configuration requires that multiple devices share an interrupt.
|
||||
|
||||
config SHARED_IRQ_0_NAME
|
||||
string "Select a name for the device"
|
||||
depends on SHARED_IRQ_0
|
||||
default "SHARED_IRQ0"
|
||||
|
||||
config SHARED_IRQ_0_IRQ
|
||||
int "instance 0 interrupt"
|
||||
depends on SHARED_IRQ_0
|
||||
help
|
||||
System interrupt number to be handled by this instance of the driver.
|
||||
|
||||
config SHARED_IRQ_0_PRI
|
||||
int "instance 0 interrupt priority"
|
||||
default 2
|
||||
depends on SHARED_IRQ_0
|
||||
help
|
||||
Priority of shared interrupt handler for the configured interrupt
|
||||
|
||||
choice
|
||||
depends on SHARED_IRQ_0
|
||||
prompt "Shared IRQ #0 Trigger Condition"
|
||||
default SHARED_IRQ_0_RISING_EDGE
|
||||
|
||||
config SHARED_IRQ_0_FALLING_EDGE
|
||||
bool "Falling Edge"
|
||||
help
|
||||
Interrupt triggers on falling edge.
|
||||
|
||||
config SHARED_IRQ_0_RISING_EDGE
|
||||
bool "Rising Edge"
|
||||
help
|
||||
Interrupt triggers on rising edge.
|
||||
|
||||
config SHARED_IRQ_0_LEVEL_HIGH
|
||||
bool "Level High"
|
||||
help
|
||||
Interrupt triggers when level is high.
|
||||
|
||||
config SHARED_IRQ_0_LEVEL_LOW
|
||||
bool "Level Low"
|
||||
help
|
||||
Interrupt triggers when level is low.
|
||||
|
||||
endchoice
|
||||
|
||||
config SHARED_IRQ_1
|
||||
bool "Shared interrupt instance 1"
|
||||
depends on SHARED_IRQ
|
||||
help
|
||||
Provide an instance of the shared interrupt driver when system
|
||||
configuration requires that multiple devices share an interrupt.
|
||||
|
||||
config SHARED_IRQ_1_NAME
|
||||
string "Select a name for the device"
|
||||
depends on SHARED_IRQ_1
|
||||
default "SHARED_IRQ1"
|
||||
|
||||
config SHARED_IRQ_1_IRQ
|
||||
int "instance 1 interrupt"
|
||||
depends on SHARED_IRQ_1
|
||||
help
|
||||
System interrupt number to be handled by this instance of the driver.
|
||||
|
||||
config SHARED_IRQ_1_PRI
|
||||
int "instance 1 interrupt priority"
|
||||
default 2
|
||||
depends on SHARED_IRQ_1
|
||||
help
|
||||
Priority of shared interrupt handler for the configured interrupt
|
||||
|
||||
choice
|
||||
depends on SHARED_IRQ_1
|
||||
prompt "Shared IRQ #1 Trigger Condition"
|
||||
default SHARED_IRQ_1_RISING_EDGE
|
||||
|
||||
config SHARED_IRQ_1_FALLING_EDGE
|
||||
bool "Falling Edge"
|
||||
help
|
||||
Interrupt triggers on falling edge.
|
||||
|
||||
config SHARED_IRQ_1_RISING_EDGE
|
||||
bool "Rising Edge"
|
||||
help
|
||||
Interrupt triggers on rising edge.
|
||||
|
||||
config SHARED_IRQ_1_LEVEL_HIGH
|
||||
bool "Level High"
|
||||
help
|
||||
Interrupt triggers when level is high.
|
||||
|
||||
config SHARED_IRQ_1_LEVEL_LOW
|
||||
bool "Level Low"
|
||||
help
|
||||
Interrupt triggers when level is low.
|
||||
|
||||
endchoice
|
||||
|
|
|
@ -125,37 +125,24 @@ int shared_irq_initialize(struct device *dev)
|
|||
void shared_irq_config_0_irq(void);
|
||||
|
||||
const struct shared_irq_config shared_irq_config_0 = {
|
||||
.irq_num = CONFIG_SHARED_IRQ_0_IRQ,
|
||||
.irq_num = DT_SHARED_IRQ_SHAREDIRQ0_IRQ_0,
|
||||
.client_count = CONFIG_SHARED_IRQ_NUM_CLIENTS,
|
||||
.config = shared_irq_config_0_irq
|
||||
};
|
||||
|
||||
struct shared_irq_runtime shared_irq_0_runtime;
|
||||
|
||||
DEVICE_AND_API_INIT(shared_irq_0, CONFIG_SHARED_IRQ_0_NAME,
|
||||
DEVICE_AND_API_INIT(shared_irq_0, DT_SHARED_IRQ_SHAREDIRQ0_LABEL,
|
||||
shared_irq_initialize, &shared_irq_0_runtime,
|
||||
&shared_irq_config_0, POST_KERNEL,
|
||||
CONFIG_SHARED_IRQ_INIT_PRIORITY, &api_funcs);
|
||||
|
||||
#if defined(CONFIG_IOAPIC)
|
||||
#if defined(CONFIG_SHARED_IRQ_0_FALLING_EDGE)
|
||||
#define SHARED_IRQ_0_FLAGS (IOAPIC_EDGE | IOAPIC_LOW)
|
||||
#elif defined(CONFIG_SHARED_IRQ_0_RISING_EDGE)
|
||||
#define SHARED_IRQ_0_FLAGS (IOAPIC_EDGE | IOAPIC_HIGH)
|
||||
#elif defined(CONFIG_SHARED_IRQ_0_LEVEL_HIGH)
|
||||
#define SHARED_IRQ_0_FLAGS (IOAPIC_LEVEL | IOAPIC_HIGH)
|
||||
#elif defined(CONFIG_SHARED_IRQ_0_LEVEL_LOW)
|
||||
#define SHARED_IRQ_0_FLAGS (IOAPIC_LEVEL | IOAPIC_LOW)
|
||||
#endif
|
||||
#else
|
||||
#define SHARED_IRQ_0_FLAGS 0
|
||||
#endif /* CONFIG_IOAPIC */
|
||||
|
||||
void shared_irq_config_0_irq(void)
|
||||
{
|
||||
IRQ_CONNECT(CONFIG_SHARED_IRQ_0_IRQ, CONFIG_SHARED_IRQ_0_PRI,
|
||||
IRQ_CONNECT(DT_SHARED_IRQ_SHAREDIRQ0_IRQ_0,
|
||||
DT_SHARED_IRQ_SHAREDIRQ0_IRQ_0_PRIORITY,
|
||||
shared_irq_isr, DEVICE_GET(shared_irq_0),
|
||||
SHARED_IRQ_0_FLAGS);
|
||||
DT_SHARED_IRQ_SHAREDIRQ0_IRQ_0_SENSE);
|
||||
}
|
||||
|
||||
#endif /* CONFIG_SHARED_IRQ_0 */
|
||||
|
@ -164,37 +151,24 @@ void shared_irq_config_0_irq(void)
|
|||
void shared_irq_config_1_irq(void);
|
||||
|
||||
const struct shared_irq_config shared_irq_config_1 = {
|
||||
.irq_num = CONFIG_SHARED_IRQ_1_IRQ,
|
||||
.irq_num = DT_SHARED_IRQ_SHAREDIRQ1_IRQ_0,
|
||||
.client_count = CONFIG_SHARED_IRQ_NUM_CLIENTS,
|
||||
.config = shared_irq_config_1_irq
|
||||
};
|
||||
|
||||
struct shared_irq_runtime shared_irq_1_runtime;
|
||||
|
||||
DEVICE_AND_API_INIT(shared_irq_1, CONFIG_SHARED_IRQ_1_NAME,
|
||||
DEVICE_AND_API_INIT(shared_irq_1, DT_SHARED_IRQ_SHAREDIRQ1_LABEL,
|
||||
shared_irq_initialize, &shared_irq_1_runtime,
|
||||
&shared_irq_config_1, POST_KERNEL,
|
||||
CONFIG_SHARED_IRQ_INIT_PRIORITY, &api_funcs);
|
||||
|
||||
#if defined(CONFIG_IOAPIC)
|
||||
#if defined(CONFIG_SHARED_IRQ_1_FALLING_EDGE)
|
||||
#define SHARED_IRQ_1_FLAGS (IOAPIC_EDGE | IOAPIC_LOW)
|
||||
#elif defined(CONFIG_SHARED_IRQ_1_RISING_EDGE)
|
||||
#define SHARED_IRQ_1_FLAGS (IOAPIC_EDGE | IOAPIC_HIGH)
|
||||
#elif defined(CONFIG_SHARED_IRQ_1_LEVEL_HIGH)
|
||||
#define SHARED_IRQ_1_FLAGS (IOAPIC_LEVEL | IOAPIC_HIGH)
|
||||
#elif defined(CONFIG_SHARED_IRQ_1_LEVEL_LOW)
|
||||
#define SHARED_IRQ_1_FLAGS (IOAPIC_LEVEL | IOAPIC_LOW)
|
||||
#endif
|
||||
#else
|
||||
#define SHARED_IRQ_1_FLAGS 0
|
||||
#endif /* CONFIG_IOAPIC */
|
||||
|
||||
void shared_irq_config_1_irq(void)
|
||||
{
|
||||
IRQ_CONNECT(CONFIG_SHARED_IRQ_1_IRQ, CONFIG_SHARED_IRQ_1_PRI,
|
||||
IRQ_CONNECT(DT_SHARED_IRQ_SHAREDIRQ1_IRQ_0,
|
||||
DT_SHARED_IRQ_SHAREDIRQ1_IRQ_0_PRIORITY,
|
||||
shared_irq_isr, DEVICE_GET(shared_irq_1),
|
||||
SHARED_IRQ_1_FLAGS);
|
||||
DT_SHARED_IRQ_SHAREDIRQ1_IRQ_0_SENSE);
|
||||
}
|
||||
|
||||
#endif /* CONFIG_SHARED_IRQ_1 */
|
||||
|
|
28
dts/bindings/interrupt-controller/shared-irq.yaml
Normal file
28
dts/bindings/interrupt-controller/shared-irq.yaml
Normal file
|
@ -0,0 +1,28 @@
|
|||
---
|
||||
title: Shared IRQ interrupt dispatcher
|
||||
version: 0.1
|
||||
|
||||
description: >
|
||||
This binding describes Shared IRQ interrupt dispatcher
|
||||
|
||||
properties:
|
||||
compatible:
|
||||
category: required
|
||||
type: string
|
||||
description: compatible strings
|
||||
constraint: "shared-irq"
|
||||
generation: define
|
||||
|
||||
interrupts:
|
||||
type: array
|
||||
category: required
|
||||
description: required interrupts
|
||||
generation: define
|
||||
|
||||
label:
|
||||
type: string
|
||||
category: required
|
||||
description: Human readable string describing the device (used by Zephyr for API name)
|
||||
generation: define
|
||||
|
||||
...
|
|
@ -105,4 +105,13 @@
|
|||
status = "disabled";
|
||||
};
|
||||
};
|
||||
|
||||
sharedirq0: sharedirq0 {
|
||||
compatible = "shared-irq";
|
||||
label = "SHARED_IRQ0";
|
||||
interrupts = <18 IRQ_TYPE_LEVEL_LOW 2>;
|
||||
interrupt-parent = <&intc>;
|
||||
|
||||
status = "disabled";
|
||||
};
|
||||
};
|
||||
|
|
|
@ -23,17 +23,6 @@ if SHARED_IRQ
|
|||
config SHARED_IRQ_0
|
||||
default y
|
||||
|
||||
if SHARED_IRQ_0
|
||||
|
||||
config SHARED_IRQ_0_NAME
|
||||
default "SHARED_IRQ0"
|
||||
config SHARED_IRQ_0_IRQ
|
||||
default 18
|
||||
config SHARED_IRQ_0_PRI
|
||||
default 2
|
||||
|
||||
endif # SHARED_IRQ_0
|
||||
|
||||
endif # SHARED_IRQ
|
||||
|
||||
if PCI_LEGACY_BRIDGE
|
||||
|
@ -67,9 +56,6 @@ if I2C_0
|
|||
config I2C_0_IRQ_PRI
|
||||
default 2
|
||||
|
||||
config I2C_DW_0_IRQ_SHARED_NAME
|
||||
default SHARED_IRQ_0_NAME if SHARED_IRQ
|
||||
|
||||
endif # I2C_0
|
||||
|
||||
endif # I2C_DW
|
||||
|
@ -120,8 +106,6 @@ config GPIO_DW_0_NAME
|
|||
default "GPIO_0"
|
||||
config GPIO_DW_0_IRQ_PRI
|
||||
default 2
|
||||
config GPIO_DW_0_IRQ_SHARED_NAME
|
||||
default SHARED_IRQ_0_NAME if SHARED_IRQ
|
||||
|
||||
endif # GPIO_DW_0
|
||||
|
||||
|
@ -190,13 +174,6 @@ if ETH_DW
|
|||
config ETH_DW_0
|
||||
default y
|
||||
|
||||
if ETH_DW_0
|
||||
|
||||
config ETH_DW_0_IRQ_SHARED_NAME
|
||||
default SHARED_IRQ_0_NAME if SHARED_IRQ
|
||||
|
||||
endif # ETH_DW_0
|
||||
|
||||
endif # ETH_DW
|
||||
|
||||
endif # NET_L2_ETHERNET
|
||||
|
|
|
@ -41,3 +41,15 @@
|
|||
#define DT_SPI_1_IRQ_FLAGS DT_INTEL_INTEL_SPI_90008000_IRQ_0_SENSE
|
||||
#define DT_SPI_1_IRQ_PRI DT_INTEL_INTEL_SPI_90008000_IRQ_0_PRIORITY
|
||||
#define DT_SPI_1_NAME DT_INTEL_INTEL_SPI_90008000_LABEL
|
||||
|
||||
#ifdef CONFIG_I2C_0
|
||||
#define CONFIG_I2C_DW_0_IRQ_SHARED_NAME DT_SHARED_IRQ_SHAREDIRQ0_LABEL
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_GPIO_DW_0
|
||||
#define CONFIG_GPIO_DW_0_IRQ_SHARED_NAME DT_SHARED_IRQ_SHAREDIRQ0_LABEL
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_ETH_DW_0
|
||||
#define CONFIG_ETH_DW_0_IRQ_SHARED_NAME DT_SHARED_IRQ_SHAREDIRQ0_LABEL
|
||||
#endif
|
||||
|
|
Loading…
Reference in a new issue