diff options
-rw-r--r-- | Documentation/devicetree/bindings/barebox/barebox,state.rst | 6 | ||||
-rw-r--r-- | common/state/backend_storage.c | 9 |
2 files changed, 9 insertions, 6 deletions
diff --git a/Documentation/devicetree/bindings/barebox/barebox,state.rst b/Documentation/devicetree/bindings/barebox/barebox,state.rst index 4b1aade662..cebb5f8287 100644 --- a/Documentation/devicetree/bindings/barebox/barebox,state.rst +++ b/Documentation/devicetree/bindings/barebox/barebox,state.rst @@ -48,8 +48,10 @@ Optional Properties ################### * ``backend-stridesize``: stride counted in bytes. See note below. -* ``backend-storage-type``: Defines the backend storage type to ``direct`` or - ``circular``. Defaults to ``circular`` for media which requires erase cycles. +* ``backend-storage-type``: Defines the backend storage type to ``direct``, + ``circular`` or ``noncircular``. If the backend memory needs to be erased + prior a write it defaults to the ``circular`` storage backend type, for backend + memories like RAMs or EEPROMs it defaults to the ``direct`` storage backend type. * ``algo``: A HMAC algorithm used to detect manipulation of the data or header, sensible values follow this pattern ``hmac(<HASH>)``, e.g. ``hmac(sha256)``. Only available for the ``backend-type`` ``raw``. diff --git a/common/state/backend_storage.c b/common/state/backend_storage.c index 2e2478cb6f..825db824b3 100644 --- a/common/state/backend_storage.c +++ b/common/state/backend_storage.c @@ -357,11 +357,12 @@ static int state_storage_file_buckets_init(struct state_backend_storage *storage * @param dev_offset Offset in the device to start writing at. * @param max_size Maximum size of the data. May be 0 for infinite. * @param stridesize Distance between two copies of the data. Not relevant for MTD - * @param storagetype Type of the storage backend. This may be NULL where we - * autoselect some backwardscompatible backend options + * @param storagetype Type of the storage backend. May be NULL for autoselection. * @return 0 on success, -errno otherwise * - * Depending on the filetype, we create mtd buckets or normal file buckets. + * If the backend memory needs to be erased prior a write, the @b storagetype + * defaults to 'circular' storage backend type, for backend memories like RAMs + * or EEPROMs @b storagetype defaults to the 'direct' storage backend type. */ int state_storage_init(struct state *state, const char *path, off_t offset, size_t max_size, uint32_t stridesize, @@ -373,6 +374,7 @@ int state_storage_init(struct state *state, const char *path, INIT_LIST_HEAD(&storage->buckets); storage->dev = &state->dev; + storage->name = storagetype; storage->stridesize = stridesize; storage->offset = offset; storage->max_size = max_size; @@ -387,7 +389,6 @@ int state_storage_init(struct state *state, const char *path, storage->name = "circular"; circular = true; } else if (!strcmp(storagetype, "noncircular")) { - storage->name = "noncircular"; dev_warn(storage->dev, "using old format circular storage type.\n"); circular = false; } else { |