• Manivannan Sadhasivam's avatar
    scsi: ufs: qcom: Add support for scaling interconnects · 03ce80a1
    Manivannan Sadhasivam authored
    Qcom SoCs require scaling the interconnect paths for proper working of the
    peripherals connected through interconnects. Even for accessing the UFS
    controller, someone should setup the interconnect paths. So far, the
    bootloaders used to setup the interconnect paths before booting Linux as
    they need to access the UFS storage for things like fetching boot firmware.
    But with the advent of multi boot options, bootloader nowadays like in
    SA8540p SoC do not setup the interconnect paths at all.
    
    So trying to configure UFS in the absence of the interconnect path
    configuration results in a boot crash.
    
    To fix this issue, and also to dynamically scale the interconnects (UFS-DDR
    and CPU-UFS), interconnect API support is added to the Qcom UFS driver.
    With this support, the interconnect paths are scaled dynamically based on
    the gear configuration.
    
    During the early stage of ufs_qcom_init(), ufs_qcom_icc_init() will setup
    the paths to max bandwidth to allow configuring the UFS registers. Touching
    the registers without configuring the icc paths would result in a crash.
    However, we don't really need to set max vote for the icc paths as any
    minimal vote would suffice. But the max value would allow initialization to
    be done faster. After init, the bandwidth will get updated using
    ufs_qcom_icc_update_bw() based on the gear and lane configuration.
    
    The bandwidth values defined in ufs_qcom_bw_table struct are taken from
    Qcom downstream vendor devicetree source and are calculated as per the
    UFS3.1 Spec, Section 6.4.1, HS Gear Rates. So it is fixed across platforms.
    
    Cc: Brian Masney <bmasney@redhat.com>
    Signed-off-by: default avatarManivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
    Link: https://lore.kernel.org/r/20230731145020.41262-3-manivannan.sadhasivam@linaro.orgSigned-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
    03ce80a1
ufs-qcom.h 6.73 KB