linux-gpio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Aisheng Dong <aisheng.dong@nxp.com>
To: Peng Fan <peng.fan@nxp.com>, Andy Shevchenko <andy.shevchenko@gmail.com>
Cc: BOUGH CHEN <haibo.chen@nxp.com>,
	"festevam@gmail.com" <festevam@gmail.com>,
	"shawnguo@kernel.org" <shawnguo@kernel.org>,
	"stefan@agner.ch" <stefan@agner.ch>,
	"kernel@pengutronix.de" <kernel@pengutronix.de>,
	"linus.walleij@linaro.org" <linus.walleij@linaro.org>,
	"s.hauer@pengutronix.de" <s.hauer@pengutronix.de>,
	dl-linux-imx <linux-imx@nxp.com>,
	"christophe.jaillet@wanadoo.fr" <christophe.jaillet@wanadoo.fr>,
	"dan.carpenter@oracle.com" <dan.carpenter@oracle.com>,
	"linux@roeck-us.net" <linux@roeck-us.net>,
	"linux-gpio@vger.kernel.org" <linux-gpio@vger.kernel.org>
Subject: RE: [PATCH v2] Revert "pinctrl: freescale: imx: Use 'devm_of_iomap()' to avoid a resource leak in case of error in 'imx_pinctrl_probe()'"
Date: Wed, 17 Jun 2020 02:53:13 +0000	[thread overview]
Message-ID: <AM6PR04MB49666437F0A488FE67D66F7B809A0@AM6PR04MB4966.eurprd04.prod.outlook.com> (raw)
In-Reply-To: <DB6PR0402MB2760B7D339C1DECFB7DACAC8889A0@DB6PR0402MB2760.eurprd04.prod.outlook.com>

> From: Peng Fan <peng.fan@nxp.com>
> Sent: Wednesday, June 17, 2020 9:15 AM
> 
> > Subject: Re: [PATCH v2] Revert "pinctrl: freescale: imx: Use 'devm_of_iomap()'
> > to avoid a resource leak in case of error in 'imx_pinctrl_probe()'"
> >
> > On Tue, Jun 16, 2020 at 5:54 AM Aisheng Dong <aisheng.dong@nxp.com>
> > wrote:
> >
> > > Could you help apply this patch as it blocked MX7D booting for a while?
> >
> > > > This reverts commit ba403242615c2c99e27af7984b1650771a2cc2c9.
> > > >
> > > > After commit 26d8cde5260b ("pinctrl: freescale: imx: add shared
> > > > input select reg support"). i.MX7D has two iomux controllers
> > > > iomuxc and iomuxc-lpsr which share select_input register for daisy chain
> settings.
> > > > If use 'devm_of_iomap()', when probe the iomuxc-lpsr, will call
> > > > devm_request_mem_region() for the region <0x30330000-0x3033ffff>
> > > > for the first time. Then, next time when probe the iomuxc, API
> > > > devm_platform_ioremap_resource() will also use the API
> > > > devm_request_mem_region() for the share region
> > > > <0x30330000-0x3033ffff> again, then cause issue, log like below:
> > > >
> > > > [    0.179561] imx7d-pinctrl 302c0000.iomuxc-lpsr: initialized IMX
> > pinctrl
> > > > driver
> > > > [    0.191742] imx7d-pinctrl 30330000.pinctrl: can't request region for
> > > > resource [mem 0x30330000-0x3033ffff]
> > > > [    0.191842] imx7d-pinctrl: probe of 30330000.pinctrl failed with error
> > -16
> >
> > It means that shared support took a wrong approach. If something has
> > shared resources, another schema should be used, something like MFD
> > (parent device which keeps only shared resources). Easiest way is to
> > switch to the regmap API.
> 
> Actually not MFD, it is the dts use wrong address region.
> 
>                         iomuxc_lpsr: iomuxc-lpsr@302c0000 {
>                                 compatible = "fsl,imx7d-iomuxc-lpsr";
>                                 reg = <0x302c0000 0x10000>;
>                                 fsl,input-sel = <&iomuxc>;
>                         };
>                         iomuxc: pinctrl@30330000 {
>                                 compatible = "fsl,imx7d-iomuxc";
>                                 reg = <0x30330000 0x10000>;
>                         };
> 
> There is overlap between the two.
> 
> The iomuxc_lpsr using 0x10000 as size is wrong. It not have such large area.
> 
> With the size fix, devm_of_ioremap could be used I think.
> 

Really overlapped?

I think the real issue is LPSR Sel Input part using the same memory region as iomux.

Regards
Aisheng

> Regards,
> Peng.
> 
> >
> > P.S. The revert is okay as a quick fix but... see above.
> >
> > --
> > With Best Regards,
> > Andy Shevchenko

  reply	other threads:[~2020-06-17  2:53 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-09  3:27 [PATCH v2] Revert "pinctrl: freescale: imx: Use 'devm_of_iomap()' to avoid a resource leak in case of error in 'imx_pinctrl_probe()'" haibo.chen
2020-06-16  2:53 ` Aisheng Dong
2020-06-16 18:15   ` Andy Shevchenko
2020-06-17  1:14     ` Peng Fan
2020-06-17  2:53       ` Aisheng Dong [this message]
2020-06-17  2:56         ` Peng Fan
2020-06-17  2:43     ` Aisheng Dong
2020-06-16  8:21 ` Linus Walleij

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=AM6PR04MB49666437F0A488FE67D66F7B809A0@AM6PR04MB4966.eurprd04.prod.outlook.com \
    --to=aisheng.dong@nxp.com \
    --cc=andy.shevchenko@gmail.com \
    --cc=christophe.jaillet@wanadoo.fr \
    --cc=dan.carpenter@oracle.com \
    --cc=festevam@gmail.com \
    --cc=haibo.chen@nxp.com \
    --cc=kernel@pengutronix.de \
    --cc=linus.walleij@linaro.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-imx@nxp.com \
    --cc=linux@roeck-us.net \
    --cc=peng.fan@nxp.com \
    --cc=s.hauer@pengutronix.de \
    --cc=shawnguo@kernel.org \
    --cc=stefan@agner.ch \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).