From patchwork Wed Apr 23 07:51:41 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johan Hovold X-Patchwork-Id: 885030 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 41EB726D4F5; Wed, 23 Apr 2025 07:54:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1745394841; cv=none; b=CI7mn8NPysRBf8/TQXL8NnoffPIgTDcb0XMSajaBFSzOtbWRkDB0vePpM0dYcalLSdzOxFcXFjzdLMo1bac69ZcO0axf2pEiuSX7fHYUWff86nltPa+vDYWiqf6ic6tHaocK30zg01pk82vskhUbAmcbxwo2LBM+7wBiXfC9Nj4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1745394841; c=relaxed/simple; bh=zDte0/iXQpDSnWpaIOv5baQ9jRG/g3Ee05V6cmpgp+E=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=eVxO0ooEXXzDtvhAHHiRSPcOLxNDAzq9Xpa1he6kbiPHZROEzk0w5EUUj54Vic5S7Ody3Jv9BL8L/PQwF4gR/dPUx7cogW2M7yRWRcjtxym6xf0plxFbZ55VedBdpUUpY+hjE3XJEbkbmr43qJVFVA9gvUW12m62fx3E2v5GMt0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=keRBghCG; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="keRBghCG" Received: by smtp.kernel.org (Postfix) with ESMTPSA id BF2E9C4CEEF; Wed, 23 Apr 2025 07:54:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1745394840; bh=zDte0/iXQpDSnWpaIOv5baQ9jRG/g3Ee05V6cmpgp+E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=keRBghCGdWmUHzXz0BO6ocH91FuuEBSS1x1hpBzecyLMYSfIXvkWntlx6DsrUiIVr hqWf6wlJvKjlROruVM2B5Ab7MsX2gp+kld7415IK6fxUoGJ6BqB5a6NF13PTKy1P7+ t265R0lg6BftcJJIveV3fw4Bd32RzagGEhGTNaVD5NPGnWCxqijZfcHgB0BZL/gxUO EHYsGgQnzbeOXE2TkrxjucinRGQJiSB+ytmidQU2gvZZdQI8wZIJJZZMaCqDGFDmqM o7IP/yu2/2I1jIKDFPaiOpahztGMP1uZSQrciUZcJwCpgKuJZ5m15MUiUaOI+yii9A 7hbR4gLuPNusA== Received: from johan by xi.lan with local (Exim 4.97.1) (envelope-from ) id 1u7Uvf-000000002xF-1tA6; Wed, 23 Apr 2025 09:53:59 +0200 From: Johan Hovold To: Alexandre Belloni , Bjorn Andersson Cc: Rob Herring , Krzysztof Kozlowski , Conor Dooley , Konrad Dybcio , linux-arm-msm@vger.kernel.org, linux-rtc@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Johan Hovold , Rob Clark Subject: [PATCH 2/4] rtc: pm8xxx: fix uefi offset lookup Date: Wed, 23 Apr 2025 09:51:41 +0200 Message-ID: <20250423075143.11157-3-johan+linaro@kernel.org> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250423075143.11157-1-johan+linaro@kernel.org> References: <20250423075143.11157-1-johan+linaro@kernel.org> Precedence: bulk X-Mailing-List: linux-arm-msm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 On many Qualcomm platforms the PMIC RTC control and time registers are read-only so that the RTC time can not be updated. Instead an offset needs be stored in some machine-specific non-volatile memory, which a driver can take into account. On platforms where the offset is stored in a Qualcomm specific UEFI variable the variables are also accessed in a non-standard way, which means that the OS cannot assume that the variable service is available by the time the driver probes. Use the new 'qcom,uefi-rtc-info' property to determine whether to probe defer until the UEFI offset becomes available so that the offset can be used also when the RTC driver is built in or when a dependency of the UEFI variable driver is built as a module (e.g. the driver for the SCM interconnects). Fixes: bba38b874886 ("rtc: pm8xxx: add support for uefi offset") Reported-by: Rob Clark Link: https://lore.kernel.org/lkml/CAF6AEGsfke=x0p1b2-uNX6DuQfRyEjVbJaxTbVLDT2YvSkGJbg@mail.gmail.com/ Signed-off-by: Johan Hovold --- drivers/rtc/rtc-pm8xxx.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/drivers/rtc/rtc-pm8xxx.c b/drivers/rtc/rtc-pm8xxx.c index 3c1dddcc81df..5da237e7b9b2 100644 --- a/drivers/rtc/rtc-pm8xxx.c +++ b/drivers/rtc/rtc-pm8xxx.c @@ -576,13 +576,20 @@ static int pm8xxx_rtc_probe_offset(struct pm8xxx_rtc *rtc_dd) } /* Use UEFI storage as fallback if available */ - if (efivar_is_available()) { - rc = pm8xxx_rtc_read_uefi_offset(rtc_dd); - if (rc == 0) - rtc_dd->use_uefi = true; + rtc_dd->use_uefi = of_property_read_bool(rtc_dd->dev->of_node, + "qcom,uefi-rtc-info"); + if (!rtc_dd->use_uefi) + return 0; + + if (!efivar_is_available()) { + if (IS_ENABLED(CONFIG_EFI)) + return -EPROBE_DEFER; + + dev_warn(rtc_dd->dev, "efivars not available\n"); + rtc_dd->use_uefi = false; } - return 0; + return pm8xxx_rtc_read_uefi_offset(rtc_dd); } static int pm8xxx_rtc_probe(struct platform_device *pdev) From patchwork Wed Apr 23 07:51:42 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johan Hovold X-Patchwork-Id: 885029 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7922026F444; Wed, 23 Apr 2025 07:54:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1745394841; cv=none; b=b65t444dzbDreM9H8JEhVr0t2qUzSnHijl8BUdXDOs1VyQZFzXI3xbtvCJQrmDMsap2YHJoB1lsjbOIUr6fUz0RgW1/wKPwyaUdXNSVX5zA+ssZ4keBkyzwdWmuhU1aVnFDXWdPn2NFfk3N+NEfR8asBeh+/Y2EiY0q2wQh5utU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1745394841; c=relaxed/simple; bh=wZmVIbw/lQthHIrwcOBgr2yuApg1OYgWGTelA61EH1M=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=nYP/cZgRyJ/+CTj2/RPWCe8qnwHQC27uoU7gUcfdnvsy/dxRqY9xRBPmemdpO+VBuvjiyIqrmvoHJ+C/IIFsQ69nv4a/GNkP7JZbTCeAIPeV6O3GwbcnRC4SOUpFdd5pI7qQbTVnsN+VMd5mpGq1jpzn4Rtn+igWM8lAardBFag= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=ODGa/Wv0; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="ODGa/Wv0" Received: by smtp.kernel.org (Postfix) with ESMTPSA id F4031C4CEF9; Wed, 23 Apr 2025 07:54:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1745394841; bh=wZmVIbw/lQthHIrwcOBgr2yuApg1OYgWGTelA61EH1M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ODGa/Wv0EW6YjAydX6uA/bH14EN8i4pWoMUtptnE/kGBA9stKEr9HSH0e/h1WIt5R +/vMRKsP6b1JP/BbQCp8BsvrKcwJ8BkejO6fkmmu4gtPNTZ41RIxbHB9NqK3mrYvpz W33YK/awH668yE99yI84SgHdr5x4QHwhS+eGqmSliVhZVOTxgKTrRDMdUCI57njzz9 Si3LD0xuygUSVBmbEkH10dxOP1rIISDg8eF+ohuXzxYhlOR1OeKgjfxSYe/2tT5keK qEj3viucpCdJirsII+oswJpGtDPlrkZyBM4H3xo9FdWgq9DeZwKHUhc25vhoNTO23L gbbSt0f6anfNw== Received: from johan by xi.lan with local (Exim 4.97.1) (envelope-from ) id 1u7Uvf-000000002xH-2Def; Wed, 23 Apr 2025 09:53:59 +0200 From: Johan Hovold To: Alexandre Belloni , Bjorn Andersson Cc: Rob Herring , Krzysztof Kozlowski , Conor Dooley , Konrad Dybcio , linux-arm-msm@vger.kernel.org, linux-rtc@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Johan Hovold Subject: [PATCH 3/4] arm64: dts: qcom: sc8280xp-x13s: describe uefi rtc offset Date: Wed, 23 Apr 2025 09:51:42 +0200 Message-ID: <20250423075143.11157-4-johan+linaro@kernel.org> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250423075143.11157-1-johan+linaro@kernel.org> References: <20250423075143.11157-1-johan+linaro@kernel.org> Precedence: bulk X-Mailing-List: linux-arm-msm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 On many Qualcomm platforms the PMIC RTC control and time registers are read-only so that the RTC time can not be updated. Instead an offset needs be stored in some machine-specific non-volatile memory, which a driver can take into account. On platforms where the offset is stored in a Qualcomm specific UEFI variable the variables are also accessed in a non-standard way, which means that the OS cannot assume that the variable service is available by the time the RTC driver probes. Use the new 'qcom,uefi-rtc-info' property to indicate that the offset is stored in a UEFI variable so that the OS can determine whether to wait for it to become available. Fixes: 409803681a55 ("arm64: dts: qcom: sc8280xp-x13s: switch to uefi rtc offset") Signed-off-by: Johan Hovold --- arch/arm64/boot/dts/qcom/sc8280xp-lenovo-thinkpad-x13s.dts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/arm64/boot/dts/qcom/sc8280xp-lenovo-thinkpad-x13s.dts b/arch/arm64/boot/dts/qcom/sc8280xp-lenovo-thinkpad-x13s.dts index 8000254f4db5..66c39765225f 100644 --- a/arch/arm64/boot/dts/qcom/sc8280xp-lenovo-thinkpad-x13s.dts +++ b/arch/arm64/boot/dts/qcom/sc8280xp-lenovo-thinkpad-x13s.dts @@ -1090,6 +1090,8 @@ &pmk8280_pon_resin { }; &pmk8280_rtc { + qcom,uefi-rtc-info; + status = "okay"; };