File tree Expand file tree Collapse file tree 4 files changed +8
-8
lines changed Expand file tree Collapse file tree 4 files changed +8
-8
lines changed Original file line number Diff line number Diff line change 11/*
22 * Copyright (c) 2022 Basalte bv
3+ * Copyright (c) 2023 Gerson Fernando Budke
34 *
45 * SPDX-License-Identifier: Apache-2.0
56 */
89
910#include <zephyr/device.h>
1011#include <zephyr/drivers/hwinfo.h>
11- #include <zephyr/init.h>
12- #include <soc.h>
12+ #include <zephyr/drivers/clock_control/atmel_sam_pmc.h>
1313
1414BUILD_ASSERT (DT_NUM_INST_STATUS_OKAY (DT_DRV_COMPAT ) == 1 ,
1515 "No atmel,sam-rstc compatible device found" );
@@ -56,12 +56,14 @@ int z_impl_hwinfo_get_supported_reset_cause(uint32_t *supported)
5656static int hwinfo_rstc_init (const struct device * dev )
5757{
5858 Rstc * regs = (Rstc * )DT_INST_REG_ADDR (0 );
59+ const struct atmel_sam_pmc_config clock_cfg = SAM_DT_INST_CLOCK_PMC_CFG (0 );
5960 uint32_t mode ;
6061
6162 ARG_UNUSED (dev );
6263
6364 /* Enable RSTC in PMC */
64- soc_pmc_peripheral_enable (DT_INST_PROP (0 , peripheral_id ));
65+ (void )clock_control_on (SAM_DT_PMC_CONTROLLER ,
66+ (clock_control_subsys_t * )& clock_cfg );
6567
6668 /* Get current Mode Register value */
6769 mode = regs -> RSTC_MR ;
Original file line number Diff line number Diff line change 216216 rstc: rstc@400e1400 {
217217 compatible = "atmel,sam-rstc";
218218 reg = <0x400e1400 0x10>;
219- peripheral-id = <1>;
219+ clocks = <&pmc PMC_TYPE_PERIPHERAL 1>;
220220 user-nrst;
221221 };
222222
Original file line number Diff line number Diff line change 452452 rstc: rstc@400e1800 {
453453 compatible = "atmel,sam-rstc";
454454 reg = <0x400e1800 0x10>;
455- peripheral-id = <1>;
455+ clocks = <&pmc PMC_TYPE_PERIPHERAL 1>;
456456 user-nrst;
457457 };
458458 };
Original file line number Diff line number Diff line change @@ -11,9 +11,7 @@ properties:
1111 reg :
1212 required : true
1313
14- peripheral-id :
15- type : int
16- description : peripheral ID
14+ clocks :
1715 required : true
1816
1917 user-nrst :
You can’t perform that action at this time.
0 commit comments