Skip to content

Commit

Permalink
rtc: zynqmp: fix linking failure for ARCH arm
Browse files Browse the repository at this point in the history
64-bit division "(u64 A) / (u32 B)" will break linking on ARCH arm:

rm-linux-gnueabihf-ld: drivers/rtc/rtc-zynqmp.o: in function `xlnx_rtc_read_offset':
rtc-zynqmp.c:(.text+0x48): undefined reference to `__aeabi_ldivmod'

Fix this by using do_div.

Signed-off-by: Quanyang Wang <quanyang.wang@windriver.com>
  • Loading branch information
wqyoung authored and Michal Simek committed Jul 13, 2021
1 parent d3b087e commit a5f3af6
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions drivers/rtc/rtc-zynqmp.c
Expand Up @@ -193,9 +193,10 @@ 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;
long offset_val;
unsigned int reg;
unsigned int tick_mult = RTC_PPB / xrtcdev->calibval;
unsigned int tick_mult = do_div(rtc_ppb, xrtcdev->calibval);

reg = readl(xrtcdev->reg_base + RTC_CALIB_RD);

Expand All @@ -216,11 +217,12 @@ 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;
short int max_tick;
unsigned char fract_tick = 0;
unsigned int calibval;
int fract_offset;
unsigned int tick_mult = RTC_PPB / xrtcdev->calibval;
unsigned int tick_mult = do_div(rtc_ppb, xrtcdev->calibval);

/* Make sure offset value is within supported range */
if (offset < RTC_OFFSET_MIN || offset > RTC_OFFSET_MAX)
Expand Down

0 comments on commit a5f3af6

Please sign in to comment.