* [PATCH] rtc: opal: set range
From: Alexandre Belloni @ 2021-01-10 22:46 UTC (permalink / raw)
To: Michael Ellerman, Benjamin Herrenschmidt, Paul Mackerras,
Alessandro Zummo, Alexandre Belloni
Cc: linux-rtc, linuxppc-dev, linux-kernel
It is a BCD RTC with 4 digits for the year.
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
---
drivers/rtc/rtc-opal.c | 14 ++++++++------
1 file changed, 8 insertions(+), 6 deletions(-)
diff --git a/drivers/rtc/rtc-opal.c b/drivers/rtc/rtc-opal.c
index 7b9f8bcf86fe..c586f695bdc9 100644
--- a/drivers/rtc/rtc-opal.c
+++ b/drivers/rtc/rtc-opal.c
@@ -233,6 +233,10 @@ static int opal_rtc_probe(struct platform_device *pdev)
{
struct rtc_device *rtc;
+ rtc = devm_rtc_allocate_device(&pdev->dev);
+ if (IS_ERR(rtc))
+ return PTR_ERR(rtc);
+
if (pdev->dev.of_node &&
(of_property_read_bool(pdev->dev.of_node, "wakeup-source") ||
of_property_read_bool(pdev->dev.of_node, "has-tpo")/* legacy */)) {
@@ -242,14 +246,12 @@ static int opal_rtc_probe(struct platform_device *pdev)
opal_rtc_ops.alarm_irq_enable = opal_tpo_alarm_irq_enable;
}
- rtc = devm_rtc_device_register(&pdev->dev, DRVNAME, &opal_rtc_ops,
- THIS_MODULE);
- if (IS_ERR(rtc))
- return PTR_ERR(rtc);
-
+ rtc->ops = &opal_rtc_ops;
+ rtc->range_min = RTC_TIMESTAMP_BEGIN_0000;
+ rtc->range_max = RTC_TIMESTAMP_END_9999;
rtc->uie_unsupported = 1;
- return 0;
+ return devm_rtc_register_device(rtc);
}
static const struct of_device_id opal_rtc_match[] = {
--
2.29.2
^ permalink raw reply related
* [PATCH 02/17] rtc: pl031: use RTC_FEATURE_ALARM
From: Alexandre Belloni @ 2021-01-10 23:17 UTC (permalink / raw)
To: linux-rtc, Linus Walleij, Alessandro Zummo, Alexandre Belloni
Cc: linuxppc-dev, linux-kernel, linux-arm-kernel
In-Reply-To: <20210110231752.1418816-1-alexandre.belloni@bootlin.com>
Clear RTC_FEATURE_ALARM instead of setting set_alarm, read_alarm and
alarm_irq_enable to NULL.
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
---
drivers/rtc/rtc-pl031.c | 8 ++------
1 file changed, 2 insertions(+), 6 deletions(-)
diff --git a/drivers/rtc/rtc-pl031.c b/drivers/rtc/rtc-pl031.c
index 224bbf096262..7c3967df4f9a 100644
--- a/drivers/rtc/rtc-pl031.c
+++ b/drivers/rtc/rtc-pl031.c
@@ -352,12 +352,8 @@ static int pl031_probe(struct amba_device *adev, const struct amba_id *id)
}
}
- if (!adev->irq[0]) {
- /* When there's no interrupt, no point in exposing the alarm */
- ops->read_alarm = NULL;
- ops->set_alarm = NULL;
- ops->alarm_irq_enable = NULL;
- }
+ if (!adev->irq[0])
+ clear_bit(RTC_FEATURE_ALARM, ldata->rtc->features);
device_init_wakeup(&adev->dev, true);
ldata->rtc = devm_rtc_allocate_device(&adev->dev);
--
2.29.2
^ permalink raw reply related
* [PATCH 00/17] rtc: constify all rtc_class_ops
From: Alexandre Belloni @ 2021-01-10 23:17 UTC (permalink / raw)
To: linux-rtc; +Cc: Alexandre Belloni, linuxppc-dev, linux-kernel, linux-arm-kernel
Hello,
This first introduces a features bitfield that is used to handle the
presence or absence of alarms instead of relying only on the presence of
the alarm callbacks.
The drivers modifying a struct rtc_class_ops or using two different
structures are then converted.
Alexandre Belloni (17):
rtc: introduce features bitfield
rtc: pl031: use RTC_FEATURE_ALARM
rtc: armada38x: remove armada38x_rtc_ops_noirq
rtc: cmos: remove cmos_rtc_ops_no_alarm
rtc: mv: remove mv_rtc_alarm_ops
rtc: m48t59: remove m48t02_rtc_ops
rtc: pcf2127: remove pcf2127_rtc_alrm_ops
rtc: pcf85063: remove pcf85063_rtc_ops_alarm
rtc: rx8010: drop a struct rtc_class_ops
rtc: pcf85363: drop a struct rtc_class_ops
rtc: m41t80: constify m41t80_rtc_ops
rtc: opal: constify opal_rtc_ops
rtc: rv3028: constify rv3028_rtc_ops
rtc: rv3029: constify rv3029_rtc_ops
rtc: rv3032: constify rv3032_rtc_ops
rtc: rv8803: constify rv8803_rtc_ops
rtc: tps65910: remove tps65910_rtc_ops_noirq
drivers/rtc/class.c | 5 +++++
drivers/rtc/interface.c | 12 ++++++------
drivers/rtc/rtc-armada38x.c | 21 ++++-----------------
drivers/rtc/rtc-cmos.c | 12 +++---------
drivers/rtc/rtc-m41t80.c | 14 +++++++-------
drivers/rtc/rtc-m48t59.c | 22 ++++++++--------------
drivers/rtc/rtc-mv.c | 14 ++++----------
drivers/rtc/rtc-opal.c | 13 +++++++------
drivers/rtc/rtc-pcf2127.c | 11 +++--------
drivers/rtc/rtc-pcf85063.c | 11 ++---------
drivers/rtc/rtc-pcf85363.c | 8 ++------
drivers/rtc/rtc-pl031.c | 8 ++------
drivers/rtc/rtc-rv3028.c | 11 ++++++-----
drivers/rtc/rtc-rv3029c2.c | 11 ++++++-----
drivers/rtc/rtc-rv3032.c | 11 ++++++-----
drivers/rtc/rtc-rv8803.c | 11 ++++++-----
drivers/rtc/rtc-rx8010.c | 13 +++----------
drivers/rtc/rtc-tps65910.c | 15 ++++-----------
include/linux/rtc.h | 2 ++
include/uapi/linux/rtc.h | 5 +++++
20 files changed, 91 insertions(+), 139 deletions(-)
--
2.29.2
^ permalink raw reply
* [PATCH 01/17] rtc: introduce features bitfield
From: Alexandre Belloni @ 2021-01-10 23:17 UTC (permalink / raw)
To: linux-rtc, Alessandro Zummo, Alexandre Belloni
Cc: linuxppc-dev, linux-kernel, linux-arm-kernel
In-Reply-To: <20210110231752.1418816-1-alexandre.belloni@bootlin.com>
Introduce a bitfield to allow the drivers to announce the available
features for an RTC.
The main use case would be to better handle alarms, that could be present
or not or have a minute resolution or may need a correct week day to be set.
Use the newly introduced RTC_FEATURE_ALARM bit to then test whether alarms
are available instead of relying on the presence of ops->set_alarm.
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
---
drivers/rtc/class.c | 5 +++++
drivers/rtc/interface.c | 12 ++++++------
include/linux/rtc.h | 2 ++
include/uapi/linux/rtc.h | 5 +++++
4 files changed, 18 insertions(+), 6 deletions(-)
diff --git a/drivers/rtc/class.c b/drivers/rtc/class.c
index 7e470fbd5e4d..03abd0aa229a 100644
--- a/drivers/rtc/class.c
+++ b/drivers/rtc/class.c
@@ -231,6 +231,8 @@ static struct rtc_device *rtc_allocate_device(void)
rtc->pie_timer.function = rtc_pie_update_irq;
rtc->pie_enabled = 0;
+ set_bit(RTC_FEATURE_ALARM, rtc->features);
+
return rtc;
}
@@ -386,6 +388,9 @@ int __devm_rtc_register_device(struct module *owner, struct rtc_device *rtc)
return -EINVAL;
}
+ if (!rtc->ops->set_alarm)
+ clear_bit(RTC_FEATURE_ALARM, rtc->features);
+
rtc->owner = owner;
rtc_device_get_offset(rtc);
diff --git a/drivers/rtc/interface.c b/drivers/rtc/interface.c
index 794a4f036b99..dcb34c73319e 100644
--- a/drivers/rtc/interface.c
+++ b/drivers/rtc/interface.c
@@ -186,7 +186,7 @@ static int rtc_read_alarm_internal(struct rtc_device *rtc,
if (!rtc->ops) {
err = -ENODEV;
- } else if (!rtc->ops->read_alarm) {
+ } else if (!test_bit(RTC_FEATURE_ALARM, rtc->features) || !rtc->ops->read_alarm) {
err = -EINVAL;
} else {
alarm->enabled = 0;
@@ -392,7 +392,7 @@ int rtc_read_alarm(struct rtc_device *rtc, struct rtc_wkalrm *alarm)
return err;
if (!rtc->ops) {
err = -ENODEV;
- } else if (!rtc->ops->read_alarm) {
+ } else if (!test_bit(RTC_FEATURE_ALARM, rtc->features) || !rtc->ops->read_alarm) {
err = -EINVAL;
} else {
memset(alarm, 0, sizeof(struct rtc_wkalrm));
@@ -436,7 +436,7 @@ static int __rtc_set_alarm(struct rtc_device *rtc, struct rtc_wkalrm *alarm)
if (!rtc->ops)
err = -ENODEV;
- else if (!rtc->ops->set_alarm)
+ else if (!test_bit(RTC_FEATURE_ALARM, rtc->features))
err = -EINVAL;
else
err = rtc->ops->set_alarm(rtc->dev.parent, alarm);
@@ -451,7 +451,7 @@ int rtc_set_alarm(struct rtc_device *rtc, struct rtc_wkalrm *alarm)
if (!rtc->ops)
return -ENODEV;
- else if (!rtc->ops->set_alarm)
+ else if (!test_bit(RTC_FEATURE_ALARM, rtc->features))
return -EINVAL;
err = rtc_valid_tm(&alarm->time);
@@ -531,7 +531,7 @@ int rtc_alarm_irq_enable(struct rtc_device *rtc, unsigned int enabled)
/* nothing */;
else if (!rtc->ops)
err = -ENODEV;
- else if (!rtc->ops->alarm_irq_enable)
+ else if (!test_bit(RTC_FEATURE_ALARM, rtc->features) || !rtc->ops->alarm_irq_enable)
err = -EINVAL;
else
err = rtc->ops->alarm_irq_enable(rtc->dev.parent, enabled);
@@ -843,7 +843,7 @@ static int rtc_timer_enqueue(struct rtc_device *rtc, struct rtc_timer *timer)
static void rtc_alarm_disable(struct rtc_device *rtc)
{
- if (!rtc->ops || !rtc->ops->alarm_irq_enable)
+ if (!rtc->ops || !test_bit(RTC_FEATURE_ALARM, rtc->features) || !rtc->ops->alarm_irq_enable)
return;
rtc->ops->alarm_irq_enable(rtc->dev.parent, false);
diff --git a/include/linux/rtc.h b/include/linux/rtc.h
index 568909449c13..bd611e26291d 100644
--- a/include/linux/rtc.h
+++ b/include/linux/rtc.h
@@ -141,6 +141,8 @@ struct rtc_device {
*/
unsigned long set_offset_nsec;
+ unsigned long features[BITS_TO_LONGS(RTC_FEATURE_CNT)];
+
time64_t range_min;
timeu64_t range_max;
time64_t start_secs;
diff --git a/include/uapi/linux/rtc.h b/include/uapi/linux/rtc.h
index fa9aff91cbf2..f950bff75e97 100644
--- a/include/uapi/linux/rtc.h
+++ b/include/uapi/linux/rtc.h
@@ -110,6 +110,11 @@ struct rtc_pll_info {
#define RTC_AF 0x20 /* Alarm interrupt */
#define RTC_UF 0x10 /* Update interrupt for 1Hz RTC */
+/* feature list */
+#define RTC_FEATURE_ALARM 0
+#define RTC_FEATURE_ALARM_RES_MINUTE 1
+#define RTC_FEATURE_NEED_WEEK_DAY 2
+#define RTC_FEATURE_CNT 3
#define RTC_MAX_FREQ 8192
--
2.29.2
^ permalink raw reply related
* [PATCH 03/17] rtc: armada38x: remove armada38x_rtc_ops_noirq
From: Alexandre Belloni @ 2021-01-10 23:17 UTC (permalink / raw)
To: linux-rtc, Andrew Lunn, Gregory Clement, Sebastian Hesselbarth,
Alessandro Zummo, Alexandre Belloni
Cc: linuxppc-dev, linux-kernel, linux-arm-kernel
In-Reply-To: <20210110231752.1418816-1-alexandre.belloni@bootlin.com>
Clear RTC_FEATURE_ALARM to signal that alarms are not available instead of
having a supplementary struct rtc_class_ops with a NULL .set_alarm.
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
---
drivers/rtc/rtc-armada38x.c | 21 ++++-----------------
1 file changed, 4 insertions(+), 17 deletions(-)
diff --git a/drivers/rtc/rtc-armada38x.c b/drivers/rtc/rtc-armada38x.c
index 807a79c07f08..cc542e6b1d5b 100644
--- a/drivers/rtc/rtc-armada38x.c
+++ b/drivers/rtc/rtc-armada38x.c
@@ -458,14 +458,6 @@ static const struct rtc_class_ops armada38x_rtc_ops = {
.set_offset = armada38x_rtc_set_offset,
};
-static const struct rtc_class_ops armada38x_rtc_ops_noirq = {
- .read_time = armada38x_rtc_read_time,
- .set_time = armada38x_rtc_set_time,
- .read_alarm = armada38x_rtc_read_alarm,
- .read_offset = armada38x_rtc_read_offset,
- .set_offset = armada38x_rtc_set_offset,
-};
-
static const struct armada38x_rtc_data armada38x_data = {
.update_mbus_timing = rtc_update_38x_mbus_timing_params,
.read_rtc_reg = read_rtc_register_38x_wa,
@@ -540,20 +532,15 @@ static __init int armada38x_rtc_probe(struct platform_device *pdev)
}
platform_set_drvdata(pdev, rtc);
- if (rtc->irq != -1) {
+ if (rtc->irq != -1)
device_init_wakeup(&pdev->dev, 1);
- rtc->rtc_dev->ops = &armada38x_rtc_ops;
- } else {
- /*
- * If there is no interrupt available then we can't
- * use the alarm
- */
- rtc->rtc_dev->ops = &armada38x_rtc_ops_noirq;
- }
+ else
+ clear_bit(RTC_FEATURE_ALARM, rtc->rtc_dev->features);
/* Update RTC-MBUS bridge timing parameters */
rtc->data->update_mbus_timing(rtc);
+ rtc->rtc_dev->ops = &armada38x_rtc_ops;
rtc->rtc_dev->range_max = U32_MAX;
return devm_rtc_register_device(rtc->rtc_dev);
--
2.29.2
^ permalink raw reply related
* [PATCH 04/17] rtc: cmos: remove cmos_rtc_ops_no_alarm
From: Alexandre Belloni @ 2021-01-10 23:17 UTC (permalink / raw)
To: linux-rtc, Alessandro Zummo, Alexandre Belloni
Cc: linuxppc-dev, linux-kernel, linux-arm-kernel
In-Reply-To: <20210110231752.1418816-1-alexandre.belloni@bootlin.com>
Clear RTC_FEATURE_ALARM to signal that alarms are not available instead of
having a supplementary struct rtc_class_ops with a NULL .set_alarm.
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
---
drivers/rtc/rtc-cmos.c | 12 +++---------
1 file changed, 3 insertions(+), 9 deletions(-)
diff --git a/drivers/rtc/rtc-cmos.c b/drivers/rtc/rtc-cmos.c
index 51e80bc70d42..c3746e249f5a 100644
--- a/drivers/rtc/rtc-cmos.c
+++ b/drivers/rtc/rtc-cmos.c
@@ -574,12 +574,6 @@ static const struct rtc_class_ops cmos_rtc_ops = {
.alarm_irq_enable = cmos_alarm_irq_enable,
};
-static const struct rtc_class_ops cmos_rtc_ops_no_alarm = {
- .read_time = cmos_read_time,
- .set_time = cmos_set_time,
- .proc = cmos_procfs,
-};
-
/*----------------------------------------------------------------*/
/*
@@ -857,12 +851,12 @@ cmos_do_probe(struct device *dev, struct resource *ports, int rtc_irq)
dev_dbg(dev, "IRQ %d is already in use\n", rtc_irq);
goto cleanup1;
}
-
- cmos_rtc.rtc->ops = &cmos_rtc_ops;
} else {
- cmos_rtc.rtc->ops = &cmos_rtc_ops_no_alarm;
+ clear_bit(RTC_FEATURE_ALARM, cmos_rtc.rtc->features);
}
+ cmos_rtc.rtc->ops = &cmos_rtc_ops;
+
retval = devm_rtc_register_device(cmos_rtc.rtc);
if (retval)
goto cleanup2;
--
2.29.2
^ permalink raw reply related
* [PATCH 07/17] rtc: pcf2127: remove pcf2127_rtc_alrm_ops
From: Alexandre Belloni @ 2021-01-10 23:17 UTC (permalink / raw)
To: linux-rtc, Alessandro Zummo, Alexandre Belloni
Cc: linuxppc-dev, linux-kernel, linux-arm-kernel
In-Reply-To: <20210110231752.1418816-1-alexandre.belloni@bootlin.com>
Move the alarm callbacks in pcf2127_rtc_ops and use RTC_FEATURE_ALARM to
signal to the core whether alarms are available instead of having a
supplementary struct rtc_class_ops without alarm callbacks.
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
---
drivers/rtc/rtc-pcf2127.c | 11 +++--------
1 file changed, 3 insertions(+), 8 deletions(-)
diff --git a/drivers/rtc/rtc-pcf2127.c b/drivers/rtc/rtc-pcf2127.c
index 39a7b5116aa4..68160d857ac1 100644
--- a/drivers/rtc/rtc-pcf2127.c
+++ b/drivers/rtc/rtc-pcf2127.c
@@ -225,12 +225,6 @@ static int pcf2127_rtc_ioctl(struct device *dev,
}
}
-static const struct rtc_class_ops pcf2127_rtc_ops = {
- .ioctl = pcf2127_rtc_ioctl,
- .read_time = pcf2127_rtc_read_time,
- .set_time = pcf2127_rtc_set_time,
-};
-
static int pcf2127_nvmem_read(void *priv, unsigned int offset,
void *val, size_t bytes)
{
@@ -459,7 +453,7 @@ static irqreturn_t pcf2127_rtc_irq(int irq, void *dev)
return IRQ_HANDLED;
}
-static const struct rtc_class_ops pcf2127_rtc_alrm_ops = {
+static const struct rtc_class_ops pcf2127_rtc_ops = {
.ioctl = pcf2127_rtc_ioctl,
.read_time = pcf2127_rtc_read_time,
.set_time = pcf2127_rtc_set_time,
@@ -584,6 +578,7 @@ static int pcf2127_probe(struct device *dev, struct regmap *regmap,
pcf2127->rtc->range_max = RTC_TIMESTAMP_END_2099;
pcf2127->rtc->set_start_time = true; /* Sets actual start to 1970 */
pcf2127->rtc->uie_unsupported = 1;
+ clear_bit(RTC_FEATURE_ALARM, pcf2127->rtc->features);
if (alarm_irq > 0) {
ret = devm_request_threaded_irq(dev, alarm_irq, NULL,
@@ -598,7 +593,7 @@ static int pcf2127_probe(struct device *dev, struct regmap *regmap,
if (alarm_irq > 0 || device_property_read_bool(dev, "wakeup-source")) {
device_init_wakeup(dev, true);
- pcf2127->rtc->ops = &pcf2127_rtc_alrm_ops;
+ set_bit(RTC_FEATURE_ALARM, pcf2127->rtc->features);
}
if (has_nvmem) {
--
2.29.2
^ permalink raw reply related
* [PATCH 08/17] rtc: pcf85063: remove pcf85063_rtc_ops_alarm
From: Alexandre Belloni @ 2021-01-10 23:17 UTC (permalink / raw)
To: linux-rtc, Alessandro Zummo, Alexandre Belloni
Cc: linuxppc-dev, linux-kernel, linux-arm-kernel
In-Reply-To: <20210110231752.1418816-1-alexandre.belloni@bootlin.com>
Move the alarm callbacks in pcf85063_rtc_ops and use RTC_FEATURE_ALARM to
signal to the core whether alarms are available instead of having a
supplementary struct rtc_class_ops without alarm callbacks.
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
---
drivers/rtc/rtc-pcf85063.c | 11 ++---------
1 file changed, 2 insertions(+), 9 deletions(-)
diff --git a/drivers/rtc/rtc-pcf85063.c b/drivers/rtc/rtc-pcf85063.c
index e19cf2adbc35..f7e7c9eb0781 100644
--- a/drivers/rtc/rtc-pcf85063.c
+++ b/drivers/rtc/rtc-pcf85063.c
@@ -307,14 +307,6 @@ static int pcf85063_ioctl(struct device *dev, unsigned int cmd,
}
static const struct rtc_class_ops pcf85063_rtc_ops = {
- .read_time = pcf85063_rtc_read_time,
- .set_time = pcf85063_rtc_set_time,
- .read_offset = pcf85063_read_offset,
- .set_offset = pcf85063_set_offset,
- .ioctl = pcf85063_ioctl,
-};
-
-static const struct rtc_class_ops pcf85063_rtc_ops_alarm = {
.read_time = pcf85063_rtc_read_time,
.set_time = pcf85063_rtc_set_time,
.read_offset = pcf85063_read_offset,
@@ -587,6 +579,7 @@ static int pcf85063_probe(struct i2c_client *client)
pcf85063->rtc->range_min = RTC_TIMESTAMP_BEGIN_2000;
pcf85063->rtc->range_max = RTC_TIMESTAMP_END_2099;
pcf85063->rtc->uie_unsupported = 1;
+ clear_bit(RTC_FEATURE_ALARM, pcf85063->rtc->features);
if (config->has_alarms && client->irq > 0) {
err = devm_request_threaded_irq(&client->dev, client->irq,
@@ -597,7 +590,7 @@ static int pcf85063_probe(struct i2c_client *client)
dev_warn(&pcf85063->rtc->dev,
"unable to request IRQ, alarms disabled\n");
} else {
- pcf85063->rtc->ops = &pcf85063_rtc_ops_alarm;
+ set_bit(RTC_FEATURE_ALARM, pcf85063->rtc->features);
device_init_wakeup(&client->dev, true);
err = dev_pm_set_wake_irq(&client->dev, client->irq);
if (err)
--
2.29.2
^ permalink raw reply related
* [PATCH 09/17] rtc: rx8010: drop a struct rtc_class_ops
From: Alexandre Belloni @ 2021-01-10 23:17 UTC (permalink / raw)
To: linux-rtc, Alessandro Zummo, Alexandre Belloni
Cc: linuxppc-dev, linux-kernel, linux-arm-kernel
In-Reply-To: <20210110231752.1418816-1-alexandre.belloni@bootlin.com>
Merge both struct rtc_class_ops in a single one and use RTC_FEATURE_ALARM
to signal to the core whether alarms are available.
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
---
drivers/rtc/rtc-rx8010.c | 13 +++----------
1 file changed, 3 insertions(+), 10 deletions(-)
diff --git a/drivers/rtc/rtc-rx8010.c b/drivers/rtc/rtc-rx8010.c
index 8340ab47a059..1a05e4654290 100644
--- a/drivers/rtc/rtc-rx8010.c
+++ b/drivers/rtc/rtc-rx8010.c
@@ -354,13 +354,7 @@ static int rx8010_ioctl(struct device *dev, unsigned int cmd, unsigned long arg)
}
}
-static const struct rtc_class_ops rx8010_rtc_ops_default = {
- .read_time = rx8010_get_time,
- .set_time = rx8010_set_time,
- .ioctl = rx8010_ioctl,
-};
-
-static const struct rtc_class_ops rx8010_rtc_ops_alarm = {
+static const struct rtc_class_ops rx8010_rtc_ops = {
.read_time = rx8010_get_time,
.set_time = rx8010_set_time,
.ioctl = rx8010_ioctl,
@@ -409,12 +403,11 @@ static int rx8010_probe(struct i2c_client *client)
dev_err(dev, "unable to request IRQ\n");
return err;
}
-
- rx8010->rtc->ops = &rx8010_rtc_ops_alarm;
} else {
- rx8010->rtc->ops = &rx8010_rtc_ops_default;
+ clear_bit(RTC_FEATURE_ALARM, rx8010->rtc->features);
}
+ rx8010->rtc->ops = &rx8010_rtc_ops;
rx8010->rtc->max_user_freq = 1;
rx8010->rtc->range_min = RTC_TIMESTAMP_BEGIN_2000;
rx8010->rtc->range_max = RTC_TIMESTAMP_END_2099;
--
2.29.2
^ permalink raw reply related
* [PATCH 06/17] rtc: m48t59: remove m48t02_rtc_ops
From: Alexandre Belloni @ 2021-01-10 23:17 UTC (permalink / raw)
To: linux-rtc, Alessandro Zummo, Alexandre Belloni
Cc: linuxppc-dev, linux-kernel, linux-arm-kernel
In-Reply-To: <20210110231752.1418816-1-alexandre.belloni@bootlin.com>
Clear RTC_FEATURE_ALARM to signal that alarms are not available instead of
having a supplementary struct rtc_class_ops without alarm callbacks.
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
---
drivers/rtc/rtc-m48t59.c | 22 ++++++++--------------
1 file changed, 8 insertions(+), 14 deletions(-)
diff --git a/drivers/rtc/rtc-m48t59.c b/drivers/rtc/rtc-m48t59.c
index 5f5898d3b055..1d2e99a70fce 100644
--- a/drivers/rtc/rtc-m48t59.c
+++ b/drivers/rtc/rtc-m48t59.c
@@ -313,11 +313,6 @@ static const struct rtc_class_ops m48t59_rtc_ops = {
.alarm_irq_enable = m48t59_rtc_alarm_irq_enable,
};
-static const struct rtc_class_ops m48t02_rtc_ops = {
- .read_time = m48t59_rtc_read_time,
- .set_time = m48t59_rtc_set_time,
-};
-
static int m48t59_nvram_read(void *priv, unsigned int offset, void *val,
size_t size)
{
@@ -366,7 +361,6 @@ static int m48t59_rtc_probe(struct platform_device *pdev)
struct m48t59_private *m48t59 = NULL;
struct resource *res;
int ret = -ENOMEM;
- const struct rtc_class_ops *ops;
struct nvmem_config nvmem_cfg = {
.name = "m48t59-",
.word_size = 1,
@@ -438,17 +432,21 @@ static int m48t59_rtc_probe(struct platform_device *pdev)
if (ret)
return ret;
}
+
+ m48t59->rtc = devm_rtc_allocate_device(&pdev->dev);
+ if (IS_ERR(m48t59->rtc))
+ return PTR_ERR(m48t59->rtc);
+
switch (pdata->type) {
case M48T59RTC_TYPE_M48T59:
- ops = &m48t59_rtc_ops;
pdata->offset = 0x1ff0;
break;
case M48T59RTC_TYPE_M48T02:
- ops = &m48t02_rtc_ops;
+ clear_bit(RTC_FEATURE_ALARM, m48t59->rtc->features);
pdata->offset = 0x7f0;
break;
case M48T59RTC_TYPE_M48T08:
- ops = &m48t02_rtc_ops;
+ clear_bit(RTC_FEATURE_ALARM, m48t59->rtc->features);
pdata->offset = 0x1ff0;
break;
default:
@@ -459,11 +457,7 @@ static int m48t59_rtc_probe(struct platform_device *pdev)
spin_lock_init(&m48t59->lock);
platform_set_drvdata(pdev, m48t59);
- m48t59->rtc = devm_rtc_allocate_device(&pdev->dev);
- if (IS_ERR(m48t59->rtc))
- return PTR_ERR(m48t59->rtc);
-
- m48t59->rtc->ops = ops;
+ m48t59->rtc->ops = &m48t59_rtc_ops;
nvmem_cfg.size = pdata->offset;
ret = devm_rtc_nvmem_register(m48t59->rtc, &nvmem_cfg);
--
2.29.2
^ permalink raw reply related
* [PATCH 05/17] rtc: mv: remove mv_rtc_alarm_ops
From: Alexandre Belloni @ 2021-01-10 23:17 UTC (permalink / raw)
To: linux-rtc, Alessandro Zummo, Alexandre Belloni
Cc: linuxppc-dev, linux-kernel, linux-arm-kernel
In-Reply-To: <20210110231752.1418816-1-alexandre.belloni@bootlin.com>
Move the alarm callbacks in mv_rtc_ops and clear RTC_FEATURE_ALARM to
signal that alarms are not available instead of having a supplementary
struct rtc_class_ops.
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
---
drivers/rtc/rtc-mv.c | 14 ++++----------
1 file changed, 4 insertions(+), 10 deletions(-)
diff --git a/drivers/rtc/rtc-mv.c b/drivers/rtc/rtc-mv.c
index f8e2ecea1d8d..6c526e2ec56d 100644
--- a/drivers/rtc/rtc-mv.c
+++ b/drivers/rtc/rtc-mv.c
@@ -200,11 +200,6 @@ static irqreturn_t mv_rtc_interrupt(int irq, void *data)
static const struct rtc_class_ops mv_rtc_ops = {
.read_time = mv_rtc_read_time,
.set_time = mv_rtc_set_time,
-};
-
-static const struct rtc_class_ops mv_rtc_alarm_ops = {
- .read_time = mv_rtc_read_time,
- .set_time = mv_rtc_set_time,
.read_alarm = mv_rtc_read_alarm,
.set_alarm = mv_rtc_set_alarm,
.alarm_irq_enable = mv_rtc_alarm_irq_enable,
@@ -268,13 +263,12 @@ static int __init mv_rtc_probe(struct platform_device *pdev)
}
}
- if (pdata->irq >= 0) {
+ if (pdata->irq >= 0)
device_init_wakeup(&pdev->dev, 1);
- pdata->rtc->ops = &mv_rtc_alarm_ops;
- } else {
- pdata->rtc->ops = &mv_rtc_ops;
- }
+ else
+ clear_bit(RTC_FEATURE_ALARM, pdata->rtc->features);
+ pdata->rtc->ops = &mv_rtc_ops;
pdata->rtc->range_min = RTC_TIMESTAMP_BEGIN_2000;
pdata->rtc->range_max = RTC_TIMESTAMP_END_2099;
--
2.29.2
^ permalink raw reply related
* [PATCH 11/17] rtc: m41t80: constify m41t80_rtc_ops
From: Alexandre Belloni @ 2021-01-10 23:17 UTC (permalink / raw)
To: linux-rtc, Alessandro Zummo, Alexandre Belloni
Cc: linuxppc-dev, linux-kernel, linux-arm-kernel
In-Reply-To: <20210110231752.1418816-1-alexandre.belloni@bootlin.com>
Use RTC_FEATURE_ALARM to signal to the core whether alarms are available
instead of changing the global struct rtc_class_ops, allowing to make it
const.
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
---
drivers/rtc/rtc-m41t80.c | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/drivers/rtc/rtc-m41t80.c b/drivers/rtc/rtc-m41t80.c
index 160dcf68e64e..e3ddd660d68c 100644
--- a/drivers/rtc/rtc-m41t80.c
+++ b/drivers/rtc/rtc-m41t80.c
@@ -397,10 +397,13 @@ static int m41t80_read_alarm(struct device *dev, struct rtc_wkalrm *alrm)
return 0;
}
-static struct rtc_class_ops m41t80_rtc_ops = {
+static const struct rtc_class_ops m41t80_rtc_ops = {
.read_time = m41t80_rtc_read_time,
.set_time = m41t80_rtc_set_time,
.proc = m41t80_rtc_proc,
+ .read_alarm = m41t80_read_alarm,
+ .set_alarm = m41t80_set_alarm,
+ .alarm_irq_enable = m41t80_alarm_irq_enable,
};
#ifdef CONFIG_PM_SLEEP
@@ -913,13 +916,10 @@ static int m41t80_probe(struct i2c_client *client,
wakeup_source = false;
}
}
- if (client->irq > 0 || wakeup_source) {
- m41t80_rtc_ops.read_alarm = m41t80_read_alarm;
- m41t80_rtc_ops.set_alarm = m41t80_set_alarm;
- m41t80_rtc_ops.alarm_irq_enable = m41t80_alarm_irq_enable;
- /* Enable the wakealarm */
+ if (client->irq > 0 || wakeup_source)
device_init_wakeup(&client->dev, true);
- }
+ else
+ clear_bit(RTC_FEATURE_ALARM, m41t80_data->rtc->features);
m41t80_data->rtc->ops = &m41t80_rtc_ops;
m41t80_data->rtc->range_min = RTC_TIMESTAMP_BEGIN_2000;
--
2.29.2
^ permalink raw reply related
* [PATCH 10/17] rtc: pcf85363: drop a struct rtc_class_ops
From: Alexandre Belloni @ 2021-01-10 23:17 UTC (permalink / raw)
To: linux-rtc, Alessandro Zummo, Alexandre Belloni
Cc: linuxppc-dev, linux-kernel, linux-arm-kernel
In-Reply-To: <20210110231752.1418816-1-alexandre.belloni@bootlin.com>
Merge both struct rtc_class_ops in a single one and use RTC_FEATURE_ALARM
to signal to the core whether alarms are available.
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
---
drivers/rtc/rtc-pcf85363.c | 8 ++------
1 file changed, 2 insertions(+), 6 deletions(-)
diff --git a/drivers/rtc/rtc-pcf85363.c b/drivers/rtc/rtc-pcf85363.c
index a574c8d15a5c..8c2dcbac0d7b 100644
--- a/drivers/rtc/rtc-pcf85363.c
+++ b/drivers/rtc/rtc-pcf85363.c
@@ -285,11 +285,6 @@ static irqreturn_t pcf85363_rtc_handle_irq(int irq, void *dev_id)
static const struct rtc_class_ops rtc_ops = {
.read_time = pcf85363_rtc_read_time,
.set_time = pcf85363_rtc_set_time,
-};
-
-static const struct rtc_class_ops rtc_ops_alarm = {
- .read_time = pcf85363_rtc_read_time,
- .set_time = pcf85363_rtc_set_time,
.read_alarm = pcf85363_rtc_read_alarm,
.set_alarm = pcf85363_rtc_set_alarm,
.alarm_irq_enable = pcf85363_rtc_alarm_irq_enable,
@@ -403,6 +398,7 @@ static int pcf85363_probe(struct i2c_client *client,
pcf85363->rtc->ops = &rtc_ops;
pcf85363->rtc->range_min = RTC_TIMESTAMP_BEGIN_2000;
pcf85363->rtc->range_max = RTC_TIMESTAMP_END_2099;
+ clear_bit(RTC_FEATURE_ALARM, pcf85363->rtc->features);
if (client->irq > 0) {
regmap_write(pcf85363->regmap, CTRL_FLAGS, 0);
@@ -415,7 +411,7 @@ static int pcf85363_probe(struct i2c_client *client,
if (ret)
dev_warn(&client->dev, "unable to request IRQ, alarms disabled\n");
else
- pcf85363->rtc->ops = &rtc_ops_alarm;
+ set_bit(RTC_FEATURE_ALARM, pcf85363->rtc->features);
}
ret = devm_rtc_register_device(pcf85363->rtc);
--
2.29.2
^ permalink raw reply related
* [PATCH 12/17] rtc: opal: constify opal_rtc_ops
From: Alexandre Belloni @ 2021-01-10 23:17 UTC (permalink / raw)
To: linux-rtc, Michael Ellerman, Benjamin Herrenschmidt,
Paul Mackerras, Alessandro Zummo, Alexandre Belloni
Cc: linuxppc-dev, linux-kernel, linux-arm-kernel
In-Reply-To: <20210110231752.1418816-1-alexandre.belloni@bootlin.com>
Use RTC_FEATURE_ALARM to signal to the core whether alarms are available
instead of changing the global struct rtc_class_ops, allowing to make it
const.
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
---
drivers/rtc/rtc-opal.c | 13 +++++++------
1 file changed, 7 insertions(+), 6 deletions(-)
diff --git a/drivers/rtc/rtc-opal.c b/drivers/rtc/rtc-opal.c
index c586f695bdc9..f8f49a969c23 100644
--- a/drivers/rtc/rtc-opal.c
+++ b/drivers/rtc/rtc-opal.c
@@ -224,9 +224,12 @@ static int opal_tpo_alarm_irq_enable(struct device *dev, unsigned int enabled)
return enabled ? 0 : opal_set_tpo_time(dev, &alarm);
}
-static struct rtc_class_ops opal_rtc_ops = {
+static const struct rtc_class_ops opal_rtc_ops = {
.read_time = opal_get_rtc_time,
.set_time = opal_set_rtc_time,
+ .read_alarm = opal_get_tpo_time,
+ .set_alarm = opal_set_tpo_time,
+ .alarm_irq_enable = opal_tpo_alarm_irq_enable,
};
static int opal_rtc_probe(struct platform_device *pdev)
@@ -239,12 +242,10 @@ static int opal_rtc_probe(struct platform_device *pdev)
if (pdev->dev.of_node &&
(of_property_read_bool(pdev->dev.of_node, "wakeup-source") ||
- of_property_read_bool(pdev->dev.of_node, "has-tpo")/* legacy */)) {
+ of_property_read_bool(pdev->dev.of_node, "has-tpo")/* legacy */))
device_set_wakeup_capable(&pdev->dev, true);
- opal_rtc_ops.read_alarm = opal_get_tpo_time;
- opal_rtc_ops.set_alarm = opal_set_tpo_time;
- opal_rtc_ops.alarm_irq_enable = opal_tpo_alarm_irq_enable;
- }
+ else
+ clear_bit(RTC_FEATURE_ALARM, rtc->features);
rtc->ops = &opal_rtc_ops;
rtc->range_min = RTC_TIMESTAMP_BEGIN_0000;
--
2.29.2
^ permalink raw reply related
* [PATCH 14/17] rtc: rv3029: constify rv3029_rtc_ops
From: Alexandre Belloni @ 2021-01-10 23:17 UTC (permalink / raw)
To: linux-rtc, Alessandro Zummo, Alexandre Belloni
Cc: linuxppc-dev, linux-kernel, linux-arm-kernel
In-Reply-To: <20210110231752.1418816-1-alexandre.belloni@bootlin.com>
Use RTC_FEATURE_ALARM to signal to the core whether alarms are available
instead of changing the global struct rtc_class_ops, allowing to make it
const.
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
---
drivers/rtc/rtc-rv3029c2.c | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/drivers/rtc/rtc-rv3029c2.c b/drivers/rtc/rtc-rv3029c2.c
index dc1bda62095e..c1f4c0bba1e5 100644
--- a/drivers/rtc/rtc-rv3029c2.c
+++ b/drivers/rtc/rtc-rv3029c2.c
@@ -694,10 +694,13 @@ static void rv3029_hwmon_register(struct device *dev, const char *name)
#endif /* CONFIG_RTC_DRV_RV3029_HWMON */
-static struct rtc_class_ops rv3029_rtc_ops = {
+static const struct rtc_class_ops rv3029_rtc_ops = {
.read_time = rv3029_read_time,
.set_time = rv3029_set_time,
.ioctl = rv3029_ioctl,
+ .read_alarm = rv3029_read_alarm,
+ .set_alarm = rv3029_set_alarm,
+ .alarm_irq_enable = rv3029_alarm_irq_enable,
};
static int rv3029_probe(struct device *dev, struct regmap *regmap, int irq,
@@ -739,12 +742,10 @@ static int rv3029_probe(struct device *dev, struct regmap *regmap, int irq,
if (rc) {
dev_warn(dev, "unable to request IRQ, alarms disabled\n");
rv3029->irq = 0;
- } else {
- rv3029_rtc_ops.read_alarm = rv3029_read_alarm;
- rv3029_rtc_ops.set_alarm = rv3029_set_alarm;
- rv3029_rtc_ops.alarm_irq_enable = rv3029_alarm_irq_enable;
}
}
+ if (!rv3029->irq)
+ clear_bit(RTC_FEATURE_ALARM, rv3029->rtc->features);
rv3029->rtc->ops = &rv3029_rtc_ops;
rv3029->rtc->range_min = RTC_TIMESTAMP_BEGIN_2000;
--
2.29.2
^ permalink raw reply related
* [PATCH 13/17] rtc: rv3028: constify rv3028_rtc_ops
From: Alexandre Belloni @ 2021-01-10 23:17 UTC (permalink / raw)
To: linux-rtc, Alessandro Zummo, Alexandre Belloni
Cc: linuxppc-dev, linux-kernel, linux-arm-kernel
In-Reply-To: <20210110231752.1418816-1-alexandre.belloni@bootlin.com>
Use RTC_FEATURE_ALARM to signal to the core whether alarms are available
instead of changing the global struct rtc_class_ops, allowing to make it
const.
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
---
drivers/rtc/rtc-rv3028.c | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/drivers/rtc/rtc-rv3028.c b/drivers/rtc/rtc-rv3028.c
index 979407a51c7a..2004f8c5397f 100644
--- a/drivers/rtc/rtc-rv3028.c
+++ b/drivers/rtc/rtc-rv3028.c
@@ -770,9 +770,12 @@ static int rv3028_clkout_register_clk(struct rv3028_data *rv3028,
}
#endif
-static struct rtc_class_ops rv3028_rtc_ops = {
+static const struct rtc_class_ops rv3028_rtc_ops = {
.read_time = rv3028_get_time,
.set_time = rv3028_set_time,
+ .read_alarm = rv3028_get_alarm,
+ .set_alarm = rv3028_set_alarm,
+ .alarm_irq_enable = rv3028_alarm_irq_enable,
.read_offset = rv3028_read_offset,
.set_offset = rv3028_set_offset,
.ioctl = rv3028_ioctl,
@@ -841,12 +844,10 @@ static int rv3028_probe(struct i2c_client *client)
if (ret) {
dev_warn(&client->dev, "unable to request IRQ, alarms disabled\n");
client->irq = 0;
- } else {
- rv3028_rtc_ops.read_alarm = rv3028_get_alarm;
- rv3028_rtc_ops.set_alarm = rv3028_set_alarm;
- rv3028_rtc_ops.alarm_irq_enable = rv3028_alarm_irq_enable;
}
}
+ if (!client->irq)
+ clear_bit(RTC_FEATURE_ALARM, rv3028->rtc->features);
ret = regmap_update_bits(rv3028->regmap, RV3028_CTRL1,
RV3028_CTRL1_WADA, RV3028_CTRL1_WADA);
--
2.29.2
^ permalink raw reply related
* [PATCH 15/17] rtc: rv3032: constify rv3032_rtc_ops
From: Alexandre Belloni @ 2021-01-10 23:17 UTC (permalink / raw)
To: linux-rtc, Alessandro Zummo, Alexandre Belloni
Cc: linuxppc-dev, linux-kernel, linux-arm-kernel
In-Reply-To: <20210110231752.1418816-1-alexandre.belloni@bootlin.com>
Use RTC_FEATURE_ALARM to signal to the core whether alarms are available
instead of changing the global struct rtc_class_ops, allowing to make it
const.
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
---
drivers/rtc/rtc-rv3032.c | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/drivers/rtc/rtc-rv3032.c b/drivers/rtc/rtc-rv3032.c
index c9bcea727757..5161016bce00 100644
--- a/drivers/rtc/rtc-rv3032.c
+++ b/drivers/rtc/rtc-rv3032.c
@@ -804,12 +804,15 @@ static void rv3032_hwmon_register(struct device *dev)
devm_hwmon_device_register_with_info(dev, "rv3032", rv3032, &rv3032_hwmon_chip_info, NULL);
}
-static struct rtc_class_ops rv3032_rtc_ops = {
+static const struct rtc_class_ops rv3032_rtc_ops = {
.read_time = rv3032_get_time,
.set_time = rv3032_set_time,
.read_offset = rv3032_read_offset,
.set_offset = rv3032_set_offset,
.ioctl = rv3032_ioctl,
+ .read_alarm = rv3032_get_alarm,
+ .set_alarm = rv3032_set_alarm,
+ .alarm_irq_enable = rv3032_alarm_irq_enable,
};
static const struct regmap_config regmap_config = {
@@ -868,12 +871,10 @@ static int rv3032_probe(struct i2c_client *client)
if (ret) {
dev_warn(&client->dev, "unable to request IRQ, alarms disabled\n");
client->irq = 0;
- } else {
- rv3032_rtc_ops.read_alarm = rv3032_get_alarm;
- rv3032_rtc_ops.set_alarm = rv3032_set_alarm;
- rv3032_rtc_ops.alarm_irq_enable = rv3032_alarm_irq_enable;
}
}
+ if (!client->irq)
+ clear_bit(RTC_FEATURE_ALARM, rv3032->rtc->features);
ret = regmap_update_bits(rv3032->regmap, RV3032_CTRL1,
RV3032_CTRL1_WADA, RV3032_CTRL1_WADA);
--
2.29.2
^ permalink raw reply related
* [PATCH 16/17] rtc: rv8803: constify rv8803_rtc_ops
From: Alexandre Belloni @ 2021-01-10 23:17 UTC (permalink / raw)
To: linux-rtc, Alessandro Zummo, Alexandre Belloni
Cc: linuxppc-dev, linux-kernel, linux-arm-kernel
In-Reply-To: <20210110231752.1418816-1-alexandre.belloni@bootlin.com>
Use RTC_FEATURE_ALARM to signal to the core whether alarms are available
instead of changing the global struct rtc_class_ops, allowing to make it
const.
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
---
drivers/rtc/rtc-rv8803.c | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/drivers/rtc/rtc-rv8803.c b/drivers/rtc/rtc-rv8803.c
index d4ea6db51b26..8821264e9385 100644
--- a/drivers/rtc/rtc-rv8803.c
+++ b/drivers/rtc/rtc-rv8803.c
@@ -471,10 +471,13 @@ static int rv8803_nvram_read(void *priv, unsigned int offset,
return 0;
}
-static struct rtc_class_ops rv8803_rtc_ops = {
+static const struct rtc_class_ops rv8803_rtc_ops = {
.read_time = rv8803_get_time,
.set_time = rv8803_set_time,
.ioctl = rv8803_ioctl,
+ .read_alarm = rv8803_get_alarm,
+ .set_alarm = rv8803_set_alarm,
+ .alarm_irq_enable = rv8803_alarm_irq_enable,
};
static int rx8900_trickle_charger_init(struct rv8803_data *rv8803)
@@ -567,12 +570,10 @@ static int rv8803_probe(struct i2c_client *client,
if (err) {
dev_warn(&client->dev, "unable to request IRQ, alarms disabled\n");
client->irq = 0;
- } else {
- rv8803_rtc_ops.read_alarm = rv8803_get_alarm;
- rv8803_rtc_ops.set_alarm = rv8803_set_alarm;
- rv8803_rtc_ops.alarm_irq_enable = rv8803_alarm_irq_enable;
}
}
+ if (!client->irq)
+ clear_bit(RTC_FEATURE_ALARM, rv8803->rtc->features);
err = rv8803_write_reg(rv8803->client, RV8803_EXT, RV8803_EXT_WADA);
if (err)
--
2.29.2
^ permalink raw reply related
* [PATCH 17/17] rtc: tps65910: remove tps65910_rtc_ops_noirq
From: Alexandre Belloni @ 2021-01-10 23:17 UTC (permalink / raw)
To: linux-rtc, Alessandro Zummo, Alexandre Belloni
Cc: linuxppc-dev, linux-kernel, linux-arm-kernel
In-Reply-To: <20210110231752.1418816-1-alexandre.belloni@bootlin.com>
Clear RTC_FEATURE_ALARM to signal that alarms are not available instead of
having a supplementary struct rtc_class_ops without alarm callbacks.
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
---
drivers/rtc/rtc-tps65910.c | 15 ++++-----------
1 file changed, 4 insertions(+), 11 deletions(-)
diff --git a/drivers/rtc/rtc-tps65910.c b/drivers/rtc/rtc-tps65910.c
index 2d87b62826a8..e1415a49f4ee 100644
--- a/drivers/rtc/rtc-tps65910.c
+++ b/drivers/rtc/rtc-tps65910.c
@@ -361,13 +361,6 @@ static const struct rtc_class_ops tps65910_rtc_ops = {
.set_offset = tps65910_set_offset,
};
-static const struct rtc_class_ops tps65910_rtc_ops_noirq = {
- .read_time = tps65910_rtc_read_time,
- .set_time = tps65910_rtc_set_time,
- .read_offset = tps65910_read_offset,
- .set_offset = tps65910_set_offset,
-};
-
static int tps65910_rtc_probe(struct platform_device *pdev)
{
struct tps65910 *tps65910 = NULL;
@@ -425,12 +418,12 @@ static int tps65910_rtc_probe(struct platform_device *pdev)
irq = -1;
tps_rtc->irq = irq;
- if (irq != -1) {
+ if (irq != -1)
device_set_wakeup_capable(&pdev->dev, 1);
- tps_rtc->rtc->ops = &tps65910_rtc_ops;
- } else
- tps_rtc->rtc->ops = &tps65910_rtc_ops_noirq;
+ else
+ clear_bit(RTC_FEATURE_ALARM, tps_rtc->rtc->features);
+ tps_rtc->rtc->ops = &tps65910_rtc_ops;
tps_rtc->rtc->range_min = RTC_TIMESTAMP_BEGIN_2000;
tps_rtc->rtc->range_max = RTC_TIMESTAMP_END_2099;
--
2.29.2
^ permalink raw reply related
* [PATCH] powerpc/64s: fix scv entry fallback flush vs interrupt
From: Nicholas Piggin @ 2021-01-11 6:24 UTC (permalink / raw)
To: linuxppc-dev
Cc: Tulio Magno Quites Machado Filho, Nicholas Piggin, Daniel Axtens
The L1D flush fallback functions are not recoverable vs interrupts,
yet the scv entry flush runs with MSR[EE]=1. This can result in a
timer (soft-NMI) or MCE or SRESET interrupt hitting here and overwriting
the EXRFI save area, which ends up corrupting userspace registers for
scv return.
Fix this by disabling RI and EE for the scv entry fallback flush.
Fixes: f79643787e0a0 ("powerpc/64s: flush L1D on kernel entry")
Cc: stable@vger.kernel.org # 5.9+ which also have flush L1D patch backport
Cc: Daniel Axtens <dja@axtens.net>
Reported-by: Tulio Magno Quites Machado Filho <tuliom@linux.ibm.com>
Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
---
This applies to stable kernels 5.9+ (with scv support), which have
backported commit f79643787e0a0 ("powerpc/64s: flush L1D on kernel entry")
which was upstreamed in 5.10 but was backported. Maybe only 5.10 if
there will be no more 5.9 kernels.
arch/powerpc/include/asm/exception-64s.h | 13 ++++++++++++
arch/powerpc/include/asm/feature-fixups.h | 10 ++++++++++
arch/powerpc/kernel/entry_64.S | 2 +-
arch/powerpc/kernel/exceptions-64s.S | 19 ++++++++++++++++++
arch/powerpc/kernel/vmlinux.lds.S | 7 +++++++
arch/powerpc/lib/feature-fixups.c | 24 ++++++++++++++++++++---
6 files changed, 71 insertions(+), 4 deletions(-)
diff --git a/arch/powerpc/include/asm/exception-64s.h b/arch/powerpc/include/asm/exception-64s.h
index 1d32b174ab6a..c1a8aac01cf9 100644
--- a/arch/powerpc/include/asm/exception-64s.h
+++ b/arch/powerpc/include/asm/exception-64s.h
@@ -63,6 +63,12 @@
nop; \
nop;
+#define SCV_ENTRY_FLUSH_SLOT \
+ SCV_ENTRY_FLUSH_FIXUP_SECTION; \
+ nop; \
+ nop; \
+ nop;
+
/*
* r10 must be free to use, r13 must be paca
*/
@@ -70,6 +76,13 @@
STF_ENTRY_BARRIER_SLOT; \
ENTRY_FLUSH_SLOT
+/*
+ * r10, ctr must be free to use, r13 must be paca
+ */
+#define SCV_INTERRUPT_TO_KERNEL \
+ STF_ENTRY_BARRIER_SLOT; \
+ SCV_ENTRY_FLUSH_SLOT
+
/*
* Macros for annotating the expected destination of (h)rfid
*
diff --git a/arch/powerpc/include/asm/feature-fixups.h b/arch/powerpc/include/asm/feature-fixups.h
index f6d2acb57425..ac605fc369c4 100644
--- a/arch/powerpc/include/asm/feature-fixups.h
+++ b/arch/powerpc/include/asm/feature-fixups.h
@@ -240,6 +240,14 @@ label##3: \
FTR_ENTRY_OFFSET 957b-958b; \
.popsection;
+#define SCV_ENTRY_FLUSH_FIXUP_SECTION \
+957: \
+ .pushsection __scv_entry_flush_fixup,"a"; \
+ .align 2; \
+958: \
+ FTR_ENTRY_OFFSET 957b-958b; \
+ .popsection;
+
#define RFI_FLUSH_FIXUP_SECTION \
951: \
.pushsection __rfi_flush_fixup,"a"; \
@@ -273,10 +281,12 @@ label##3: \
extern long stf_barrier_fallback;
extern long entry_flush_fallback;
+extern long scv_entry_flush_fallback;
extern long __start___stf_entry_barrier_fixup, __stop___stf_entry_barrier_fixup;
extern long __start___stf_exit_barrier_fixup, __stop___stf_exit_barrier_fixup;
extern long __start___uaccess_flush_fixup, __stop___uaccess_flush_fixup;
extern long __start___entry_flush_fixup, __stop___entry_flush_fixup;
+extern long __start___scv_entry_flush_fixup, __stop___scv_entry_flush_fixup;
extern long __start___rfi_flush_fixup, __stop___rfi_flush_fixup;
extern long __start___barrier_nospec_fixup, __stop___barrier_nospec_fixup;
extern long __start__btb_flush_fixup, __stop__btb_flush_fixup;
diff --git a/arch/powerpc/kernel/entry_64.S b/arch/powerpc/kernel/entry_64.S
index aa1af139d947..33ddfeef4fe9 100644
--- a/arch/powerpc/kernel/entry_64.S
+++ b/arch/powerpc/kernel/entry_64.S
@@ -75,7 +75,7 @@ BEGIN_FTR_SECTION
bne .Ltabort_syscall
END_FTR_SECTION_IFSET(CPU_FTR_TM)
#endif
- INTERRUPT_TO_KERNEL
+ SCV_INTERRUPT_TO_KERNEL
mr r10,r1
ld r1,PACAKSAVE(r13)
std r10,0(r1)
diff --git a/arch/powerpc/kernel/exceptions-64s.S b/arch/powerpc/kernel/exceptions-64s.S
index e02ad6fefa46..6e53f7638737 100644
--- a/arch/powerpc/kernel/exceptions-64s.S
+++ b/arch/powerpc/kernel/exceptions-64s.S
@@ -2993,6 +2993,25 @@ TRAMP_REAL_BEGIN(entry_flush_fallback)
ld r11,PACA_EXRFI+EX_R11(r13)
blr
+/*
+ * The SCV entry flush happens with interrupts enabled, so it must disable
+ * to prevent EXRFI being clobbered by NMIs (e.g., soft_nmi_common). r10
+ * (containing LR) does not need to be preserved here because scv entry
+ * puts 0 in the pt_regs, CTR can be clobbered for the same reason.
+ */
+TRAMP_REAL_BEGIN(scv_entry_flush_fallback)
+ li r10,0
+ mtmsrd r10,1
+ lbz r10,PACAIRQHAPPENED(r13)
+ ori r10,r10,PACA_IRQ_HARD_DIS
+ stb r10,PACAIRQHAPPENED(r13)
+ std r11,PACA_EXRFI+EX_R11(r13)
+ L1D_DISPLACEMENT_FLUSH
+ ld r11,PACA_EXRFI+EX_R11(r13)
+ li r10,MSR_RI
+ mtmsrd r10,1
+ blr
+
TRAMP_REAL_BEGIN(rfi_flush_fallback)
SET_SCRATCH0(r13);
GET_PACA(r13);
diff --git a/arch/powerpc/kernel/vmlinux.lds.S b/arch/powerpc/kernel/vmlinux.lds.S
index 0318ba436f34..377f5f8b1514 100644
--- a/arch/powerpc/kernel/vmlinux.lds.S
+++ b/arch/powerpc/kernel/vmlinux.lds.S
@@ -145,6 +145,13 @@ SECTIONS
__stop___entry_flush_fixup = .;
}
+ . = ALIGN(8);
+ __scv_entry_flush_fixup : AT(ADDR(__scv_entry_flush_fixup) - LOAD_OFFSET) {
+ __start___scv_entry_flush_fixup = .;
+ *(__scv_entry_flush_fixup)
+ __stop___scv_entry_flush_fixup = .;
+ }
+
. = ALIGN(8);
__stf_exit_barrier_fixup : AT(ADDR(__stf_exit_barrier_fixup) - LOAD_OFFSET) {
__start___stf_exit_barrier_fixup = .;
diff --git a/arch/powerpc/lib/feature-fixups.c b/arch/powerpc/lib/feature-fixups.c
index 47821055b94c..1fd31b4b0e13 100644
--- a/arch/powerpc/lib/feature-fixups.c
+++ b/arch/powerpc/lib/feature-fixups.c
@@ -290,9 +290,6 @@ void do_entry_flush_fixups(enum l1d_flush_type types)
long *start, *end;
int i;
- start = PTRRELOC(&__start___entry_flush_fixup);
- end = PTRRELOC(&__stop___entry_flush_fixup);
-
instrs[0] = 0x60000000; /* nop */
instrs[1] = 0x60000000; /* nop */
instrs[2] = 0x60000000; /* nop */
@@ -312,6 +309,8 @@ void do_entry_flush_fixups(enum l1d_flush_type types)
if (types & L1D_FLUSH_MTTRIG)
instrs[i++] = 0x7c12dba6; /* mtspr TRIG2,r0 (SPR #882) */
+ start = PTRRELOC(&__start___entry_flush_fixup);
+ end = PTRRELOC(&__stop___entry_flush_fixup);
for (i = 0; start < end; start++, i++) {
dest = (void *)start + *start;
@@ -328,6 +327,25 @@ void do_entry_flush_fixups(enum l1d_flush_type types)
patch_instruction((struct ppc_inst *)(dest + 2), ppc_inst(instrs[2]));
}
+ start = PTRRELOC(&__start___scv_entry_flush_fixup);
+ end = PTRRELOC(&__stop___scv_entry_flush_fixup);
+ for (; start < end; start++, i++) {
+ dest = (void *)start + *start;
+
+ pr_devel("patching dest %lx\n", (unsigned long)dest);
+
+ patch_instruction((struct ppc_inst *)dest, ppc_inst(instrs[0]));
+
+ if (types == L1D_FLUSH_FALLBACK)
+ patch_branch((struct ppc_inst *)(dest + 1), (unsigned long)&scv_entry_flush_fallback,
+ BRANCH_SET_LINK);
+ else
+ patch_instruction((struct ppc_inst *)(dest + 1), ppc_inst(instrs[1]));
+
+ patch_instruction((struct ppc_inst *)(dest + 2), ppc_inst(instrs[2]));
+ }
+
+
printk(KERN_DEBUG "entry-flush: patched %d locations (%s flush)\n", i,
(types == L1D_FLUSH_NONE) ? "no" :
(types == L1D_FLUSH_FALLBACK) ? "fallback displacement" :
--
2.23.0
^ permalink raw reply related
* Re: [PATCH v1 06/15] powerpc: Remove address and errorcode arguments from do_break()
From: Christophe Leroy @ 2021-01-11 6:57 UTC (permalink / raw)
To: Nicholas Piggin, Benjamin Herrenschmidt, Michael Ellerman,
Paul Mackerras
Cc: linuxppc-dev, linux-kernel
In-Reply-To: <1609039258.ijw9vns8wh.astroid@bobo.none>
Le 27/12/2020 à 04:25, Nicholas Piggin a écrit :
> Excerpts from Christophe Leroy's message of December 22, 2020 11:28 pm:
>> Let do_break() retrieve address and errorcode from regs.
>>
>> This simplifies the code and shouldn't impeed performance as
>> address and errorcode are likely still hot in the cache.
>>
>> Suggested-by: Nicholas Piggin <npiggin@gmail.com>
>> Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
>> ---
>> arch/powerpc/include/asm/debug.h | 3 +--
>> arch/powerpc/kernel/exceptions-64s.S | 2 --
>> arch/powerpc/kernel/head_8xx.S | 5 -----
>> arch/powerpc/kernel/process.c | 8 +++-----
>> 4 files changed, 4 insertions(+), 14 deletions(-)
>>
>> diff --git a/arch/powerpc/include/asm/debug.h b/arch/powerpc/include/asm/debug.h
>> index ec57daf87f40..0550eceab3ca 100644
>> --- a/arch/powerpc/include/asm/debug.h
>> +++ b/arch/powerpc/include/asm/debug.h
>> @@ -52,8 +52,7 @@ extern void do_send_trap(struct pt_regs *regs, unsigned long address,
>> unsigned long error_code, int brkpt);
>> #else
>>
>> -extern void do_break(struct pt_regs *regs, unsigned long address,
>> - unsigned long error_code);
>> +void do_break(struct pt_regs *regs);
>> #endif
>>
>> #endif /* _ASM_POWERPC_DEBUG_H */
>> diff --git a/arch/powerpc/kernel/exceptions-64s.S b/arch/powerpc/kernel/exceptions-64s.S
>> index cfbd1d690033..3ea067bcbb95 100644
>> --- a/arch/powerpc/kernel/exceptions-64s.S
>> +++ b/arch/powerpc/kernel/exceptions-64s.S
>> @@ -3262,8 +3262,6 @@ handle_page_fault:
>>
>> /* We have a data breakpoint exception - handle it */
>> handle_dabr_fault:
>> - ld r4,_DAR(r1)
>> - ld r5,_DSISR(r1)
>> addi r3,r1,STACK_FRAME_OVERHEAD
>> bl do_break
>> /*
>> diff --git a/arch/powerpc/kernel/head_8xx.S b/arch/powerpc/kernel/head_8xx.S
>> index 52702f3db6df..81f3c984f50c 100644
>> --- a/arch/powerpc/kernel/head_8xx.S
>> +++ b/arch/powerpc/kernel/head_8xx.S
>> @@ -364,11 +364,6 @@ do_databreakpoint:
>> addi r3,r1,STACK_FRAME_OVERHEAD
>> mfspr r4,SPRN_BAR
>> stw r4,_DAR(r11)
>> -#ifdef CONFIG_VMAP_STACK
>> - lwz r5,_DSISR(r11)
>> -#else
>> - mfspr r5,SPRN_DSISR
>> -#endif
>
> I didn't think you can do this (at leastuntil after your patch 10). I have my
> !VMAP path doing mfspr r5,DSISR ; stw r3,_DSISR(r11);
>
Yes you are right, I went too quick.
Christophe
^ permalink raw reply
* Re: [PATCH v2] powerpc: fix alignment bug whithin the init sections
From: Christophe Leroy @ 2021-01-11 7:06 UTC (permalink / raw)
To: Ariel Marcovitch, mpe
Cc: keescook, maskray, linux-kernel, npiggin, oss, paulus,
ariel.marcovitch, naveen.n.rao, linuxppc-dev, dja
In-Reply-To: <20210102201156.10805-1-ariel.marcovitch@gmail.com>
Le 02/01/2021 à 21:11, Ariel Marcovitch a écrit :
> This is a bug that causes early crashes in builds with a
> .exit.text section smaller than a page and a .init.text section that
> ends in the beginning of a physical page (this is kinda random, which
> might explain why this wasn't really encountered before).
>
> The init sections are ordered like this:
> .init.text
> .exit.text
> .init.data
>
> Currently, these sections aren't page aligned.
>
> Because the init code might become read-only at runtime and because the
> .init.text section can potentially reside on the same physical page as
> .init.data, the beginning of .init.data might be mapped read-only along
> with .init.text.
>
> Then when the kernel tries to modify a variable in .init.data (like
> kthreadd_done, used in kernel_init()) the kernel panics.
>
> To avoid this, make _einittext page aligned and also align .exit.text
> to make sure .init.data is always seperated from the text segments.
>
> Fixes: 060ef9d89d18 ("powerpc32: PAGE_EXEC required for inittext")
> Signed-off-by: Ariel Marcovitch <ariel.marcovitch@gmail.com>
Reviewed-by: Christophe Leroy <christophe.leroy@csgroup.eu>
> ---
> arch/powerpc/kernel/vmlinux.lds.S | 7 +++++++
> 1 file changed, 7 insertions(+)
>
> diff --git a/arch/powerpc/kernel/vmlinux.lds.S b/arch/powerpc/kernel/vmlinux.lds.S
> index 6db90cdf11da..b6c765d8e7ee 100644
> --- a/arch/powerpc/kernel/vmlinux.lds.S
> +++ b/arch/powerpc/kernel/vmlinux.lds.S
> @@ -187,6 +187,11 @@ SECTIONS
> .init.text : AT(ADDR(.init.text) - LOAD_OFFSET) {
> _sinittext = .;
> INIT_TEXT
> +
> + /* .init.text might be RO so we must
> + * ensure this section ends in a page boundary.
> + */
> + . = ALIGN(PAGE_SIZE);
> _einittext = .;
> #ifdef CONFIG_PPC64
> *(.tramp.ftrace.init);
> @@ -200,6 +205,8 @@ SECTIONS
> EXIT_TEXT
> }
>
> + . = ALIGN(PAGE_SIZE);
> +
> .init.data : AT(ADDR(.init.data) - LOAD_OFFSET) {
> INIT_DATA
> }
>
> base-commit: 2c85ebc57b3e1817b6ce1a6b703928e113a90442
>
^ permalink raw reply
* [PATCH 0/3] Retire remaining WindRiver embedded SBC BSPs
From: Paul Gortmaker @ 2021-01-11 8:28 UTC (permalink / raw)
To: linuxppc-dev; +Cc: linux-kernel, Scott Wood, Paul Gortmaker, Paul Mackerras
In v2.6.27 (2008, 917f0af9e5a9) the sbc8260 support was implicitly
retired by not being carried forward through the ppc --> powerpc
device tree transition.
Then, in v3.6 (2012, b048b4e17cbb) we retired the support for the
sbc8560 boards.
Next, in v4.18 (2017, 3bc6cf5a86e5) we retired the support for the
2006 vintage sbc834x boards.
The sbc8548 and sbc8641d boards were maybe 1-2 years newer than the
sbc834x boards, but it is also 3+ years later, so it makes sense to
now retire them as well - which is what is done here.
These two remaining WR boards were based on the Freescale MPC8548-CDS
and the MPC8641D-HPCN reference board implementations. Having had the
chance to use these and many other Fsl ref boards, I know this: The
Freescale reference boards were typically produced in limited quantity
and primarily available to BSP developers and hardware designers, and
not likely to have found a 2nd life with hobbyists and/or collectors.
It was good to have that BSP code subjected to mainline review and
hence also widely available back in the day. But given the above, we
should probably also be giving serious consideration to retiring
additional similar age/type reference board platforms as well.
I've always felt it is important for us to be proactive in retiring
old code, since it has a genuine non-zero carrying cost, as described
in the 930d52c012b8 merge log. But for the here and now, we just
clean up the remaining BSP code that I had added for SBC platforms.
Paul.
--
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Scott Wood <oss@buserror.net>
The following changes since commit 7c53f6b671f4aba70ff15e1b05148b10d58c2837:
Linux 5.11-rc3 (2021-01-10 14:34:50 -0800)
are available in the Git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/paulg/linux.git wr_sbc-delete
for you to fetch changes up to 1dfb28199572e3f6517cada41f6a150551749da1:
MAINTAINERS: update for Paul Gortmaker (2021-01-11 00:06:01 -0500)
----------------------------------------------------------------
Paul Gortmaker (3):
powerpc: retire sbc8548 board support
powerpc: retire sbc8641d board support
MAINTAINERS: update for Paul Gortmaker
MAINTAINERS | 1 -
arch/powerpc/boot/Makefile | 1 -
arch/powerpc/boot/dts/fsl/sbc8641d.dts | 176 -----------------
arch/powerpc/boot/dts/sbc8548-altflash.dts | 111 -----------
arch/powerpc/boot/dts/sbc8548-post.dtsi | 289 ----------------------------
arch/powerpc/boot/dts/sbc8548-pre.dtsi | 48 -----
arch/powerpc/boot/dts/sbc8548.dts | 106 ----------
arch/powerpc/boot/wrapper | 2 +-
arch/powerpc/configs/85xx/sbc8548_defconfig | 50 -----
arch/powerpc/configs/mpc85xx_base.config | 1 -
arch/powerpc/configs/mpc86xx_base.config | 1 -
arch/powerpc/configs/ppc6xx_defconfig | 1 -
arch/powerpc/platforms/85xx/Kconfig | 6 -
arch/powerpc/platforms/85xx/Makefile | 1 -
arch/powerpc/platforms/85xx/sbc8548.c | 134 -------------
arch/powerpc/platforms/86xx/Kconfig | 8 +-
arch/powerpc/platforms/86xx/Makefile | 1 -
arch/powerpc/platforms/86xx/sbc8641d.c | 87 ---------
18 files changed, 2 insertions(+), 1022 deletions(-)
delete mode 100644 arch/powerpc/boot/dts/fsl/sbc8641d.dts
delete mode 100644 arch/powerpc/boot/dts/sbc8548-altflash.dts
delete mode 100644 arch/powerpc/boot/dts/sbc8548-post.dtsi
delete mode 100644 arch/powerpc/boot/dts/sbc8548-pre.dtsi
delete mode 100644 arch/powerpc/boot/dts/sbc8548.dts
delete mode 100644 arch/powerpc/configs/85xx/sbc8548_defconfig
delete mode 100644 arch/powerpc/platforms/85xx/sbc8548.c
delete mode 100644 arch/powerpc/platforms/86xx/sbc8641d.c
^ permalink raw reply
* [PATCH 3/3] MAINTAINERS: update for Paul Gortmaker
From: Paul Gortmaker @ 2021-01-11 8:28 UTC (permalink / raw)
To: linuxppc-dev; +Cc: Paul Gortmaker, linux-kernel
In-Reply-To: <20210111082823.99562-1-paul.gortmaker@windriver.com>
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
---
MAINTAINERS | 1 -
1 file changed, 1 deletion(-)
diff --git a/MAINTAINERS b/MAINTAINERS
index cc1e6a5ee6e6..c5f5cdb24674 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -6529,7 +6529,6 @@ F: Documentation/admin-guide/media/em28xx*
F: drivers/media/usb/em28xx/
EMBEDDED LINUX
-M: Paul Gortmaker <paul.gortmaker@windriver.com>
M: Matt Mackall <mpm@selenic.com>
M: David Woodhouse <dwmw2@infradead.org>
L: linux-embedded@vger.kernel.org
--
2.17.1
^ permalink raw reply related
* [PATCH 2/3] powerpc: retire sbc8641d board support
From: Paul Gortmaker @ 2021-01-11 8:28 UTC (permalink / raw)
To: linuxppc-dev; +Cc: Paul Gortmaker, linux-kernel, Paul Mackerras
In-Reply-To: <20210111082823.99562-1-paul.gortmaker@windriver.com>
The support was for this was added to mainline over 12 years ago, in
v2.6.26 [4e8aae89a35d] just around the ppc --> powerpc migration.
I believe the board was introduced shortly after the sbc8548 board,
making it roughly a 14 year old platform - with the CPU speed and
memory size typical for that era.
I haven't had one of these boards for several years, and availability
was discontinued several years before that.
Given that, there is no point in adding a burden to testing coverage
that builds all possible defconfigs, so it makes sense to remove it.
Of course it will remain in the git history forever, for anyone who
happens to find a functional board and wants to tinker with it.
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Paul Mackerras <paulus@samba.org>
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
---
arch/powerpc/boot/dts/fsl/sbc8641d.dts | 176 -----------------------
arch/powerpc/configs/mpc86xx_base.config | 1 -
arch/powerpc/configs/ppc6xx_defconfig | 1 -
arch/powerpc/platforms/86xx/Kconfig | 8 +-
arch/powerpc/platforms/86xx/Makefile | 1 -
arch/powerpc/platforms/86xx/sbc8641d.c | 87 -----------
6 files changed, 1 insertion(+), 273 deletions(-)
delete mode 100644 arch/powerpc/boot/dts/fsl/sbc8641d.dts
delete mode 100644 arch/powerpc/platforms/86xx/sbc8641d.c
diff --git a/arch/powerpc/boot/dts/fsl/sbc8641d.dts b/arch/powerpc/boot/dts/fsl/sbc8641d.dts
deleted file mode 100644
index 3dca10acc161..000000000000
--- a/arch/powerpc/boot/dts/fsl/sbc8641d.dts
+++ /dev/null
@@ -1,176 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * SBC8641D Device Tree Source
- *
- * Copyright 2008 Wind River Systems Inc.
- *
- * Paul Gortmaker (see MAINTAINERS for contact information)
- *
- * Based largely on the mpc8641_hpcn.dts by Freescale Semiconductor Inc.
- */
-
-/include/ "mpc8641si-pre.dtsi"
-
-/ {
- model = "SBC8641D";
- compatible = "wind,sbc8641";
-
- memory {
- device_type = "memory";
- reg = <0x00000000 0x20000000>; // 512M at 0x0
- };
-
- lbc: localbus@f8005000 {
- reg = <0xf8005000 0x1000>;
-
- ranges = <0 0 0xff000000 0x01000000 // 16MB Boot flash
- 1 0 0xf0000000 0x00010000 // 64KB EEPROM
- 2 0 0xf1000000 0x00100000 // EPLD (1MB)
- 3 0 0xe0000000 0x04000000 // 64MB LB SDRAM (CS3)
- 4 0 0xe4000000 0x04000000 // 64MB LB SDRAM (CS4)
- 6 0 0xf4000000 0x00100000 // LCD display (1MB)
- 7 0 0xe8000000 0x04000000>; // 64MB OneNAND
-
- flash@0,0 {
- compatible = "cfi-flash";
- reg = <0 0 0x01000000>;
- bank-width = <2>;
- device-width = <2>;
- #address-cells = <1>;
- #size-cells = <1>;
- partition@0 {
- label = "dtb";
- reg = <0x00000000 0x00100000>;
- read-only;
- };
- partition@300000 {
- label = "kernel";
- reg = <0x00100000 0x00400000>;
- read-only;
- };
- partition@400000 {
- label = "fs";
- reg = <0x00500000 0x00a00000>;
- };
- partition@700000 {
- label = "firmware";
- reg = <0x00f00000 0x00100000>;
- read-only;
- };
- };
-
- epld@2,0 {
- compatible = "wrs,epld-localbus";
- #address-cells = <2>;
- #size-cells = <1>;
- reg = <2 0 0x100000>;
- ranges = <0 0 5 0 1 // User switches
- 1 0 5 1 1 // Board ID/Rev
- 3 0 5 3 1>; // LEDs
- };
- };
-
- soc: soc@f8000000 {
- ranges = <0x00000000 0xf8000000 0x00100000>;
-
- enet0: ethernet@24000 {
- tbi-handle = <&tbi0>;
- phy-handle = <&phy0>;
- phy-connection-type = "rgmii-id";
- };
-
- mdio@24520 {
- phy0: ethernet-phy@1f {
- reg = <0x1f>;
- };
- phy1: ethernet-phy@0 {
- reg = <0>;
- };
- phy2: ethernet-phy@1 {
- reg = <1>;
- };
- phy3: ethernet-phy@2 {
- reg = <2>;
- };
- tbi0: tbi-phy@11 {
- reg = <0x11>;
- device_type = "tbi-phy";
- };
- };
-
- enet1: ethernet@25000 {
- tbi-handle = <&tbi1>;
- phy-handle = <&phy1>;
- phy-connection-type = "rgmii-id";
- };
-
- mdio@25520 {
- tbi1: tbi-phy@11 {
- reg = <0x11>;
- device_type = "tbi-phy";
- };
- };
-
- enet2: ethernet@26000 {
- tbi-handle = <&tbi2>;
- phy-handle = <&phy2>;
- phy-connection-type = "rgmii-id";
- };
-
- mdio@26520 {
- tbi2: tbi-phy@11 {
- reg = <0x11>;
- device_type = "tbi-phy";
- };
- };
-
- enet3: ethernet@27000 {
- tbi-handle = <&tbi3>;
- phy-handle = <&phy3>;
- phy-connection-type = "rgmii-id";
- };
-
- mdio@27520 {
- tbi3: tbi-phy@11 {
- reg = <0x11>;
- device_type = "tbi-phy";
- };
- };
- };
-
- pci0: pcie@f8008000 {
- reg = <0xf8008000 0x1000>;
- ranges = <0x02000000 0x0 0x80000000 0x80000000 0x0 0x20000000
- 0x01000000 0x0 0x00000000 0xe2000000 0x0 0x00100000>;
- interrupt-map-mask = <0xff00 0 0 7>;
-
- pcie@0 {
- ranges = <0x02000000 0x0 0x80000000
- 0x02000000 0x0 0x80000000
- 0x0 0x20000000
-
- 0x01000000 0x0 0x00000000
- 0x01000000 0x0 0x00000000
- 0x0 0x00100000>;
- };
-
- };
-
- pci1: pcie@f8009000 {
- reg = <0xf8009000 0x1000>;
- ranges = <0x02000000 0x0 0xa0000000 0xa0000000 0x0 0x20000000
- 0x01000000 0x0 0x00000000 0xe3000000 0x0 0x00100000>;
-
- pcie@0 {
- ranges = <0x02000000 0x0 0xa0000000
- 0x02000000 0x0 0xa0000000
- 0x0 0x20000000
-
- 0x01000000 0x0 0x00000000
- 0x01000000 0x0 0x00000000
- 0x0 0x00100000>;
- };
- };
-};
-
-/include/ "mpc8641si-post.dtsi"
diff --git a/arch/powerpc/configs/mpc86xx_base.config b/arch/powerpc/configs/mpc86xx_base.config
index 67bd1fa036ee..588870e6af3b 100644
--- a/arch/powerpc/configs/mpc86xx_base.config
+++ b/arch/powerpc/configs/mpc86xx_base.config
@@ -1,6 +1,5 @@
CONFIG_PPC_86xx=y
CONFIG_MPC8641_HPCN=y
-CONFIG_SBC8641D=y
CONFIG_MPC8610_HPCD=y
CONFIG_GEF_PPC9A=y
CONFIG_GEF_SBC310=y
diff --git a/arch/powerpc/configs/ppc6xx_defconfig b/arch/powerpc/configs/ppc6xx_defconfig
index ef09f3cce1fa..e5823a8bf856 100644
--- a/arch/powerpc/configs/ppc6xx_defconfig
+++ b/arch/powerpc/configs/ppc6xx_defconfig
@@ -56,7 +56,6 @@ CONFIG_MPC837x_RDB=y
CONFIG_ASP834x=y
CONFIG_PPC_86xx=y
CONFIG_MPC8641_HPCN=y
-CONFIG_SBC8641D=y
CONFIG_MPC8610_HPCD=y
CONFIG_GEF_SBC610=y
CONFIG_CPU_FREQ=y
diff --git a/arch/powerpc/platforms/86xx/Kconfig b/arch/powerpc/platforms/86xx/Kconfig
index 07a9d60c618a..be867abebc83 100644
--- a/arch/powerpc/platforms/86xx/Kconfig
+++ b/arch/powerpc/platforms/86xx/Kconfig
@@ -20,12 +20,6 @@ config MPC8641_HPCN
help
This option enables support for the MPC8641 HPCN board.
-config SBC8641D
- bool "Wind River SBC8641D"
- select DEFAULT_UIMAGE
- help
- This option enables support for the WRS SBC8641D board.
-
config MPC8610_HPCD
bool "Freescale MPC8610 HPCD"
select DEFAULT_UIMAGE
@@ -74,7 +68,7 @@ config MPC8641
select FSL_PCI if PCI
select PPC_UDBG_16550
select MPIC
- default y if MPC8641_HPCN || SBC8641D || GEF_SBC610 || GEF_SBC310 || GEF_PPC9A \
+ default y if MPC8641_HPCN || GEF_SBC610 || GEF_SBC310 || GEF_PPC9A \
|| MVME7100
config MPC8610
diff --git a/arch/powerpc/platforms/86xx/Makefile b/arch/powerpc/platforms/86xx/Makefile
index 2c04449be107..5bbe1475bf26 100644
--- a/arch/powerpc/platforms/86xx/Makefile
+++ b/arch/powerpc/platforms/86xx/Makefile
@@ -6,7 +6,6 @@
obj-y := pic.o common.o
obj-$(CONFIG_SMP) += mpc86xx_smp.o
obj-$(CONFIG_MPC8641_HPCN) += mpc86xx_hpcn.o
-obj-$(CONFIG_SBC8641D) += sbc8641d.o
obj-$(CONFIG_MPC8610_HPCD) += mpc8610_hpcd.o
obj-$(CONFIG_GEF_SBC610) += gef_sbc610.o
obj-$(CONFIG_GEF_SBC310) += gef_sbc310.o
diff --git a/arch/powerpc/platforms/86xx/sbc8641d.c b/arch/powerpc/platforms/86xx/sbc8641d.c
deleted file mode 100644
index dc23dd383d6e..000000000000
--- a/arch/powerpc/platforms/86xx/sbc8641d.c
+++ /dev/null
@@ -1,87 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * SBC8641D board specific routines
- *
- * Copyright 2008 Wind River Systems Inc.
- *
- * By Paul Gortmaker (see MAINTAINERS for contact information)
- *
- * Based largely on the 8641 HPCN support by Freescale Semiconductor Inc.
- */
-
-#include <linux/stddef.h>
-#include <linux/kernel.h>
-#include <linux/pci.h>
-#include <linux/kdev_t.h>
-#include <linux/delay.h>
-#include <linux/seq_file.h>
-#include <linux/of_platform.h>
-
-#include <asm/time.h>
-#include <asm/machdep.h>
-#include <asm/pci-bridge.h>
-#include <asm/prom.h>
-#include <mm/mmu_decl.h>
-#include <asm/udbg.h>
-
-#include <asm/mpic.h>
-
-#include <sysdev/fsl_pci.h>
-#include <sysdev/fsl_soc.h>
-
-#include "mpc86xx.h"
-
-static void __init
-sbc8641_setup_arch(void)
-{
- if (ppc_md.progress)
- ppc_md.progress("sbc8641_setup_arch()", 0);
-
- printk("SBC8641 board from Wind River\n");
-
-#ifdef CONFIG_SMP
- mpc86xx_smp_init();
-#endif
-
- fsl_pci_assign_primary();
-}
-
-
-static void
-sbc8641_show_cpuinfo(struct seq_file *m)
-{
- uint svid = mfspr(SPRN_SVR);
-
- seq_printf(m, "Vendor\t\t: Wind River Systems\n");
-
- seq_printf(m, "SVR\t\t: 0x%x\n", svid);
-}
-
-
-/*
- * Called very early, device-tree isn't unflattened
- */
-static int __init sbc8641_probe(void)
-{
- if (of_machine_is_compatible("wind,sbc8641"))
- return 1; /* Looks good */
-
- return 0;
-}
-
-machine_arch_initcall(sbc8641, mpc86xx_common_publish_devices);
-
-define_machine(sbc8641) {
- .name = "SBC8641D",
- .probe = sbc8641_probe,
- .setup_arch = sbc8641_setup_arch,
- .init_IRQ = mpc86xx_init_irq,
- .show_cpuinfo = sbc8641_show_cpuinfo,
- .get_irq = mpic_get_irq,
- .time_init = mpc86xx_time_init,
- .calibrate_decr = generic_calibrate_decr,
- .progress = udbg_progress,
-#ifdef CONFIG_PCI
- .pcibios_fixup_bus = fsl_pcibios_fixup_bus,
-#endif
-};
--
2.17.1
^ permalink raw reply related
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox