Repository navigation
Conversation
PR Summary by QodoAdd AM13E eQEP support to the TI counter driver
AI Description
Diagram
High-Level Assessment
Files changed (5)
|
| QEPA/QEPB/QEPI can instead be sourced from an on-chip comparator or | ||
| the PWM crossbar (AM13E-only); these need no pinctrl or mux entry, | ||
| so set the QEPSRCSEL field directly: | ||
|
|
||
| &eqep0 { | ||
| ti,qepa-src = <TI_EQEP_SRC_CMPSS1>; | ||
| }; |
There was a problem hiding this comment.
1. Comparator-sourced eqep fails to initialise 🐞 Bug ≡ Correctness
ti_eqep_init unconditionally applies PINCTRL_STATE_DEFAULT and returns its error, although the binding’s comparator and PWM X-BAR example has no pinctrl-0. When an AM13 EQEP node uses an internal source without a pinctrl state, lookup returns -ENOENT, so initialization stops before the AM13 mux and QEPSRCSEL configuration.
Agent Prompt
## Issue description
The binding documents AM13 EQEP comparator and PWM X-BAR sources without pinctrl, but `ti_eqep_init` fails with `-ENOENT` when those nodes have no default pinctrl state.
## Fix Focus Areas
- drivers/counter/counter_ti_am3352_eqep.c[497-504]
- dts/bindings/counter/ti,am3352-eqep.yaml[27-33]
## Recommended Fix
Allow initialization to continue when an AM13 EQEP node with a configured internal source has no default pinctrl state. Apply the default state and retain existing error handling for nodes that define one. If pinctrl must remain mandatory instead, update the binding text and example to require `pinctrl-0`.
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools
| uint16_t unknown = flg & ~(TI_EQEP_INT_PCOI | TI_EQEP_INT_PCUI | TI_EQEP_INT_PCMI | | ||
| TI_EQEP_INT_SELI | TI_EQEP_INT_IELI | TI_EQEP_INT_UTOI | | ||
| TI_EQEP_INT_GLOB); |
There was a problem hiding this comment.
2. Isr logs errors for flags that were never enabled 🐞 Bug ◔ Observability
The ISR now computes unknown = flg & ~(known) from the raw INTFLG without masking by INTEN,
and it runs on every interrupt rather than only when no known flag matched. Status flags the driver
never enables, such as quadrature direction change (TI_EQEP_INT_QDCI) and phase or position
errors, can be latched when an overflow, compare, index or timeout interrupt fires; each such
interrupt then emits LOG_ERR("unknown interrupt ...") from ISR context.
Agent Prompt
## Issue description
`ti_eqep_isr` reports any latched `INTFLG` bit outside the known set as an error on every interrupt. That includes status flags like QDC that latch without being enabled, so error logs get spammed from ISR context.
## Fix Focus Areas
- drivers/counter/counter_ti_am3352_eqep.c[556-558]
- drivers/counter/counter_ti_am3352_eqep.c[637-641]
## Recommended Fix
Compute `unknown = flg & regs->INTEN & ~(known | TI_EQEP_INT_GLOB)` so only enabled-but-unhandled sources are logged. Clear the remaining non-enabled latched flags silently, or leave them alone. Consider `LOG_DBG` for the silent case.
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools
| /* FREE_SOFT=run-free: keep QUTMR running under debugger halt. */ | ||
| regs->QEPCTL = (regs->QEPCTL & ~TI_EQEP_QEPCTL_FREE_SOFT) | | ||
| FIELD_PREP(TI_EQEP_QEPCTL_FREE_SOFT, TI_EQEP_QEPCTL_FREE_SOFT_RUNFREE); |
There was a problem hiding this comment.
3. Debug-halt timer behaviour changes on all socs 🐞 Bug ≡ Correctness
ti_eqep_init now always rewrites QEPCTL.FREE_SOFT to run-free, outside the CONFIG_COUNTER_TI_AM3352_EQEP_VARIANT_AM13 guard. Existing K3/AM3352 users therefore also get the new debugger-halt behaviour, where position and unit timers keep running while the core is halted, even though the change was meant for AM13.
Agent Prompt
## Issue description
The FREE_SOFT run-free setting applies to all SoCs that use the ti,am3352-eqep driver, not only AM13. This changes debug-halt behaviour on existing platforms.
## Fix Focus Areas
- drivers/counter/counter_ti_am3352_eqep.c[532-534]
## Recommended Fix
Move the FREE_SOFT write inside the AM13 variant block, or make it configurable (Kconfig or DT property). If the change is meant for all SoCs, say so in the commit message.
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools
…EPS...
PR: 121529
Document mux-states routing and ti,qep{a,b,i}-src, include mux-consumer,
and add QEPSRCSEL source macros.
Signed-off-by: Aditya Chopra <a-chopra1@ti.com>
PR: 121529 Describe eqep0/1/2 on AM13E; leave status disabled for board overlays. Signed-off-by: Aditya Chopra <a-chopra1@ti.com>
… QE... PR: 121529 Gate AM13E QEPSRCSEL and Input X-BAR mux-states behind COUNTER_TI_AM3352_EQEP_VARIANT_AM13. Signed-off-by: Aditya Chopra <a-chopra1@ti.com>
…twa... PR: 121529 Signed-off-by: Aditya Chopra <a-chopra1@ti.com>
…debug PR: 121529 Signed-off-by: Aditya Chopra <a-chopra1@ti.com>
…rop... PR: 121529 Allow EQEP nodes to consume SYSCTL PWREN via ti,pwren. Signed-off-by: Aditya Chopra <a-chopra1@ti.com>
PR: 121529 Attach SYSCTL PWREN specifiers to eqep0/1/2. Signed-off-by: Aditya Chopra <a-chopra1@ti.com>
PR: 121529 Power EQEP from driver init using ti,pwren instead of a SoC-level SYSCTL poke. Signed-off-by: Aditya Chopra <a-chopra1@ti.com>
3489ade to
f53ee8f
Compare
8537f24
into
TexasInstruments:v4.4.0-ti-next
Enables support for eqep driver for am13. Reuses k3 driver for the most part.
Test logs:
19-Oct-26_AM13E230_ttyACM2-eqep_fr.txt