• Romain Naour's avatar
    regulator: ti-abb: don't use devm_platform_ioremap_resource_byname for shared interrupt register · a67e1f0b
    Romain Naour authored
    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 b36c6b18 ("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 b36c6b18 ("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: b36c6b18 ("regulator: ti-abb: Make use of the helper function devm_ioremap related")
    Signed-off-by: default avatarRomain Naour <romain.naour@skf.com>
    Reviewed-by: default avatarYoann Congal <yoann.congal@smile.fr>
    Link: https://msgid.link/r/20240123111456.739381-1-romain.naour@smile.frSigned-off-by: default avatarMark Brown <broonie@kernel.org>
    a67e1f0b
ti-abb-regulator.c 23.7 KB