drivers: counter_nrfx_rtc: Port driver to DTS
This commit updates the counter_nrfx_rtc driver in order to use device tree infrastructure. Signed-off-by: Piotr Zięcik <piotr.ziecik@nordicsemi.no>
This commit is contained in:
parent
0d1665e93a
commit
298b841873
8 changed files with 98 additions and 35 deletions
|
@ -158,16 +158,6 @@ config COUNTER_RTC0
|
||||||
|
|
||||||
if COUNTER_RTC0
|
if COUNTER_RTC0
|
||||||
|
|
||||||
config COUNTER_RTC0_NAME
|
|
||||||
string "Counter device name"
|
|
||||||
default "RTC Counter 0"
|
|
||||||
help
|
|
||||||
Specify the device name for Counter driver instance.
|
|
||||||
|
|
||||||
config COUNTER_RTC0_IRQ_PRI
|
|
||||||
int "Counter interrupt priority"
|
|
||||||
default 0
|
|
||||||
|
|
||||||
config COUNTER_RTC0_PRESCALER
|
config COUNTER_RTC0_PRESCALER
|
||||||
int "RTC prescaler"
|
int "RTC prescaler"
|
||||||
default 0
|
default 0
|
||||||
|
@ -186,16 +176,6 @@ config COUNTER_RTC1
|
||||||
|
|
||||||
if COUNTER_RTC1
|
if COUNTER_RTC1
|
||||||
|
|
||||||
config COUNTER_RTC1_NAME
|
|
||||||
string "Counter device name"
|
|
||||||
default "RTC Counter 1"
|
|
||||||
help
|
|
||||||
Specify the device name for Counter driver instance.
|
|
||||||
|
|
||||||
config COUNTER_RTC1_IRQ_PRI
|
|
||||||
int "Counter interrupt priority"
|
|
||||||
default 0
|
|
||||||
|
|
||||||
config COUNTER_RTC1_PRESCALER
|
config COUNTER_RTC1_PRESCALER
|
||||||
int "RTC prescaler"
|
int "RTC prescaler"
|
||||||
default 0
|
default 0
|
||||||
|
@ -213,16 +193,6 @@ config COUNTER_RTC2
|
||||||
|
|
||||||
if COUNTER_RTC2
|
if COUNTER_RTC2
|
||||||
|
|
||||||
config COUNTER_RTC2_NAME
|
|
||||||
string "Counter device name"
|
|
||||||
default "RTC Counter 2"
|
|
||||||
help
|
|
||||||
Specify the device name for Counter driver instance.
|
|
||||||
|
|
||||||
config COUNTER_RTC2_IRQ_PRI
|
|
||||||
int "Counter interrupt priority"
|
|
||||||
default 0
|
|
||||||
|
|
||||||
config COUNTER_RTC2_PRESCALER
|
config COUNTER_RTC2_PRESCALER
|
||||||
int "RTC prescaler"
|
int "RTC prescaler"
|
||||||
default 0
|
default 0
|
||||||
|
|
|
@ -245,8 +245,8 @@ static const struct counter_driver_api counter_nrfx_driver_api = {
|
||||||
} \
|
} \
|
||||||
static int counter_##idx##_init(struct device *dev) \
|
static int counter_##idx##_init(struct device *dev) \
|
||||||
{ \
|
{ \
|
||||||
IRQ_CONNECT(NRFX_IRQ_NUMBER_GET(NRF_RTC##idx), \
|
IRQ_CONNECT(DT_NORDIC_NRF_RTC_RTC_##idx##_IRQ, \
|
||||||
CONFIG_COUNTER_RTC##idx##_IRQ_PRI, \
|
DT_NORDIC_NRF_RTC_RTC_##idx##_IRQ_PRIORITY, \
|
||||||
nrfx_isr, nrfx_rtc_##idx##_irq_handler, 0); \
|
nrfx_isr, nrfx_rtc_##idx##_irq_handler, 0); \
|
||||||
const nrfx_rtc_config_t config = { \
|
const nrfx_rtc_config_t config = { \
|
||||||
.prescaler = CONFIG_COUNTER_RTC##idx##_PRESCALER, \
|
.prescaler = CONFIG_COUNTER_RTC##idx##_PRESCALER, \
|
||||||
|
@ -269,7 +269,8 @@ static const struct counter_driver_api counter_nrfx_driver_api = {
|
||||||
.rtc = NRFX_RTC_INSTANCE(idx), \
|
.rtc = NRFX_RTC_INSTANCE(idx), \
|
||||||
LOG_INSTANCE_PTR_INIT(log, LOG_MODULE_NAME, idx) \
|
LOG_INSTANCE_PTR_INIT(log, LOG_MODULE_NAME, idx) \
|
||||||
}; \
|
}; \
|
||||||
DEVICE_AND_API_INIT(rtc_##idx, CONFIG_COUNTER_RTC##idx##_NAME, \
|
DEVICE_AND_API_INIT(rtc_##idx, \
|
||||||
|
DT_NORDIC_NRF_RTC_RTC_##idx##_LABEL, \
|
||||||
counter_##idx##_init, \
|
counter_##idx##_init, \
|
||||||
&counter_##idx##_data, \
|
&counter_##idx##_data, \
|
||||||
&nrfx_counter_##idx##_config.info, \
|
&nrfx_counter_##idx##_config.info, \
|
||||||
|
|
|
@ -47,6 +47,8 @@
|
||||||
gpiote-0 = &gpiote;
|
gpiote-0 = &gpiote;
|
||||||
wdt-0 = &wdt;
|
wdt-0 = &wdt;
|
||||||
qdec-0 = &qdec;
|
qdec-0 = &qdec;
|
||||||
|
rtc-0 = &rtc0;
|
||||||
|
rtc-1 = &rtc1;
|
||||||
};
|
};
|
||||||
|
|
||||||
soc {
|
soc {
|
||||||
|
@ -141,6 +143,22 @@
|
||||||
label = "SPI_1";
|
label = "SPI_1";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
rtc0: rtc@4000b000 {
|
||||||
|
compatible = "nordic,nrf-rtc";
|
||||||
|
reg = <0x4000b000 0x1000>;
|
||||||
|
interrupts = <11 1>;
|
||||||
|
status = "ok";
|
||||||
|
label = "RTC_0";
|
||||||
|
};
|
||||||
|
|
||||||
|
rtc1: rtc@40011000 {
|
||||||
|
compatible = "nordic,nrf-rtc";
|
||||||
|
reg = <0x40011000 0x1000>;
|
||||||
|
interrupts = <17 1>;
|
||||||
|
status = "ok";
|
||||||
|
label = "RTC_1";
|
||||||
|
};
|
||||||
|
|
||||||
wdt: watchdog@40010000 {
|
wdt: watchdog@40010000 {
|
||||||
compatible = "nordic,nrf-watchdog";
|
compatible = "nordic,nrf-watchdog";
|
||||||
reg = <0x40010000 0x1000>;
|
reg = <0x40010000 0x1000>;
|
||||||
|
|
|
@ -45,6 +45,8 @@
|
||||||
wdt-0 = &wdt;
|
wdt-0 = &wdt;
|
||||||
pwm-0 = &pwm0;
|
pwm-0 = &pwm0;
|
||||||
qdec-0 = &qdec;
|
qdec-0 = &qdec;
|
||||||
|
rtc-0 = &rtc0;
|
||||||
|
rtc-1 = &rtc1;
|
||||||
};
|
};
|
||||||
|
|
||||||
soc {
|
soc {
|
||||||
|
@ -128,6 +130,22 @@
|
||||||
label = "SPI_0";
|
label = "SPI_0";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
rtc0: rtc@4000b000 {
|
||||||
|
compatible = "nordic,nrf-rtc";
|
||||||
|
reg = <0x4000b000 0x1000>;
|
||||||
|
interrupts = <11 1>;
|
||||||
|
status = "ok";
|
||||||
|
label = "RTC_0";
|
||||||
|
};
|
||||||
|
|
||||||
|
rtc1: rtc@40011000 {
|
||||||
|
compatible = "nordic,nrf-rtc";
|
||||||
|
reg = <0x40011000 0x1000>;
|
||||||
|
interrupts = <17 1>;
|
||||||
|
status = "ok";
|
||||||
|
label = "RTC_1";
|
||||||
|
};
|
||||||
|
|
||||||
wdt: watchdog@40010000 {
|
wdt: watchdog@40010000 {
|
||||||
compatible = "nordic,nrf-watchdog";
|
compatible = "nordic,nrf-watchdog";
|
||||||
reg = <0x40010000 0x1000>;
|
reg = <0x40010000 0x1000>;
|
||||||
|
|
|
@ -51,6 +51,9 @@
|
||||||
pwm-1 = &pwm1;
|
pwm-1 = &pwm1;
|
||||||
pwm-2 = &pwm2;
|
pwm-2 = &pwm2;
|
||||||
qdec-0 = &qdec;
|
qdec-0 = &qdec;
|
||||||
|
rtc-0 = &rtc0;
|
||||||
|
rtc-1 = &rtc1;
|
||||||
|
rtc-2 = &rtc2;
|
||||||
};
|
};
|
||||||
|
|
||||||
soc {
|
soc {
|
||||||
|
@ -181,6 +184,30 @@
|
||||||
label = "SPI_2";
|
label = "SPI_2";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
rtc0: rtc@4000b000 {
|
||||||
|
compatible = "nordic,nrf-rtc";
|
||||||
|
reg = <0x4000b000 0x1000>;
|
||||||
|
interrupts = <11 1>;
|
||||||
|
status = "ok";
|
||||||
|
label = "RTC_0";
|
||||||
|
};
|
||||||
|
|
||||||
|
rtc1: rtc@40011000 {
|
||||||
|
compatible = "nordic,nrf-rtc";
|
||||||
|
reg = <0x40011000 0x1000>;
|
||||||
|
interrupts = <17 1>;
|
||||||
|
status = "ok";
|
||||||
|
label = "RTC_1";
|
||||||
|
};
|
||||||
|
|
||||||
|
rtc2: rtc@40024000 {
|
||||||
|
compatible = "nordic,nrf-rtc";
|
||||||
|
reg = <0x40024000 0x1000>;
|
||||||
|
interrupts = <36 1>;
|
||||||
|
status = "ok";
|
||||||
|
label = "RTC_2";
|
||||||
|
};
|
||||||
|
|
||||||
wdt: watchdog@40010000 {
|
wdt: watchdog@40010000 {
|
||||||
compatible = "nordic,nrf-watchdog";
|
compatible = "nordic,nrf-watchdog";
|
||||||
reg = <0x40010000 0x1000>;
|
reg = <0x40010000 0x1000>;
|
||||||
|
|
|
@ -58,6 +58,9 @@
|
||||||
pwm-2 = &pwm2;
|
pwm-2 = &pwm2;
|
||||||
pwm-3 = &pwm3;
|
pwm-3 = &pwm3;
|
||||||
qdec-0 = &qdec;
|
qdec-0 = &qdec;
|
||||||
|
rtc-0 = &rtc0;
|
||||||
|
rtc-1 = &rtc1;
|
||||||
|
rtc-2 = &rtc2;
|
||||||
};
|
};
|
||||||
|
|
||||||
soc {
|
soc {
|
||||||
|
@ -224,6 +227,30 @@
|
||||||
label = "SPI_3";
|
label = "SPI_3";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
rtc0: rtc@4000b000 {
|
||||||
|
compatible = "nordic,nrf-rtc";
|
||||||
|
reg = <0x4000b000 0x1000>;
|
||||||
|
interrupts = <11 1>;
|
||||||
|
status = "ok";
|
||||||
|
label = "RTC_0";
|
||||||
|
};
|
||||||
|
|
||||||
|
rtc1: rtc@40011000 {
|
||||||
|
compatible = "nordic,nrf-rtc";
|
||||||
|
reg = <0x40011000 0x1000>;
|
||||||
|
interrupts = <17 1>;
|
||||||
|
status = "ok";
|
||||||
|
label = "RTC_1";
|
||||||
|
};
|
||||||
|
|
||||||
|
rtc2: rtc@40024000 {
|
||||||
|
compatible = "nordic,nrf-rtc";
|
||||||
|
reg = <0x40024000 0x1000>;
|
||||||
|
interrupts = <36 1>;
|
||||||
|
status = "ok";
|
||||||
|
label = "RTC_2";
|
||||||
|
};
|
||||||
|
|
||||||
usbd: usbd@40027000 {
|
usbd: usbd@40027000 {
|
||||||
compatible = "nordic,nrf-usbd";
|
compatible = "nordic,nrf-usbd";
|
||||||
reg = <0x40027000 0x1000>;
|
reg = <0x40027000 0x1000>;
|
||||||
|
|
|
@ -191,6 +191,7 @@ rtc0: rtc@14000 {
|
||||||
reg = <0x14000 0x1000>;
|
reg = <0x14000 0x1000>;
|
||||||
interrupts = <20 1>;
|
interrupts = <20 1>;
|
||||||
status = "ok";
|
status = "ok";
|
||||||
|
label = "RTC_0";
|
||||||
};
|
};
|
||||||
|
|
||||||
rtc1: rtc@15000 {
|
rtc1: rtc@15000 {
|
||||||
|
@ -198,6 +199,7 @@ rtc1: rtc@15000 {
|
||||||
reg = <0x15000 0x1000>;
|
reg = <0x15000 0x1000>;
|
||||||
interrupts = <21 1>;
|
interrupts = <21 1>;
|
||||||
status = "ok";
|
status = "ok";
|
||||||
|
label = "RTC_1";
|
||||||
};
|
};
|
||||||
|
|
||||||
clock: clock@5000 {
|
clock: clock@5000 {
|
||||||
|
|
|
@ -44,11 +44,11 @@ const char *devices[] = {
|
||||||
#endif
|
#endif
|
||||||
#ifdef CONFIG_COUNTER_RTC0
|
#ifdef CONFIG_COUNTER_RTC0
|
||||||
/* Nordic RTC0 may be reserved for Bluetooth */
|
/* Nordic RTC0 may be reserved for Bluetooth */
|
||||||
CONFIG_COUNTER_RTC0_NAME,
|
DT_NORDIC_NRF_RTC_RTC_0_LABEL,
|
||||||
#endif
|
#endif
|
||||||
/* Nordic RTC1 is used for the system clock */
|
/* Nordic RTC1 is used for the system clock */
|
||||||
#ifdef CONFIG_COUNTER_RTC2
|
#ifdef CONFIG_COUNTER_RTC2
|
||||||
CONFIG_COUNTER_RTC2_NAME,
|
DT_NORDIC_NRF_RTC_RTC_2_LABEL,
|
||||||
#endif
|
#endif
|
||||||
#ifdef CONFIG_COUNTER_IMX_EPIT_1
|
#ifdef CONFIG_COUNTER_IMX_EPIT_1
|
||||||
DT_COUNTER_IMX_EPIT_1_LABEL,
|
DT_COUNTER_IMX_EPIT_1_LABEL,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue