Skip to content

Commit a7e7d96

Browse files
Wolfram Sangalexandrebelloni
authored andcommitted
rtc: sh: remove periodic interrupt handling
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 <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Alexandre Belloni <[email protected]>
1 parent fb06b6b commit a7e7d96

File tree

1 file changed

+0
-69
lines changed

1 file changed

+0
-69
lines changed

drivers/rtc/rtc-sh.c

Lines changed: 0 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -72,21 +72,13 @@
7272
/* ALARM Bits - or with BCD encoded value */
7373
#define AR_ENB 0x80 /* Enable for alarm cmp */
7474

75-
/* Period Bits */
76-
#define PF_HP 0x100 /* Enable Half Period to support 8,32,128Hz */
77-
#define PF_COUNT 0x200 /* Half periodic counter */
78-
#define PF_KOU 0x800 /* Kernel or User periodic request 1=kernel */
79-
#define PF_MASK 0xf00
80-
8175
/* RCR1 Bits */
8276
#define RCR1_CF 0x80 /* Carry Flag */
8377
#define RCR1_CIE 0x10 /* Carry Interrupt Enable */
8478
#define RCR1_AIE 0x08 /* Alarm Interrupt Enable */
8579
#define RCR1_AF 0x01 /* Alarm Flag */
8680

8781
/* RCR2 Bits */
88-
#define RCR2_PEF 0x80 /* PEriodic interrupt Flag */
89-
#define RCR2_PESMASK 0x70 /* Periodic interrupt Set */
9082
#define RCR2_RTCEN 0x08 /* ENable RTC */
9183
#define RCR2_ADJ 0x04 /* ADJustment (30-second) */
9284
#define RCR2_RESET 0x02 /* Reset bit */
@@ -103,7 +95,6 @@ struct sh_rtc {
10395
struct rtc_device *rtc_dev;
10496
spinlock_t lock;
10597
unsigned long capabilities; /* See asm/rtc.h for cap bits */
106-
unsigned short periodic_freq;
10798
};
10899

109100
static int __sh_rtc_alarm(struct sh_rtc *rtc)
@@ -121,30 +112,6 @@ static int __sh_rtc_alarm(struct sh_rtc *rtc)
121112
return pending;
122113
}
123114

124-
static int __sh_rtc_periodic(struct sh_rtc *rtc)
125-
{
126-
unsigned int tmp, pending;
127-
128-
tmp = readb(rtc->regbase + RCR2);
129-
pending = tmp & RCR2_PEF;
130-
tmp &= ~RCR2_PEF;
131-
writeb(tmp, rtc->regbase + RCR2);
132-
133-
if (!pending)
134-
return 0;
135-
136-
/* Half period enabled than one skipped and the next notified */
137-
if ((rtc->periodic_freq & PF_HP) && (rtc->periodic_freq & PF_COUNT))
138-
rtc->periodic_freq &= ~PF_COUNT;
139-
else {
140-
if (rtc->periodic_freq & PF_HP)
141-
rtc->periodic_freq |= PF_COUNT;
142-
rtc_update_irq(rtc->rtc_dev, 1, RTC_PF | RTC_IRQF);
143-
}
144-
145-
return pending;
146-
}
147-
148115
static irqreturn_t sh_rtc_alarm(int irq, void *dev_id)
149116
{
150117
struct sh_rtc *rtc = dev_id;
@@ -157,26 +124,13 @@ static irqreturn_t sh_rtc_alarm(int irq, void *dev_id)
157124
return IRQ_RETVAL(ret);
158125
}
159126

160-
static irqreturn_t sh_rtc_periodic(int irq, void *dev_id)
161-
{
162-
struct sh_rtc *rtc = dev_id;
163-
int ret;
164-
165-
spin_lock(&rtc->lock);
166-
ret = __sh_rtc_periodic(rtc);
167-
spin_unlock(&rtc->lock);
168-
169-
return IRQ_RETVAL(ret);
170-
}
171-
172127
static irqreturn_t sh_rtc_shared(int irq, void *dev_id)
173128
{
174129
struct sh_rtc *rtc = dev_id;
175130
int ret;
176131

177132
spin_lock(&rtc->lock);
178133
ret = __sh_rtc_alarm(rtc);
179-
ret |= __sh_rtc_periodic(rtc);
180134
spin_unlock(&rtc->lock);
181135

182136
return IRQ_RETVAL(ret);
@@ -201,18 +155,6 @@ static inline void sh_rtc_setaie(struct device *dev, unsigned int enable)
201155
spin_unlock_irq(&rtc->lock);
202156
}
203157

204-
static int sh_rtc_proc(struct device *dev, struct seq_file *seq)
205-
{
206-
struct sh_rtc *rtc = dev_get_drvdata(dev);
207-
unsigned int tmp;
208-
209-
tmp = readb(rtc->regbase + RCR2);
210-
seq_printf(seq, "periodic_IRQ\t: %s\n",
211-
(tmp & RCR2_PESMASK) ? "yes" : "no");
212-
213-
return 0;
214-
}
215-
216158
static int sh_rtc_alarm_irq_enable(struct device *dev, unsigned int enabled)
217159
{
218160
sh_rtc_setaie(dev, enabled);
@@ -405,7 +347,6 @@ static const struct rtc_class_ops sh_rtc_ops = {
405347
.set_time = sh_rtc_set_time,
406348
.read_alarm = sh_rtc_read_alarm,
407349
.set_alarm = sh_rtc_set_alarm,
408-
.proc = sh_rtc_proc,
409350
.alarm_irq_enable = sh_rtc_alarm_irq_enable,
410351
};
411352

@@ -512,16 +453,6 @@ static int __init sh_rtc_probe(struct platform_device *pdev)
512453
goto err_unmap;
513454
}
514455
} else {
515-
/* register periodic/carry/alarm irqs */
516-
ret = devm_request_irq(&pdev->dev, rtc->periodic_irq,
517-
sh_rtc_periodic, 0, "sh-rtc period", rtc);
518-
if (unlikely(ret)) {
519-
dev_err(&pdev->dev,
520-
"request period IRQ failed with %d, IRQ %d\n",
521-
ret, rtc->periodic_irq);
522-
goto err_unmap;
523-
}
524-
525456
ret = devm_request_irq(&pdev->dev, rtc->alarm_irq,
526457
sh_rtc_alarm, 0, "sh-rtc alarm", rtc);
527458
if (unlikely(ret)) {

0 commit comments

Comments
 (0)