[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID:
<DU0PR04MB9299B6F59BA5D68E1AFC9AD780FC2@DU0PR04MB9299.eurprd04.prod.outlook.com>
Date: Fri, 31 May 2024 08:44:12 +0000
From: Aisheng Dong <aisheng.dong@....com>
To: Peng Fan <peng.fan@....com>, Linus Walleij <linus.walleij@...aro.org>,
"Peng Fan (OSS)" <peng.fan@....nxp.com>
CC: Sudeep Holla <sudeep.holla@....com>, Cristian Marussi
<cristian.marussi@....com>, Rob Herring <robh@...nel.org>, Krzysztof
Kozlowski <krzk+dt@...nel.org>, Conor Dooley <conor+dt@...nel.org>, Shawn Guo
<shawnguo@...nel.org>, Sascha Hauer <s.hauer@...gutronix.de>, Pengutronix
Kernel Team <kernel@...gutronix.de>, Fabio Estevam <festevam@...il.com>,
Jacky Bai <ping.bai@....com>, "linux-arm-kernel@...ts.infradead.org"
<linux-arm-kernel@...ts.infradead.org>, "devicetree@...r.kernel.org"
<devicetree@...r.kernel.org>, "linux-kernel@...r.kernel.org"
<linux-kernel@...r.kernel.org>, "imx@...ts.linux.dev" <imx@...ts.linux.dev>,
"linux-gpio@...r.kernel.org" <linux-gpio@...r.kernel.org>
Subject: RE: [PATCH 3/3] pinctrl: imx: support SCMI pinctrl protocol for
i.MX95
> From: Peng Fan <peng.fan@....com>
> Sent: 2024年5月27日 21:18
>
> Hi Linus,
>
> > Subject: Re: [PATCH 3/3] pinctrl: imx: support SCMI pinctrl protocol
> > for
> > i.MX95
> >
> > On Tue, May 21, 2024 at 8:17 AM Peng Fan (OSS) <peng.fan@....nxp.com>
> > wrote:
> >
> > > +static int pinctrl_scmi_imx_dt_node_to_map(struct pinctrl_dev *pctldev,
> > > + struct device_node *np,
> > > + struct pinctrl_map
> **map,
> > > + unsigned int
> *num_maps)
> > (...)
> > > +static int pinctrl_scmi_imx_pinconf_set(struct pinctrl_dev *pctldev,
> > > + unsigned int pin,
> > > + unsigned long *configs,
> > > + unsigned int num_configs)
> >
> > The code in these functions look suspiciously similar to same code in
> > pinctrl- imx.c, I bet it is copy/pase/modify.
>
> I only took the imx_pinctrl_parse_pin_mmio as example to get parse the node
> and do the pinctrl_scmi_imx_dt_node_to_map here. Only the pieces:
> "be32_to_cpu(*list++); "
>
> For other parts, they are different. There is no MUX here, configs has vendor
> SCMI "IMX_SCMI_PIN_X", and more.
>
> >
> > Can you look a second time if it is possible to share code between the
> drivers?
>
> I thought about this. Just trying what did for i.MX8 SCU pinctrl API by adding
> IMX_USE_SCMI flag.
>
> But because that means more if else check in pinctrl-imx.c and scmi requires
> different configs layout, which makes pinctrl-imx.c looks messy. And scmi
> pinctrl requires a totally different probe function, not imx_pinctrl_probe. So I
> decided to write a new driver for i.MX95.
>
Agree. We once had a local discussion before on whether can reuse the pinctrl-imx.c.
Current implementation is more tiny and clean for SCMI only which has many logic difference
from the legacy platforms in pinctrl-imx.c. (e.g. no grp/function, no static pin
definition/registration, pin configuration packing). Reuse requires adding more code.
So we think probably better to keep it a separate driver for SCMI only.
Regards
Aisheng
> >
> > It's not super much code, I'm mostly worried about bugs having to be
> > fixed in two places.
>
> I could switch back to my initial try to share pinctrl-imx.c, but I hope not.
>
> >
> > What is the opinion of the othe i.MX pinctrl maintainers?
>
> Aisheng, Fabio, Shawn, Jacky, any comments?
>
> Thanks,
> Peng.
>
> >
> > Yours,
> > Linus Walleij
Powered by blists - more mailing lists