Re: PXA25x: GPIO driver fails probe due to resource conflict with pinctrl driver

Robert Jarzmik
2022-12-08T20:39:07Z

"Russell King (Oracle)" <linux@armlinux.org.uk> writes:
> From a quick look, I think this commit is to blame:
>
> 542c25b7a209 drivers: gpio: pxa: use
> devm_platform_ioremap_resource()
>
> Someone "helpfully" making this change:
>
> - res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> - if (!res)
> - return -EINVAL;
> - gpio_reg_base = devm_ioremap(&pdev->dev, res->start,
> - resource_size(res));
> +
> + gpio_reg_base = devm_platform_ioremap_resource(pdev, 0);
>
> which introduces request_mem_region() to the PXA GPIO driver,
> resulting
> in this resource clash.
You're right.

Now, as for Jonathan, there are 2 options :
- first one : revert the patch Russell pointed out
- second one : a lot of work, detailed below :

Given that Arnd is removing legacy platformdata code, that will
only leave the
device-tree one, which works only with the pinctrl driver enabled.
That gives the opportunity to drop the use of GPDR from the
gpio-pxa driver,
and now we can map with separate iomem ressources pinctrl-pxa and
gpio-pxa.

Therefore, if Jonathan has the will to make a patch, I would :
- keep the patch identfied by Russell (ie. don't revert it)
- amend the device-tree descriptions for pxa
- pxa2xx.dtsi
...
gpio: gpio@40e00000 {
...
reg = <0x40e00000 0xc>, <0x40e00018 0x3c>,
<0x40e00100 4>, <0x40e00118 0x34>;
- amend the gpio_pxa.c driver, to map the 4 regions (and not only
one as before)
- the pinctrl-pxa25.c and its device-tree are already mapping the
holes in the
previous list
- check that I didn't mess up the 4 iomem regions, they should
overlap with
"pinctrl: pinctrl@40e00000".

Well it's up to Jonathan to see which version he prefers to
choose, the simple
one or the tedious one.

Cheers.

--
Robert