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:
Gerson Fernando Budke 2023-03-07 19:37:11 +01:00 committed by Marti Bolivar
parent c4f1d98ef6
commit 91e219c644
6 changed files with 8 additions and 11 deletions

View file

@ -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;

View file

@ -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";
};

View file

@ -279,7 +279,6 @@
trng: random@42002800 {
compatible = "atmel,sam-trng";
reg = <0x42002800 0x1e>;
peripheral-id = <0>;
interrupts = <131 0>;
};

View file

@ -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";
};

View file

@ -195,7 +195,6 @@
trng: random@42003800 {
compatible = "atmel,sam-trng";
reg = <0x42003800 0x24>;
peripheral-id = <0>;
interrupts = <27 0>;
};
};

View file

@ -13,8 +13,3 @@ properties:
interrupts:
required: true
peripheral-id:
type: int
description: peripheral ID
required: true