public inbox for linux-arm-kernel@lists.infradead.org
 help / color / mirror / Atom feed
* [PATCH v2 0/5] rtc: zynqmp: fixes for read and set offset
@ 2026-01-08 12:51 Tomas Melin
  2026-01-08 12:51 ` [PATCH v2 1/5] rtc: zynqmp: correct frequency value Tomas Melin
                   ` (5 more replies)
  0 siblings, 6 replies; 16+ messages in thread
From: Tomas Melin @ 2026-01-08 12:51 UTC (permalink / raw)
  To: Alexandre Belloni, Michal Simek
  Cc: linux-rtc, linux-arm-kernel, linux-kernel, Tomas Melin

Add improvements for read and set offset functions.
The basic functionality is still the same, but offset correction values
are now updated to match with expected.

The RTC calibration value operates with full ticks,
and fractional ticks which are a 1/16 of a full tick.
The 16 lowest bits in the calibration registers are for the full ticks
and value matches the external oscillator in Hz. Through that,
the maximum and minimum offset values can be calculated dynamically,
as they depend on the input frequency used.

For docs on the calibration register, see
https://docs.amd.com/r/en-US/ug1087-zynq-ultrascale-registers/CALIB_READ-RTC-Register

Due to rounding errors (different number of fract ticks),
offset readback will differ slightly depending on
if the offset is negative or positive.

For example
$ echo 34335 > offset 
$ cat offset 
34335
$ echo -34335 > offset 
$ cat offset 
-34326

Signed-off-by: Tomas Melin <tomas.melin@vaisala.com>
---
Changes in v2:
- Add commit introducing check for calibration value overflow
- Update comments
- Align data types across set and read
- Rename fract_tick as fract_data conforming to data sheet
- Further improve on set offset calculation logic
- Link to v1: https://lore.kernel.org/r/20251201-zynqmp-rtc-updates-v1-0-33875c1e385b@vaisala.com

---
Tomas Melin (5):
      rtc: zynqmp: correct frequency value
      rtc: zynqmp: check calibration max value
      rtc: zynqmp: rework read_offset
      rtc: zynqmp: rework set_offset
      rtc: zynqmp: use dynamic max and min offset ranges

 drivers/rtc/rtc-zynqmp.c | 74 ++++++++++++++++++++++++++----------------------
 1 file changed, 40 insertions(+), 34 deletions(-)
---
base-commit: cd635e33b0113287c94021be53d2a7c61a1614e9
change-id: 20251201-zynqmp-rtc-updates-d260364cc01b

Best regards,
-- 
Tomas Melin <tomas.melin@vaisala.com>



^ permalink raw reply	[flat|nested] 16+ messages in thread

* [PATCH v2 1/5] rtc: zynqmp: correct frequency value
  2026-01-08 12:51 [PATCH v2 0/5] rtc: zynqmp: fixes for read and set offset Tomas Melin
@ 2026-01-08 12:51 ` Tomas Melin
  2026-01-14 15:35   ` T, Harini
  2026-01-08 12:51 ` [PATCH v2 2/5] rtc: zynqmp: check calibration max value Tomas Melin
                   ` (4 subsequent siblings)
  5 siblings, 1 reply; 16+ messages in thread
From: Tomas Melin @ 2026-01-08 12:51 UTC (permalink / raw)
  To: Alexandre Belloni, Michal Simek
  Cc: linux-rtc, linux-arm-kernel, linux-kernel, Tomas Melin

Fix calibration value in case a clock reference is provided.
The actual calibration value written into register is
frequency - 1.

Signed-off-by: Tomas Melin <tomas.melin@vaisala.com>
---
 drivers/rtc/rtc-zynqmp.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/rtc/rtc-zynqmp.c b/drivers/rtc/rtc-zynqmp.c
index 3baa2b481d9f2008750046005283b98a0d546c5c..856bc1678e7d31144f320ae9f75fc58c742a2a64 100644
--- a/drivers/rtc/rtc-zynqmp.c
+++ b/drivers/rtc/rtc-zynqmp.c
@@ -345,7 +345,10 @@ static int xlnx_rtc_probe(struct platform_device *pdev)
 					   &xrtcdev->freq);
 		if (ret)
 			xrtcdev->freq = RTC_CALIB_DEF;
+	} else {
+		xrtcdev->freq--;
 	}
+
 	ret = readl(xrtcdev->reg_base + RTC_CALIB_RD);
 	if (!ret)
 		writel(xrtcdev->freq, (xrtcdev->reg_base + RTC_CALIB_WR));

-- 
2.47.3



^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH v2 2/5] rtc: zynqmp: check calibration max value
  2026-01-08 12:51 [PATCH v2 0/5] rtc: zynqmp: fixes for read and set offset Tomas Melin
  2026-01-08 12:51 ` [PATCH v2 1/5] rtc: zynqmp: correct frequency value Tomas Melin
@ 2026-01-08 12:51 ` Tomas Melin
  2026-01-14 15:35   ` T, Harini
  2026-01-08 12:51 ` [PATCH v2 3/5] rtc: zynqmp: rework read_offset Tomas Melin
                   ` (3 subsequent siblings)
  5 siblings, 1 reply; 16+ messages in thread
From: Tomas Melin @ 2026-01-08 12:51 UTC (permalink / raw)
  To: Alexandre Belloni, Michal Simek
  Cc: linux-rtc, linux-arm-kernel, linux-kernel, Tomas Melin

Enable check to not overflow the calibration
max value.

Signed-off-by: Tomas Melin <tomas.melin@vaisala.com>
---
 drivers/rtc/rtc-zynqmp.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/rtc/rtc-zynqmp.c b/drivers/rtc/rtc-zynqmp.c
index 856bc1678e7d31144f320ae9f75fc58c742a2a64..caacce3725e2ef3803ea42d40e77ceaeb7d7b914 100644
--- a/drivers/rtc/rtc-zynqmp.c
+++ b/drivers/rtc/rtc-zynqmp.c
@@ -349,6 +349,11 @@ static int xlnx_rtc_probe(struct platform_device *pdev)
 		xrtcdev->freq--;
 	}
 
+	if (xrtcdev->freq > RTC_TICK_MASK) {
+		dev_err(&pdev->dev, "Invalid RTC calibration value\n");
+		return -EINVAL;
+	}
+
 	ret = readl(xrtcdev->reg_base + RTC_CALIB_RD);
 	if (!ret)
 		writel(xrtcdev->freq, (xrtcdev->reg_base + RTC_CALIB_WR));

-- 
2.47.3



^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH v2 3/5] rtc: zynqmp: rework read_offset
  2026-01-08 12:51 [PATCH v2 0/5] rtc: zynqmp: fixes for read and set offset Tomas Melin
  2026-01-08 12:51 ` [PATCH v2 1/5] rtc: zynqmp: correct frequency value Tomas Melin
  2026-01-08 12:51 ` [PATCH v2 2/5] rtc: zynqmp: check calibration max value Tomas Melin
@ 2026-01-08 12:51 ` Tomas Melin
  2026-01-14 15:36   ` T, Harini
  2026-01-15  0:42   ` kernel test robot
  2026-01-08 12:51 ` [PATCH v2 4/5] rtc: zynqmp: rework set_offset Tomas Melin
                   ` (2 subsequent siblings)
  5 siblings, 2 replies; 16+ messages in thread
From: Tomas Melin @ 2026-01-08 12:51 UTC (permalink / raw)
  To: Alexandre Belloni, Michal Simek
  Cc: linux-rtc, linux-arm-kernel, linux-kernel, Tomas Melin

read_offset() was using static frequency for determining
the tick offset. It was also using remainder from do_div()
operation as tick_mult value which caused the offset to be
incorrect.

At the same time, rework function to improve readability.
It is worth noting, that due to rounding errors, the offset
readback will differ slightly for positive and negative
calibration values.

Signed-off-by: Tomas Melin <tomas.melin@vaisala.com>
---
 drivers/rtc/rtc-zynqmp.c | 25 ++++++++++++++++---------
 1 file changed, 16 insertions(+), 9 deletions(-)

diff --git a/drivers/rtc/rtc-zynqmp.c b/drivers/rtc/rtc-zynqmp.c
index caacce3725e2ef3803ea42d40e77ceaeb7d7b914..6740c3aed1897d4b50a02c4823a746d9c2ae2655 100644
--- a/drivers/rtc/rtc-zynqmp.c
+++ b/drivers/rtc/rtc-zynqmp.c
@@ -178,21 +178,28 @@ static void xlnx_init_rtc(struct xlnx_rtc_dev *xrtcdev)
 static int xlnx_rtc_read_offset(struct device *dev, long *offset)
 {
 	struct xlnx_rtc_dev *xrtcdev = dev_get_drvdata(dev);
-	unsigned long long rtc_ppb = RTC_PPB;
-	unsigned int tick_mult = do_div(rtc_ppb, xrtcdev->freq);
-	unsigned int calibval;
+	unsigned int calibval, fract_data, fract_part;
+	int freq = xrtcdev->freq;
+	int max_tick, tick_mult;
 	long offset_val;
 
+	/* Tick to offset multiplier */
+	tick_mult = DIV_ROUND_CLOSEST(RTC_PPB, freq);
+
 	calibval = readl(xrtcdev->reg_base + RTC_CALIB_RD);
 	/* Offset with seconds ticks */
-	offset_val = calibval & RTC_TICK_MASK;
-	offset_val = offset_val - RTC_CALIB_DEF;
-	offset_val = offset_val * tick_mult;
+	max_tick = calibval & RTC_TICK_MASK;
+	offset_val = max_tick - freq;
+	/* Convert to ppb */
+	offset_val *= tick_mult;
 
 	/* Offset with fractional ticks */
-	if (calibval & RTC_FR_EN)
-		offset_val += ((calibval & RTC_FR_MASK) >> RTC_FR_DATSHIFT)
-			* (tick_mult / RTC_FR_MAX_TICKS);
+	if (calibval & RTC_FR_EN) {
+		fract_data = (calibval & RTC_FR_MASK) >> RTC_FR_DATSHIFT;
+		fract_part = DIV_ROUND_UP(tick_mult, RTC_FR_MAX_TICKS);
+		offset_val += (fract_part * fract_data);
+	}
+
 	*offset = offset_val;
 
 	return 0;

-- 
2.47.3



^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH v2 4/5] rtc: zynqmp: rework set_offset
  2026-01-08 12:51 [PATCH v2 0/5] rtc: zynqmp: fixes for read and set offset Tomas Melin
                   ` (2 preceding siblings ...)
  2026-01-08 12:51 ` [PATCH v2 3/5] rtc: zynqmp: rework read_offset Tomas Melin
@ 2026-01-08 12:51 ` Tomas Melin
  2026-01-14 15:37   ` T, Harini
  2026-01-08 12:51 ` [PATCH v2 5/5] rtc: zynqmp: use dynamic max and min offset ranges Tomas Melin
  2026-01-14 15:44 ` [PATCH v2 0/5] rtc: zynqmp: fixes for read and set offset T, Harini
  5 siblings, 1 reply; 16+ messages in thread
From: Tomas Melin @ 2026-01-08 12:51 UTC (permalink / raw)
  To: Alexandre Belloni, Michal Simek
  Cc: linux-rtc, linux-arm-kernel, linux-kernel, Tomas Melin

set_offset was using remainder of do_div as tick_mult which resulted in
wrong offset. Calibration value also assumed builtin calibration default.
Update fract_offset to correctly calculate the value for
negative offset and replace the for loop with division.

Signed-off-by: Tomas Melin <tomas.melin@vaisala.com>
---
 drivers/rtc/rtc-zynqmp.c | 33 +++++++++++++--------------------
 1 file changed, 13 insertions(+), 20 deletions(-)

diff --git a/drivers/rtc/rtc-zynqmp.c b/drivers/rtc/rtc-zynqmp.c
index 6740c3aed1897d4b50a02c4823a746d9c2ae2655..d15c256e7ae56058ddc38849af6424cd29b8965e 100644
--- a/drivers/rtc/rtc-zynqmp.c
+++ b/drivers/rtc/rtc-zynqmp.c
@@ -208,13 +208,13 @@ static int xlnx_rtc_read_offset(struct device *dev, long *offset)
 static int xlnx_rtc_set_offset(struct device *dev, long offset)
 {
 	struct xlnx_rtc_dev *xrtcdev = dev_get_drvdata(dev);
-	unsigned long long rtc_ppb = RTC_PPB;
-	unsigned int tick_mult = do_div(rtc_ppb, xrtcdev->freq);
-	unsigned char fract_tick = 0;
+	int max_tick, tick_mult, fract_offset, fract_part;
 	unsigned int calibval;
-	short int  max_tick;
-	int fract_offset;
+	int fract_data = 0;
+	int freq = xrtcdev->freq;
 
+	/* Tick to offset multiplier */
+	tick_mult = DIV_ROUND_CLOSEST(RTC_PPB, xrtcdev->freq);
 	if (offset < RTC_MIN_OFFSET || offset > RTC_MAX_OFFSET)
 		return -ERANGE;
 
@@ -223,29 +223,22 @@ static int xlnx_rtc_set_offset(struct device *dev, long offset)
 
 	/* Number fractional ticks for given offset */
 	if (fract_offset) {
-		if (fract_offset < 0) {
-			fract_offset = fract_offset + tick_mult;
+		fract_part = DIV_ROUND_UP(tick_mult, RTC_FR_MAX_TICKS);
+		fract_data = fract_offset / fract_part;
+		/* Subtract one from max_tick while adding fract_offset */
+		if (fract_offset < 0 && fract_data) {
 			max_tick--;
-		}
-		if (fract_offset > (tick_mult / RTC_FR_MAX_TICKS)) {
-			for (fract_tick = 1; fract_tick < 16; fract_tick++) {
-				if (fract_offset <=
-				    (fract_tick *
-				     (tick_mult / RTC_FR_MAX_TICKS)))
-					break;
-			}
+			fract_data += RTC_FR_MAX_TICKS;
 		}
 	}
 
 	/* Zynqmp RTC uses second and fractional tick
 	 * counters for compensation
 	 */
-	calibval = max_tick + RTC_CALIB_DEF;
-
-	if (fract_tick)
-		calibval |= RTC_FR_EN;
+	calibval = max_tick + freq;
 
-	calibval |= (fract_tick << RTC_FR_DATSHIFT);
+	if (fract_data)
+		calibval |= (RTC_FR_EN | (fract_data << RTC_FR_DATSHIFT));
 
 	writel(calibval, (xrtcdev->reg_base + RTC_CALIB_WR));
 

-- 
2.47.3



^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH v2 5/5] rtc: zynqmp: use dynamic max and min offset ranges
  2026-01-08 12:51 [PATCH v2 0/5] rtc: zynqmp: fixes for read and set offset Tomas Melin
                   ` (3 preceding siblings ...)
  2026-01-08 12:51 ` [PATCH v2 4/5] rtc: zynqmp: rework set_offset Tomas Melin
@ 2026-01-08 12:51 ` Tomas Melin
  2026-01-14 15:37   ` T, Harini
  2026-01-14 15:44 ` [PATCH v2 0/5] rtc: zynqmp: fixes for read and set offset T, Harini
  5 siblings, 1 reply; 16+ messages in thread
From: Tomas Melin @ 2026-01-08 12:51 UTC (permalink / raw)
  To: Alexandre Belloni, Michal Simek
  Cc: linux-rtc, linux-arm-kernel, linux-kernel, Tomas Melin

Maximum and minimum offsets in ppb that can be handled are dependent on
the rtc clock frequency and what can fit in the 16-bit register field.

Signed-off-by: Tomas Melin <tomas.melin@vaisala.com>
---
 drivers/rtc/rtc-zynqmp.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/drivers/rtc/rtc-zynqmp.c b/drivers/rtc/rtc-zynqmp.c
index d15c256e7ae56058ddc38849af6424cd29b8965e..f508c61f4046e906d9569cc779a1360474a85fd2 100644
--- a/drivers/rtc/rtc-zynqmp.c
+++ b/drivers/rtc/rtc-zynqmp.c
@@ -44,8 +44,6 @@
 #define RTC_FR_MASK		0xF0000
 #define RTC_FR_MAX_TICKS	16
 #define RTC_PPB			1000000000LL
-#define RTC_MIN_OFFSET		-32768000
-#define RTC_MAX_OFFSET		32767000
 
 struct xlnx_rtc_dev {
 	struct rtc_device	*rtc;
@@ -215,12 +213,12 @@ static int xlnx_rtc_set_offset(struct device *dev, long offset)
 
 	/* Tick to offset multiplier */
 	tick_mult = DIV_ROUND_CLOSEST(RTC_PPB, xrtcdev->freq);
-	if (offset < RTC_MIN_OFFSET || offset > RTC_MAX_OFFSET)
-		return -ERANGE;
-
 	/* Number ticks for given offset */
 	max_tick = div_s64_rem(offset, tick_mult, &fract_offset);
 
+	if (freq + max_tick > RTC_TICK_MASK || (freq + max_tick < 1))
+		return -ERANGE;
+
 	/* Number fractional ticks for given offset */
 	if (fract_offset) {
 		fract_part = DIV_ROUND_UP(tick_mult, RTC_FR_MAX_TICKS);

-- 
2.47.3



^ permalink raw reply related	[flat|nested] 16+ messages in thread

* RE: [PATCH v2 1/5] rtc: zynqmp: correct frequency value
  2026-01-08 12:51 ` [PATCH v2 1/5] rtc: zynqmp: correct frequency value Tomas Melin
@ 2026-01-14 15:35   ` T, Harini
  0 siblings, 0 replies; 16+ messages in thread
From: T, Harini @ 2026-01-14 15:35 UTC (permalink / raw)
  To: Tomas Melin, Alexandre Belloni, Simek, Michal
  Cc: linux-rtc@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org

[Public]

Reviewed-by: Harini T <harini.t@amd.com>

Thanks,
Harini T

> -----Original Message-----
> From: Tomas Melin <tomas.melin@vaisala.com>
> Sent: Thursday, January 8, 2026 6:21 PM
> To: Alexandre Belloni <alexandre.belloni@bootlin.com>; Simek, Michal
> <michal.simek@amd.com>
> Cc: linux-rtc@vger.kernel.org; linux-arm-kernel@lists.infradead.org; linux-
> kernel@vger.kernel.org; Tomas Melin <tomas.melin@vaisala.com>
> Subject: [PATCH v2 1/5] rtc: zynqmp: correct frequency value
>
> Caution: This message originated from an External Source. Use proper
> caution when opening attachments, clicking links, or responding.
>
>
> Fix calibration value in case a clock reference is provided.
> The actual calibration value written into register is frequency - 1.
>
> Signed-off-by: Tomas Melin <tomas.melin@vaisala.com>
> ---
>  drivers/rtc/rtc-zynqmp.c | 3 +++
>  1 file changed, 3 insertions(+)
>
> diff --git a/drivers/rtc/rtc-zynqmp.c b/drivers/rtc/rtc-zynqmp.c index
> 3baa2b481d9f2008750046005283b98a0d546c5c..856bc1678e7d31144f320ae
> 9f75fc58c742a2a64 100644
> --- a/drivers/rtc/rtc-zynqmp.c
> +++ b/drivers/rtc/rtc-zynqmp.c
> @@ -345,7 +345,10 @@ static int xlnx_rtc_probe(struct platform_device
> *pdev)
>                                            &xrtcdev->freq);
>                 if (ret)
>                         xrtcdev->freq = RTC_CALIB_DEF;
> +       } else {
> +               xrtcdev->freq--;
>         }
> +
>         ret = readl(xrtcdev->reg_base + RTC_CALIB_RD);
>         if (!ret)
>                 writel(xrtcdev->freq, (xrtcdev->reg_base + RTC_CALIB_WR));
>
> --
> 2.47.3
>


^ permalink raw reply	[flat|nested] 16+ messages in thread

* RE: [PATCH v2 2/5] rtc: zynqmp: check calibration max value
  2026-01-08 12:51 ` [PATCH v2 2/5] rtc: zynqmp: check calibration max value Tomas Melin
@ 2026-01-14 15:35   ` T, Harini
  0 siblings, 0 replies; 16+ messages in thread
From: T, Harini @ 2026-01-14 15:35 UTC (permalink / raw)
  To: Tomas Melin, Alexandre Belloni, Simek, Michal
  Cc: linux-rtc@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org

[Public]

Reviewed-by: Harini T <harini.t@amd.com>

Thanks,
Harini T

> -----Original Message-----
> From: Tomas Melin <tomas.melin@vaisala.com>
> Sent: Thursday, January 8, 2026 6:21 PM
> To: Alexandre Belloni <alexandre.belloni@bootlin.com>; Simek, Michal
> <michal.simek@amd.com>
> Cc: linux-rtc@vger.kernel.org; linux-arm-kernel@lists.infradead.org; linux-
> kernel@vger.kernel.org; Tomas Melin <tomas.melin@vaisala.com>
> Subject: [PATCH v2 2/5] rtc: zynqmp: check calibration max value
>
> Caution: This message originated from an External Source. Use proper
> caution when opening attachments, clicking links, or responding.
>
>
> Enable check to not overflow the calibration max value.
>
> Signed-off-by: Tomas Melin <tomas.melin@vaisala.com>
> ---
>  drivers/rtc/rtc-zynqmp.c | 5 +++++
>  1 file changed, 5 insertions(+)
>
> diff --git a/drivers/rtc/rtc-zynqmp.c b/drivers/rtc/rtc-zynqmp.c index
> 856bc1678e7d31144f320ae9f75fc58c742a2a64..caacce3725e2ef3803ea42d40
> e77ceaeb7d7b914 100644
> --- a/drivers/rtc/rtc-zynqmp.c
> +++ b/drivers/rtc/rtc-zynqmp.c
> @@ -349,6 +349,11 @@ static int xlnx_rtc_probe(struct platform_device
> *pdev)
>                 xrtcdev->freq--;
>         }
>
> +       if (xrtcdev->freq > RTC_TICK_MASK) {
> +               dev_err(&pdev->dev, "Invalid RTC calibration value\n");
> +               return -EINVAL;
> +       }
> +
>         ret = readl(xrtcdev->reg_base + RTC_CALIB_RD);
>         if (!ret)
>                 writel(xrtcdev->freq, (xrtcdev->reg_base + RTC_CALIB_WR));
>
> --
> 2.47.3
>


^ permalink raw reply	[flat|nested] 16+ messages in thread

* RE: [PATCH v2 3/5] rtc: zynqmp: rework read_offset
  2026-01-08 12:51 ` [PATCH v2 3/5] rtc: zynqmp: rework read_offset Tomas Melin
@ 2026-01-14 15:36   ` T, Harini
  2026-01-15  0:42   ` kernel test robot
  1 sibling, 0 replies; 16+ messages in thread
From: T, Harini @ 2026-01-14 15:36 UTC (permalink / raw)
  To: Tomas Melin, Alexandre Belloni, Simek, Michal
  Cc: linux-rtc@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org

[Public]

Reviewed-by: Harini T <harini.t@amd.com>

Thanks,
Harini T

> -----Original Message-----
> From: Tomas Melin <tomas.melin@vaisala.com>
> Sent: Thursday, January 8, 2026 6:21 PM
> To: Alexandre Belloni <alexandre.belloni@bootlin.com>; Simek, Michal
> <michal.simek@amd.com>
> Cc: linux-rtc@vger.kernel.org; linux-arm-kernel@lists.infradead.org; linux-
> kernel@vger.kernel.org; Tomas Melin <tomas.melin@vaisala.com>
> Subject: [PATCH v2 3/5] rtc: zynqmp: rework read_offset
>
> Caution: This message originated from an External Source. Use proper
> caution when opening attachments, clicking links, or responding.
>
>
> read_offset() was using static frequency for determining the tick offset. It was
> also using remainder from do_div() operation as tick_mult value which
> caused the offset to be incorrect.
>
> At the same time, rework function to improve readability.
> It is worth noting, that due to rounding errors, the offset readback will differ
> slightly for positive and negative calibration values.
>
> Signed-off-by: Tomas Melin <tomas.melin@vaisala.com>
> ---
>  drivers/rtc/rtc-zynqmp.c | 25 ++++++++++++++++---------
>  1 file changed, 16 insertions(+), 9 deletions(-)
>
> diff --git a/drivers/rtc/rtc-zynqmp.c b/drivers/rtc/rtc-zynqmp.c index
> caacce3725e2ef3803ea42d40e77ceaeb7d7b914..6740c3aed1897d4b50a02c4
> 823a746d9c2ae2655 100644
> --- a/drivers/rtc/rtc-zynqmp.c
> +++ b/drivers/rtc/rtc-zynqmp.c
> @@ -178,21 +178,28 @@ static void xlnx_init_rtc(struct xlnx_rtc_dev
> *xrtcdev)  static int xlnx_rtc_read_offset(struct device *dev, long *offset)  {
>         struct xlnx_rtc_dev *xrtcdev = dev_get_drvdata(dev);
> -       unsigned long long rtc_ppb = RTC_PPB;
> -       unsigned int tick_mult = do_div(rtc_ppb, xrtcdev->freq);
> -       unsigned int calibval;
> +       unsigned int calibval, fract_data, fract_part;
> +       int freq = xrtcdev->freq;
> +       int max_tick, tick_mult;
>         long offset_val;
>
> +       /* Tick to offset multiplier */
> +       tick_mult = DIV_ROUND_CLOSEST(RTC_PPB, freq);
> +
>         calibval = readl(xrtcdev->reg_base + RTC_CALIB_RD);
>         /* Offset with seconds ticks */
> -       offset_val = calibval & RTC_TICK_MASK;
> -       offset_val = offset_val - RTC_CALIB_DEF;
> -       offset_val = offset_val * tick_mult;
> +       max_tick = calibval & RTC_TICK_MASK;
> +       offset_val = max_tick - freq;
> +       /* Convert to ppb */
> +       offset_val *= tick_mult;
>
>         /* Offset with fractional ticks */
> -       if (calibval & RTC_FR_EN)
> -               offset_val += ((calibval & RTC_FR_MASK) >> RTC_FR_DATSHIFT)
> -                       * (tick_mult / RTC_FR_MAX_TICKS);
> +       if (calibval & RTC_FR_EN) {
> +               fract_data = (calibval & RTC_FR_MASK) >> RTC_FR_DATSHIFT;
> +               fract_part = DIV_ROUND_UP(tick_mult, RTC_FR_MAX_TICKS);
> +               offset_val += (fract_part * fract_data);
> +       }
> +
>         *offset = offset_val;
>
>         return 0;
>
> --
> 2.47.3
>


^ permalink raw reply	[flat|nested] 16+ messages in thread

* RE: [PATCH v2 4/5] rtc: zynqmp: rework set_offset
  2026-01-08 12:51 ` [PATCH v2 4/5] rtc: zynqmp: rework set_offset Tomas Melin
@ 2026-01-14 15:37   ` T, Harini
  2026-01-15  7:24     ` Tomas Melin
  0 siblings, 1 reply; 16+ messages in thread
From: T, Harini @ 2026-01-14 15:37 UTC (permalink / raw)
  To: Tomas Melin, Alexandre Belloni, Simek, Michal
  Cc: linux-rtc@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org

[Public]

Hi,

> -----Original Message-----
> From: Tomas Melin <tomas.melin@vaisala.com>
> Sent: Thursday, January 8, 2026 6:21 PM
> To: Alexandre Belloni <alexandre.belloni@bootlin.com>; Simek, Michal
> <michal.simek@amd.com>
> Cc: linux-rtc@vger.kernel.org; linux-arm-kernel@lists.infradead.org; linux-
> kernel@vger.kernel.org; Tomas Melin <tomas.melin@vaisala.com>
> Subject: [PATCH v2 4/5] rtc: zynqmp: rework set_offset
>
> Caution: This message originated from an External Source. Use proper
> caution when opening attachments, clicking links, or responding.
>
>
> set_offset was using remainder of do_div as tick_mult which resulted in
> wrong offset. Calibration value also assumed builtin calibration default.
> Update fract_offset to correctly calculate the value for negative offset and
> replace the for loop with division.
>
> Signed-off-by: Tomas Melin <tomas.melin@vaisala.com>
> ---
>  drivers/rtc/rtc-zynqmp.c | 33 +++++++++++++--------------------
>  1 file changed, 13 insertions(+), 20 deletions(-)
>
> diff --git a/drivers/rtc/rtc-zynqmp.c b/drivers/rtc/rtc-zynqmp.c index
> 6740c3aed1897d4b50a02c4823a746d9c2ae2655..d15c256e7ae56058ddc3884
> 9af6424cd29b8965e 100644
> --- a/drivers/rtc/rtc-zynqmp.c
> +++ b/drivers/rtc/rtc-zynqmp.c
> @@ -208,13 +208,13 @@ static int xlnx_rtc_read_offset(struct device *dev,
> long *offset)  static int xlnx_rtc_set_offset(struct device *dev, long offset)  {
>         struct xlnx_rtc_dev *xrtcdev = dev_get_drvdata(dev);
> -       unsigned long long rtc_ppb = RTC_PPB;
> -       unsigned int tick_mult = do_div(rtc_ppb, xrtcdev->freq);
> -       unsigned char fract_tick = 0;
> +       int max_tick, tick_mult, fract_offset, fract_part;
>         unsigned int calibval;
> -       short int  max_tick;
> -       int fract_offset;
> +       int fract_data = 0;
> +       int freq = xrtcdev->freq;
Please follow reverse XMAS tree style.
>
> +       /* Tick to offset multiplier */
> +       tick_mult = DIV_ROUND_CLOSEST(RTC_PPB, xrtcdev->freq);
>         if (offset < RTC_MIN_OFFSET || offset > RTC_MAX_OFFSET)
>                 return -ERANGE;
>
> @@ -223,29 +223,22 @@ static int xlnx_rtc_set_offset(struct device *dev,
> long offset)
>
>         /* Number fractional ticks for given offset */
>         if (fract_offset) {
> -               if (fract_offset < 0) {
> -                       fract_offset = fract_offset + tick_mult;
> +               fract_part = DIV_ROUND_UP(tick_mult, RTC_FR_MAX_TICKS);
> +               fract_data = fract_offset / fract_part;
> +               /* Subtract one from max_tick while adding fract_offset */
> +               if (fract_offset < 0 && fract_data) {
>                         max_tick--;
> -               }
> -               if (fract_offset > (tick_mult / RTC_FR_MAX_TICKS)) {
> -                       for (fract_tick = 1; fract_tick < 16; fract_tick++) {
> -                               if (fract_offset <=
> -                                   (fract_tick *
> -                                    (tick_mult / RTC_FR_MAX_TICKS)))
> -                                       break;
> -                       }
> +                       fract_data += RTC_FR_MAX_TICKS;
>                 }
>         }
>
>         /* Zynqmp RTC uses second and fractional tick
>          * counters for compensation
>          */
> -       calibval = max_tick + RTC_CALIB_DEF;
> -
> -       if (fract_tick)
> -               calibval |= RTC_FR_EN;
> +       calibval = max_tick + freq;
>
> -       calibval |= (fract_tick << RTC_FR_DATSHIFT);
> +       if (fract_data)
> +               calibval |= (RTC_FR_EN | (fract_data <<
> + RTC_FR_DATSHIFT));
>
>         writel(calibval, (xrtcdev->reg_base + RTC_CALIB_WR));
>
>
> --
> 2.47.3
>

Thanks,
Harini T

^ permalink raw reply	[flat|nested] 16+ messages in thread

* RE: [PATCH v2 5/5] rtc: zynqmp: use dynamic max and min offset ranges
  2026-01-08 12:51 ` [PATCH v2 5/5] rtc: zynqmp: use dynamic max and min offset ranges Tomas Melin
@ 2026-01-14 15:37   ` T, Harini
  0 siblings, 0 replies; 16+ messages in thread
From: T, Harini @ 2026-01-14 15:37 UTC (permalink / raw)
  To: Tomas Melin, Alexandre Belloni, Simek, Michal
  Cc: linux-rtc@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org

[Public]

Reviewed-by: Harini T <harini.t@amd.com>

Thanks,
Harini T

> -----Original Message-----
> From: Tomas Melin <tomas.melin@vaisala.com>
> Sent: Thursday, January 8, 2026 6:21 PM
> To: Alexandre Belloni <alexandre.belloni@bootlin.com>; Simek, Michal
> <michal.simek@amd.com>
> Cc: linux-rtc@vger.kernel.org; linux-arm-kernel@lists.infradead.org; linux-
> kernel@vger.kernel.org; Tomas Melin <tomas.melin@vaisala.com>
> Subject: [PATCH v2 5/5] rtc: zynqmp: use dynamic max and min offset ranges
>
> Caution: This message originated from an External Source. Use proper
> caution when opening attachments, clicking links, or responding.
>
>
> Maximum and minimum offsets in ppb that can be handled are dependent
> on the rtc clock frequency and what can fit in the 16-bit register field.
>
> Signed-off-by: Tomas Melin <tomas.melin@vaisala.com>
> ---
>  drivers/rtc/rtc-zynqmp.c | 8 +++-----
>  1 file changed, 3 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/rtc/rtc-zynqmp.c b/drivers/rtc/rtc-zynqmp.c index
> d15c256e7ae56058ddc38849af6424cd29b8965e..f508c61f4046e906d9569cc7
> 79a1360474a85fd2 100644
> --- a/drivers/rtc/rtc-zynqmp.c
> +++ b/drivers/rtc/rtc-zynqmp.c
> @@ -44,8 +44,6 @@
>  #define RTC_FR_MASK            0xF0000
>  #define RTC_FR_MAX_TICKS       16
>  #define RTC_PPB                        1000000000LL
> -#define RTC_MIN_OFFSET         -32768000
> -#define RTC_MAX_OFFSET         32767000
>
>  struct xlnx_rtc_dev {
>         struct rtc_device       *rtc;
> @@ -215,12 +213,12 @@ static int xlnx_rtc_set_offset(struct device *dev,
> long offset)
>
>         /* Tick to offset multiplier */
>         tick_mult = DIV_ROUND_CLOSEST(RTC_PPB, xrtcdev->freq);
> -       if (offset < RTC_MIN_OFFSET || offset > RTC_MAX_OFFSET)
> -               return -ERANGE;
> -
>         /* Number ticks for given offset */
>         max_tick = div_s64_rem(offset, tick_mult, &fract_offset);
>
> +       if (freq + max_tick > RTC_TICK_MASK || (freq + max_tick < 1))
> +               return -ERANGE;
> +
>         /* Number fractional ticks for given offset */
>         if (fract_offset) {
>                 fract_part = DIV_ROUND_UP(tick_mult, RTC_FR_MAX_TICKS);
>
> --
> 2.47.3
>


^ permalink raw reply	[flat|nested] 16+ messages in thread

* RE: [PATCH v2 0/5] rtc: zynqmp: fixes for read and set offset
  2026-01-08 12:51 [PATCH v2 0/5] rtc: zynqmp: fixes for read and set offset Tomas Melin
                   ` (4 preceding siblings ...)
  2026-01-08 12:51 ` [PATCH v2 5/5] rtc: zynqmp: use dynamic max and min offset ranges Tomas Melin
@ 2026-01-14 15:44 ` T, Harini
  5 siblings, 0 replies; 16+ messages in thread
From: T, Harini @ 2026-01-14 15:44 UTC (permalink / raw)
  To: Tomas Melin, Alexandre Belloni, Simek, Michal
  Cc: linux-rtc@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org

[Public]

Write +34335 ppb → Read +34335 ppb (0 ppb error)
Write -34335 ppb → Read -34326 ppb (9 ppb error)
Asymmetry: 9 ppb

The 9 ppb error is acceptable as it's well within the hardware's ±1908 ppb
quantization limit (4-bit fractional resolution)

Tested-by: Harini T <harini.t@amd.com>

Thanks,
Harini T

> -----Original Message-----
> From: Tomas Melin <tomas.melin@vaisala.com>
> Sent: Thursday, January 8, 2026 6:21 PM
> To: Alexandre Belloni <alexandre.belloni@bootlin.com>; Simek, Michal
> <michal.simek@amd.com>
> Cc: linux-rtc@vger.kernel.org; linux-arm-kernel@lists.infradead.org; linux-
> kernel@vger.kernel.org; Tomas Melin <tomas.melin@vaisala.com>
> Subject: [PATCH v2 0/5] rtc: zynqmp: fixes for read and set offset
>
> Caution: This message originated from an External Source. Use proper
> caution when opening attachments, clicking links, or responding.
>
>
> Add improvements for read and set offset functions.
> The basic functionality is still the same, but offset correction values are now
> updated to match with expected.
>
> The RTC calibration value operates with full ticks, and fractional ticks which
> are a 1/16 of a full tick.
> The 16 lowest bits in the calibration registers are for the full ticks and value
> matches the external oscillator in Hz. Through that, the maximum and
> minimum offset values can be calculated dynamically, as they depend on the
> input frequency used.
>
> For docs on the calibration register, see https://docs.amd.com/r/en-
> US/ug1087-zynq-ultrascale-registers/CALIB_READ-RTC-Register
>
> Due to rounding errors (different number of fract ticks), offset readback will
> differ slightly depending on if the offset is negative or positive.
>
> For example
> $ echo 34335 > offset
> $ cat offset
> 34335
> $ echo -34335 > offset
> $ cat offset
> -34326
>
> Signed-off-by: Tomas Melin <tomas.melin@vaisala.com>
> ---
> Changes in v2:
> - Add commit introducing check for calibration value overflow
> - Update comments
> - Align data types across set and read
> - Rename fract_tick as fract_data conforming to data sheet
> - Further improve on set offset calculation logic
> - Link to v1: https://lore.kernel.org/r/20251201-zynqmp-rtc-updates-v1-0-
> 33875c1e385b@vaisala.com
>
> ---
> Tomas Melin (5):
>       rtc: zynqmp: correct frequency value
>       rtc: zynqmp: check calibration max value
>       rtc: zynqmp: rework read_offset
>       rtc: zynqmp: rework set_offset
>       rtc: zynqmp: use dynamic max and min offset ranges
>
>  drivers/rtc/rtc-zynqmp.c | 74 ++++++++++++++++++++++++++---------------------
> -
>  1 file changed, 40 insertions(+), 34 deletions(-)
> ---
> base-commit: cd635e33b0113287c94021be53d2a7c61a1614e9
> change-id: 20251201-zynqmp-rtc-updates-d260364cc01b
>
> Best regards,
> --
> Tomas Melin <tomas.melin@vaisala.com>
>


^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH v2 3/5] rtc: zynqmp: rework read_offset
  2026-01-08 12:51 ` [PATCH v2 3/5] rtc: zynqmp: rework read_offset Tomas Melin
  2026-01-14 15:36   ` T, Harini
@ 2026-01-15  0:42   ` kernel test robot
  2026-01-15  7:41     ` Tomas Melin
  1 sibling, 1 reply; 16+ messages in thread
From: kernel test robot @ 2026-01-15  0:42 UTC (permalink / raw)
  To: Tomas Melin, Alexandre Belloni, Michal Simek
  Cc: oe-kbuild-all, linux-rtc, linux-arm-kernel, linux-kernel,
	Tomas Melin

Hi Tomas,

kernel test robot noticed the following build errors:

[auto build test ERROR on abelloni/rtc-next]
[also build test ERROR on xilinx-xlnx/master linus/master v6.19-rc5]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Tomas-Melin/rtc-zynqmp-check-calibration-max-value/20260108-223800
base:   https://git.kernel.org/pub/scm/linux/kernel/git/abelloni/linux.git rtc-next
patch link:    https://lore.kernel.org/r/20260108-zynqmp-rtc-updates-v2-3-864c161fa83d%40vaisala.com
patch subject: [PATCH v2 3/5] rtc: zynqmp: rework read_offset
config: arm-allyesconfig (https://download.01.org/0day-ci/archive/20260115/202601150836.Yk8DcSZW-lkp@intel.com/config)
compiler: arm-linux-gnueabi-gcc (GCC) 15.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260115/202601150836.Yk8DcSZW-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202601150836.Yk8DcSZW-lkp@intel.com/

All errors (new ones prefixed by >>):

   arm-linux-gnueabi-ld: drivers/spi/spi-amlogic-spifc-a4.o: in function `aml_sfc_set_bus_width':
   spi-amlogic-spifc-a4.c:(.text.aml_sfc_set_bus_width+0x8c): undefined reference to `__ffsdi2'
   arm-linux-gnueabi-ld: spi-amlogic-spifc-a4.c:(.text.aml_sfc_set_bus_width+0xac): undefined reference to `__ffsdi2'
   arm-linux-gnueabi-ld: spi-amlogic-spifc-a4.c:(.text.aml_sfc_set_bus_width+0xcc): undefined reference to `__ffsdi2'
   arm-linux-gnueabi-ld: drivers/rtc/rtc-zynqmp.o: in function `xlnx_rtc_read_offset':
>> rtc-zynqmp.c:(.text.xlnx_rtc_read_offset+0xd0): undefined reference to `__aeabi_ldivmod'
>> arm-linux-gnueabi-ld: rtc-zynqmp.c:(.text.xlnx_rtc_read_offset+0x15c): undefined reference to `__aeabi_ldivmod'

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki


^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH v2 4/5] rtc: zynqmp: rework set_offset
  2026-01-14 15:37   ` T, Harini
@ 2026-01-15  7:24     ` Tomas Melin
  0 siblings, 0 replies; 16+ messages in thread
From: Tomas Melin @ 2026-01-15  7:24 UTC (permalink / raw)
  To: T, Harini, Alexandre Belloni, Simek, Michal
  Cc: linux-rtc@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org

Hi,


On 14/01/2026 17:37, T, Harini wrote:
>> +++ b/drivers/rtc/rtc-zynqmp.c
>> @@ -208,13 +208,13 @@ static int xlnx_rtc_read_offset(struct device *dev,
>> long *offset)  static int xlnx_rtc_set_offset(struct device *dev, long offset)  {
>>         struct xlnx_rtc_dev *xrtcdev = dev_get_drvdata(dev);
>> -       unsigned long long rtc_ppb = RTC_PPB;
>> -       unsigned int tick_mult = do_div(rtc_ppb, xrtcdev->freq);
>> -       unsigned char fract_tick = 0;
>> +       int max_tick, tick_mult, fract_offset, fract_part;
>>         unsigned int calibval;
>> -       short int  max_tick;
>> -       int fract_offset;
>> +       int fract_data = 0;
>> +       int freq = xrtcdev->freq;
> Please follow reverse XMAS tree style.
I can fix this with a follow up version.

Thanks,
Tomas



>>
>> +       /* Tick to offset multiplier */
>> +       tick_mult = DIV_ROUND_CLOSEST(RTC_PPB, xrtcdev->freq);
>>         if (offset < RTC_MIN_OFFSET || offset > RTC_MAX_OFFSET)
>>                 return -ERANGE;
>>
>> @@ -223,29 +223,22 @@ static int xlnx_rtc_set_offset(struct device *dev,
>> long offset)
>>
>>         /* Number fractional ticks for given offset */
>>         if (fract_offset) {
>> -               if (fract_offset < 0) {
>> -                       fract_offset = fract_offset + tick_mult;
>> +               fract_part = DIV_ROUND_UP(tick_mult, RTC_FR_MAX_TICKS);
>> +               fract_data = fract_offset / fract_part;
>> +               /* Subtract one from max_tick while adding fract_offset */
>> +               if (fract_offset < 0 && fract_data) {
>>                         max_tick--;
>> -               }
>> -               if (fract_offset > (tick_mult / RTC_FR_MAX_TICKS)) {
>> -                       for (fract_tick = 1; fract_tick < 16; fract_tick++) {
>> -                               if (fract_offset <=
>> -                                   (fract_tick *
>> -                                    (tick_mult / RTC_FR_MAX_TICKS)))
>> -                                       break;
>> -                       }
>> +                       fract_data += RTC_FR_MAX_TICKS;
>>                 }
>>         }
>>
>>         /* Zynqmp RTC uses second and fractional tick
>>          * counters for compensation
>>          */
>> -       calibval = max_tick + RTC_CALIB_DEF;
>> -
>> -       if (fract_tick)
>> -               calibval |= RTC_FR_EN;
>> +       calibval = max_tick + freq;
>>
>> -       calibval |= (fract_tick << RTC_FR_DATSHIFT);
>> +       if (fract_data)
>> +               calibval |= (RTC_FR_EN | (fract_data <<
>> + RTC_FR_DATSHIFT));
>>
>>         writel(calibval, (xrtcdev->reg_base + RTC_CALIB_WR));
>>
>>
>> --
>> 2.47.3
>>
> 
> Thanks,
> Harini T



^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH v2 3/5] rtc: zynqmp: rework read_offset
  2026-01-15  0:42   ` kernel test robot
@ 2026-01-15  7:41     ` Tomas Melin
  2026-01-19  9:45       ` Tomas Melin
  0 siblings, 1 reply; 16+ messages in thread
From: Tomas Melin @ 2026-01-15  7:41 UTC (permalink / raw)
  To: kernel test robot, Alexandre Belloni, Michal Simek
  Cc: oe-kbuild-all, linux-rtc, linux-arm-kernel, linux-kernel

Hi,

On 15/01/2026 02:42, kernel test robot wrote:

> 
>    arm-linux-gnueabi-ld: drivers/spi/spi-amlogic-spifc-a4.o: in function `aml_sfc_set_bus_width':
>    spi-amlogic-spifc-a4.c:(.text.aml_sfc_set_bus_width+0x8c): undefined reference to `__ffsdi2'
>    arm-linux-gnueabi-ld: spi-amlogic-spifc-a4.c:(.text.aml_sfc_set_bus_width+0xac): undefined reference to `__ffsdi2'
>    arm-linux-gnueabi-ld: spi-amlogic-spifc-a4.c:(.text.aml_sfc_set_bus_width+0xcc): undefined reference to `__ffsdi2'
>    arm-linux-gnueabi-ld: drivers/rtc/rtc-zynqmp.o: in function `xlnx_rtc_read_offset':
>>> rtc-zynqmp.c:(.text.xlnx_rtc_read_offset+0xd0): undefined reference to `__aeabi_ldivmod'
>>> arm-linux-gnueabi-ld: rtc-zynqmp.c:(.text.xlnx_rtc_read_offset+0x15c): undefined reference to `__aeabi_ldivmod'
AFAIU this is related to compiling for arm 32 bit target. Is this error
relevant since this driver is for aarch64 zynqmp specifically? If so,
what would be correct way of fixing?

Thanks,
Tomas



> 



^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH v2 3/5] rtc: zynqmp: rework read_offset
  2026-01-15  7:41     ` Tomas Melin
@ 2026-01-19  9:45       ` Tomas Melin
  0 siblings, 0 replies; 16+ messages in thread
From: Tomas Melin @ 2026-01-19  9:45 UTC (permalink / raw)
  To: kernel test robot, Alexandre Belloni, Michal Simek
  Cc: oe-kbuild-all, linux-rtc, linux-arm-kernel, linux-kernel



On 15/01/2026 09:41, Tomas Melin wrote:
> Hi,
> 
> On 15/01/2026 02:42, kernel test robot wrote:
> 
>>
>>    arm-linux-gnueabi-ld: drivers/spi/spi-amlogic-spifc-a4.o: in function `aml_sfc_set_bus_width':
>>    spi-amlogic-spifc-a4.c:(.text.aml_sfc_set_bus_width+0x8c): undefined reference to `__ffsdi2'
>>    arm-linux-gnueabi-ld: spi-amlogic-spifc-a4.c:(.text.aml_sfc_set_bus_width+0xac): undefined reference to `__ffsdi2'
>>    arm-linux-gnueabi-ld: spi-amlogic-spifc-a4.c:(.text.aml_sfc_set_bus_width+0xcc): undefined reference to `__ffsdi2'
>>    arm-linux-gnueabi-ld: drivers/rtc/rtc-zynqmp.o: in function `xlnx_rtc_read_offset':
>>>> rtc-zynqmp.c:(.text.xlnx_rtc_read_offset+0xd0): undefined reference to `__aeabi_ldivmod'
>>>> arm-linux-gnueabi-ld: rtc-zynqmp.c:(.text.xlnx_rtc_read_offset+0x15c): undefined reference to `__aeabi_ldivmod'
> AFAIU this is related to compiling for arm 32 bit target. Is this error
> relevant since this driver is for aarch64 zynqmp specifically? If so,
> what would be correct way of fixing?

Answering my self, I think correct course of action here is probably to
limit building of this driver for the zynqmp architecture. I will add
this in next version.

Thanks,
Tomas


> 
> Thanks,
> Tomas
> 
> 
> 
>>
> 
> 



^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2026-01-19  9:46 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-01-08 12:51 [PATCH v2 0/5] rtc: zynqmp: fixes for read and set offset Tomas Melin
2026-01-08 12:51 ` [PATCH v2 1/5] rtc: zynqmp: correct frequency value Tomas Melin
2026-01-14 15:35   ` T, Harini
2026-01-08 12:51 ` [PATCH v2 2/5] rtc: zynqmp: check calibration max value Tomas Melin
2026-01-14 15:35   ` T, Harini
2026-01-08 12:51 ` [PATCH v2 3/5] rtc: zynqmp: rework read_offset Tomas Melin
2026-01-14 15:36   ` T, Harini
2026-01-15  0:42   ` kernel test robot
2026-01-15  7:41     ` Tomas Melin
2026-01-19  9:45       ` Tomas Melin
2026-01-08 12:51 ` [PATCH v2 4/5] rtc: zynqmp: rework set_offset Tomas Melin
2026-01-14 15:37   ` T, Harini
2026-01-15  7:24     ` Tomas Melin
2026-01-08 12:51 ` [PATCH v2 5/5] rtc: zynqmp: use dynamic max and min offset ranges Tomas Melin
2026-01-14 15:37   ` T, Harini
2026-01-14 15:44 ` [PATCH v2 0/5] rtc: zynqmp: fixes for read and set offset T, Harini

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox