Hi Bo Gan,
On 14:55 Thu 27 Aug , Bo Gan wrote:
> Hi Yixun,
>
> On 8/20/26 06:01, Yixun Lan wrote:
> > Based on upstream Linux:
> > 7412311c4655 ("pinctrl: spacemit: k3: add initial pin support")
> > 3f20bdf71518 ("pinctrl: spacemit: k3: adjust drive strength and
> > schmitter trigger")
> >
> > K3 uses a different pin-to-register mapping than K1, so add a
> > K3-specific pin_to_reg path and pin/IO power-domain tables. Drive
> > strength expands to 4 bits with larger mA tables, and the shared
> > pinctrl data gains per-SoC drive_mask and drive-strength tables so
> > K1 and K3 can live in the same driver.
> >
> > Signed-off-by: Yixun Lan <[email protected]>
> > ---
> > drivers/pinctrl/spacemit/Kconfig | 4 +-
> > drivers/pinctrl/spacemit/pinctrl-k1.c | 291
> > ++++++++++++++++++++++++++++++----
> > 2 files changed, 259 insertions(+), 36 deletions(-)
> >
...
> > @@ -704,12 +700,239 @@ static const struct spacemit_pinctrl_data
> > k1_pinctrl_data = {
> > .get_functions = k1_get_functions,
> > .get_io_type = k1_get_io_type,
> > .pin_to_io_pd_offset = spacemit_k1_pin_to_io_pd_offset,
> > + .drive_mask = PAD_DRIVE_K1,
> > + .ds_1v8_tbl = spacemit_ds_1v8_tbl,
> > + .ds_1v8_tbl_num = ARRAY_SIZE(spacemit_ds_1v8_tbl),
> > + .ds_3v3_tbl = spacemit_ds_3v3_tbl,
> > + .ds_3v3_tbl_num = ARRAY_SIZE(spacemit_ds_3v3_tbl),
> > +};
> > +
>
> Can the following table be simplified using static function and switch
> cases? As your other series mentioned, the SPL has very strict size limit,
> so we'd better not define this huge data array.
>
While actually looking into the implemenation, I end at giving up to
optimize it by using static function, it's much hard than I expected..
the io pin's information is per pin bias, and io voltage is dynamically
parsed from the DT property, which mean we actually need to allocate
each instance for all pins..
The optimization implenmation isn't critical, so I will leave it
unchanged for next version..
> > +static struct spacemit_pin_io k3_io_pins[] = {
> > + { 0, IO_TYPE_EXTERNAL, 0, },
> > + { 1, IO_TYPE_EXTERNAL, 0, },
> > + { 2, IO_TYPE_EXTERNAL, 0, },
> > + { 3, IO_TYPE_EXTERNAL, 0, },
> > + { 4, IO_TYPE_EXTERNAL, 0, },
> > + { 5, IO_TYPE_EXTERNAL, 0, },
....
--
Yixun Lan (dlan)