[PATCH v3 4/5] arm64: dts: qcom: x1e80100-crd: add rtc offset to set rtc time

Jonathan Marek posted 5 patches 1 month, 1 week ago
[PATCH v3 4/5] arm64: dts: qcom: x1e80100-crd: add rtc offset to set rtc time
Posted by Jonathan Marek 1 month, 1 week ago
See commit e67b45582c5e for explanation.

Note: the 0xbc offset is arbitrary, it just needs to not be already in use.

Signed-off-by: Jonathan Marek <jonathan@marek.ca>
---
 arch/arm64/boot/dts/qcom/x1e80100-crd.dts | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/arch/arm64/boot/dts/qcom/x1e80100-crd.dts b/arch/arm64/boot/dts/qcom/x1e80100-crd.dts
index 6dfc85eda3540..eb6b735c41453 100644
--- a/arch/arm64/boot/dts/qcom/x1e80100-crd.dts
+++ b/arch/arm64/boot/dts/qcom/x1e80100-crd.dts
@@ -1224,6 +1224,17 @@ edp_bl_en: edp-bl-en-state {
 	};
 };
 
+&pmk8550_rtc {
+	nvmem-cells = <&rtc_offset>;
+	nvmem-cell-names = "offset";
+};
+
+&pmk8550_sdam_2 {
+	rtc_offset: rtc-offset@bc {
+		reg = <0xbc 0x4>;
+	};
+};
+
 &qupv3_0 {
 	status = "okay";
 };
-- 
2.45.1
Re: [PATCH v3 4/5] arm64: dts: qcom: x1e80100-crd: add rtc offset to set rtc time
Posted by Konrad Dybcio 3 weeks, 5 days ago
On 15.10.2024 2:47 AM, Jonathan Marek wrote:
> See commit e67b45582c5e for explanation.
> 
> Note: the 0xbc offset is arbitrary, it just needs to not be already in use.
> 
> Signed-off-by: Jonathan Marek <jonathan@marek.ca>
> ---
>  arch/arm64/boot/dts/qcom/x1e80100-crd.dts | 11 +++++++++++
>  1 file changed, 11 insertions(+)
> 
> diff --git a/arch/arm64/boot/dts/qcom/x1e80100-crd.dts b/arch/arm64/boot/dts/qcom/x1e80100-crd.dts
> index 6dfc85eda3540..eb6b735c41453 100644
> --- a/arch/arm64/boot/dts/qcom/x1e80100-crd.dts
> +++ b/arch/arm64/boot/dts/qcom/x1e80100-crd.dts
> @@ -1224,6 +1224,17 @@ edp_bl_en: edp-bl-en-state {
>  	};
>  };
>  
> +&pmk8550_rtc {
> +	nvmem-cells = <&rtc_offset>;
> +	nvmem-cell-names = "offset";
> +};
> +
> +&pmk8550_sdam_2 {
> +	rtc_offset: rtc-offset@bc {
> +		reg = <0xbc 0x4>;
> +	};
> +};

Setting random bits in SDAM is a very very very very bad idea

I'll try to get a good spot for the offset internally

Konrad
Re: [PATCH v3 4/5] arm64: dts: qcom: x1e80100-crd: add rtc offset to set rtc time
Posted by Johan Hovold 1 month, 1 week ago
On Mon, Oct 14, 2024 at 08:47:29PM -0400, Jonathan Marek wrote:
> See commit e67b45582c5e for explanation.

It's good that you reference commit e67b45582c5e ("arm64: dts: qcom:
sc8280xp-crd: enable rtc") but your commit message still needs to be
self-contained and provide the explanation here in some form (e.g.
quoted or paraphrased).

Also spell out the commit summary in parenthesis when referring to
commits as I did above.

> Note: the 0xbc offset is arbitrary, it just needs to not be already in use.

How did you verify that nothing is using this offset on this platform? I
assume we need someone with access to the docs to make sure it's not in
use as we did for sc8280xp.

Johan
Re: [PATCH v3 4/5] arm64: dts: qcom: x1e80100-crd: add rtc offset to set rtc time
Posted by Jonathan Marek 1 month, 1 week ago
On 10/16/24 2:51 AM, Johan Hovold wrote:
> On Mon, Oct 14, 2024 at 08:47:29PM -0400, Jonathan Marek wrote:
>> See commit e67b45582c5e for explanation.
> 
> It's good that you reference commit e67b45582c5e ("arm64: dts: qcom:
> sc8280xp-crd: enable rtc") but your commit message still needs to be
> self-contained and provide the explanation here in some form (e.g.
> quoted or paraphrased).
> 
> Also spell out the commit summary in parenthesis when referring to
> commits as I did above.
> 
>> Note: the 0xbc offset is arbitrary, it just needs to not be already in use.
> 
> How did you verify that nothing is using this offset on this platform? I
> assume we need someone with access to the docs to make sure it's not in
> use as we did for sc8280xp.
> 

AFAIK qcom allocate things from the start of the SDAM, so allocating 
from the end of the SDAM should be safe. And AFAIK this is supposed to 
be a general purpose HLOS (linux/windows) SDAM block, so should be 
mostly free to use.

(its possible windows uses this offset for something, I don't know about 
that)
Re: [PATCH v3 4/5] arm64: dts: qcom: x1e80100-crd: add rtc offset to set rtc time
Posted by Johan Hovold 1 month, 1 week ago
On Wed, Oct 16, 2024 at 09:31:00AM -0400, Jonathan Marek wrote:
> On 10/16/24 2:51 AM, Johan Hovold wrote:
> > On Mon, Oct 14, 2024 at 08:47:29PM -0400, Jonathan Marek wrote:

> >> Note: the 0xbc offset is arbitrary, it just needs to not be already in use.
> > 
> > How did you verify that nothing is using this offset on this platform? I
> > assume we need someone with access to the docs to make sure it's not in
> > use as we did for sc8280xp.
>
> AFAIK qcom allocate things from the start of the SDAM, so allocating 
> from the end of the SDAM should be safe. And AFAIK this is supposed to 
> be a general purpose HLOS (linux/windows) SDAM block, so should be 
> mostly free to use.

From what I understand these registers are also used for things like
programmable LEDs (e.g. see 24e2d05d1b68 ("leds: Add driver for Qualcomm
LPG")). And who knows what else.

It would be good if someone from Qualcomm could confirm that these bytes
are free for use before merging. I've started asking around.

Johan