]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
rtc: sh: remove periodic interrupt handling
authorWolfram Sang <wsa+renesas@sang-engineering.com>
Thu, 27 Feb 2025 13:42:59 +0000 (14:42 +0100)
committerAlexandre Belloni <alexandre.belloni@bootlin.com>
Tue, 8 Apr 2025 13:56:19 +0000 (15:56 +0200)
Because periodic interrupts are emulated by the RTC core, the PIE
handling code can simply go away now. And with it the custom proc-file.

Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Link: https://lore.kernel.org/r/20250227134256.9167-14-wsa+renesas@sang-engineering.com
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
drivers/rtc/rtc-sh.c

index 469806604f31dcf6e36c227cd62b4ca2af558123..e80d4ae979c93280eb5e70f6cddff3c0da853276 100644 (file)
 /* ALARM Bits - or with BCD encoded value */
 #define AR_ENB         0x80    /* Enable for alarm cmp   */
 
-/* Period Bits */
-#define PF_HP          0x100   /* Enable Half Period to support 8,32,128Hz */
-#define PF_COUNT       0x200   /* Half periodic counter */
-#define PF_KOU         0x800   /* Kernel or User periodic request 1=kernel */
-#define PF_MASK                0xf00
-
 /* RCR1 Bits */
 #define RCR1_CF                0x80    /* Carry Flag             */
 #define RCR1_CIE       0x10    /* Carry Interrupt Enable */
@@ -85,8 +79,6 @@
 #define RCR1_AF                0x01    /* Alarm Flag             */
 
 /* RCR2 Bits */
-#define RCR2_PEF       0x80    /* PEriodic interrupt Flag */
-#define RCR2_PESMASK   0x70    /* Periodic interrupt Set  */
 #define RCR2_RTCEN     0x08    /* ENable RTC              */
 #define RCR2_ADJ       0x04    /* ADJustment (30-second)  */
 #define RCR2_RESET     0x02    /* Reset bit               */
@@ -103,7 +95,6 @@ struct sh_rtc {
        struct rtc_device       *rtc_dev;
        spinlock_t              lock;
        unsigned long           capabilities;   /* See asm/rtc.h for cap bits */
-       unsigned short          periodic_freq;
 };
 
 static int __sh_rtc_alarm(struct sh_rtc *rtc)
@@ -121,30 +112,6 @@ static int __sh_rtc_alarm(struct sh_rtc *rtc)
        return pending;
 }
 
-static int __sh_rtc_periodic(struct sh_rtc *rtc)
-{
-       unsigned int tmp, pending;
-
-       tmp = readb(rtc->regbase + RCR2);
-       pending = tmp & RCR2_PEF;
-       tmp &= ~RCR2_PEF;
-       writeb(tmp, rtc->regbase + RCR2);
-
-       if (!pending)
-               return 0;
-
-       /* Half period enabled than one skipped and the next notified */
-       if ((rtc->periodic_freq & PF_HP) && (rtc->periodic_freq & PF_COUNT))
-               rtc->periodic_freq &= ~PF_COUNT;
-       else {
-               if (rtc->periodic_freq & PF_HP)
-                       rtc->periodic_freq |= PF_COUNT;
-               rtc_update_irq(rtc->rtc_dev, 1, RTC_PF | RTC_IRQF);
-       }
-
-       return pending;
-}
-
 static irqreturn_t sh_rtc_alarm(int irq, void *dev_id)
 {
        struct sh_rtc *rtc = dev_id;
@@ -157,18 +124,6 @@ static irqreturn_t sh_rtc_alarm(int irq, void *dev_id)
        return IRQ_RETVAL(ret);
 }
 
-static irqreturn_t sh_rtc_periodic(int irq, void *dev_id)
-{
-       struct sh_rtc *rtc = dev_id;
-       int ret;
-
-       spin_lock(&rtc->lock);
-       ret = __sh_rtc_periodic(rtc);
-       spin_unlock(&rtc->lock);
-
-       return IRQ_RETVAL(ret);
-}
-
 static irqreturn_t sh_rtc_shared(int irq, void *dev_id)
 {
        struct sh_rtc *rtc = dev_id;
@@ -176,7 +131,6 @@ static irqreturn_t sh_rtc_shared(int irq, void *dev_id)
 
        spin_lock(&rtc->lock);
        ret = __sh_rtc_alarm(rtc);
-       ret |= __sh_rtc_periodic(rtc);
        spin_unlock(&rtc->lock);
 
        return IRQ_RETVAL(ret);
@@ -201,18 +155,6 @@ static inline void sh_rtc_setaie(struct device *dev, unsigned int enable)
        spin_unlock_irq(&rtc->lock);
 }
 
-static int sh_rtc_proc(struct device *dev, struct seq_file *seq)
-{
-       struct sh_rtc *rtc = dev_get_drvdata(dev);
-       unsigned int tmp;
-
-       tmp = readb(rtc->regbase + RCR2);
-       seq_printf(seq, "periodic_IRQ\t: %s\n",
-                  (tmp & RCR2_PESMASK) ? "yes" : "no");
-
-       return 0;
-}
-
 static int sh_rtc_alarm_irq_enable(struct device *dev, unsigned int enabled)
 {
        sh_rtc_setaie(dev, enabled);
@@ -405,7 +347,6 @@ static const struct rtc_class_ops sh_rtc_ops = {
        .set_time       = sh_rtc_set_time,
        .read_alarm     = sh_rtc_read_alarm,
        .set_alarm      = sh_rtc_set_alarm,
-       .proc           = sh_rtc_proc,
        .alarm_irq_enable = sh_rtc_alarm_irq_enable,
 };
 
@@ -512,16 +453,6 @@ static int __init sh_rtc_probe(struct platform_device *pdev)
                        goto err_unmap;
                }
        } else {
-               /* register periodic/carry/alarm irqs */
-               ret = devm_request_irq(&pdev->dev, rtc->periodic_irq,
-                               sh_rtc_periodic, 0, "sh-rtc period", rtc);
-               if (unlikely(ret)) {
-                       dev_err(&pdev->dev,
-                               "request period IRQ failed with %d, IRQ %d\n",
-                               ret, rtc->periodic_irq);
-                       goto err_unmap;
-               }
-
                ret = devm_request_irq(&pdev->dev, rtc->alarm_irq,
                                sh_rtc_alarm, 0, "sh-rtc alarm", rtc);
                if (unlikely(ret)) {