1. 15 Mar, 2023 37 commits
  2. 13 Mar, 2023 3 commits
    • Johan Hovold's avatar
      arm64: dts: qcom: sc8280xp-x13s: enable rtc · 5fef1b43
      Johan Hovold authored
      The Lenovo X13s firmware does not implement the UEFI time runtime
      services so the RTC in the PM8280K PMIC needs to be accessed directly.
      
      To complicate things further, the RTC control and time registers are
      read-only on this platform so an offset must be stored in some other
      machine-specific non-volatile memory which an RTC driver can take into
      account when reading or updating the time.
      
      The UEFI firmware (and Windows) use a UEFI variable for this:
      
      	882f8c2b-9646-435f-8de5-f208ff80c1bd-RTCInfo
      
      but the offset can only be accessed via the Qualcomm UEFI Secure
      Application residing in the TEE as the firmware does not implement the
      variable runtime services either.
      
      While it is possible to access this UEFI variable from Linux on the
      X13s, this requires using a fairly complex and reverse-engineered
      firmware interface. As the only benefit of doing so is to make sure that
      the UEFI (Windows) and Linux time never gets out of sync, it seems
      preferable to use the PMIC scratch registers for storing an offset
      instead. This also avoids flash wear in case of RTC drift, etc.
      
      So instead of using the UEFI RTC offset, reserve four bytes in one of
      the PMIC SDAM scratch-register blocks to hold the RTC offset.
      Signed-off-by: default avatarJohan Hovold <johan+linaro@kernel.org>
      Signed-off-by: default avatarBjorn Andersson <andersson@kernel.org>
      Link: https://lore.kernel.org/r/20230202155448.6715-23-johan+linaro@kernel.org
      5fef1b43
    • Johan Hovold's avatar
      arm64: dts: qcom: sc8280xp-crd: enable rtc · e67b4558
      Johan Hovold authored
      The SC8280XP CRD firmware does not implement the UEFI time runtime
      services so the RTC in the PM8280K PMIC needs to be accessed directly.
      
      To complicate things further, the RTC control and time registers are
      read-only on this platform so an offset must be stored in some other
      machine-specific non-volatile memory which an RTC driver can take into
      account when reading or updating the time.
      
      The UEFI firmware (and Windows) use a UEFI variable for this:
      
      	882f8c2b-9646-435f-8de5-f208ff80c1bd-RTCInfo
      
      but the offset can only be accessed via the Qualcomm UEFI Secure
      Application residing in the TEE as the firmware does not implement the
      variable runtime services either.
      
      While it is possible to access this UEFI variable from Linux on the CRD,
      this requires using a fairly complex and reverse-engineered firmware
      interface. As the only benefit of doing so is to make sure that the UEFI
      (Windows) and Linux time never gets out of sync, it seems preferable to
      use the PMIC scratch registers for storing an offset instead. This also
      avoids flash wear in case of RTC drift, etc.
      
      Also note that setting variables using this interface does not work on
      at least one CRD for reasons not yet known.
      
      So instead of using the UEFI RTC offset, reserve four bytes in one of
      the PMIC SDAM scratch-register blocks to hold the RTC offset.
      Signed-off-by: default avatarJohan Hovold <johan+linaro@kernel.org>
      Signed-off-by: default avatarBjorn Andersson <andersson@kernel.org>
      Link: https://lore.kernel.org/r/20230202155448.6715-22-johan+linaro@kernel.org
      e67b4558
    • Johan Hovold's avatar
      arm64: dts: qcom: sc8280xp-pmics: add pmk8280 sdam nvram · d6dbbda3
      Johan Hovold authored
      Add one of the PMK8280 SDAM blocks which can be used to store an RTC
      offset.
      Signed-off-by: default avatarJohan Hovold <johan+linaro@kernel.org>
      Signed-off-by: default avatarBjorn Andersson <andersson@kernel.org>
      Link: https://lore.kernel.org/r/20230202155448.6715-21-johan+linaro@kernel.org
      d6dbbda3