File tree Expand file tree Collapse file tree 6 files changed +8
-11
lines changed Expand file tree Collapse file tree 6 files changed +8
-11
lines changed Original file line number Diff line number Diff line change 11/*
22 * Copyright (c) 2018 Aurelien Jarno
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/entropy.h>
12+ #include <zephyr/drivers/clock_control/atmel_sam_pmc.h>
1113#include <errno.h>
1214#include <zephyr/init.h>
1315#include <zephyr/kernel.h>
@@ -165,8 +167,10 @@ static int entropy_sam_init(const struct device *dev)
165167 /* Enable the TRNG */
166168 trng -> CTRLA .bit .ENABLE = 1 ;
167169#else
168- /* Enable the user interface clock */
169- soc_pmc_peripheral_enable (DT_INST_PROP (0 , peripheral_id ));
170+ /* Enable TRNG in PMC */
171+ const struct atmel_sam_pmc_config clock_cfg = SAM_DT_INST_CLOCK_PMC_CFG (0 );
172+ (void )clock_control_on (SAM_DT_PMC_CONTROLLER ,
173+ (clock_control_subsys_t * )& clock_cfg );
170174
171175 /* Enable the TRNG */
172176 trng -> TRNG_CR = TRNG_CR_KEY_PASSWD | TRNG_CR_ENABLE ;
Original file line number Diff line number Diff line change 229229 compatible = "atmel,sam-trng";
230230 reg = <0x40068000 0x4000>;
231231 interrupts = <73 0>;
232- peripheral-id = <17>;
232+ clocks = <&pmc PMC_TYPE_PERIPHERAL 17>;
233233 status = "okay";
234234 };
235235
Original file line number Diff line number Diff line change 279279 trng: random@42002800 {
280280 compatible = "atmel,sam-trng";
281281 reg = <0x42002800 0x1e>;
282- peripheral-id = <0>;
283282 interrupts = <131 0>;
284283 };
285284
Original file line number Diff line number Diff line change 386386 compatible = "atmel,sam-trng";
387387 reg = <0x40070000 0x4000>;
388388 interrupts = <57 0>;
389- peripheral-id = <57>;
389+ clocks = <&pmc PMC_TYPE_PERIPHERAL 57>;
390390 status = "okay";
391391 };
392392
Original file line number Diff line number Diff line change 195195 trng: random@42003800 {
196196 compatible = "atmel,sam-trng";
197197 reg = <0x42003800 0x24>;
198- peripheral-id = <0>;
199198 interrupts = <27 0>;
200199 };
201200 };
Original file line number Diff line number Diff line change @@ -13,8 +13,3 @@ properties:
1313
1414 interrupts :
1515 required : true
16-
17- peripheral-id :
18- type : int
19- description : peripheral ID
20- required : true
You can’t perform that action at this time.
0 commit comments