[1/1] Revert "clk: imx: use devm_platform_ioremap_resource() to simplify code"
diff mbox series

Message ID 1555670144-24220-1-git-send-email-aisheng.dong@nxp.com
State New
Headers show
Series
  • [1/1] Revert "clk: imx: use devm_platform_ioremap_resource() to simplify code"
Related show

Commit Message

Aisheng Dong April 19, 2019, 10:42 a.m. UTC
This reverts commit 612d5b65894b5b1607a004bd9bc60d5963b58ef6.

Originally we use devm_ioremap() specifically because we want to bypass
the devm_request_mem_region due to LPCG address space are shared with
some other modules within the same SS (subsystem).

The patch in question occasionally added the request_me_region back
by calling devm_platform_ioremap_resource which results in all the devices
with overlappded IO space failed to be probed as follows:

[    1.062996] fsl-lpuart 5a060000.serial: can't request region for resource [mem 0x5a060000-0x5a060fff]
[    1.071923] fsl-lpuart: probe of 5a060000.serial failed with error -16

Cc: Anson Huang <Anson.Huang@nxp.com>
Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
---
Shawn,

This is a new issue and only exist in imx/for-next branch.
You can decide whether to remove it or take the revert patch.
---
 drivers/clk/imx/clk-imx8qxp-lpcg.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

Comments

Leonard Crestez April 20, 2019, 3:30 p.m. UTC | #1
On 4/19/19 1:42 PM, Aisheng Dong wrote:
> This reverts commit 612d5b65894b5b1607a004bd9bc60d5963b58ef6.
> 
> Originally we use devm_ioremap() specifically because we want to bypass
> the devm_request_mem_region due to LPCG address space are shared with
> some other modules within the same SS (subsystem).
> 
> The patch in question occasionally added the request_me_region back
> by calling devm_platform_ioremap_resource which results in all the devices
> with overlappded IO space failed to be probed as follows:
> 
> [    1.062996] fsl-lpuart 5a060000.serial: can't request region for resource [mem 0x5a060000-0x5a060fff]
> [    1.071923] fsl-lpuart: probe of 5a060000.serial failed with error -16
> 
> Cc: Anson Huang <Anson.Huang@nxp.com>
> Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>

Tested-by: Leonard Crestez <leonard.crestez@nxp.com>
This revert fixes the main console on imx8qxp-mek

Instead of having imx8qxp-lpcg-adma map the whole ADMA subsystem a much 
better approach is to split LPCG into 64k areas each with their own DT 
node. Having so many clk provider nodes is unusual but it's an accurate 
description of 8qxp/8qm hardware.

The LPCG blocks were deliberately split in the SOC address space so that 
access to clk gating for individual peripherals can be controlled using 
the same kind of coarse-grained memory access control mechanisms used 
for the peripherals themselves.

Unfortunately this series has been hung for quite a while:
https://patchwork.kernel.org/project/linux-arm-kernel/list/?series=83525
Shawn Guo April 22, 2019, 2:03 a.m. UTC | #2
On Fri, Apr 19, 2019 at 10:42:51AM +0000, Aisheng Dong wrote:
> This reverts commit 612d5b65894b5b1607a004bd9bc60d5963b58ef6.
> 
> Originally we use devm_ioremap() specifically because we want to bypass
> the devm_request_mem_region due to LPCG address space are shared with
> some other modules within the same SS (subsystem).
> 
> The patch in question occasionally added the request_me_region back
> by calling devm_platform_ioremap_resource which results in all the devices
> with overlappded IO space failed to be probed as follows:
> 
> [    1.062996] fsl-lpuart 5a060000.serial: can't request region for resource [mem 0x5a060000-0x5a060fff]
> [    1.071923] fsl-lpuart: probe of 5a060000.serial failed with error -16
> 
> Cc: Anson Huang <Anson.Huang@nxp.com>
> Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
> ---
> Shawn,
> 
> This is a new issue and only exist in imx/for-next branch.
> You can decide whether to remove it or take the revert patch.

Dropped the offending patch.  Thanks for finding it.

Shawn

Patch
diff mbox series

diff --git a/drivers/clk/imx/clk-imx8qxp-lpcg.c b/drivers/clk/imx/clk-imx8qxp-lpcg.c
index c711654..fb6edf1 100644
--- a/drivers/clk/imx/clk-imx8qxp-lpcg.c
+++ b/drivers/clk/imx/clk-imx8qxp-lpcg.c
@@ -159,6 +159,7 @@  static int imx8qxp_lpcg_clk_probe(struct platform_device *pdev)
 	struct clk_hw_onecell_data *clk_data;
 	const struct imx8qxp_ss_lpcg *ss_lpcg;
 	const struct imx8qxp_lpcg_data *lpcg;
+	struct resource *res;
 	struct clk_hw **clks;
 	void __iomem *base;
 	int i;
@@ -167,7 +168,10 @@  static int imx8qxp_lpcg_clk_probe(struct platform_device *pdev)
 	if (!ss_lpcg)
 		return -ENODEV;
 
-	base = devm_platform_ioremap_resource(pdev, 0);
+	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+	if (!res)
+		return -EINVAL;
+	base = devm_ioremap(dev, res->start, resource_size(res));
 	if (!base)
 		return -ENOMEM;