From 3224a21aa25bd99b4c72f581c3d76d65a7df8cd8 Mon Sep 17 00:00:00 2001 From: Andrey Smirnov Date: Thu, 6 Dec 2018 23:29:02 -0800 Subject: net: lib: Make use of ETH_ALEN Signed-off-by: Andrey Smirnov Signed-off-by: Sascha Hauer --- net/lib.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/net/lib.c b/net/lib.c index d4343bcedd..d2b33132d6 100644 --- a/net/lib.c +++ b/net/lib.c @@ -28,13 +28,13 @@ #include #include -int string_to_ethaddr(const char *str, u8 enetaddr[6]) +int string_to_ethaddr(const char *str, u8 enetaddr[ETH_ALEN]) { int reg; char *e; if (!str || strlen(str) != 17) { - memset(enetaddr, 0, 6); + memset(enetaddr, 0, ETH_ALEN); return -EINVAL; } @@ -42,7 +42,7 @@ int string_to_ethaddr(const char *str, u8 enetaddr[6]) str[11] != ':' || str[14] != ':') return -EINVAL; - for (reg = 0; reg < 6; ++reg) { + for (reg = 0; reg < ETH_ALEN; ++reg) { enetaddr[reg] = simple_strtoul(str, &e, 16); str = e + 1; } @@ -50,7 +50,7 @@ int string_to_ethaddr(const char *str, u8 enetaddr[6]) return 0; } -void ethaddr_to_string(const u8 enetaddr[6], char *str) +void ethaddr_to_string(const u8 enetaddr[ETH_ALEN], char *str) { sprintf(str, "%02x:%02x:%02x:%02x:%02x:%02x", enetaddr[0], enetaddr[1], enetaddr[2], enetaddr[3], -- cgit v1.2.3 From 3f326f9d0058174d2da92f31dbc176245386a4a6 Mon Sep 17 00:00:00 2001 From: Andrey Smirnov Date: Thu, 6 Dec 2018 23:29:32 -0800 Subject: mfd: rave-sp: Make use of wait_on_timeout() Signed-off-by: Andrey Smirnov Signed-off-by: Sascha Hauer --- drivers/mfd/rave-sp.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/drivers/mfd/rave-sp.c b/drivers/mfd/rave-sp.c index 469ce4cc0d..cc897b122f 100644 --- a/drivers/mfd/rave-sp.c +++ b/drivers/mfd/rave-sp.c @@ -314,7 +314,6 @@ int rave_sp_exec(struct rave_sp *sp, unsigned char *data = __data; int command, ret = 0; u8 ackid; - uint64_t start = get_time_ns(); command = sp->variant->cmd.translate(data[0]); if (command < 0) @@ -334,12 +333,9 @@ int rave_sp_exec(struct rave_sp *sp, * is_timeout will implicitly poll serdev via poller * infrastructure */ - while (!is_timeout(start, SECOND) && !reply.received) - ; - - if (!reply.received) { + ret = wait_on_timeout(SECOND, reply.received); + if (ret) { dev_err(dev, "Command timeout\n"); - ret = -ETIMEDOUT; sp->reply = NULL; } -- cgit v1.2.3 From bfbfe1e29902f4b23cd2d82609960de236fce43f Mon Sep 17 00:00:00 2001 From: Andrey Smirnov Date: Thu, 6 Dec 2018 23:29:51 -0800 Subject: commands: boot: Remove useless code All of those variables are already initialized in-place in the variable declaration section above to exactly the same values Signed-off-by: Andrey Smirnov Signed-off-by: Sascha Hauer --- commands/boot.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/commands/boot.c b/commands/boot.c index 5d81d79ce8..0257b3dd4f 100644 --- a/commands/boot.c +++ b/commands/boot.c @@ -29,10 +29,6 @@ static int do_boot(int argc, char *argv[]) struct bootentries *entries; struct bootentry *entry; - verbose = 0; - dryrun = 0; - timeout = -1; - while ((opt = getopt(argc, argv, "vldmt:w:")) > 0) { switch (opt) { case 'v': -- cgit v1.2.3 From d2184fff9369210653a07c90df11d8dc322b8b99 Mon Sep 17 00:00:00 2001 From: Andrey Smirnov Date: Thu, 6 Dec 2018 23:30:57 -0800 Subject: led: core: Don't call get_time_us() twice The code doesn't seem to be time-sensitive enough to warrant calling get_time_ns() twice instead of caching its value and using it no both places. Signed-off-by: Andrey Smirnov Signed-off-by: Sascha Hauer --- drivers/led/core.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/led/core.c b/drivers/led/core.c index a388e6b365..f11504acee 100644 --- a/drivers/led/core.c +++ b/drivers/led/core.c @@ -127,12 +127,13 @@ static void led_blink_func(struct poller_struct *poller) struct led *led; list_for_each_entry(led, &leds, list) { + const uint64_t now = get_time_ns(); int on; if (!led->blink && !led->flash) continue; - if (led->blink_next_event > get_time_ns()) { + if (led->blink_next_event > now) { continue; } @@ -140,7 +141,7 @@ static void led_blink_func(struct poller_struct *poller) if (on) on = led->max_value; - led->blink_next_event = get_time_ns() + + led->blink_next_event = now + (led->blink_states[led->blink_next_state] * MSECOND); led->blink_next_state = (led->blink_next_state + 1) % led->blink_nr_states; -- cgit v1.2.3 From 95bcdb4fcb2601499bd853a7cd295fe48c1b62c0 Mon Sep 17 00:00:00 2001 From: Andrey Smirnov Date: Thu, 6 Dec 2018 23:30:58 -0800 Subject: led: core: Initialize blink_next_event with 0 A simpler way to make pattern to trigger immediately is to initialize blink_next_event to 0 instead of current time value. Save a function call and convert the code to do just that. Signed-off-by: Andrey Smirnov Signed-off-by: Sascha Hauer --- drivers/led/core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/led/core.c b/drivers/led/core.c index f11504acee..34c514be8e 100644 --- a/drivers/led/core.c +++ b/drivers/led/core.c @@ -177,7 +177,7 @@ int led_blink_pattern(struct led *led, const unsigned int *pattern, pattern_len * sizeof(*led->blink_states)); led->blink_nr_states = pattern_len; led->blink_next_state = 0; - led->blink_next_event = get_time_ns(); + led->blink_next_event = 0; led->blink = 1; led->flash = 0; -- cgit v1.2.3 From d5c0c8be3cc128dff9deac476d5cddf452875bbd Mon Sep 17 00:00:00 2001 From: Andrey Smirnov Date: Thu, 6 Dec 2018 23:30:59 -0800 Subject: led: core: Make use of ARRAY_AND_SIZE Signed-off-by: Andrey Smirnov Signed-off-by: Sascha Hauer --- drivers/led/core.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/led/core.c b/drivers/led/core.c index 34c514be8e..431966d067 100644 --- a/drivers/led/core.c +++ b/drivers/led/core.c @@ -188,7 +188,7 @@ int led_blink(struct led *led, unsigned int on_ms, unsigned int off_ms) { unsigned int pattern[] = {on_ms, off_ms}; - return led_blink_pattern(led, pattern, 2); + return led_blink_pattern(led, ARRAY_AND_SIZE(pattern)); } int led_flash(struct led *led, unsigned int duration_ms) @@ -196,7 +196,7 @@ int led_flash(struct led *led, unsigned int duration_ms) unsigned int pattern[] = {duration_ms, 0}; int ret; - ret = led_blink_pattern(led, pattern, 2); + ret = led_blink_pattern(led, ARRAY_AND_SIZE(pattern)); if (ret) return ret; -- cgit v1.2.3 From 1d48fdfe8be18e92ac8acc7890a6c238182ac331 Mon Sep 17 00:00:00 2001 From: Andrey Smirnov Date: Thu, 6 Dec 2018 23:32:04 -0800 Subject: nvmem: ocotp: Make use of postcore_platform_driver macro Signed-off-by: Andrey Smirnov Signed-off-by: Sascha Hauer --- drivers/nvmem/ocotp.c | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/drivers/nvmem/ocotp.c b/drivers/nvmem/ocotp.c index e0cf35f0b7..2952988f84 100644 --- a/drivers/nvmem/ocotp.c +++ b/drivers/nvmem/ocotp.c @@ -697,11 +697,4 @@ static struct driver_d imx_ocotp_driver = { .probe = imx_ocotp_probe, .of_compatible = DRV_OF_COMPAT(imx_ocotp_dt_ids), }; - -static int imx_ocotp_init(void) -{ - platform_driver_register(&imx_ocotp_driver); - - return 0; -} -postcore_initcall(imx_ocotp_init); +postcore_platform_driver(imx_ocotp_driver); -- cgit v1.2.3 From 32c01aa6c8a6310d09b706fd634f439cc3d115e3 Mon Sep 17 00:00:00 2001 From: Andrey Smirnov Date: Thu, 6 Dec 2018 23:32:18 -0800 Subject: lib/parameter: Fix typecases to match corresponding PARAM_TYPE_* This change should be a no-op in terms of behavior, but it makes code less confusing when PARAM_TYPE_* matches the type used in the type cast. Signed-off-by: Andrey Smirnov Signed-off-by: Sascha Hauer --- lib/parameter.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/parameter.c b/lib/parameter.c index a21b8fa4a4..00e9a9ff4e 100644 --- a/lib/parameter.c +++ b/lib/parameter.c @@ -343,10 +343,10 @@ static int param_int_set(struct device_d *dev, struct param_d *p, const char *va ret = strtobool(val, pi->value); break; case PARAM_TYPE_INT32: - *(uint32_t *)pi->value = simple_strtol(val, NULL, 0); + *(int32_t *)pi->value = simple_strtol(val, NULL, 0); break; case PARAM_TYPE_UINT32: - *(int32_t *)pi->value = simple_strtoul(val, NULL, 0); + *(uint32_t *)pi->value = simple_strtoul(val, NULL, 0); break; case PARAM_TYPE_INT64: *(int64_t *)pi->value = simple_strtoll(val, NULL, 0); -- cgit v1.2.3 From 392ae40c2c10e0bf657723bc3fdd8a9a7fa54b77 Mon Sep 17 00:00:00 2001 From: Andrey Smirnov Date: Fri, 7 Dec 2018 00:13:22 -0800 Subject: Documentation: i.MX: Document how to use GPT Document a way to avoid clashes between i.MX boot info/Barebox and GPT's Partition Entry Array. Signed-off-by: Andrey Smirnov Signed-off-by: Sascha Hauer --- Documentation/boards/imx.rst | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/Documentation/boards/imx.rst b/Documentation/boards/imx.rst index 99ca10b7cc..35a180b0dd 100644 --- a/Documentation/boards/imx.rst +++ b/Documentation/boards/imx.rst @@ -60,6 +60,25 @@ The images can also always be started second stage:: bootm /mnt/tftp/barebox-freescale-imx51-babbage.img +Using GPT on i.MX +^^^^^^^^^^^^^^^^^ + +For i.MX SoCs that place vendor specific header at +1KiB mark of a +boot medium, special care needs to be taken when parition that medium +with GPT. In order to make room for i.MX boot header GPT Partition +Entry Array needs to be moved from its typical location, LBA 2, to an +offset past vendor specific information. One way to do this would be +to use ``-j`` or ``--adjust-main-table`` option of ``sgdisk``. For +example, the following sequence: + + sgdisk -Z + sgdisk -o -j 2048 -n 1:8192:+100M + +will create a single GPT partition starting at LBA 8192 and would +place Partition Entry Array starting at LBA 2048 which should leave +enough room for Barebox/i.MX boot header. Once that is done ``dd`` +command above can be used to place Barebox on the same medium. + Information about the ``imx-image`` tool ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -- cgit v1.2.3 From bba1bd47b509f1347d1a383ec75f2d8368555ee4 Mon Sep 17 00:00:00 2001 From: Antony Pavlov Date: Thu, 13 Dec 2018 09:34:08 +0300 Subject: scripts/mkcompile_h: Remove trailing spaces from compiler version This is an adoption of the linux kernel commit | commit adcc3f7cee29eb831f79f4ac7ba6a0fbce7ac936 | Author: Jonathan Liu | Date: Mon Jun 12 18:23:17 2017 +1000 | | scripts/mkcompile_h: Remove trailing spaces from compiler version | | Improves the output of "cat /proc/version" by getting rid of the | trailing space at the end of the compiler version when the kernel | is compiled using GCC. | | Signed-off-by: Jonathan Liu | Signed-off-by: Masahiro Yamada Signed-off-by: Antony Pavlov Signed-off-by: Sascha Hauer --- scripts/mkcompile_h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/mkcompile_h b/scripts/mkcompile_h index 1a80ef7c70..60b20cafc6 100755 --- a/scripts/mkcompile_h +++ b/scripts/mkcompile_h @@ -72,7 +72,7 @@ UTS_TRUNCATE="cut -b -$UTS_LEN" echo \#define BAREBOX_COMPILE_BY \"`echo $BAREBOX_COMPILE_BY | $UTS_TRUNCATE`\" echo \#define BAREBOX_COMPILE_HOST \"`echo $BAREBOX_COMPILE_HOST | $UTS_TRUNCATE`\" - echo \#define BAREBOX_COMPILER \"`$CC -v 2>&1 | tail -n 1`\" + echo \#define BAREBOX_COMPILER \"`$CC -v 2>&1 | grep ' version ' | sed 's/[[:space:]]*$//'`\" ) > .tmpcompile # Only replace the real compile.h if the new one is different, -- cgit v1.2.3 From c9b2899f6d2f5d9a2321b53c6a9e4158756a1a74 Mon Sep 17 00:00:00 2001 From: Andreas Schmidt Date: Thu, 11 Oct 2018 15:10:44 +0200 Subject: commands: miitool: remove unsupported options a and b Signed-off-by: Andreas Schmidt --- commands/miitool.c | 6 ------ 1 file changed, 6 deletions(-) diff --git a/commands/miitool.c b/commands/miitool.c index acf61421b8..4ea6fda34d 100644 --- a/commands/miitool.c +++ b/commands/miitool.c @@ -281,12 +281,6 @@ static int do_miitool(int argc, char *argv[]) while ((opt = getopt(argc, argv, "vs:r:")) > 0) { switch (opt) { - case 'a': - addr = simple_strtol(optarg, NULL, 0); - break; - case 'b': - bus = simple_strtoul(optarg, NULL, 0); - break; case 's': action = MIITOOL_SHOW; phydevname = xstrdup(optarg); -- cgit v1.2.3 From 7036c933612dc7004b90d7d3c9d1a208d3a22db1 Mon Sep 17 00:00:00 2001 From: Andrey Smirnov Date: Wed, 12 Dec 2018 23:10:31 -0800 Subject: serial: amba-pl011: Fix regulator_get() return check NULL is used to designate a dummy regulator, so it it should be safe to use against regulator_enable(). Any value that would retrun true for IS_ERR(), OTOH, is not. Such value would also pass "if (r)" check without any problems. Fix the code to use !IS_ERR() instead. Signed-off-by: Andrey Smirnov Signed-off-by: Sascha Hauer --- drivers/serial/amba-pl011.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/serial/amba-pl011.c b/drivers/serial/amba-pl011.c index 4c4067d5b5..ce40f840f7 100644 --- a/drivers/serial/amba-pl011.c +++ b/drivers/serial/amba-pl011.c @@ -185,7 +185,7 @@ static int pl011_probe(struct amba_device *dev, const struct amba_id *id) struct regulator *r; r = regulator_get(&dev->dev, NULL); - if (r) { + if (!IS_ERR(r)) { int ret; ret = regulator_enable(r); -- cgit v1.2.3 From ac6bbe6ab32309218d1806572e0f1f331f9a8dcd Mon Sep 17 00:00:00 2001 From: Andrey Smirnov Date: Wed, 12 Dec 2018 23:10:32 -0800 Subject: mci: Rely on NULL being a dummy regulator Since NULL, is a dummy regulator, we can drop a bit of error checking logic and simplify the code if we assing host->supply to NULL in case we can't find an appropriate regulator during probing. Signed-off-by: Andrey Smirnov Signed-off-by: Sascha Hauer --- drivers/mci/mci-core.c | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/drivers/mci/mci-core.c b/drivers/mci/mci-core.c index c8d1d5e164..2693100956 100644 --- a/drivers/mci/mci-core.c +++ b/drivers/mci/mci-core.c @@ -1650,13 +1650,11 @@ static int mci_card_probe(struct mci *mci) return -ENODEV; } - if (!IS_ERR(host->supply)) { - ret = regulator_enable(host->supply); - if (ret) { - dev_err(&mci->dev, "failed to enable regulator: %s\n", - strerror(-ret)); - return ret; - } + ret = regulator_enable(host->supply); + if (ret) { + dev_err(&mci->dev, "failed to enable regulator: %s\n", + strerror(-ret)); + return ret; } /* start with a host interface reset */ @@ -1728,8 +1726,7 @@ on_error: if (rc != 0) { host->clock = 0; /* disable the MCI clock */ mci_set_ios(mci); - if (!IS_ERR(host->supply)) - regulator_disable(host->supply); + regulator_disable(host->supply); } return rc; @@ -1816,8 +1813,10 @@ int mci_register(struct mci_host *host) mci->dev.detect = mci_detect; host->supply = regulator_get(host->hw_dev, "vmmc"); - if (IS_ERR(host->supply)) + if (IS_ERR(host->supply)) { dev_err(&mci->dev, "Failed to get 'vmmc' regulator.\n"); + host->supply = NULL; + } ret = register_device(&mci->dev); if (ret) -- cgit v1.2.3 From 426ba13f41e59151dce5d20dca1d4279192b60dc Mon Sep 17 00:00:00 2001 From: Andrey Smirnov Date: Wed, 12 Dec 2018 23:10:33 -0800 Subject: video: mtl017: Make sure errno is not used as a regulator pointer Since regulator_get() can return an errno via regulator pointer, we need to make sure we handle that case without passing bogus pointers around. Add code to convert mtl017->regulator to a dummy regulator if regulator_get() fails. Signed-off-by: Andrey Smirnov Signed-off-by: Sascha Hauer --- drivers/video/mtl017.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/video/mtl017.c b/drivers/video/mtl017.c index 085ea110ba..423fb8e4fd 100644 --- a/drivers/video/mtl017.c +++ b/drivers/video/mtl017.c @@ -244,6 +244,9 @@ static int mtl017_probe(struct device_d *dev) mtl017->client = to_i2c_client(dev); mtl017->regulator = regulator_get(dev, "vdd"); + if (IS_ERR(mtl017->regulator)) + mtl017->regulator = NULL; + mtl017->enable_gpio = of_get_named_gpio_flags(dev->device_node, "enable-gpios", 0, &flags); if (gpio_is_valid(mtl017->enable_gpio)) { -- cgit v1.2.3 From 9e2931ff9cb93e45798b50b34b89276ab9f21bae Mon Sep 17 00:00:00 2001 From: Alexander Shiyan Date: Thu, 13 Dec 2018 11:01:44 +0300 Subject: ARM: clps711x: Increase boot space Signed-off-by: Alexander Shiyan Signed-off-by: Sascha Hauer --- arch/arm/boards/clep7212/clep7212.c | 2 +- arch/arm/boards/clep7212/defaultenv-clep7212/init/mtdparts-nor | 2 +- arch/arm/mach-clps711x/Kconfig | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/arch/arm/boards/clep7212/clep7212.c b/arch/arm/boards/clep7212/clep7212.c index 584ecdcab2..641fa15021 100644 --- a/arch/arm/boards/clep7212/clep7212.c +++ b/arch/arm/boards/clep7212/clep7212.c @@ -37,7 +37,7 @@ static int clps711x_devices_init(void) add_cfi_flash_device(DEVICE_ID_DYNAMIC, (unsigned long)cfi_io, SZ_32M, IORESOURCE_MEM); - devfs_add_partition("nor0", 0x00000, SZ_256K, DEVFS_PARTITION_FIXED, + devfs_add_partition("nor0", 0x00000, SZ_512K, DEVFS_PARTITION_FIXED, "self0"); devfs_add_partition("nor0", SZ_256K, SZ_256K, DEVFS_PARTITION_FIXED, "env0"); diff --git a/arch/arm/boards/clep7212/defaultenv-clep7212/init/mtdparts-nor b/arch/arm/boards/clep7212/defaultenv-clep7212/init/mtdparts-nor index 39777f95f2..e2e518ca66 100644 --- a/arch/arm/boards/clep7212/defaultenv-clep7212/init/mtdparts-nor +++ b/arch/arm/boards/clep7212/defaultenv-clep7212/init/mtdparts-nor @@ -1,6 +1,6 @@ #!/bin/sh -mtdparts="256k(boot),256k(env),3584k(kernel),-(root)" +mtdparts="512k(boot),256k(env),3584k(kernel),-(root)" kernelname="physmap-flash.0" mtdparts-add -d nor0 -k ${kernelname} -p ${mtdparts} diff --git a/arch/arm/mach-clps711x/Kconfig b/arch/arm/mach-clps711x/Kconfig index 0853ce2e62..c00514e86d 100644 --- a/arch/arm/mach-clps711x/Kconfig +++ b/arch/arm/mach-clps711x/Kconfig @@ -24,7 +24,7 @@ endmenu config ARCH_TEXT_BASE hex - default 0xc0780000 if MACH_CLEP7212 + default 0xc0740000 if MACH_CLEP7212 config BAREBOX_MAX_IMAGE_SIZE hex -- cgit v1.2.3 From f606a778cb469f6bdf1680cacd3f53a0dbb22594 Mon Sep 17 00:00:00 2001 From: Roland Hieber Date: Mon, 10 Dec 2018 16:55:09 +0100 Subject: Documentation: i.MX: improve wording, add markup and missing articles Signed-off-by: Roland Hieber Signed-off-by: Sascha Hauer --- Documentation/boards/imx.rst | 102 ++++++++++++++++++++++++------------------- 1 file changed, 57 insertions(+), 45 deletions(-) diff --git a/Documentation/boards/imx.rst b/Documentation/boards/imx.rst index 35a180b0dd..2e6a30fd2f 100644 --- a/Documentation/boards/imx.rst +++ b/Documentation/boards/imx.rst @@ -43,40 +43,50 @@ SD card: The above will overwrite the MBR (and consequently the partition table) on the destination SD card. To preserve the MBR while writing the rest -of the image to the card, use:: +of the image to the card, use: + +.. code-block:: sh dd if=images/barebox-freescale-imx51-babbage.img of=/dev/sdd bs=1024 skip=1 seek=1 -NOTE: MaskROM on i.MX8 expects image to start at +33KiB mark, so the +Note that MaskROM on i.MX8 expects the image to start at the +33KiB mark, so the following command has to be used instead: +.. code-block:: sh + dd if=images/barebox-nxp-imx8mq-evk.img of=/dev/sdd bs=1024 skip=33 seek=33 Or, in case of NAND: +.. code-block:: sh + dd if=images/barebox-nxp-imx8mq-evk.img of=/dev/nand bs=1024 skip=33 seek=1 -The images can also always be started second stage:: +The images can also always be started as second stage on the target: + +.. code-block:: console - bootm /mnt/tftp/barebox-freescale-imx51-babbage.img + barebox@Board Name:/ bootm /mnt/tftp/barebox-freescale-imx51-babbage.img Using GPT on i.MX ^^^^^^^^^^^^^^^^^ -For i.MX SoCs that place vendor specific header at +1KiB mark of a -boot medium, special care needs to be taken when parition that medium -with GPT. In order to make room for i.MX boot header GPT Partition +For i.MX SoCs that place a vendor specific header at the +1KiB mark of a +boot medium, special care needs to be taken when partitioning that medium +with GPT. In order to make room for the i.MX boot header, the GPT Partition Entry Array needs to be moved from its typical location, LBA 2, to an offset past vendor specific information. One way to do this would be -to use ``-j`` or ``--adjust-main-table`` option of ``sgdisk``. For -example, the following sequence: +to use the ``-j`` or ``--adjust-main-table`` option of ``sgdisk``. For +example, the following sequence + +.. code-block:: sh sgdisk -Z sgdisk -o -j 2048 -n 1:8192:+100M will create a single GPT partition starting at LBA 8192 and would -place Partition Entry Array starting at LBA 2048 which should leave -enough room for Barebox/i.MX boot header. Once that is done ``dd`` +place the Partition Entry Array starting at LBA 2048, which should leave +enough room for the Barebox/i.MX boot header. Once that is done, the ``dd`` command above can be used to place Barebox on the same medium. Information about the ``imx-image`` tool @@ -89,46 +99,48 @@ options in this file are: Header: -+----------------+--------------------------------------------------------------+ -| soc |soctype can be one of imx35, imx51, imx53, imx6, imx7, vf610, | -| | imx8mq | -+----------------+--------------------------------------------------------------+ -| loadaddr | The address the binary is uploaded to | -+----------------+--------------------------------------------------------------+ -| dcdofs | The offset of the image header in the image. This should be: | -| | * ``0x400``: MMC/SD, NAND, serial ROM, PATA, SATA | -| | * ``0x1000``: NOR Flash | -| | * ``0x100``: OneNAND | -+----------------+--------------------------------------------------------------+ ++--------------------+--------------------------------------------------------------+ +| ``soc `` | soctype can be one of imx35, imx51, imx53, imx6, imx7, vf610,| +| | imx8mq | ++--------------------+--------------------------------------------------------------+ +| ``loadaddr `` | The address the binary is uploaded to | ++--------------------+--------------------------------------------------------------+ +| ``dcdofs `` | The offset of the image header in the image. This should be: | +| | | +| | * ``0x400``: MMC/SD, NAND, serial ROM, PATA, SATA | +| | * ``0x1000``: NOR Flash | +| | * ``0x100``: OneNAND | ++--------------------+--------------------------------------------------------------+ Memory manipulation: -+------------------------------------+-----------------------------------------+ -| wm 8 | write into byte | -+------------------------------------+-----------------------------------------+ -| wm 16 | write into short | -+------------------------------------+-----------------------------------------+ -| wm 32 | write into word | -+------------------------------------+-----------------------------------------+ -| set_bits | set set bits in in | -+------------------------------------+-----------------------------------------+ -| clear_bits | clear set bits in in | -+------------------------------------+-----------------------------------------+ -| nop | do nothing (just waste time) | -+------------------------------------+-----------------------------------------+ - - can be of 8, 16 or 32. ++----------------------------------------+-------------------------------------------------+ +| ``wm 8 `` | write ```` into byte ```` | ++----------------------------------------+-------------------------------------------------+ +| ``wm 16 `` | write ```` into short ```` | ++----------------------------------------+-------------------------------------------------+ +| ``wm 32 `` | write ```` into word ```` | ++----------------------------------------+-------------------------------------------------+ +| ``set_bits `` | set set bits in ```` in ```` | ++----------------------------------------+-------------------------------------------------+ +| ``clear_bits `` | clear set bits in ```` in ```` | ++----------------------------------------+-------------------------------------------------+ +| ``nop`` | do nothing (just waste time) | ++----------------------------------------+-------------------------------------------------+ + +```` can be one of 8, 16 or 32. Checking conditions: -+------------------------------------+-----------------------------------------+ -| check | Poll until condition becomes true. | -| | with being one of: | -| | * ``until_all_bits_clear`` | -| | * ``until_all_bits_set`` | -| | * ``until_any_bit_clear`` | -| | * ``until_any_bit_set`` | -+------------------------------------+-----------------------------------------+ ++----------------------------------------+-----------------------------------------+ +| ``check `` | Poll until condition becomes true. | +| | with ```` being one of: | +| | | +| | * ``until_all_bits_clear`` | +| | * ``until_all_bits_set`` | +| | * ``until_any_bit_clear`` | +| | * ``until_any_bit_set`` | ++----------------------------------------+-----------------------------------------+ Some notes about the mentioned *conditions*. -- cgit v1.2.3 From c0eecaa80739e2d70b8973e5736953dadf4323d7 Mon Sep 17 00:00:00 2001 From: Ahmad Fatoum Date: Fri, 14 Dec 2018 16:23:05 +0100 Subject: include/linux/time.h: define USEC_PER_SEC and friends Linux has them in include/linux/time64.h and they are useful for making (especially microsecond) use readable such as in read*_poll_timeout. Signed-off-by: Ahmad Fatoum Signed-off-by: Sascha Hauer --- include/linux/time.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/include/linux/time.h b/include/linux/time.h index 3a1bb50020..7903139a65 100644 --- a/include/linux/time.h +++ b/include/linux/time.h @@ -3,7 +3,13 @@ #include +#define MSEC_PER_SEC 1000L +#define USEC_PER_MSEC 1000L +#define NSEC_PER_USEC 1000L +#define NSEC_PER_MSEC 1000000L +#define USEC_PER_SEC 1000000L #define NSEC_PER_SEC 1000000000L +#define FSEC_PER_SEC 1000000000000000LL struct timespec { time_t tv_sec; /* seconds */ -- cgit v1.2.3 From 943d69083c855deeb3d7ba11d1d3f2892f90901a Mon Sep 17 00:00:00 2001 From: Ahmad Fatoum Date: Fri, 14 Dec 2018 16:23:08 +0100 Subject: net: fec_imx: fix timeout off by *1000 error read*_poll_timeout's final timeout parameter is in microseconds, but the supplied arguments in fec_imx.c were in nanoseconds, which might lead to barebox getting seemingly stuck in fec_halt (loops for a thousand seconds instead of one). I've tested this still works on an i.MX6D by copying a file over TFTP and verifying the hash is correct. Signed-off-by: Ahmad Fatoum Signed-off-by: Sascha Hauer --- drivers/net/fec_imx.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/net/fec_imx.c b/drivers/net/fec_imx.c index c2628cc1d6..4823b08340 100644 --- a/drivers/net/fec_imx.c +++ b/drivers/net/fec_imx.c @@ -51,7 +51,7 @@ static int fec_miibus_read(struct mii_bus *bus, int phyAddr, int regAddr) * wait for the related interrupt */ if (readl_poll_timeout(fec->regs + FEC_IEVENT, reg, - reg & FEC_IEVENT_MII, MSECOND)) { + reg & FEC_IEVENT_MII, USEC_PER_MSEC)) { dev_err(&fec->edev.dev, "Read MDIO failed...\n"); return -1; } @@ -88,7 +88,7 @@ static int fec_miibus_write(struct mii_bus *bus, int phyAddr, * wait for the MII interrupt */ if (readl_poll_timeout(fec->regs + FEC_IEVENT, reg, - reg & FEC_IEVENT_MII, MSECOND)) { + reg & FEC_IEVENT_MII, USEC_PER_MSEC)) { dev_err(&fec->edev.dev, "Write MDIO failed...\n"); return -1; } @@ -401,7 +401,7 @@ static void fec_halt(struct eth_device *dev) /* wait for graceful stop to register */ if (readl_poll_timeout(fec->regs + FEC_IEVENT, reg, - reg & FEC_IEVENT_GRA, SECOND)) + reg & FEC_IEVENT_GRA, USEC_PER_SEC)) dev_err(&dev->dev, "graceful stop timeout\n"); /* Disable SmartDMA tasks */ @@ -475,7 +475,7 @@ static int fec_send(struct eth_device *dev, void *eth_data, int data_length) fec_tx_task_enable(fec); if (readw_poll_timeout(&fec->tbd_base[fec->tbd_index].status, - status, !(status & FEC_TBD_READY), SECOND)) + status, !(status & FEC_TBD_READY), USEC_PER_SEC)) dev_err(&dev->dev, "transmission timeout\n"); dma_unmap_single(fec->dev, dma, data_length, DMA_TO_DEVICE); @@ -796,7 +796,7 @@ static int fec_probe(struct device_d *dev) /* Reset chip. */ writel(FEC_ECNTRL_RESET, fec->regs + FEC_ECNTRL); ret = readl_poll_timeout(fec->regs + FEC_ECNTRL, reg, - !(reg & FEC_ECNTRL_RESET), SECOND); + !(reg & FEC_ECNTRL_RESET), USEC_PER_SEC); if (ret) goto free_gpio; -- cgit v1.2.3 From a64b47afac79db8720a479ab0b5012ecd8496a61 Mon Sep 17 00:00:00 2001 From: Teresa Remmet Date: Tue, 18 Dec 2018 13:40:03 +0100 Subject: commands: nand-bitflip: Add documentation for option '-c' Signed-off-by: Teresa Remmet Signed-off-by: Sascha Hauer --- commands/nand-bitflip.c | 1 + 1 file changed, 1 insertion(+) diff --git a/commands/nand-bitflip.c b/commands/nand-bitflip.c index a8a97c153a..cfde2f4040 100644 --- a/commands/nand-bitflip.c +++ b/commands/nand-bitflip.c @@ -107,6 +107,7 @@ BAREBOX_CMD_HELP_START(nand_bitflip) BAREBOX_CMD_HELP_TEXT("This command creates bitflips on Nand pages.") BAREBOX_CMD_HELP_TEXT("Options:") BAREBOX_CMD_HELP_OPT ("-b ", "block to work on") +BAREBOX_CMD_HELP_OPT ("-c\t", "Check only for bitflips") BAREBOX_CMD_HELP_OPT ("-o ", "offset in Nand") BAREBOX_CMD_HELP_OPT ("-r\t", "flip random bits") BAREBOX_CMD_HELP_OPT ("-n ", "Specify maximum number of bitflips to generate") -- cgit v1.2.3 From d5285342d87dcaf9aef7514e09558972099de64a Mon Sep 17 00:00:00 2001 From: Ahmad Fatoum Date: Wed, 2 Jan 2019 14:35:48 +0100 Subject: mci: skip of_partitions_register_fixup for boot partitions The bootN-partitions binding is barebox-specific, so it shouldn't be fixed up into the kernel device tree. Suggested-by: Sascha Hauer Signed-off-by: Ahmad Fatoum Signed-off-by: Sascha Hauer --- drivers/mci/mci-core.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/mci/mci-core.c b/drivers/mci/mci-core.c index 2693100956..0bd68b15b8 100644 --- a/drivers/mci/mci-core.c +++ b/drivers/mci/mci-core.c @@ -1628,7 +1628,12 @@ static int mci_register_partition(struct mci_part *part) if (np) { of_parse_partitions(&part->blk.cdev, np); - of_partitions_register_fixup(&part->blk.cdev); + + /* bootN-partitions binding barebox-specific, so don't register + * for fixup into kernel device tree + */ + if (part->area_type != MMC_BLK_DATA_AREA_BOOT) + of_partitions_register_fixup(&part->blk.cdev); } return 0; -- cgit v1.2.3 From 58ccf5137f1f6179bb851186610c9d165ba30db6 Mon Sep 17 00:00:00 2001 From: Sam Ravnborg Date: Mon, 31 Dec 2018 09:07:21 +0100 Subject: 2d-primitives: fix no previous prototype warning MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fix the following warnings: lib/gui/2d-primitives.c:88:6: warning: no previous prototype for ‘gu_draw_line’ [-Wmissing-prototypes] void gu_draw_line(struct screen *sc, ^~~~~~~~~~~~ lib/gui/2d-primitives.c:174:6: warning: no previous prototype for ‘gu_draw_circle’ [-Wmissing-prototypes] void gu_draw_circle(struct screen *sc, ^~~~~~~~~~~~~~ Signed-off-by: Sam Ravnborg Signed-off-by: Sascha Hauer --- lib/gui/2d-primitives.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/gui/2d-primitives.c b/lib/gui/2d-primitives.c index 82e59d9a67..940e82b7d4 100644 --- a/lib/gui/2d-primitives.c +++ b/lib/gui/2d-primitives.c @@ -7,6 +7,8 @@ #include #include +#include + static void __illuminate(struct fb_info *info, int x, int y, u8 r, u8 g, u8 b, u8 a) -- cgit v1.2.3 From 8e2f92c146d219af0c1770b3afc5785f2d8df830 Mon Sep 17 00:00:00 2001 From: Sam Ravnborg Date: Mon, 31 Dec 2018 09:07:24 +0100 Subject: at91sam9263ek: fix build of of_init Fix mistake in Makefile that prevented build of of_init.o With this fix smc shows up in iomem like this: 0xffffe400 - 0xffffe5ff (size 0x00000200) at91sam9-smc0 0xffffea00 - 0xffffebff (size 0x00000200) at91sam9-smc1 And we get access to the files from defaultenv provided by the board Fixes: b467c262b5a7 (at91sam9263ek: enable DT support) Signed-off-by: Sam Ravnborg Signed-off-by: Sascha Hauer --- arch/arm/boards/at91sam9263ek/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm/boards/at91sam9263ek/Makefile b/arch/arm/boards/at91sam9263ek/Makefile index 66083a239e..d4d5e76395 100644 --- a/arch/arm/boards/at91sam9263ek/Makefile +++ b/arch/arm/boards/at91sam9263ek/Makefile @@ -1,7 +1,7 @@ ifeq ($(CONFIG_OFDEVICE),) obj-y += init.o endif -obj-$(CONFIG_OF_DEVICE) += of_init.o +obj-$(CONFIG_OFDEVICE) += of_init.o lwl-y += lowlevel_init.o -- cgit v1.2.3 From b02a0ed4ebc606b504898bce25c6531870d2aa0c Mon Sep 17 00:00:00 2001 From: Sam Ravnborg Date: Mon, 31 Dec 2018 09:07:25 +0100 Subject: video: mtl017: fix driver name variable It look like a copy-paste bug that the twl_driver name was used. Rename to the more sensible mtl_driver Signed-off-by: Sam Ravnborg Signed-off-by: Sascha Hauer --- drivers/video/mtl017.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/video/mtl017.c b/drivers/video/mtl017.c index 423fb8e4fd..c04875cd07 100644 --- a/drivers/video/mtl017.c +++ b/drivers/video/mtl017.c @@ -268,8 +268,8 @@ static int mtl017_probe(struct device_d *dev) return 0; } -static struct driver_d twl_driver = { +static struct driver_d mtl_driver = { .name = "mtl017", .probe = mtl017_probe, }; -device_i2c_driver(twl_driver); +device_i2c_driver(mtl_driver); -- cgit v1.2.3 From 0835bab7e51bb1d4db6e5210ffa82cf5a28cd5c4 Mon Sep 17 00:00:00 2001 From: Sam Ravnborg Date: Mon, 31 Dec 2018 09:07:22 +0100 Subject: images: fix force rebuild of piggy.o piggy.o would be build for every time barebox was built This had the sideeffect that the image(s) would always be rebuilt despite no changes Fix this by adding piggy.o to targets and avoid an extra command in the rule to create .pblb files The patch includes the removal of a stray assignment Fixes: 2078438662 ("Add multi images support") Signed-off-by: Sam Ravnborg Signed-off-by: Sascha Hauer --- images/Makefile | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/images/Makefile b/images/Makefile index 4c6d486f08..c4b2a483fb 100644 --- a/images/Makefile +++ b/images/Makefile @@ -43,7 +43,9 @@ # quiet_cmd_objcopy_bin = OBJCOPYB $@ - cmd_objcopy_bin = $(OBJCOPY) -O binary $(OBJCOPYFLAGS) $(OBJCOPYFLAGS_$(@F)) $< $@ + cmd_objcopy_bin = \ + $(OBJCOPY) -O binary $(OBJCOPYFLAGS) $(OBJCOPYFLAGS_$(@F)) $< $@ && \ + $(objtree)/scripts/fix_size -f $@ pbl-lds := $(obj)/pbl.lds extra-y += $(pbl-lds) @@ -59,8 +61,6 @@ quiet_cmd_elf__ ?= LD $@ PBL_CPPFLAGS += -fdata-sections -ffunction-sections -piggy_o := piggy.$(suffix_y).o - $(obj)/%.pbl: $(pbl-lds) $(barebox-pbl-common) $(obj)/piggy.o FORCE $(call if_changed,elf__,$(*F)) @@ -105,7 +105,7 @@ include $(srctree)/images/Makefile.tegra include $(srctree)/images/Makefile.vexpress include $(srctree)/images/Makefile.at91 -targets += $(image-y) pbl.lds barebox.x barebox.z +targets += $(image-y) pbl.lds barebox.x barebox.z piggy.o targets += $(patsubst %,%.pblb,$(pblb-y)) targets += $(patsubst %,%.pbl,$(pblb-y)) targets += $(patsubst %,%.s,$(pblb-y)) -- cgit v1.2.3 From 83842b8174515db446a33fda788b6df68a74bc09 Mon Sep 17 00:00:00 2001 From: Alexander Kurz Date: Mon, 24 Dec 2018 10:16:42 +0000 Subject: fs/fat: fix FAT32 detection Limits for the number of clusters were used to determine the FAT fs type. This fails e.g. for FAT32 fs with low cluster number that can be found in certain Android images. Sync the FAT fs type detection to the method used in linux by checking the sectors/FAT entries at offset 0x16 (must be zero for FAT32) and offset 0x24 (must be non-zero for FAT32). Signed-off-by: Alexander Kurz Signed-off-by: Sascha Hauer --- fs/fat/ff.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/fs/fat/ff.c b/fs/fat/ff.c index 33f8b6195d..ba4adfc133 100644 --- a/fs/fat/ff.c +++ b/fs/fat/ff.c @@ -1591,9 +1591,14 @@ static int chk_mounted ( /* 0(0): successful, !=0: any error occurred */ return -EINVAL; /* Number of sectors per FAT */ + fmt = FS_FAT12; fasize = LD_WORD(fs->win+BPB_FATSz16); - if (!fasize) + if (!fasize) { fasize = LD_DWORD(fs->win+BPB_FATSz32); + if (fasize) + /* Must be FAT32 */ + fmt = FS_FAT32; + } fs->fsize = fasize; /* Number of FAT copies */ @@ -1633,11 +1638,8 @@ static int chk_mounted ( /* 0(0): successful, !=0: any error occurred */ nclst = (tsect - sysect) / fs->csize; if (!nclst) return -EINVAL; /* (Invalid volume size) */ - fmt = FS_FAT12; - if (nclst >= MIN_FAT16) + if (fmt == FS_FAT12 && nclst >= MIN_FAT16) fmt = FS_FAT16; - if (nclst >= MIN_FAT32) - fmt = FS_FAT32; /* Boundaries and Limits */ /* Number of FAT entries */ -- cgit v1.2.3 From 23ea88c5e5f47df6beedc8f80ce03703d134e4fa Mon Sep 17 00:00:00 2001 From: Roland Hieber Date: Sun, 30 Dec 2018 03:18:23 +0100 Subject: README: add licensing information MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Now that we are moving away from boilerplate code towards SPDX license tags in individual file headers, we should have a short note about what these tags mean. Also, until now, there was effectively no explicit information that barebox is licensed under GPLv2 (only). This could have been interpolated from the existence of a GPLv2 text in ./COPYING (and from most of the individual file headers… have fun reading all of them), but a warranty and copyright notice was still missing. Add those as a catch-all for the project to ease application of GPLv2 article 0: 0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. […] and article 1: 1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; […] Since barebox goes back to U-Boot, I tried to find explicit project-wide copyright lines, but the only one I could find was the one from U-Boot's old README in commit 7e149c897b95b40752. If there are additional copyright holders, those are probably only present in the respective file headers. Signed-off-by: Roland Hieber Signed-off-by: Sascha Hauer --- README | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/README b/README index 940e1f96dd..dada97cab3 100644 --- a/README +++ b/README @@ -1,3 +1,5 @@ +# SPDX-License-Identifier: GPL-2.0-only + Barebox ------- @@ -222,3 +224,33 @@ are the release rules: does never change, in order to make life easier for distribution people. + +License +------- + +Copyright (C) 2000 - 2005 Wolfgang Denk, DENX Software Engineering, wd@denx.de. +Copyright (C) 2018 Sascha Hauer, Pengutronix, and individual contributors + +Barebox is free software: you can redistribute it and/or modify it under the +terms of the GNU General Public License, version 2, as published by the Free +Software Foundation. + +This program is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +PARTICULAR PURPOSE. See the GNU General Public License for more details. + +You should have received a copy of the GNU General Public License in the file +COPYING along with this program. If not, see . + +Individual files may contain the following SPDX license tags as a shorthand for +the above copyright and warranty notices: + + SPDX-License-Identifier: GPL-2.0-only + SPDX-License-Identifier: GPL-2.0-or-later + +This eases machine processing of licensing information based on the SPDX +License Identifiers that are available at http://spdx.org/licenses/. + +Also note that some files in the Barebox source tree are available under +several different GPLv2-compatible open-source licenses. This fact is noted +clearly in the file headers of the respective files. -- cgit v1.2.3 From 5feabc1e6737742f1cf6a1c41921f68b4dbb5c10 Mon Sep 17 00:00:00 2001 From: Sam Ravnborg Date: Wed, 2 Jan 2019 21:26:09 +0100 Subject: arm: at91: fix clock to mci1 for at91sam9263 at91_add_device_mci() was missing configuration of PIOA6 when configuring mci1. With this fix we can read data from SD card with at91sam9263ek, when built without DT. Building without a DT is required when we do a bootstrap build. The other at91samxxx_devices was checked - only the 9263 was missing the CLK configuration for mci1. Signed-off-by: Sam Ravnborg Signed-off-by: Sascha Hauer --- arch/arm/mach-at91/at91sam9263_devices.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/arch/arm/mach-at91/at91sam9263_devices.c b/arch/arm/mach-at91/at91sam9263_devices.c index a67345f05d..c7e4962a93 100644 --- a/arch/arm/mach-at91/at91sam9263_devices.c +++ b/arch/arm/mach-at91/at91sam9263_devices.c @@ -396,6 +396,9 @@ void at91_add_device_mci(short mmc_id, struct atmel_mci_platform_data *data) } else { /* MCI1 */ start = AT91SAM9263_BASE_MCI1; + /* CLK */ + at91_set_A_periph(AT91_PIN_PA6, 0); + if (data->slot_b) { /* CMD */ at91_set_A_periph(AT91_PIN_PA21, 1); -- cgit v1.2.3 From d80179baf828c8086edf68fa83ff67ab93d9a638 Mon Sep 17 00:00:00 2001 From: Roland Hieber Date: Fri, 4 Jan 2019 16:16:44 +0100 Subject: common: state: fix alignment Fixes: 7126dffd0be ("common: state: Add variable_type to state_variable") Signed-off-by: Roland Hieber Signed-off-by: Sascha Hauer --- common/state/state_variables.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/common/state/state_variables.c b/common/state/state_variables.c index 269d175874..50cffba700 100644 --- a/common/state/state_variables.c +++ b/common/state/state_variables.c @@ -132,7 +132,7 @@ static struct state_variable *state_uint8_create(struct state *state, static struct state_variable *state_uint32_create(struct state *state, const char *name, struct device_node *node, - const struct variable_type *vtype) + const struct variable_type *vtype) { struct state_uint32 *su32; struct param_d *param; @@ -223,7 +223,7 @@ static int state_enum32_import(struct state_variable *sv, static struct state_variable *state_enum32_create(struct state *state, const char *name, struct device_node *node, - const struct variable_type *vtype) + const struct variable_type *vtype) { struct state_enum32 *enum32; int ret, i, num_names; @@ -307,7 +307,7 @@ static int state_mac_import(struct state_variable *sv, struct device_node *node) static struct state_variable *state_mac_create(struct state *state, const char *name, struct device_node *node, - const struct variable_type *vtype) + const struct variable_type *vtype) { struct state_mac *mac; int ret; @@ -409,7 +409,7 @@ static int state_string_get(struct param_d *p, void *priv) static struct state_variable *state_string_create(struct state *state, const char *name, struct device_node *node, - const struct variable_type *vtype) + const struct variable_type *vtype) { struct state_string *string; uint32_t start_size[2]; -- cgit v1.2.3 From a8c86dd239154ed4c5b3a7e67fdd6822a96d75f4 Mon Sep 17 00:00:00 2001 From: Martin Hofmann Date: Sat, 5 Jan 2019 19:45:12 +0100 Subject: Add generic implementation for muldi3 Since version v2018.08.0 some shared copies of gcc routines got added to barebox so that archs don't need to have their own copy inside their lib. The arch I am working on atm also needs support for muldi3 which is not present as a generic version right now. This patch adds the generic version from latest linux v4.20 to barebox and lets the archs select it in their Kconfig so they don't need to provide it themself. Signed-off-by: Martin Hofmann Signed-off-by: Sascha Hauer --- include/lib/libgcc.h | 1 + lib/Kconfig | 3 +++ lib/Makefile | 1 + lib/muldi3.c | 73 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 78 insertions(+) create mode 100644 lib/muldi3.c diff --git a/include/lib/libgcc.h b/include/lib/libgcc.h index adad27704a..f7b9be61f6 100644 --- a/include/lib/libgcc.h +++ b/include/lib/libgcc.h @@ -43,5 +43,6 @@ typedef union { long long __lshrdi3(long long u, word_type b); long long __ashldi3(long long u, word_type b); long long __ashrdi3(long long u, word_type b); +long long __muldi3(long long u, long long v); #endif /* __ASM_LIBGCC_H */ diff --git a/lib/Kconfig b/lib/Kconfig index 67680adbb5..e048aded8b 100644 --- a/lib/Kconfig +++ b/lib/Kconfig @@ -145,4 +145,7 @@ config GENERIC_LIB_ASHRDI3 config GENERIC_LIB_LSHRDI3 bool +config GENERIC_LIB_MULDI3 + bool + endmenu diff --git a/lib/Makefile b/lib/Makefile index 8ece2c284f..e72aa6655c 100644 --- a/lib/Makefile +++ b/lib/Makefile @@ -72,5 +72,6 @@ obj-$(CONFIG_CRC8) += crc8.o obj-$(CONFIG_GENERIC_LIB_ASHLDI3) += ashldi3.o obj-$(CONFIG_GENERIC_LIB_ASHRDI3) += ashrdi3.o obj-$(CONFIG_GENERIC_LIB_LSHRDI3) += lshrdi3.o +obj-$(CONFIG_GENERIC_LIB_MULDI3) += muldi3.o pbl-$(CONFIG_GENERIC_LIB_ASHLDI3) += ashldi3.o diff --git a/lib/muldi3.c b/lib/muldi3.c new file mode 100644 index 0000000000..eec810e807 --- /dev/null +++ b/lib/muldi3.c @@ -0,0 +1,73 @@ +/* + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, see the file COPYING, or write + * to the Free Software Foundation, Inc. + */ + +#include + +#include + +#define W_TYPE_SIZE 32 + +#define __ll_B ((unsigned long) 1 << (W_TYPE_SIZE / 2)) +#define __ll_lowpart(t) ((unsigned long) (t) & (__ll_B - 1)) +#define __ll_highpart(t) ((unsigned long) (t) >> (W_TYPE_SIZE / 2)) + +/* If we still don't have umul_ppmm, define it using plain C. */ +#if !defined(umul_ppmm) +#define umul_ppmm(w1, w0, u, v) \ + do { \ + unsigned long __x0, __x1, __x2, __x3; \ + unsigned short __ul, __vl, __uh, __vh; \ + \ + __ul = __ll_lowpart(u); \ + __uh = __ll_highpart(u); \ + __vl = __ll_lowpart(v); \ + __vh = __ll_highpart(v); \ + \ + __x0 = (unsigned long) __ul * __vl; \ + __x1 = (unsigned long) __ul * __vh; \ + __x2 = (unsigned long) __uh * __vl; \ + __x3 = (unsigned long) __uh * __vh; \ + \ + __x1 += __ll_highpart(__x0); /* this can't give carry */\ + __x1 += __x2; /* but this indeed can */ \ + if (__x1 < __x2) /* did we get it? */ \ + __x3 += __ll_B; /* yes, add it in the proper pos */ \ + \ + (w1) = __x3 + __ll_highpart(__x1); \ + (w0) = __ll_lowpart(__x1) * __ll_B + __ll_lowpart(__x0);\ + } while (0) +#endif + +#if !defined(__umulsidi3) +#define __umulsidi3(u, v) ({ \ + DWunion __w; \ + umul_ppmm(__w.s.high, __w.s.low, u, v); \ + __w.ll; \ + }) +#endif + +long long notrace __muldi3(long long u, long long v) +{ + const DWunion uu = {.ll = u}; + const DWunion vv = {.ll = v}; + DWunion w = {.ll = __umulsidi3(uu.s.low, vv.s.low)}; + + w.s.high += ((unsigned long) uu.s.low * (unsigned long) vv.s.high + + (unsigned long) uu.s.high * (unsigned long) vv.s.low); + + return w.ll; +} +EXPORT_SYMBOL(__muldi3); -- cgit v1.2.3 From b3501cf81ba3ca6dafba7853a32a7b4d7f658de2 Mon Sep 17 00:00:00 2001 From: Roland Hieber Date: Mon, 7 Jan 2019 15:43:33 +0100 Subject: common: state: fix another alignment Fixes: 7126dffd0be ("common: state: Add variable_type to state_variable") Fixes: 6096a0cfa4a ("common: state: fix alignment") Signed-off-by: Roland Hieber Signed-off-by: Sascha Hauer --- common/state/state_variables.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/state/state_variables.c b/common/state/state_variables.c index 50cffba700..6a00c82203 100644 --- a/common/state/state_variables.c +++ b/common/state/state_variables.c @@ -102,7 +102,7 @@ static int state_uint8_set(struct param_d *p, void *priv) static struct state_variable *state_uint8_create(struct state *state, const char *name, struct device_node *node, - const struct variable_type *vtype) + const struct variable_type *vtype) { struct state_uint32 *su32; struct param_d *param; -- cgit v1.2.3 From 9b20b537c892ebb0e5e25d396d2bfc49b1234919 Mon Sep 17 00:00:00 2001 From: Sam Ravnborg Date: Sun, 6 Jan 2019 19:18:06 +0100 Subject: doc: add at91 documentation Add at91 specific documentation. Add files for the Atmel evaluations kits. This is mostly placeholders with some trivial information, but we now have files to add more information. Signed-off-by: Sam Ravnborg Signed-off-by: Sascha Hauer --- Documentation/boards/at91.rst | 51 ++++++++++++++++++++++ .../boards/at91/microchip-at91rm9200-ek.rst | 8 ++++ .../boards/at91/microchip-at91sam9260-ek.rst | 8 ++++ .../boards/at91/microchip-at91sam9261-ek.rst | 18 ++++++++ .../boards/at91/microchip-at91sam9263-ek.rst | 10 +++++ .../boards/at91/microchip-at91sam9g10-ek.rst | 8 ++++ .../boards/at91/microchip-at91sam9g20-ek.rst | 8 ++++ .../boards/at91/microchip-at91sam9m10g45-ek.rst | 8 ++++ .../boards/at91/microchip-at91sam9n12-ek.rst | 8 ++++ .../boards/at91/microchip-at91sam9x5-ek.rst | 10 +++++ 10 files changed, 137 insertions(+) create mode 100644 Documentation/boards/at91.rst create mode 100644 Documentation/boards/at91/microchip-at91rm9200-ek.rst create mode 100644 Documentation/boards/at91/microchip-at91sam9260-ek.rst create mode 100644 Documentation/boards/at91/microchip-at91sam9261-ek.rst create mode 100644 Documentation/boards/at91/microchip-at91sam9263-ek.rst create mode 100644 Documentation/boards/at91/microchip-at91sam9g10-ek.rst create mode 100644 Documentation/boards/at91/microchip-at91sam9g20-ek.rst create mode 100644 Documentation/boards/at91/microchip-at91sam9m10g45-ek.rst create mode 100644 Documentation/boards/at91/microchip-at91sam9n12-ek.rst create mode 100644 Documentation/boards/at91/microchip-at91sam9x5-ek.rst diff --git a/Documentation/boards/at91.rst b/Documentation/boards/at91.rst new file mode 100644 index 0000000000..f25cb01bb1 --- /dev/null +++ b/Documentation/boards/at91.rst @@ -0,0 +1,51 @@ +Microchip (Atmel) AT91 +====================== + +The Microchip (former Atmel) AT91 architecure has very good support within +barebox. +Most boards today have their description in their board files, but +boards are slowly migrating to use DT. +Likewise most boards are not yet migrated to multi image support, but +this is also ongoing. + +The boot process of the AT91 CPU's is a two step process. +The first step is named the bootstrap and at91bootstrap +is often used (https://github.com/linux4sam/at91bootstrap). +barebox supports bootstrapping some at91 boards as documented +in the following. + +The bootstrap program are loaded by a boot program and can be loaded +from DataFlash, NAND Flash, SD Card or via USB. +The bootstrap program do the low-level configuration of the +processor and then load and execute barebox. + +AT91 boards +----------- +The majority of the supported boards have a short entry here. +For each board defconfig file(s) are noted but barebox may include additional +defconfig files and may also include boards not included in the following. + +.. toctree:: + :glob: + :maxdepth: 1 + + at91/* + +TODO +---- +This is a list of AT91 specific TODO items, listed in no particular order. + +* fix prototype for barebox_arm_reset_vector. Introduce the prototype: + +.. code-block:: c + + void __naked __bare_init barebox_arm_reset_vector(uint32_t r0, uint32_t r1, uint32_t r2) + + +This will unify the prototype for the reset vector for multi image and standalone images + +* Update remaining boards to DT +* Update remaing boards to support multi image boot +* Get bootstrap working in combination with multi image +* Introduce defaultenv2 for all boards +* Add pwm driver (required to support backlight) diff --git a/Documentation/boards/at91/microchip-at91rm9200-ek.rst b/Documentation/boards/at91/microchip-at91rm9200-ek.rst new file mode 100644 index 0000000000..2eecf48272 --- /dev/null +++ b/Documentation/boards/at91/microchip-at91rm9200-ek.rst @@ -0,0 +1,8 @@ +Atmel AT91RM9200-EK Evaluation Kit +================================== + +Building barebox: + +.. code-block:: sh + + make ARCH=arm at91rm9200ek_defconfig diff --git a/Documentation/boards/at91/microchip-at91sam9260-ek.rst b/Documentation/boards/at91/microchip-at91sam9260-ek.rst new file mode 100644 index 0000000000..c54c262513 --- /dev/null +++ b/Documentation/boards/at91/microchip-at91sam9260-ek.rst @@ -0,0 +1,8 @@ +Atmel AT91SAM9260-EK Evaluation Kit +=================================== + +Building barebox: + +.. code-block:: sh + + make ARCH=arm at91sam9260ek_defconfig diff --git a/Documentation/boards/at91/microchip-at91sam9261-ek.rst b/Documentation/boards/at91/microchip-at91sam9261-ek.rst new file mode 100644 index 0000000000..df88282959 --- /dev/null +++ b/Documentation/boards/at91/microchip-at91sam9261-ek.rst @@ -0,0 +1,18 @@ +Atmel AT91SAM9261-EK Evaluation Kit +=================================== + +For AT91SAM9261-EK there are three defconfigs. + +The two defconfigs listed below are almost identical. +The one named _first_stage_ can be used for FLASH as it allows the first part to be loaded to SRAM. + +.. code-block:: sh + + make ARCH=arm at91sam9261ek_defconfig + make ARCH=arm at91sam9261ek_first_stage_defconfig + +The following defconfig can be used to build a bootstrap variant of barebox + +.. code-block:: sh + + make ARCH=arm at91sam9261ek_bootstrap_defconfig diff --git a/Documentation/boards/at91/microchip-at91sam9263-ek.rst b/Documentation/boards/at91/microchip-at91sam9263-ek.rst new file mode 100644 index 0000000000..74ddb3cdb6 --- /dev/null +++ b/Documentation/boards/at91/microchip-at91sam9263-ek.rst @@ -0,0 +1,10 @@ +Atmel AT91SAM9263-EK Evaluation Kit +=================================== + +The AT91SAM9263-EK evaluation kit supports Device Tree and Multi Images. + +Building barebox: + +.. code-block:: sh + + make ARCH=arm at91sam9263ek_defconfig diff --git a/Documentation/boards/at91/microchip-at91sam9g10-ek.rst b/Documentation/boards/at91/microchip-at91sam9g10-ek.rst new file mode 100644 index 0000000000..f8f7d561a5 --- /dev/null +++ b/Documentation/boards/at91/microchip-at91sam9g10-ek.rst @@ -0,0 +1,8 @@ +Atmel AT91SAM9G10-EK Evaluation Kit +=================================== + +Building barebox: + +.. code-block:: sh + + make ARCH=arm at91sam9g10ek_defconfig diff --git a/Documentation/boards/at91/microchip-at91sam9g20-ek.rst b/Documentation/boards/at91/microchip-at91sam9g20-ek.rst new file mode 100644 index 0000000000..b641e0a388 --- /dev/null +++ b/Documentation/boards/at91/microchip-at91sam9g20-ek.rst @@ -0,0 +1,8 @@ +Atmel AT91SAM9G20-EK Evaluation Kit +=================================== + +Building barebox: + +.. code-block:: sh + + make ARCH=arm at91sam9g20ek_defconfig diff --git a/Documentation/boards/at91/microchip-at91sam9m10g45-ek.rst b/Documentation/boards/at91/microchip-at91sam9m10g45-ek.rst new file mode 100644 index 0000000000..ac54ed7c58 --- /dev/null +++ b/Documentation/boards/at91/microchip-at91sam9m10g45-ek.rst @@ -0,0 +1,8 @@ +Atmel AT91SAM9M10G45-EK Evaluation Kit +====================================== + +Building barebox: + +.. code-block:: sh + + make ARCH=arm at91sam9m10g45ek_defconfig diff --git a/Documentation/boards/at91/microchip-at91sam9n12-ek.rst b/Documentation/boards/at91/microchip-at91sam9n12-ek.rst new file mode 100644 index 0000000000..8aeba53f1e --- /dev/null +++ b/Documentation/boards/at91/microchip-at91sam9n12-ek.rst @@ -0,0 +1,8 @@ +Atmel AT91SAM9N12-EK Evaluation Kit +=================================== + +Building barebox: + +.. code-block:: sh + + make ARCH=arm at91sam9n12ek_defconfig diff --git a/Documentation/boards/at91/microchip-at91sam9x5-ek.rst b/Documentation/boards/at91/microchip-at91sam9x5-ek.rst new file mode 100644 index 0000000000..4c7b0cf3da --- /dev/null +++ b/Documentation/boards/at91/microchip-at91sam9x5-ek.rst @@ -0,0 +1,10 @@ +Atmel AT91SAM9X5-EK Evaluation Kit +=================================== + +The AT91SAM9X5-EK kit supports Device Tree and Multi Images. + +Building barebox: + +.. code-block:: sh + + make ARCH=arm at91sam9x5ek_defconfig -- cgit v1.2.3 From 682e63e0bae09e17992727f6341ba72e36c5caa8 Mon Sep 17 00:00:00 2001 From: Sam Ravnborg Date: Sun, 6 Jan 2019 19:18:07 +0100 Subject: doc: add additional at91 boards Simple files that makes it simple to add further documentation later Signed-off-by: Sam Ravnborg Signed-off-by: Sascha Hauer --- Documentation/boards/at91/microchip-ksz9477-evb.rst | 11 +++++++++++ Documentation/boards/at91/microchip-sama5d3-xplained.rst | 8 ++++++++ Documentation/boards/at91/microchip-sama5d3x-ek.rst | 8 ++++++++ Documentation/boards/at91/microchip-sama5d4-xplained.rst | 8 ++++++++ Documentation/boards/at91/somfy-animeo-ip.rst | 4 ++++ Documentation/boards/at91/telit-evk-pro3.rst | 9 +++++++++ 6 files changed, 48 insertions(+) create mode 100644 Documentation/boards/at91/microchip-ksz9477-evb.rst create mode 100644 Documentation/boards/at91/microchip-sama5d3-xplained.rst create mode 100644 Documentation/boards/at91/microchip-sama5d3x-ek.rst create mode 100644 Documentation/boards/at91/microchip-sama5d4-xplained.rst create mode 100644 Documentation/boards/at91/somfy-animeo-ip.rst create mode 100644 Documentation/boards/at91/telit-evk-pro3.rst diff --git a/Documentation/boards/at91/microchip-ksz9477-evb.rst b/Documentation/boards/at91/microchip-ksz9477-evb.rst new file mode 100644 index 0000000000..4c4c4aecbf --- /dev/null +++ b/Documentation/boards/at91/microchip-ksz9477-evb.rst @@ -0,0 +1,11 @@ +Microchip KSZ 9477 Evaluation board +=================================== + +This is an evaluation board for a switch that uses the at91sam9x5 CPU. +The board uses Device Tree and supports multi image. + +Building barebox: + +.. code-block:: sh + + make ARCH=arm microchip_ksz9477_evb_defconfig diff --git a/Documentation/boards/at91/microchip-sama5d3-xplained.rst b/Documentation/boards/at91/microchip-sama5d3-xplained.rst new file mode 100644 index 0000000000..e96111af72 --- /dev/null +++ b/Documentation/boards/at91/microchip-sama5d3-xplained.rst @@ -0,0 +1,8 @@ +Atmel SAMA5D3_XPLAINED Evaluation Kit +===================================== + +Building barebox: + +.. code-block:: sh + + make ARCH=arm sama5d3_xplained_defconfig diff --git a/Documentation/boards/at91/microchip-sama5d3x-ek.rst b/Documentation/boards/at91/microchip-sama5d3x-ek.rst new file mode 100644 index 0000000000..10bf2e611d --- /dev/null +++ b/Documentation/boards/at91/microchip-sama5d3x-ek.rst @@ -0,0 +1,8 @@ +Atmel SAMA5D3X Evaluation Kit +============================= + +Building barebox: + +.. code-block:: sh + + make ARCH=arm sama5d3xek_defconfig diff --git a/Documentation/boards/at91/microchip-sama5d4-xplained.rst b/Documentation/boards/at91/microchip-sama5d4-xplained.rst new file mode 100644 index 0000000000..d8615e4aff --- /dev/null +++ b/Documentation/boards/at91/microchip-sama5d4-xplained.rst @@ -0,0 +1,8 @@ +Atmel SAMA5D4 XPLAINED ULTRA Evaluation Kit +=========================================== + +Building barebox: + +.. code-block:: sh + + make ARCH=arm sama5d4_xplained_defconfig diff --git a/Documentation/boards/at91/somfy-animeo-ip.rst b/Documentation/boards/at91/somfy-animeo-ip.rst new file mode 100644 index 0000000000..a87179469b --- /dev/null +++ b/Documentation/boards/at91/somfy-animeo-ip.rst @@ -0,0 +1,4 @@ +Somfy Animeo IP +=============== + +No defconfig provided to build barebox diff --git a/Documentation/boards/at91/telit-evk-pro3.rst b/Documentation/boards/at91/telit-evk-pro3.rst new file mode 100644 index 0000000000..ea0b070fd1 --- /dev/null +++ b/Documentation/boards/at91/telit-evk-pro3.rst @@ -0,0 +1,9 @@ +Atmel Telit EVK-PRO3 +==================== + +Telit EVK-PRO3 with GE863-PRO3 +Building barebox: + +.. code-block:: sh + + make ARCH=arm telit_evk_pro3_defconfig -- cgit v1.2.3 From 2008b1feccebe61c4d57aa3d55ac57c49a8ec179 Mon Sep 17 00:00:00 2001 From: Sam Ravnborg Date: Sun, 6 Jan 2019 19:18:08 +0100 Subject: doc: at91sam9263-ek: add notes Add notes from working on bootstrap support Signed-off-by: Sam Ravnborg Signed-off-by: Sascha Hauer --- .../boards/at91/microchip-at91sam9263-ek.rst | 122 +++++++++++++++++++++ 1 file changed, 122 insertions(+) diff --git a/Documentation/boards/at91/microchip-at91sam9263-ek.rst b/Documentation/boards/at91/microchip-at91sam9263-ek.rst index 74ddb3cdb6..8022cdd678 100644 --- a/Documentation/boards/at91/microchip-at91sam9263-ek.rst +++ b/Documentation/boards/at91/microchip-at91sam9263-ek.rst @@ -8,3 +8,125 @@ Building barebox: .. code-block:: sh make ARCH=arm at91sam9263ek_defconfig + +Notes while working on at91sam9263ek bootstrap support + +The at91sam9263 have support for a boot program, +like the other members in the Atmel at91 series. + +The boot program (ROMBOOT) will try to load the +boot program from DataFlash, SD Card, NAND Flash and USB + +SD Card is the first to try. +It looks for a file named BOOT.BIN in the first +partition in a FAT16/32 filesystem. + +To generate the SD Card image I used genimage: +(https://github.com/pengutronix/genimage) +Onle 2 GB SD card works, 4 GB did not work. ROMBOOT do not +support high capacity SD cards. + +Configuration file: + +.. code-block:: none + + image boot.vfat { + name = "boot" + vfat { + /* + * RomBOOT in the at91sam9263 does not recognize + * the default FAT partition created by mkdosfs. + * -n BOOT - Set volume label to "BOOT" + * -F 16 - Force the partition to FAT 16 + * -D 0 - Set drive number to 0 + * -R 1 -a - Reserve only one sector + * The combination of "-D 0" AND "-R 1 -a" + * is required with mkdosfs version 4.1 + */ + extraargs = "-n BOOT -F 16 -D 0 -R 1 -a" + file BOOT.BIN { image = "barebox.bin" } // barebox.bin from root of barebox dir + file barebox.bin { image = "barebox-at91sam9263ek.img" } + file zImage { image = "zImage" } + } + + size = 16M + } + + image rootfs.ext4 { + ext4 { + label = "root" + } + mountpoint = "/" + size = 1500M + } + + image SD { + hdimage {} + + partition boot { + partition-type = 0xc + bootable = "true" + image = "boot.vfat" + } + + partition root { + image = "rootfs.ext4" + partition-type = 0x83 + } + + } + +ROMBOOT will load the BOOT.BIN file to internal SRAM that +starts at 0x300000. Maximum size 0x12000 (72 KiB). +When loaded ROMBOOT will remap like this: + +.. code-block:: none + + 0x00000000 0x00000000 + Internal ROM => Internal SRAM + + 0x00300000 0x00400000 + Internal SRAM => Internal ROM + +It is not documented but assumed that ROMBOOT uses the +MMU to remap the addresses. +There seems not to be a dedicated remapping feature that is used. + +Note: For DataFlash and NAND Flash the image is validated. +The first 28 bytes must be valid load PC or PC relative addressing. +Vector 0x6 must include the size of the image (in bytes). +This validation is (according to datasheet) not done for SD Card boots. + +barebox related notes when trying to make it work with PBL enabled + +To let barebox detect the SD card early use: CONFIG_MCI_STARTUP=y + +When PBL (and MULTI_IMAGE) are enabled then barebox creates +a binary with the following structure: + +.. code-block:: none + + +----------------------+ + | PBL (PreBootLoader) | + +----------------------+ + | piggy.o | + |+--------------------+| + ||barebox second stage|| + |+--------------------+| + +----------------------+ + +The PBL contains code from the sections .text_head_entry*, .text_bare_init* and .text* + +``.text_head_entry*:`` +This is the reset vector and exception vectors. Must be the very first in the file + +``.text_bare_init*:`` +Everything in this section, and , is checked at link time. +Size most be less than BAREBOX_MAX_BARE_INIT_SIZE / ARCH_BAREBOX_MAX_BARE_INIT_SIZE + +at91 specify the size of the two sections in exception vector 6 (see above), +if CONFIG_AT91_LOAD_BAREBOX_SRAM is defined. +I think this is because some at91 variants have only very limited SRAM size, +and we copy only a minimal part to the SRAM. The remaining part is then +executed in-place. +For at91sam9263 we have a large SRAM so there is room for the full bootstrap binary. -- cgit v1.2.3 From f91a993e39f43bf78e9723cec207fd03cf4867d9 Mon Sep 17 00:00:00 2001 From: Andrey Smirnov Date: Tue, 8 Jan 2019 20:09:02 -0800 Subject: memory_display: Fix type of argument passed to %*s On AArch64, pointer arithmetic in (pos - line) resolves into "long int", whereas "%*s" is expecting regular "int". Add explicit cast to avoid compiler warnings. Signed-off-by: Andrey Smirnov Signed-off-by: Sascha Hauer --- common/memory_display.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/memory_display.c b/common/memory_display.c index cd0eadf88d..fbb8bbb6fa 100644 --- a/common/memory_display.c +++ b/common/memory_display.c @@ -96,7 +96,7 @@ int __pr_memory_display(int level, const void *addr, loff_t offs, unsigned nbyte offs += size; } - pos += sprintf(pos, "%*s", 61 - (pos - line), ""); + pos += sprintf(pos, "%*s", (int)(61 - (pos - line)), ""); cp = linebuf; for (i = 0; i < linebytes; i++) { -- cgit v1.2.3 From d79673c5766f29a96cc19218987f61e01c150b43 Mon Sep 17 00:00:00 2001 From: Andrey Smirnov Date: Tue, 8 Jan 2019 20:09:17 -0800 Subject: mfd: syscon: Switch to using %pa to print memory addresses Switch to using %pa to print memory addresses in order to be able to support both 64 and 32 bit builds. Signed-off-by: Andrey Smirnov Signed-off-by: Sascha Hauer --- drivers/mfd/syscon.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/mfd/syscon.c b/drivers/mfd/syscon.c index 957d9a7267..30ed65f737 100644 --- a/drivers/mfd/syscon.c +++ b/drivers/mfd/syscon.c @@ -176,7 +176,7 @@ static int syscon_probe(struct device_d *dev) syscon->base = IOMEM(res->start); dev->priv = syscon; - dev_dbg(dev, "map 0x%x-0x%x registered\n", res->start, res->end); + dev_dbg(dev, "map %pa-%pa registered\n", &res->start, &res->end); return 0; } -- cgit v1.2.3 From b71d0d733ed1360ff85be584373d7c4b6f495747 Mon Sep 17 00:00:00 2001 From: Andrey Smirnov Date: Tue, 8 Jan 2019 20:09:33 -0800 Subject: printk: Pass groupsize to memory_display() in print_hex_dump() Don't hardcode grouping data into 4-byte words in print_hex_dump() implementation and instead pass 'groupsize' to memory_display(), since that's what that parameter is for. Signed-off-by: Andrey Smirnov Signed-off-by: Sascha Hauer --- include/printk.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/printk.h b/include/printk.h index aaad07552e..ab2c64cf3c 100644 --- a/include/printk.h +++ b/include/printk.h @@ -119,7 +119,7 @@ static inline void print_hex_dump(const char *level, const char *prefix_str, int prefix_type, int rowsize, int groupsize, const void *buf, size_t len, bool ascii) { - memory_display(buf, 0, len, 4, 0); + memory_display(buf, 0, len, groupsize, 0); } struct log_entry { -- cgit v1.2.3 From 0473048c4fa5410b0c4a75f667f7b317e44c15df Mon Sep 17 00:00:00 2001 From: Ladislav Michl Date: Wed, 9 Jan 2019 12:29:45 +0100 Subject: usbgadget: dfu: remove useless break in the switch statement Signed-off-by: Ladislav Michl Signed-off-by: Sascha Hauer --- drivers/usb/gadget/dfu.c | 5 ----- 1 file changed, 5 deletions(-) diff --git a/drivers/usb/gadget/dfu.c b/drivers/usb/gadget/dfu.c index d7bf92cdff..c2b3d481af 100644 --- a/drivers/usb/gadget/dfu.c +++ b/drivers/usb/gadget/dfu.c @@ -489,7 +489,6 @@ static int dfu_setup(struct usb_function *f, const struct usb_ctrlrequest *ctrl) value = handle_dnload(f, ctrl); dfu->dfu_state = DFU_STATE_dfuDNLOAD_IDLE; return 0; - break; case USB_REQ_DFU_UPLOAD: dfu->dfu_state = DFU_STATE_dfuUPLOAD_IDLE; debug("dfu: starting upload from %s\n", dfu_file_entry->filename); @@ -505,7 +504,6 @@ static int dfu_setup(struct usb_function *f, const struct usb_ctrlrequest *ctrl) } handle_upload(f, ctrl); return 0; - break; case USB_REQ_DFU_ABORT: dfu->dfu_status = DFU_STATUS_OK; value = 0; @@ -517,7 +515,6 @@ static int dfu_setup(struct usb_function *f, const struct usb_ctrlrequest *ctrl) default: dfu->dfu_state = DFU_STATE_dfuERROR; value = -EINVAL; - goto out; break; } break; @@ -544,7 +541,6 @@ static int dfu_setup(struct usb_function *f, const struct usb_ctrlrequest *ctrl) case USB_REQ_DFU_UPLOAD: handle_upload(f, ctrl); return 0; - break; case USB_REQ_DFU_ABORT: dfu_abort(dfu); value = 0; @@ -574,7 +570,6 @@ static int dfu_setup(struct usb_function *f, const struct usb_ctrlrequest *ctrl) case DFU_STATE_dfuMANIFEST: dfu->dfu_state = DFU_STATE_dfuERROR; value = -EINVAL; - goto out; break; default: break; -- cgit v1.2.3