Message ID | 329ac54993d5eb955249d037241a7213faff508f.1575924858.git.leonard.crestez@nxp.com (mailing list archive) |
---|---|
State | Awaiting Upstream, archived |
Headers | show |
Series | clk: imx8qxp-lpcg: Warn against devm_platform_ioremap_resource | expand |
> 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
On Mon, Dec 09, 2019 at 10:56:28PM +0200, Leonard Crestez wrote: > 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> Applied, thanks.
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)
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> --- drivers/clk/imx/clk-imx8qxp-lpcg.c | 11 +++++++++++ 1 file changed, 11 insertions(+)