drivers: entropy: sam/sam0: Update to use clock control
This update Atmel SAM trng driver to use clock control driver. Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
This commit is contained in:
parent
c4f1d98ef6
commit
91e219c644
6 changed files with 8 additions and 11 deletions
|
|
@ -1,5 +1,6 @@
|
|||
/*
|
||||
* Copyright (c) 2018 Aurelien Jarno
|
||||
* Copyright (c) 2023 Gerson Fernando Budke
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
|
@ -8,6 +9,7 @@
|
|||
|
||||
#include <zephyr/device.h>
|
||||
#include <zephyr/drivers/entropy.h>
|
||||
#include <zephyr/drivers/clock_control/atmel_sam_pmc.h>
|
||||
#include <errno.h>
|
||||
#include <zephyr/init.h>
|
||||
#include <zephyr/kernel.h>
|
||||
|
|
@ -165,8 +167,10 @@ static int entropy_sam_init(const struct device *dev)
|
|||
/* Enable the TRNG */
|
||||
trng->CTRLA.bit.ENABLE = 1;
|
||||
#else
|
||||
/* Enable the user interface clock */
|
||||
soc_pmc_peripheral_enable(DT_INST_PROP(0, peripheral_id));
|
||||
/* Enable TRNG in PMC */
|
||||
const struct atmel_sam_pmc_config clock_cfg = SAM_DT_INST_CLOCK_PMC_CFG(0);
|
||||
(void)clock_control_on(SAM_DT_PMC_CONTROLLER,
|
||||
(clock_control_subsys_t *)&clock_cfg);
|
||||
|
||||
/* Enable the TRNG */
|
||||
trng->TRNG_CR = TRNG_CR_KEY_PASSWD | TRNG_CR_ENABLE;
|
||||
|
|
|
|||
|
|
@ -229,7 +229,7 @@
|
|||
compatible = "atmel,sam-trng";
|
||||
reg = <0x40068000 0x4000>;
|
||||
interrupts = <73 0>;
|
||||
peripheral-id = <17>;
|
||||
clocks = <&pmc PMC_TYPE_PERIPHERAL 17>;
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -279,7 +279,6 @@
|
|||
trng: random@42002800 {
|
||||
compatible = "atmel,sam-trng";
|
||||
reg = <0x42002800 0x1e>;
|
||||
peripheral-id = <0>;
|
||||
interrupts = <131 0>;
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -386,7 +386,7 @@
|
|||
compatible = "atmel,sam-trng";
|
||||
reg = <0x40070000 0x4000>;
|
||||
interrupts = <57 0>;
|
||||
peripheral-id = <57>;
|
||||
clocks = <&pmc PMC_TYPE_PERIPHERAL 57>;
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -195,7 +195,6 @@
|
|||
trng: random@42003800 {
|
||||
compatible = "atmel,sam-trng";
|
||||
reg = <0x42003800 0x24>;
|
||||
peripheral-id = <0>;
|
||||
interrupts = <27 0>;
|
||||
};
|
||||
};
|
||||
|
|
|
|||
|
|
@ -13,8 +13,3 @@ properties:
|
|||
|
||||
interrupts:
|
||||
required: true
|
||||
|
||||
peripheral-id:
|
||||
type: int
|
||||
description: peripheral ID
|
||||
required: true
|
||||
|
|
|
|||
Loading…
Reference in a new issue