[PATCH v6 00/11] Add Renesas RZ/G3E GPT support
From: Biju
Date: Thu Jun 04 2026 - 06:10:45 EST
From: Biju Das <biju.das.jz@xxxxxxxxxxxxxx>
This series extends the RZ/G2L GPT PWM driver with RZ/G3E SoC support.
The RZ/G3E GPT has a number of hardware differences compared to RZ/G2L:
it exposes 16 channels (across two GPT instances of 8 channels each),
uses a 4-bit GTCR prescaler field (versus 3-bit on RZ/G2L), and has a
discontinuous prescale sequence with powers-of-2 scaling rather than the
continuous powers-of-4 sequence on RZ/G2L. It also has additional clocks
and resets (bus clock and rst_s).
To accommodate these differences cleanly the series proceeds as follows:
Patch 1 fixes overflow with period_ticks variable.
Patches 2-3 add DT binding documentation for the renesas,poegs property
(allowing GPT channels to be linked with POEG for output-disable) and
implement the corresponding driver support. This configures GTINTAD to
route output-disable requests to the correct POEG group and sets GTIOR
to tri-state both output pins on an output-disable event.
Patch 4-5 small cleanup adding missing newlines to dev_err_probe()
messages and removing an unused parameter from
rzg2l_gpt_calculate_prescale().
Patch 6 migrates the driver from the legacy .get_state/.apply ops to
the new waveform callback interface, introducing struct
rzg2l_gpt_waveform to hold the hardware configuration (gtpr, gtccr,
prescale) for a single channel.
Patches 7-9 introduce struct rzg2l_gpt_info to capture SoC-specific
hardware differences, adding fields for the GTCR prescaler mask
(gtcr_tpcs), the prescaler multiplier (prescale_mult), and a
calculate_prescale() function pointer. This cleanly abstracts the
per-SoC prescaler logic needed for RZ/G3E.
Patch 10 adds DT binding documentation for the RZ/G3E GPT
(renesas,r9a09g047-gpt), covering its 16-channel layout, 64 interrupts,
dual clocks and dual resets.
Patch 11 adds the RZ/G3E driver support itself, wiring up the new
rzg3e_data match entry with its own prescale calculation, prescaler
field mask, and prescale multiplier.
v5->v6:
* Added patch for fixing period_ticks overflow.
* Added patch to add missing newlines to dev_err_probe() messages.
* Dropped extra space in poegs variable assignment in
rzg2l_gpt_poeg_init().
* Updated the comment sections of rzg2l_gpt_poeg_init() with POEG and GPT
in upper-case and replaced configure->configures.
* Format specifiers in dev_err() changed from %d to %u in
rzg2l_gpt_poeg_init().
* Dropped local variables pv and dc from rzg2l_gpt_round_waveform_tohw().
* Dropped blank line in rzg2l_gpt_round_waveform_tohw().
* Moved assignment of rzg2l_gpt->period_ticks[ch] to *_write_waveform().
* Restored clamping of duty_ticks with period_ticks in
rzg2l_gpt_round_waveform_tohw().
* Simplified rzg2l_gpt_write_waveform() using else if statement.
* Dropped local variable gptr in rzg2l_gpt_write_waveform().
* Moved mutex after early return in rzg2l_gpt_round_waveform_tohw().
* Dropped extra parameter rzg2l_gpt from rzg2l_gpt_calculate_prescale()
in rzg2l_gpt_round_waveform_tohw().
* Updated comment in rzg2l_gpt_calculate_period_or_duty().
* Updated rzg3e_gpt_calculate_prescale().
v4->v5:
* Merged GPT linking POEG patch series here.
* Dropped suspend/resume patch; will be added later.
* Updated commit description for patches #2, #4, #5, and #6.
* Replaced return type of rzg2l_gpt_poeg_init() from void to int and
probe() check this return value.
* Added more error checks in rzg2l_gpt_poeg_init().
* Added a patch to drop the unused rzg2l_gpt_chip parameter from
rzg2l_gpt_calculate_prescale().
* Updated rzg2l_gpt_round_waveform_tohw() to initialize gtccr when the
period of the second channel is smaller.
* Replaced period_ticks with RZG2L_MAX_TICKS for the duty_ticks maximum
value check in rzg2l_gpt_round_waveform_tohw().
v3->v4:
* Added wave form callback conversion back to this patch series.
* Updated rzg2l_gpt_is_ch_enabled() fit into 80-character limit for
consistency with other functions.
* Dropped field_{get,prep} as mainline now support it.
* Updated commit description for patch#3
* Retained RZG2L_GTCR_TPCS bit definitons
* Replaced gtcr_tpcs_mask->gtcr_tpcs
* Updated commit header and description for patch#4
* Renamed prescale_pow_of_two_mult_factor->prescale_mult
* Added RZG3E_GTCR_TPCS bit definition for RZ/G3E and added to
rzg3e_data.
* Added error checks on suspend() and device set to operational state
on failure().
* Added Rb tag from Geert for SoC dtsi.
* Added SW_GPIO9_CAN1_STB check to gpt0 node.
v2->v3:
* Added Rb tag from Rob for bindings patch
* Dropped wave form callback conversion from this patch series as
it is covered in another series[1]
* Added suspend/resume support.
v1->v2:
* Created separate document for RZ/G3E GPT.
* Updated commit header and description for binding patch.
* Added waveform callback conversion to this series.
* Collected tag.
* Added link to hardware manual
* Updated limitation section in driver patch.
Biju Das (11):
pwm: rzg2l-gpt: Fix period_ticks type from u32 to u64
dt-bindings: pwm: rzg2l-gpt: Document renesas,poegs property
pwm: rzg2l-gpt: Add support for gpt linking with poeg
pwm: rzg2l-gpt: Add missing newlines to dev_err_probe() messages
pwm: rzg2l-gpt: Drop unused rzg2l_gpt_chip parameter from
rzg2l_gpt_calculate_prescale()
pwm: rzg2l-gpt: Convert to waveform callbacks
pwm: rzg2l-gpt: Add info variable to struct rzg2l_gpt_chip
pwm: rzg2l-gpt: Add prescale_mult variable to struct rzg2l_gpt_info
pwm: rzg2l-gpt: Add calculate_prescale() callback to struct
rzg2l_gpt_info
dt-bindings: pwm: Document RZ/G3E GPT support
pwm: rzg2l-gpt: Add RZ/G3E support
.../bindings/pwm/renesas,rzg2l-gpt.yaml | 23 ++
.../bindings/pwm/renesas,rzg3e-gpt.yaml | 323 +++++++++++++++
drivers/pwm/pwm-rzg2l-gpt.c | 379 +++++++++++++-----
3 files changed, 634 insertions(+), 91 deletions(-)
create mode 100644 Documentation/devicetree/bindings/pwm/renesas,rzg3e-gpt.yaml
base-commit: 5b5e33c44a491d5b5e019f527e028bd567a226fa
--
2.43.0