|
ra8-firmware 0.1.0
Bare-metal firmware for the Renesas RA8 family (RA8D2 / RA8P1)
|
Graphics power-domain bring-up for the LPM HAL driver. More...
#include <stdint.h>#include "ra8_attributes.h"#include "ra8_check.h"#include "ra8_err.h"#include "ra8_log.h"#include "ra8_lpm.h"#include "ra8_lpm_regs.h"#include "ra8_register_protection.h"Go to the source code of this file.
Functions | |
| static ra8_err_t | internal_pdctrgd_wait (uint8_t mask, bool want_set, uint32_t limit) |
| Poll a PDCTRGD status flag until it reads the wanted level. | |
| static void | internal_graphics_enable_moco (void) |
| Start MOCO so the graphics power-gating controller has a clock. | |
| static ra8_err_t | internal_graphics_confirm_ready (uint32_t limit) |
| Wait until PDCSF = 0 and PDPGSF = 1 (domain ready for the clear). | |
| static ra8_err_t | internal_graphics_confirm_powered (uint32_t limit) |
| Wait until PDCSF = 0 and PDPGSF = 0 (gating finished, domain live). | |
| static void | internal_graphics_clear_pdde (void) |
| Clear PDDE under the PRC1 unlock so the domain powers on. | |
| ra8_err_t | ra8_lpm_graphics_power_on (uint32_t timeout_iters) |
| Power the graphics domain on (DRW / GLCDC / MIPI DSI+CSI / VIN). | |
Variables | |
| static const char * | s_tag = "LPM" |
| Component tag used in every log line emitted by this driver. | |
Graphics power-domain bring-up for the LPM HAL driver.
Implements ra8_lpm_graphics_power_on (declared in ra8_lpm.h) and its static helpers. Split out of ra8_lpm.c so neither translation unit exceeds the file-size cap: the graphics power-gating sequence is a distinct responsibility from the sleep-mode / clock-shutdown matrix that remains in the core driver.
The sequence follows HUM Ch 11.5.1 (p 480) and HUM Ch 11.2.14 (PDCTRGD, p 452): start MOCO (MOCOCR is PRC0/CGC), wait for the controller to become ready, clear PDCTRGD.PDDE under the PRC1 unlock to request power-on, then confirm the domain is live. Every protected write runs inside a scoped RA8_PROTECTED_WRITE window so it cannot be silently discarded.
Definition in file ra8_lpm_graphics.c.
|
static |
Clear PDDE under the PRC1 unlock so the domain powers on.
PDCTRGD is PRC1-protected (HUM Ch 13.1 Table 13.1 p 521); without the unlock the clear is dropped. PDDE = 0 powers the domain ON.
Definition at line 162 of file ra8_lpm_graphics.c.
References k_ra8_lpm_pdctrgd_off, k_ra8_prcr_unlock_lpm, RA8_INTERNAL, ra8_lpm_sysc_reg8(), and RA8_PROTECTED_WRITE.
Referenced by ra8_lpm_graphics_power_on().
|
static |
Wait until PDCSF = 0 and PDPGSF = 0 (gating finished, domain live).
Gating is complete when the controller is idle and the domain is no longer gated; split out of ra8_lpm_graphics_power_on for size.
| [in] | limit | Iteration bound handed to internal_pdctrgd_wait. |
| k_ra8_ok | PDCSF == 0 and PDPGSF == 0 within limit polls. |
| k_ra8_err_hw_timeout | A flag never settled. |
limit > 0. Definition at line 140 of file ra8_lpm_graphics.c.
References internal_pdctrgd_wait(), k_ra8_lpm_pdctr_pdcsf_mask, k_ra8_lpm_pdctr_pdpgsf_mask, RA8_INTERNAL, RA8_RETURN_ON_ERROR, and s_tag.
Referenced by ra8_lpm_graphics_power_on().
|
static |
Wait until PDCSF = 0 and PDPGSF = 1 (domain ready for the clear).
HUM Ch 11.2.14 p 452 gates the PDDE clear on PDCSF = 0 then PDPGSF = 1; split out of ra8_lpm_graphics_power_on for size.
| [in] | limit | Iteration bound handed to internal_pdctrgd_wait. |
| k_ra8_ok | PDCSF == 0 and PDPGSF == 1 within limit polls. |
| k_ra8_err_hw_timeout | A flag never settled. |
limit > 0. Definition at line 116 of file ra8_lpm_graphics.c.
References internal_pdctrgd_wait(), k_ra8_lpm_pdctr_pdcsf_mask, k_ra8_lpm_pdctr_pdpgsf_mask, RA8_INTERNAL, RA8_RETURN_ON_ERROR, and s_tag.
Referenced by ra8_lpm_graphics_power_on().
|
static |
Start MOCO so the graphics power-gating controller has a clock.
HUM Ch 11.5.1 p 480 requires MOCOCR.MCSTP = 0 before power gating; MOCOCR is PRC0 (CGC) so the clear runs in a CGC unlock window.
Definition at line 90 of file ra8_lpm_graphics.c.
References k_ra8_lpm_clock_stop_mask, k_ra8_lpm_mococr_off, k_ra8_prcr_unlock_cgc, RA8_INTERNAL, ra8_lpm_sysc_reg8(), and RA8_PROTECTED_WRITE.
Referenced by ra8_lpm_graphics_power_on().
|
static |
Poll a PDCTRGD status flag until it reads the wanted level.
Busy-polls the read-only graphics power-domain status register for at most limit iterations (NASA Rule 2 bound); no PRCR window is needed.
| [in] | mask | k_ra8_lpm_pdctr_*_mask bit to watch. |
| [in] | want_set | true to wait for set, false for clear. |
| [in] | limit | Iteration bound (NASA Rule 2). |
| k_ra8_ok | The watched bit read want_set within limit polls. |
| k_ra8_err_hw_timeout | The bit never reached want_set. |
limit reads of PDCTRGD were issued. Definition at line 66 of file ra8_lpm_graphics.c.
References k_ra8_err_hw_timeout, k_ra8_lpm_pdctrgd_off, k_ra8_ok, RA8_INTERNAL, and ra8_lpm_sysc_reg8().
Referenced by internal_graphics_confirm_powered(), and internal_graphics_confirm_ready().
|
nodiscard |
Power the graphics domain on (DRW / GLCDC / MIPI DSI+CSI / VIN).
Clears PDCTRGD.PDDE so the graphics power domain leaves its gated reset state, then waits for the controller to report the transition complete. HUM Ch 11.5.1 Table 11.7 p 480 lists the domain contents: MIPI DSI, MIPI CSI, VIN, DRW and GLCDC. HUM Ch 11.2.14 p 452 gives the register a reset value of 0x81 – PDPGSF = 1 (gated off) and PDDE = 1 (power off) – so every one of those peripherals is unpowered out of reset and cancelling module-stop alone is not enough to make one respond.
This was the whole of issue #247: the D/AVE 2D engine had never rasterised a pixel on real silicon because nothing ever powered its domain. Bench evidence on an EK-RA8D2 – with PDCTRGD at its 0x81 reset value the DRW HWREVISION register reads 0x00000000; after this call it reads 0x0FBE0107.
Sequence (HUM Ch 11.2.14 p 452 + Ch 11.5.1 p 480):
Idempotent: if the domain is already powered (PDPGSF = 0) the function returns k_ra8_ok without touching the register, so several graphics drivers may each call it during their own init.
| [in] | timeout_iters | Poll-loop bound for each flag wait; must be non-zero. Bounds the loop for NASA Rule 2. |
| k_ra8_ok | Domain powered and gating complete. |
| k_ra8_err_invalid_arg | timeout_iters was 0. |
| k_ra8_err_hw_timeout | A status flag never reached its target state within timeout_iters. |
Definition at line 171 of file ra8_lpm_graphics.c.
References internal_graphics_clear_pdde(), internal_graphics_confirm_powered(), internal_graphics_confirm_ready(), internal_graphics_enable_moco(), k_ra8_err_invalid_arg, k_ra8_lpm_pdctr_pdpgsf_mask, k_ra8_lpm_pdctrgd_off, k_ra8_ok, ra8_log_error, ra8_log_info, ra8_lpm_sysc_reg8(), RA8_RETURN_ON_ERROR, and s_tag.
Referenced by ra8_drw_init().
|
static |
Component tag used in every log line emitted by this driver.
Definition at line 39 of file ra8_lpm_graphics.c.