|
ra8-firmware 0.1.0
Bare-metal firmware for the Renesas RA8 family (RA8D2 / RA8P1)
|
MIPI D-PHY driver – HUM timing tables and table-driven setup. More...
#include <stdint.h>#include "ra8_attributes.h"#include "ra8_err.h"#include "ra8_mipi_phy.h"#include "ra8_mipi_phy_internal.h"#include "ra8_mipi_phy_regs.h"Go to the source code of this file.
Data Structures | |
| struct | mipi_phy_table_row_t |
| One row of HUM Tables 64.2 / 64.3 with the rate ceiling. More... | |
Enumerations | |
| enum | mipi_pll_frac_t : uint16_t { k_mipi_pll_percent_scale = 100U , k_mipi_nf_x100_33 = 33U , k_mipi_nf_x100_66 = 66U , k_mipi_nf_x100_50 = 50U } |
| PLL fixed-point (hundredths) scale and NF fractional table. More... | |
| enum | ra8_mipi_phy_table_szlim_t : uint8_t { k_ra8_mipi_phy_table_pclka_125 = 125U , k_ra8_mipi_phy_table_pclka_120 = 120U , k_ra8_mipi_phy_table_pclka_100 = 100U , k_ra8_mipi_phy_table_pclka_80 = 80U , k_ra8_mipi_phy_table_pclka_75 = 75U , k_ra8_mipi_phy_table_pclka_50 = 50U , k_ra8_mipi_phy_table_pclka_40 = 40U } |
| Static lookup-table cardinalities. More... | |
Functions | |
| static const ra8_mipi_phy_timing_t * | internal_mipi_phy_lookup_timing (const mipi_phy_table_row_t *tbl, uint32_t n, uint8_t pclka, uint16_t rate_mbps, uint8_t mode_flag) |
| Lookup helper – linear scan picks the first row whose rate_max is >= the requested rate within a matching PCLKA bucket. | |
| uint32_t | priv_mipi_phy_compute_freq (const ra8_mipi_phy_pll_t *pll, uint8_t mosc_mhz) |
| Compute the PLL output frequency for a (mosc, pll) tuple. | |
| ra8_err_t | ra8_mipi_phy_select_timing (ra8_mipi_phy_mode_t mode, uint8_t pclka_mhz, uint16_t rate_mbps, ra8_mipi_phy_timing_t *const out_timing) |
| Look up an HUM Table 64.2 / 64.3 row and apply the timing. | |
Variables | |
| static const mipi_phy_table_row_t | s_dsi_table [] |
| HUM Table 64.2 D-PHY timing setting DSI mode (p 3831-3834). | |
| static const mipi_phy_table_row_t | s_csi_table [] |
| HUM Table 64.3 D-PHY timing setting CSI mode (p 3835-3836). | |
MIPI D-PHY driver – HUM timing tables and table-driven setup.
This translation unit holds the bulky portion of the MIPI D-PHY driver that ra8_mipi_phy.c delegates to so that neither file exceeds the scripts/checks/check_file_size.py cap. It owns:
The register-write path used by ra8_mipi_phy_select_timing lives in ra8_mipi_phy.c (priv_mipi_phy_write_timing) and is reached through ra8_mipi_phy_internal.h.
Definition in file ra8_mipi_phy_timing.c.
| enum mipi_pll_frac_t : uint16_t |
PLL fixed-point (hundredths) scale and NF fractional table.
| Enumerator | |
|---|---|
| k_mipi_pll_percent_scale | Hundredths fixed-point scale. |
| k_mipi_nf_x100_33 | NF = 0.33 (x100). |
| k_mipi_nf_x100_66 | NF = 0.66 (x100). |
| k_mipi_nf_x100_50 | NF = 0.50 (x100). |
Definition at line 42 of file ra8_mipi_phy_timing.c.
| enum ra8_mipi_phy_table_szlim_t : uint8_t |
Static lookup-table cardinalities.
Definition at line 79 of file ra8_mipi_phy_timing.c.
|
static |
Lookup helper – linear scan picks the first row whose rate_max is >= the requested rate within a matching PCLKA bucket.
Definition at line 865 of file ra8_mipi_phy_timing.c.
References mipi_phy_table_row_t::t.
Referenced by ra8_mipi_phy_select_timing().
| uint32_t priv_mipi_phy_compute_freq | ( | const ra8_mipi_phy_pll_t * | pll, |
| uint8_t | mosc_mhz ) |
Compute the PLL output frequency for a (mosc, pll) tuple.
Defined in ra8_mipi_phy_timing.c and shared with ra8_mipi_phy_validate_pll_band in ra8_mipi_phy.c. Implements the HUM Ch 64.2.2 p 3823 relation f = fMAIN * I * (NF + N) * P using hundredths fixed-point arithmetic.
| [in] | pll | PLL coefficient block (IDIV / NFMUL / PMUL / NMUL). |
| [in] | mosc_mhz | Main-oscillator frequency in MHz. |
| 0 | The composed divisor product was zero. |
| other | Computed PLL output frequency in MHz. |
Definition at line 880 of file ra8_mipi_phy_timing.c.
References ra8_mipi_phy_pll_t::idiv, k_mipi_nf_x100_33, k_mipi_nf_x100_50, k_mipi_nf_x100_66, k_mipi_pll_percent_scale, ra8_mipi_phy_pll_t::nfmul, ra8_mipi_phy_pll_t::nmul_int, and ra8_mipi_phy_pll_t::pmul.
Referenced by ra8_mipi_phy_validate_pll_band().
|
nodiscard |
Look up an HUM Table 64.2 / 64.3 row and apply the timing.
Tables 64.2 (DSI mode, p 3831-3834) and 64.3 (CSI mode, p 3835-3836) map (PCLKA, lane_rate_mbps) to a ready-made set of DPHYTIMx field values. This helper picks the closest row, fills in a ra8_mipi_phy_timing_t, and writes DPHYTIM1..6.
| [in] | mode | Active mode (DSI vs CSI uses different tables). |
| [in] | pclka_mhz | PCLKA frequency in MHz. |
| [in] | rate_mbps | Per-lane line rate in Mbps. |
| [out] | out_timing | Optional non-NULL pointer to receive the applied timing block (skip with NULL). |
| k_ra8_ok | Timing applied. |
| k_ra8_err_invalid_arg | rate_mbps outside 80..720 or mode outside the enum. |
| k_ra8_err_not_supported | PCLKA does not match any table row. |
Definition at line 900 of file ra8_mipi_phy_timing.c.
References internal_mipi_phy_lookup_timing(), k_ra8_err_invalid_arg, k_ra8_err_not_supported, k_ra8_mipi_phy_line_rate_max_mbps, k_ra8_mipi_phy_line_rate_min_mbps, k_ra8_mipi_phy_mode_csi_device, k_ra8_mipi_phy_mode_dsi_host, k_ra8_ok, priv_mipi_phy_write_timing(), s_csi_table, and s_dsi_table.
|
static |
HUM Table 64.3 D-PHY timing setting CSI mode (p 3835-3836).
CSI rows only constrain TINIT, TCLKMISS, TCLKSETT, THSSETT, TCLKPREP, THSPREP – the high-speed lane fields are not used in device mode (the host side drives them). The struct fields not listed in the table are left zero-filled.
Definition at line 734 of file ra8_mipi_phy_timing.c.
Referenced by ra8_mipi_phy_select_timing().
|
static |
HUM Table 64.2 D-PHY timing setting DSI mode (p 3831-3834).
Rows are ordered by (PCLKA descending, rate ascending). Lookup picks the row with matching PCLKA whose rate_max is the smallest value >= the requested rate.
Definition at line 98 of file ra8_mipi_phy_timing.c.
Referenced by ra8_mipi_phy_select_timing().