From: Peng Fan <peng.fan@nxp.com>
To: Leonard Crestez <leonard.crestez@nxp.com>,
Stephen Boyd <sboyd@kernel.org>, Shawn Guo <shawnguo@kernel.org>,
Aisheng Dong <aisheng.dong@nxp.com>
Cc: Michael Turquette <mturquette@baylibre.com>,
Yangtao Li <tiny.windzz@gmail.com>,
Anson Huang <anson.huang@nxp.com>,
Fabio Estevam <fabio.estevam@nxp.com>,
Rob Herring <robh+dt@kernel.org>,
Mark Rutland <mark.rutland@arm.com>,
"linux-clk@vger.kernel.org" <linux-clk@vger.kernel.org>,
"kernel@pengutronix.de" <kernel@pengutronix.de>,
dl-linux-imx <linux-imx@nxp.com>
Subject: RE: [PATCH] clk: imx8qxp-lpcg: Warn against devm_platform_ioremap_resource
Date: Tue, 10 Dec 2019 06:07:31 +0000 [thread overview]
Message-ID: <AM0PR04MB4481421FCFF6AE90813572AA885B0@AM0PR04MB4481.eurprd04.prod.outlook.com> (raw)
In-Reply-To: <329ac54993d5eb955249d037241a7213faff508f.1575924858.git.leonard.crestez@nxp.com>
> Subject: [PATCH] clk: imx8qxp-lpcg: Warn against
> devm_platform_ioremap_resource
>
> On imx8 the LPCG nodes map entire subsystems and overlap peripherals, this
> means that using devm_platform_ioremap_resource will cause many devices
> to fail to probe including serial ports.
>
> Well-meaning but boot-breaking patches were posted multiple times so add a
> comment explaining this issue.
>
> Suggested-by: Peng Fan <peng.fan@nxp.com>
> Signed-off-by: Leonard Crestez <leonard.crestez@nxp.com>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
> ---
> drivers/clk/imx/clk-imx8qxp-lpcg.c | 11 +++++++++++
> 1 file changed, 11 insertions(+)
>
> diff --git a/drivers/clk/imx/clk-imx8qxp-lpcg.c
> b/drivers/clk/imx/clk-imx8qxp-lpcg.c
> index c0aff7ca6374..04c8ee35e14c 100644
> --- a/drivers/clk/imx/clk-imx8qxp-lpcg.c
> +++ b/drivers/clk/imx/clk-imx8qxp-lpcg.c
> @@ -171,10 +171,21 @@ static int imx8qxp_lpcg_clk_probe(struct
> platform_device *pdev)
>
> ss_lpcg = of_device_get_match_data(dev);
> if (!ss_lpcg)
> return -ENODEV;
>
> + /*
> + * Please don't replace this with devm_platform_ioremap_resource.
> + *
> + * devm_platform_ioremap_resource calls devm_ioremap_resource
> which
> + * differs from devm_ioremap by also calling
> devm_request_mem_region
> + * and preventing other mappings in the same area.
> + *
> + * On imx8 the LPCG nodes map entire subsystems and overlap
> + * peripherals, this means that using devm_platform_ioremap_resource
> + * will cause many devices to fail to probe including serial ports.
> + */
> res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> if (!res)
> return -EINVAL;
> base = devm_ioremap(dev, res->start, resource_size(res));
> if (!base)
> --
> 2.17.1
next prev parent reply other threads:[~2019-12-10 6:07 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-12-09 20:56 [PATCH] clk: imx8qxp-lpcg: Warn against devm_platform_ioremap_resource Leonard Crestez
2019-12-10 6:07 ` Peng Fan [this message]
2019-12-11 8:06 ` Shawn Guo
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=AM0PR04MB4481421FCFF6AE90813572AA885B0@AM0PR04MB4481.eurprd04.prod.outlook.com \
--to=peng.fan@nxp.com \
--cc=aisheng.dong@nxp.com \
--cc=anson.huang@nxp.com \
--cc=fabio.estevam@nxp.com \
--cc=kernel@pengutronix.de \
--cc=leonard.crestez@nxp.com \
--cc=linux-clk@vger.kernel.org \
--cc=linux-imx@nxp.com \
--cc=mark.rutland@arm.com \
--cc=mturquette@baylibre.com \
--cc=robh+dt@kernel.org \
--cc=sboyd@kernel.org \
--cc=shawnguo@kernel.org \
--cc=tiny.windzz@gmail.com \
/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).