* [U-Boot] [PATCH v2 0/2] Update RV3029 driver to DM and add DM-backed bootcount support
@ 2018-11-27 22:00 Philipp Tomsich
2018-11-27 22:00 ` [U-Boot] [PATCH v2 1/2] bootcount: add uclass for bootcount Philipp Tomsich
` (2 more replies)
0 siblings, 3 replies; 12+ messages in thread
From: Philipp Tomsich @ 2018-11-27 22:00 UTC (permalink / raw)
To: u-boot
On one of our application-specific carrier boards, a MicroCrystal
RV3029 acts as an off-module battery-backed RTC for the RK3399-Q7.
The RV3029 is intended both to provide RTC services (to Linux) and
to store the bootcount in its battery-backed SRAM section.
To support this use-case, this series adds the following:
* replaces the existing RV3029 driver by a DM-based one (note that the
existing driver appears unused and didn't even have a Kconfig entry)
that closely mirrors its incarnation in Linux 4.17
* adds a bootcount-method interfacing back into DM devices (implementing
support for the RTC uclass as of now).
Changes in v2:
- changed to provide a UCLASS-based implementation, as requested by
SJG in his earlier review
- split off the RV3029 driver into a separate series
Philipp Tomsich (2):
bootcount: add uclass for bootcount
bootcount: add a DM RTC backing store for bootcount
doc/device-tree-bindings/chosen.txt | 30 ++++++++++++
drivers/bootcount/Kconfig | 28 +++++++++++
drivers/bootcount/Makefile | 3 ++
drivers/bootcount/bootcount-uclass.c | 93 ++++++++++++++++++++++++++++++++++++
drivers/bootcount/rtc.c | 89 ++++++++++++++++++++++++++++++++++
include/bootcount.h | 48 +++++++++++++++++++
include/dm/uclass-id.h | 1 +
7 files changed, 292 insertions(+)
create mode 100644 drivers/bootcount/bootcount-uclass.c
create mode 100644 drivers/bootcount/rtc.c
--
2.1.4
^ permalink raw reply [flat|nested] 12+ messages in thread
* [U-Boot] [PATCH v2 1/2] bootcount: add uclass for bootcount
2018-11-27 22:00 [U-Boot] [PATCH v2 0/2] Update RV3029 driver to DM and add DM-backed bootcount support Philipp Tomsich
@ 2018-11-27 22:00 ` Philipp Tomsich
2018-12-10 0:01 ` [U-Boot] [U-Boot,v2,1/2] " Philipp Tomsich
2018-12-11 1:07 ` [U-Boot] [PATCH v2 1/2] " Simon Glass
2018-11-27 22:00 ` [U-Boot] [PATCH v2 2/2] bootcount: add a DM RTC backing store " Philipp Tomsich
2018-11-28 6:29 ` [U-Boot] EXT: [PATCH v2 0/2] Update RV3029 driver to DM and add DM-backed bootcount support Ray, Ian
2 siblings, 2 replies; 12+ messages in thread
From: Philipp Tomsich @ 2018-11-27 22:00 UTC (permalink / raw)
To: u-boot
The original bootcount methods do not provide an interface to DM and
rely on a static configuration for I2C devices (e.g. bus, chip-addr,
etc. are configured through defines statically). On a modern system
that exposes multiple devices in a DTS-configurable way, this is less
than optimal and a interface to DM-based devices will be desirable.
This adds a simple driver that is DM-aware and configurable via DTS.
If ambiguous (i.e. multiple bootcount-devices are present) the
/chosen/u-boot,bootcount-device property can be used to select one
bootcount device.
Initially, this provides support for the following DM devices:
* RTC devices
Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Tested-by: Klaus Goger <klaus.goger@theobroma-systems.com>
---
Changes in v2:
- changed to provide a UCLASS-based implementation, as requested by
SJG in his earlier review
- split off the RV3029 driver into a separate series
doc/device-tree-bindings/chosen.txt | 30 ++++++++++++
drivers/bootcount/Kconfig | 8 ++++
drivers/bootcount/Makefile | 2 +
drivers/bootcount/bootcount-uclass.c | 93 ++++++++++++++++++++++++++++++++++++
include/bootcount.h | 48 +++++++++++++++++++
include/dm/uclass-id.h | 1 +
6 files changed, 182 insertions(+)
create mode 100644 drivers/bootcount/bootcount-uclass.c
diff --git a/doc/device-tree-bindings/chosen.txt b/doc/device-tree-bindings/chosen.txt
index 86c533a..395c950 100644
--- a/doc/device-tree-bindings/chosen.txt
+++ b/doc/device-tree-bindings/chosen.txt
@@ -42,6 +42,36 @@ Example
};
};
+u-boot,bootcount-device property
+--------------------------------
+
+In a DM-based system, the bootcount may be stored in a device known to
+the DM framework (e.g. in a battery-backed SRAM area within a RTC
+device) managed by a device conforming to UCLASS_BOOTCOUNT. If
+multiple such devices are present in a system concurrently, then the
+u-boot,bootcount-device property can select the preferred target.
+
+Example
+-------
+/ {
+ chosen {
+ u-boot,bootcount-device = &bootcount-rv3029;
+ };
+
+ bootcount-rv3029: bootcount at 0 {
+ compatible = "u-boot,bootcount-rtc";
+ rtc = &rv3029;
+ offset = <0x38>;
+ };
+
+ i2c2 {
+ rv3029: rtc at 56 {
+ compatible = "mc,rv3029";
+ reg = <0x56>;
+ };
+ };
+};
+
u-boot,spl-boot-order property
------------------------------
diff --git a/drivers/bootcount/Kconfig b/drivers/bootcount/Kconfig
index 6703363..46571eb 100644
--- a/drivers/bootcount/Kconfig
+++ b/drivers/bootcount/Kconfig
@@ -70,6 +70,14 @@ config BOOTCOUNT_AT91
bool "Boot counter for Atmel AT91SAM9XE"
depends on AT91SAM9XE
+config DM_BOOTCOUNT
+ bool "Boot counter in a device-model device"
+ help
+ Enables reading/writing the bootcount in a device-model based
+ backing store. If an entry in /chosen/u-boot,bootcount-device
+ exists, this will be the preferred bootcount device; otherwise
+ the first available bootcount device will be used.
+
endchoice
config BOOTCOUNT_BOOTLIMIT
diff --git a/drivers/bootcount/Makefile b/drivers/bootcount/Makefile
index 68bc006..81980b3 100644
--- a/drivers/bootcount/Makefile
+++ b/drivers/bootcount/Makefile
@@ -7,3 +7,5 @@ obj-$(CONFIG_BOOTCOUNT_RAM) += bootcount_ram.o
obj-$(CONFIG_BOOTCOUNT_ENV) += bootcount_env.o
obj-$(CONFIG_BOOTCOUNT_I2C) += bootcount_i2c.o
obj-$(CONFIG_BOOTCOUNT_EXT) += bootcount_ext.o
+
+obj-$(CONFIG_DM_BOOTCOUNT) += bootcount-uclass.o
diff --git a/drivers/bootcount/bootcount-uclass.c b/drivers/bootcount/bootcount-uclass.c
new file mode 100644
index 0000000..0689db7
--- /dev/null
+++ b/drivers/bootcount/bootcount-uclass.c
@@ -0,0 +1,93 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * (C) Copyright 2018 Theobroma Systems Design und Consulting GmbH
+ */
+
+#include <common.h>
+#include <dm.h>
+#include <errno.h>
+#include <bootcount.h>
+
+int dm_bootcount_get(struct udevice *dev, u32 *bootcount)
+{
+ struct bootcount_ops *ops = bootcount_get_ops(dev);
+
+ assert(ops);
+ if (!ops->get)
+ return -ENOSYS;
+ return ops->get(dev, bootcount);
+}
+
+int dm_bootcount_set(struct udevice *dev, const u32 bootcount)
+{
+ struct bootcount_ops *ops = bootcount_get_ops(dev);
+
+ assert(ops);
+ if (!ops->set)
+ return -ENOSYS;
+ return ops->set(dev, bootcount);
+}
+
+/* Now implement the generic default functions */
+void bootcount_store(ulong val)
+{
+ struct udevice *dev = NULL;
+ ofnode node;
+ const char *propname = "u-boot,bootcount-device";
+ int ret = -ENODEV;
+
+ /*
+ * If there's a preferred bootcount device selected by the user (by
+ * setting '/chosen/u-boot,bootcount-device' in the DTS), try to use
+ * it if available.
+ */
+ node = ofnode_get_chosen_node(propname);
+ if (ofnode_valid(node))
+ ret = uclass_get_device_by_ofnode(UCLASS_BOOTCOUNT, node, &dev);
+
+ /* If there was no user-selected device, use the first available one */
+ if (ret)
+ ret = uclass_get_device(UCLASS_BOOTCOUNT, 0, &dev);
+
+ if (dev)
+ ret = dm_bootcount_set(dev, val);
+
+ if (ret)
+ pr_debug("%s: failed to store 0x%lx\n", __func__, val);
+}
+
+ulong bootcount_load(void)
+{
+ struct udevice *dev = NULL;
+ ofnode node;
+ const char *propname = "u-boot,bootcount-device";
+ int ret = -ENODEV;
+ u32 val;
+
+ /*
+ * If there's a preferred bootcount device selected by the user (by
+ * setting '/chosen/u-boot,bootcount-device' in the DTS), try to use
+ * it if available.
+ */
+ node = ofnode_get_chosen_node(propname);
+ if (ofnode_valid(node))
+ ret = uclass_get_device_by_ofnode(UCLASS_BOOTCOUNT, node, &dev);
+
+ /* If there was no user-selected device, use the first available one */
+ if (ret)
+ ret = uclass_get_device(UCLASS_BOOTCOUNT, 0, &dev);
+
+ if (dev)
+ ret = dm_bootcount_get(dev, &val);
+
+ if (ret)
+ pr_debug("%s: failed to load bootcount\n", __func__);
+
+ /* Return the 0, if the call to dm_bootcount_get failed */
+ return ret ? 0 : val;
+}
+
+UCLASS_DRIVER(bootcount) = {
+ .name = "bootcount",
+ .id = UCLASS_BOOTCOUNT,
+};
diff --git a/include/bootcount.h b/include/bootcount.h
index 671adcc..daee843 100644
--- a/include/bootcount.h
+++ b/include/bootcount.h
@@ -10,6 +10,54 @@
#include <asm/io.h>
#include <asm/byteorder.h>
+#ifdef CONFIG_DM_BOOTCOUNT
+
+struct bootcount_ops {
+ /**
+ * get() - get the current bootcount value
+ *
+ * Returns the current counter value of the bootcount backing
+ * store.
+ *
+ * @dev: Device to read from
+ * @bootcount: Address to put the current bootcount value
+ */
+ int (*get)(struct udevice *dev, u32 *bootcount);
+
+ /**
+ * set() - set a bootcount value (e.g. to reset or increment)
+ *
+ * Sets the value in the bootcount backing store.
+ *
+ * @dev: Device to read from
+ * @bootcount: New bootcount value to store
+ */
+ int (*set)(struct udevice *dev, const u32 bootcount);
+};
+
+/* Access the operations for a bootcount device */
+#define bootcount_get_ops(dev) ((struct bootcount_ops *)(dev)->driver->ops)
+
+/**
+ * dm_bootcount_get() - Read the current value from a bootcount storage
+ *
+ * @dev: Device to read from
+ * @bootcount: Place to put the current bootcount
+ * @return 0 if OK, -ve on error
+ */
+int dm_bootcount_get(struct udevice *dev, u32 *bootcount);
+
+/**
+ * dm_bootcount_set() - Write a value to a bootcount storage
+ *
+ * @dev: Device to read from
+ * @bootcount: Value to be written to the backing storage
+ * @return 0 if OK, -ve on error
+ */
+int dm_bootcount_set(struct udevice *dev, u32 bootcount);
+
+#endif
+
#if defined(CONFIG_SPL_BOOTCOUNT_LIMIT) || defined(CONFIG_BOOTCOUNT_LIMIT)
#if !defined(CONFIG_SYS_BOOTCOUNT_LE) && !defined(CONFIG_SYS_BOOTCOUNT_BE)
diff --git a/include/dm/uclass-id.h b/include/dm/uclass-id.h
index aad5d26..0e41f8a 100644
--- a/include/dm/uclass-id.h
+++ b/include/dm/uclass-id.h
@@ -32,6 +32,7 @@ enum uclass_id {
UCLASS_AXI, /* AXI bus */
UCLASS_BLK, /* Block device */
UCLASS_BOARD, /* Device information from hardware */
+ UCLASS_BOOTCOUNT, /* Bootcount backing store */
UCLASS_CLK, /* Clock source, e.g. used by peripherals */
UCLASS_CPU, /* CPU, typically part of an SoC */
UCLASS_CROS_EC, /* Chrome OS EC */
--
2.1.4
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [U-Boot] [PATCH v2 2/2] bootcount: add a DM RTC backing store for bootcount
2018-11-27 22:00 [U-Boot] [PATCH v2 0/2] Update RV3029 driver to DM and add DM-backed bootcount support Philipp Tomsich
2018-11-27 22:00 ` [U-Boot] [PATCH v2 1/2] bootcount: add uclass for bootcount Philipp Tomsich
@ 2018-11-27 22:00 ` Philipp Tomsich
2018-12-10 0:01 ` [U-Boot] [U-Boot, v2, " Philipp Tomsich
2018-11-28 6:29 ` [U-Boot] EXT: [PATCH v2 0/2] Update RV3029 driver to DM and add DM-backed bootcount support Ray, Ian
2 siblings, 1 reply; 12+ messages in thread
From: Philipp Tomsich @ 2018-11-27 22:00 UTC (permalink / raw)
To: u-boot
This implements a driver using a RTC-based backing store for the DM
bootcount implementation. The node configuring this feature will be
compatible with 'u-boot,bootcount-rtc' and the underlying RTC device
shall be reference through the property 'rtc'. An offset into the RTC
device's register space can be provided through the 'offset' property.
Tested on a RK3399-Q7 on a Flamingo carrier board using the SRAM area
of the carrier board's RV3029 RTC.
Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
---
Changes in v2: None
drivers/bootcount/Kconfig | 20 +++++++++++
drivers/bootcount/Makefile | 1 +
drivers/bootcount/rtc.c | 89 ++++++++++++++++++++++++++++++++++++++++++++++
3 files changed, 110 insertions(+)
create mode 100644 drivers/bootcount/rtc.c
diff --git a/drivers/bootcount/Kconfig b/drivers/bootcount/Kconfig
index 46571eb..b7c29f2 100644
--- a/drivers/bootcount/Kconfig
+++ b/drivers/bootcount/Kconfig
@@ -80,6 +80,26 @@ config DM_BOOTCOUNT
endchoice
+if DM_BOOTCOUNT
+
+menu "Backing stores for device-model backed bootcount"
+config DM_BOOTCOUNT_RTC
+ bool "Support RTC devices as a backing store for bootcount"
+ depends on DM_RTC
+ help
+ Enabled reading/writing the bootcount in a DM RTC device.
+ The wrapper device is to be specified with the compatible string
+ 'u-boot,bootcount-rtc' and the 'rtc'-property (a phandle pointing
+ to the underlying RTC device) and an optional 'offset' property
+ are supported.
+
+ Accesses to the backing store are performed using the write16
+ and read16 ops of DM RTC devices.
+
+endmenu
+
+endif
+
config BOOTCOUNT_BOOTLIMIT
int "Maximum number of reboot cycles allowed"
default 0
diff --git a/drivers/bootcount/Makefile b/drivers/bootcount/Makefile
index 81980b3..f9841d8 100644
--- a/drivers/bootcount/Makefile
+++ b/drivers/bootcount/Makefile
@@ -9,3 +9,4 @@ obj-$(CONFIG_BOOTCOUNT_I2C) += bootcount_i2c.o
obj-$(CONFIG_BOOTCOUNT_EXT) += bootcount_ext.o
obj-$(CONFIG_DM_BOOTCOUNT) += bootcount-uclass.o
+obj-$(CONFIG_DM_BOOTCOUNT_RTC) += rtc.o
diff --git a/drivers/bootcount/rtc.c b/drivers/bootcount/rtc.c
new file mode 100644
index 0000000..db89fa3
--- /dev/null
+++ b/drivers/bootcount/rtc.c
@@ -0,0 +1,89 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * (C) Copyright 2018 Theobroma Systems Design und Consulting GmbH
+ */
+
+#include <common.h>
+#include <bootcount.h>
+#include <dm.h>
+#include <rtc.h>
+
+static const u8 bootcount_magic = 0xbc;
+
+struct bootcount_rtc_priv {
+ struct udevice *rtc;
+ u32 offset;
+};
+
+static int bootcount_rtc_set(struct udevice *dev, const u32 a)
+{
+ struct bootcount_rtc_priv *priv = dev_get_priv(dev);
+ const u16 val = bootcount_magic << 8 | (a & 0xff);
+
+ if (rtc_write16(priv->rtc, priv->offset, val) < 0) {
+ debug("%s: rtc_write16 failed\n", __func__);
+ return -EIO;
+ }
+
+ return 0;
+}
+
+static int bootcount_rtc_get(struct udevice *dev, u32 *a)
+{
+ struct bootcount_rtc_priv *priv = dev_get_priv(dev);
+ u16 val;
+
+ if (rtc_read16(priv->rtc, priv->offset, &val) < 0) {
+ debug("%s: rtc_write16 failed\n", __func__);
+ return -EIO;
+ }
+
+ if (val >> 8 == bootcount_magic) {
+ *a = val & 0xff;
+ return 0;
+ }
+
+ debug("%s: bootcount magic does not match on %04x\n", __func__, val);
+ return -EIO;
+}
+
+static int bootcount_rtc_probe(struct udevice *dev)
+{
+ struct ofnode_phandle_args phandle_args;
+ struct bootcount_rtc_priv *priv = dev_get_priv(dev);
+ struct udevice *rtc;
+
+ if (dev_read_phandle_with_args(dev, "rtc", NULL, 0, 0, &phandle_args)) {
+ debug("%s: rtc backing device not specified\n", dev->name);
+ return -ENOENT;
+ }
+
+ if (uclass_get_device_by_ofnode(UCLASS_RTC, phandle_args.node, &rtc)) {
+ debug("%s: could not get backing device\n", dev->name);
+ return -ENODEV;
+ }
+
+ priv->rtc = rtc;
+ priv->offset = dev_read_u32_default(dev, "offset", 0);
+
+ return 0;
+}
+
+static const struct bootcount_ops bootcount_rtc_ops = {
+ .get = bootcount_rtc_get,
+ .set = bootcount_rtc_set,
+};
+
+static const struct udevice_id bootcount_rtc_ids[] = {
+ { .compatible = "u-boot,bootcount-rtc" },
+ { }
+};
+
+U_BOOT_DRIVER(bootcount_rtc) = {
+ .name = "bootcount-rtc",
+ .id = UCLASS_BOOTCOUNT,
+ .priv_auto_alloc_size = sizeof(struct bootcount_rtc_priv),
+ .probe = bootcount_rtc_probe,
+ .of_match = bootcount_rtc_ids,
+ .ops = &bootcount_rtc_ops,
+};
--
2.1.4
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [U-Boot] EXT: [PATCH v2 0/2] Update RV3029 driver to DM and add DM-backed bootcount support
2018-11-27 22:00 [U-Boot] [PATCH v2 0/2] Update RV3029 driver to DM and add DM-backed bootcount support Philipp Tomsich
2018-11-27 22:00 ` [U-Boot] [PATCH v2 1/2] bootcount: add uclass for bootcount Philipp Tomsich
2018-11-27 22:00 ` [U-Boot] [PATCH v2 2/2] bootcount: add a DM RTC backing store " Philipp Tomsich
@ 2018-11-28 6:29 ` Ray, Ian
2018-11-28 9:25 ` Philipp Tomsich
2 siblings, 1 reply; 12+ messages in thread
From: Ray, Ian @ 2018-11-28 6:29 UTC (permalink / raw)
To: u-boot
> On 28 Nov 2018, at 0.00, Philipp Tomsich <philipp.tomsich@theobroma-systems.com> wrote:
>
>
> On one of our application-specific carrier boards, a MicroCrystal
> RV3029 acts as an off-module battery-backed RTC for the RK3399-Q7.
> The RV3029 is intended both to provide RTC services (to Linux) and
> to store the bootcount in its battery-backed SRAM section.
>
> To support this use-case, this series adds the following:
> * replaces the existing RV3029 driver by a DM-based one (note that the
> existing driver appears unused and didn't even have a Kconfig entry)
> that closely mirrors its incarnation in Linux 4.17
While true in v1, drivers/rtc/rv3029.c is not modified in this patchset.
> * adds a bootcount-method interfacing back into DM devices (implementing
> support for the RTC uclass as of now).
>
>
> Changes in v2:
> - changed to provide a UCLASS-based implementation, as requested by
> SJG in his earlier review
> - split off the RV3029 driver into a separate series
>
> Philipp Tomsich (2):
> bootcount: add uclass for bootcount
> bootcount: add a DM RTC backing store for bootcount
>
Reviewed-by: Ian Ray <ian.ray@ge.com>
> doc/device-tree-bindings/chosen.txt | 30 ++++++++++++
> drivers/bootcount/Kconfig | 28 +++++++++++
> drivers/bootcount/Makefile | 3 ++
> drivers/bootcount/bootcount-uclass.c | 93 ++++++++++++++++++++++++++++++++++++
> drivers/bootcount/rtc.c | 89 ++++++++++++++++++++++++++++++++++
> include/bootcount.h | 48 +++++++++++++++++++
> include/dm/uclass-id.h | 1 +
> 7 files changed, 292 insertions(+)
> create mode 100644 drivers/bootcount/bootcount-uclass.c
> create mode 100644 drivers/bootcount/rtc.c
>
> --
> 2.1.4
>
^ permalink raw reply [flat|nested] 12+ messages in thread
* [U-Boot] EXT: [PATCH v2 0/2] Update RV3029 driver to DM and add DM-backed bootcount support
2018-11-28 6:29 ` [U-Boot] EXT: [PATCH v2 0/2] Update RV3029 driver to DM and add DM-backed bootcount support Ray, Ian
@ 2018-11-28 9:25 ` Philipp Tomsich
0 siblings, 0 replies; 12+ messages in thread
From: Philipp Tomsich @ 2018-11-28 9:25 UTC (permalink / raw)
To: u-boot
> On 28.11.2018, at 07:29, Ray, Ian (GE Healthcare) <ian.ray@ge.com> wrote:
>
>
>
>> On 28 Nov 2018, at 0.00, Philipp Tomsich <philipp.tomsich@theobroma-systems.com> wrote:
>>
>>
>> On one of our application-specific carrier boards, a MicroCrystal
>> RV3029 acts as an off-module battery-backed RTC for the RK3399-Q7.
>> The RV3029 is intended both to provide RTC services (to Linux) and
>> to store the bootcount in its battery-backed SRAM section.
>>
>> To support this use-case, this series adds the following:
>> * replaces the existing RV3029 driver by a DM-based one (note that the
>> existing driver appears unused and didn't even have a Kconfig entry)
>> that closely mirrors its incarnation in Linux 4.17
>
> While true in v1, drivers/rtc/rv3029.c is not modified in this patchset.
Good point. The cover letter needs updating (or I need to avoid last-minute decisions
to split a series…).
The RV3029 changes have been split off into the following series:
https://patchwork.ozlabs.org/project/uboot/list/?series=78378
I’ll wait for comments and repost with an updated coverletter after those, if necessary.
>> * adds a bootcount-method interfacing back into DM devices (implementing
>> support for the RTC uclass as of now).
>>
>>
>> Changes in v2:
>> - changed to provide a UCLASS-based implementation, as requested by
>> SJG in his earlier review
>> - split off the RV3029 driver into a separate series
>>
>> Philipp Tomsich (2):
>> bootcount: add uclass for bootcount
>> bootcount: add a DM RTC backing store for bootcount
>>
>
> Reviewed-by: Ian Ray <ian.ray@ge.com>
>
>
>> doc/device-tree-bindings/chosen.txt | 30 ++++++++++++
>> drivers/bootcount/Kconfig | 28 +++++++++++
>> drivers/bootcount/Makefile | 3 ++
>> drivers/bootcount/bootcount-uclass.c | 93 ++++++++++++++++++++++++++++++++++++
>> drivers/bootcount/rtc.c | 89 ++++++++++++++++++++++++++++++++++
>> include/bootcount.h | 48 +++++++++++++++++++
>> include/dm/uclass-id.h | 1 +
>> 7 files changed, 292 insertions(+)
>> create mode 100644 drivers/bootcount/bootcount-uclass.c
>> create mode 100644 drivers/bootcount/rtc.c
>>
>> --
>> 2.1.4
>>
>
^ permalink raw reply [flat|nested] 12+ messages in thread
* [U-Boot] [U-Boot, v2, 2/2] bootcount: add a DM RTC backing store for bootcount
2018-11-27 22:00 ` [U-Boot] [PATCH v2 2/2] bootcount: add a DM RTC backing store " Philipp Tomsich
@ 2018-12-10 0:01 ` Philipp Tomsich
0 siblings, 0 replies; 12+ messages in thread
From: Philipp Tomsich @ 2018-12-10 0:01 UTC (permalink / raw)
To: u-boot
> This implements a driver using a RTC-based backing store for the DM
> bootcount implementation. The node configuring this feature will be
> compatible with 'u-boot,bootcount-rtc' and the underlying RTC device
> shall be reference through the property 'rtc'. An offset into the RTC
> device's register space can be provided through the 'offset' property.
>
> Tested on a RK3399-Q7 on a Flamingo carrier board using the SRAM area
> of the carrier board's RV3029 RTC.
>
> Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
> ---
>
> Changes in v2: None
>
> drivers/bootcount/Kconfig | 20 +++++++++++
> drivers/bootcount/Makefile | 1 +
> drivers/bootcount/rtc.c | 89 ++++++++++++++++++++++++++++++++++++++++++++++
> 3 files changed, 110 insertions(+)
> create mode 100644 drivers/bootcount/rtc.c
>
Applied to u-boot-rockchip, thanks!
^ permalink raw reply [flat|nested] 12+ messages in thread
* [U-Boot] [U-Boot,v2,1/2] bootcount: add uclass for bootcount
2018-11-27 22:00 ` [U-Boot] [PATCH v2 1/2] bootcount: add uclass for bootcount Philipp Tomsich
@ 2018-12-10 0:01 ` Philipp Tomsich
2018-12-11 1:07 ` [U-Boot] [PATCH v2 1/2] " Simon Glass
1 sibling, 0 replies; 12+ messages in thread
From: Philipp Tomsich @ 2018-12-10 0:01 UTC (permalink / raw)
To: u-boot
> The original bootcount methods do not provide an interface to DM and
> rely on a static configuration for I2C devices (e.g. bus, chip-addr,
> etc. are configured through defines statically). On a modern system
> that exposes multiple devices in a DTS-configurable way, this is less
> than optimal and a interface to DM-based devices will be desirable.
>
> This adds a simple driver that is DM-aware and configurable via DTS.
> If ambiguous (i.e. multiple bootcount-devices are present) the
> /chosen/u-boot,bootcount-device property can be used to select one
> bootcount device.
>
> Initially, this provides support for the following DM devices:
> * RTC devices
>
> Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
> Tested-by: Klaus Goger <klaus.goger@theobroma-systems.com>
> ---
>
> Changes in v2:
> - changed to provide a UCLASS-based implementation, as requested by
> SJG in his earlier review
> - split off the RV3029 driver into a separate series
>
> doc/device-tree-bindings/chosen.txt | 30 ++++++++++++
> drivers/bootcount/Kconfig | 8 ++++
> drivers/bootcount/Makefile | 2 +
> drivers/bootcount/bootcount-uclass.c | 93 ++++++++++++++++++++++++++++++++++++
> include/bootcount.h | 48 +++++++++++++++++++
> include/dm/uclass-id.h | 1 +
> 6 files changed, 182 insertions(+)
> create mode 100644 drivers/bootcount/bootcount-uclass.c
>
Applied to u-boot-rockchip, thanks!
^ permalink raw reply [flat|nested] 12+ messages in thread
* [U-Boot] [PATCH v2 1/2] bootcount: add uclass for bootcount
2018-11-27 22:00 ` [U-Boot] [PATCH v2 1/2] bootcount: add uclass for bootcount Philipp Tomsich
2018-12-10 0:01 ` [U-Boot] [U-Boot,v2,1/2] " Philipp Tomsich
@ 2018-12-11 1:07 ` Simon Glass
2018-12-14 15:37 ` Simon Glass
1 sibling, 1 reply; 12+ messages in thread
From: Simon Glass @ 2018-12-11 1:07 UTC (permalink / raw)
To: u-boot
Hi Philipp,
On Tue, 27 Nov 2018 at 15:00, Philipp Tomsich
<philipp.tomsich@theobroma-systems.com> wrote:
>
> The original bootcount methods do not provide an interface to DM and
> rely on a static configuration for I2C devices (e.g. bus, chip-addr,
> etc. are configured through defines statically). On a modern system
> that exposes multiple devices in a DTS-configurable way, this is less
> than optimal and a interface to DM-based devices will be desirable.
>
> This adds a simple driver that is DM-aware and configurable via DTS.
> If ambiguous (i.e. multiple bootcount-devices are present) the
> /chosen/u-boot,bootcount-device property can be used to select one
> bootcount device.
>
> Initially, this provides support for the following DM devices:
> * RTC devices
>
> Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
> Tested-by: Klaus Goger <klaus.goger@theobroma-systems.com>
>
> ---
>
> Changes in v2:
> - changed to provide a UCLASS-based implementation, as requested by
> SJG in his earlier review
> - split off the RV3029 driver into a separate series
>
> doc/device-tree-bindings/chosen.txt | 30 ++++++++++++
> drivers/bootcount/Kconfig | 8 ++++
> drivers/bootcount/Makefile | 2 +
> drivers/bootcount/bootcount-uclass.c | 93 ++++++++++++++++++++++++++++++++++++
> include/bootcount.h | 48 +++++++++++++++++++
> include/dm/uclass-id.h | 1 +
> 6 files changed, 182 insertions(+)
> create mode 100644 drivers/bootcount/bootcount-uclass.c
Just checking if there is a text and sandbox driver for this?
Regards,
SImon
^ permalink raw reply [flat|nested] 12+ messages in thread
* [U-Boot] [PATCH v2 1/2] bootcount: add uclass for bootcount
2018-12-11 1:07 ` [U-Boot] [PATCH v2 1/2] " Simon Glass
@ 2018-12-14 15:37 ` Simon Glass
2018-12-14 16:04 ` Philipp Tomsich
0 siblings, 1 reply; 12+ messages in thread
From: Simon Glass @ 2018-12-14 15:37 UTC (permalink / raw)
To: u-boot
Hi,
On Mon, 10 Dec 2018 at 18:07, Simon Glass <sjg@chromium.org> wrote:
>
> Hi Philipp,
>
> On Tue, 27 Nov 2018 at 15:00, Philipp Tomsich
> <philipp.tomsich@theobroma-systems.com> wrote:
> >
> > The original bootcount methods do not provide an interface to DM and
> > rely on a static configuration for I2C devices (e.g. bus, chip-addr,
> > etc. are configured through defines statically). On a modern system
> > that exposes multiple devices in a DTS-configurable way, this is less
> > than optimal and a interface to DM-based devices will be desirable.
> >
> > This adds a simple driver that is DM-aware and configurable via DTS.
> > If ambiguous (i.e. multiple bootcount-devices are present) the
> > /chosen/u-boot,bootcount-device property can be used to select one
> > bootcount device.
> >
> > Initially, this provides support for the following DM devices:
> > * RTC devices
> >
> > Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
> > Tested-by: Klaus Goger <klaus.goger@theobroma-systems.com>
> >
> > ---
> >
> > Changes in v2:
> > - changed to provide a UCLASS-based implementation, as requested by
> > SJG in his earlier review
> > - split off the RV3029 driver into a separate series
> >
> > doc/device-tree-bindings/chosen.txt | 30 ++++++++++++
> > drivers/bootcount/Kconfig | 8 ++++
> > drivers/bootcount/Makefile | 2 +
> > drivers/bootcount/bootcount-uclass.c | 93 ++++++++++++++++++++++++++++++++++++
> > include/bootcount.h | 48 +++++++++++++++++++
> > include/dm/uclass-id.h | 1 +
> > 6 files changed, 182 insertions(+)
> > create mode 100644 drivers/bootcount/bootcount-uclass.c
>
> Just checking if there is a text and sandbox driver for this?
Oops I meant test, sorry. All uclasses should have a test.
Regards,
Simon
^ permalink raw reply [flat|nested] 12+ messages in thread
* [U-Boot] [PATCH v2 1/2] bootcount: add uclass for bootcount
2018-12-14 15:37 ` Simon Glass
@ 2018-12-14 16:04 ` Philipp Tomsich
2018-12-14 16:06 ` Simon Glass
0 siblings, 1 reply; 12+ messages in thread
From: Philipp Tomsich @ 2018-12-14 16:04 UTC (permalink / raw)
To: u-boot
> On 14.12.2018, at 16:37, Simon Glass <sjg@chromium.org> wrote:
>
> Hi,
>
> On Mon, 10 Dec 2018 at 18:07, Simon Glass <sjg at chromium.org <mailto:sjg@chromium.org>> wrote:
>>
>> Hi Philipp,
>>
>> On Tue, 27 Nov 2018 at 15:00, Philipp Tomsich
>> <philipp.tomsich@theobroma-systems.com> wrote:
>>>
>>> The original bootcount methods do not provide an interface to DM and
>>> rely on a static configuration for I2C devices (e.g. bus, chip-addr,
>>> etc. are configured through defines statically). On a modern system
>>> that exposes multiple devices in a DTS-configurable way, this is less
>>> than optimal and a interface to DM-based devices will be desirable.
>>>
>>> This adds a simple driver that is DM-aware and configurable via DTS.
>>> If ambiguous (i.e. multiple bootcount-devices are present) the
>>> /chosen/u-boot,bootcount-device property can be used to select one
>>> bootcount device.
>>>
>>> Initially, this provides support for the following DM devices:
>>> * RTC devices
>>>
>>> Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
>>> Tested-by: Klaus Goger <klaus.goger@theobroma-systems.com>
>>>
>>> ---
>>>
>>> Changes in v2:
>>> - changed to provide a UCLASS-based implementation, as requested by
>>> SJG in his earlier review
>>> - split off the RV3029 driver into a separate series
>>>
>>> doc/device-tree-bindings/chosen.txt | 30 ++++++++++++
>>> drivers/bootcount/Kconfig | 8 ++++
>>> drivers/bootcount/Makefile | 2 +
>>> drivers/bootcount/bootcount-uclass.c | 93 ++++++++++++++++++++++++++++++++++++
>>> include/bootcount.h | 48 +++++++++++++++++++
>>> include/dm/uclass-id.h | 1 +
>>> 6 files changed, 182 insertions(+)
>>> create mode 100644 drivers/bootcount/bootcount-uclass.c
>>
>> Just checking if there is a text and sandbox driver for this?
>
> Oops I meant test, sorry. All uclasses should have a test.
Not yet, I’ll get started on it.
So now I know why I had initially tried to avoid making this a uclass ;-)
—Philipp.
^ permalink raw reply [flat|nested] 12+ messages in thread
* [U-Boot] [PATCH v2 1/2] bootcount: add uclass for bootcount
2018-12-14 16:04 ` Philipp Tomsich
@ 2018-12-14 16:06 ` Simon Glass
2018-12-14 20:16 ` Philipp Tomsich
0 siblings, 1 reply; 12+ messages in thread
From: Simon Glass @ 2018-12-14 16:06 UTC (permalink / raw)
To: u-boot
Hi Philipp,
On Fri, 14 Dec 2018 at 09:04, Philipp Tomsich
<philipp.tomsich@theobroma-systems.com> wrote:
>
>
>
> On 14.12.2018, at 16:37, Simon Glass <sjg@chromium.org> wrote:
>
> Hi,
>
> On Mon, 10 Dec 2018 at 18:07, Simon Glass <sjg@chromium.org> wrote:
>
>
> Hi Philipp,
>
> On Tue, 27 Nov 2018 at 15:00, Philipp Tomsich
> <philipp.tomsich@theobroma-systems.com> wrote:
>
>
> The original bootcount methods do not provide an interface to DM and
> rely on a static configuration for I2C devices (e.g. bus, chip-addr,
> etc. are configured through defines statically). On a modern system
> that exposes multiple devices in a DTS-configurable way, this is less
> than optimal and a interface to DM-based devices will be desirable.
>
> This adds a simple driver that is DM-aware and configurable via DTS.
> If ambiguous (i.e. multiple bootcount-devices are present) the
> /chosen/u-boot,bootcount-device property can be used to select one
> bootcount device.
>
> Initially, this provides support for the following DM devices:
> * RTC devices
>
> Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
> Tested-by: Klaus Goger <klaus.goger@theobroma-systems.com>
>
> ---
>
> Changes in v2:
> - changed to provide a UCLASS-based implementation, as requested by
> SJG in his earlier review
> - split off the RV3029 driver into a separate series
>
> doc/device-tree-bindings/chosen.txt | 30 ++++++++++++
> drivers/bootcount/Kconfig | 8 ++++
> drivers/bootcount/Makefile | 2 +
> drivers/bootcount/bootcount-uclass.c | 93 ++++++++++++++++++++++++++++++++++++
> include/bootcount.h | 48 +++++++++++++++++++
> include/dm/uclass-id.h | 1 +
> 6 files changed, 182 insertions(+)
> create mode 100644 drivers/bootcount/bootcount-uclass.c
>
>
> Just checking if there is a text and sandbox driver for this?
>
>
> Oops I meant test, sorry. All uclasses should have a test.
>
>
> Not yet, I’ll get started on it.
> So now I know why I had initially tried to avoid making this a uclass ;-)
Well let me rephrase it...we should have tests for all common code in U-Boot :-)
It's normally a very small amount of work, particularly for something
like this. Keep it simple.
- Simon
^ permalink raw reply [flat|nested] 12+ messages in thread
* [U-Boot] [PATCH v2 1/2] bootcount: add uclass for bootcount
2018-12-14 16:06 ` Simon Glass
@ 2018-12-14 20:16 ` Philipp Tomsich
0 siblings, 0 replies; 12+ messages in thread
From: Philipp Tomsich @ 2018-12-14 20:16 UTC (permalink / raw)
To: u-boot
Simon,
> On 14.12.2018, at 17:06, Simon Glass <sjg@chromium.org> wrote:
>
> Hi Philipp,
>
> On Fri, 14 Dec 2018 at 09:04, Philipp Tomsich
> <philipp.tomsich at theobroma-systems.com <mailto:philipp.tomsich@theobroma-systems.com>> wrote:
>>
>>
>>
>> On 14.12.2018, at 16:37, Simon Glass <sjg@chromium.org> wrote:
>>
>> Hi,
>>
>> On Mon, 10 Dec 2018 at 18:07, Simon Glass <sjg@chromium.org> wrote:
>>
>>
>> Hi Philipp,
>>
>> On Tue, 27 Nov 2018 at 15:00, Philipp Tomsich
>> <philipp.tomsich@theobroma-systems.com> wrote:
>>
>>
>> The original bootcount methods do not provide an interface to DM and
>> rely on a static configuration for I2C devices (e.g. bus, chip-addr,
>> etc. are configured through defines statically). On a modern system
>> that exposes multiple devices in a DTS-configurable way, this is less
>> than optimal and a interface to DM-based devices will be desirable.
>>
>> This adds a simple driver that is DM-aware and configurable via DTS.
>> If ambiguous (i.e. multiple bootcount-devices are present) the
>> /chosen/u-boot,bootcount-device property can be used to select one
>> bootcount device.
>>
>> Initially, this provides support for the following DM devices:
>> * RTC devices
>>
>> Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
>> Tested-by: Klaus Goger <klaus.goger@theobroma-systems.com>
>>
>> ---
>>
>> Changes in v2:
>> - changed to provide a UCLASS-based implementation, as requested by
>> SJG in his earlier review
>> - split off the RV3029 driver into a separate series
>>
>> doc/device-tree-bindings/chosen.txt | 30 ++++++++++++
>> drivers/bootcount/Kconfig | 8 ++++
>> drivers/bootcount/Makefile | 2 +
>> drivers/bootcount/bootcount-uclass.c | 93 ++++++++++++++++++++++++++++++++++++
>> include/bootcount.h | 48 +++++++++++++++++++
>> include/dm/uclass-id.h | 1 +
>> 6 files changed, 182 insertions(+)
>> create mode 100644 drivers/bootcount/bootcount-uclass.c
>>
>>
>> Just checking if there is a text and sandbox driver for this?
>>
>>
>> Oops I meant test, sorry. All uclasses should have a test.
>>
>>
>> Not yet, I’ll get started on it.
>> So now I know why I had initially tried to avoid making this a uclass ;-)
>
> Well let me rephrase it...we should have tests for all common code in U-Boot :-)
I knew I couldn’t get away with it, but couldn’t resist to try it anyway...
> It's normally a very small amount of work, particularly for something
> like this. Keep it simple.
As the original series is already on master, I sent the new test as a separate
patch. Feel free to comment and request more embellishments.
Thanks,
Philipp.
^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2018-12-14 20:16 UTC | newest]
Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-11-27 22:00 [U-Boot] [PATCH v2 0/2] Update RV3029 driver to DM and add DM-backed bootcount support Philipp Tomsich
2018-11-27 22:00 ` [U-Boot] [PATCH v2 1/2] bootcount: add uclass for bootcount Philipp Tomsich
2018-12-10 0:01 ` [U-Boot] [U-Boot,v2,1/2] " Philipp Tomsich
2018-12-11 1:07 ` [U-Boot] [PATCH v2 1/2] " Simon Glass
2018-12-14 15:37 ` Simon Glass
2018-12-14 16:04 ` Philipp Tomsich
2018-12-14 16:06 ` Simon Glass
2018-12-14 20:16 ` Philipp Tomsich
2018-11-27 22:00 ` [U-Boot] [PATCH v2 2/2] bootcount: add a DM RTC backing store " Philipp Tomsich
2018-12-10 0:01 ` [U-Boot] [U-Boot, v2, " Philipp Tomsich
2018-11-28 6:29 ` [U-Boot] EXT: [PATCH v2 0/2] Update RV3029 driver to DM and add DM-backed bootcount support Ray, Ian
2018-11-28 9:25 ` Philipp Tomsich
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.