1 // SPDX-License-Identifier: BSD-2-Clause 2 /* 3 * Texas Instruments K3 DTHEV2 Driver 4 * 5 * Copyright (C) 2025 Texas Instruments Incorporated - https://www.ti.com/ 6 * T Pratham <t-pratham@ti.com> 7 */ 8 9 #include <drivers/ti_sci.h> 10 #include <initcall.h> 11 #include <io.h> 12 #include <keep.h> 13 #include <kernel/interrupt.h> 14 #include <kernel/misc.h> 15 #include <kernel/spinlock.h> 16 #include <mm/core_memprot.h> 17 #include <mm/core_mmu.h> 18 #include <platform_config.h> 19 #include <rng_support.h> 20 21 #include "eip76d_trng.h" 22 #include "ti_crypto.h" 23 dthev2_init(void)24static TEE_Result dthev2_init(void) 25 { 26 TEE_Result result = TEE_SUCCESS; 27 28 result = ti_crypto_init_rng_fwl(DTHEv2_TI_SCI_FW_ID, 29 DTHEv2_TI_SCI_FW_RGN_ID); 30 if (result != TEE_SUCCESS) { 31 EMSG("Failed to enable firewalls for TRNG device"); 32 return result; 33 } 34 35 IMSG("Enabled firewalls for DTHEv2 TRNG device"); 36 37 /* Initialize the RNG Module */ 38 result = eip76d_rng_init(); 39 if (result != TEE_SUCCESS) 40 return result; 41 42 IMSG("DTHEv2 Drivers initialized"); 43 44 return TEE_SUCCESS; 45 } 46 service_init_crypto(dthev2_init); 47