Skip to content

Commit a67e1f0

Browse files
Romain Naourbroonie
authored andcommitted
regulator: ti-abb: don't use devm_platform_ioremap_resource_byname for shared interrupt register
We can't use devm_platform_ioremap_resource_byname() to remap the interrupt register that can be shared between regulator-abb-{ivahd,dspeve,gpu} drivers instances. The combined helper introduce a call to devm_request_mem_region() that creates a new busy resource region on PRM_IRQSTATUS_MPU register (0x4ae06010). The first devm_request_mem_region() call succeeds for regulator-abb-ivahd but fails for the two other regulator-abb-dspeve and regulator-abb-gpu. # cat /proc/iomem | grep -i 4ae06 4ae06010-4ae06013 : 4ae07e34.regulator-abb-ivahd int-address 4ae06014-4ae06017 : 4ae07ddc.regulator-abb-mpu int-address regulator-abb-dspeve and regulator-abb-gpu are missing due to devm_request_mem_region() failure (EBUSY): [ 1.326660] ti_abb 4ae07e30.regulator-abb-dspeve: can't request region for resource [mem 0x4ae06010-0x4ae06013] [ 1.326660] ti_abb: probe of 4ae07e30.regulator-abb-dspeve failed with error -16 [ 1.327239] ti_abb 4ae07de4.regulator-abb-gpu: can't request region for resource [mem 0x4ae06010-0x4ae06013] [ 1.327270] ti_abb: probe of 4ae07de4.regulator-abb-gpu failed with error -16 >From arm/boot/dts/dra7.dtsi: The abb_mpu is the only instance using its own interrupt register: (0x4ae06014) PRM_IRQSTATUS_MPU_2, ABB_MPU_DONE_ST (bit 7) The other tree instances (abb_ivahd, abb_dspeve, abb_gpu) share PRM_IRQSTATUS_MPU register (0x4ae06010) but use different bits ABB_IVA_DONE_ST (bit 30), ABB_DSPEVE_DONE_ST( bit 29) and ABB_GPU_DONE_ST (but 28). The commit b36c6b1 ("regulator: ti-abb: Make use of the helper function devm_ioremap related") overlooked the following comment implicitly explaining why devm_ioremap() is used in this case: /* * We may have shared interrupt register offsets which are * write-1-to-clear between domains ensuring exclusivity. */ Fixes and partially reverts commit b36c6b1 ("regulator: ti-abb: Make use of the helper function devm_ioremap related"). Improve the existing comment to avoid further conversion to devm_platform_ioremap_resource_byname(). Fixes: b36c6b1 ("regulator: ti-abb: Make use of the helper function devm_ioremap related") Signed-off-by: Romain Naour <[email protected]> Reviewed-by: Yoann Congal <[email protected]> Link: https://msgid.link/r/[email protected] Signed-off-by: Mark Brown <[email protected]>
1 parent b3cbdcc commit a67e1f0

File tree

1 file changed

+19
-3
lines changed

1 file changed

+19
-3
lines changed

drivers/regulator/ti-abb-regulator.c

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -726,9 +726,25 @@ static int ti_abb_probe(struct platform_device *pdev)
726726
return PTR_ERR(abb->setup_reg);
727727
}
728728

729-
abb->int_base = devm_platform_ioremap_resource_byname(pdev, "int-address");
730-
if (IS_ERR(abb->int_base))
731-
return PTR_ERR(abb->int_base);
729+
pname = "int-address";
730+
res = platform_get_resource_byname(pdev, IORESOURCE_MEM, pname);
731+
if (!res) {
732+
dev_err(dev, "Missing '%s' IO resource\n", pname);
733+
return -ENODEV;
734+
}
735+
/*
736+
* The MPU interrupt status register (PRM_IRQSTATUS_MPU) is
737+
* shared between regulator-abb-{ivahd,dspeve,gpu} driver
738+
* instances. Therefore use devm_ioremap() rather than
739+
* devm_platform_ioremap_resource_byname() to avoid busy
740+
* resource region conflicts.
741+
*/
742+
abb->int_base = devm_ioremap(dev, res->start,
743+
resource_size(res));
744+
if (!abb->int_base) {
745+
dev_err(dev, "Unable to map '%s'\n", pname);
746+
return -ENOMEM;
747+
}
732748

733749
/* Map Optional resources */
734750
pname = "efuse-address";

0 commit comments

Comments
 (0)