diff options
-rw-r--r-- | Documentation/boards/sandbox.rst | 14 | ||||
-rw-r--r-- | Makefile | 4 | ||||
-rw-r--r-- | common/fastboot.c | 2 | ||||
-rw-r--r-- | common/imd.c | 2 | ||||
-rw-r--r-- | common/startup.c | 1 | ||||
-rw-r--r-- | drivers/mtd/nand/nand_base.c | 35 | ||||
-rw-r--r-- | drivers/mtd/nand/nand_mxs.c | 8 | ||||
-rw-r--r-- | drivers/of/of_firmware.c | 11 | ||||
-rw-r--r-- | drivers/of/overlay.c | 5 | ||||
-rw-r--r-- | include/dt-bindings/clock/ls1b-clk.h (renamed from dts/include/dt-bindings/clock/ls1b-clk.h) | 0 | ||||
-rw-r--r-- | include/image-sparse.h | 2 | ||||
-rw-r--r-- | lib/image-sparse.c | 7 |
12 files changed, 57 insertions, 34 deletions
diff --git a/Documentation/boards/sandbox.rst b/Documentation/boards/sandbox.rst index 8b24b6a645..e9e5183653 100644 --- a/Documentation/boards/sandbox.rst +++ b/Documentation/boards/sandbox.rst @@ -34,6 +34,20 @@ Available sandbox invocation options include: Map a <file> to barebox. This option can be given multiple times. The <file>s will show up as ``/dev/fd0`` ... ``/dev/fdX`` in the barebox simulator. + How the file is mapped in barebox can be controlled by a number of flags: + + * ``,ro``: The host file is mapped read-only + + * ``,blkdev``: The host file is to be mapped as block device. This is the + default when passing block devices from the host. The file's size must + be a multiple of the barebox sector size of 512 bytes. + + * ``,cdev``: The host file is mapped as character device. This is the default, + unless the the host file is a block device. + + Multiple options can be appended if they don't clash. Literal commas within the + file path can be escaped with a backslash. Example: ``-i './0\,0.hdimg,blkdev,ro'``. + ``-e <file>`` Map <file> to barebox. With this option <file>s are mapped as @@ -1,6 +1,6 @@ # SPDX-License-Identifier: GPL-2.0 -VERSION = 2020 -PATCHLEVEL = 12 +VERSION = 2021 +PATCHLEVEL = 01 SUBLEVEL = 0 EXTRAVERSION = NAME = None diff --git a/common/fastboot.c b/common/fastboot.c index 27d3f1eddc..a394d07e28 100644 --- a/common/fastboot.c +++ b/common/fastboot.c @@ -565,7 +565,7 @@ static int fastboot_handle_sparse(struct fastboot *fb, } while (1) { - int retlen; + size_t retlen; loff_t pos; ret = sparse_image_read(sparse, buf, &pos, bufsiz, &retlen); diff --git a/common/imd.c b/common/imd.c index ef9eff876b..aff3b00b6b 100644 --- a/common/imd.c +++ b/common/imd.c @@ -406,7 +406,7 @@ int imd_verify_crc32(void *buf, size_t size) *p, crc); return -EILSEQ; } else if (*p != crc && !imd_crc32_is_valid(*flags)) { - printf("CRC: is invalid, but the checksum tag is not enabled\n"); + debug("CRC: is invalid, but the checksum tag is not enabled\n"); return -EINVAL; } else { printf("CRC: valid\n"); diff --git a/common/startup.c b/common/startup.c index 767d178de8..1ac36d950c 100644 --- a/common/startup.c +++ b/common/startup.c @@ -307,6 +307,7 @@ static int run_init(void) struct stat s; setenv("PATH", "/env/bin"); + export("PATH"); /* Run legacy /env/bin/init if it exists */ env_bin_init_exists = stat(INITFILE, &s) == 0; diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c index 427aa7f0ec..b37017372f 100644 --- a/drivers/mtd/nand/nand_base.c +++ b/drivers/mtd/nand/nand_base.c @@ -5622,10 +5622,6 @@ int nand_scan_tail(struct nand_chip *chip) if (!ecc->write_subpage && ecc->hwctl && ecc->calculate) ecc->write_subpage = nand_write_subpage_hwecc; case NAND_ECC_HW_SYNDROME: - if (!IS_ENABLED(CONFIG_NAND_ECC_HW_SYNDROME)) { - ret = -ENOSYS; - goto err_nand_manuf_cleanup; - } if ((!ecc->calculate || !ecc->correct || !ecc->hwctl) && (!ecc->read_page || ecc->read_page == nand_read_page_hwecc || @@ -5635,19 +5631,24 @@ int nand_scan_tail(struct nand_chip *chip) ret = -EINVAL; goto err_nand_manuf_cleanup; } - /* Use standard syndrome read/write page function? */ - if (!ecc->read_page) - ecc->read_page = nand_read_page_syndrome; - if (!ecc->write_page) - ecc->write_page = nand_write_page_syndrome; - if (!ecc->read_page_raw) - ecc->read_page_raw = nand_read_page_raw_syndrome; - if (!ecc->write_page_raw) - ecc->write_page_raw = nand_write_page_raw_syndrome; - if (!ecc->read_oob) - ecc->read_oob = nand_read_oob_syndrome; - if (!ecc->write_oob) - ecc->write_oob = nand_write_oob_syndrome; + if (IS_ENABLED(CONFIG_NAND_ECC_HW_SYNDROME)) { + /* Use standard syndrome read/write page function? */ + if (!ecc->read_page) + ecc->read_page = nand_read_page_syndrome; + if (!ecc->write_page) + ecc->write_page = nand_write_page_syndrome; + if (!ecc->read_page_raw) + ecc->read_page_raw = nand_read_page_raw_syndrome; + if (!ecc->write_page_raw) + ecc->write_page_raw = nand_write_page_raw_syndrome; + if (!ecc->read_oob) + ecc->read_oob = nand_read_oob_syndrome; + if (!ecc->write_oob) + ecc->write_oob = nand_write_oob_syndrome; + } else if (ecc->mode == NAND_ECC_HW_SYNDROME) { + ret = -ENOSYS; + goto err_nand_manuf_cleanup; + } if (mtd->writesize >= ecc->size) { if (!ecc->strength) { diff --git a/drivers/mtd/nand/nand_mxs.c b/drivers/mtd/nand/nand_mxs.c index 9f7ab14426..434da49d3e 100644 --- a/drivers/mtd/nand/nand_mxs.c +++ b/drivers/mtd/nand/nand_mxs.c @@ -37,6 +37,8 @@ #include <stmp-device.h> #include <mach/generic.h> +#include "internals.h" + #define MX28_BLOCK_SFTRST (1 << 31) #define MX28_BLOCK_CLKGATE (1 << 30) @@ -2055,14 +2057,12 @@ static int mxs_nand_enable_edo_mode(struct mxs_nand_info *info) /* [1] send SET FEATURE commond to NAND */ feature[0] = mode; - ret = chip->legacy.set_features(chip, - ONFI_FEATURE_ADDR_TIMING_MODE, feature); + ret = nand_set_features(chip, ONFI_FEATURE_ADDR_TIMING_MODE, feature); if (ret) goto err_out; /* [2] send GET FEATURE command to double-check the timing mode */ - ret = chip->legacy.get_features(chip, - ONFI_FEATURE_ADDR_TIMING_MODE, feature); + ret = nand_get_features(chip, ONFI_FEATURE_ADDR_TIMING_MODE, feature); if (ret || feature[0] != mode) goto err_out; } diff --git a/drivers/of/of_firmware.c b/drivers/of/of_firmware.c index 0135631fb8..096f84572e 100644 --- a/drivers/of/of_firmware.c +++ b/drivers/of/of_firmware.c @@ -43,6 +43,9 @@ static int load_firmware(struct device_node *target, else if (err) return -EINVAL; + if (!target) + return -EINVAL; + mgr = of_node_get_mgr(target); if (!mgr) return -EINVAL; @@ -69,11 +72,13 @@ int of_firmware_load_overlay(struct device_node *overlay, const char *path) struct device_node *ovl; root = of_get_root_node(); + resolved = of_resolve_phandles(root, overlay); /* - * If we cannot resolve the symbols in the overlay, ensure that the - * overlay does depend on firmware to be loaded. + * If the overlay cannot be resolved, use the load_firmware callback + * with the unresolved overlay to verify that the overlay does not + * depend on a firmware to be loaded. If a required firmware cannot be + * loaded, the overlay must not be applied. */ - resolved = of_resolve_phandles(root, overlay); ovl = resolved ? resolved : overlay; err = of_process_overlay(root, ovl, diff --git a/drivers/of/overlay.c b/drivers/of/overlay.c index b79dbff94d..eb47378258 100644 --- a/drivers/of/overlay.c +++ b/drivers/of/overlay.c @@ -215,12 +215,13 @@ int of_process_overlay(struct device_node *root, target = find_target(root, fragment); if (!target) - continue; + pr_debug("cannot find target for fragment", + fragment->name); err = process(target, ovl, data); if (err) { pr_warn("failed to process overlay for %s\n", - target->name); + target ? target->name : "unknown"); break; } } diff --git a/dts/include/dt-bindings/clock/ls1b-clk.h b/include/dt-bindings/clock/ls1b-clk.h index 2277225e39..2277225e39 100644 --- a/dts/include/dt-bindings/clock/ls1b-clk.h +++ b/include/dt-bindings/clock/ls1b-clk.h diff --git a/include/image-sparse.h b/include/image-sparse.h index 29242f4fd5..6bff844411 100644 --- a/include/image-sparse.h +++ b/include/image-sparse.h @@ -60,7 +60,7 @@ struct sparse_image_ctx; struct sparse_image_ctx *sparse_image_open(const char *path); int sparse_image_read(struct sparse_image_ctx *si, void *buf, - loff_t *pos, size_t len, int *retlen); + loff_t *pos, size_t len, size_t *retlen); void sparse_image_close(struct sparse_image_ctx *si); loff_t sparse_image_size(struct sparse_image_ctx *si); diff --git a/lib/image-sparse.c b/lib/image-sparse.c index 0c31742ab6..c375c78d63 100644 --- a/lib/image-sparse.c +++ b/lib/image-sparse.c @@ -62,7 +62,8 @@ struct sparse_image_ctx { static int sparse_seek(struct sparse_image_ctx *si) { - unsigned int chunk_data_sz, payload; + uint64_t chunk_data_sz; + unsigned int payload; loff_t offs; int ret; @@ -94,7 +95,7 @@ again: return -errno; } - chunk_data_sz = si->sparse.blk_sz * si->chunk.chunk_sz; + chunk_data_sz = (uint64_t) si->sparse.blk_sz * si->chunk.chunk_sz; payload = si->chunk.total_sz - si->sparse.chunk_hdr_sz; si->processed_chunks++; @@ -190,7 +191,7 @@ out: } int sparse_image_read(struct sparse_image_ctx *si, void *buf, loff_t *pos, - size_t len, int *retlen) + size_t len, size_t *retlen) { size_t now; int ret, i; |