drivers: rtc: Add sam0 support to pinctrl

This add support to pinctrl at Atmel sam0 rtc driver. It allows to
define pins to be used for tamper detection.

Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
This commit is contained in:
Gerson Fernando Budke 2022-03-13 13:20:37 -03:00 committed by Marti Bolivar
commit 4c5e94317c
2 changed files with 14 additions and 1 deletions

View file

@ -20,6 +20,7 @@
#include <soc.h>
#include <drivers/clock_control.h>
#include <drivers/timer/system_timer.h>
#include <drivers/pinctrl.h>
#include <sys_clock.h>
/* RTC registers. */
@ -78,6 +79,9 @@ static volatile uint32_t rtc_counter;
/* Tick value of the next timeout. */
static volatile uint32_t rtc_timeout;
PINCTRL_DT_INST_DEFINE(0);
static const struct pinctrl_dev_config *pcfg = PINCTRL_DT_INST_DEV_CONFIG_GET(0);
#endif /* CONFIG_TICKLESS_KERNEL */
/*
@ -242,6 +246,8 @@ uint32_t sys_clock_cycle_get_32(void)
static int sys_clock_driver_init(const struct device *dev)
{
int retval;
ARG_UNUSED(dev);
#ifdef MCLK
@ -258,6 +264,11 @@ static int sys_clock_driver_init(const struct device *dev)
}
#endif
retval = pinctrl_apply_state(pcfg, PINCTRL_STATE_DEFAULT);
if (retval < 0) {
return retval;
}
/* Reset module to hardware defaults. */
rtc_reset();

View file

@ -5,7 +5,9 @@ description: Atmel SAM0 RTC
compatible: "atmel,sam0-rtc"
include: rtc.yaml
include:
- name: rtc.yaml
- name: pinctrl-device.yaml
properties:
reg: