Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

rtc: goldfish: Use gf_ioread32()/gf_iowrite32()

Replace readl()/writel() by gf_ioread32()/gf_iowrite32()
as done for goldfish-tty.

Signed-off-by: Laurent Vivier <laurent@vivier.eu>
Acked-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Link: https://lore.kernel.org/r/20220406201523.243733-3-laurent@vivier.eu
Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>

authored by

Laurent Vivier and committed by
Geert Uytterhoeven
3378c7f4 2e2ac4a3

+16 -15
+16 -15
drivers/rtc/rtc-goldfish.c
··· 10 10 #include <linux/of.h> 11 11 #include <linux/platform_device.h> 12 12 #include <linux/rtc.h> 13 + #include <linux/goldfish.h> 13 14 14 15 #define TIMER_TIME_LOW 0x00 /* get low bits of current time */ 15 16 /* and update TIMER_TIME_HIGH */ ··· 42 41 rtcdrv = dev_get_drvdata(dev); 43 42 base = rtcdrv->base; 44 43 45 - rtc_alarm_low = readl(base + TIMER_ALARM_LOW); 46 - rtc_alarm_high = readl(base + TIMER_ALARM_HIGH); 44 + rtc_alarm_low = gf_ioread32(base + TIMER_ALARM_LOW); 45 + rtc_alarm_high = gf_ioread32(base + TIMER_ALARM_HIGH); 47 46 rtc_alarm = (rtc_alarm_high << 32) | rtc_alarm_low; 48 47 49 48 do_div(rtc_alarm, NSEC_PER_SEC); ··· 51 50 52 51 rtc_time64_to_tm(rtc_alarm, &alrm->time); 53 52 54 - if (readl(base + TIMER_ALARM_STATUS)) 53 + if (gf_ioread32(base + TIMER_ALARM_STATUS)) 55 54 alrm->enabled = 1; 56 55 else 57 56 alrm->enabled = 0; ··· 72 71 73 72 if (alrm->enabled) { 74 73 rtc_alarm64 = rtc_tm_to_time64(&alrm->time) * NSEC_PER_SEC; 75 - writel((rtc_alarm64 >> 32), base + TIMER_ALARM_HIGH); 76 - writel(rtc_alarm64, base + TIMER_ALARM_LOW); 77 - writel(1, base + TIMER_IRQ_ENABLED); 74 + gf_iowrite32((rtc_alarm64 >> 32), base + TIMER_ALARM_HIGH); 75 + gf_iowrite32(rtc_alarm64, base + TIMER_ALARM_LOW); 76 + gf_iowrite32(1, base + TIMER_IRQ_ENABLED); 78 77 } else { 79 78 /* 80 79 * if this function was called with enabled=0 81 80 * then it could mean that the application is 82 81 * trying to cancel an ongoing alarm 83 82 */ 84 - rtc_status_reg = readl(base + TIMER_ALARM_STATUS); 83 + rtc_status_reg = gf_ioread32(base + TIMER_ALARM_STATUS); 85 84 if (rtc_status_reg) 86 - writel(1, base + TIMER_CLEAR_ALARM); 85 + gf_iowrite32(1, base + TIMER_CLEAR_ALARM); 87 86 } 88 87 89 88 return 0; ··· 99 98 base = rtcdrv->base; 100 99 101 100 if (enabled) 102 - writel(1, base + TIMER_IRQ_ENABLED); 101 + gf_iowrite32(1, base + TIMER_IRQ_ENABLED); 103 102 else 104 - writel(0, base + TIMER_IRQ_ENABLED); 103 + gf_iowrite32(0, base + TIMER_IRQ_ENABLED); 105 104 106 105 return 0; 107 106 } ··· 111 110 struct goldfish_rtc *rtcdrv = dev_id; 112 111 void __iomem *base = rtcdrv->base; 113 112 114 - writel(1, base + TIMER_CLEAR_INTERRUPT); 113 + gf_iowrite32(1, base + TIMER_CLEAR_INTERRUPT); 115 114 116 115 rtc_update_irq(rtcdrv->rtc, 1, RTC_IRQF | RTC_AF); 117 116 ··· 129 128 rtcdrv = dev_get_drvdata(dev); 130 129 base = rtcdrv->base; 131 130 132 - time_low = readl(base + TIMER_TIME_LOW); 133 - time_high = readl(base + TIMER_TIME_HIGH); 131 + time_low = gf_ioread32(base + TIMER_TIME_LOW); 132 + time_high = gf_ioread32(base + TIMER_TIME_HIGH); 134 133 time = (time_high << 32) | time_low; 135 134 136 135 do_div(time, NSEC_PER_SEC); ··· 150 149 base = rtcdrv->base; 151 150 152 151 now64 = rtc_tm_to_time64(tm) * NSEC_PER_SEC; 153 - writel((now64 >> 32), base + TIMER_TIME_HIGH); 154 - writel(now64, base + TIMER_TIME_LOW); 152 + gf_iowrite32((now64 >> 32), base + TIMER_TIME_HIGH); 153 + gf_iowrite32(now64, base + TIMER_TIME_LOW); 155 154 156 155 return 0; 157 156 }