* [PATCH 0/3] rtc: remove obsolete drivers
@ 2021-01-20 15:41 ` Arnd Bergmann
0 siblings, 0 replies; 19+ messages in thread
From: Arnd Bergmann @ 2021-01-20 15:41 UTC (permalink / raw)
To: linux-arm-kernel, linux-kernel, linux-rtc, Alexandre Belloni
Cc: Alessandro Zummo, Arnd Bergmann
From: Arnd Bergmann <arnd@arndb.de>
A few Arm platforms are getting removed in v5.12, this removes
the corresponding rtc drivers.
Link: https://lore.kernel.org/linux-arm-kernel/20210120124812.2800027-1-arnd@kernel.org/T/
Arnd Bergmann (3):
rtc: remove sirfsoc driver
rtc: remove ste coh901 driver
rtc: remove ste ab3100 driver
.../bindings/rtc/sirf,prima2-sysrtc.txt | 13 -
.../bindings/rtc/stericsson,coh901331.txt | 16 -
drivers/rtc/Kconfig | 27 --
drivers/rtc/Makefile | 3 -
drivers/rtc/rtc-ab3100.c | 254 ----------
drivers/rtc/rtc-coh901331.c | 290 ------------
drivers/rtc/rtc-sirfsoc.c | 446 ------------------
include/linux/rtc/sirfsoc_rtciobrg.h | 21 -
8 files changed, 1070 deletions(-)
delete mode 100644 Documentation/devicetree/bindings/rtc/sirf,prima2-sysrtc.txt
delete mode 100644 Documentation/devicetree/bindings/rtc/stericsson,coh901331.txt
delete mode 100644 drivers/rtc/rtc-ab3100.c
delete mode 100644 drivers/rtc/rtc-coh901331.c
delete mode 100644 drivers/rtc/rtc-sirfsoc.c
delete mode 100644 include/linux/rtc/sirfsoc_rtciobrg.h
--
2.29.2
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 19+ messages in thread
* [PATCH 1/3] rtc: remove sirfsoc driver
2021-01-20 15:41 ` Arnd Bergmann
@ 2021-01-20 15:41 ` Arnd Bergmann
-1 siblings, 0 replies; 19+ messages in thread
From: Arnd Bergmann @ 2021-01-20 15:41 UTC (permalink / raw)
To: linux-arm-kernel, linux-kernel, linux-rtc, Alexandre Belloni
Cc: Alessandro Zummo, Arnd Bergmann, Barry Song
From: Arnd Bergmann <arnd@arndb.de>
The CSR SiRF prima2/atlas platforms are getting removed, so this driver
is no longer needed.
Cc: Barry Song <baohua@kernel.org>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
.../bindings/rtc/sirf,prima2-sysrtc.txt | 13 -
drivers/rtc/Kconfig | 7 -
drivers/rtc/Makefile | 1 -
drivers/rtc/rtc-sirfsoc.c | 446 ------------------
include/linux/rtc/sirfsoc_rtciobrg.h | 21 -
5 files changed, 488 deletions(-)
delete mode 100644 Documentation/devicetree/bindings/rtc/sirf,prima2-sysrtc.txt
delete mode 100644 drivers/rtc/rtc-sirfsoc.c
delete mode 100644 include/linux/rtc/sirfsoc_rtciobrg.h
diff --git a/Documentation/devicetree/bindings/rtc/sirf,prima2-sysrtc.txt b/Documentation/devicetree/bindings/rtc/sirf,prima2-sysrtc.txt
deleted file mode 100644
index 58885b55da21..000000000000
--- a/Documentation/devicetree/bindings/rtc/sirf,prima2-sysrtc.txt
+++ /dev/null
@@ -1,13 +0,0 @@
-SiRFSoC Real Time Clock
-
-Required properties:
-- compatible: must be "sirf,prima2-sysrtc"
-- reg: address range of rtc register set.
-- interrupts: rtc alarm interrupts.
-
-Example:
- rtc@2000 {
- compatible = "sirf,prima2-sysrtc";
- reg = <0x2000 0x1000>;
- interrupts = <52 53 54>;
- };
diff --git a/drivers/rtc/Kconfig b/drivers/rtc/Kconfig
index 6123f9f4fbc9..8fb9aa55ace1 100644
--- a/drivers/rtc/Kconfig
+++ b/drivers/rtc/Kconfig
@@ -1799,13 +1799,6 @@ config RTC_DRV_IMX_SC
If you say yes here you get support for the NXP i.MX System
Controller RTC module.
-config RTC_DRV_SIRFSOC
- tristate "SiRFSOC RTC"
- depends on ARCH_SIRF
- help
- Say "yes" here to support the real time clock on SiRF SOC chips.
- This driver can also be built as a module called rtc-sirfsoc.
-
config RTC_DRV_ST_LPC
tristate "STMicroelectronics LPC RTC"
depends on ARCH_STI
diff --git a/drivers/rtc/Makefile b/drivers/rtc/Makefile
index bb8f319b09fb..1f00896db507 100644
--- a/drivers/rtc/Makefile
+++ b/drivers/rtc/Makefile
@@ -154,7 +154,6 @@ obj-$(CONFIG_RTC_DRV_SA1100) += rtc-sa1100.o
obj-$(CONFIG_RTC_DRV_SC27XX) += rtc-sc27xx.o
obj-$(CONFIG_RTC_DRV_SD3078) += rtc-sd3078.o
obj-$(CONFIG_RTC_DRV_SH) += rtc-sh.o
-obj-$(CONFIG_RTC_DRV_SIRFSOC) += rtc-sirfsoc.o
obj-$(CONFIG_RTC_DRV_SNVS) += rtc-snvs.o
obj-$(CONFIG_RTC_DRV_SPEAR) += rtc-spear.o
obj-$(CONFIG_RTC_DRV_STARFIRE) += rtc-starfire.o
diff --git a/drivers/rtc/rtc-sirfsoc.c b/drivers/rtc/rtc-sirfsoc.c
deleted file mode 100644
index 03a6cca23201..000000000000
--- a/drivers/rtc/rtc-sirfsoc.c
+++ /dev/null
@@ -1,446 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * SiRFSoC Real Time Clock interface for Linux
- *
- * Copyright (c) 2013 Cambridge Silicon Radio Limited, a CSR plc group company.
- */
-
-#include <linux/module.h>
-#include <linux/err.h>
-#include <linux/rtc.h>
-#include <linux/platform_device.h>
-#include <linux/slab.h>
-#include <linux/io.h>
-#include <linux/of.h>
-#include <linux/regmap.h>
-#include <linux/rtc/sirfsoc_rtciobrg.h>
-
-
-#define RTC_CN 0x00
-#define RTC_ALARM0 0x04
-#define RTC_ALARM1 0x18
-#define RTC_STATUS 0x08
-#define RTC_SW_VALUE 0x40
-#define SIRFSOC_RTC_AL1E (1<<6)
-#define SIRFSOC_RTC_AL1 (1<<4)
-#define SIRFSOC_RTC_HZE (1<<3)
-#define SIRFSOC_RTC_AL0E (1<<2)
-#define SIRFSOC_RTC_HZ (1<<1)
-#define SIRFSOC_RTC_AL0 (1<<0)
-#define RTC_DIV 0x0c
-#define RTC_DEEP_CTRL 0x14
-#define RTC_CLOCK_SWITCH 0x1c
-#define SIRFSOC_RTC_CLK 0x03 /* others are reserved */
-
-/* Refer to RTC DIV switch */
-#define RTC_HZ 16
-
-/* This macro is also defined in arch/arm/plat-sirfsoc/cpu.c */
-#define RTC_SHIFT 4
-
-#define INTR_SYSRTC_CN 0x48
-
-struct sirfsoc_rtc_drv {
- struct rtc_device *rtc;
- u32 rtc_base;
- u32 irq;
- unsigned irq_wake;
- /* Overflow for every 8 years extra time */
- u32 overflow_rtc;
- spinlock_t lock;
- struct regmap *regmap;
-#ifdef CONFIG_PM
- u32 saved_counter;
- u32 saved_overflow_rtc;
-#endif
-};
-
-static u32 sirfsoc_rtc_readl(struct sirfsoc_rtc_drv *rtcdrv, u32 offset)
-{
- u32 val;
-
- regmap_read(rtcdrv->regmap, rtcdrv->rtc_base + offset, &val);
- return val;
-}
-
-static void sirfsoc_rtc_writel(struct sirfsoc_rtc_drv *rtcdrv,
- u32 offset, u32 val)
-{
- regmap_write(rtcdrv->regmap, rtcdrv->rtc_base + offset, val);
-}
-
-static int sirfsoc_rtc_read_alarm(struct device *dev,
- struct rtc_wkalrm *alrm)
-{
- unsigned long rtc_alarm, rtc_count;
- struct sirfsoc_rtc_drv *rtcdrv;
-
- rtcdrv = dev_get_drvdata(dev);
-
- spin_lock_irq(&rtcdrv->lock);
-
- rtc_count = sirfsoc_rtc_readl(rtcdrv, RTC_CN);
-
- rtc_alarm = sirfsoc_rtc_readl(rtcdrv, RTC_ALARM0);
- memset(alrm, 0, sizeof(struct rtc_wkalrm));
-
- /*
- * assume alarm interval not beyond one round counter overflow_rtc:
- * 0->0xffffffff
- */
- /* if alarm is in next overflow cycle */
- if (rtc_count > rtc_alarm)
- rtc_time64_to_tm((rtcdrv->overflow_rtc + 1)
- << (BITS_PER_LONG - RTC_SHIFT)
- | rtc_alarm >> RTC_SHIFT, &alrm->time);
- else
- rtc_time64_to_tm(rtcdrv->overflow_rtc
- << (BITS_PER_LONG - RTC_SHIFT)
- | rtc_alarm >> RTC_SHIFT, &alrm->time);
- if (sirfsoc_rtc_readl(rtcdrv, RTC_STATUS) & SIRFSOC_RTC_AL0E)
- alrm->enabled = 1;
-
- spin_unlock_irq(&rtcdrv->lock);
-
- return 0;
-}
-
-static int sirfsoc_rtc_set_alarm(struct device *dev,
- struct rtc_wkalrm *alrm)
-{
- unsigned long rtc_status_reg, rtc_alarm;
- struct sirfsoc_rtc_drv *rtcdrv;
- rtcdrv = dev_get_drvdata(dev);
-
- if (alrm->enabled) {
- rtc_alarm = rtc_tm_to_time64(&alrm->time);
-
- spin_lock_irq(&rtcdrv->lock);
-
- rtc_status_reg = sirfsoc_rtc_readl(rtcdrv, RTC_STATUS);
- if (rtc_status_reg & SIRFSOC_RTC_AL0E) {
- /*
- * An ongoing alarm in progress - ingore it and not
- * to return EBUSY
- */
- dev_info(dev, "An old alarm was set, will be replaced by a new one\n");
- }
-
- sirfsoc_rtc_writel(rtcdrv, RTC_ALARM0, rtc_alarm << RTC_SHIFT);
- rtc_status_reg &= ~0x07; /* mask out the lower status bits */
- /*
- * This bit RTC_AL sets it as a wake-up source for Sleep Mode
- * Writing 1 into this bit will clear it
- */
- rtc_status_reg |= SIRFSOC_RTC_AL0;
- /* enable the RTC alarm interrupt */
- rtc_status_reg |= SIRFSOC_RTC_AL0E;
- sirfsoc_rtc_writel(rtcdrv, RTC_STATUS, rtc_status_reg);
-
- spin_unlock_irq(&rtcdrv->lock);
- } else {
- /*
- * if this function was called with enabled=0
- * then it could mean that the application is
- * trying to cancel an ongoing alarm
- */
- spin_lock_irq(&rtcdrv->lock);
-
- rtc_status_reg = sirfsoc_rtc_readl(rtcdrv, RTC_STATUS);
- if (rtc_status_reg & SIRFSOC_RTC_AL0E) {
- /* clear the RTC status register's alarm bit */
- rtc_status_reg &= ~0x07;
- /* write 1 into SIRFSOC_RTC_AL0 to force a clear */
- rtc_status_reg |= (SIRFSOC_RTC_AL0);
- /* Clear the Alarm enable bit */
- rtc_status_reg &= ~(SIRFSOC_RTC_AL0E);
-
- sirfsoc_rtc_writel(rtcdrv, RTC_STATUS,
- rtc_status_reg);
- }
-
- spin_unlock_irq(&rtcdrv->lock);
- }
-
- return 0;
-}
-
-static int sirfsoc_rtc_read_time(struct device *dev,
- struct rtc_time *tm)
-{
- unsigned long tmp_rtc = 0;
- struct sirfsoc_rtc_drv *rtcdrv;
- rtcdrv = dev_get_drvdata(dev);
- /*
- * This patch is taken from WinCE - Need to validate this for
- * correctness. To work around sirfsoc RTC counter double sync logic
- * fail, read several times to make sure get stable value.
- */
- do {
- tmp_rtc = sirfsoc_rtc_readl(rtcdrv, RTC_CN);
- cpu_relax();
- } while (tmp_rtc != sirfsoc_rtc_readl(rtcdrv, RTC_CN));
-
- rtc_time64_to_tm(rtcdrv->overflow_rtc << (BITS_PER_LONG - RTC_SHIFT)
- | tmp_rtc >> RTC_SHIFT, tm);
- return 0;
-}
-
-static int sirfsoc_rtc_set_time(struct device *dev,
- struct rtc_time *tm)
-{
- unsigned long rtc_time;
- struct sirfsoc_rtc_drv *rtcdrv;
- rtcdrv = dev_get_drvdata(dev);
-
- rtc_time = rtc_tm_to_time64(tm);
-
- rtcdrv->overflow_rtc = rtc_time >> (BITS_PER_LONG - RTC_SHIFT);
-
- sirfsoc_rtc_writel(rtcdrv, RTC_SW_VALUE, rtcdrv->overflow_rtc);
- sirfsoc_rtc_writel(rtcdrv, RTC_CN, rtc_time << RTC_SHIFT);
-
- return 0;
-}
-
-static int sirfsoc_rtc_alarm_irq_enable(struct device *dev,
- unsigned int enabled)
-{
- unsigned long rtc_status_reg = 0x0;
- struct sirfsoc_rtc_drv *rtcdrv;
-
- rtcdrv = dev_get_drvdata(dev);
-
- spin_lock_irq(&rtcdrv->lock);
-
- rtc_status_reg = sirfsoc_rtc_readl(rtcdrv, RTC_STATUS);
- if (enabled)
- rtc_status_reg |= SIRFSOC_RTC_AL0E;
- else
- rtc_status_reg &= ~SIRFSOC_RTC_AL0E;
-
- sirfsoc_rtc_writel(rtcdrv, RTC_STATUS, rtc_status_reg);
-
- spin_unlock_irq(&rtcdrv->lock);
-
- return 0;
-
-}
-
-static const struct rtc_class_ops sirfsoc_rtc_ops = {
- .read_time = sirfsoc_rtc_read_time,
- .set_time = sirfsoc_rtc_set_time,
- .read_alarm = sirfsoc_rtc_read_alarm,
- .set_alarm = sirfsoc_rtc_set_alarm,
- .alarm_irq_enable = sirfsoc_rtc_alarm_irq_enable
-};
-
-static irqreturn_t sirfsoc_rtc_irq_handler(int irq, void *pdata)
-{
- struct sirfsoc_rtc_drv *rtcdrv = pdata;
- unsigned long rtc_status_reg = 0x0;
- unsigned long events = 0x0;
-
- spin_lock(&rtcdrv->lock);
-
- rtc_status_reg = sirfsoc_rtc_readl(rtcdrv, RTC_STATUS);
- /* this bit will be set ONLY if an alarm was active
- * and it expired NOW
- * So this is being used as an ASSERT
- */
- if (rtc_status_reg & SIRFSOC_RTC_AL0) {
- /*
- * clear the RTC status register's alarm bit
- * mask out the lower status bits
- */
- rtc_status_reg &= ~0x07;
- /* write 1 into SIRFSOC_RTC_AL0 to ACK the alarm interrupt */
- rtc_status_reg |= (SIRFSOC_RTC_AL0);
- /* Clear the Alarm enable bit */
- rtc_status_reg &= ~(SIRFSOC_RTC_AL0E);
- }
-
- sirfsoc_rtc_writel(rtcdrv, RTC_STATUS, rtc_status_reg);
-
- spin_unlock(&rtcdrv->lock);
-
- /* this should wake up any apps polling/waiting on the read
- * after setting the alarm
- */
- events |= RTC_IRQF | RTC_AF;
- rtc_update_irq(rtcdrv->rtc, 1, events);
-
- return IRQ_HANDLED;
-}
-
-static const struct of_device_id sirfsoc_rtc_of_match[] = {
- { .compatible = "sirf,prima2-sysrtc"},
- {},
-};
-
-static const struct regmap_config sysrtc_regmap_config = {
- .reg_bits = 32,
- .val_bits = 32,
- .fast_io = true,
-};
-
-MODULE_DEVICE_TABLE(of, sirfsoc_rtc_of_match);
-
-static int sirfsoc_rtc_probe(struct platform_device *pdev)
-{
- int err;
- unsigned long rtc_div;
- struct sirfsoc_rtc_drv *rtcdrv;
- struct device_node *np = pdev->dev.of_node;
-
- rtcdrv = devm_kzalloc(&pdev->dev,
- sizeof(struct sirfsoc_rtc_drv), GFP_KERNEL);
- if (rtcdrv == NULL)
- return -ENOMEM;
-
- spin_lock_init(&rtcdrv->lock);
-
- err = of_property_read_u32(np, "reg", &rtcdrv->rtc_base);
- if (err) {
- dev_err(&pdev->dev, "unable to find base address of rtc node in dtb\n");
- return err;
- }
-
- platform_set_drvdata(pdev, rtcdrv);
-
- /* Register rtc alarm as a wakeup source */
- device_init_wakeup(&pdev->dev, 1);
-
- rtcdrv->regmap = devm_regmap_init_iobg(&pdev->dev,
- &sysrtc_regmap_config);
- if (IS_ERR(rtcdrv->regmap)) {
- err = PTR_ERR(rtcdrv->regmap);
- dev_err(&pdev->dev, "Failed to allocate register map: %d\n",
- err);
- return err;
- }
-
- /*
- * Set SYS_RTC counter in RTC_HZ HZ Units
- * We are using 32K RTC crystal (32768 / RTC_HZ / 2) -1
- * If 16HZ, therefore RTC_DIV = 1023;
- */
- rtc_div = ((32768 / RTC_HZ) / 2) - 1;
- sirfsoc_rtc_writel(rtcdrv, RTC_DIV, rtc_div);
-
- /* 0x3 -> RTC_CLK */
- sirfsoc_rtc_writel(rtcdrv, RTC_CLOCK_SWITCH, SIRFSOC_RTC_CLK);
-
- /* reset SYS RTC ALARM0 */
- sirfsoc_rtc_writel(rtcdrv, RTC_ALARM0, 0x0);
-
- /* reset SYS RTC ALARM1 */
- sirfsoc_rtc_writel(rtcdrv, RTC_ALARM1, 0x0);
-
- /* Restore RTC Overflow From Register After Command Reboot */
- rtcdrv->overflow_rtc =
- sirfsoc_rtc_readl(rtcdrv, RTC_SW_VALUE);
-
- rtcdrv->rtc = devm_rtc_allocate_device(&pdev->dev);
- if (IS_ERR(rtcdrv->rtc))
- return PTR_ERR(rtcdrv->rtc);
-
- rtcdrv->rtc->ops = &sirfsoc_rtc_ops;
- rtcdrv->rtc->range_max = (1ULL << 60) - 1;
-
- rtcdrv->irq = platform_get_irq(pdev, 0);
- err = devm_request_irq(&pdev->dev, rtcdrv->irq, sirfsoc_rtc_irq_handler,
- IRQF_SHARED, pdev->name, rtcdrv);
- if (err) {
- dev_err(&pdev->dev, "Unable to register for the SiRF SOC RTC IRQ\n");
- return err;
- }
-
- return devm_rtc_register_device(rtcdrv->rtc);
-}
-
-#ifdef CONFIG_PM_SLEEP
-static int sirfsoc_rtc_suspend(struct device *dev)
-{
- struct sirfsoc_rtc_drv *rtcdrv = dev_get_drvdata(dev);
- rtcdrv->overflow_rtc =
- sirfsoc_rtc_readl(rtcdrv, RTC_SW_VALUE);
-
- rtcdrv->saved_counter =
- sirfsoc_rtc_readl(rtcdrv, RTC_CN);
- rtcdrv->saved_overflow_rtc = rtcdrv->overflow_rtc;
- if (device_may_wakeup(dev) && !enable_irq_wake(rtcdrv->irq))
- rtcdrv->irq_wake = 1;
-
- return 0;
-}
-
-static int sirfsoc_rtc_resume(struct device *dev)
-{
- u32 tmp;
- struct sirfsoc_rtc_drv *rtcdrv = dev_get_drvdata(dev);
-
- /*
- * if resume from snapshot and the rtc power is lost,
- * restroe the rtc settings
- */
- if (SIRFSOC_RTC_CLK != sirfsoc_rtc_readl(rtcdrv, RTC_CLOCK_SWITCH)) {
- u32 rtc_div;
- /* 0x3 -> RTC_CLK */
- sirfsoc_rtc_writel(rtcdrv, RTC_CLOCK_SWITCH, SIRFSOC_RTC_CLK);
- /*
- * Set SYS_RTC counter in RTC_HZ HZ Units
- * We are using 32K RTC crystal (32768 / RTC_HZ / 2) -1
- * If 16HZ, therefore RTC_DIV = 1023;
- */
- rtc_div = ((32768 / RTC_HZ) / 2) - 1;
-
- sirfsoc_rtc_writel(rtcdrv, RTC_DIV, rtc_div);
-
- /* reset SYS RTC ALARM0 */
- sirfsoc_rtc_writel(rtcdrv, RTC_ALARM0, 0x0);
-
- /* reset SYS RTC ALARM1 */
- sirfsoc_rtc_writel(rtcdrv, RTC_ALARM1, 0x0);
- }
- rtcdrv->overflow_rtc = rtcdrv->saved_overflow_rtc;
-
- /*
- * if current counter is small than previous,
- * it means overflow in sleep
- */
- tmp = sirfsoc_rtc_readl(rtcdrv, RTC_CN);
- if (tmp <= rtcdrv->saved_counter)
- rtcdrv->overflow_rtc++;
- /*
- *PWRC Value Be Changed When Suspend, Restore Overflow
- * In Memory To Register
- */
- sirfsoc_rtc_writel(rtcdrv, RTC_SW_VALUE, rtcdrv->overflow_rtc);
-
- if (device_may_wakeup(dev) && rtcdrv->irq_wake) {
- disable_irq_wake(rtcdrv->irq);
- rtcdrv->irq_wake = 0;
- }
-
- return 0;
-}
-#endif
-
-static SIMPLE_DEV_PM_OPS(sirfsoc_rtc_pm_ops,
- sirfsoc_rtc_suspend, sirfsoc_rtc_resume);
-
-static struct platform_driver sirfsoc_rtc_driver = {
- .driver = {
- .name = "sirfsoc-rtc",
- .pm = &sirfsoc_rtc_pm_ops,
- .of_match_table = sirfsoc_rtc_of_match,
- },
- .probe = sirfsoc_rtc_probe,
-};
-module_platform_driver(sirfsoc_rtc_driver);
-
-MODULE_DESCRIPTION("SiRF SoC rtc driver");
-MODULE_AUTHOR("Xianglong Du <Xianglong.Du@csr.com>");
-MODULE_LICENSE("GPL v2");
-MODULE_ALIAS("platform:sirfsoc-rtc");
diff --git a/include/linux/rtc/sirfsoc_rtciobrg.h b/include/linux/rtc/sirfsoc_rtciobrg.h
deleted file mode 100644
index b31f2856733d..000000000000
--- a/include/linux/rtc/sirfsoc_rtciobrg.h
+++ /dev/null
@@ -1,21 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0-or-later */
-/*
- * RTC I/O Bridge interfaces for CSR SiRFprimaII
- * ARM access the registers of SYSRTC, GPSRTC and PWRC through this module
- *
- * Copyright (c) 2011 Cambridge Silicon Radio Limited, a CSR plc group company.
- */
-#ifndef _SIRFSOC_RTC_IOBRG_H_
-#define _SIRFSOC_RTC_IOBRG_H_
-
-struct regmap_config;
-
-extern void sirfsoc_rtc_iobrg_besyncing(void);
-
-extern u32 sirfsoc_rtc_iobrg_readl(u32 addr);
-
-extern void sirfsoc_rtc_iobrg_writel(u32 val, u32 addr);
-struct regmap *devm_regmap_init_iobg(struct device *dev,
- const struct regmap_config *config);
-
-#endif
--
2.29.2
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [PATCH 1/3] rtc: remove sirfsoc driver
@ 2021-01-20 15:41 ` Arnd Bergmann
0 siblings, 0 replies; 19+ messages in thread
From: Arnd Bergmann @ 2021-01-20 15:41 UTC (permalink / raw)
To: linux-arm-kernel, linux-kernel, linux-rtc, Alexandre Belloni
Cc: Alessandro Zummo, Barry Song, Arnd Bergmann
From: Arnd Bergmann <arnd@arndb.de>
The CSR SiRF prima2/atlas platforms are getting removed, so this driver
is no longer needed.
Cc: Barry Song <baohua@kernel.org>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
.../bindings/rtc/sirf,prima2-sysrtc.txt | 13 -
drivers/rtc/Kconfig | 7 -
drivers/rtc/Makefile | 1 -
drivers/rtc/rtc-sirfsoc.c | 446 ------------------
include/linux/rtc/sirfsoc_rtciobrg.h | 21 -
5 files changed, 488 deletions(-)
delete mode 100644 Documentation/devicetree/bindings/rtc/sirf,prima2-sysrtc.txt
delete mode 100644 drivers/rtc/rtc-sirfsoc.c
delete mode 100644 include/linux/rtc/sirfsoc_rtciobrg.h
diff --git a/Documentation/devicetree/bindings/rtc/sirf,prima2-sysrtc.txt b/Documentation/devicetree/bindings/rtc/sirf,prima2-sysrtc.txt
deleted file mode 100644
index 58885b55da21..000000000000
--- a/Documentation/devicetree/bindings/rtc/sirf,prima2-sysrtc.txt
+++ /dev/null
@@ -1,13 +0,0 @@
-SiRFSoC Real Time Clock
-
-Required properties:
-- compatible: must be "sirf,prima2-sysrtc"
-- reg: address range of rtc register set.
-- interrupts: rtc alarm interrupts.
-
-Example:
- rtc@2000 {
- compatible = "sirf,prima2-sysrtc";
- reg = <0x2000 0x1000>;
- interrupts = <52 53 54>;
- };
diff --git a/drivers/rtc/Kconfig b/drivers/rtc/Kconfig
index 6123f9f4fbc9..8fb9aa55ace1 100644
--- a/drivers/rtc/Kconfig
+++ b/drivers/rtc/Kconfig
@@ -1799,13 +1799,6 @@ config RTC_DRV_IMX_SC
If you say yes here you get support for the NXP i.MX System
Controller RTC module.
-config RTC_DRV_SIRFSOC
- tristate "SiRFSOC RTC"
- depends on ARCH_SIRF
- help
- Say "yes" here to support the real time clock on SiRF SOC chips.
- This driver can also be built as a module called rtc-sirfsoc.
-
config RTC_DRV_ST_LPC
tristate "STMicroelectronics LPC RTC"
depends on ARCH_STI
diff --git a/drivers/rtc/Makefile b/drivers/rtc/Makefile
index bb8f319b09fb..1f00896db507 100644
--- a/drivers/rtc/Makefile
+++ b/drivers/rtc/Makefile
@@ -154,7 +154,6 @@ obj-$(CONFIG_RTC_DRV_SA1100) += rtc-sa1100.o
obj-$(CONFIG_RTC_DRV_SC27XX) += rtc-sc27xx.o
obj-$(CONFIG_RTC_DRV_SD3078) += rtc-sd3078.o
obj-$(CONFIG_RTC_DRV_SH) += rtc-sh.o
-obj-$(CONFIG_RTC_DRV_SIRFSOC) += rtc-sirfsoc.o
obj-$(CONFIG_RTC_DRV_SNVS) += rtc-snvs.o
obj-$(CONFIG_RTC_DRV_SPEAR) += rtc-spear.o
obj-$(CONFIG_RTC_DRV_STARFIRE) += rtc-starfire.o
diff --git a/drivers/rtc/rtc-sirfsoc.c b/drivers/rtc/rtc-sirfsoc.c
deleted file mode 100644
index 03a6cca23201..000000000000
--- a/drivers/rtc/rtc-sirfsoc.c
+++ /dev/null
@@ -1,446 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * SiRFSoC Real Time Clock interface for Linux
- *
- * Copyright (c) 2013 Cambridge Silicon Radio Limited, a CSR plc group company.
- */
-
-#include <linux/module.h>
-#include <linux/err.h>
-#include <linux/rtc.h>
-#include <linux/platform_device.h>
-#include <linux/slab.h>
-#include <linux/io.h>
-#include <linux/of.h>
-#include <linux/regmap.h>
-#include <linux/rtc/sirfsoc_rtciobrg.h>
-
-
-#define RTC_CN 0x00
-#define RTC_ALARM0 0x04
-#define RTC_ALARM1 0x18
-#define RTC_STATUS 0x08
-#define RTC_SW_VALUE 0x40
-#define SIRFSOC_RTC_AL1E (1<<6)
-#define SIRFSOC_RTC_AL1 (1<<4)
-#define SIRFSOC_RTC_HZE (1<<3)
-#define SIRFSOC_RTC_AL0E (1<<2)
-#define SIRFSOC_RTC_HZ (1<<1)
-#define SIRFSOC_RTC_AL0 (1<<0)
-#define RTC_DIV 0x0c
-#define RTC_DEEP_CTRL 0x14
-#define RTC_CLOCK_SWITCH 0x1c
-#define SIRFSOC_RTC_CLK 0x03 /* others are reserved */
-
-/* Refer to RTC DIV switch */
-#define RTC_HZ 16
-
-/* This macro is also defined in arch/arm/plat-sirfsoc/cpu.c */
-#define RTC_SHIFT 4
-
-#define INTR_SYSRTC_CN 0x48
-
-struct sirfsoc_rtc_drv {
- struct rtc_device *rtc;
- u32 rtc_base;
- u32 irq;
- unsigned irq_wake;
- /* Overflow for every 8 years extra time */
- u32 overflow_rtc;
- spinlock_t lock;
- struct regmap *regmap;
-#ifdef CONFIG_PM
- u32 saved_counter;
- u32 saved_overflow_rtc;
-#endif
-};
-
-static u32 sirfsoc_rtc_readl(struct sirfsoc_rtc_drv *rtcdrv, u32 offset)
-{
- u32 val;
-
- regmap_read(rtcdrv->regmap, rtcdrv->rtc_base + offset, &val);
- return val;
-}
-
-static void sirfsoc_rtc_writel(struct sirfsoc_rtc_drv *rtcdrv,
- u32 offset, u32 val)
-{
- regmap_write(rtcdrv->regmap, rtcdrv->rtc_base + offset, val);
-}
-
-static int sirfsoc_rtc_read_alarm(struct device *dev,
- struct rtc_wkalrm *alrm)
-{
- unsigned long rtc_alarm, rtc_count;
- struct sirfsoc_rtc_drv *rtcdrv;
-
- rtcdrv = dev_get_drvdata(dev);
-
- spin_lock_irq(&rtcdrv->lock);
-
- rtc_count = sirfsoc_rtc_readl(rtcdrv, RTC_CN);
-
- rtc_alarm = sirfsoc_rtc_readl(rtcdrv, RTC_ALARM0);
- memset(alrm, 0, sizeof(struct rtc_wkalrm));
-
- /*
- * assume alarm interval not beyond one round counter overflow_rtc:
- * 0->0xffffffff
- */
- /* if alarm is in next overflow cycle */
- if (rtc_count > rtc_alarm)
- rtc_time64_to_tm((rtcdrv->overflow_rtc + 1)
- << (BITS_PER_LONG - RTC_SHIFT)
- | rtc_alarm >> RTC_SHIFT, &alrm->time);
- else
- rtc_time64_to_tm(rtcdrv->overflow_rtc
- << (BITS_PER_LONG - RTC_SHIFT)
- | rtc_alarm >> RTC_SHIFT, &alrm->time);
- if (sirfsoc_rtc_readl(rtcdrv, RTC_STATUS) & SIRFSOC_RTC_AL0E)
- alrm->enabled = 1;
-
- spin_unlock_irq(&rtcdrv->lock);
-
- return 0;
-}
-
-static int sirfsoc_rtc_set_alarm(struct device *dev,
- struct rtc_wkalrm *alrm)
-{
- unsigned long rtc_status_reg, rtc_alarm;
- struct sirfsoc_rtc_drv *rtcdrv;
- rtcdrv = dev_get_drvdata(dev);
-
- if (alrm->enabled) {
- rtc_alarm = rtc_tm_to_time64(&alrm->time);
-
- spin_lock_irq(&rtcdrv->lock);
-
- rtc_status_reg = sirfsoc_rtc_readl(rtcdrv, RTC_STATUS);
- if (rtc_status_reg & SIRFSOC_RTC_AL0E) {
- /*
- * An ongoing alarm in progress - ingore it and not
- * to return EBUSY
- */
- dev_info(dev, "An old alarm was set, will be replaced by a new one\n");
- }
-
- sirfsoc_rtc_writel(rtcdrv, RTC_ALARM0, rtc_alarm << RTC_SHIFT);
- rtc_status_reg &= ~0x07; /* mask out the lower status bits */
- /*
- * This bit RTC_AL sets it as a wake-up source for Sleep Mode
- * Writing 1 into this bit will clear it
- */
- rtc_status_reg |= SIRFSOC_RTC_AL0;
- /* enable the RTC alarm interrupt */
- rtc_status_reg |= SIRFSOC_RTC_AL0E;
- sirfsoc_rtc_writel(rtcdrv, RTC_STATUS, rtc_status_reg);
-
- spin_unlock_irq(&rtcdrv->lock);
- } else {
- /*
- * if this function was called with enabled=0
- * then it could mean that the application is
- * trying to cancel an ongoing alarm
- */
- spin_lock_irq(&rtcdrv->lock);
-
- rtc_status_reg = sirfsoc_rtc_readl(rtcdrv, RTC_STATUS);
- if (rtc_status_reg & SIRFSOC_RTC_AL0E) {
- /* clear the RTC status register's alarm bit */
- rtc_status_reg &= ~0x07;
- /* write 1 into SIRFSOC_RTC_AL0 to force a clear */
- rtc_status_reg |= (SIRFSOC_RTC_AL0);
- /* Clear the Alarm enable bit */
- rtc_status_reg &= ~(SIRFSOC_RTC_AL0E);
-
- sirfsoc_rtc_writel(rtcdrv, RTC_STATUS,
- rtc_status_reg);
- }
-
- spin_unlock_irq(&rtcdrv->lock);
- }
-
- return 0;
-}
-
-static int sirfsoc_rtc_read_time(struct device *dev,
- struct rtc_time *tm)
-{
- unsigned long tmp_rtc = 0;
- struct sirfsoc_rtc_drv *rtcdrv;
- rtcdrv = dev_get_drvdata(dev);
- /*
- * This patch is taken from WinCE - Need to validate this for
- * correctness. To work around sirfsoc RTC counter double sync logic
- * fail, read several times to make sure get stable value.
- */
- do {
- tmp_rtc = sirfsoc_rtc_readl(rtcdrv, RTC_CN);
- cpu_relax();
- } while (tmp_rtc != sirfsoc_rtc_readl(rtcdrv, RTC_CN));
-
- rtc_time64_to_tm(rtcdrv->overflow_rtc << (BITS_PER_LONG - RTC_SHIFT)
- | tmp_rtc >> RTC_SHIFT, tm);
- return 0;
-}
-
-static int sirfsoc_rtc_set_time(struct device *dev,
- struct rtc_time *tm)
-{
- unsigned long rtc_time;
- struct sirfsoc_rtc_drv *rtcdrv;
- rtcdrv = dev_get_drvdata(dev);
-
- rtc_time = rtc_tm_to_time64(tm);
-
- rtcdrv->overflow_rtc = rtc_time >> (BITS_PER_LONG - RTC_SHIFT);
-
- sirfsoc_rtc_writel(rtcdrv, RTC_SW_VALUE, rtcdrv->overflow_rtc);
- sirfsoc_rtc_writel(rtcdrv, RTC_CN, rtc_time << RTC_SHIFT);
-
- return 0;
-}
-
-static int sirfsoc_rtc_alarm_irq_enable(struct device *dev,
- unsigned int enabled)
-{
- unsigned long rtc_status_reg = 0x0;
- struct sirfsoc_rtc_drv *rtcdrv;
-
- rtcdrv = dev_get_drvdata(dev);
-
- spin_lock_irq(&rtcdrv->lock);
-
- rtc_status_reg = sirfsoc_rtc_readl(rtcdrv, RTC_STATUS);
- if (enabled)
- rtc_status_reg |= SIRFSOC_RTC_AL0E;
- else
- rtc_status_reg &= ~SIRFSOC_RTC_AL0E;
-
- sirfsoc_rtc_writel(rtcdrv, RTC_STATUS, rtc_status_reg);
-
- spin_unlock_irq(&rtcdrv->lock);
-
- return 0;
-
-}
-
-static const struct rtc_class_ops sirfsoc_rtc_ops = {
- .read_time = sirfsoc_rtc_read_time,
- .set_time = sirfsoc_rtc_set_time,
- .read_alarm = sirfsoc_rtc_read_alarm,
- .set_alarm = sirfsoc_rtc_set_alarm,
- .alarm_irq_enable = sirfsoc_rtc_alarm_irq_enable
-};
-
-static irqreturn_t sirfsoc_rtc_irq_handler(int irq, void *pdata)
-{
- struct sirfsoc_rtc_drv *rtcdrv = pdata;
- unsigned long rtc_status_reg = 0x0;
- unsigned long events = 0x0;
-
- spin_lock(&rtcdrv->lock);
-
- rtc_status_reg = sirfsoc_rtc_readl(rtcdrv, RTC_STATUS);
- /* this bit will be set ONLY if an alarm was active
- * and it expired NOW
- * So this is being used as an ASSERT
- */
- if (rtc_status_reg & SIRFSOC_RTC_AL0) {
- /*
- * clear the RTC status register's alarm bit
- * mask out the lower status bits
- */
- rtc_status_reg &= ~0x07;
- /* write 1 into SIRFSOC_RTC_AL0 to ACK the alarm interrupt */
- rtc_status_reg |= (SIRFSOC_RTC_AL0);
- /* Clear the Alarm enable bit */
- rtc_status_reg &= ~(SIRFSOC_RTC_AL0E);
- }
-
- sirfsoc_rtc_writel(rtcdrv, RTC_STATUS, rtc_status_reg);
-
- spin_unlock(&rtcdrv->lock);
-
- /* this should wake up any apps polling/waiting on the read
- * after setting the alarm
- */
- events |= RTC_IRQF | RTC_AF;
- rtc_update_irq(rtcdrv->rtc, 1, events);
-
- return IRQ_HANDLED;
-}
-
-static const struct of_device_id sirfsoc_rtc_of_match[] = {
- { .compatible = "sirf,prima2-sysrtc"},
- {},
-};
-
-static const struct regmap_config sysrtc_regmap_config = {
- .reg_bits = 32,
- .val_bits = 32,
- .fast_io = true,
-};
-
-MODULE_DEVICE_TABLE(of, sirfsoc_rtc_of_match);
-
-static int sirfsoc_rtc_probe(struct platform_device *pdev)
-{
- int err;
- unsigned long rtc_div;
- struct sirfsoc_rtc_drv *rtcdrv;
- struct device_node *np = pdev->dev.of_node;
-
- rtcdrv = devm_kzalloc(&pdev->dev,
- sizeof(struct sirfsoc_rtc_drv), GFP_KERNEL);
- if (rtcdrv == NULL)
- return -ENOMEM;
-
- spin_lock_init(&rtcdrv->lock);
-
- err = of_property_read_u32(np, "reg", &rtcdrv->rtc_base);
- if (err) {
- dev_err(&pdev->dev, "unable to find base address of rtc node in dtb\n");
- return err;
- }
-
- platform_set_drvdata(pdev, rtcdrv);
-
- /* Register rtc alarm as a wakeup source */
- device_init_wakeup(&pdev->dev, 1);
-
- rtcdrv->regmap = devm_regmap_init_iobg(&pdev->dev,
- &sysrtc_regmap_config);
- if (IS_ERR(rtcdrv->regmap)) {
- err = PTR_ERR(rtcdrv->regmap);
- dev_err(&pdev->dev, "Failed to allocate register map: %d\n",
- err);
- return err;
- }
-
- /*
- * Set SYS_RTC counter in RTC_HZ HZ Units
- * We are using 32K RTC crystal (32768 / RTC_HZ / 2) -1
- * If 16HZ, therefore RTC_DIV = 1023;
- */
- rtc_div = ((32768 / RTC_HZ) / 2) - 1;
- sirfsoc_rtc_writel(rtcdrv, RTC_DIV, rtc_div);
-
- /* 0x3 -> RTC_CLK */
- sirfsoc_rtc_writel(rtcdrv, RTC_CLOCK_SWITCH, SIRFSOC_RTC_CLK);
-
- /* reset SYS RTC ALARM0 */
- sirfsoc_rtc_writel(rtcdrv, RTC_ALARM0, 0x0);
-
- /* reset SYS RTC ALARM1 */
- sirfsoc_rtc_writel(rtcdrv, RTC_ALARM1, 0x0);
-
- /* Restore RTC Overflow From Register After Command Reboot */
- rtcdrv->overflow_rtc =
- sirfsoc_rtc_readl(rtcdrv, RTC_SW_VALUE);
-
- rtcdrv->rtc = devm_rtc_allocate_device(&pdev->dev);
- if (IS_ERR(rtcdrv->rtc))
- return PTR_ERR(rtcdrv->rtc);
-
- rtcdrv->rtc->ops = &sirfsoc_rtc_ops;
- rtcdrv->rtc->range_max = (1ULL << 60) - 1;
-
- rtcdrv->irq = platform_get_irq(pdev, 0);
- err = devm_request_irq(&pdev->dev, rtcdrv->irq, sirfsoc_rtc_irq_handler,
- IRQF_SHARED, pdev->name, rtcdrv);
- if (err) {
- dev_err(&pdev->dev, "Unable to register for the SiRF SOC RTC IRQ\n");
- return err;
- }
-
- return devm_rtc_register_device(rtcdrv->rtc);
-}
-
-#ifdef CONFIG_PM_SLEEP
-static int sirfsoc_rtc_suspend(struct device *dev)
-{
- struct sirfsoc_rtc_drv *rtcdrv = dev_get_drvdata(dev);
- rtcdrv->overflow_rtc =
- sirfsoc_rtc_readl(rtcdrv, RTC_SW_VALUE);
-
- rtcdrv->saved_counter =
- sirfsoc_rtc_readl(rtcdrv, RTC_CN);
- rtcdrv->saved_overflow_rtc = rtcdrv->overflow_rtc;
- if (device_may_wakeup(dev) && !enable_irq_wake(rtcdrv->irq))
- rtcdrv->irq_wake = 1;
-
- return 0;
-}
-
-static int sirfsoc_rtc_resume(struct device *dev)
-{
- u32 tmp;
- struct sirfsoc_rtc_drv *rtcdrv = dev_get_drvdata(dev);
-
- /*
- * if resume from snapshot and the rtc power is lost,
- * restroe the rtc settings
- */
- if (SIRFSOC_RTC_CLK != sirfsoc_rtc_readl(rtcdrv, RTC_CLOCK_SWITCH)) {
- u32 rtc_div;
- /* 0x3 -> RTC_CLK */
- sirfsoc_rtc_writel(rtcdrv, RTC_CLOCK_SWITCH, SIRFSOC_RTC_CLK);
- /*
- * Set SYS_RTC counter in RTC_HZ HZ Units
- * We are using 32K RTC crystal (32768 / RTC_HZ / 2) -1
- * If 16HZ, therefore RTC_DIV = 1023;
- */
- rtc_div = ((32768 / RTC_HZ) / 2) - 1;
-
- sirfsoc_rtc_writel(rtcdrv, RTC_DIV, rtc_div);
-
- /* reset SYS RTC ALARM0 */
- sirfsoc_rtc_writel(rtcdrv, RTC_ALARM0, 0x0);
-
- /* reset SYS RTC ALARM1 */
- sirfsoc_rtc_writel(rtcdrv, RTC_ALARM1, 0x0);
- }
- rtcdrv->overflow_rtc = rtcdrv->saved_overflow_rtc;
-
- /*
- * if current counter is small than previous,
- * it means overflow in sleep
- */
- tmp = sirfsoc_rtc_readl(rtcdrv, RTC_CN);
- if (tmp <= rtcdrv->saved_counter)
- rtcdrv->overflow_rtc++;
- /*
- *PWRC Value Be Changed When Suspend, Restore Overflow
- * In Memory To Register
- */
- sirfsoc_rtc_writel(rtcdrv, RTC_SW_VALUE, rtcdrv->overflow_rtc);
-
- if (device_may_wakeup(dev) && rtcdrv->irq_wake) {
- disable_irq_wake(rtcdrv->irq);
- rtcdrv->irq_wake = 0;
- }
-
- return 0;
-}
-#endif
-
-static SIMPLE_DEV_PM_OPS(sirfsoc_rtc_pm_ops,
- sirfsoc_rtc_suspend, sirfsoc_rtc_resume);
-
-static struct platform_driver sirfsoc_rtc_driver = {
- .driver = {
- .name = "sirfsoc-rtc",
- .pm = &sirfsoc_rtc_pm_ops,
- .of_match_table = sirfsoc_rtc_of_match,
- },
- .probe = sirfsoc_rtc_probe,
-};
-module_platform_driver(sirfsoc_rtc_driver);
-
-MODULE_DESCRIPTION("SiRF SoC rtc driver");
-MODULE_AUTHOR("Xianglong Du <Xianglong.Du@csr.com>");
-MODULE_LICENSE("GPL v2");
-MODULE_ALIAS("platform:sirfsoc-rtc");
diff --git a/include/linux/rtc/sirfsoc_rtciobrg.h b/include/linux/rtc/sirfsoc_rtciobrg.h
deleted file mode 100644
index b31f2856733d..000000000000
--- a/include/linux/rtc/sirfsoc_rtciobrg.h
+++ /dev/null
@@ -1,21 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0-or-later */
-/*
- * RTC I/O Bridge interfaces for CSR SiRFprimaII
- * ARM access the registers of SYSRTC, GPSRTC and PWRC through this module
- *
- * Copyright (c) 2011 Cambridge Silicon Radio Limited, a CSR plc group company.
- */
-#ifndef _SIRFSOC_RTC_IOBRG_H_
-#define _SIRFSOC_RTC_IOBRG_H_
-
-struct regmap_config;
-
-extern void sirfsoc_rtc_iobrg_besyncing(void);
-
-extern u32 sirfsoc_rtc_iobrg_readl(u32 addr);
-
-extern void sirfsoc_rtc_iobrg_writel(u32 val, u32 addr);
-struct regmap *devm_regmap_init_iobg(struct device *dev,
- const struct regmap_config *config);
-
-#endif
--
2.29.2
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 19+ messages in thread
* Re: [PATCH 1/3] rtc: remove sirfsoc driver
2021-01-20 15:41 ` Arnd Bergmann
(?)
@ 2021-01-20 20:36 ` kernel test robot
2021-01-20 21:02 ` Arnd Bergmann
-1 siblings, 1 reply; 19+ messages in thread
From: kernel test robot @ 2021-01-20 20:36 UTC (permalink / raw)
To: kbuild-all
[-- Attachment #1: Type: text/plain, Size: 2232 bytes --]
Hi Arnd,
I love your patch! Yet something to improve:
[auto build test ERROR on abelloni/rtc-next]
[also build test ERROR on soc/for-next linux/master linus/master v5.11-rc4 next-20210120]
[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]
url: https://github.com/0day-ci/linux/commits/Arnd-Bergmann/rtc-remove-obsolete-drivers/20210120-235148
base: https://git.kernel.org/pub/scm/linux/kernel/git/abelloni/linux.git rtc-next
config: arm-defconfig (attached as .config)
compiler: arm-linux-gnueabi-gcc (GCC) 9.3.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://github.com/0day-ci/linux/commit/ffcefa0774c608b57d5ea429ad445201d2d2aea7
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Arnd-Bergmann/rtc-remove-obsolete-drivers/20210120-235148
git checkout ffcefa0774c608b57d5ea429ad445201d2d2aea7
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=arm
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
All errors (new ones prefixed by >>):
>> arch/arm/mach-prima2/pm.c:17:10: fatal error: linux/rtc/sirfsoc_rtciobrg.h: No such file or directory
17 | #include <linux/rtc/sirfsoc_rtciobrg.h>
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
vim +17 arch/arm/mach-prima2/pm.c
2558bd99cb1426a0 Rongjun Ying 2011-09-21 @17 #include <linux/rtc/sirfsoc_rtciobrg.h>
f81309067ff2d847 Russell King 2015-06-01 18 #include <asm/outercache.h>
2558bd99cb1426a0 Rongjun Ying 2011-09-21 19 #include <asm/suspend.h>
2558bd99cb1426a0 Rongjun Ying 2011-09-21 20 #include <asm/hardware/cache-l2x0.h>
2558bd99cb1426a0 Rongjun Ying 2011-09-21 21
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 54191 bytes --]
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH 1/3] rtc: remove sirfsoc driver
2021-01-20 15:41 ` Arnd Bergmann
@ 2021-01-20 21:20 ` Barry Song
-1 siblings, 0 replies; 19+ messages in thread
From: Barry Song @ 2021-01-20 21:20 UTC (permalink / raw)
To: Arnd Bergmann
Cc: linux-arm-kernel, LKML, linux-rtc, Alexandre Belloni,
Alessandro Zummo, Arnd Bergmann
Arnd Bergmann <arnd@kernel.org> 于2021年1月21日周四 上午4:42写道:
>
> From: Arnd Bergmann <arnd@arndb.de>
>
> The CSR SiRF prima2/atlas platforms are getting removed, so this driver
> is no longer needed.
>
> Cc: Barry Song <baohua@kernel.org>
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Barry Song <baohua@kernel.org>
> ---
> .../bindings/rtc/sirf,prima2-sysrtc.txt | 13 -
> drivers/rtc/Kconfig | 7 -
> drivers/rtc/Makefile | 1 -
> drivers/rtc/rtc-sirfsoc.c | 446 ------------------
> include/linux/rtc/sirfsoc_rtciobrg.h | 21 -
> 5 files changed, 488 deletions(-)
> delete mode 100644 Documentation/devicetree/bindings/rtc/sirf,prima2-sysrtc.txt
> delete mode 100644 drivers/rtc/rtc-sirfsoc.c
> delete mode 100644 include/linux/rtc/sirfsoc_rtciobrg.h
>
> diff --git a/Documentation/devicetree/bindings/rtc/sirf,prima2-sysrtc.txt b/Documentation/devicetree/bindings/rtc/sirf,prima2-sysrtc.txt
> deleted file mode 100644
> index 58885b55da21..000000000000
> --- a/Documentation/devicetree/bindings/rtc/sirf,prima2-sysrtc.txt
> +++ /dev/null
> @@ -1,13 +0,0 @@
> -SiRFSoC Real Time Clock
> -
> -Required properties:
> -- compatible: must be "sirf,prima2-sysrtc"
> -- reg: address range of rtc register set.
> -- interrupts: rtc alarm interrupts.
> -
> -Example:
> - rtc@2000 {
> - compatible = "sirf,prima2-sysrtc";
> - reg = <0x2000 0x1000>;
> - interrupts = <52 53 54>;
> - };
> diff --git a/drivers/rtc/Kconfig b/drivers/rtc/Kconfig
> index 6123f9f4fbc9..8fb9aa55ace1 100644
> --- a/drivers/rtc/Kconfig
> +++ b/drivers/rtc/Kconfig
> @@ -1799,13 +1799,6 @@ config RTC_DRV_IMX_SC
> If you say yes here you get support for the NXP i.MX System
> Controller RTC module.
>
> -config RTC_DRV_SIRFSOC
> - tristate "SiRFSOC RTC"
> - depends on ARCH_SIRF
> - help
> - Say "yes" here to support the real time clock on SiRF SOC chips.
> - This driver can also be built as a module called rtc-sirfsoc.
> -
> config RTC_DRV_ST_LPC
> tristate "STMicroelectronics LPC RTC"
> depends on ARCH_STI
> diff --git a/drivers/rtc/Makefile b/drivers/rtc/Makefile
> index bb8f319b09fb..1f00896db507 100644
> --- a/drivers/rtc/Makefile
> +++ b/drivers/rtc/Makefile
> @@ -154,7 +154,6 @@ obj-$(CONFIG_RTC_DRV_SA1100) += rtc-sa1100.o
> obj-$(CONFIG_RTC_DRV_SC27XX) += rtc-sc27xx.o
> obj-$(CONFIG_RTC_DRV_SD3078) += rtc-sd3078.o
> obj-$(CONFIG_RTC_DRV_SH) += rtc-sh.o
> -obj-$(CONFIG_RTC_DRV_SIRFSOC) += rtc-sirfsoc.o
> obj-$(CONFIG_RTC_DRV_SNVS) += rtc-snvs.o
> obj-$(CONFIG_RTC_DRV_SPEAR) += rtc-spear.o
> obj-$(CONFIG_RTC_DRV_STARFIRE) += rtc-starfire.o
> diff --git a/drivers/rtc/rtc-sirfsoc.c b/drivers/rtc/rtc-sirfsoc.c
> deleted file mode 100644
> index 03a6cca23201..000000000000
> --- a/drivers/rtc/rtc-sirfsoc.c
> +++ /dev/null
> @@ -1,446 +0,0 @@
> -// SPDX-License-Identifier: GPL-2.0-or-later
> -/*
> - * SiRFSoC Real Time Clock interface for Linux
> - *
> - * Copyright (c) 2013 Cambridge Silicon Radio Limited, a CSR plc group company.
> - */
> -
> -#include <linux/module.h>
> -#include <linux/err.h>
> -#include <linux/rtc.h>
> -#include <linux/platform_device.h>
> -#include <linux/slab.h>
> -#include <linux/io.h>
> -#include <linux/of.h>
> -#include <linux/regmap.h>
> -#include <linux/rtc/sirfsoc_rtciobrg.h>
> -
> -
> -#define RTC_CN 0x00
> -#define RTC_ALARM0 0x04
> -#define RTC_ALARM1 0x18
> -#define RTC_STATUS 0x08
> -#define RTC_SW_VALUE 0x40
> -#define SIRFSOC_RTC_AL1E (1<<6)
> -#define SIRFSOC_RTC_AL1 (1<<4)
> -#define SIRFSOC_RTC_HZE (1<<3)
> -#define SIRFSOC_RTC_AL0E (1<<2)
> -#define SIRFSOC_RTC_HZ (1<<1)
> -#define SIRFSOC_RTC_AL0 (1<<0)
> -#define RTC_DIV 0x0c
> -#define RTC_DEEP_CTRL 0x14
> -#define RTC_CLOCK_SWITCH 0x1c
> -#define SIRFSOC_RTC_CLK 0x03 /* others are reserved */
> -
> -/* Refer to RTC DIV switch */
> -#define RTC_HZ 16
> -
> -/* This macro is also defined in arch/arm/plat-sirfsoc/cpu.c */
> -#define RTC_SHIFT 4
> -
> -#define INTR_SYSRTC_CN 0x48
> -
> -struct sirfsoc_rtc_drv {
> - struct rtc_device *rtc;
> - u32 rtc_base;
> - u32 irq;
> - unsigned irq_wake;
> - /* Overflow for every 8 years extra time */
> - u32 overflow_rtc;
> - spinlock_t lock;
> - struct regmap *regmap;
> -#ifdef CONFIG_PM
> - u32 saved_counter;
> - u32 saved_overflow_rtc;
> -#endif
> -};
> -
> -static u32 sirfsoc_rtc_readl(struct sirfsoc_rtc_drv *rtcdrv, u32 offset)
> -{
> - u32 val;
> -
> - regmap_read(rtcdrv->regmap, rtcdrv->rtc_base + offset, &val);
> - return val;
> -}
> -
> -static void sirfsoc_rtc_writel(struct sirfsoc_rtc_drv *rtcdrv,
> - u32 offset, u32 val)
> -{
> - regmap_write(rtcdrv->regmap, rtcdrv->rtc_base + offset, val);
> -}
> -
> -static int sirfsoc_rtc_read_alarm(struct device *dev,
> - struct rtc_wkalrm *alrm)
> -{
> - unsigned long rtc_alarm, rtc_count;
> - struct sirfsoc_rtc_drv *rtcdrv;
> -
> - rtcdrv = dev_get_drvdata(dev);
> -
> - spin_lock_irq(&rtcdrv->lock);
> -
> - rtc_count = sirfsoc_rtc_readl(rtcdrv, RTC_CN);
> -
> - rtc_alarm = sirfsoc_rtc_readl(rtcdrv, RTC_ALARM0);
> - memset(alrm, 0, sizeof(struct rtc_wkalrm));
> -
> - /*
> - * assume alarm interval not beyond one round counter overflow_rtc:
> - * 0->0xffffffff
> - */
> - /* if alarm is in next overflow cycle */
> - if (rtc_count > rtc_alarm)
> - rtc_time64_to_tm((rtcdrv->overflow_rtc + 1)
> - << (BITS_PER_LONG - RTC_SHIFT)
> - | rtc_alarm >> RTC_SHIFT, &alrm->time);
> - else
> - rtc_time64_to_tm(rtcdrv->overflow_rtc
> - << (BITS_PER_LONG - RTC_SHIFT)
> - | rtc_alarm >> RTC_SHIFT, &alrm->time);
> - if (sirfsoc_rtc_readl(rtcdrv, RTC_STATUS) & SIRFSOC_RTC_AL0E)
> - alrm->enabled = 1;
> -
> - spin_unlock_irq(&rtcdrv->lock);
> -
> - return 0;
> -}
> -
> -static int sirfsoc_rtc_set_alarm(struct device *dev,
> - struct rtc_wkalrm *alrm)
> -{
> - unsigned long rtc_status_reg, rtc_alarm;
> - struct sirfsoc_rtc_drv *rtcdrv;
> - rtcdrv = dev_get_drvdata(dev);
> -
> - if (alrm->enabled) {
> - rtc_alarm = rtc_tm_to_time64(&alrm->time);
> -
> - spin_lock_irq(&rtcdrv->lock);
> -
> - rtc_status_reg = sirfsoc_rtc_readl(rtcdrv, RTC_STATUS);
> - if (rtc_status_reg & SIRFSOC_RTC_AL0E) {
> - /*
> - * An ongoing alarm in progress - ingore it and not
> - * to return EBUSY
> - */
> - dev_info(dev, "An old alarm was set, will be replaced by a new one\n");
> - }
> -
> - sirfsoc_rtc_writel(rtcdrv, RTC_ALARM0, rtc_alarm << RTC_SHIFT);
> - rtc_status_reg &= ~0x07; /* mask out the lower status bits */
> - /*
> - * This bit RTC_AL sets it as a wake-up source for Sleep Mode
> - * Writing 1 into this bit will clear it
> - */
> - rtc_status_reg |= SIRFSOC_RTC_AL0;
> - /* enable the RTC alarm interrupt */
> - rtc_status_reg |= SIRFSOC_RTC_AL0E;
> - sirfsoc_rtc_writel(rtcdrv, RTC_STATUS, rtc_status_reg);
> -
> - spin_unlock_irq(&rtcdrv->lock);
> - } else {
> - /*
> - * if this function was called with enabled=0
> - * then it could mean that the application is
> - * trying to cancel an ongoing alarm
> - */
> - spin_lock_irq(&rtcdrv->lock);
> -
> - rtc_status_reg = sirfsoc_rtc_readl(rtcdrv, RTC_STATUS);
> - if (rtc_status_reg & SIRFSOC_RTC_AL0E) {
> - /* clear the RTC status register's alarm bit */
> - rtc_status_reg &= ~0x07;
> - /* write 1 into SIRFSOC_RTC_AL0 to force a clear */
> - rtc_status_reg |= (SIRFSOC_RTC_AL0);
> - /* Clear the Alarm enable bit */
> - rtc_status_reg &= ~(SIRFSOC_RTC_AL0E);
> -
> - sirfsoc_rtc_writel(rtcdrv, RTC_STATUS,
> - rtc_status_reg);
> - }
> -
> - spin_unlock_irq(&rtcdrv->lock);
> - }
> -
> - return 0;
> -}
> -
> -static int sirfsoc_rtc_read_time(struct device *dev,
> - struct rtc_time *tm)
> -{
> - unsigned long tmp_rtc = 0;
> - struct sirfsoc_rtc_drv *rtcdrv;
> - rtcdrv = dev_get_drvdata(dev);
> - /*
> - * This patch is taken from WinCE - Need to validate this for
> - * correctness. To work around sirfsoc RTC counter double sync logic
> - * fail, read several times to make sure get stable value.
> - */
> - do {
> - tmp_rtc = sirfsoc_rtc_readl(rtcdrv, RTC_CN);
> - cpu_relax();
> - } while (tmp_rtc != sirfsoc_rtc_readl(rtcdrv, RTC_CN));
> -
> - rtc_time64_to_tm(rtcdrv->overflow_rtc << (BITS_PER_LONG - RTC_SHIFT)
> - | tmp_rtc >> RTC_SHIFT, tm);
> - return 0;
> -}
> -
> -static int sirfsoc_rtc_set_time(struct device *dev,
> - struct rtc_time *tm)
> -{
> - unsigned long rtc_time;
> - struct sirfsoc_rtc_drv *rtcdrv;
> - rtcdrv = dev_get_drvdata(dev);
> -
> - rtc_time = rtc_tm_to_time64(tm);
> -
> - rtcdrv->overflow_rtc = rtc_time >> (BITS_PER_LONG - RTC_SHIFT);
> -
> - sirfsoc_rtc_writel(rtcdrv, RTC_SW_VALUE, rtcdrv->overflow_rtc);
> - sirfsoc_rtc_writel(rtcdrv, RTC_CN, rtc_time << RTC_SHIFT);
> -
> - return 0;
> -}
> -
> -static int sirfsoc_rtc_alarm_irq_enable(struct device *dev,
> - unsigned int enabled)
> -{
> - unsigned long rtc_status_reg = 0x0;
> - struct sirfsoc_rtc_drv *rtcdrv;
> -
> - rtcdrv = dev_get_drvdata(dev);
> -
> - spin_lock_irq(&rtcdrv->lock);
> -
> - rtc_status_reg = sirfsoc_rtc_readl(rtcdrv, RTC_STATUS);
> - if (enabled)
> - rtc_status_reg |= SIRFSOC_RTC_AL0E;
> - else
> - rtc_status_reg &= ~SIRFSOC_RTC_AL0E;
> -
> - sirfsoc_rtc_writel(rtcdrv, RTC_STATUS, rtc_status_reg);
> -
> - spin_unlock_irq(&rtcdrv->lock);
> -
> - return 0;
> -
> -}
> -
> -static const struct rtc_class_ops sirfsoc_rtc_ops = {
> - .read_time = sirfsoc_rtc_read_time,
> - .set_time = sirfsoc_rtc_set_time,
> - .read_alarm = sirfsoc_rtc_read_alarm,
> - .set_alarm = sirfsoc_rtc_set_alarm,
> - .alarm_irq_enable = sirfsoc_rtc_alarm_irq_enable
> -};
> -
> -static irqreturn_t sirfsoc_rtc_irq_handler(int irq, void *pdata)
> -{
> - struct sirfsoc_rtc_drv *rtcdrv = pdata;
> - unsigned long rtc_status_reg = 0x0;
> - unsigned long events = 0x0;
> -
> - spin_lock(&rtcdrv->lock);
> -
> - rtc_status_reg = sirfsoc_rtc_readl(rtcdrv, RTC_STATUS);
> - /* this bit will be set ONLY if an alarm was active
> - * and it expired NOW
> - * So this is being used as an ASSERT
> - */
> - if (rtc_status_reg & SIRFSOC_RTC_AL0) {
> - /*
> - * clear the RTC status register's alarm bit
> - * mask out the lower status bits
> - */
> - rtc_status_reg &= ~0x07;
> - /* write 1 into SIRFSOC_RTC_AL0 to ACK the alarm interrupt */
> - rtc_status_reg |= (SIRFSOC_RTC_AL0);
> - /* Clear the Alarm enable bit */
> - rtc_status_reg &= ~(SIRFSOC_RTC_AL0E);
> - }
> -
> - sirfsoc_rtc_writel(rtcdrv, RTC_STATUS, rtc_status_reg);
> -
> - spin_unlock(&rtcdrv->lock);
> -
> - /* this should wake up any apps polling/waiting on the read
> - * after setting the alarm
> - */
> - events |= RTC_IRQF | RTC_AF;
> - rtc_update_irq(rtcdrv->rtc, 1, events);
> -
> - return IRQ_HANDLED;
> -}
> -
> -static const struct of_device_id sirfsoc_rtc_of_match[] = {
> - { .compatible = "sirf,prima2-sysrtc"},
> - {},
> -};
> -
> -static const struct regmap_config sysrtc_regmap_config = {
> - .reg_bits = 32,
> - .val_bits = 32,
> - .fast_io = true,
> -};
> -
> -MODULE_DEVICE_TABLE(of, sirfsoc_rtc_of_match);
> -
> -static int sirfsoc_rtc_probe(struct platform_device *pdev)
> -{
> - int err;
> - unsigned long rtc_div;
> - struct sirfsoc_rtc_drv *rtcdrv;
> - struct device_node *np = pdev->dev.of_node;
> -
> - rtcdrv = devm_kzalloc(&pdev->dev,
> - sizeof(struct sirfsoc_rtc_drv), GFP_KERNEL);
> - if (rtcdrv == NULL)
> - return -ENOMEM;
> -
> - spin_lock_init(&rtcdrv->lock);
> -
> - err = of_property_read_u32(np, "reg", &rtcdrv->rtc_base);
> - if (err) {
> - dev_err(&pdev->dev, "unable to find base address of rtc node in dtb\n");
> - return err;
> - }
> -
> - platform_set_drvdata(pdev, rtcdrv);
> -
> - /* Register rtc alarm as a wakeup source */
> - device_init_wakeup(&pdev->dev, 1);
> -
> - rtcdrv->regmap = devm_regmap_init_iobg(&pdev->dev,
> - &sysrtc_regmap_config);
> - if (IS_ERR(rtcdrv->regmap)) {
> - err = PTR_ERR(rtcdrv->regmap);
> - dev_err(&pdev->dev, "Failed to allocate register map: %d\n",
> - err);
> - return err;
> - }
> -
> - /*
> - * Set SYS_RTC counter in RTC_HZ HZ Units
> - * We are using 32K RTC crystal (32768 / RTC_HZ / 2) -1
> - * If 16HZ, therefore RTC_DIV = 1023;
> - */
> - rtc_div = ((32768 / RTC_HZ) / 2) - 1;
> - sirfsoc_rtc_writel(rtcdrv, RTC_DIV, rtc_div);
> -
> - /* 0x3 -> RTC_CLK */
> - sirfsoc_rtc_writel(rtcdrv, RTC_CLOCK_SWITCH, SIRFSOC_RTC_CLK);
> -
> - /* reset SYS RTC ALARM0 */
> - sirfsoc_rtc_writel(rtcdrv, RTC_ALARM0, 0x0);
> -
> - /* reset SYS RTC ALARM1 */
> - sirfsoc_rtc_writel(rtcdrv, RTC_ALARM1, 0x0);
> -
> - /* Restore RTC Overflow From Register After Command Reboot */
> - rtcdrv->overflow_rtc =
> - sirfsoc_rtc_readl(rtcdrv, RTC_SW_VALUE);
> -
> - rtcdrv->rtc = devm_rtc_allocate_device(&pdev->dev);
> - if (IS_ERR(rtcdrv->rtc))
> - return PTR_ERR(rtcdrv->rtc);
> -
> - rtcdrv->rtc->ops = &sirfsoc_rtc_ops;
> - rtcdrv->rtc->range_max = (1ULL << 60) - 1;
> -
> - rtcdrv->irq = platform_get_irq(pdev, 0);
> - err = devm_request_irq(&pdev->dev, rtcdrv->irq, sirfsoc_rtc_irq_handler,
> - IRQF_SHARED, pdev->name, rtcdrv);
> - if (err) {
> - dev_err(&pdev->dev, "Unable to register for the SiRF SOC RTC IRQ\n");
> - return err;
> - }
> -
> - return devm_rtc_register_device(rtcdrv->rtc);
> -}
> -
> -#ifdef CONFIG_PM_SLEEP
> -static int sirfsoc_rtc_suspend(struct device *dev)
> -{
> - struct sirfsoc_rtc_drv *rtcdrv = dev_get_drvdata(dev);
> - rtcdrv->overflow_rtc =
> - sirfsoc_rtc_readl(rtcdrv, RTC_SW_VALUE);
> -
> - rtcdrv->saved_counter =
> - sirfsoc_rtc_readl(rtcdrv, RTC_CN);
> - rtcdrv->saved_overflow_rtc = rtcdrv->overflow_rtc;
> - if (device_may_wakeup(dev) && !enable_irq_wake(rtcdrv->irq))
> - rtcdrv->irq_wake = 1;
> -
> - return 0;
> -}
> -
> -static int sirfsoc_rtc_resume(struct device *dev)
> -{
> - u32 tmp;
> - struct sirfsoc_rtc_drv *rtcdrv = dev_get_drvdata(dev);
> -
> - /*
> - * if resume from snapshot and the rtc power is lost,
> - * restroe the rtc settings
> - */
> - if (SIRFSOC_RTC_CLK != sirfsoc_rtc_readl(rtcdrv, RTC_CLOCK_SWITCH)) {
> - u32 rtc_div;
> - /* 0x3 -> RTC_CLK */
> - sirfsoc_rtc_writel(rtcdrv, RTC_CLOCK_SWITCH, SIRFSOC_RTC_CLK);
> - /*
> - * Set SYS_RTC counter in RTC_HZ HZ Units
> - * We are using 32K RTC crystal (32768 / RTC_HZ / 2) -1
> - * If 16HZ, therefore RTC_DIV = 1023;
> - */
> - rtc_div = ((32768 / RTC_HZ) / 2) - 1;
> -
> - sirfsoc_rtc_writel(rtcdrv, RTC_DIV, rtc_div);
> -
> - /* reset SYS RTC ALARM0 */
> - sirfsoc_rtc_writel(rtcdrv, RTC_ALARM0, 0x0);
> -
> - /* reset SYS RTC ALARM1 */
> - sirfsoc_rtc_writel(rtcdrv, RTC_ALARM1, 0x0);
> - }
> - rtcdrv->overflow_rtc = rtcdrv->saved_overflow_rtc;
> -
> - /*
> - * if current counter is small than previous,
> - * it means overflow in sleep
> - */
> - tmp = sirfsoc_rtc_readl(rtcdrv, RTC_CN);
> - if (tmp <= rtcdrv->saved_counter)
> - rtcdrv->overflow_rtc++;
> - /*
> - *PWRC Value Be Changed When Suspend, Restore Overflow
> - * In Memory To Register
> - */
> - sirfsoc_rtc_writel(rtcdrv, RTC_SW_VALUE, rtcdrv->overflow_rtc);
> -
> - if (device_may_wakeup(dev) && rtcdrv->irq_wake) {
> - disable_irq_wake(rtcdrv->irq);
> - rtcdrv->irq_wake = 0;
> - }
> -
> - return 0;
> -}
> -#endif
> -
> -static SIMPLE_DEV_PM_OPS(sirfsoc_rtc_pm_ops,
> - sirfsoc_rtc_suspend, sirfsoc_rtc_resume);
> -
> -static struct platform_driver sirfsoc_rtc_driver = {
> - .driver = {
> - .name = "sirfsoc-rtc",
> - .pm = &sirfsoc_rtc_pm_ops,
> - .of_match_table = sirfsoc_rtc_of_match,
> - },
> - .probe = sirfsoc_rtc_probe,
> -};
> -module_platform_driver(sirfsoc_rtc_driver);
> -
> -MODULE_DESCRIPTION("SiRF SoC rtc driver");
> -MODULE_AUTHOR("Xianglong Du <Xianglong.Du@csr.com>");
> -MODULE_LICENSE("GPL v2");
> -MODULE_ALIAS("platform:sirfsoc-rtc");
> diff --git a/include/linux/rtc/sirfsoc_rtciobrg.h b/include/linux/rtc/sirfsoc_rtciobrg.h
> deleted file mode 100644
> index b31f2856733d..000000000000
> --- a/include/linux/rtc/sirfsoc_rtciobrg.h
> +++ /dev/null
> @@ -1,21 +0,0 @@
> -/* SPDX-License-Identifier: GPL-2.0-or-later */
> -/*
> - * RTC I/O Bridge interfaces for CSR SiRFprimaII
> - * ARM access the registers of SYSRTC, GPSRTC and PWRC through this module
> - *
> - * Copyright (c) 2011 Cambridge Silicon Radio Limited, a CSR plc group company.
> - */
> -#ifndef _SIRFSOC_RTC_IOBRG_H_
> -#define _SIRFSOC_RTC_IOBRG_H_
> -
> -struct regmap_config;
> -
> -extern void sirfsoc_rtc_iobrg_besyncing(void);
> -
> -extern u32 sirfsoc_rtc_iobrg_readl(u32 addr);
> -
> -extern void sirfsoc_rtc_iobrg_writel(u32 val, u32 addr);
> -struct regmap *devm_regmap_init_iobg(struct device *dev,
> - const struct regmap_config *config);
> -
> -#endif
> --
> 2.29.2
>
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH 1/3] rtc: remove sirfsoc driver
@ 2021-01-20 21:20 ` Barry Song
0 siblings, 0 replies; 19+ messages in thread
From: Barry Song @ 2021-01-20 21:20 UTC (permalink / raw)
To: Arnd Bergmann
Cc: linux-rtc, Alessandro Zummo, Alexandre Belloni, Arnd Bergmann,
LKML, linux-arm-kernel
Arnd Bergmann <arnd@kernel.org> 于2021年1月21日周四 上午4:42写道:
>
> From: Arnd Bergmann <arnd@arndb.de>
>
> The CSR SiRF prima2/atlas platforms are getting removed, so this driver
> is no longer needed.
>
> Cc: Barry Song <baohua@kernel.org>
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Barry Song <baohua@kernel.org>
> ---
> .../bindings/rtc/sirf,prima2-sysrtc.txt | 13 -
> drivers/rtc/Kconfig | 7 -
> drivers/rtc/Makefile | 1 -
> drivers/rtc/rtc-sirfsoc.c | 446 ------------------
> include/linux/rtc/sirfsoc_rtciobrg.h | 21 -
> 5 files changed, 488 deletions(-)
> delete mode 100644 Documentation/devicetree/bindings/rtc/sirf,prima2-sysrtc.txt
> delete mode 100644 drivers/rtc/rtc-sirfsoc.c
> delete mode 100644 include/linux/rtc/sirfsoc_rtciobrg.h
>
> diff --git a/Documentation/devicetree/bindings/rtc/sirf,prima2-sysrtc.txt b/Documentation/devicetree/bindings/rtc/sirf,prima2-sysrtc.txt
> deleted file mode 100644
> index 58885b55da21..000000000000
> --- a/Documentation/devicetree/bindings/rtc/sirf,prima2-sysrtc.txt
> +++ /dev/null
> @@ -1,13 +0,0 @@
> -SiRFSoC Real Time Clock
> -
> -Required properties:
> -- compatible: must be "sirf,prima2-sysrtc"
> -- reg: address range of rtc register set.
> -- interrupts: rtc alarm interrupts.
> -
> -Example:
> - rtc@2000 {
> - compatible = "sirf,prima2-sysrtc";
> - reg = <0x2000 0x1000>;
> - interrupts = <52 53 54>;
> - };
> diff --git a/drivers/rtc/Kconfig b/drivers/rtc/Kconfig
> index 6123f9f4fbc9..8fb9aa55ace1 100644
> --- a/drivers/rtc/Kconfig
> +++ b/drivers/rtc/Kconfig
> @@ -1799,13 +1799,6 @@ config RTC_DRV_IMX_SC
> If you say yes here you get support for the NXP i.MX System
> Controller RTC module.
>
> -config RTC_DRV_SIRFSOC
> - tristate "SiRFSOC RTC"
> - depends on ARCH_SIRF
> - help
> - Say "yes" here to support the real time clock on SiRF SOC chips.
> - This driver can also be built as a module called rtc-sirfsoc.
> -
> config RTC_DRV_ST_LPC
> tristate "STMicroelectronics LPC RTC"
> depends on ARCH_STI
> diff --git a/drivers/rtc/Makefile b/drivers/rtc/Makefile
> index bb8f319b09fb..1f00896db507 100644
> --- a/drivers/rtc/Makefile
> +++ b/drivers/rtc/Makefile
> @@ -154,7 +154,6 @@ obj-$(CONFIG_RTC_DRV_SA1100) += rtc-sa1100.o
> obj-$(CONFIG_RTC_DRV_SC27XX) += rtc-sc27xx.o
> obj-$(CONFIG_RTC_DRV_SD3078) += rtc-sd3078.o
> obj-$(CONFIG_RTC_DRV_SH) += rtc-sh.o
> -obj-$(CONFIG_RTC_DRV_SIRFSOC) += rtc-sirfsoc.o
> obj-$(CONFIG_RTC_DRV_SNVS) += rtc-snvs.o
> obj-$(CONFIG_RTC_DRV_SPEAR) += rtc-spear.o
> obj-$(CONFIG_RTC_DRV_STARFIRE) += rtc-starfire.o
> diff --git a/drivers/rtc/rtc-sirfsoc.c b/drivers/rtc/rtc-sirfsoc.c
> deleted file mode 100644
> index 03a6cca23201..000000000000
> --- a/drivers/rtc/rtc-sirfsoc.c
> +++ /dev/null
> @@ -1,446 +0,0 @@
> -// SPDX-License-Identifier: GPL-2.0-or-later
> -/*
> - * SiRFSoC Real Time Clock interface for Linux
> - *
> - * Copyright (c) 2013 Cambridge Silicon Radio Limited, a CSR plc group company.
> - */
> -
> -#include <linux/module.h>
> -#include <linux/err.h>
> -#include <linux/rtc.h>
> -#include <linux/platform_device.h>
> -#include <linux/slab.h>
> -#include <linux/io.h>
> -#include <linux/of.h>
> -#include <linux/regmap.h>
> -#include <linux/rtc/sirfsoc_rtciobrg.h>
> -
> -
> -#define RTC_CN 0x00
> -#define RTC_ALARM0 0x04
> -#define RTC_ALARM1 0x18
> -#define RTC_STATUS 0x08
> -#define RTC_SW_VALUE 0x40
> -#define SIRFSOC_RTC_AL1E (1<<6)
> -#define SIRFSOC_RTC_AL1 (1<<4)
> -#define SIRFSOC_RTC_HZE (1<<3)
> -#define SIRFSOC_RTC_AL0E (1<<2)
> -#define SIRFSOC_RTC_HZ (1<<1)
> -#define SIRFSOC_RTC_AL0 (1<<0)
> -#define RTC_DIV 0x0c
> -#define RTC_DEEP_CTRL 0x14
> -#define RTC_CLOCK_SWITCH 0x1c
> -#define SIRFSOC_RTC_CLK 0x03 /* others are reserved */
> -
> -/* Refer to RTC DIV switch */
> -#define RTC_HZ 16
> -
> -/* This macro is also defined in arch/arm/plat-sirfsoc/cpu.c */
> -#define RTC_SHIFT 4
> -
> -#define INTR_SYSRTC_CN 0x48
> -
> -struct sirfsoc_rtc_drv {
> - struct rtc_device *rtc;
> - u32 rtc_base;
> - u32 irq;
> - unsigned irq_wake;
> - /* Overflow for every 8 years extra time */
> - u32 overflow_rtc;
> - spinlock_t lock;
> - struct regmap *regmap;
> -#ifdef CONFIG_PM
> - u32 saved_counter;
> - u32 saved_overflow_rtc;
> -#endif
> -};
> -
> -static u32 sirfsoc_rtc_readl(struct sirfsoc_rtc_drv *rtcdrv, u32 offset)
> -{
> - u32 val;
> -
> - regmap_read(rtcdrv->regmap, rtcdrv->rtc_base + offset, &val);
> - return val;
> -}
> -
> -static void sirfsoc_rtc_writel(struct sirfsoc_rtc_drv *rtcdrv,
> - u32 offset, u32 val)
> -{
> - regmap_write(rtcdrv->regmap, rtcdrv->rtc_base + offset, val);
> -}
> -
> -static int sirfsoc_rtc_read_alarm(struct device *dev,
> - struct rtc_wkalrm *alrm)
> -{
> - unsigned long rtc_alarm, rtc_count;
> - struct sirfsoc_rtc_drv *rtcdrv;
> -
> - rtcdrv = dev_get_drvdata(dev);
> -
> - spin_lock_irq(&rtcdrv->lock);
> -
> - rtc_count = sirfsoc_rtc_readl(rtcdrv, RTC_CN);
> -
> - rtc_alarm = sirfsoc_rtc_readl(rtcdrv, RTC_ALARM0);
> - memset(alrm, 0, sizeof(struct rtc_wkalrm));
> -
> - /*
> - * assume alarm interval not beyond one round counter overflow_rtc:
> - * 0->0xffffffff
> - */
> - /* if alarm is in next overflow cycle */
> - if (rtc_count > rtc_alarm)
> - rtc_time64_to_tm((rtcdrv->overflow_rtc + 1)
> - << (BITS_PER_LONG - RTC_SHIFT)
> - | rtc_alarm >> RTC_SHIFT, &alrm->time);
> - else
> - rtc_time64_to_tm(rtcdrv->overflow_rtc
> - << (BITS_PER_LONG - RTC_SHIFT)
> - | rtc_alarm >> RTC_SHIFT, &alrm->time);
> - if (sirfsoc_rtc_readl(rtcdrv, RTC_STATUS) & SIRFSOC_RTC_AL0E)
> - alrm->enabled = 1;
> -
> - spin_unlock_irq(&rtcdrv->lock);
> -
> - return 0;
> -}
> -
> -static int sirfsoc_rtc_set_alarm(struct device *dev,
> - struct rtc_wkalrm *alrm)
> -{
> - unsigned long rtc_status_reg, rtc_alarm;
> - struct sirfsoc_rtc_drv *rtcdrv;
> - rtcdrv = dev_get_drvdata(dev);
> -
> - if (alrm->enabled) {
> - rtc_alarm = rtc_tm_to_time64(&alrm->time);
> -
> - spin_lock_irq(&rtcdrv->lock);
> -
> - rtc_status_reg = sirfsoc_rtc_readl(rtcdrv, RTC_STATUS);
> - if (rtc_status_reg & SIRFSOC_RTC_AL0E) {
> - /*
> - * An ongoing alarm in progress - ingore it and not
> - * to return EBUSY
> - */
> - dev_info(dev, "An old alarm was set, will be replaced by a new one\n");
> - }
> -
> - sirfsoc_rtc_writel(rtcdrv, RTC_ALARM0, rtc_alarm << RTC_SHIFT);
> - rtc_status_reg &= ~0x07; /* mask out the lower status bits */
> - /*
> - * This bit RTC_AL sets it as a wake-up source for Sleep Mode
> - * Writing 1 into this bit will clear it
> - */
> - rtc_status_reg |= SIRFSOC_RTC_AL0;
> - /* enable the RTC alarm interrupt */
> - rtc_status_reg |= SIRFSOC_RTC_AL0E;
> - sirfsoc_rtc_writel(rtcdrv, RTC_STATUS, rtc_status_reg);
> -
> - spin_unlock_irq(&rtcdrv->lock);
> - } else {
> - /*
> - * if this function was called with enabled=0
> - * then it could mean that the application is
> - * trying to cancel an ongoing alarm
> - */
> - spin_lock_irq(&rtcdrv->lock);
> -
> - rtc_status_reg = sirfsoc_rtc_readl(rtcdrv, RTC_STATUS);
> - if (rtc_status_reg & SIRFSOC_RTC_AL0E) {
> - /* clear the RTC status register's alarm bit */
> - rtc_status_reg &= ~0x07;
> - /* write 1 into SIRFSOC_RTC_AL0 to force a clear */
> - rtc_status_reg |= (SIRFSOC_RTC_AL0);
> - /* Clear the Alarm enable bit */
> - rtc_status_reg &= ~(SIRFSOC_RTC_AL0E);
> -
> - sirfsoc_rtc_writel(rtcdrv, RTC_STATUS,
> - rtc_status_reg);
> - }
> -
> - spin_unlock_irq(&rtcdrv->lock);
> - }
> -
> - return 0;
> -}
> -
> -static int sirfsoc_rtc_read_time(struct device *dev,
> - struct rtc_time *tm)
> -{
> - unsigned long tmp_rtc = 0;
> - struct sirfsoc_rtc_drv *rtcdrv;
> - rtcdrv = dev_get_drvdata(dev);
> - /*
> - * This patch is taken from WinCE - Need to validate this for
> - * correctness. To work around sirfsoc RTC counter double sync logic
> - * fail, read several times to make sure get stable value.
> - */
> - do {
> - tmp_rtc = sirfsoc_rtc_readl(rtcdrv, RTC_CN);
> - cpu_relax();
> - } while (tmp_rtc != sirfsoc_rtc_readl(rtcdrv, RTC_CN));
> -
> - rtc_time64_to_tm(rtcdrv->overflow_rtc << (BITS_PER_LONG - RTC_SHIFT)
> - | tmp_rtc >> RTC_SHIFT, tm);
> - return 0;
> -}
> -
> -static int sirfsoc_rtc_set_time(struct device *dev,
> - struct rtc_time *tm)
> -{
> - unsigned long rtc_time;
> - struct sirfsoc_rtc_drv *rtcdrv;
> - rtcdrv = dev_get_drvdata(dev);
> -
> - rtc_time = rtc_tm_to_time64(tm);
> -
> - rtcdrv->overflow_rtc = rtc_time >> (BITS_PER_LONG - RTC_SHIFT);
> -
> - sirfsoc_rtc_writel(rtcdrv, RTC_SW_VALUE, rtcdrv->overflow_rtc);
> - sirfsoc_rtc_writel(rtcdrv, RTC_CN, rtc_time << RTC_SHIFT);
> -
> - return 0;
> -}
> -
> -static int sirfsoc_rtc_alarm_irq_enable(struct device *dev,
> - unsigned int enabled)
> -{
> - unsigned long rtc_status_reg = 0x0;
> - struct sirfsoc_rtc_drv *rtcdrv;
> -
> - rtcdrv = dev_get_drvdata(dev);
> -
> - spin_lock_irq(&rtcdrv->lock);
> -
> - rtc_status_reg = sirfsoc_rtc_readl(rtcdrv, RTC_STATUS);
> - if (enabled)
> - rtc_status_reg |= SIRFSOC_RTC_AL0E;
> - else
> - rtc_status_reg &= ~SIRFSOC_RTC_AL0E;
> -
> - sirfsoc_rtc_writel(rtcdrv, RTC_STATUS, rtc_status_reg);
> -
> - spin_unlock_irq(&rtcdrv->lock);
> -
> - return 0;
> -
> -}
> -
> -static const struct rtc_class_ops sirfsoc_rtc_ops = {
> - .read_time = sirfsoc_rtc_read_time,
> - .set_time = sirfsoc_rtc_set_time,
> - .read_alarm = sirfsoc_rtc_read_alarm,
> - .set_alarm = sirfsoc_rtc_set_alarm,
> - .alarm_irq_enable = sirfsoc_rtc_alarm_irq_enable
> -};
> -
> -static irqreturn_t sirfsoc_rtc_irq_handler(int irq, void *pdata)
> -{
> - struct sirfsoc_rtc_drv *rtcdrv = pdata;
> - unsigned long rtc_status_reg = 0x0;
> - unsigned long events = 0x0;
> -
> - spin_lock(&rtcdrv->lock);
> -
> - rtc_status_reg = sirfsoc_rtc_readl(rtcdrv, RTC_STATUS);
> - /* this bit will be set ONLY if an alarm was active
> - * and it expired NOW
> - * So this is being used as an ASSERT
> - */
> - if (rtc_status_reg & SIRFSOC_RTC_AL0) {
> - /*
> - * clear the RTC status register's alarm bit
> - * mask out the lower status bits
> - */
> - rtc_status_reg &= ~0x07;
> - /* write 1 into SIRFSOC_RTC_AL0 to ACK the alarm interrupt */
> - rtc_status_reg |= (SIRFSOC_RTC_AL0);
> - /* Clear the Alarm enable bit */
> - rtc_status_reg &= ~(SIRFSOC_RTC_AL0E);
> - }
> -
> - sirfsoc_rtc_writel(rtcdrv, RTC_STATUS, rtc_status_reg);
> -
> - spin_unlock(&rtcdrv->lock);
> -
> - /* this should wake up any apps polling/waiting on the read
> - * after setting the alarm
> - */
> - events |= RTC_IRQF | RTC_AF;
> - rtc_update_irq(rtcdrv->rtc, 1, events);
> -
> - return IRQ_HANDLED;
> -}
> -
> -static const struct of_device_id sirfsoc_rtc_of_match[] = {
> - { .compatible = "sirf,prima2-sysrtc"},
> - {},
> -};
> -
> -static const struct regmap_config sysrtc_regmap_config = {
> - .reg_bits = 32,
> - .val_bits = 32,
> - .fast_io = true,
> -};
> -
> -MODULE_DEVICE_TABLE(of, sirfsoc_rtc_of_match);
> -
> -static int sirfsoc_rtc_probe(struct platform_device *pdev)
> -{
> - int err;
> - unsigned long rtc_div;
> - struct sirfsoc_rtc_drv *rtcdrv;
> - struct device_node *np = pdev->dev.of_node;
> -
> - rtcdrv = devm_kzalloc(&pdev->dev,
> - sizeof(struct sirfsoc_rtc_drv), GFP_KERNEL);
> - if (rtcdrv == NULL)
> - return -ENOMEM;
> -
> - spin_lock_init(&rtcdrv->lock);
> -
> - err = of_property_read_u32(np, "reg", &rtcdrv->rtc_base);
> - if (err) {
> - dev_err(&pdev->dev, "unable to find base address of rtc node in dtb\n");
> - return err;
> - }
> -
> - platform_set_drvdata(pdev, rtcdrv);
> -
> - /* Register rtc alarm as a wakeup source */
> - device_init_wakeup(&pdev->dev, 1);
> -
> - rtcdrv->regmap = devm_regmap_init_iobg(&pdev->dev,
> - &sysrtc_regmap_config);
> - if (IS_ERR(rtcdrv->regmap)) {
> - err = PTR_ERR(rtcdrv->regmap);
> - dev_err(&pdev->dev, "Failed to allocate register map: %d\n",
> - err);
> - return err;
> - }
> -
> - /*
> - * Set SYS_RTC counter in RTC_HZ HZ Units
> - * We are using 32K RTC crystal (32768 / RTC_HZ / 2) -1
> - * If 16HZ, therefore RTC_DIV = 1023;
> - */
> - rtc_div = ((32768 / RTC_HZ) / 2) - 1;
> - sirfsoc_rtc_writel(rtcdrv, RTC_DIV, rtc_div);
> -
> - /* 0x3 -> RTC_CLK */
> - sirfsoc_rtc_writel(rtcdrv, RTC_CLOCK_SWITCH, SIRFSOC_RTC_CLK);
> -
> - /* reset SYS RTC ALARM0 */
> - sirfsoc_rtc_writel(rtcdrv, RTC_ALARM0, 0x0);
> -
> - /* reset SYS RTC ALARM1 */
> - sirfsoc_rtc_writel(rtcdrv, RTC_ALARM1, 0x0);
> -
> - /* Restore RTC Overflow From Register After Command Reboot */
> - rtcdrv->overflow_rtc =
> - sirfsoc_rtc_readl(rtcdrv, RTC_SW_VALUE);
> -
> - rtcdrv->rtc = devm_rtc_allocate_device(&pdev->dev);
> - if (IS_ERR(rtcdrv->rtc))
> - return PTR_ERR(rtcdrv->rtc);
> -
> - rtcdrv->rtc->ops = &sirfsoc_rtc_ops;
> - rtcdrv->rtc->range_max = (1ULL << 60) - 1;
> -
> - rtcdrv->irq = platform_get_irq(pdev, 0);
> - err = devm_request_irq(&pdev->dev, rtcdrv->irq, sirfsoc_rtc_irq_handler,
> - IRQF_SHARED, pdev->name, rtcdrv);
> - if (err) {
> - dev_err(&pdev->dev, "Unable to register for the SiRF SOC RTC IRQ\n");
> - return err;
> - }
> -
> - return devm_rtc_register_device(rtcdrv->rtc);
> -}
> -
> -#ifdef CONFIG_PM_SLEEP
> -static int sirfsoc_rtc_suspend(struct device *dev)
> -{
> - struct sirfsoc_rtc_drv *rtcdrv = dev_get_drvdata(dev);
> - rtcdrv->overflow_rtc =
> - sirfsoc_rtc_readl(rtcdrv, RTC_SW_VALUE);
> -
> - rtcdrv->saved_counter =
> - sirfsoc_rtc_readl(rtcdrv, RTC_CN);
> - rtcdrv->saved_overflow_rtc = rtcdrv->overflow_rtc;
> - if (device_may_wakeup(dev) && !enable_irq_wake(rtcdrv->irq))
> - rtcdrv->irq_wake = 1;
> -
> - return 0;
> -}
> -
> -static int sirfsoc_rtc_resume(struct device *dev)
> -{
> - u32 tmp;
> - struct sirfsoc_rtc_drv *rtcdrv = dev_get_drvdata(dev);
> -
> - /*
> - * if resume from snapshot and the rtc power is lost,
> - * restroe the rtc settings
> - */
> - if (SIRFSOC_RTC_CLK != sirfsoc_rtc_readl(rtcdrv, RTC_CLOCK_SWITCH)) {
> - u32 rtc_div;
> - /* 0x3 -> RTC_CLK */
> - sirfsoc_rtc_writel(rtcdrv, RTC_CLOCK_SWITCH, SIRFSOC_RTC_CLK);
> - /*
> - * Set SYS_RTC counter in RTC_HZ HZ Units
> - * We are using 32K RTC crystal (32768 / RTC_HZ / 2) -1
> - * If 16HZ, therefore RTC_DIV = 1023;
> - */
> - rtc_div = ((32768 / RTC_HZ) / 2) - 1;
> -
> - sirfsoc_rtc_writel(rtcdrv, RTC_DIV, rtc_div);
> -
> - /* reset SYS RTC ALARM0 */
> - sirfsoc_rtc_writel(rtcdrv, RTC_ALARM0, 0x0);
> -
> - /* reset SYS RTC ALARM1 */
> - sirfsoc_rtc_writel(rtcdrv, RTC_ALARM1, 0x0);
> - }
> - rtcdrv->overflow_rtc = rtcdrv->saved_overflow_rtc;
> -
> - /*
> - * if current counter is small than previous,
> - * it means overflow in sleep
> - */
> - tmp = sirfsoc_rtc_readl(rtcdrv, RTC_CN);
> - if (tmp <= rtcdrv->saved_counter)
> - rtcdrv->overflow_rtc++;
> - /*
> - *PWRC Value Be Changed When Suspend, Restore Overflow
> - * In Memory To Register
> - */
> - sirfsoc_rtc_writel(rtcdrv, RTC_SW_VALUE, rtcdrv->overflow_rtc);
> -
> - if (device_may_wakeup(dev) && rtcdrv->irq_wake) {
> - disable_irq_wake(rtcdrv->irq);
> - rtcdrv->irq_wake = 0;
> - }
> -
> - return 0;
> -}
> -#endif
> -
> -static SIMPLE_DEV_PM_OPS(sirfsoc_rtc_pm_ops,
> - sirfsoc_rtc_suspend, sirfsoc_rtc_resume);
> -
> -static struct platform_driver sirfsoc_rtc_driver = {
> - .driver = {
> - .name = "sirfsoc-rtc",
> - .pm = &sirfsoc_rtc_pm_ops,
> - .of_match_table = sirfsoc_rtc_of_match,
> - },
> - .probe = sirfsoc_rtc_probe,
> -};
> -module_platform_driver(sirfsoc_rtc_driver);
> -
> -MODULE_DESCRIPTION("SiRF SoC rtc driver");
> -MODULE_AUTHOR("Xianglong Du <Xianglong.Du@csr.com>");
> -MODULE_LICENSE("GPL v2");
> -MODULE_ALIAS("platform:sirfsoc-rtc");
> diff --git a/include/linux/rtc/sirfsoc_rtciobrg.h b/include/linux/rtc/sirfsoc_rtciobrg.h
> deleted file mode 100644
> index b31f2856733d..000000000000
> --- a/include/linux/rtc/sirfsoc_rtciobrg.h
> +++ /dev/null
> @@ -1,21 +0,0 @@
> -/* SPDX-License-Identifier: GPL-2.0-or-later */
> -/*
> - * RTC I/O Bridge interfaces for CSR SiRFprimaII
> - * ARM access the registers of SYSRTC, GPSRTC and PWRC through this module
> - *
> - * Copyright (c) 2011 Cambridge Silicon Radio Limited, a CSR plc group company.
> - */
> -#ifndef _SIRFSOC_RTC_IOBRG_H_
> -#define _SIRFSOC_RTC_IOBRG_H_
> -
> -struct regmap_config;
> -
> -extern void sirfsoc_rtc_iobrg_besyncing(void);
> -
> -extern u32 sirfsoc_rtc_iobrg_readl(u32 addr);
> -
> -extern void sirfsoc_rtc_iobrg_writel(u32 val, u32 addr);
> -struct regmap *devm_regmap_init_iobg(struct device *dev,
> - const struct regmap_config *config);
> -
> -#endif
> --
> 2.29.2
>
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH 1/3] rtc: remove sirfsoc driver
2021-01-20 15:41 ` Arnd Bergmann
` (2 preceding siblings ...)
(?)
@ 2021-01-21 4:26 ` kernel test robot
-1 siblings, 0 replies; 19+ messages in thread
From: kernel test robot @ 2021-01-21 4:26 UTC (permalink / raw)
To: kbuild-all
[-- Attachment #1: Type: text/plain, Size: 2164 bytes --]
Hi Arnd,
I love your patch! Yet something to improve:
[auto build test ERROR on abelloni/rtc-next]
[also build test ERROR on soc/for-next linux/master linus/master v5.11-rc4 next-20210120]
[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]
url: https://github.com/0day-ci/linux/commits/Arnd-Bergmann/rtc-remove-obsolete-drivers/20210120-235148
base: https://git.kernel.org/pub/scm/linux/kernel/git/abelloni/linux.git rtc-next
config: arm-defconfig (attached as .config)
compiler: arm-linux-gnueabi-gcc (GCC) 9.3.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://github.com/0day-ci/linux/commit/ffcefa0774c608b57d5ea429ad445201d2d2aea7
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Arnd-Bergmann/rtc-remove-obsolete-drivers/20210120-235148
git checkout ffcefa0774c608b57d5ea429ad445201d2d2aea7
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=arm
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
All errors (new ones prefixed by >>):
>> drivers/input/misc/sirfsoc-onkey.c:14:10: fatal error: linux/rtc/sirfsoc_rtciobrg.h: No such file or directory
14 | #include <linux/rtc/sirfsoc_rtciobrg.h>
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
vim +14 drivers/input/misc/sirfsoc-onkey.c
9b5f953ddc3247dd Binghua Duan 2013-06-02 @14 #include <linux/rtc/sirfsoc_rtciobrg.h>
9b5f953ddc3247dd Binghua Duan 2013-06-02 15 #include <linux/of.h>
a1a7521064428fc1 Xianglong Du 2014-02-15 16 #include <linux/workqueue.h>
9b5f953ddc3247dd Binghua Duan 2013-06-02 17
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 54185 bytes --]
^ permalink raw reply [flat|nested] 19+ messages in thread
* [PATCH 2/3] rtc: remove ste coh901 driver
2021-01-20 15:41 ` Arnd Bergmann
@ 2021-01-20 15:41 ` Arnd Bergmann
-1 siblings, 0 replies; 19+ messages in thread
From: Arnd Bergmann @ 2021-01-20 15:41 UTC (permalink / raw)
To: linux-arm-kernel, linux-kernel, linux-rtc, Alexandre Belloni
Cc: Alessandro Zummo, Arnd Bergmann, Linus Walleij
From: Arnd Bergmann <arnd@arndb.de>
The ST-Ericsson U300 platform is getting removed, so this driver is no
longer needed.
Cc: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
.../bindings/rtc/stericsson,coh901331.txt | 16 -
drivers/rtc/Kconfig | 12 -
drivers/rtc/Makefile | 1 -
drivers/rtc/rtc-coh901331.c | 290 ------------------
4 files changed, 319 deletions(-)
delete mode 100644 Documentation/devicetree/bindings/rtc/stericsson,coh901331.txt
delete mode 100644 drivers/rtc/rtc-coh901331.c
diff --git a/Documentation/devicetree/bindings/rtc/stericsson,coh901331.txt b/Documentation/devicetree/bindings/rtc/stericsson,coh901331.txt
deleted file mode 100644
index e615a897b20e..000000000000
--- a/Documentation/devicetree/bindings/rtc/stericsson,coh901331.txt
+++ /dev/null
@@ -1,16 +0,0 @@
-ST-Ericsson COH 901 331 Real Time Clock
-
-Required properties:
-- compatible: must be "stericsson,coh901331"
-- reg: address range of rtc register set.
-- interrupts: rtc alarm interrupt.
-- clocks: phandle to the rtc clock source
-
-Example:
- rtc: rtc@c0017000 {
- compatible = "stericsson,coh901331";
- reg = <0xc0017000 0x1000>;
- interrupt-parent = <&vicb>;
- interrupts = <10>;
- clocks = <&rtc_clk>;
- };
diff --git a/drivers/rtc/Kconfig b/drivers/rtc/Kconfig
index 8fb9aa55ace1..ff583d6a2870 100644
--- a/drivers/rtc/Kconfig
+++ b/drivers/rtc/Kconfig
@@ -1645,18 +1645,6 @@ config RTC_DRV_PS3
This driver can also be built as a module. If so, the module
will be called rtc-ps3.
-config RTC_DRV_COH901331
- tristate "ST-Ericsson COH 901 331 RTC"
- depends on ARCH_U300 || COMPILE_TEST
- help
- If you say Y here you will get access to ST-Ericsson
- COH 901 331 RTC clock found in some ST-Ericsson Mobile
- Platforms.
-
- This driver can also be built as a module. If so, the module
- will be called "rtc-coh901331".
-
-
config RTC_DRV_STMP
tristate "Freescale STMP3xxx/i.MX23/i.MX28 RTC"
depends on ARCH_MXS || COMPILE_TEST
diff --git a/drivers/rtc/Makefile b/drivers/rtc/Makefile
index 1f00896db507..8585cd159979 100644
--- a/drivers/rtc/Makefile
+++ b/drivers/rtc/Makefile
@@ -38,7 +38,6 @@ obj-$(CONFIG_RTC_DRV_BQ4802) += rtc-bq4802.o
obj-$(CONFIG_RTC_DRV_BRCMSTB) += rtc-brcmstb-waketimer.o
obj-$(CONFIG_RTC_DRV_CADENCE) += rtc-cadence.o
obj-$(CONFIG_RTC_DRV_CMOS) += rtc-cmos.o
-obj-$(CONFIG_RTC_DRV_COH901331) += rtc-coh901331.o
obj-$(CONFIG_RTC_DRV_CPCAP) += rtc-cpcap.o
obj-$(CONFIG_RTC_DRV_CROS_EC) += rtc-cros-ec.o
obj-$(CONFIG_RTC_DRV_DA9052) += rtc-da9052.o
diff --git a/drivers/rtc/rtc-coh901331.c b/drivers/rtc/rtc-coh901331.c
deleted file mode 100644
index 168ced87d93a..000000000000
--- a/drivers/rtc/rtc-coh901331.c
+++ /dev/null
@@ -1,290 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0
-/*
- * Copyright (C) 2007-2009 ST-Ericsson AB
- * Real Time Clock interface for ST-Ericsson AB COH 901 331 RTC.
- * Author: Linus Walleij <linus.walleij@stericsson.com>
- * Based on rtc-pl031.c by Deepak Saxena <dsaxena@plexity.net>
- * Copyright 2006 (c) MontaVista Software, Inc.
- */
-#include <linux/init.h>
-#include <linux/module.h>
-#include <linux/mod_devicetable.h>
-#include <linux/rtc.h>
-#include <linux/clk.h>
-#include <linux/interrupt.h>
-#include <linux/pm.h>
-#include <linux/platform_device.h>
-#include <linux/io.h>
-#include <linux/slab.h>
-
-/*
- * Registers in the COH 901 331
- */
-/* Alarm value 32bit (R/W) */
-#define COH901331_ALARM 0x00U
-/* Used to set current time 32bit (R/W) */
-#define COH901331_SET_TIME 0x04U
-/* Indication if current time is valid 32bit (R/-) */
-#define COH901331_VALID 0x08U
-/* Read the current time 32bit (R/-) */
-#define COH901331_CUR_TIME 0x0cU
-/* Event register for the "alarm" interrupt */
-#define COH901331_IRQ_EVENT 0x10U
-/* Mask register for the "alarm" interrupt */
-#define COH901331_IRQ_MASK 0x14U
-/* Force register for the "alarm" interrupt */
-#define COH901331_IRQ_FORCE 0x18U
-
-/*
- * Reference to RTC block clock
- * Notice that the frequent clk_enable()/clk_disable() on this
- * clock is mainly to be able to turn on/off other clocks in the
- * hierarchy as needed, the RTC clock is always on anyway.
- */
-struct coh901331_port {
- struct rtc_device *rtc;
- struct clk *clk;
- void __iomem *virtbase;
- int irq;
-#ifdef CONFIG_PM_SLEEP
- u32 irqmaskstore;
-#endif
-};
-
-static irqreturn_t coh901331_interrupt(int irq, void *data)
-{
- struct coh901331_port *rtap = data;
-
- clk_enable(rtap->clk);
- /* Ack IRQ */
- writel(1, rtap->virtbase + COH901331_IRQ_EVENT);
- /*
- * Disable the interrupt. This is necessary because
- * the RTC lives on a lower-clocked line and will
- * not release the IRQ line until after a few (slower)
- * clock cycles. The interrupt will be re-enabled when
- * a new alarm is set anyway.
- */
- writel(0, rtap->virtbase + COH901331_IRQ_MASK);
- clk_disable(rtap->clk);
-
- /* Set alarm flag */
- rtc_update_irq(rtap->rtc, 1, RTC_AF);
-
- return IRQ_HANDLED;
-}
-
-static int coh901331_read_time(struct device *dev, struct rtc_time *tm)
-{
- struct coh901331_port *rtap = dev_get_drvdata(dev);
-
- clk_enable(rtap->clk);
- /* Check if the time is valid */
- if (!readl(rtap->virtbase + COH901331_VALID)) {
- clk_disable(rtap->clk);
- return -EINVAL;
- }
-
- rtc_time64_to_tm(readl(rtap->virtbase + COH901331_CUR_TIME), tm);
- clk_disable(rtap->clk);
- return 0;
-}
-
-static int coh901331_set_time(struct device *dev, struct rtc_time *tm)
-{
- struct coh901331_port *rtap = dev_get_drvdata(dev);
-
- clk_enable(rtap->clk);
- writel(rtc_tm_to_time64(tm), rtap->virtbase + COH901331_SET_TIME);
- clk_disable(rtap->clk);
-
- return 0;
-}
-
-static int coh901331_read_alarm(struct device *dev, struct rtc_wkalrm *alarm)
-{
- struct coh901331_port *rtap = dev_get_drvdata(dev);
-
- clk_enable(rtap->clk);
- rtc_time64_to_tm(readl(rtap->virtbase + COH901331_ALARM), &alarm->time);
- alarm->pending = readl(rtap->virtbase + COH901331_IRQ_EVENT) & 1U;
- alarm->enabled = readl(rtap->virtbase + COH901331_IRQ_MASK) & 1U;
- clk_disable(rtap->clk);
-
- return 0;
-}
-
-static int coh901331_set_alarm(struct device *dev, struct rtc_wkalrm *alarm)
-{
- struct coh901331_port *rtap = dev_get_drvdata(dev);
- unsigned long time = rtc_tm_to_time64(&alarm->time);
-
- clk_enable(rtap->clk);
- writel(time, rtap->virtbase + COH901331_ALARM);
- writel(alarm->enabled, rtap->virtbase + COH901331_IRQ_MASK);
- clk_disable(rtap->clk);
-
- return 0;
-}
-
-static int coh901331_alarm_irq_enable(struct device *dev, unsigned int enabled)
-{
- struct coh901331_port *rtap = dev_get_drvdata(dev);
-
- clk_enable(rtap->clk);
- if (enabled)
- writel(1, rtap->virtbase + COH901331_IRQ_MASK);
- else
- writel(0, rtap->virtbase + COH901331_IRQ_MASK);
- clk_disable(rtap->clk);
-
- return 0;
-}
-
-static const struct rtc_class_ops coh901331_ops = {
- .read_time = coh901331_read_time,
- .set_time = coh901331_set_time,
- .read_alarm = coh901331_read_alarm,
- .set_alarm = coh901331_set_alarm,
- .alarm_irq_enable = coh901331_alarm_irq_enable,
-};
-
-static int __exit coh901331_remove(struct platform_device *pdev)
-{
- struct coh901331_port *rtap = platform_get_drvdata(pdev);
-
- if (rtap)
- clk_unprepare(rtap->clk);
-
- return 0;
-}
-
-
-static int __init coh901331_probe(struct platform_device *pdev)
-{
- int ret;
- struct coh901331_port *rtap;
-
- rtap = devm_kzalloc(&pdev->dev,
- sizeof(struct coh901331_port), GFP_KERNEL);
- if (!rtap)
- return -ENOMEM;
-
- rtap->virtbase = devm_platform_ioremap_resource(pdev, 0);
- if (IS_ERR(rtap->virtbase))
- return PTR_ERR(rtap->virtbase);
-
- rtap->irq = platform_get_irq(pdev, 0);
- if (devm_request_irq(&pdev->dev, rtap->irq, coh901331_interrupt, 0,
- "RTC COH 901 331 Alarm", rtap))
- return -EIO;
-
- rtap->clk = devm_clk_get(&pdev->dev, NULL);
- if (IS_ERR(rtap->clk)) {
- ret = PTR_ERR(rtap->clk);
- dev_err(&pdev->dev, "could not get clock\n");
- return ret;
- }
-
- rtap->rtc = devm_rtc_allocate_device(&pdev->dev);
- if (IS_ERR(rtap->rtc))
- return PTR_ERR(rtap->rtc);
-
- rtap->rtc->ops = &coh901331_ops;
- rtap->rtc->range_max = U32_MAX;
-
- /* We enable/disable the clock only to assure it works */
- ret = clk_prepare_enable(rtap->clk);
- if (ret) {
- dev_err(&pdev->dev, "could not enable clock\n");
- return ret;
- }
- clk_disable(rtap->clk);
-
- platform_set_drvdata(pdev, rtap);
-
- ret = devm_rtc_register_device(rtap->rtc);
- if (ret)
- goto out_no_rtc;
-
- return 0;
-
- out_no_rtc:
- clk_unprepare(rtap->clk);
- return ret;
-}
-
-#ifdef CONFIG_PM_SLEEP
-static int coh901331_suspend(struct device *dev)
-{
- struct coh901331_port *rtap = dev_get_drvdata(dev);
-
- /*
- * If this RTC alarm will be used for waking the system up,
- * don't disable it of course. Else we just disable the alarm
- * and await suspension.
- */
- if (device_may_wakeup(dev)) {
- enable_irq_wake(rtap->irq);
- } else {
- clk_enable(rtap->clk);
- rtap->irqmaskstore = readl(rtap->virtbase + COH901331_IRQ_MASK);
- writel(0, rtap->virtbase + COH901331_IRQ_MASK);
- clk_disable(rtap->clk);
- }
- clk_unprepare(rtap->clk);
- return 0;
-}
-
-static int coh901331_resume(struct device *dev)
-{
- int ret;
- struct coh901331_port *rtap = dev_get_drvdata(dev);
-
- ret = clk_prepare(rtap->clk);
- if (ret)
- return ret;
-
- if (device_may_wakeup(dev)) {
- disable_irq_wake(rtap->irq);
- } else {
- clk_enable(rtap->clk);
- writel(rtap->irqmaskstore, rtap->virtbase + COH901331_IRQ_MASK);
- clk_disable(rtap->clk);
- }
- return 0;
-}
-#endif
-
-static SIMPLE_DEV_PM_OPS(coh901331_pm_ops, coh901331_suspend, coh901331_resume);
-
-static void coh901331_shutdown(struct platform_device *pdev)
-{
- struct coh901331_port *rtap = platform_get_drvdata(pdev);
-
- clk_enable(rtap->clk);
- writel(0, rtap->virtbase + COH901331_IRQ_MASK);
- clk_disable_unprepare(rtap->clk);
-}
-
-static const struct of_device_id coh901331_dt_match[] = {
- { .compatible = "stericsson,coh901331" },
- {},
-};
-MODULE_DEVICE_TABLE(of, coh901331_dt_match);
-
-static struct platform_driver coh901331_driver = {
- .driver = {
- .name = "rtc-coh901331",
- .pm = &coh901331_pm_ops,
- .of_match_table = coh901331_dt_match,
- },
- .remove = __exit_p(coh901331_remove),
- .shutdown = coh901331_shutdown,
-};
-
-module_platform_driver_probe(coh901331_driver, coh901331_probe);
-
-MODULE_AUTHOR("Linus Walleij <linus.walleij@stericsson.com>");
-MODULE_DESCRIPTION("ST-Ericsson AB COH 901 331 RTC Driver");
-MODULE_LICENSE("GPL");
--
2.29.2
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [PATCH 2/3] rtc: remove ste coh901 driver
@ 2021-01-20 15:41 ` Arnd Bergmann
0 siblings, 0 replies; 19+ messages in thread
From: Arnd Bergmann @ 2021-01-20 15:41 UTC (permalink / raw)
To: linux-arm-kernel, linux-kernel, linux-rtc, Alexandre Belloni
Cc: Alessandro Zummo, Linus Walleij, Arnd Bergmann
From: Arnd Bergmann <arnd@arndb.de>
The ST-Ericsson U300 platform is getting removed, so this driver is no
longer needed.
Cc: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
.../bindings/rtc/stericsson,coh901331.txt | 16 -
drivers/rtc/Kconfig | 12 -
drivers/rtc/Makefile | 1 -
drivers/rtc/rtc-coh901331.c | 290 ------------------
4 files changed, 319 deletions(-)
delete mode 100644 Documentation/devicetree/bindings/rtc/stericsson,coh901331.txt
delete mode 100644 drivers/rtc/rtc-coh901331.c
diff --git a/Documentation/devicetree/bindings/rtc/stericsson,coh901331.txt b/Documentation/devicetree/bindings/rtc/stericsson,coh901331.txt
deleted file mode 100644
index e615a897b20e..000000000000
--- a/Documentation/devicetree/bindings/rtc/stericsson,coh901331.txt
+++ /dev/null
@@ -1,16 +0,0 @@
-ST-Ericsson COH 901 331 Real Time Clock
-
-Required properties:
-- compatible: must be "stericsson,coh901331"
-- reg: address range of rtc register set.
-- interrupts: rtc alarm interrupt.
-- clocks: phandle to the rtc clock source
-
-Example:
- rtc: rtc@c0017000 {
- compatible = "stericsson,coh901331";
- reg = <0xc0017000 0x1000>;
- interrupt-parent = <&vicb>;
- interrupts = <10>;
- clocks = <&rtc_clk>;
- };
diff --git a/drivers/rtc/Kconfig b/drivers/rtc/Kconfig
index 8fb9aa55ace1..ff583d6a2870 100644
--- a/drivers/rtc/Kconfig
+++ b/drivers/rtc/Kconfig
@@ -1645,18 +1645,6 @@ config RTC_DRV_PS3
This driver can also be built as a module. If so, the module
will be called rtc-ps3.
-config RTC_DRV_COH901331
- tristate "ST-Ericsson COH 901 331 RTC"
- depends on ARCH_U300 || COMPILE_TEST
- help
- If you say Y here you will get access to ST-Ericsson
- COH 901 331 RTC clock found in some ST-Ericsson Mobile
- Platforms.
-
- This driver can also be built as a module. If so, the module
- will be called "rtc-coh901331".
-
-
config RTC_DRV_STMP
tristate "Freescale STMP3xxx/i.MX23/i.MX28 RTC"
depends on ARCH_MXS || COMPILE_TEST
diff --git a/drivers/rtc/Makefile b/drivers/rtc/Makefile
index 1f00896db507..8585cd159979 100644
--- a/drivers/rtc/Makefile
+++ b/drivers/rtc/Makefile
@@ -38,7 +38,6 @@ obj-$(CONFIG_RTC_DRV_BQ4802) += rtc-bq4802.o
obj-$(CONFIG_RTC_DRV_BRCMSTB) += rtc-brcmstb-waketimer.o
obj-$(CONFIG_RTC_DRV_CADENCE) += rtc-cadence.o
obj-$(CONFIG_RTC_DRV_CMOS) += rtc-cmos.o
-obj-$(CONFIG_RTC_DRV_COH901331) += rtc-coh901331.o
obj-$(CONFIG_RTC_DRV_CPCAP) += rtc-cpcap.o
obj-$(CONFIG_RTC_DRV_CROS_EC) += rtc-cros-ec.o
obj-$(CONFIG_RTC_DRV_DA9052) += rtc-da9052.o
diff --git a/drivers/rtc/rtc-coh901331.c b/drivers/rtc/rtc-coh901331.c
deleted file mode 100644
index 168ced87d93a..000000000000
--- a/drivers/rtc/rtc-coh901331.c
+++ /dev/null
@@ -1,290 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0
-/*
- * Copyright (C) 2007-2009 ST-Ericsson AB
- * Real Time Clock interface for ST-Ericsson AB COH 901 331 RTC.
- * Author: Linus Walleij <linus.walleij@stericsson.com>
- * Based on rtc-pl031.c by Deepak Saxena <dsaxena@plexity.net>
- * Copyright 2006 (c) MontaVista Software, Inc.
- */
-#include <linux/init.h>
-#include <linux/module.h>
-#include <linux/mod_devicetable.h>
-#include <linux/rtc.h>
-#include <linux/clk.h>
-#include <linux/interrupt.h>
-#include <linux/pm.h>
-#include <linux/platform_device.h>
-#include <linux/io.h>
-#include <linux/slab.h>
-
-/*
- * Registers in the COH 901 331
- */
-/* Alarm value 32bit (R/W) */
-#define COH901331_ALARM 0x00U
-/* Used to set current time 32bit (R/W) */
-#define COH901331_SET_TIME 0x04U
-/* Indication if current time is valid 32bit (R/-) */
-#define COH901331_VALID 0x08U
-/* Read the current time 32bit (R/-) */
-#define COH901331_CUR_TIME 0x0cU
-/* Event register for the "alarm" interrupt */
-#define COH901331_IRQ_EVENT 0x10U
-/* Mask register for the "alarm" interrupt */
-#define COH901331_IRQ_MASK 0x14U
-/* Force register for the "alarm" interrupt */
-#define COH901331_IRQ_FORCE 0x18U
-
-/*
- * Reference to RTC block clock
- * Notice that the frequent clk_enable()/clk_disable() on this
- * clock is mainly to be able to turn on/off other clocks in the
- * hierarchy as needed, the RTC clock is always on anyway.
- */
-struct coh901331_port {
- struct rtc_device *rtc;
- struct clk *clk;
- void __iomem *virtbase;
- int irq;
-#ifdef CONFIG_PM_SLEEP
- u32 irqmaskstore;
-#endif
-};
-
-static irqreturn_t coh901331_interrupt(int irq, void *data)
-{
- struct coh901331_port *rtap = data;
-
- clk_enable(rtap->clk);
- /* Ack IRQ */
- writel(1, rtap->virtbase + COH901331_IRQ_EVENT);
- /*
- * Disable the interrupt. This is necessary because
- * the RTC lives on a lower-clocked line and will
- * not release the IRQ line until after a few (slower)
- * clock cycles. The interrupt will be re-enabled when
- * a new alarm is set anyway.
- */
- writel(0, rtap->virtbase + COH901331_IRQ_MASK);
- clk_disable(rtap->clk);
-
- /* Set alarm flag */
- rtc_update_irq(rtap->rtc, 1, RTC_AF);
-
- return IRQ_HANDLED;
-}
-
-static int coh901331_read_time(struct device *dev, struct rtc_time *tm)
-{
- struct coh901331_port *rtap = dev_get_drvdata(dev);
-
- clk_enable(rtap->clk);
- /* Check if the time is valid */
- if (!readl(rtap->virtbase + COH901331_VALID)) {
- clk_disable(rtap->clk);
- return -EINVAL;
- }
-
- rtc_time64_to_tm(readl(rtap->virtbase + COH901331_CUR_TIME), tm);
- clk_disable(rtap->clk);
- return 0;
-}
-
-static int coh901331_set_time(struct device *dev, struct rtc_time *tm)
-{
- struct coh901331_port *rtap = dev_get_drvdata(dev);
-
- clk_enable(rtap->clk);
- writel(rtc_tm_to_time64(tm), rtap->virtbase + COH901331_SET_TIME);
- clk_disable(rtap->clk);
-
- return 0;
-}
-
-static int coh901331_read_alarm(struct device *dev, struct rtc_wkalrm *alarm)
-{
- struct coh901331_port *rtap = dev_get_drvdata(dev);
-
- clk_enable(rtap->clk);
- rtc_time64_to_tm(readl(rtap->virtbase + COH901331_ALARM), &alarm->time);
- alarm->pending = readl(rtap->virtbase + COH901331_IRQ_EVENT) & 1U;
- alarm->enabled = readl(rtap->virtbase + COH901331_IRQ_MASK) & 1U;
- clk_disable(rtap->clk);
-
- return 0;
-}
-
-static int coh901331_set_alarm(struct device *dev, struct rtc_wkalrm *alarm)
-{
- struct coh901331_port *rtap = dev_get_drvdata(dev);
- unsigned long time = rtc_tm_to_time64(&alarm->time);
-
- clk_enable(rtap->clk);
- writel(time, rtap->virtbase + COH901331_ALARM);
- writel(alarm->enabled, rtap->virtbase + COH901331_IRQ_MASK);
- clk_disable(rtap->clk);
-
- return 0;
-}
-
-static int coh901331_alarm_irq_enable(struct device *dev, unsigned int enabled)
-{
- struct coh901331_port *rtap = dev_get_drvdata(dev);
-
- clk_enable(rtap->clk);
- if (enabled)
- writel(1, rtap->virtbase + COH901331_IRQ_MASK);
- else
- writel(0, rtap->virtbase + COH901331_IRQ_MASK);
- clk_disable(rtap->clk);
-
- return 0;
-}
-
-static const struct rtc_class_ops coh901331_ops = {
- .read_time = coh901331_read_time,
- .set_time = coh901331_set_time,
- .read_alarm = coh901331_read_alarm,
- .set_alarm = coh901331_set_alarm,
- .alarm_irq_enable = coh901331_alarm_irq_enable,
-};
-
-static int __exit coh901331_remove(struct platform_device *pdev)
-{
- struct coh901331_port *rtap = platform_get_drvdata(pdev);
-
- if (rtap)
- clk_unprepare(rtap->clk);
-
- return 0;
-}
-
-
-static int __init coh901331_probe(struct platform_device *pdev)
-{
- int ret;
- struct coh901331_port *rtap;
-
- rtap = devm_kzalloc(&pdev->dev,
- sizeof(struct coh901331_port), GFP_KERNEL);
- if (!rtap)
- return -ENOMEM;
-
- rtap->virtbase = devm_platform_ioremap_resource(pdev, 0);
- if (IS_ERR(rtap->virtbase))
- return PTR_ERR(rtap->virtbase);
-
- rtap->irq = platform_get_irq(pdev, 0);
- if (devm_request_irq(&pdev->dev, rtap->irq, coh901331_interrupt, 0,
- "RTC COH 901 331 Alarm", rtap))
- return -EIO;
-
- rtap->clk = devm_clk_get(&pdev->dev, NULL);
- if (IS_ERR(rtap->clk)) {
- ret = PTR_ERR(rtap->clk);
- dev_err(&pdev->dev, "could not get clock\n");
- return ret;
- }
-
- rtap->rtc = devm_rtc_allocate_device(&pdev->dev);
- if (IS_ERR(rtap->rtc))
- return PTR_ERR(rtap->rtc);
-
- rtap->rtc->ops = &coh901331_ops;
- rtap->rtc->range_max = U32_MAX;
-
- /* We enable/disable the clock only to assure it works */
- ret = clk_prepare_enable(rtap->clk);
- if (ret) {
- dev_err(&pdev->dev, "could not enable clock\n");
- return ret;
- }
- clk_disable(rtap->clk);
-
- platform_set_drvdata(pdev, rtap);
-
- ret = devm_rtc_register_device(rtap->rtc);
- if (ret)
- goto out_no_rtc;
-
- return 0;
-
- out_no_rtc:
- clk_unprepare(rtap->clk);
- return ret;
-}
-
-#ifdef CONFIG_PM_SLEEP
-static int coh901331_suspend(struct device *dev)
-{
- struct coh901331_port *rtap = dev_get_drvdata(dev);
-
- /*
- * If this RTC alarm will be used for waking the system up,
- * don't disable it of course. Else we just disable the alarm
- * and await suspension.
- */
- if (device_may_wakeup(dev)) {
- enable_irq_wake(rtap->irq);
- } else {
- clk_enable(rtap->clk);
- rtap->irqmaskstore = readl(rtap->virtbase + COH901331_IRQ_MASK);
- writel(0, rtap->virtbase + COH901331_IRQ_MASK);
- clk_disable(rtap->clk);
- }
- clk_unprepare(rtap->clk);
- return 0;
-}
-
-static int coh901331_resume(struct device *dev)
-{
- int ret;
- struct coh901331_port *rtap = dev_get_drvdata(dev);
-
- ret = clk_prepare(rtap->clk);
- if (ret)
- return ret;
-
- if (device_may_wakeup(dev)) {
- disable_irq_wake(rtap->irq);
- } else {
- clk_enable(rtap->clk);
- writel(rtap->irqmaskstore, rtap->virtbase + COH901331_IRQ_MASK);
- clk_disable(rtap->clk);
- }
- return 0;
-}
-#endif
-
-static SIMPLE_DEV_PM_OPS(coh901331_pm_ops, coh901331_suspend, coh901331_resume);
-
-static void coh901331_shutdown(struct platform_device *pdev)
-{
- struct coh901331_port *rtap = platform_get_drvdata(pdev);
-
- clk_enable(rtap->clk);
- writel(0, rtap->virtbase + COH901331_IRQ_MASK);
- clk_disable_unprepare(rtap->clk);
-}
-
-static const struct of_device_id coh901331_dt_match[] = {
- { .compatible = "stericsson,coh901331" },
- {},
-};
-MODULE_DEVICE_TABLE(of, coh901331_dt_match);
-
-static struct platform_driver coh901331_driver = {
- .driver = {
- .name = "rtc-coh901331",
- .pm = &coh901331_pm_ops,
- .of_match_table = coh901331_dt_match,
- },
- .remove = __exit_p(coh901331_remove),
- .shutdown = coh901331_shutdown,
-};
-
-module_platform_driver_probe(coh901331_driver, coh901331_probe);
-
-MODULE_AUTHOR("Linus Walleij <linus.walleij@stericsson.com>");
-MODULE_DESCRIPTION("ST-Ericsson AB COH 901 331 RTC Driver");
-MODULE_LICENSE("GPL");
--
2.29.2
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 19+ messages in thread
* Re: [PATCH 2/3] rtc: remove ste coh901 driver
2021-01-20 15:41 ` Arnd Bergmann
@ 2021-01-21 12:23 ` Linus Walleij
-1 siblings, 0 replies; 19+ messages in thread
From: Linus Walleij @ 2021-01-21 12:23 UTC (permalink / raw)
To: Arnd Bergmann
Cc: Linux ARM, linux-kernel, linux-rtc, Alexandre Belloni,
Alessandro Zummo, Arnd Bergmann
On Wed, Jan 20, 2021 at 4:42 PM Arnd Bergmann <arnd@kernel.org> wrote:
> From: Arnd Bergmann <arnd@arndb.de>
>
> The ST-Ericsson U300 platform is getting removed, so this driver is no
> longer needed.
>
> Cc: Linus Walleij <linus.walleij@linaro.org>
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Yours,
Linus Walleij
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH 2/3] rtc: remove ste coh901 driver
@ 2021-01-21 12:23 ` Linus Walleij
0 siblings, 0 replies; 19+ messages in thread
From: Linus Walleij @ 2021-01-21 12:23 UTC (permalink / raw)
To: Arnd Bergmann
Cc: linux-rtc, Alessandro Zummo, Alexandre Belloni, Arnd Bergmann,
linux-kernel, Linux ARM
On Wed, Jan 20, 2021 at 4:42 PM Arnd Bergmann <arnd@kernel.org> wrote:
> From: Arnd Bergmann <arnd@arndb.de>
>
> The ST-Ericsson U300 platform is getting removed, so this driver is no
> longer needed.
>
> Cc: Linus Walleij <linus.walleij@linaro.org>
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Yours,
Linus Walleij
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 19+ messages in thread
* [PATCH 3/3] rtc: remove ste ab3100 driver
2021-01-20 15:41 ` Arnd Bergmann
@ 2021-01-20 15:41 ` Arnd Bergmann
-1 siblings, 0 replies; 19+ messages in thread
From: Arnd Bergmann @ 2021-01-20 15:41 UTC (permalink / raw)
To: linux-arm-kernel, linux-kernel, linux-rtc, Alexandre Belloni
Cc: Alessandro Zummo, Arnd Bergmann, Linus Walleij
From: Arnd Bergmann <arnd@arndb.de>
The ST-Ericsson U300 platform is getting removed, so this driver is no
longer needed.
Cc: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
drivers/rtc/Kconfig | 8 --
drivers/rtc/Makefile | 1 -
drivers/rtc/rtc-ab3100.c | 254 ---------------------------------------
3 files changed, 263 deletions(-)
delete mode 100644 drivers/rtc/rtc-ab3100.c
diff --git a/drivers/rtc/Kconfig b/drivers/rtc/Kconfig
index ff583d6a2870..a608a8ef78fd 100644
--- a/drivers/rtc/Kconfig
+++ b/drivers/rtc/Kconfig
@@ -1270,14 +1270,6 @@ config RTC_DRV_PCF50633
If you say yes here you get support for the RTC subsystem of the
NXP PCF50633 used in embedded systems.
-config RTC_DRV_AB3100
- tristate "ST-Ericsson AB3100 RTC"
- depends on AB3100_CORE
- default y if AB3100_CORE
- help
- Select this to enable the ST-Ericsson AB3100 Mixed Signal IC RTC
- support. This chip contains a battery- and capacitor-backed RTC.
-
config RTC_DRV_AB8500
tristate "ST-Ericsson AB8500 RTC"
depends on AB8500_CORE
diff --git a/drivers/rtc/Makefile b/drivers/rtc/Makefile
index 8585cd159979..55f8a2a5b89d 100644
--- a/drivers/rtc/Makefile
+++ b/drivers/rtc/Makefile
@@ -19,7 +19,6 @@ rtc-core-$(CONFIG_RTC_INTF_SYSFS) += sysfs.o
obj-$(CONFIG_RTC_DRV_88PM80X) += rtc-88pm80x.o
obj-$(CONFIG_RTC_DRV_88PM860X) += rtc-88pm860x.o
-obj-$(CONFIG_RTC_DRV_AB3100) += rtc-ab3100.o
obj-$(CONFIG_RTC_DRV_AB8500) += rtc-ab8500.o
obj-$(CONFIG_RTC_DRV_ABB5ZES3) += rtc-ab-b5ze-s3.o
obj-$(CONFIG_RTC_DRV_ABEOZ9) += rtc-ab-eoz9.o
diff --git a/drivers/rtc/rtc-ab3100.c b/drivers/rtc/rtc-ab3100.c
deleted file mode 100644
index e4fd961e8bf6..000000000000
--- a/drivers/rtc/rtc-ab3100.c
+++ /dev/null
@@ -1,254 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0
-/*
- * Copyright (C) 2007-2009 ST-Ericsson AB
- * RTC clock driver for the AB3100 Analog Baseband Chip
- * Author: Linus Walleij <linus.walleij@stericsson.com>
- */
-#include <linux/module.h>
-#include <linux/kernel.h>
-#include <linux/init.h>
-#include <linux/platform_device.h>
-#include <linux/rtc.h>
-#include <linux/mfd/abx500.h>
-
-/* Clock rate in Hz */
-#define AB3100_RTC_CLOCK_RATE 32768
-
-/*
- * The AB3100 RTC registers. These are the same for
- * AB3000 and AB3100.
- * Control register:
- * Bit 0: RTC Monitor cleared=0, active=1, if you set it
- * to 1 it remains active until RTC power is lost.
- * Bit 1: 32 kHz Oscillator, 0 = on, 1 = bypass
- * Bit 2: Alarm on, 0 = off, 1 = on
- * Bit 3: 32 kHz buffer disabling, 0 = enabled, 1 = disabled
- */
-#define AB3100_RTC 0x53
-/* default setting, buffer disabled, alarm on */
-#define RTC_SETTING 0x30
-/* Alarm when AL0-AL3 == TI0-TI3 */
-#define AB3100_AL0 0x56
-#define AB3100_AL1 0x57
-#define AB3100_AL2 0x58
-#define AB3100_AL3 0x59
-/* This 48-bit register that counts up at 32768 Hz */
-#define AB3100_TI0 0x5a
-#define AB3100_TI1 0x5b
-#define AB3100_TI2 0x5c
-#define AB3100_TI3 0x5d
-#define AB3100_TI4 0x5e
-#define AB3100_TI5 0x5f
-
-/*
- * RTC clock functions and device struct declaration
- */
-static int ab3100_rtc_set_time(struct device *dev, struct rtc_time *tm)
-{
- u8 regs[] = {AB3100_TI0, AB3100_TI1, AB3100_TI2,
- AB3100_TI3, AB3100_TI4, AB3100_TI5};
- unsigned char buf[6];
- u64 hw_counter = rtc_tm_to_time64(tm) * AB3100_RTC_CLOCK_RATE * 2;
- int err = 0;
- int i;
-
- buf[0] = (hw_counter) & 0xFF;
- buf[1] = (hw_counter >> 8) & 0xFF;
- buf[2] = (hw_counter >> 16) & 0xFF;
- buf[3] = (hw_counter >> 24) & 0xFF;
- buf[4] = (hw_counter >> 32) & 0xFF;
- buf[5] = (hw_counter >> 40) & 0xFF;
-
- for (i = 0; i < 6; i++) {
- err = abx500_set_register_interruptible(dev, 0,
- regs[i], buf[i]);
- if (err)
- return err;
- }
-
- /* Set the flag to mark that the clock is now set */
- return abx500_mask_and_set_register_interruptible(dev, 0,
- AB3100_RTC,
- 0x01, 0x01);
-
-}
-
-static int ab3100_rtc_read_time(struct device *dev, struct rtc_time *tm)
-{
- time64_t time;
- u8 rtcval;
- int err;
-
- err = abx500_get_register_interruptible(dev, 0,
- AB3100_RTC, &rtcval);
- if (err)
- return err;
-
- if (!(rtcval & 0x01)) {
- dev_info(dev, "clock not set (lost power)");
- return -EINVAL;
- } else {
- u64 hw_counter;
- u8 buf[6];
-
- /* Read out time registers */
- err = abx500_get_register_page_interruptible(dev, 0,
- AB3100_TI0,
- buf, 6);
- if (err != 0)
- return err;
-
- hw_counter = ((u64) buf[5] << 40) | ((u64) buf[4] << 32) |
- ((u64) buf[3] << 24) | ((u64) buf[2] << 16) |
- ((u64) buf[1] << 8) | (u64) buf[0];
- time = hw_counter / (u64) (AB3100_RTC_CLOCK_RATE * 2);
- }
-
- rtc_time64_to_tm(time, tm);
-
- return 0;
-}
-
-static int ab3100_rtc_read_alarm(struct device *dev, struct rtc_wkalrm *alarm)
-{
- time64_t time;
- u64 hw_counter;
- u8 buf[6];
- u8 rtcval;
- int err;
-
- /* Figure out if alarm is enabled or not */
- err = abx500_get_register_interruptible(dev, 0,
- AB3100_RTC, &rtcval);
- if (err)
- return err;
- if (rtcval & 0x04)
- alarm->enabled = 1;
- else
- alarm->enabled = 0;
- /* No idea how this could be represented */
- alarm->pending = 0;
- /* Read out alarm registers, only 4 bytes */
- err = abx500_get_register_page_interruptible(dev, 0,
- AB3100_AL0, buf, 4);
- if (err)
- return err;
- hw_counter = ((u64) buf[3] << 40) | ((u64) buf[2] << 32) |
- ((u64) buf[1] << 24) | ((u64) buf[0] << 16);
- time = hw_counter / (u64) (AB3100_RTC_CLOCK_RATE * 2);
-
- rtc_time64_to_tm(time, &alarm->time);
-
- return rtc_valid_tm(&alarm->time);
-}
-
-static int ab3100_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *alarm)
-{
- u8 regs[] = {AB3100_AL0, AB3100_AL1, AB3100_AL2, AB3100_AL3};
- unsigned char buf[4];
- time64_t secs;
- u64 hw_counter;
- int err;
- int i;
-
- secs = rtc_tm_to_time64(&alarm->time);
- hw_counter = secs * AB3100_RTC_CLOCK_RATE * 2;
- buf[0] = (hw_counter >> 16) & 0xFF;
- buf[1] = (hw_counter >> 24) & 0xFF;
- buf[2] = (hw_counter >> 32) & 0xFF;
- buf[3] = (hw_counter >> 40) & 0xFF;
-
- /* Set the alarm */
- for (i = 0; i < 4; i++) {
- err = abx500_set_register_interruptible(dev, 0,
- regs[i], buf[i]);
- if (err)
- return err;
- }
- /* Then enable the alarm */
- return abx500_mask_and_set_register_interruptible(dev, 0,
- AB3100_RTC, (1 << 2),
- alarm->enabled << 2);
-}
-
-static int ab3100_rtc_irq_enable(struct device *dev, unsigned int enabled)
-{
- /*
- * It's not possible to enable/disable the alarm IRQ for this RTC.
- * It does not actually trigger any IRQ: instead its only function is
- * to power up the system, if it wasn't on. This will manifest as
- * a "power up cause" in the AB3100 power driver (battery charging etc)
- * and need to be handled there instead.
- */
- if (enabled)
- return abx500_mask_and_set_register_interruptible(dev, 0,
- AB3100_RTC, (1 << 2),
- 1 << 2);
- else
- return abx500_mask_and_set_register_interruptible(dev, 0,
- AB3100_RTC, (1 << 2),
- 0);
-}
-
-static const struct rtc_class_ops ab3100_rtc_ops = {
- .read_time = ab3100_rtc_read_time,
- .set_time = ab3100_rtc_set_time,
- .read_alarm = ab3100_rtc_read_alarm,
- .set_alarm = ab3100_rtc_set_alarm,
- .alarm_irq_enable = ab3100_rtc_irq_enable,
-};
-
-static int __init ab3100_rtc_probe(struct platform_device *pdev)
-{
- int err;
- u8 regval;
- struct rtc_device *rtc;
-
- /* The first RTC register needs special treatment */
- err = abx500_get_register_interruptible(&pdev->dev, 0,
- AB3100_RTC, ®val);
- if (err) {
- dev_err(&pdev->dev, "unable to read RTC register\n");
- return -ENODEV;
- }
-
- if ((regval & 0xFE) != RTC_SETTING) {
- dev_warn(&pdev->dev, "not default value in RTC reg 0x%x\n",
- regval);
- }
-
- if ((regval & 1) == 0) {
- /*
- * Set bit to detect power loss.
- * This bit remains until RTC power is lost.
- */
- regval = 1 | RTC_SETTING;
- err = abx500_set_register_interruptible(&pdev->dev, 0,
- AB3100_RTC, regval);
- /* Ignore any error on this write */
- }
-
- rtc = devm_rtc_allocate_device(&pdev->dev);
- if (IS_ERR(rtc))
- return PTR_ERR(rtc);
-
- rtc->ops = &ab3100_rtc_ops;
- /* 48bit counter at (AB3100_RTC_CLOCK_RATE * 2) */
- rtc->range_max = U32_MAX;
-
- platform_set_drvdata(pdev, rtc);
-
- return devm_rtc_register_device(rtc);
-}
-
-static struct platform_driver ab3100_rtc_driver = {
- .driver = {
- .name = "ab3100-rtc",
- },
-};
-
-module_platform_driver_probe(ab3100_rtc_driver, ab3100_rtc_probe);
-
-MODULE_AUTHOR("Linus Walleij <linus.walleij@stericsson.com>");
-MODULE_DESCRIPTION("AB3100 RTC Driver");
-MODULE_LICENSE("GPL");
--
2.29.2
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [PATCH 3/3] rtc: remove ste ab3100 driver
@ 2021-01-20 15:41 ` Arnd Bergmann
0 siblings, 0 replies; 19+ messages in thread
From: Arnd Bergmann @ 2021-01-20 15:41 UTC (permalink / raw)
To: linux-arm-kernel, linux-kernel, linux-rtc, Alexandre Belloni
Cc: Alessandro Zummo, Linus Walleij, Arnd Bergmann
From: Arnd Bergmann <arnd@arndb.de>
The ST-Ericsson U300 platform is getting removed, so this driver is no
longer needed.
Cc: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
drivers/rtc/Kconfig | 8 --
drivers/rtc/Makefile | 1 -
drivers/rtc/rtc-ab3100.c | 254 ---------------------------------------
3 files changed, 263 deletions(-)
delete mode 100644 drivers/rtc/rtc-ab3100.c
diff --git a/drivers/rtc/Kconfig b/drivers/rtc/Kconfig
index ff583d6a2870..a608a8ef78fd 100644
--- a/drivers/rtc/Kconfig
+++ b/drivers/rtc/Kconfig
@@ -1270,14 +1270,6 @@ config RTC_DRV_PCF50633
If you say yes here you get support for the RTC subsystem of the
NXP PCF50633 used in embedded systems.
-config RTC_DRV_AB3100
- tristate "ST-Ericsson AB3100 RTC"
- depends on AB3100_CORE
- default y if AB3100_CORE
- help
- Select this to enable the ST-Ericsson AB3100 Mixed Signal IC RTC
- support. This chip contains a battery- and capacitor-backed RTC.
-
config RTC_DRV_AB8500
tristate "ST-Ericsson AB8500 RTC"
depends on AB8500_CORE
diff --git a/drivers/rtc/Makefile b/drivers/rtc/Makefile
index 8585cd159979..55f8a2a5b89d 100644
--- a/drivers/rtc/Makefile
+++ b/drivers/rtc/Makefile
@@ -19,7 +19,6 @@ rtc-core-$(CONFIG_RTC_INTF_SYSFS) += sysfs.o
obj-$(CONFIG_RTC_DRV_88PM80X) += rtc-88pm80x.o
obj-$(CONFIG_RTC_DRV_88PM860X) += rtc-88pm860x.o
-obj-$(CONFIG_RTC_DRV_AB3100) += rtc-ab3100.o
obj-$(CONFIG_RTC_DRV_AB8500) += rtc-ab8500.o
obj-$(CONFIG_RTC_DRV_ABB5ZES3) += rtc-ab-b5ze-s3.o
obj-$(CONFIG_RTC_DRV_ABEOZ9) += rtc-ab-eoz9.o
diff --git a/drivers/rtc/rtc-ab3100.c b/drivers/rtc/rtc-ab3100.c
deleted file mode 100644
index e4fd961e8bf6..000000000000
--- a/drivers/rtc/rtc-ab3100.c
+++ /dev/null
@@ -1,254 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0
-/*
- * Copyright (C) 2007-2009 ST-Ericsson AB
- * RTC clock driver for the AB3100 Analog Baseband Chip
- * Author: Linus Walleij <linus.walleij@stericsson.com>
- */
-#include <linux/module.h>
-#include <linux/kernel.h>
-#include <linux/init.h>
-#include <linux/platform_device.h>
-#include <linux/rtc.h>
-#include <linux/mfd/abx500.h>
-
-/* Clock rate in Hz */
-#define AB3100_RTC_CLOCK_RATE 32768
-
-/*
- * The AB3100 RTC registers. These are the same for
- * AB3000 and AB3100.
- * Control register:
- * Bit 0: RTC Monitor cleared=0, active=1, if you set it
- * to 1 it remains active until RTC power is lost.
- * Bit 1: 32 kHz Oscillator, 0 = on, 1 = bypass
- * Bit 2: Alarm on, 0 = off, 1 = on
- * Bit 3: 32 kHz buffer disabling, 0 = enabled, 1 = disabled
- */
-#define AB3100_RTC 0x53
-/* default setting, buffer disabled, alarm on */
-#define RTC_SETTING 0x30
-/* Alarm when AL0-AL3 == TI0-TI3 */
-#define AB3100_AL0 0x56
-#define AB3100_AL1 0x57
-#define AB3100_AL2 0x58
-#define AB3100_AL3 0x59
-/* This 48-bit register that counts up at 32768 Hz */
-#define AB3100_TI0 0x5a
-#define AB3100_TI1 0x5b
-#define AB3100_TI2 0x5c
-#define AB3100_TI3 0x5d
-#define AB3100_TI4 0x5e
-#define AB3100_TI5 0x5f
-
-/*
- * RTC clock functions and device struct declaration
- */
-static int ab3100_rtc_set_time(struct device *dev, struct rtc_time *tm)
-{
- u8 regs[] = {AB3100_TI0, AB3100_TI1, AB3100_TI2,
- AB3100_TI3, AB3100_TI4, AB3100_TI5};
- unsigned char buf[6];
- u64 hw_counter = rtc_tm_to_time64(tm) * AB3100_RTC_CLOCK_RATE * 2;
- int err = 0;
- int i;
-
- buf[0] = (hw_counter) & 0xFF;
- buf[1] = (hw_counter >> 8) & 0xFF;
- buf[2] = (hw_counter >> 16) & 0xFF;
- buf[3] = (hw_counter >> 24) & 0xFF;
- buf[4] = (hw_counter >> 32) & 0xFF;
- buf[5] = (hw_counter >> 40) & 0xFF;
-
- for (i = 0; i < 6; i++) {
- err = abx500_set_register_interruptible(dev, 0,
- regs[i], buf[i]);
- if (err)
- return err;
- }
-
- /* Set the flag to mark that the clock is now set */
- return abx500_mask_and_set_register_interruptible(dev, 0,
- AB3100_RTC,
- 0x01, 0x01);
-
-}
-
-static int ab3100_rtc_read_time(struct device *dev, struct rtc_time *tm)
-{
- time64_t time;
- u8 rtcval;
- int err;
-
- err = abx500_get_register_interruptible(dev, 0,
- AB3100_RTC, &rtcval);
- if (err)
- return err;
-
- if (!(rtcval & 0x01)) {
- dev_info(dev, "clock not set (lost power)");
- return -EINVAL;
- } else {
- u64 hw_counter;
- u8 buf[6];
-
- /* Read out time registers */
- err = abx500_get_register_page_interruptible(dev, 0,
- AB3100_TI0,
- buf, 6);
- if (err != 0)
- return err;
-
- hw_counter = ((u64) buf[5] << 40) | ((u64) buf[4] << 32) |
- ((u64) buf[3] << 24) | ((u64) buf[2] << 16) |
- ((u64) buf[1] << 8) | (u64) buf[0];
- time = hw_counter / (u64) (AB3100_RTC_CLOCK_RATE * 2);
- }
-
- rtc_time64_to_tm(time, tm);
-
- return 0;
-}
-
-static int ab3100_rtc_read_alarm(struct device *dev, struct rtc_wkalrm *alarm)
-{
- time64_t time;
- u64 hw_counter;
- u8 buf[6];
- u8 rtcval;
- int err;
-
- /* Figure out if alarm is enabled or not */
- err = abx500_get_register_interruptible(dev, 0,
- AB3100_RTC, &rtcval);
- if (err)
- return err;
- if (rtcval & 0x04)
- alarm->enabled = 1;
- else
- alarm->enabled = 0;
- /* No idea how this could be represented */
- alarm->pending = 0;
- /* Read out alarm registers, only 4 bytes */
- err = abx500_get_register_page_interruptible(dev, 0,
- AB3100_AL0, buf, 4);
- if (err)
- return err;
- hw_counter = ((u64) buf[3] << 40) | ((u64) buf[2] << 32) |
- ((u64) buf[1] << 24) | ((u64) buf[0] << 16);
- time = hw_counter / (u64) (AB3100_RTC_CLOCK_RATE * 2);
-
- rtc_time64_to_tm(time, &alarm->time);
-
- return rtc_valid_tm(&alarm->time);
-}
-
-static int ab3100_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *alarm)
-{
- u8 regs[] = {AB3100_AL0, AB3100_AL1, AB3100_AL2, AB3100_AL3};
- unsigned char buf[4];
- time64_t secs;
- u64 hw_counter;
- int err;
- int i;
-
- secs = rtc_tm_to_time64(&alarm->time);
- hw_counter = secs * AB3100_RTC_CLOCK_RATE * 2;
- buf[0] = (hw_counter >> 16) & 0xFF;
- buf[1] = (hw_counter >> 24) & 0xFF;
- buf[2] = (hw_counter >> 32) & 0xFF;
- buf[3] = (hw_counter >> 40) & 0xFF;
-
- /* Set the alarm */
- for (i = 0; i < 4; i++) {
- err = abx500_set_register_interruptible(dev, 0,
- regs[i], buf[i]);
- if (err)
- return err;
- }
- /* Then enable the alarm */
- return abx500_mask_and_set_register_interruptible(dev, 0,
- AB3100_RTC, (1 << 2),
- alarm->enabled << 2);
-}
-
-static int ab3100_rtc_irq_enable(struct device *dev, unsigned int enabled)
-{
- /*
- * It's not possible to enable/disable the alarm IRQ for this RTC.
- * It does not actually trigger any IRQ: instead its only function is
- * to power up the system, if it wasn't on. This will manifest as
- * a "power up cause" in the AB3100 power driver (battery charging etc)
- * and need to be handled there instead.
- */
- if (enabled)
- return abx500_mask_and_set_register_interruptible(dev, 0,
- AB3100_RTC, (1 << 2),
- 1 << 2);
- else
- return abx500_mask_and_set_register_interruptible(dev, 0,
- AB3100_RTC, (1 << 2),
- 0);
-}
-
-static const struct rtc_class_ops ab3100_rtc_ops = {
- .read_time = ab3100_rtc_read_time,
- .set_time = ab3100_rtc_set_time,
- .read_alarm = ab3100_rtc_read_alarm,
- .set_alarm = ab3100_rtc_set_alarm,
- .alarm_irq_enable = ab3100_rtc_irq_enable,
-};
-
-static int __init ab3100_rtc_probe(struct platform_device *pdev)
-{
- int err;
- u8 regval;
- struct rtc_device *rtc;
-
- /* The first RTC register needs special treatment */
- err = abx500_get_register_interruptible(&pdev->dev, 0,
- AB3100_RTC, ®val);
- if (err) {
- dev_err(&pdev->dev, "unable to read RTC register\n");
- return -ENODEV;
- }
-
- if ((regval & 0xFE) != RTC_SETTING) {
- dev_warn(&pdev->dev, "not default value in RTC reg 0x%x\n",
- regval);
- }
-
- if ((regval & 1) == 0) {
- /*
- * Set bit to detect power loss.
- * This bit remains until RTC power is lost.
- */
- regval = 1 | RTC_SETTING;
- err = abx500_set_register_interruptible(&pdev->dev, 0,
- AB3100_RTC, regval);
- /* Ignore any error on this write */
- }
-
- rtc = devm_rtc_allocate_device(&pdev->dev);
- if (IS_ERR(rtc))
- return PTR_ERR(rtc);
-
- rtc->ops = &ab3100_rtc_ops;
- /* 48bit counter at (AB3100_RTC_CLOCK_RATE * 2) */
- rtc->range_max = U32_MAX;
-
- platform_set_drvdata(pdev, rtc);
-
- return devm_rtc_register_device(rtc);
-}
-
-static struct platform_driver ab3100_rtc_driver = {
- .driver = {
- .name = "ab3100-rtc",
- },
-};
-
-module_platform_driver_probe(ab3100_rtc_driver, ab3100_rtc_probe);
-
-MODULE_AUTHOR("Linus Walleij <linus.walleij@stericsson.com>");
-MODULE_DESCRIPTION("AB3100 RTC Driver");
-MODULE_LICENSE("GPL");
--
2.29.2
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 19+ messages in thread
* Re: [PATCH 3/3] rtc: remove ste ab3100 driver
2021-01-20 15:41 ` Arnd Bergmann
@ 2021-01-21 12:23 ` Linus Walleij
-1 siblings, 0 replies; 19+ messages in thread
From: Linus Walleij @ 2021-01-21 12:23 UTC (permalink / raw)
To: Arnd Bergmann
Cc: Linux ARM, linux-kernel, linux-rtc, Alexandre Belloni,
Alessandro Zummo, Arnd Bergmann
On Wed, Jan 20, 2021 at 4:42 PM Arnd Bergmann <arnd@kernel.org> wrote:
> From: Arnd Bergmann <arnd@arndb.de>
>
> The ST-Ericsson U300 platform is getting removed, so this driver is no
> longer needed.
>
> Cc: Linus Walleij <linus.walleij@linaro.org>
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Yours,
Linus Walleij
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH 3/3] rtc: remove ste ab3100 driver
@ 2021-01-21 12:23 ` Linus Walleij
0 siblings, 0 replies; 19+ messages in thread
From: Linus Walleij @ 2021-01-21 12:23 UTC (permalink / raw)
To: Arnd Bergmann
Cc: linux-rtc, Alessandro Zummo, Alexandre Belloni, Arnd Bergmann,
linux-kernel, Linux ARM
On Wed, Jan 20, 2021 at 4:42 PM Arnd Bergmann <arnd@kernel.org> wrote:
> From: Arnd Bergmann <arnd@arndb.de>
>
> The ST-Ericsson U300 platform is getting removed, so this driver is no
> longer needed.
>
> Cc: Linus Walleij <linus.walleij@linaro.org>
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Yours,
Linus Walleij
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH 0/3] rtc: remove obsolete drivers
2021-01-20 15:41 ` Arnd Bergmann
@ 2021-01-23 13:57 ` Alexandre Belloni
-1 siblings, 0 replies; 19+ messages in thread
From: Alexandre Belloni @ 2021-01-23 13:57 UTC (permalink / raw)
To: linux-rtc, linux-kernel, linux-arm-kernel, Arnd Bergmann
Cc: Alexandre Belloni, Arnd Bergmann, Alessandro Zummo
On Wed, 20 Jan 2021 16:41:55 +0100, Arnd Bergmann wrote:
> A few Arm platforms are getting removed in v5.12, this removes
> the corresponding rtc drivers.
>
> Link: https://lore.kernel.org/linux-arm-kernel/20210120124812.2800027-1-arnd@kernel.org/T/
>
>
> Arnd Bergmann (3):
> rtc: remove sirfsoc driver
> rtc: remove ste coh901 driver
> rtc: remove ste ab3100 driver
>
> [...]
Applied, thanks!
[1/3] rtc: remove sirfsoc driver
commit: 9d0735519f99948c5b5c22426b682ced7f7af9be
[2/3] rtc: remove ste coh901 driver
commit: dd2d3b40039d0278f25a21aa3e50955a01a92a62
[3/3] rtc: remove ste ab3100 driver
commit: 2f58f5eea8c60052100ff325688f2d987bde572b
Best regards,
--
Alexandre Belloni <alexandre.belloni@bootlin.com>
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH 0/3] rtc: remove obsolete drivers
@ 2021-01-23 13:57 ` Alexandre Belloni
0 siblings, 0 replies; 19+ messages in thread
From: Alexandre Belloni @ 2021-01-23 13:57 UTC (permalink / raw)
To: linux-rtc, linux-kernel, linux-arm-kernel, Arnd Bergmann
Cc: Alessandro Zummo, Alexandre Belloni, Arnd Bergmann
On Wed, 20 Jan 2021 16:41:55 +0100, Arnd Bergmann wrote:
> A few Arm platforms are getting removed in v5.12, this removes
> the corresponding rtc drivers.
>
> Link: https://lore.kernel.org/linux-arm-kernel/20210120124812.2800027-1-arnd@kernel.org/T/
>
>
> Arnd Bergmann (3):
> rtc: remove sirfsoc driver
> rtc: remove ste coh901 driver
> rtc: remove ste ab3100 driver
>
> [...]
Applied, thanks!
[1/3] rtc: remove sirfsoc driver
commit: 9d0735519f99948c5b5c22426b682ced7f7af9be
[2/3] rtc: remove ste coh901 driver
commit: dd2d3b40039d0278f25a21aa3e50955a01a92a62
[3/3] rtc: remove ste ab3100 driver
commit: 2f58f5eea8c60052100ff325688f2d987bde572b
Best regards,
--
Alexandre Belloni <alexandre.belloni@bootlin.com>
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 19+ messages in thread