drivers: qcom: RNG and WDT Driver Consolidation#7855
Conversation
3dd88b6 to
24ab177
Compare
|
Based on above + earlier elaborate review here qualcomm-linux/optee_os#15
|
- Rename prng.c to qcom-rng.c for platform-agnostic naming - Move driver source inclusion to parent qcom/sub.mk with CFG_QCOM_RNG flag - Simplify driver by using generic RNG naming conventions Change-Id: I5b262d5038e10aca7f6b4e8ee93847006b1b0a9f Signed-off-by: Harikrishna <hart@qti.qualcomm.com> Reviewed-by: Selvam Sathappan Periakaruppan <speriaka@qti.qualcomm.com>
- Update from CFG_QCOM_PRNG to unified CFG_QCOM_RNG - Configure RNG_REG_BASE for PRNG variant - Enable CFG_HWRNG_PTA configuration for ipq52xx - When HWRNG_PTA is enabled: - Disable CFG_WITH_SOFTWARE_PRNG to prevent fallback - Force enable CFG_QCOM_RNG to use hardware QRNG driver - Configure HWRNG quality to 1024 bits entropy - Set HWRNG rate to 0 (unlimited) Signed-off-by: Harikrishna <hart@qti.qualcomm.com> Reviewed-by: Selvam Sathappan Periakaruppan <speriaka@qti.qualcomm.com>
QCOM platforms manage secure watchdog via driver_init() without framework registration. This is sufficient as QCOM currently does not require HLOS control over the secure watchdog. The implementation maintains separation between secure and non-secure world watchdog management. Key implementation details: - Maps APSS_WDT_TMR2_BASE into secure I/O memory - Configures bark timeout (6s) and bite timeout (22s) using a 32 KHz watchdog clock, converting milliseconds to hardware ticks - Registers qcom_sec_wdog_bark_handler() for SEC_WDOG_BARK_INT_ID via interrupt_create_handler() - Bark handler pets the watchdog by writing to WDOG_RESET register Signed-off-by: Harikrishna <hart@qti.qualcomm.com> Reviewed-by: Selvam Sathappan Periakaruppan <speriaka@qti.qualcomm.com>
- CFG_QCOM_SEC_WDOG enabled in bobcat/arch.mk for all Bobcat targets - Per-target hardware addresses (WDT_TMR_BASE, WDT_BARK_INT_ID, WDT_RESET_REG_OFFSET) defined in target-specific target_config.h files: - ipq96xx/ipq54xx: base=0x0F411000, bark_int=0x36 - ipq52xx: base=0x0B117000, bark_int=0x23 Signed-off-by: Harikrishna <hart@qti.qualcomm.com> Reviewed-by: Selvam Sathappan Periakaruppan <speriaka@qti.qualcomm.com>
24ab177 to
c9b45b6
Compare
| } | ||
|
|
||
| static TEE_Result qcom_prng_init(void) | ||
| static TEE_Result rng_init(void) |
There was a problem hiding this comment.
Rather rename the API as qcom_rng_init().
| # | ||
|
|
||
| global-incdirs-y += . | ||
| srcs-$(CFG_QCOM_RNG) += qcom-rng.c |
There was a problem hiding this comment.
Is this sub.mk really needed as you include the file in outside sub.mk directly?
| #include <rng_support.h> | ||
|
|
||
| #define SEC_PRNG_REG_SIZE 0x1000 | ||
| #define RNG_REG_SIZE 0x1000 |
There was a problem hiding this comment.
Rather rename all the macros with a QCOM_ prefix
| } prng = { | ||
| .pa = SEC_PRNG_REG_BASE, | ||
| } rng = { | ||
| .pa = RNG_REG_BASE, |
There was a problem hiding this comment.
This will break build after this individual commit, change the targets to define the new macro: QCOM_RNG_REG_BASE in this commit only.
| CFG_QCOM_RAMBLUR_TA_WINDOW_ID ?= 2 | ||
|
|
||
| $(call force,CFG_QCOM_PRNG,y) | ||
| $(call force,CFG_QCOM_RNG,y) |
There was a problem hiding this comment.
These changes should be folded in prior commit as the driver was already enabled for hoya platforms.
There was a problem hiding this comment.
Don't write commit descriptions as all the bullet point, rather than write small paras to summarize.
| static uint32_t ms_to_ticks_wdt(uint32_t ms) | ||
| { | ||
| return (uint32_t)(((uint64_t)ms * WDT_CLK_HZ) / 1000U); | ||
| } |
| return TEE_SUCCESS; | ||
| } | ||
|
|
||
| driver_init(wdt_init); |
There was a problem hiding this comment.
Use qcom_ prefixes for the APIs and macros.
|
|
||
| srcs-$(CFG_QCOM_RAMBLUR_PIMEM_V3) += ramblur/ramblur_pimem_v3.c | ||
| srcs-$(CFG_QCOM_RNG) += rng/qcom-rng.c | ||
| srcs-$(CFG_QCOM_SEC_WDOG) += wdt/wdt.c |
| #define RNG_REG_BASE UL(0x4C5000) | ||
|
|
||
| #define WDT_TMR_BASE UL(0x0B117000) | ||
| #define WDT_RESET_REG_OFFSET UL(0x4) |
There was a problem hiding this comment.
Can this offset macro move to the driver itself?
This pull request consolidates and refactors QCOM RNG and WDT drivers
with unified naming conventions and improved configuration management.
RNG Driver Consolidation
Refactor PRNG driver into generic RNG implementation:
Platform configuration updates:
Secure Watchdog Driver
Add secure watchdog driver for Bobcat family:
QCOM platforms manage secure watchdog via driver_init() without framework
registration. This is sufficient as QCOM currently does not require HLOS
control over the secure watchdog. The implementation maintains separation
between secure and non-secure world watchdog management.
Implementation details:
Platform enablement for Bobcat family: