Re: [PATCH v2 1/4] serial: 8250_dw: Keep the BUSY-safe divisor hook when DLF is present

From: Andy Shevchenko

Date: Wed Oct 21 2026 - 09:58:03 EST


On Wed, Oct 21, 2026 at 07:00:49AM -0300, Vinicius Pedrosa wrote:
> On Wed, 21 Oct 2026, Andy Shevchenko wrote:
>
> > Right, but have you read my second question in the above paragraph?
>
> Sorry, I missed the second part of your question.
>
> If I understand you correctly, since 8250_dw.c already has the BUSY-safe
> set_divisor, you're suggesting that it should have the matching
> get_divisor as well, instead of pairing it with the dwlib getter.

Exactly!

> The dwlib getter would stay for the other users of dw8250_setup_port(),
> like 8250_lpss. Is that the structure you had in mind?

8250_lpss doesn't redefine either of the _get/_set_divisor, so it won't be
affected. But I think that 8250_lpss actually lacks of busy support that's
why it uses simpler version of all this. Maybe we can refactor that (in
the future?) so that we will have dwlib to provide the IDLE version of them
for all and depending on the existence of busy functionality degrade to
the same as just current DFL helpers.

Can you check that approach?

Ah, dw8250_idle_*() are already BUSY-functionality aware. So, what we need
is to provide dw8250_idlej_*() callbacks via struct dw8250_port_data and
make current 8250_dw::dw8250_set_divisor() to be part of dwlib.

Patch 1 (dwlib): Add callback definitions for dw8250_idle_*() to struct dw8250_port_data
Patch 2 (dw): Assign new callbacks and use them in dw8250_set_divisor()
Patch 3 (lpss): Introduce stubs and assign new callbacks to them
Patch 4 (dwlib): Use dw8250_idle_*() in dw8250_set_divisor()
Patch 5 (dw): Kill now duplicate code pieces

(Some of the patches might be combined, but I think the above split is not bad.)

Would it work?

--
With Best Regards,
Andy Shevchenko