drivers: hwinfo: sam: Update to use clock control
This update Atmel SAM hwinfo reset cause driver to use clock control driver. Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
This commit is contained in:
parent
eb2c6d7e2c
commit
08015c8f57
|
@ -1,5 +1,6 @@
|
|||
/*
|
||||
* Copyright (c) 2022 Basalte bv
|
||||
* Copyright (c) 2023 Gerson Fernando Budke
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
@ -8,8 +9,7 @@
|
|||
|
||||
#include <zephyr/device.h>
|
||||
#include <zephyr/drivers/hwinfo.h>
|
||||
#include <zephyr/init.h>
|
||||
#include <soc.h>
|
||||
#include <zephyr/drivers/clock_control/atmel_sam_pmc.h>
|
||||
|
||||
BUILD_ASSERT(DT_NUM_INST_STATUS_OKAY(DT_DRV_COMPAT) == 1,
|
||||
"No atmel,sam-rstc compatible device found");
|
||||
|
@ -56,12 +56,14 @@ int z_impl_hwinfo_get_supported_reset_cause(uint32_t *supported)
|
|||
static int hwinfo_rstc_init(const struct device *dev)
|
||||
{
|
||||
Rstc *regs = (Rstc *)DT_INST_REG_ADDR(0);
|
||||
const struct atmel_sam_pmc_config clock_cfg = SAM_DT_INST_CLOCK_PMC_CFG(0);
|
||||
uint32_t mode;
|
||||
|
||||
ARG_UNUSED(dev);
|
||||
|
||||
/* Enable RSTC in PMC */
|
||||
soc_pmc_peripheral_enable(DT_INST_PROP(0, peripheral_id));
|
||||
(void)clock_control_on(SAM_DT_PMC_CONTROLLER,
|
||||
(clock_control_subsys_t *)&clock_cfg);
|
||||
|
||||
/* Get current Mode Register value */
|
||||
mode = regs->RSTC_MR;
|
||||
|
|
|
@ -216,7 +216,7 @@
|
|||
rstc: rstc@400e1400 {
|
||||
compatible = "atmel,sam-rstc";
|
||||
reg = <0x400e1400 0x10>;
|
||||
peripheral-id = <1>;
|
||||
clocks = <&pmc PMC_TYPE_PERIPHERAL 1>;
|
||||
user-nrst;
|
||||
};
|
||||
|
||||
|
|
|
@ -452,7 +452,7 @@
|
|||
rstc: rstc@400e1800 {
|
||||
compatible = "atmel,sam-rstc";
|
||||
reg = <0x400e1800 0x10>;
|
||||
peripheral-id = <1>;
|
||||
clocks = <&pmc PMC_TYPE_PERIPHERAL 1>;
|
||||
user-nrst;
|
||||
};
|
||||
};
|
||||
|
|
|
@ -11,9 +11,7 @@ properties:
|
|||
reg:
|
||||
required: true
|
||||
|
||||
peripheral-id:
|
||||
type: int
|
||||
description: peripheral ID
|
||||
clocks:
|
||||
required: true
|
||||
|
||||
user-nrst:
|
||||
|
|
Loading…
Reference in a new issue