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:
parent
8427f5e9b1
commit
4c5e94317c
2 changed files with 14 additions and 1 deletions
|
@ -20,6 +20,7 @@
|
||||||
#include <soc.h>
|
#include <soc.h>
|
||||||
#include <drivers/clock_control.h>
|
#include <drivers/clock_control.h>
|
||||||
#include <drivers/timer/system_timer.h>
|
#include <drivers/timer/system_timer.h>
|
||||||
|
#include <drivers/pinctrl.h>
|
||||||
#include <sys_clock.h>
|
#include <sys_clock.h>
|
||||||
|
|
||||||
/* RTC registers. */
|
/* RTC registers. */
|
||||||
|
@ -78,6 +79,9 @@ static volatile uint32_t rtc_counter;
|
||||||
/* Tick value of the next timeout. */
|
/* Tick value of the next timeout. */
|
||||||
static volatile uint32_t rtc_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 */
|
#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)
|
static int sys_clock_driver_init(const struct device *dev)
|
||||||
{
|
{
|
||||||
|
int retval;
|
||||||
|
|
||||||
ARG_UNUSED(dev);
|
ARG_UNUSED(dev);
|
||||||
|
|
||||||
#ifdef MCLK
|
#ifdef MCLK
|
||||||
|
@ -258,6 +264,11 @@ static int sys_clock_driver_init(const struct device *dev)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
retval = pinctrl_apply_state(pcfg, PINCTRL_STATE_DEFAULT);
|
||||||
|
if (retval < 0) {
|
||||||
|
return retval;
|
||||||
|
}
|
||||||
|
|
||||||
/* Reset module to hardware defaults. */
|
/* Reset module to hardware defaults. */
|
||||||
rtc_reset();
|
rtc_reset();
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,9 @@ description: Atmel SAM0 RTC
|
||||||
|
|
||||||
compatible: "atmel,sam0-rtc"
|
compatible: "atmel,sam0-rtc"
|
||||||
|
|
||||||
include: rtc.yaml
|
include:
|
||||||
|
- name: rtc.yaml
|
||||||
|
- name: pinctrl-device.yaml
|
||||||
|
|
||||||
properties:
|
properties:
|
||||||
reg:
|
reg:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue