Re: [PATCH 12/12] commands: add parted

2024-02-19 Thread Ulrich Ölmann
ing a partition number.\n");
> + return -EINVAL;
> + }
> +
> + ret = kstrtoul(argv[1], 0, );
> + if (ret)
> + return ret;
> +
> + pdesc = pdesc_get(blk);
> + if (!pdesc)
> + return -EINVAL;
> +
> + ret = partition_remove(pdesc, num);
> + if (ret)
> + return ret;
> +
> + table_needs_write = true;
> +
> + return 2;
> +}
> +
> +static int do_mklabel(struct block_device *blk, int argc, char *argv[])
> +{
> + struct partition_desc *pdesc;
> +
> + if (argc < 2) {
> + printf("Error: Expecting a disk label type.\n");
> + return -EINVAL;
> + }
> +
> + pdesc = partition_table_new(blk, argv[1]);
> + if (IS_ERR(pdesc)) {
> + printf("Error: Cannot create partition table: %pe\n", pdesc);
> + return PTR_ERR(pdesc);
> + }
> +
> + table_needs_write = true;
> +
> + if (gpdesc)
> + partition_table_free(gpdesc);
> + gpdesc = pdesc;
> +
> + return 2;
> +}
> +
> +static int do_refresh(struct block_device *blk, int argc, char *argv[])
> +{
> + struct partition_desc *pdesc;
> +
> + pdesc = pdesc_get(blk);
> + if (!pdesc)
> + return -EINVAL;
> +
> + table_needs_write = true;
> +
> + return 1;
> +}
> +
> +struct parted_command {
> + const char *name;
> + int (*command)(struct block_device *blk, int argc, char *argv[]);
> +};
> +
> +struct parted_command parted_commands[] = {
> + {
> + .name = "mkpart",
> + .command = do_mkpart,
> + }, {
> + .name = "print",
> + .command = do_print,
> + }, {
> + .name = "rm",
> + .command = do_rmpart,
> + }, {
> + .name = "mklabel",
> + .command = do_mklabel,
> + }, {
> + .name = "unit",
> + .command = do_unit,
> + }, {
> + .name = "refresh",
> + .command = do_refresh,
> + },
> +};
> +
> +static int parted_run_command(struct block_device *blk, int argc, char 
> *argv[])
> +{
> + int i;
> +
> + for (i = 0; i < ARRAY_SIZE(parted_commands); i++) {
> + struct parted_command *cmd = _commands[i];
> +
> + if (!strcmp(argv[0], cmd->name))
> + return cmd->command(blk, argc, argv);
> + }
> +
> + printf("No such command: %s\n", argv[0]);
> +
> + return COMMAND_ERROR;
> +}
> +
> +static int do_parted(int argc, char *argv[])
> +{
> + struct cdev *cdev;
> + struct block_device *blk;
> + int ret = 0;
> +
> + table_needs_write = false;
> + gpdesc = NULL;
> +
> + if (argc < 3)
> + return COMMAND_ERROR_USAGE;
> +
> + cdev = cdev_open_by_name(argv[1], O_RDWR);
> + if (!cdev) {
> + printf("Cannot open %s\n", argv[1]);
> + return COMMAND_ERROR;
> + }
> +
> + blk = cdev_get_block_device(cdev);
> + if (!blk) {
> + ret = -EINVAL;
> + goto err;
> + }
> +
> + argc -= 2;
> + argv += 2;
> +
> + while (argc) {
> + debug("---> run command %s\n", argv[0]);
> + ret = parted_run_command(blk, argc, argv);
> + if (ret < 0)
> + break;
> +
> + argc -= ret;
> + argv += ret;
> +
> + ret = 0;
> + }
> +
> + if (!ret && gpdesc && table_needs_write)
> + ret = partition_table_write(gpdesc);
> +
> +err:
> + if (gpdesc)
> + partition_table_free(gpdesc);
> +
> + cdev_close(cdev);
> +
> + return ret;
> +}
> +
> +BAREBOX_CMD_HELP_START(parted)
> +BAREBOX_CMD_HELP_TEXT("parted is a partition manipulation program with a 
> behaviour similar to")
> +BAREBOX_CMD_HELP_TEXT("GNU Parted")
> +BAREBOX_CMD_HELP_TEXT("")
> +BAREBOX_CMD_HELP_TEXT("commands:")
> +BAREBOX_CMD_HELP_OPT ("print", "print partitions")
> +BAREBOX_CMD_HELP_OPT ("mklabel ", "create a new partition table")
> +BAREBOX_CMD_HELP_OPT ("rm ", "remove a partition")
> +BAREBOX_CMD_HELP_OPT ("mkpart", "create a new 
> partition")
> +BAREBOX_CMD_HELP_OPT ("unit ", "change display/input units")
> +BAREBOX_CMD_HELP_OPT ("refresh", "refresh a partition table")
> +BAREBOX_CMD_HELP_TEXT("")
> +BAREBOX_CMD_HELP_TEXT(" can be one of \"s\" (sectors), \"B\" (bytes), 
> \"kB\", \"MB\", \"GB\", \"TB\",")
> +BAREBOX_CMD_HELP_TEXT("\"KiB\", \"MiB\", \"GiB\" or \"TiB\"")
> +BAREBOX_CMD_HELP_TEXT(" must be \"gpt\"")
> +BAREBOX_CMD_HELP_TEXT(" can be one of  \"ext2\", \"ext3\", \"ext4\", 
> \"fat16\" or \"fat32\"")
> +BAREBOX_CMD_HELP_TEXT(" for MBR partition tables can be one of 
> \"primary\", \"extended\" or")
> +BAREBOX_CMD_HELP_TEXT("\"logical\". For GPT this is a name string.")
> +BAREBOX_CMD_HELP_END
> +
> +BAREBOX_CMD_START(parted)
> + .cmd= do_parted,
> + BAREBOX_CMD_DESC("edit partition tables")
> + BAREBOX_CMD_OPTS(" [command [options...]...]")
> + BAREBOX_CMD_GROUP(CMD_GRP_FILE)
> + BAREBOX_CMD_HELP(cmd_parted_help)
> +BAREBOX_CMD_END
-- 
Pengutronix e.K.   | Ulrich Ölmann   |
Industrial Linux Solutions | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0|
Amtsgericht Hildesheim, HRA 2686   | Fax:   +49-5121-206917- |



Re: [PATCH] Documentation: dt-bindings: leds: document 'default-on' trigger

2023-11-21 Thread Ulrich Ölmann
Hi Roland,

On Tue, Nov 21 2023 at 17:20 +0100, Roland Hieber  wrote:
> The default-on trigger has been supported in barebox since commit
> 767c6b4a814a2a000f3b (2014-02-28, Sascha Hauer: "led: Add default-on
> trigger").
>
> Signed-off-by: Roland Hieber 
> ---
>  Documentation/devicetree/bindings/leds/common.rst | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/Documentation/devicetree/bindings/leds/common.rst 
> b/Documentation/devicetree/bindings/leds/common.rst
> index 09b4e401bc2c..ad94ceb506b1 100644
> --- a/Documentation/devicetree/bindings/leds/common.rst
> +++ b/Documentation/devicetree/bindings/leds/common.rst
> @@ -9,6 +9,7 @@ Common leds properties
>  * ``net`` - LED indicates network activity (tx and rx)
>  * ``net-rx`` - LED indicates network activity (rx only)
>  * ``net-tx`` - LED indicates network activity (tx only)
> +* ``default-on`` – LED is switched on by default

the lines before utilize the character '-' while in your new line a '–'
is used. I think this should be consistent in one or the other
direction.

Best regards
Ulrich


>  * ``label``: The label for this LED. If omitted, the label is taken
>from the node name (excluding the unit address).
-- 
Pengutronix e.K.   | Ulrich Ölmann   |
Industrial Linux Solutions | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0|
Amtsgericht Hildesheim, HRA 2686   | Fax:   +49-5121-206917- |



[PATCH 2/2] ARM: skov-imx6: Add new calibration values for i.MX6S

2023-08-15 Thread Ulrich Ölmann
From: Sascha Hauer 

Update to new DDR3 calibration values. The values are taken from the
NXP DDR Stress Test (3.0.0) on a board variant 19 (ptx internal
inventory skov-K-00-02685).

The DRAM controller settings and IOMUX settings have been taken from
the MX6DL_DDR3_register_programming_aid_v2.2.xlxs file.

DDR setup debug output:
---
density:4 Gb (2 Gb per chip)
clock: 400MHz (2500 ps)
memspd:800
tcke=2
tcksrx=5
tcksre=5
taofpd=0
taonpd=0
todtlon=3
tanpd=3
taxpd=3
trfc=63
txs=67
txp=2
txpdll=9
tfaw=19
tcl=3
trcd=5
trp=5
trc=19
tras=13
twr=5
tmrd=11
tcwl=3
tdllk=511
trtp=3
twtr=3
trrd=3
txpr=67
cs0_end=23
ncs=1
Rtt_wr=0
Rtt_nom=2
SRT=0
tcl=3
twr=5
MR2 CS0: 0x8032
MR3 CS0: 0x8033
MR1 CS0: 0x00408031
MR0 CS0: 0x15208030


DDR Stress Test (3.0.0)
Build: Dec 14 2018, 14:20:16
NXP Semiconductors.



Chip ID
CHIP ID = i.MX6 Solo/DualLite (0x61)
Internal Revision = TO1.2



Boot Configuration
SRC_SBMR1(0x020d8004) = 0x28003032
SRC_SBMR2(0x020d801c) = 0x0201


What ARM core speed would you like to run?
Type 1 for 800MHz, 2 for 1GHz
ARM Clock set to 800MHz


DDR configuration
BOOT_CFG3[5-4]: 0x00, Single DDR channel.
DDR type is DDR3
Data width: 32, bank num: 8
Row size: 14, col size: 10
Chip select CSD0 is used
Density per chip select: 512MB


Current Temperature: 50


Please select the DDR density per chip select (in bytes) on the board
Type 0 for 2GB; 1 for 1GB; 2 for 512MB; 3 for 256MB; 4 for 128MB; 5 for 64MB; 6 
for 32MB
For maximum supported density (4GB), we can only access up to 3.75GB.  Type 7 
to select this
  DDR density selected (MB): 128

Would do you want to change VDD_SOC_CAP/VDD_ARM_CAP voltage? Type 'y' to run 
and 'n' to skip

Would do you want run DDR Calibration? Type 'y' to run and 'n' to skip

Calibration will run at DDR frequency 400MHz. Type 'y' to continue.
If you want to run at other DDR frequency. Type 'n'
  Please enter the MR1 value on the initilization script
  This will be re-programmed into MR1 after write leveling calibration
  Enter as a 4-digit HEX value, example 0004, then hit enter
0040DDR Freq: 396 MHz

ddr_mr1=0x0040
Start write leveling calibration...
running Write level HW calibration
  MPWLHWERR register read out for factory diagnostics:
  MPWLHWERR PHY0 = 0x78787878

Write leveling calibration completed, update the following registers in your 
initialization script
MMDC_MPWLDECTRL0 ch0 (0x021b080c) = 0x004A004B
MMDC_MPWLDECTRL1 ch0 (0x021b0810) = 0x00420046
Write DQS delay result:
   Write DQS0 delay: 75/256 CK
   Write DQS1 delay: 74/256 CK
   Write DQS2 delay: 70/256 CK
   Write DQS3 delay: 66/256 CK

WARNING: write-leveling calibration value is greater than 1/8 CK.
Per the reference manual, WALAT must be set to 1 in the register 
MDMISC(0x021B0018).
This has been performed automatically.
However, in addition to updating the calibration values in your DDR 
initialization,
it is also REQUIRED change the value of MDMISC in their DDR 
initialization as follows:

MMDC_MDMISC (0x021b0018) =  0x00091740

Starting DQS gating calibration
. HC_DEL=0x result[00]=0x0001
. HC_DEL=0x0001 result[01]=0x0001
. HC_DEL=0x0002 result[02]=0x
. HC_DEL=0x0003 result[03]=0x
. HC_DEL=0x0004 result[04]=0x
. HC_DEL=0x0005 result[05]=0x
. HC_DEL=0x0006 result[06]=0x
. HC_DEL=0x0007 result[07]=0x
. HC_DEL=0x0008 result[08]=0x
. HC_DEL=0x0009 result[09]=0x
. HC_DEL=0x000A result[0A]=0x
. HC_DEL=0x000B result[0B]=0x
. HC_DEL=0x000C result[0C]=0x
. HC_DEL=0x000D result[0D]=0x
DQS HC delay value low1 = 0x0002, high1=0x03030303

loop ABS offset to get HW_DG_LOW
. ABS_OFFSET=0x result[00]=0x0001
. ABS_OFFSET=0x0004 result[01]=0x0001
. ABS_OFFSET=0x0008 result[02]=0x
. ABS_OFFSET=0x000C result[03]=0x
. ABS_OFFSET=0x0010 result[04]=0x
. ABS_OFFSET=0x0014 result[05]=0x
. ABS_OFFSET=0x0018 result[06]=0x
. ABS_OFFSET=0x001C result[07]=0x
. ABS_OFFSET=0x0020 result[08]=0x
. ABS_OFFSET=0x0024 result[09]=0x
. ABS_OFFSET=0x0028 result[0A]=0x
. ABS_OFFSET=0x002C result[0B]=0x
. ABS_OFFSET=0x0030 result[0C]=0x
. ABS_OFFSET=0x0034 result[0D]=0x
. ABS_OFFSET=0x0038 result[0E]=0x
. ABS_OFFSET=0x003C 

[PATCH 1/2] ARM: skov-imx6: Add new calibration values for i.MX6Q

2023-08-15 Thread Ulrich Ölmann
From: Sascha Hauer 

Update to new DDR3 calibration values. The values are taken from the
NXP DDR Stress Test (3.0.0) on a board variant 24 (ptx internal
inventory skov-K-00-04624).

The DRAM controller settings and IOMUX settings have been taken from
the MX6DQ_DDR3_register_programming_aid_v2.4.xlxs file.

DDR setup debug output:
---
density:8 Gb (2 Gb per chip)
clock: 528MHz (1893 ps)
memspd:1066
tcke=2
tcksrx=6
tcksre=6
taofpd=1
taonpd=1
todtlon=4
tanpd=4
taxpd=4
trfc=84
txs=89
txp=3
txpdll=12
tfaw=26
tcl=5
trcd=7
trp=7
trc=25
tras=18
twr=7
tmrd=11
tcwl=4
tdllk=511
trtp=3
twtr=3
trrd=5
txpr=89
cs0_end=39
ncs=1
Rtt_wr=0
Rtt_nom=2
SRT=0
tcl=5
twr=7
MR2 CS0: 0x00088032
MR3 CS0: 0x8033
MR1 CS0: 0x00408031
MR0 CS0: 0x19408030


DDR Stress Test (3.0.0)
Build: Dec 14 2018, 14:20:05
NXP Semiconductors.



Chip ID
CHIP ID = i.MX6 Dual/Quad (0x63)
Internal Revision = TO1.6



Boot Configuration
SRC_SBMR1(0x020d8004) = 0x28003032
SRC_SBMR2(0x020d801c) = 0x0201


What ARM core speed would you like to run?
Type 1 for 800MHz, 2 for 1GHz, 3 for 1.2GHz
ARM Clock set to 800MHz


DDR configuration
BOOT_CFG3[5-4]: 0x00, Single DDR channel.
DDR type is DDR3
Data width: 64, bank num: 8
Row size: 14, col size: 10
Chip select CSD0 is used
Density per chip select: 1024MB


Current Temperature: 37


Please select the DDR density per chip select (in bytes) on the board
Type 0 for 2GB; 1 for 1GB; 2 for 512MB; 3 for 256MB; 4 for 128MB; 5 for 64MB; 6 
for 32MB
For maximum supported density (4GB), we can only access up to 3.75GB.  Type 7 
to select this
  DDR density selected (MB): 128

Would do you want to change VDD_SOC_CAP/VDD_ARM_CAP voltage? Type 'y' to run 
and 'n' to skip

Would do you want run DDR Calibration? Type 'y' to run and 'n' to skip

Calibration will run at DDR frequency 528MHz. Type 'y' to continue.
If you want to run at other DDR frequency. Type 'n'
  Please enter the MR1 value on the initilization script
  This will be re-programmed into MR1 after write leveling calibration
  Enter as a 4-digit HEX value, example 0004, then hit enter
0040DDR Freq: 528 MHz

ddr_mr1=0x0040
Start write leveling calibration...
running Write level HW calibration
  MPWLHWERR register read out for factory diagnostics:
  MPWLHWERR PHY0 = 0x3c3e3c3c
  MPWLHWERR PHY1 = 0x3e3c3e3c

Write leveling calibration completed, update the following registers in your 
initialization script
MMDC_MPWLDECTRL0 ch0 (0x021b080c) = 0x00230023
MMDC_MPWLDECTRL1 ch0 (0x021b0810) = 0x0029001E
MMDC_MPWLDECTRL0 ch1 (0x021b480c) = 0x001F002A
MMDC_MPWLDECTRL1 ch1 (0x021b4810) = 0x001A0028
Write DQS delay result:
   Write DQS0 delay: 35/256 CK
   Write DQS1 delay: 35/256 CK
   Write DQS2 delay: 30/256 CK
   Write DQS3 delay: 41/256 CK
   Write DQS4 delay: 42/256 CK
   Write DQS5 delay: 31/256 CK
   Write DQS6 delay: 40/256 CK
   Write DQS7 delay: 26/256 CK

WARNING: write-leveling calibration value is greater than 1/8 CK.
Per the reference manual, WALAT must be set to 1 in the register 
MDMISC(0x021B0018).
This has been performed automatically.
However, in addition to updating the calibration values in your DDR 
initialization,
it is also REQUIRED change the value of MDMISC in their DDR 
initialization as follows:

MMDC_MDMISC (0x021b0018) =  0x00091740

Starting DQS gating calibration
. HC_DEL=0x result[00]=0x11101101
. HC_DEL=0x0001 result[01]=0x11101101
. HC_DEL=0x0002 result[02]=0x0011
. HC_DEL=0x0003 result[03]=0x
. HC_DEL=0x0004 result[04]=0x
. HC_DEL=0x0005 result[05]=0x
. HC_DEL=0x0006 result[06]=0x
. HC_DEL=0x0007 result[07]=0x
. HC_DEL=0x0008 result[08]=0x
. HC_DEL=0x0009 result[09]=0x
. HC_DEL=0x000A result[0A]=0x
. HC_DEL=0x000B result[0B]=0x
. HC_DEL=0x000C result[0C]=0x
. HC_DEL=0x000D result[0D]=0x
DQS HC delay value low1 = 0x02020003, high1=0x04040404
DQS HC delay value low2 = 0x02020300, high2=0x04040404

loop ABS offset to get HW_DG_LOW
. ABS_OFFSET=0x result[00]=0x11101101
. ABS_OFFSET=0x0004 result[01]=0x11101101
. ABS_OFFSET=0x0008 result[02]=0x11001101
. ABS_OFFSET=0x000C result[03]=0x1101
. ABS_OFFSET=0x0010 result[04]=0x11001100
. ABS_OFFSET=0x0014 result[05]=0x11001100
. ABS_OFFSET=0x0018 result[06]=0x11001100
. ABS_OFFSET=0x001C result[07]=0x11001100
. ABS_OFFSET=0x0020 

Re: [PATCH] common: Kconfig: fix typo

2023-06-14 Thread Ulrich Ölmann
Forgot my SOB and sent a v2.

Ulrich


On Wed, Jun 14 2023 at 08:38 +0200, Ulrich Ölmann  
wrote:
> ---
>  common/Kconfig | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/common/Kconfig b/common/Kconfig
> index ce94718c848a..a36d823608ac 100644
> --- a/common/Kconfig
> +++ b/common/Kconfig
> @@ -711,7 +711,7 @@ config MMCBLKDEV_ROOTARG
> kernel doesn't contain commit [1]. The first linux kernel release
> containing that commit is v5.10-rc1.
>  
> -   The appending only happen if barebox 'linux.bootargs.bootm.appendroot'
> +   The appending only happens if barebox' 
> 'linux.bootargs.bootm.appendroot'
> variable is set or the used blspec entry contains 'linux-appendroot'.
>  
> Note: It is crucial that the kernel device tree and the barebox device
-- 
Pengutronix e.K.   | Ulrich Ölmann   |
Industrial Linux Solutions | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0|
Amtsgericht Hildesheim, HRA 2686   | Fax:   +49-5121-206917- |



[PATCH v2] common: Kconfig: fix typo

2023-06-14 Thread Ulrich Ölmann
Signed-off-by: Ulrich Ölmann 
---
 common/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/common/Kconfig b/common/Kconfig
index ce94718c848a..a36d823608ac 100644
--- a/common/Kconfig
+++ b/common/Kconfig
@@ -711,7 +711,7 @@ config MMCBLKDEV_ROOTARG
  kernel doesn't contain commit [1]. The first linux kernel release
  containing that commit is v5.10-rc1.
 
- The appending only happen if barebox 'linux.bootargs.bootm.appendroot'
+ The appending only happens if barebox' 
'linux.bootargs.bootm.appendroot'
  variable is set or the used blspec entry contains 'linux-appendroot'.
 
  Note: It is crucial that the kernel device tree and the barebox device
-- 
2.39.2




[PATCH] common: Kconfig: fix typo

2023-06-14 Thread Ulrich Ölmann
---
 common/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/common/Kconfig b/common/Kconfig
index ce94718c848a..a36d823608ac 100644
--- a/common/Kconfig
+++ b/common/Kconfig
@@ -711,7 +711,7 @@ config MMCBLKDEV_ROOTARG
  kernel doesn't contain commit [1]. The first linux kernel release
  containing that commit is v5.10-rc1.
 
- The appending only happen if barebox 'linux.bootargs.bootm.appendroot'
+ The appending only happens if barebox' 
'linux.bootargs.bootm.appendroot'
  variable is set or the used blspec entry contains 'linux-appendroot'.
 
  Note: It is crucial that the kernel device tree and the barebox device
-- 
2.39.2




Re: [PATCH 14/18] of: export new of_cdev_find helper

2023-06-01 Thread Ulrich Ölmann
IND_PATH_FLAGS_BB 1  /* return .bb device if 
> available */
>  int of_find_path(struct device_node *node, const char *propname, char 
> **outpath, unsigned flags);
> +struct cdev *of_cdev_find(struct device_node *node);
>  int of_find_path_by_node(struct device_node *node, char **outpath, unsigned 
> flags);
>  struct device_node *of_find_node_by_devpath(struct device_node *root, const 
> char *path);
>  int of_register_fixup(int (*fixup)(struct device_node *, void *), void 
> *context);
-- 
Pengutronix e.K.   | Ulrich Ölmann   |
Industrial Linux Solutions | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0|
Amtsgericht Hildesheim, HRA 2686   | Fax:   +49-5121-206917- |



Re: [PATCH 11/18] block: parse partition table on block device registration

2023-06-01 Thread Ulrich Ölmann
  of_parse_partitions(>blk.cdev, np);
>  
> diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
> index bf9176ce0922..79a5f9325ef8 100644
> --- a/drivers/nvme/host/core.c
> +++ b/drivers/nvme/host/core.c
> @@ -1,6 +1,5 @@
>  // SPDX-License-Identifier: GPL-2.0-only
>  #include 
> -#include 
>  
>  #include "nvme.h"
>  
> @@ -373,10 +372,6 @@ static void nvme_alloc_ns(struct nvme_ctrl *ctrl, 
> unsigned nsid)
>   goto out_free_id;
>   }
>  
> - ret = parse_partition_table(>blk);
> - if (ret)
> - dev_warn(ctrl->dev, "No partition table found\n");
> -
>   return;
>  out_free_id:
>   kfree(id);
> diff --git a/drivers/usb/storage/usb.c b/drivers/usb/storage/usb.c
> index 103ae293a3a4..dda713196071 100644
> --- a/drivers/usb/storage/usb.c
> +++ b/drivers/usb/storage/usb.c
> @@ -420,11 +420,6 @@ static int usb_stor_add_blkdev(struct us_data *us, 
> unsigned char lun)
>   goto BadDevice;
>   }
>  
> - /* create partitions on demand */
> - result = parse_partition_table(_dev->blk);
> - if (result != 0)
> - dev_warn(dev, "No partition table found\n");
> -
>   list_add_tail(_dev->list, >blk_dev_list);
>   dev_dbg(dev, "USB disk device successfully added\n");
-- 
Pengutronix e.K.   | Ulrich Ölmann   |
Industrial Linux Solutions | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0|
Amtsgericht Hildesheim, HRA 2686   | Fax:   +49-5121-206917- |



Re: [PATCH 09/18] cdev: record whether partition is parsed from OF

2023-06-01 Thread Ulrich Ölmann
Hi Ahmad,

again some nitpicky typo fixes.

On Wed, May 31 2023 at 16:59 +0200, Ahmad Fatoum  
wrote:
> Later code will make it possible to define a on-disk-described partition

s/a on-disk-described/an on-disk-described/

> in the DT as well. For this reason, we can't assumed

s/assumed/assume/

Best regards
Ulrich


> DEVFS_PARTITION_FROM_TABLE to mean !DT, so let's add a dedicated flag
> for that.
>
> Signed-off-by: Ahmad Fatoum 
> ---
>  drivers/of/partition.c | 5 +++--
>  fs/fs.c| 2 ++
>  include/driver.h   | 5 +++--
>  3 files changed, 8 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/of/partition.c b/drivers/of/partition.c
> index a70e503cec9e..15943502ce17 100644
> --- a/drivers/of/partition.c
> +++ b/drivers/of/partition.c
> @@ -74,6 +74,7 @@ struct cdev *of_parse_partition(struct cdev *cdev, struct 
> device_node *node)
>   }
>  
>   new->device_node = node;
> + new->flags |= DEVFS_PARTITION_FROM_OF;
>  
>   if (IS_ENABLED(CONFIG_NVMEM) && of_device_is_compatible(node, 
> "nvmem-cells")) {
>   struct nvmem_device *nvmem = nvmem_partition_register(new);
> @@ -162,7 +163,7 @@ int of_fixup_partitions(struct device_node *np, struct 
> cdev *cdev)
>   return 0;
>  
>   list_for_each_entry(partcdev, >partitions, partition_entry) {
> - if (partcdev->flags & DEVFS_PARTITION_FROM_TABLE)
> + if (!(partcdev->flags & DEVFS_PARTITION_FROM_OF))
>   continue;
>   n_parts++;
>   }
> @@ -213,7 +214,7 @@ int of_fixup_partitions(struct device_node *np, struct 
> cdev *cdev)
>   u8 tmp[16 * 16]; /* Up to 64-bit address + 64-bit size */
>   loff_t partoffset;
>  
> - if (partcdev->flags & DEVFS_PARTITION_FROM_TABLE)
> + if (!(partcdev->flags & DEVFS_PARTITION_FROM_OF))
>   continue;
>  
>   if (partcdev->mtd)
> diff --git a/fs/fs.c b/fs/fs.c
> index 1820e48393af..9d8aab268ca4 100644
> --- a/fs/fs.c
> +++ b/fs/fs.c
> @@ -88,6 +88,8 @@ void cdev_print(const struct cdev *cdev)
>   printf(" fixed-partition");
>   if (cdev->flags & DEVFS_PARTITION_READONLY)
>   printf(" readonly-partition");
> + if (cdev->flags & DEVFS_PARTITION_FROM_OF)
> + printf(" of-partition");
>   if (cdev->flags & DEVFS_PARTITION_FROM_TABLE)
>   printf(" table-partition");
>   if (cdev->flags & DEVFS_IS_MCI_MAIN_PART_DEV)
> diff --git a/include/driver.h b/include/driver.h
> index 42e513a15603..118d2adb6750 100644
> --- a/include/driver.h
> +++ b/include/driver.h
> @@ -584,8 +584,9 @@ extern struct list_head cdev_list;
>  #define DEVFS_PARTITION_FIXED(1U << 0)
>  #define DEVFS_PARTITION_READONLY (1U << 1)
>  #define DEVFS_IS_CHARACTER_DEV   (1U << 3)
> -#define DEVFS_PARTITION_FROM_TABLE   (1U << 4)
> -#define DEVFS_IS_MCI_MAIN_PART_DEV   (1U << 5)
> +#define DEVFS_IS_MCI_MAIN_PART_DEV   (1U << 4)
> +#define DEVFS_PARTITION_FROM_OF  (1U << 5)
> +#define DEVFS_PARTITION_FROM_TABLE   (1U << 6)
>  
>  struct cdev *devfs_add_partition(const char *devname, loff_t offset,
>   loff_t size, unsigned int flags, const char *name);
-- 
Pengutronix e.K.   | Ulrich Ölmann   |
Industrial Linux Solutions | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0|
Amtsgericht Hildesheim, HRA 2686   | Fax:   +49-5121-206917- |



Re: [PATCH 05/18] of: of_path: always call of_partition_ensure_probed before resolving

2023-06-01 Thread Ulrich Ölmann
Hi Ahmad,

as it looks that you are going to create a v2 anyway, just a small typo
fix.

On Wed, May 31 2023 at 16:59 +0200, Ahmad Fatoum  
wrote:
> of_find_path may be called on a partition, whose parent device is not
> yet probed. state code solves that by calling of_partition_ensure_probed
> before of_find_path_by_nde, but really we should be doing that for all

s/of_find_path_by_nde/of_find_path_by_node/

Best regards
Ulrich


> calls to of_find_path. Do so.
>
> Signed-off-by: Ahmad Fatoum 
> ---
>  common/state/state.c | 4 
>  drivers/of/of_path.c | 2 ++
>  2 files changed, 2 insertions(+), 4 deletions(-)
>
> diff --git a/common/state/state.c b/common/state/state.c
> index 6b4acbb32bcc..11cc86ff73be 100644
> --- a/common/state/state.c
> +++ b/common/state/state.c
> @@ -618,10 +618,6 @@ struct state *state_new_from_node(struct device_node 
> *node, bool readonly)
>   }
>  
>  #ifdef __BAREBOX__
> - ret = of_partition_ensure_probed(partition_node);
> - if (ret)
> - goto out_release_state;
> -
>   ret = of_find_path_by_node(partition_node, >backend_path, 0);
>  #else
>   ret = of_get_devicepath(partition_node, >backend_path, , 
> );
> diff --git a/drivers/of/of_path.c b/drivers/of/of_path.c
> index 1268cf36ee5b..059690e9b8e8 100644
> --- a/drivers/of/of_path.c
> +++ b/drivers/of/of_path.c
> @@ -43,6 +43,8 @@ static int __of_find_path(struct device_node *node, const 
> char *part, char **out
>   struct cdev *cdev;
>   bool add_bb = false;
>  
> + of_partition_ensure_probed(node);
> +
>   dev = of_find_device_by_node_path(node->full_name);
>   if (!dev) {
>   int ret;
-- 
Pengutronix e.K.   | Ulrich Ölmann   |
Industrial Linux Solutions | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0|
Amtsgericht Hildesheim, HRA 2686   | Fax:   +49-5121-206917- |



Re: [PATCH] of: partition: moan if adding a partition failed

2023-01-08 Thread Ulrich Ölmann
Hi Alexander,

On Sun, Jan 08 2023 at 16:34 +0300, Alexander Shiyan 
 wrote:
> Hello.
> Can you fix also double semicolon at line:
> new->device_node = node;;

just sent a v2.

Best regards
Ulrich


> пт, 6 янв. 2023 г. в 18:03, Ulrich Ölmann :
>>
>> Do not silently continue if e.g. the label of a partition defined in the
>> devicetree collides with the name of a partition defined in a GPT on the 
>> device.
>>
>> Signed-off-by: Ulrich Ölmann 
>> ---
>>  drivers/of/partition.c | 4 +++-
>>  1 file changed, 3 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/of/partition.c b/drivers/of/partition.c
>> index abbda674d6cb..b41498b4 100644
>> --- a/drivers/of/partition.c
>> +++ b/drivers/of/partition.c
>> @@ -67,8 +67,10 @@ struct cdev *of_parse_partition(struct cdev *cdev, struct 
>> device_node *node)
>> filename = basprintf("%s.%s", cdev->name, partname);
>>
>> new = devfs_add_partition(cdev->name, offset, size, flags, filename);
>> -   if (IS_ERR(new))
>> +   if (IS_ERR(new)) {
>> +   pr_err("Adding partition %s failed: %pe\n", filename, new);
>>         new = NULL;
>> +   }
>>
>> if (new)
>> new->device_node = node;;
>> --
>> 2.30.2
>>
>>
-- 
Pengutronix e.K.   | Ulrich Ölmann   |
Industrial Linux Solutions | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0|
Amtsgericht Hildesheim, HRA 2686   | Fax:   +49-5121-206917- |



[PATCH v2] of: partition: moan if adding a partition failed

2023-01-08 Thread Ulrich Ölmann
Do not silently continue if e.g. the label of a partition defined in the
devicetree collides with the name of a partition defined in a GPT on the device.

While already at it, fix a double semicolon a few lines downward.

Signed-off-by: Ulrich Ölmann 
---
 drivers/of/partition.c | 6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/of/partition.c b/drivers/of/partition.c
index abbda674d6cb..ed1114193062 100644
--- a/drivers/of/partition.c
+++ b/drivers/of/partition.c
@@ -67,11 +67,13 @@ struct cdev *of_parse_partition(struct cdev *cdev, struct 
device_node *node)
filename = basprintf("%s.%s", cdev->name, partname);
 
new = devfs_add_partition(cdev->name, offset, size, flags, filename);
-   if (IS_ERR(new))
+   if (IS_ERR(new)) {
+   pr_err("Adding partition %s failed: %pe\n", filename, new);
new = NULL;
+   }
 
if (new)
-   new->device_node = node;;
+   new->device_node = node;
 
if (IS_ENABLED(CONFIG_NVMEM) && of_device_is_compatible(node, 
"nvmem-cells")) {
struct nvmem_device *nvmem = nvmem_partition_register(new);
-- 
2.30.2




[PATCH] of: partition: moan if adding a partition failed

2023-01-06 Thread Ulrich Ölmann
Do not silently continue if e.g. the label of a partition defined in the
devicetree collides with the name of a partition defined in a GPT on the device.

Signed-off-by: Ulrich Ölmann 
---
 drivers/of/partition.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/of/partition.c b/drivers/of/partition.c
index abbda674d6cb..b41498b4 100644
--- a/drivers/of/partition.c
+++ b/drivers/of/partition.c
@@ -67,8 +67,10 @@ struct cdev *of_parse_partition(struct cdev *cdev, struct 
device_node *node)
filename = basprintf("%s.%s", cdev->name, partname);
 
new = devfs_add_partition(cdev->name, offset, size, flags, filename);
-   if (IS_ERR(new))
+   if (IS_ERR(new)) {
+   pr_err("Adding partition %s failed: %pe\n", filename, new);
new = NULL;
+   }
 
if (new)
new->device_node = node;;
-- 
2.30.2




Re: [PATCH] Documentation: i.MX8M: add EVK barebox installation documentation

2023-01-03 Thread Ulrich Ölmann
box image includes a 32KiB preamble that allows the image
> +to be directly writable to the start of the SD-Card or eMMC user area.
> +Unlike older i.MX8M, the i.MX8MP BootROM expects the bootloader to not
> +start as an offset when booting from eMMC boot partitions, thus the first

s/start as an offset/start at an offset/

Best regards
Ulrich


> +32KiB must be stripped.
> +
> +The ``barebox_update`` command takes care of this and need just be
> +supplied a barebox image as argument.
-- 
Pengutronix e.K.   | Ulrich Ölmann   |
Industrial Linux Solutions | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0|
Amtsgericht Hildesheim, HRA 2686   | Fax:   +49-5121-206917- |



Re: [PATCH] common: deep-probe: write deep probe enabled message to log

2022-12-22 Thread Ulrich Ölmann
Hi Ahmad,

On Thu, Dec 22 2022 at 15:35 +0100, Ahmad Fatoum  
wrote:
> The "Deep probe supported due to" was not written to log and thus only
> shown on startup and not in dmesg output. Make it available in both.
>
> Signed-off-by: Ahmad Fatoum 
> ---
>  common/deep-probe.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/common/deep-probe.c b/common/deep-probe.c
> index 1020ad93b7f7..931e5a17709d 100644
> --- a/common/deep-probe.c
> +++ b/common/deep-probe.c
> @@ -1,5 +1,7 @@
>  // SPDX-License-Identifier: GPL-2.0-only
>  
> +#define pr_fmt(fmt) "deep-probe: " fmt
> +
>  #include 
>  #include 
>  #include 
> @@ -27,7 +29,7 @@ bool deep_probe_is_supported(void)
>   for (; matches->compatible; matches++) {
>   if (of_machine_is_compatible(matches->compatible)) {
>   boardstate = DEEP_PROBE_SUPPORTED;
> - printk("Deep probe supported due to %s\n", 
> matches->compatible);
> + pr_info("supported due to %s\n", 
> matches->compatible);

was it by accident that you removed the message's beginning "Deep probe "?

Best regards
Ulrich


>   return true;
>   }
>   }
-- 
Pengutronix e.K.   | Ulrich Ölmann   |
Industrial Linux Solutions | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0|
Amtsgericht Hildesheim, HRA 2686   | Fax:   +49-5121-206917- |



Re: [PATCH 02/10] common: allow requesting SDRAM regions with custom flags

2022-08-16 Thread Ulrich Ölmann
Hi Ahmad,

On Mon, Aug 15 2022 at 17:32 +0200, Ahmad Fatoum  
wrote:
> Now that __request_region accepts a flag parameter, define
> __request_sdram_region, which also accepts a flag parameter and passes
> it through. The default flags for request_sdram_region() will be
> IORESOURCE_MEM as that ensures resource_contains behaves correctly when
> comparing against another memory resource.
>
> Signed-off-by: Ahmad Fatoum 
> ---
>  common/memory.c   |  8 +---
>  common/resource.c |  2 +-
>  include/memory.h  | 13 +++--
>  3 files changed, 17 insertions(+), 6 deletions(-)
>
> diff --git a/common/memory.c b/common/memory.c
> index 03fec1f1eb0e..347f83fd4cf8 100644
> --- a/common/memory.c
> +++ b/common/memory.c
> @@ -200,16 +200,18 @@ mmu_initcall(add_mem_devices);
>  /*
>   * Request a region from the registered sdram
>   */
> -struct resource *request_sdram_region(const char *name, resource_size_t 
> start,
> - resource_size_t size)
> +struct resource *__request_sdram_region(const char *name, unsigned flags,
> + resource_size_t start, resource_size_t 
> size)
>  {
>   struct memory_bank *bank;
>  
> + flags |= IORESOURCE_MEM;
> +
>   for_each_memory_bank(bank) {
>   struct resource *res;
>  
>   res = __request_region(bank->res, start, start + size - 1,
> -name, 0);
> +name, flags);
>   if (!IS_ERR(res))
>   return res;
>   }
> diff --git a/common/resource.c b/common/resource.c
> index 81f337668ef1..8678609229ab 100644
> --- a/common/resource.c
> +++ b/common/resource.c
> @@ -73,7 +73,7 @@ struct resource *__request_region(struct resource *parent,
>   }
>  
>  ok:
> - debug("%s ok: 0x%08llx:0x%08llx flags=%u\n", __func__,
> + debug("%s ok: 0x%08llx:0x%08llx flags=0x%x\n", __func__,

this hunk should be squashed/amended into patch 01/10 where the flags
parameter has originally been introduced into this debug message.

Best regards
Ulrich


>   (unsigned long long)start,
>   (unsigned long long)end, flags);
>  
> diff --git a/include/memory.h b/include/memory.h
> index c793bb51ed77..31da5d74d568 100644
> --- a/include/memory.h
> +++ b/include/memory.h
> @@ -23,8 +23,17 @@ int barebox_add_memory_bank(const char *name, 
> resource_size_t start,
>  
>  #define for_each_memory_bank(mem)list_for_each_entry(mem, _banks, 
> list)
>  
> -struct resource *request_sdram_region(const char *name, resource_size_t 
> start,
> - resource_size_t size);
> +struct resource *__request_sdram_region(const char *name, unsigned flags,
> + resource_size_t start, resource_size_t 
> size);
> +
> +static inline struct resource *request_sdram_region(const char *name,
> + resource_size_t start,
> + resource_size_t size)
> +{
> + /* IORESOURCE_MEM is implicit for all SDRAM regions */
> + return __request_sdram_region(name, 0, start, size);
> +}
> +
>  int release_sdram_region(struct resource *res);
>  
>  void memory_bank_find_space(struct memory_bank *bank, resource_size_t 
> *retstart,


-- 
Pengutronix e.K.   | Ulrich Ölmann   |
Industrial Linux Solutions | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0|
Amtsgericht Hildesheim, HRA 2686   | Fax:   +49-5121-206917- |



Re: [PATCH 2/2] Documentation: devel: porting: bring up to date

2022-08-05 Thread Ulrich Ölmann
 with a 
> zero
> +   stack top.
>  
>   - ``noinline``: Compiler code inlining is oblivious to stack manipulation in
> inline assembly. If you want to ensure a new function has its own stack 
> frame
> @@ -186,8 +193,9 @@ Looking at other boards you might see some different 
> patterns:
> a ``__noreturn noinline`` function.
>  
>   - ``arm_setup_stack``: For 32-bit ARM, ``arm_setup_stack`` initializes the 
> stack
> -   top when called from a naked C function, which allows to write the entry 
> point
> -   directly in C. The stack pointer will be decremented before pushing 
> values.
> +   top when called from a naked C function, which allowed to write the entry 
> point
> +   directly in C. Modern code should use ``ENTRY_FUNCTION_WITHSTACK`` 
> instead.
> +   Note that in both cases the stack pointer will be decremented before 
> pushing values.
> Avoid interleaving with C-code. See ``__naked`` above for more details.
>  
>   - ``__dtb_z_my_board_start[];``: Because the PBL normally doesn't parse 
> anything out
> @@ -362,12 +370,11 @@ Considerations when writing Linux drivers also apply to 
> barebox:
>  Miscellaneous Linux porting advice:
>  
>* Branches dependent on ``system_state``: Take the ``SYSTEM_BOOTING`` 
> branch
> -  * ``struct of_clk_hw_simple_get``: rename to ``struct 
> of_clk_src_simple_get``
>* ``usleep`` and co.: use ``[mud]elay``
> -  * ``.of_node``: use ``.device_node``
> +  * ``.of_node``: use ``.device_node`` or ``dev_of_node``
>* ``jiffies``: use ``get_time_ns()``
>* ``time_before``: use ``!is_timeout()``
> -  * ``clk_hw_register_fixed_rate_with_accuracy``: use 
> ``clk_register_fixed_rate`` without accuracy
> +  * ``clk_hw_register_fixed_rate_with_accuracy``: use 
> ``clk_hw_register_fixed_rate`` without accuracy
>* ``CLK_SET_RATE_GATE`` can be ignored
>* ``clk_prepare``: is for the non-atomic code preparing for clk 
> enablement. Merge it into ``clk_enable``
>  
> @@ -503,6 +510,10 @@ This can be done by implementing three functions:
> and resumes execution at the new location. This can be omitted
> if barebox won't initially execute out of ROM.
>  
> + - ``relocate_to_adr_full()``: This function does what
> +   ``relocate_to_adr()`` does and in addition moves the piggy data
> +   (the usually compressed barebox appended to the prebootloader).
> +
>  Of course, for these functions to work. The linker script needs
>  to ensure that the ELF relocation records are included in the
>  final image and define start and end markers so code can iterate
> @@ -511,7 +522,7 @@ over them.
>  To ease debugging, even when relocation has no yet happened,
>  barebox supports ``DEBUG_LL``, which acts similarly to the
>  PBL console, but does not require relocation. This is incompatible
> -with multi-image, function mso this should only be considered while 
> debugging.
> +with multi-image, so this should only be considered while debugging.
>  
>  Linker scripts
>  ==
> @@ -526,4 +537,7 @@ Generic DT image
>  It's a good idea to have the architecture generate an image that
>  looks like and can be booted just like a Linux kernel. This allows
>  easy testing with QEMU or booting from barebox or other bootloaders.
> -Refer to ``BOARD_GENERIC_DT`` for examples.
> +Refer to ``BOARD_GENERIC_DT`` for examples. If not possible, the
> +(sub-)architecture making use of the image should
> +``register_image_handler`` that can chain-boot the format from
> +a running barebox. This allows for quick debugging iterations.
-- 
Pengutronix e.K.   | Ulrich Ölmann   |
Industrial Linux Solutions | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0|
Amtsgericht Hildesheim, HRA 2686   | Fax:   +49-5121-206917- |



Re: [PATCH 1/2] Documentation: devel: project-ideas: update after DSA framework addition

2022-08-05 Thread Ulrich Ölmann
Hi Ahmad,

On Fri, Aug 05 2022 at 06:09 +0200, Ahmad Fatoum  wrote:
> We have a proper abstraction for switches now, so drop this idea
> from the list.
>
> Signed-off-by: Ahmad Fatoum 
> ---
>  Documentation/devel/project-ideas.rst | 6 ++
>  1 file changed, 2 insertions(+), 4 deletions(-)
>
> diff --git a/Documentation/devel/project-ideas.rst 
> b/Documentation/devel/project-ideas.rst
> index a3643298ab08..e49bfa6ca4da 100644
> --- a/Documentation/devel/project-ideas.rst
> +++ b/Documentation/devel/project-ideas.rst
> @@ -20,10 +20,8 @@ For GSoC, following barebox developers are mentoring:
>- Rouven Czerwinski (IRC: ``Emantor``)
>  
>  This list can be edited and extended by sending patches to the mailing list.
> -Other interesting ideas: Support for new file systems (EROFS, extfat, btrfs).
> -Switch device framework (currently scripts write into a ``/dev/switch`` file
> -to configure passthrough), Improvements for barebox-efi (e.g. as a coreboot
> -payload), ... etc.
> +Other interesting ideas: Support for new file systems (EROFS, extfat, btrfs),
> +Improvements for barebox-efi (e.g. as a coreboot payload), ... etc.

as a drive-by, could you fix

  s/Improvements/improvements/

as well?

Best regards
Ulrich


>  
>  Ideas listed below should contain a title, description, expected outcomes,
>  skills (and HW if any) required and a difficulty rating.
-- 
Pengutronix e.K.   | Ulrich Ölmann   |
Industrial Linux Solutions | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0|
Amtsgericht Hildesheim, HRA 2686   | Fax:   +49-5121-206917- |



[PATCH] doc: bootchooser: fix typo

2022-07-22 Thread Ulrich Ölmann
Signed-off-by: Ulrich Ölmann 
---
 Documentation/user/bootchooser.rst | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Documentation/user/bootchooser.rst 
b/Documentation/user/bootchooser.rst
index 8456e118230b..db0a4f8898d5 100644
--- a/Documentation/user/bootchooser.rst
+++ b/Documentation/user/bootchooser.rst
@@ -83,7 +83,7 @@ The bootchooser algorithm aborts when all enabled targets 
(priority > 0) have
 no remaining attempts left.
 
 To prevent ending up in an unbootable system after a number of failed boot
-attempts, there is a also a built-in mechanism to reset the counters to their 
defaults,
+attempts, there is also a built-in mechanism to reset the counters to their 
defaults,
 controlled by the ``global.bootchooser.reset_attempts`` variable. It holds a
 list of space-separated flags. Possible values are:
 
-- 
2.30.2




Re: [PATCH v3 1/5] common: add $global.serial_number with device tree fixup

2022-04-28 Thread Ulrich Ölmann
Hi Oleksij,

On Wed, Apr 27 2022 at 14:14 +0200, Oleksij Rempel  
wrote:
> From: Ahmad Fatoum 
>
> This new variable can be set by boards from C code or from the
> environment to change the serial number fixed up into the kernel device
> tree.
>
> Signed-off-by: Ahmad Fatoum 
> Signed-off-by: Oleksij Rempel 
> ---
>  common/Kconfig   |  5 +
>  common/misc.c| 16 
>  common/oftree.c  |  9 +
>  include/common.h |  3 +++
>  4 files changed, 33 insertions(+)
>
> diff --git a/common/Kconfig b/common/Kconfig
> index f7a6a96e87..d08302a573 100644
> --- a/common/Kconfig
> +++ b/common/Kconfig
> @@ -1066,6 +1066,11 @@ config MACHINE_ID
> Note: if no hashable information is available no machine id will be 
> passed
> to the kernel.
>  
> +config SERIAL_NUMBER_FIXUP
> + bool "fix up board serial number"
> + help
> +   fixup serial number supplied by board code info device tree

this should be

  s/code info device/code into device/

right?

Best regards
Ulrich


> +
>  config SYSTEMD_OF_WATCHDOG
>   bool "inform devicetree-enabled kernel of used watchdog"
>   depends on WATCHDOG && OFTREE && FLEXIBLE_BOOTARGS
> diff --git a/common/misc.c b/common/misc.c
> index 226635f0d4..3b3bc05bfd 100644
> --- a/common/misc.c
> +++ b/common/misc.c
> @@ -149,6 +149,7 @@ EXPORT_SYMBOL(barebox_get_model);
>  BAREBOX_MAGICVAR(global.model, "Product name of this hardware");
>  
>  static char *hostname;
> +static char *serial_number;
>  
>  /*
>   * The hostname is supposed to be the shortname of a board. It should
> @@ -179,6 +180,21 @@ EXPORT_SYMBOL(barebox_set_hostname_no_overwrite);
>  BAREBOX_MAGICVAR(global.hostname,
>   "shortname of the board. Also used as hostname for DHCP 
> requests");
>  
> +void barebox_set_serial_number(const char *__serial_number)
> +{
> + globalvar_add_simple_string("serial_number", _number);
> +
> + free(serial_number);
> + serial_number = xstrdup(__serial_number);
> +}
> +
> +const char *barebox_get_serial_number(void)
> +{
> + return serial_number;
> +}
> +
> +BAREBOX_MAGICVAR(global.serial_number, "Board serial number");
> +
>  void __noreturn panic(const char *fmt, ...)
>  {
>   va_list args;
> diff --git a/common/oftree.c b/common/oftree.c
> index bce0ff09d6..c6d75055cc 100644
> --- a/common/oftree.c
> +++ b/common/oftree.c
> @@ -207,6 +207,15 @@ static int of_fixup_bootargs(struct device_node *root, 
> void *unused)
>   int instance = reset_source_get_instance();
>   struct device_d *dev;
>  
> + if (IS_ENABLED(CONFIG_SERIAL_NUMBER_FIXUP)) {
> + const char *serialno;
> +
> + serialno = getenv("global.serial_number");
> + if (serialno)
> + of_property_write_string(root, "serial-number", 
> serialno);
> +
> + }
> +
>   node = of_create_node(root, "/chosen");
>   if (!node)
>   return -ENOMEM;
> diff --git a/include/common.h b/include/common.h
> index 4167d4676e..967502a7ab 100644
> --- a/include/common.h
> +++ b/include/common.h
> @@ -126,4 +126,7 @@ const char *barebox_get_hostname(void);
>  void barebox_set_hostname(const char *);
>  void barebox_set_hostname_no_overwrite(const char *);
>  
> +const char *barebox_get_serial_number(void);
> +void barebox_set_serial_number(const char *);
> +
>  #endif   /* __COMMON_H_ */


-- 
Pengutronix e.K.   | Ulrich Ölmann   |
Industrial Linux Solutions | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0|
Amtsgericht Hildesheim, HRA 2686   | Fax:   +49-5121-206917- |

___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


[PATCH 2/2] Documentation: reboot-mode: mention that system.reboot_mode.next is initially set to 'normal'

2022-01-20 Thread Ulrich Ölmann
Signed-off-by: Ulrich Ölmann 
---
 Documentation/user/reboot-mode.rst | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/Documentation/user/reboot-mode.rst 
b/Documentation/user/reboot-mode.rst
index 24deae78727e..83d4136b8592 100644
--- a/Documentation/user/reboot-mode.rst
+++ b/Documentation/user/reboot-mode.rst
@@ -31,7 +31,8 @@ Devices registered with the reboot mode API gain two 
parameters:
  - ``$dev_of_reboot_mode.prev`` (read-only): The reboot mode that was
set previously to barebox startup.
  - ``$dev_of_reboot_mode.next``: The next reboot mode, for when the
-   system is reset.
+   system is reset. Its initial value after startup is 0 which corresponds
+   to ``normal`` by default.
 
 The reboot mode driver core use the alias name if available to name
 the device. By convention, this should end with ``.reboot_mode``, e.g.::
-- 
2.30.2


___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


[PATCH 1/2] Documentation: reboot-mode: fix typos

2022-01-20 Thread Ulrich Ölmann
Signed-off-by: Ulrich Ölmann 
---
 Documentation/user/reboot-mode.rst | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/Documentation/user/reboot-mode.rst 
b/Documentation/user/reboot-mode.rst
index 681438d94498..24deae78727e 100644
--- a/Documentation/user/reboot-mode.rst
+++ b/Documentation/user/reboot-mode.rst
@@ -29,9 +29,9 @@ User API
 Devices registered with the reboot mode API gain two parameters:
 
  - ``$dev_of_reboot_mode.prev`` (read-only): The reboot mode that was
-   set previous to barebox startup
+   set previously to barebox startup.
  - ``$dev_of_reboot_mode.next``: The next reboot mode, for when the
-   system is reset
+   system is reset.
 
 The reboot mode driver core use the alias name if available to name
 the device. By convention, this should end with ``.reboot_mode``, e.g.::
-- 
2.30.2


___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


[PATCH] power: reset: Kconfig: fix copy-&-paste bug in help text

2022-01-19 Thread Ulrich Ölmann
Signed-off-by: Ulrich Ölmann 
---
 drivers/power/reset/Kconfig | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/power/reset/Kconfig b/drivers/power/reset/Kconfig
index e4151d8bc608..0a88bcdefa9b 100644
--- a/drivers/power/reset/Kconfig
+++ b/drivers/power/reset/Kconfig
@@ -12,7 +12,8 @@ config SYSCON_REBOOT_MODE
help
  Say y here will enable reboot mode driver. This will
  get reboot mode arguments and store it in SYSCON mapped
- register, then the bootloader can read it to take different
+ register, then the bootloader can read it and take different
+ action according to the mode.
 
 config NVMEM_REBOOT_MODE
bool "Generic NVMEM reboot mode driver"
-- 
2.30.2


___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


[PATCH] scripts: Kconfig: fix typo

2021-11-15 Thread Ulrich Ölmann
Signed-off-by: Ulrich Ölmann 
---
 scripts/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/scripts/Kconfig b/scripts/Kconfig
index a490aaa44ebb..ae8a8b18dd3f 100644
--- a/scripts/Kconfig
+++ b/scripts/Kconfig
@@ -7,7 +7,7 @@ config COMPILE_HOST_TOOLS
  on some config options. If you say yes here, the host tools that are
  not needed can be selected, too.
 
- This is usefull for compile coverage testing and for packaging the
+ This is useful for compile coverage testing and for packaging the
  host tools.
 
 source "scripts/imx/Kconfig"
-- 
2.30.2


___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


[PATCH] Documentation: reboot-mode: fix typos

2021-10-21 Thread Ulrich Ölmann
Signed-off-by: Ulrich Ölmann 
---
 Documentation/user/reboot-mode.rst | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/Documentation/user/reboot-mode.rst 
b/Documentation/user/reboot-mode.rst
index 507d6feb0141..681438d94498 100644
--- a/Documentation/user/reboot-mode.rst
+++ b/Documentation/user/reboot-mode.rst
@@ -10,7 +10,7 @@ that boot should happen from a different boot medium.
 
 Likewise, many bootloaders reuse such registers, or if unavailable,
 non-volatile memory to determine whether the OS requested a special
-reboot mode, e.g. rebooting into an USB recovery mode. This is
+reboot mode, e.g. rebooting into a USB recovery mode. This is
 common on Android systems.
 
 barebox implements the upstream device tree bindings for
@@ -52,11 +52,11 @@ Reset
 =
 
 Reboot modes can be stored on a syscon wrapping general purpose registers
-that survives warm resets. If the system instead did reset via an external
+that survive warm resets. If the system instead did reset via an external
 power management IC, the registers may lose their value.
 
 If such reboot mode storage is used, users must take care to use the correct
-reset provider. In barebox, multiple reset providers may co-exist. They
+reset provider. In barebox, multiple reset providers may co-exist. The
 ``reset`` command allows listing and choosing a specific reboot mode.
 
 Disambiguation
@@ -86,7 +86,7 @@ as the reboot mode.
 For cases, where the communication instead happens between barebox and an OS,
 they can be completely different, e.g. ``$bootsource`` may say barebox was
 booted from ``spi-nor``, while the reboot mode describes that barebox should
-boot the Kernel off an USB flash drive.
+boot the Kernel off a USB flash drive.
 
 Comparison to barebox state
 ---
-- 
2.30.2


___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


[PATCH 1/2] common: Kconfig: fix typos

2021-10-12 Thread Ulrich Ölmann
Signed-off-by: Ulrich Ölmann 
---
 common/Kconfig | 26 +-
 1 file changed, 13 insertions(+), 13 deletions(-)

diff --git a/common/Kconfig b/common/Kconfig
index 4239ddfb19e0..d8d20917aab6 100644
--- a/common/Kconfig
+++ b/common/Kconfig
@@ -10,7 +10,7 @@ config HAS_MODULES
 config HAS_CACHE
bool
help
- This allows you do run "make ARCH=sandbox allyesconfig".
+ This allows you to run "make ARCH=sandbox allyesconfig".
 
  Drivers that depend on a cache implementation can depend on this
  config, so that you don't get a compilation error.
@@ -18,7 +18,7 @@ config HAS_CACHE
 config HAS_DMA
bool
help
- This allows you do run "make ARCH=sandbox allyesconfig".
+ This allows you to run "make ARCH=sandbox allyesconfig".
 
  Drivers that depend on a DMA implementation can depend on this
  config, so that you don't get a compilation error.
@@ -630,7 +630,7 @@ config BOOTM_FITIMAGE
select FITIMAGE
depends on BOOTM && ARM
help
- Support using Flattened Image Tree (FIT) Images. FIT is an image
+ Support using Flattened Image Tree (FIT) images. FIT is an image
  format introduced by U-Boot. A FIT image contains one or multiple
  kernels, device trees and initrds. The FIT image itself is a flattened
  device tree binary. Have a look at the u-boot source tree
@@ -711,7 +711,7 @@ config MMCBLKDEV_ROOTARG
  variable is set or the used blspec entry contains 'linux-appendroot'.
 
  Note: It is crucial that the kernel device tree and the barebox device
- tree uses the same mmc aliases.
+ tree use the same mmc aliases.
 
  [1] fa2d0aa96941 ("mmc: core: Allow setting slot index via device tree
  alias")
@@ -968,7 +968,7 @@ config DEFAULT_ENVIRONMENT_GENERIC_NEW_IKCONFIG
depends on DEFAULT_ENVIRONMENT_GENERIC_NEW
help
  This option embeds the used barebox Kconfig .config file into the
- environment as /env/data/config. This will increases barebox image
+ environment as /env/data/config. This will increase barebox' image
  size. If unsure, say n here.
 
 config DEFAULT_ENVIRONMENT_PATH
@@ -1010,7 +1010,7 @@ config STATE_CRYPTO
select DIGEST
select DIGEST_HMAC_GENERIC
help
- This options enables HMAC based authentication support for
+ This option enables HMAC based authentication support for
  the state's header and data. This means the state framework
  can verify both the data integrity and the authentication of
  the state's header and data.
@@ -1084,8 +1084,8 @@ config EXTERNAL_DTS_FRAGMENTS
  the dtc include search path.
 
  A preprocessor macro based on the name of the main dts will be
- defined, which allows the dts fragments to based on which image of a
- multi image build they are being used in. Given the dts filename
+ defined, which allows the dts fragments to be based on which image of
+ a multi image build they are being used in. Given the dts filename
  used for a board is "foo-board.dts" the external dts usage can be
  limited to that board with
 
@@ -1093,9 +1093,9 @@ config EXTERNAL_DTS_FRAGMENTS
  ...
  #endif
 
- It not intended that this be put into into Barebox defconfig files.
- Instead, it's an external build system, like Yocto or buildroot, to
- add dts fragments from outside the Barebox source tree into the
+ It is not intended that this is put into Barebox' defconfig files.
+ Instead, it's an external build system's job, like Yocto or buildroot,
+ to add dts fragments from outside the Barebox source tree into the
  Barebox build.
 
 menu "OP-TEE loading"
@@ -1127,7 +1127,7 @@ config PBL_OPTEE
depends on !THUMB2_BAREBOX
help
  Allows starting OP-TEE during lowlevel initialization of the PBL.
- Requires explicit support in the boards lowlevel file.
+ Requires explicit support in the board's lowlevel file.
 
 endmenu
 
@@ -1510,7 +1510,7 @@ config PBL_BREAK
bool "Execute software break on pbl start"
depends on ARM && (!CPU_32v4T && !ARCH_TEGRA)
help
- If this enabled, barebox will be compiled with BKPT instruction
+ If enabled, barebox will be compiled with BKPT instruction
  on early pbl init. This option should be used only with JTAG debugger!
 
 source "lib/Kconfig.ubsan"
-- 
2.30.2


___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


[PATCH 2/2] common: Kconfig: fix indentation

2021-10-12 Thread Ulrich Ölmann
Signed-off-by: Ulrich Ölmann 
---
 common/Kconfig | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/common/Kconfig b/common/Kconfig
index d8d20917aab6..f4120b2083ee 100644
--- a/common/Kconfig
+++ b/common/Kconfig
@@ -992,9 +992,9 @@ config BTHREAD
select HAS_SCHED
depends on HAS_ARCH_SJLJ
help
-barebox threads are lightweight cooperative (green) threads that are
-scheduled within delay loops and the console idle to asynchronously
-execute actions, like checking for link up or feeding a watchdog.
+ barebox threads are lightweight cooperative (green) threads that are
+ scheduled within delay loops and the console idle to asynchronously
+ execute actions, like checking for link up or feeding a watchdog.
 
 config STATE
bool "generic state infrastructure"
-- 
2.30.2


___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


[PATCH] mtd: spi-nor: Add support for en25qh64

2019-12-09 Thread Ulrich Ölmann
This is a port of Linux kernel commit

| commit 30a2c8aa3c520d54bcaf3015ca8141b0156448b1
| Author: Roger Pueyo Centelles 
| Date:   Thu Feb 7 20:09:35 2019 +0100
|
| mtd: spi-nor: Add support for en25qh64
|
| The Eon EN25QH64 is a 64 Mbit SPI NOR flash memory chip found
| on recent wireless routers. Its 32, 128 and 256 Mbit siblings
| are already supported.
|
| Tested on a COMFAST CF-E120A v3 router board.
|
| Signed-off-by: Roger Pueyo Centelles 
| Reviewed-by: Tudor Ambarus 
| Signed-off-by: Boris Brezillon 

Signed-off-by: Ulrich Ölmann 
---
 drivers/mtd/spi-nor/spi-nor.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/mtd/spi-nor/spi-nor.c b/drivers/mtd/spi-nor/spi-nor.c
index b2510359826e..261f13db2415 100644
--- a/drivers/mtd/spi-nor/spi-nor.c
+++ b/drivers/mtd/spi-nor/spi-nor.c
@@ -646,6 +646,8 @@ static const struct spi_device_id spi_nor_ids[] = {
{ "en25q32b",   INFO(0x1c3016, 0, 64 * 1024,   64, 0) },
{ "en25p64",INFO(0x1c2017, 0, 64 * 1024,  128, 0) },
{ "en25q64",INFO(0x1c3017, 0, 64 * 1024,  128, SECT_4K) },
+   { "en25qh64",   INFO(0x1c7017, 0, 64 * 1024,  128,
+   SECT_4K | SPI_NOR_DUAL_READ) },
{ "en25qh128",  INFO(0x1c7018, 0, 64 * 1024,  256, 0) },
{ "en25qh256",  INFO(0x1c7019, 0, 64 * 1024,  512, 0) },
{ "en25s64",INFO(0x1c3817, 0, 64 * 1024,  128, 0) },
-- 
2.24.0


___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


Re: readling, ctrl-u is not working like linux console

2019-10-16 Thread Ulrich Ölmann
On Wed, Oct 16 2019 at 10:57 +0200, Roland Hieber  wrote:
> On Wed, Oct 16, 2019 at 04:57:45AM +0800, duhuanpeng wrote:
>> Hi,
>> 
>> I find it the barebox console's ctrl-u is not working like my
>> linux host.
>> for now, the barebox's ctrl-u discard the whole line. but the
>> linux consle just remove characters before cursor.
>> is the barebox ctrl-u follows any standard, if not, how about
>> make it just works like linux(ah, it is gnu readline) does.
>
> FWIW, in bash on both my tty2 and urxvt, Ctrl-U clears the whole line.
> But I don't know if there is a standard for this shortkey.

See this section [1] in the readline documentation.

Best regards
Ulrich


[1] https://tiswww.case.edu/php/chet/readline/readline.html#SEC17
-- 
Pengutronix e.K.   | Ulrich Ölmann   |
Industrial Linux Solutions | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0|
Amtsgericht Hildesheim, HRA 2686   | Fax:   +49-5121-206917- |

___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


[PATCH 2/3] state: backend_bucket_circular: fix double free()

2019-09-30 Thread Ulrich Ölmann
This ports the following dt-utils commit (as the actual code that is changed is
removed by the preprocesser when compiling barebox this patch is only of
cosmetic nature to keep both code bases in sync):

| commit 634317cc91202304c1477a6d738d7c7691b80419
| Author: Kim Christensen 
| Date:   Wed Sep 18 16:48:23 2019 +0200
|
| state: backend_bucket_circular: fix double free()
|
| The function state_mtd_peb_read() is only a user of buf and not its owner,
| hence it may not deallocate it.
|
| Signed-off-by: Kim Christensen 
| Reviewed-by: Ulrich Ölmann 
| Reviewed-by: Uwe Kleine-König 
| Signed-off-by: Roland Hieber 

Signed-off-by: Ulrich Ölmann 
---
 common/state/backend_bucket_circular.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/common/state/backend_bucket_circular.c 
b/common/state/backend_bucket_circular.c
index 612fa0cd8a11..735510e0d36b 100644
--- a/common/state/backend_bucket_circular.c
+++ b/common/state/backend_bucket_circular.c
@@ -178,7 +178,6 @@ static int state_mtd_peb_read(struct 
state_backend_storage_bucket_circular *circ
if (ret < 0) {
dev_err(circ->dev, "Failed to read circular storage len %d, 
%d\n",
len, ret);
-   free(buf);
return ret;
}
 
-- 
2.23.0


___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


[PATCH 1/3] state: backend_bucket_circular: harmonize code with dt-utils

2019-09-30 Thread Ulrich Ölmann
Comparing barebox' commit [1] with dt-utils' commit [2] it is obvious that
adjusting the return value has been forgotten in barebox - fix that.
(As the actual code that is changed is removed by the preprocesser when
compiling barebox this patch is only of cosmetic nature to keep both code bases
in sync).

[1] 9d6d91931afb ("state: Remove -EUCLEAN check from userspace tool")
[2] 791a2404116d ("state: Remove -EUCLEAN check from userspace tool")

Signed-off-by: Ulrich Ölmann 
---
 common/state/backend_bucket_circular.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/common/state/backend_bucket_circular.c 
b/common/state/backend_bucket_circular.c
index 47970b79f36a..612fa0cd8a11 100644
--- a/common/state/backend_bucket_circular.c
+++ b/common/state/backend_bucket_circular.c
@@ -179,9 +179,10 @@ static int state_mtd_peb_read(struct 
state_backend_storage_bucket_circular *circ
dev_err(circ->dev, "Failed to read circular storage len %d, 
%d\n",
len, ret);
free(buf);
+   return ret;
}
 
-   return ret;
+   return 0;
 }
 
 static int state_mtd_peb_write(struct state_backend_storage_bucket_circular 
*circ,
-- 
2.23.0


___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


[PATCH 3/3] common: state: fix backward compatibility

2019-09-30 Thread Ulrich Ölmann
This reverts [1] as it annihilated its counterpart of commit [2].

[1] 5033b4f58f71 ("common: state: harmonize code with dt-utils")
[2] 480cde1b2283 ("state: keep backward compatibility")

Fixes: 5033b4f58f71 ("common: state: harmonize code with dt-utils")
Signed-off-by: Ulrich Ölmann 
---
 common/state/backend_bucket_direct.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/common/state/backend_bucket_direct.c 
b/common/state/backend_bucket_direct.c
index 0dbd334db821..4522f0170f3d 100644
--- a/common/state/backend_bucket_direct.c
+++ b/common/state/backend_bucket_direct.c
@@ -115,9 +115,6 @@ static int state_backend_bucket_direct_write(struct 
state_backend_storage_bucket
int ret;
struct state_backend_storage_bucket_direct_meta meta;
 
-   if (len > direct->max_size - sizeof(meta))
-   return -E2BIG;
-
if (lseek(direct->fd, direct->offset, SEEK_SET) != direct->offset) {
dev_err(direct->dev, "Failed to seek file, %d\n", -errno);
return -errno;
-- 
2.23.0


___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


[PATCH] imd: fix memory leak

2019-09-16 Thread Ulrich Ölmann
Each invocation of 'imd' ate up to 1MB of RAM.

Signed-off-by: Ulrich Ölmann 
---
 common/imd.c | 20 ++--
 1 file changed, 14 insertions(+), 6 deletions(-)

diff --git a/common/imd.c b/common/imd.c
index 05e118e77361..913a01de87bf 100644
--- a/common/imd.c
+++ b/common/imd.c
@@ -337,8 +337,10 @@ int imd_command(int argc, char *argv[])
return -errno;
 
imd_start = imd_get(buf, size);
-   if (IS_ERR(imd_start))
-   return PTR_ERR(imd_start);
+   if (IS_ERR(imd_start)) {
+   ret = PTR_ERR(imd_start);
+   goto out;
+   }
 
if (type == IMD_TYPE_INVALID) {
imd_for_each(imd_start, imd) {
@@ -356,7 +358,8 @@ int imd_command(int argc, char *argv[])
imd = imd_find_type(imd_start, type);
if (!imd) {
debug("No tag of type 0x%08x found\n", type);
-   return -ENODATA;
+   ret = -ENODATA;
+   goto out;
}
 
if (imd_is_string(type)) {
@@ -370,8 +373,10 @@ int imd_command(int argc, char *argv[])
str = imd_concat_strings(imd);
}
 
-   if (!str)
-   return -ENODATA;
+   if (!str) {
+   ret = -ENODATA;
+   goto out;
+   }
 
if (variable_name)
imd_command_setenv(variable_name, str);
@@ -384,5 +389,8 @@ int imd_command(int argc, char *argv[])
}
}
 
-   return 0;
+   ret = 0;
+out:
+   free(buf);
+   return ret;
 }
-- 
2.23.0


___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


Re: [PATCH 3/3] doc: boards: imx: add HAB section

2019-06-05 Thread Ulrich Ölmann
On Tue, Jun 04 2019 at 18:53 +0200, Bastian Krause  wrote:
> Signed-off-by: Bastian Krause 
> ---
>  Documentation/boards/imx.rst | 59 
>  1 file changed, 59 insertions(+)
>
> diff --git a/Documentation/boards/imx.rst b/Documentation/boards/imx.rst
> index abd9c76151..ba0a3b7988 100644
> --- a/Documentation/boards/imx.rst
> +++ b/Documentation/boards/imx.rst
> @@ -83,6 +83,65 @@ The images can also always be started as second stage on 
> the target:
>  
>barebox@Board Name:/ bootm /mnt/tftp/barebox-freescale-imx51-babbage.img
>  
> +High Assurance Boot
> +^^^
> +
> +HAB is a NXP ROM code feature which is able to authenticate software in

s/a NXP/an NXP/

> +external memory at boot time.
> +This is done by verifying signatures as defined in the Command Sequence FILE

s/FILE/File/ ?

Best regards
Ulrich

> +(CSF) as compiled into the i.MX boot header.
> +
> +barebox supports generating signed images, signed USB images suitable for
> +*imx-usb-loader* and encrypted images.
> +
> +In contrast to normal (unsigned) images booting signed images via
> +imx-usb-loader requires special images:
> +DCD data is invalidated (DCD pointer set to zero), the image is then signed 
> and
> +afterwards the DCD pointer is set to the DCD data again (practically making
> +the signature invalid).
> +This works because the imx-usb-loader transmits the DCD table setup prior to
> +the actual image to set up the RAM in order to load the barebox image.
> +Now the DCD pointer is set to zero (making the signature valid again) and the
> +image is loaded and verified by the ROM code.
> +
> +Note that the device-specific Data Encryption Key (DEK) blob needs to be
> +appended to the image after the build process for appropriately encrypted
> +images.
> +
> +In order to generate these special image types barebox is equipped with
> +corresponding static pattern rules in ``images/Makefile.imx``.
> +Unlike the typical ``imximg`` file extension the following ones are used for
> +these cases:
> +
> +* ``simximg``: generate signed image
> +* ``usimximg``: generate signed USB image
> +* ``esimximg``: generate encrypted and signed image
> +
> +The imx-image tool is then automatically called with the appropriate flags
> +during image creation.
> +This again calls Freescale's Code Signing Tool (CST) which must be installed 
> in
> +the path or given via the environment variable "CST".
> +
> +Assuming ``CONFIG_HAB`` and ``CONFIG_HABV4`` are enabled the necessary
> +keys/certificates are expected in these config variables (assuming HABv4):
> +
> +.. code-block:: none
> +
> +  CONFIG_HABV4_TABLE_BIN
> +  CONFIG_HABV4_CSF_CRT_PEM
> +  CONFIG_HABV4_IMG_CRT_PEM
> +
> +A CSF template is located in
> +``arch/arm/mach-imx/include/mach/habv4-imx6-gencsf.h`` which is preprocessed
> +by barebox.
> +It must be included in the board's flash header:
> +
> +.. code-block:: none
> +
> +  #include 
> +
> +Analogous to HABv4 options and a template exist for HABv3.
> +
>  Using GPT on i.MX
>  ^
-- 
Pengutronix e.K.   | Ulrich Ölmann   |
Industrial Linux Solutions | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0|
Amtsgericht Hildesheim, HRA 2686   | Fax:   +49-5121-206917- |

___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


[PATCH] images: remove forgotten occurences of *.imx-sram-img

2019-05-22 Thread Ulrich Ölmann
Starting with commit 5a1a5ed2537d ("ARM: images: use piggydata") this file type
is not known anymore, so clean up.

Signed-off-by: Ulrich Ölmann 
---
 images/.gitignore | 1 -
 images/Makefile   | 2 +-
 2 files changed, 1 insertion(+), 2 deletions(-)

diff --git a/images/.gitignore b/images/.gitignore
index 7a7493781471..fcde7f3c42ae 100644
--- a/images/.gitignore
+++ b/images/.gitignore
@@ -4,7 +4,6 @@
 *.imximg
 *.imximg.prep
 *.imximg.signed
-*.imx-sram-img
 *.map
 *.src
 *.kwbimg
diff --git a/images/Makefile b/images/Makefile
index e525e0d27747..479647a82726 100644
--- a/images/Makefile
+++ b/images/Makefile
@@ -181,5 +181,5 @@ $(flash-list): $(image-y-path)
 clean-files := *.pbl *.pblb *.map start_*.imximg *.img barebox.z 
start_*.kwbimg \
start_*.kwbuartimg *.socfpgaimg *.mlo *.t20img *.t20img.cfg *.t30img \
*.t30img.cfg *.t124img *.t124img.cfg *.mlospi *.mlo *.mxsbs *.mxssd \
-   start_*.simximg start_*.usimximg *.imx-sram-img *.image
+   start_*.simximg start_*.usimximg *.image
 clean-files += pbl.lds
-- 
2.20.1


___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


[PATCH 0/7] Harmonize barebox' and dt-utils' state code

2019-02-07 Thread Ulrich Ölmann
These patches remove further differences between the common codebase of barebox'
and dt-utils' state implementation.

Ulrich Ölmann (7):
  common: state: fix compiler warnings about wrong type conversion in
messages
  common: state: fix formatting of "off_t" variables
  common: state: fix formatting of "uint32_t" variables
  common: state: harmonize code with dt-utils
  common: state: harmonize code with dt-utils
  common: state: harmonize code with dt-utils
  common: state: harmonize code with dt-utils

 common/state/backend_bucket_circular.c | 40 ++
 common/state/backend_bucket_direct.c   |  3 ++
 common/state/backend_storage.c | 22 +++---
 common/state/state.c   | 10 +--
 4 files changed, 44 insertions(+), 31 deletions(-)

-- 
2.20.1


___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


[PATCH 1/7] common: state: fix compiler warnings about wrong type conversion in messages

2019-02-07 Thread Ulrich Ölmann
To harmonize the common codebase this ports the remaining hunks of the following
dt-utils commit, as the residual hunks have independently already been done
before in barebox commit 1afbf6b5680e ("state: fix compile warnings for dev_err
expansion"):

| commit 9f1db73234b40f4ea071421e8179065df16211ec
| Author: Philipp Rosenberger 
| Date:   Thu Oct 18 09:17:23 2018 +0200
|
| Fix compiler warnings about wrong type conversion in messages.
|
| These warning were observed with gcc-6.3 on x86-64.
|
| Signed-off-by: Philipp Rosenberger 
| Signed-off-by: Sascha Hauer 

Signed-off-by: Ulrich Ölmann 
---
 common/state/backend_bucket_circular.c | 14 +++---
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/common/state/backend_bucket_circular.c 
b/common/state/backend_bucket_circular.c
index 4b71d8751da6..5a85650f4004 100644
--- a/common/state/backend_bucket_circular.c
+++ b/common/state/backend_bucket_circular.c
@@ -165,13 +165,13 @@ static int state_mtd_peb_read(struct 
state_backend_storage_bucket_circular *circ
return ret;
}
 
-   dev_dbg(circ->dev, "Read state from %ld length %zd\n", offset,
+   dev_dbg(circ->dev, "Read state from %ld length %d\n", offset,
len);
 
 
ret = read_full(circ->fd, buf, len);
if (ret < 0) {
-   dev_err(circ->dev, "Failed to read circular storage len %zd, 
%d\n",
+   dev_err(circ->dev, "Failed to read circular storage len %d, 
%d\n",
len, ret);
free(buf);
}
@@ -196,7 +196,7 @@ static int state_mtd_peb_write(struct 
state_backend_storage_bucket_circular *cir
 
ret = write_full(circ->fd, buf, len);
if (ret < 0) {
-   dev_err(circ->dev, "Failed to write circular to %ld length %zd, 
%d\n",
+   dev_err(circ->dev, "Failed to write circular to %ld length %d, 
%d\n",
offset, len, ret);
return ret;
}
@@ -207,7 +207,7 @@ static int state_mtd_peb_write(struct 
state_backend_storage_bucket_circular *cir
 */
flush(circ->fd);
 
-   dev_dbg(circ->dev, "Written state to offset %ld length %zd data length 
%zd\n",
+   dev_dbg(circ->dev, "Written state to offset %ld length %d data length 
%d\n",
offset, len, len);
 
return 0;
@@ -298,7 +298,7 @@ static int state_backend_bucket_circular_write(struct 
state_backend_storage_buck
void *write_buf;
 
if (written_length > circ->max_size) {
-   dev_err(circ->dev, "Error, state data too big to be written, to 
write: %zd, writesize: %zd, length: %zd, available: %zd\n",
+   dev_err(circ->dev, "Error, state data too big to be written, to 
write: %d, writesize: %zd, length: %zd, available: %zd\n",
written_length, circ->writesize, len, circ->max_size);
return -E2BIG;
}
@@ -345,12 +345,12 @@ static int state_backend_bucket_circular_write(struct 
state_backend_storage_buck
 
ret = state_mtd_peb_write(circ, write_buf, offset, written_length);
if (ret < 0 && ret != -EUCLEAN) {
-   dev_err(circ->dev, "Failed to write circular to %ld length %zd, 
%d\n",
+   dev_err(circ->dev, "Failed to write circular to %ld length %d, 
%d\n",
offset, written_length, ret);
goto out_free;
}
 
-   dev_dbg(circ->dev, "Written state to PEB %u offset %ld length %zd data 
length %zd\n",
+   dev_dbg(circ->dev, "Written state to PEB %u offset %ld length %d data 
length %zd\n",
circ->eraseblock, offset, written_length, len);
 
 out_free:
-- 
2.20.1


___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


[PATCH 5/7] common: state: harmonize code with dt-utils

2019-02-07 Thread Ulrich Ölmann
Linux userspace needs sys/param.h to have the definition of roundup().

Signed-off-by: Ulrich Ölmann 
---
 common/state/backend_bucket_circular.c | 4 
 1 file changed, 4 insertions(+)

diff --git a/common/state/backend_bucket_circular.c 
b/common/state/backend_bucket_circular.c
index 059a531aa4b3..da7c8421ae93 100644
--- a/common/state/backend_bucket_circular.c
+++ b/common/state/backend_bucket_circular.c
@@ -23,6 +23,10 @@
 #include 
 #include 
 
+#ifndef __BAREBOX__
+#include 
+#endif
+
 #include "state.h"
 
 /*
-- 
2.20.1


___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


[PATCH 3/7] common: state: fix formatting of "uint32_t" variables

2019-02-07 Thread Ulrich Ölmann
To harmonize the common codebase this ports the following dt-utils commit:

| commit 5588a6c32d54bc4a1ef0b9f72807c46dd00bc20e
| Author: Ulrich Ölmann 
| Date:   Sun Feb 3 22:48:07 2019 +0100
|
| state: fix formatting of "uint32_t" variables
|
| The format specifier "%zd" is for "size_t" typed variables and produces a
| warning with gcc, so use "%u" instead.
|
| Signed-off-by: Ulrich Ölmann 
| Signed-off-by: Roland Hieber 

Signed-off-by: Ulrich Ölmann 
---
 common/state/backend_bucket_circular.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/common/state/backend_bucket_circular.c 
b/common/state/backend_bucket_circular.c
index ae15fa2529c2..059a531aa4b3 100644
--- a/common/state/backend_bucket_circular.c
+++ b/common/state/backend_bucket_circular.c
@@ -298,7 +298,7 @@ static int state_backend_bucket_circular_write(struct 
state_backend_storage_buck
void *write_buf;
 
if (written_length > circ->max_size) {
-   dev_err(circ->dev, "Error, state data too big to be written, to 
write: %d, writesize: %zd, length: %zd, available: %zd\n",
+   dev_err(circ->dev, "Error, state data too big to be written, to 
write: %u, writesize: %zd, length: %zd, available: %zd\n",
written_length, circ->writesize, len, circ->max_size);
return -E2BIG;
}
@@ -345,12 +345,12 @@ static int state_backend_bucket_circular_write(struct 
state_backend_storage_buck
 
ret = state_mtd_peb_write(circ, write_buf, offset, written_length);
if (ret < 0 && ret != -EUCLEAN) {
-   dev_err(circ->dev, "Failed to write circular to %lld length %d, 
%d\n",
+   dev_err(circ->dev, "Failed to write circular to %lld length %u, 
%d\n",
(long long) offset, written_length, ret);
goto out_free;
}
 
-   dev_dbg(circ->dev, "Written state to PEB %u offset %lld length %d data 
length %zd\n",
+   dev_dbg(circ->dev, "Written state to PEB %u offset %lld length %u data 
length %zd\n",
circ->eraseblock, (long long) offset, written_length, len);
 
 out_free:
-- 
2.20.1


___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


[PATCH 7/7] common: state: harmonize code with dt-utils

2019-02-07 Thread Ulrich Ölmann
Insert a helpful size check that is an outcome of the following dt-utils
commits:

| commit a6eb5350be0f7a5673162d20f2dd72569d5a4d0c
| Author: Markus Pargmann 
| Date:   Fri May 27 13:53:40 2016 +0200
|
| barebox-state: Import updated state code
|
| Signed-off-by: Markus Pargmann 

| commit 583acea6669550ffa7ffb465301ddb3529206afc
| Author: Sascha Hauer 
| Date:   Thu Mar 23 11:29:50 2017 +0100
|
| state: backend-direct: Fix max_size
|
| The max_size in the direct backend includes the meta data, so
| substract its size when determing the max data size we can store.
|
| Signed-off-by: Sascha Hauer 

| commit dcf781f1b3d15aff5f5ff0b604bff447dee2040c
| Author: Sascha Hauer 
| Date:   Thu Mar 23 12:59:48 2017 +0100
|
| state: backend_bucket_direct: max_size is always given
|
| max_size is always != 0, so if(direct->max_size) can be skipped.
|
| Signed-off-by: Sascha Hauer 

Signed-off-by: Ulrich Ölmann 
---
 common/state/backend_bucket_direct.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/common/state/backend_bucket_direct.c 
b/common/state/backend_bucket_direct.c
index 9d6a337e6662..1f00b0fb2f64 100644
--- a/common/state/backend_bucket_direct.c
+++ b/common/state/backend_bucket_direct.c
@@ -110,6 +110,9 @@ static int state_backend_bucket_direct_write(struct 
state_backend_storage_bucket
int ret;
struct state_backend_storage_bucket_direct_meta meta;
 
+   if (len > direct->max_size - sizeof(meta))
+   return -E2BIG;
+
ret = lseek(direct->fd, direct->offset, SEEK_SET);
if (ret < 0) {
dev_err(direct->dev, "Failed to seek file, %d\n", ret);
-- 
2.20.1


___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


[PATCH 6/7] common: state: harmonize code with dt-utils

2019-02-07 Thread Ulrich Ölmann
Linux userspace with recent glibc versions lets barebox-state suffer from
linux/stat.h redefining 'struct statx' and because of that switched to the
inclusion of sys/stat.h instead, see dt-utils commit 1c80e31872ae ("src: fix
compilation for glibc version 2.27.9000-36.fc29 and newer").

We can follow this switch in barebox without any problems, too, as in barebox
sys/stat.h includes linux/stat.h (and adds some more definitions on top that
don't hurt us here).

Signed-off-by: Ulrich Ölmann 
---
 common/state/backend_storage.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/common/state/backend_storage.c b/common/state/backend_storage.c
index 8cd822eec486..fca887e93fa3 100644
--- a/common/state/backend_storage.c
+++ b/common/state/backend_storage.c
@@ -19,7 +19,7 @@
 #include 
 #include 
 #include 
-#include 
+#include 
 #include 
 #include 
 
-- 
2.20.1


___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


[PATCH 4/7] common: state: harmonize code with dt-utils

2019-02-07 Thread Ulrich Ölmann
Other than in barebox the offset and size of a state's backend device do not
necessarily equal zero in Linux userspace (EEPROMs & block devices), so barebox'
and dt-utils' state code differ here.

Signed-off-by: Ulrich Ölmann 
---
 common/state/state.c | 10 --
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/common/state/state.c b/common/state/state.c
index d3e048b99078..3f5d43ecbf73 100644
--- a/common/state/state.c
+++ b/common/state/state.c
@@ -596,6 +596,8 @@ struct state *state_new_from_node(struct device_node *node, 
bool readonly)
const char *alias;
uint32_t stridesize;
struct device_node *partition_node;
+   off_t offset = 0;
+   size_t size = 0;
 
alias = of_alias_get(node);
if (!alias) {
@@ -614,7 +616,11 @@ struct state *state_new_from_node(struct device_node 
*node, bool readonly)
goto out_release_state;
}
 
+#ifdef __BAREBOX__
ret = of_find_path_by_node(partition_node, >backend_path, 0);
+#else
+   ret = of_get_devicepath(partition_node, >backend_path, , 
);
+#endif
if (ret) {
if (ret != -EPROBE_DEFER)
dev_err(>dev, "state failed to parse path to 
backend: %s\n",
@@ -645,8 +651,8 @@ struct state *state_new_from_node(struct device_node *node, 
bool readonly)
if (ret)
goto out_release_state;
 
-   ret = state_storage_init(state, state->backend_path, 0,
-0, stridesize, storage_type);
+   ret = state_storage_init(state, state->backend_path, offset,
+size, stridesize, storage_type);
if (ret)
goto out_release_state;
 
-- 
2.20.1


___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


[PATCH 2/7] common: state: fix formatting of "off_t" variables

2019-02-07 Thread Ulrich Ölmann
To harmonize the common codebase this ports the following dt-utils commit:

| commit 89d033284cb69f834c1f2195c9e99a3d7f585cf1
| Author: Ulrich Ölmann 
| Date:   Sun Feb 3 22:48:06 2019 +0100
|
| state: fix formatting of "off_t" variables
|
| Explicitely casting an "off_t" variable to "long long" and formatting it 
via
| "%lld" or "%llx" respectively makes 32- as well as 64-bit compilers
| happy (tested with gcc-8.2.1 and clang-7.0.1).
|
| Signed-off-by: Ulrich Ölmann 
| Signed-off-by: Roland Hieber 

Signed-off-by: Ulrich Ölmann 
---
 common/state/backend_bucket_circular.c | 32 +-
 common/state/backend_storage.c | 20 
 2 files changed, 26 insertions(+), 26 deletions(-)

diff --git a/common/state/backend_bucket_circular.c 
b/common/state/backend_bucket_circular.c
index 5a85650f4004..ae15fa2529c2 100644
--- a/common/state/backend_bucket_circular.c
+++ b/common/state/backend_bucket_circular.c
@@ -161,11 +161,11 @@ static int state_mtd_peb_read(struct 
state_backend_storage_bucket_circular *circ
ret = lseek(circ->fd, offset, SEEK_SET);
if (ret < 0) {
dev_err(circ->dev, "Failed to set circular read position to 
%lld, %d\n",
-   offset, ret);
+   (long long) offset, ret);
return ret;
}
 
-   dev_dbg(circ->dev, "Read state from %ld length %d\n", offset,
+   dev_dbg(circ->dev, "Read state from %lld length %d\n", (long long) 
offset,
len);
 
 
@@ -189,15 +189,15 @@ static int state_mtd_peb_write(struct 
state_backend_storage_bucket_circular *cir
 
ret = lseek(circ->fd, offset, SEEK_SET);
if (ret < 0) {
-   dev_err(circ->dev, "Failed to set position for circular write 
%ld, %d\n",
-   offset, ret);
+   dev_err(circ->dev, "Failed to set position for circular write 
%lld, %d\n",
+   (long long) offset, ret);
return ret;
}
 
ret = write_full(circ->fd, buf, len);
if (ret < 0) {
-   dev_err(circ->dev, "Failed to write circular to %ld length %d, 
%d\n",
-   offset, len, ret);
+   dev_err(circ->dev, "Failed to write circular to %lld length %d, 
%d\n",
+   (long long) offset, len, ret);
return ret;
}
 
@@ -207,8 +207,8 @@ static int state_mtd_peb_write(struct 
state_backend_storage_bucket_circular *cir
 */
flush(circ->fd);
 
-   dev_dbg(circ->dev, "Written state to offset %ld length %d data length 
%d\n",
-   offset, len, len);
+   dev_dbg(circ->dev, "Written state to offset %lld length %d data length 
%d\n",
+   (long long) offset, len, len);
 
return 0;
 }
@@ -265,8 +265,8 @@ static int state_backend_bucket_circular_read(struct 
state_backend_storage_bucke
if (!buf)
return -ENOMEM;
 
-   dev_dbg(circ->dev, "Read state from PEB %u global offset %ld length 
%zd\n",
-   circ->eraseblock, offset, read_len);
+   dev_dbg(circ->dev, "Read state from PEB %u global offset %lld length 
%zd\n",
+   circ->eraseblock, (long long) offset, read_len);
 
ret = state_mtd_peb_read(circ, buf, offset, read_len);
if (ret < 0 && ret != -EUCLEAN) {
@@ -345,13 +345,13 @@ static int state_backend_bucket_circular_write(struct 
state_backend_storage_buck
 
ret = state_mtd_peb_write(circ, write_buf, offset, written_length);
if (ret < 0 && ret != -EUCLEAN) {
-   dev_err(circ->dev, "Failed to write circular to %ld length %d, 
%d\n",
-   offset, written_length, ret);
+   dev_err(circ->dev, "Failed to write circular to %lld length %d, 
%d\n",
+   (long long) offset, written_length, ret);
goto out_free;
}
 
-   dev_dbg(circ->dev, "Written state to PEB %u offset %ld length %d data 
length %zd\n",
-   circ->eraseblock, offset, written_length, len);
+   dev_dbg(circ->dev, "Written state to PEB %u offset %lld length %d data 
length %zd\n",
+   circ->eraseblock, (long long) offset, written_length, len);
 
 out_free:
free(write_buf);
@@ -445,8 +445,8 @@ static int bucket_circular_is_block_bad(struct 
state_backend_storage_bucket_circ
 
ret = ioctl(circ->fd, MEMGETBADBLOCK, );
if (ret < 0)
-   dev_err(circ->dev, "Failed to use ioctl to check for bad block 
at offset %ld, %d\n",
-   offs, ret);
+   dev_err(circ->dev, "Fai

[PATCH 1/2] common: state: fix typo

2019-02-06 Thread Ulrich Ölmann
Signed-off-by: Ulrich Ölmann 
---
 common/state/backend_format_raw.c | 4 ++--
 common/state/state.c  | 2 +-
 common/state/state.h  | 2 +-
 3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/common/state/backend_format_raw.c 
b/common/state/backend_format_raw.c
index 4369f76e376f..5a71149d3443 100644
--- a/common/state/backend_format_raw.c
+++ b/common/state/backend_format_raw.c
@@ -127,7 +127,7 @@ static int backend_format_raw_verify(struct 
state_backend_format *format,
return -EINVAL;
}
 
-   if (backend_raw->algo && !(flags & STATE_FLAG_NO_AUTHENTIFICATION)) {
+   if (backend_raw->algo && !(flags & STATE_FLAG_NO_AUTHENTICATION)) {
ret = backend_raw_digest_init(backend_raw);
if (ret)
return ret;
@@ -153,7 +153,7 @@ static int backend_format_raw_verify(struct 
state_backend_format *format,
 
*lenp = header->data_len + sizeof(*header);
 
-   if (backend_raw->algo && !(flags & STATE_FLAG_NO_AUTHENTIFICATION)) {
+   if (backend_raw->algo && !(flags & STATE_FLAG_NO_AUTHENTICATION)) {
const void *hmac = data + header->data_len;
 
/* hmac over header and data */
diff --git a/common/state/state.c b/common/state/state.c
index 54c57232e626..d3e048b99078 100644
--- a/common/state/state.c
+++ b/common/state/state.c
@@ -128,7 +128,7 @@ int state_load(struct state *state)
 
 int state_load_no_auth(struct state *state)
 {
-   return state_do_load(state, STATE_FLAG_NO_AUTHENTIFICATION);
+   return state_do_load(state, STATE_FLAG_NO_AUTHENTICATION);
 }
 
 static int state_format_init(struct state *state, const char *backend_format,
diff --git a/common/state/state.h b/common/state/state.h
index 3a0662fd2594..912d6d484823 100644
--- a/common/state/state.h
+++ b/common/state/state.h
@@ -6,7 +6,7 @@ struct state;
 struct mtd_info_user;
 
 enum state_flags {
-   STATE_FLAG_NO_AUTHENTIFICATION = (1 << 0),
+   STATE_FLAG_NO_AUTHENTICATION = (1 << 0),
 };
 
 enum state_variable_type {
-- 
2.20.1


___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


[PATCH 2/2] state: Documentation: fix typo

2019-02-06 Thread Ulrich Ölmann
Signed-off-by: Ulrich Ölmann 
---
 Documentation/devicetree/bindings/barebox/barebox,state.rst | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Documentation/devicetree/bindings/barebox/barebox,state.rst 
b/Documentation/devicetree/bindings/barebox/barebox,state.rst
index 2893937820d7..390e148a2879 100644
--- a/Documentation/devicetree/bindings/barebox/barebox,state.rst
+++ b/Documentation/devicetree/bindings/barebox/barebox,state.rst
@@ -52,7 +52,7 @@ Optional Properties
   ``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
+* ``algo``: An HMAC algorithm used to detect manipulation of the data
   or header, sensible values follow this pattern ``hmac()``,
   e.g. ``hmac(sha256)``. Only available for the ``backend-type`` ``raw``.
 * ``keep-previous-content``: Check if a the bucket meta magic field contains
-- 
2.20.1


___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


Re: Do I really need 3 buckets for state?

2019-01-24 Thread Ulrich Ölmann
Hi Ian,

On Thu, Jan 24 2019 at 16:28 +0100, Ian Abbott  wrote:
> Back when I was determining how to partition the spi-nor flash on my
> embedded device, I reserved two erase blocks (each of size 65536) for
> use as a barebox state partition.  I wasn't using it for anything at the
> time.  Now I want to use it to hold bootstate information for barebox
> bootchooser (for use in combination with rauc to handle system updates).
>
> I am using backend-type="raw"; backend-storage-type="circular"; and
> backend-stridesize=<0x40>;.

the documentation is not correct here: for the case of spi-nor flash the
stridesize is not used at all (and therefore not needed in the
devicetree). Instead each bucket is searched in reverse direction
starting from the end for non 0xff bytes and a magic value to see where
the last copy of the state variables has been written to, see [1].

> It all works fine except that I get a warning from barebox:
>
> Failed to initialize desired amount of buckets, only 2 of 3 succeeded
>
> I have "fixed" the warning with a local patch to reduce the
> 'desired_buckets' constant in "common/state/backend_storage.c" from 3 to 2.
>
> My question is, how much trouble am I letting myself in for with this
> local patch?  I assume the state driver will only erase and update 1
> bucket at a time when the buckets are full.

Correct, this is done in state_storage_write(), see [2].

> Do I really need 3 buckets or will 2 buckets be enough?

This depends on how much redundancy you need to sleep well...

Best regards
Ulrich


[1] 
https://github.com/saschahauer/barebox/blob/master/common/state/backend_bucket_circular.c#L388
[2] 
https://github.com/saschahauer/barebox/blob/master/common/state/backend_storage.c#L52
--
Pengutronix e.K.   | Ulrich Ölmann   |
Industrial Linux Solutions | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0|
Amtsgericht Hildesheim, HRA 2686   | Fax:   +49-5121-206917- |

___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


Re: [PATCH] arch: *: cpuinfo: harmonize command description

2018-11-27 Thread Ulrich Ölmann
Hi Antony & Robert,

On Thu, Nov 22 2018 at 14:39 +0100, Antony Pavlov  
wrote:
> On Thu, 22 Nov 2018 09:12:00 +0100
> Ulrich Ölmann  wrote:
>
> Hello Robert!
>
> AFAIR you are a native English speaker.
>
> Would you please comment this change
>
>> -BAREBOX_CMD_DESC("show CPU information")
>> +BAREBOX_CMD_DESC("show information about CPU")
>
> Which version of the cpuinfo command description is better?

I do not stick to the command description suggested in my patch and in
particular have no preference for one or the other of the above
alternatives - native speakers stand up: advice welcome! ;-)

The motivation for my patch was only the harmonization of things after
accidentally stumbling across different descriptions for the same
command. So perhaps let's harmonize the other commands' descriptions as
well and do it altogether in a v2.

Best regards
Ulrich
--
Pengutronix e.K.   | Ulrich Ölmann   |
Industrial Linux Solutions | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0|
Amtsgericht Hildesheim, HRA 2686   | Fax:   +49-5121-206917- |

___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


[PATCH] arch: *: cpuinfo: harmonize command description

2018-11-22 Thread Ulrich Ölmann
Unify the different cpuinfo commands' description and adjust them to the
descriptions of "clk_dump" and "devinfo".

Signed-off-by: Ulrich Ölmann 
---
 arch/arm/cpu/cpuinfo.c  | 2 +-
 arch/mips/lib/cpuinfo.c | 2 +-
 arch/openrisc/lib/cpuinfo.c | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/arch/arm/cpu/cpuinfo.c b/arch/arm/cpu/cpuinfo.c
index 175475b038dc..2421b91e57f1 100644
--- a/arch/arm/cpu/cpuinfo.c
+++ b/arch/arm/cpu/cpuinfo.c
@@ -268,7 +268,7 @@ static int do_cpuinfo(int argc, char *argv[])
 
 BAREBOX_CMD_START(cpuinfo)
.cmd= do_cpuinfo,
-   BAREBOX_CMD_DESC("show info about CPU")
+   BAREBOX_CMD_DESC("show information about CPU")
BAREBOX_CMD_GROUP(CMD_GRP_INFO)
BAREBOX_CMD_COMPLETE(empty_complete)
 BAREBOX_CMD_END
diff --git a/arch/mips/lib/cpuinfo.c b/arch/mips/lib/cpuinfo.c
index fb02a4d20217..a327672f78a5 100644
--- a/arch/mips/lib/cpuinfo.c
+++ b/arch/mips/lib/cpuinfo.c
@@ -63,6 +63,6 @@ static int do_cpuinfo(int argc, char *argv[])
 
 BAREBOX_CMD_START(cpuinfo)
.cmd= do_cpuinfo,
-   BAREBOX_CMD_DESC("show CPU information")
+   BAREBOX_CMD_DESC("show information about CPU")
BAREBOX_CMD_GROUP(CMD_GRP_INFO)
 BAREBOX_CMD_END
diff --git a/arch/openrisc/lib/cpuinfo.c b/arch/openrisc/lib/cpuinfo.c
index 175adc582ca4..3d7fcb1f59ce 100644
--- a/arch/openrisc/lib/cpuinfo.c
+++ b/arch/openrisc/lib/cpuinfo.c
@@ -198,6 +198,6 @@ static int do_cpuinfo(int argc, char *argv[])
 
 BAREBOX_CMD_START(cpuinfo)
.cmd= do_cpuinfo,
-   BAREBOX_CMD_DESC("show CPU information")
+   BAREBOX_CMD_DESC("show information about CPU")
BAREBOX_CMD_GROUP(CMD_GRP_INFO)
 BAREBOX_CMD_END
-- 
2.19.1


___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


Re: barebox state is not fixed up into kernel-device-tree

2018-11-05 Thread Ulrich Ölmann
Hi Patrick,

Patrick Boettcher  writes:
> On Mon, 5 Nov 2018 09:41:51 +0100
> Patrick Boettcher  wrote:
>> On Mon, 05 Nov 2018 09:28:53 +0100
>> Ulrich Ölmann  wrote:
>> > Patrick Boettcher  writes:
>> > > I'm using a device-state (for bootchooser) which is stored in an
>> > > eeprom.
>> > >
>> > > Works fine from within barebox - read and write.
>> > >
>> > > Userspace does not see the state:
>> > >
>> > >   Neither /aliases/state nor /state found
>> > >
>> > > The displayed device-tree when booting with 'boot -v -v '
>> > > does not contain the state-entry.
>> > >
>> > > However, there is a warning of a failed fixup:
>> > >
>> > >   Failed to fixup node in of_state_fixup+0x1/0x1ac: No such device
>> > >
>> > > Could it be that the eeprom-alias is missing? I'm still learning
>> > > device-tree and stuff and I'm not yet entirely sure how everything
>> > > is related.
>> > >
>> > > The partition is created within a
>> > >
>> > >{
>> > >  [..]
>> > >   }
>> > >
>> > > section and eeprom is defined as
>> > >
>> > >   eeprom: eeprom@52 {
>> > >
>> > >   }
>> > >
>> > > (I added the 'eeprom: '- name/alias)
>> > >
>> > > Where am I missing the link?
>> >
>> > there was a patch recently that fixed a bug in the context of
>> > partition fixups and as a result repaired the state fixup as well
>> > for some setups:
>> >
>> >   http://lists.infradead.org/pipermail/barebox/2018-October/035091.html
>> >
>> > Please check if it solves your problem. If not then please provide
>> > more insight into your devicetrees (barebox & kernel) and post a
>> > little bit more context of the state node as well as the eeprom and
>> > the aliases nodes.
>>
>> I investigated further (still doing right now). In my kernel
>> device-tree the eeprom does not have the partition definition. So
>> of_state_fixup() does not find it (I added some debug prints to
>> analyze):
>>
>>of_find_node_by_path_from:
>>/soc/aips-bus@0210/i2c@021a/eeprom@52/partitions/state@0
>>not found
>>
>> I wrongly assumed from mails I found in the archive that barebox is
>> fixing up even the partitions.
>>
>> Does your patch from above will be helpful in my case?
>>
>> Do I need to change the kernel-device-tree to insert the partitions
>> manually? If so, how should it look like if the state-partition in
>> barebox is defined like this:
>>
>>{
>>  status = "okay";
>>  partitions {
>>  compatible = "fixed-partitions";
>>  #size-cells = <1>;
>>  #address-cells = <1>;
>>  backend_update_eeprom: state@0 {
>>  reg = <0x0 0x100>;
>>  label = "barebox-state-eeprom";
>>  };
>>  };
>>   };
>
> After adding the partition the kernel-device-tree
>
>{
>   status = "okay";
>   partitions {
>   backend_update_eeprom: state@0 {
>   reg = <0x0 0x100>;
>   };
>   };
>   };
>
> The barebox-fixup error disappear, the dumped device tree at boot-time
> contains the state-node.
>
> However, barebox-state, run from userspace gives
>
>   of_get_devicepath: no 'label' property found
>   in /soc/aips-bus@0210/i2c@021a/eeprom@52/partitions/state@0
>   Cannot find backend path in /state
>
>
> Do I need to copy all of the partition-description into the
> kernel-device-tree? Is this, what your patch addresses?

The patch is needed to fix newer barebox releases, but you are using an
old vendor patched version where it is not needed.

It looks like no fixup for the eeprom partitions in the kernel
devicetree takes place. As an alternative to adding the partitions
manually you could probably patch your barebox to register the wanted
fixup in the driver.

Best regards
Ulrich
--
Pengutronix e.K.   | Ulrich Ölmann   |
Industrial Linux Solutions | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0|
Amtsgericht Hildesheim, HRA 2686   | Fax:   +49-5121-206917- |

___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


Re: barebox state is not fixed up into kernel-device-tree

2018-11-05 Thread Ulrich Ölmann
Patrick Boettcher  writes:
> On Mon, 05 Nov 2018 09:28:53 +0100
> Ulrich Ölmann  wrote:
>> Patrick Boettcher  writes:
>> > I'm using a device-state (for bootchooser) which is stored in an
>> > eeprom.
>> >
>> > Works fine from within barebox - read and write.
>> >
>> > Userspace does not see the state:
>> >
>> >   Neither /aliases/state nor /state found
>> >
>> > The displayed device-tree when booting with 'boot -v -v ' does
>> > not contain the state-entry.
>> >
>> > However, there is a warning of a failed fixup:
>> >
>> >   Failed to fixup node in of_state_fixup+0x1/0x1ac: No such device
>> >
>> > Could it be that the eeprom-alias is missing? I'm still learning
>> > device-tree and stuff and I'm not yet entirely sure how everything
>> > is related.
>> >
>> > The partition is created within a
>> >
>> >{
>> >  [..]
>> >   }
>> >
>> > section and eeprom is defined as
>> >
>> >   eeprom: eeprom@52 {
>> >
>> >   }
>> >
>> > (I added the 'eeprom: '- name/alias)
>> >
>> > Where am I missing the link?
>>
>> there was a patch recently that fixed a bug in the context of
>> partition fixups and as a result repaired the state fixup as well for
>> some setups:
>>
>>   http://lists.infradead.org/pipermail/barebox/2018-October/035091.html
>>
>> Please check if it solves your problem. If not then please provide
>> more insight into your devicetrees (barebox & kernel) and post a
>> little bit more context of the state node as well as the eeprom and
>> the aliases nodes.
>
> I investigated further (still doing right now). In my kernel device-tree
> the eeprom does not have the partition definition. So of_state_fixup()
> does not find it (I added some debug prints to analyze):
>
>of_find_node_by_path_from:
>/soc/aips-bus@0210/i2c@021a/eeprom@52/partitions/state@0
>not found
>
> I wrongly assumed from mails I found in the archive that barebox is
> fixing up even the partitions.

In my last mail I forgot to ask which version of barebox you are using?
Which version of the Linux kernel are you booting from within barebox?

Best regards
Ulrich

> Does your patch from above will be helpful in my case?
>
> Do I need to change the kernel-device-tree to insert the partitions
> manually? If so, how should it look like if the state-partition in
> barebox is defined like this:
>
>{
>   status = "okay";
>   partitions {
>   compatible = "fixed-partitions";
>   #size-cells = <1>;
>   #address-cells = <1>;
>   backend_update_eeprom: state@0 {
>   reg = <0x0 0x100>;
>   label = "barebox-state-eeprom";
>   };
>   };
>   };
>
>
> Thanks,


--
Pengutronix e.K.   | Ulrich Ölmann   |
Industrial Linux Solutions | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0|
Amtsgericht Hildesheim, HRA 2686   | Fax:   +49-5121-206917- |

___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


Re: barebox state is not fixed up into kernel-device-tree

2018-11-05 Thread Ulrich Ölmann
Hi Patrick,

Patrick Boettcher  writes:
> I'm using a device-state (for bootchooser) which is stored in an
> eeprom.
>
> Works fine from within barebox - read and write.
>
> Userspace does not see the state:
>
>   Neither /aliases/state nor /state found
>
> The displayed device-tree when booting with 'boot -v -v ' does
> not contain the state-entry.
>
> However, there is a warning of a failed fixup:
>
>   Failed to fixup node in of_state_fixup+0x1/0x1ac: No such device
>
> Could it be that the eeprom-alias is missing? I'm still learning
> device-tree and stuff and I'm not yet entirely sure how everything is
> related.
>
> The partition is created within a
>
>{
>  [..]
>   }
>
> section and eeprom is defined as
>
>   eeprom: eeprom@52 {
>
>   }
>
> (I added the 'eeprom: '- name/alias)
>
> Where am I missing the link?

there was a patch recently that fixed a bug in the context of partition
fixups and as a result repaired the state fixup as well for some setups:

  http://lists.infradead.org/pipermail/barebox/2018-October/035091.html

Please check if it solves your problem. If not then please provide more
insight into your devicetrees (barebox & kernel) and post a little bit
more context of the state node as well as the eeprom and the aliases
nodes.

Best regards
Ulrich
--
Pengutronix e.K.   | Ulrich Ölmann   |
Industrial Linux Solutions | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0|
Amtsgericht Hildesheim, HRA 2686   | Fax:   +49-5121-206917- |

___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


[PATCH] state: fix indentation

2018-10-18 Thread Ulrich Ölmann
---
 common/state/state.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/common/state/state.c b/common/state/state.c
index bef20210d6e9..54c57232e626 100644
--- a/common/state/state.c
+++ b/common/state/state.c
@@ -311,7 +311,7 @@ static int state_convert_node_variable(struct state *state,
if ((conv == STATE_CONVERT_TO_NODE)
|| (conv == STATE_CONVERT_FIXUP)) {
ret = of_property_write_string(new_node, "type",
- vtype->type_name);
+  vtype->type_name);
if (ret)
goto out;
 
-- 
2.19.0


___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


[PATCH] of: base: fix typo

2018-10-18 Thread Ulrich Ölmann
Signed-off-by: Ulrich Ölmann 
---
 drivers/of/base.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/of/base.c b/drivers/of/base.c
index f9b1c3c4cbf5..b082f0c656a4 100644
--- a/drivers/of/base.c
+++ b/drivers/of/base.c
@@ -1235,7 +1235,7 @@ int of_property_write_u64_array(struct device_node *np,
  *
  * @np:device node to which the property value is to be 
written.
  * @propname:  name of the property to be written.
- * value:  pointer to the string to write
+ * @value: pointer to the string to write
  *
  * Search for a property in a device node and write a string to
  * it. If the property does not exist, it will be created and appended to
-- 
2.19.0


___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


[PATCH] state: fix documentation of state_new_from_node()

2018-10-12 Thread Ulrich Ölmann
Commit a66a8d79871c ("state: remove unused arguments from
state_new_from_node()") removed a little bit too much.

Signed-off-by: Ulrich Ölmann 
---
 common/state/state.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/common/state/state.c b/common/state/state.c
index 25d9502111c2..7f032592097d 100644
--- a/common/state/state.c
+++ b/common/state/state.c
@@ -583,6 +583,7 @@ void state_release(struct state *state)
 /*
  * state_new_from_node - create a new state instance from a device_node
  *
+ * @node   The device_node describing the new state instance
  * @readonly   This is a read-only state. Note that with this option set,
  * there are no repairs done.
  */
-- 
2.19.0


___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


[PATCH] common: state: use of_property_write_string() where appropriate

2018-10-11 Thread Ulrich Ölmann
See commit b6089182316d ("treewide: Use of_property_write_string() where
appropriate").

Signed-off-by: Ulrich Ölmann 
---
 common/state/state_variables.c | 6 ++
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/common/state/state_variables.c b/common/state/state_variables.c
index de9ba4ab61ac..abd714ceda1e 100644
--- a/common/state/state_variables.c
+++ b/common/state/state_variables.c
@@ -339,8 +339,7 @@ static int state_string_export(struct state_variable *var,
int ret = 0;
 
if (string->value_default) {
-   ret = of_set_property(node, "default", string->value_default,
- strlen(string->value_default) + 1, 1);
+   ret = of_property_write_string(node, "default", 
string->value_default);
 
if (ret)
return ret;
@@ -350,8 +349,7 @@ static int state_string_export(struct state_variable *var,
return 0;
 
if (string->value)
-   ret = of_set_property(node, "value", string->value,
- strlen(string->value) + 1, 1);
+   ret = of_property_write_string(node, "value", string->value);
 
return ret;
 }
-- 
2.19.0


___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


[PATCH] state: backend_bucket_circular: remove unused variables

2018-10-10 Thread Ulrich Ölmann
This has been forgotten in commit 9d6d91931afb ("state: Remove -EUCLEAN check
from userspace tool").

Signed-off-by: Ulrich Ölmann 
---
 common/state/backend_bucket_circular.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/common/state/backend_bucket_circular.c 
b/common/state/backend_bucket_circular.c
index 277b94d79737..4b71d8751da6 100644
--- a/common/state/backend_bucket_circular.c
+++ b/common/state/backend_bucket_circular.c
@@ -155,8 +155,6 @@ static int state_mtd_peb_read(struct 
state_backend_storage_bucket_circular *circ
 {
int ret;
off_t offset = suboffset;
-   struct mtd_ecc_stats stat1, stat2;
-   bool nostats = false;
 
offset += (off_t)circ->eraseblock * circ->mtd->erasesize;
 
-- 
2.19.0


___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


[PATCH] common: state: fix typo

2018-10-08 Thread Ulrich Ölmann
Signed-off-by: Ulrich Ölmann 
---
 common/state/state.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/common/state/state.c b/common/state/state.c
index 25d9502111c2..1273c494c138 100644
--- a/common/state/state.c
+++ b/common/state/state.c
@@ -83,7 +83,7 @@ out:
 }
 
 /**
- * state_load - Loads a state from the backend
+ * state_do_load - Loads a state from the backend
  * @param state The state that should be updated to contain the loaded data
  * @return 0 on success, -errno on failure. If no state is loaded the previous
  * values remain in the state.
-- 
2.19.0


___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


[PATCH] state: backend_bucket_circular: fix memory leak

2018-10-08 Thread Ulrich Ölmann
Signed-off-by: Ulrich Ölmann 
---
 common/state/backend_bucket_circular.c | 11 +++
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/common/state/backend_bucket_circular.c 
b/common/state/backend_bucket_circular.c
index 0529421a2c2f..277b94d79737 100644
--- a/common/state/backend_bucket_circular.c
+++ b/common/state/backend_bucket_circular.c
@@ -480,7 +480,8 @@ int state_backend_bucket_circular_create(struct device_d 
*dev, const char *path,
circ->fd = open(path, O_RDWR);
if (circ->fd < 0) {
pr_err("Failed to open circular bucket '%s'\n", path);
-   return -errno;
+   ret = -errno;
+   goto out_free;
}
 #endif
 
@@ -489,7 +490,7 @@ int state_backend_bucket_circular_create(struct device_d 
*dev, const char *path,
dev_info(dev, "Not using eraseblock %u, it is marked as bad 
(%d)\n",
 circ->eraseblock, ret);
ret = -EIO;
-   goto out_free;
+   goto out_close;
}
 
circ->bucket.read = state_backend_bucket_circular_read;
@@ -499,13 +500,15 @@ int state_backend_bucket_circular_create(struct device_d 
*dev, const char *path,
 
ret = state_backend_bucket_circular_init(*bucket);
if (ret)
-   goto out_free;
+   goto out_close;
 
return 0;
 
-out_free:
+out_close:
 #ifndef __BAREBOX__
close(circ->fd);
+out_free:
+   free(circ->mtd);
 #endif
free(circ);
 
-- 
2.19.0


___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


Re: NFS boot - could not open /.tftp_tmp_path

2018-08-09 Thread Ulrich Ölmann
Sam Ravnborg  writes:
> Hi Ulrich
>> > Then when I try to boot from nfs I get the following output:
>> >
>> > barebox: boot nfs://192.168.86.201/nfsboot/arm9/
>> 
>> you already have the slash separating the host part of the URL and the
>> path part, but you missed the slash that is needed at the beginning of
>> the absolute path:
>> 
>>   boot nfs://192.168.86.201//nfsboot/arm9/
>> 
>> (with a two slashes) should hopefully do the trick.
>
> Hmm, no luck:
> barebox:/ boot nfs://192.168.86.201//nfsboot/arm9/
> eth0: DHCP client bound to address 192.168.86.20
> T T T T T T T T T T T T T T could not open 
> /.tftp_tmp_path/zImage-at91sam9263ekt
>
> barebox:/ boot nfs://192.168.86.201//nfsboot/arm9
> eth0: DHCP client bound to address 192.168.86.20
> T T T T T T T T T T T T T T could not open 
> /.tftp_tmp_path/zImage-at91sam9263ekt
>
> I will try to add some debugging and see whats going on.

Do you see anything of interest in the server's log?
-- 
Pengutronix e.K.   | Ulrich Ölmann   |
Industrial Linux Solutions | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0|
Amtsgericht Hildesheim, HRA 2686   | Fax:   +49-5121-206917- |

___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


Re: NFS boot - could not open /.tftp_tmp_path

2018-08-09 Thread Ulrich Ölmann
Hi Sam,

Sam Ravnborg  writes:
> I try to boot my target using NFS - but something does not work.
> I have a server (192.168.86.201) where I have exported
> an nfs mount like this:
> $ sudo exportfs
> /nfsboot/arm9   
> $ cat /etc/exports.d/nfsboot.exports
> /nfsboot/arm9*(insecure,no_subtree_check,no_root_squash,rw,nohide)
>
> On my barebox target I can then mount the nfs like this:
> barebox: mkdir /mnt
> barebox: /mnt/nfs
> barebox: mount -t nfs 192.168.86.201:/nfsboot/arm9
>
> barebox: mount
> none on / type ramfs
> none on /dev type devfs
> 192.168.86.201:/nfsboot/arm9 on /mnt/nfs type nfs
>
> barebox: ls /mnt/nfs <= shows the file I have on the server
>
> Then when I try to boot from nfs I get the following output:
>
> barebox: boot nfs://192.168.86.201/nfsboot/arm9/

you already have the slash separating the host part of the URL and the
path part, but you missed the slash that is needed at the beginning of
the absolute path:

  boot nfs://192.168.86.201//nfsboot/arm9/

(with a two slashes) should hopefully do the trick.

Best regards
Ulrich


> eth0: DHCP client bound to address 192.168.86.20
> T T T T T T T T T T T T T T could not open 
> /.tftp_tmp_path/zImage-at91sam9263ek
>
> When I grep the barebox source I can only find 'tftp_tmp_path' in some
> tftp code.
>
> It looks like it somehow revert back to tftp despite I have specified nfs.
> I hope there is something trivial I do wrong.
>
> Any hints?
>
>   Sam
>
> ___
> barebox mailing list
> barebox@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/barebox


--
Pengutronix e.K.   | Ulrich Ölmann   |
Industrial Linux Solutions | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0|
Amtsgericht Hildesheim, HRA 2686   | Fax:   +49-5121-206917- |

___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


[PATCH 3/3] Documentation: state: add unit name to state variable in DT

2018-07-10 Thread Ulrich Ölmann
Starting with DT compiler version 1.4.6 (included since v2018.07.0) one gets
warnings

  : node has a reg or ranges property, but no unit name

if the first address field of a reg-property is not taken as the unit name for
its parent node.

Signed-off-by: Ulrich Ölmann 
---
 Documentation/user/state.rst | 10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/Documentation/user/state.rst b/Documentation/user/state.rst
index 843705bdb6f3..89129add7733 100644
--- a/Documentation/user/state.rst
+++ b/Documentation/user/state.rst
@@ -475,7 +475,7 @@ content, its backend-type and *state* variable set layout.
backend-storage-type = "circular";
backend-stridesize = <32>;
 
-   variable {
+   variable@0 {
reg = <0x0 0x1>;
type ="uint8";
default = <0x1>;
@@ -524,7 +524,7 @@ content, its backend-type and *state* variable layout.
backend = <_state_nand>;
backend-storage-type = "circular";
 
-   variable {
+   variable@0 {
reg = <0x0 0x1>;
type ="uint8";
default = <0x1>;
@@ -566,7 +566,7 @@ content, its backend-type and *state* variable layout.
backend = <_state_sd>;
backend-stridesize = <0x40>;
 
-   variable {
+   variable@0 {
reg = <0x0 0x1>;
type ="uint8";
default = <0x1>;
@@ -614,7 +614,7 @@ content, its backend-type and *state* variable layout.
backend-storage-type = "direct";
backend-stridesize = <32>;
 
-   variable {
+   variable@0 {
reg = <0x0 0x1>;
type ="uint8";
default = <0x1>;
@@ -668,7 +668,7 @@ content, its backend-type and *state* variable layout.
backend-storage-type = "direct";
backend-stridesize = <32>;
 
-   variable {
+   variable@0 {
reg = <0x0 0x1>;
type ="uint8";
default = <0x1>;
-- 
2.18.0


___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


[PATCH 1/3] Documentation: state: harmonize capitalization in headings

2018-07-10 Thread Ulrich Ölmann
Signed-off-by: Ulrich Ölmann 
---
 Documentation/user/state.rst | 14 +++---
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/Documentation/user/state.rst b/Documentation/user/state.rst
index d17f39befbe4..97e45d43b7cb 100644
--- a/Documentation/user/state.rst
+++ b/Documentation/user/state.rst
@@ -52,7 +52,7 @@ required to define the location where to store the *state* 
variable set.
 
 .. _state_framework,backend_types:
 
-Backend-Types (e.g. *state* storage format)
+Backend-Types (e.g. *state* Storage Format)
 ---
 
 The *state* variable set itself can be stored in different ways. Currently two
@@ -66,7 +66,7 @@ Both serialize the *state* variable set differently.
 
 .. _state_framework,raw:
 
-The ``raw`` *state* storage format
+The ``raw`` *state* Storage Format
 ##
 
 ``raw`` means the *state* variable set is a simple binary data blob only. In
@@ -117,7 +117,7 @@ embedded *state* variable set. Refer to
 
 .. _state_framework,dtb:
 
-The ``dtb`` *state* storage format
+The ``dtb`` *state* Storage Format
 ##
 
 .. note:: The ``dtb`` backend type isn't well tested. Use the ``raw`` backend
@@ -130,7 +130,7 @@ Unlike the ``raw`` *state* backend the ``dtb`` *state* 
backend can describe itse
 
 .. _state_framework,backend_storage_type:
 
-Backend Storage Types (e.g. media storage layout)
+Backend Storage Types (e.g. Media Storage Layout)
 -
 
 The serialized data (``raw`` or ``dtb``) can be stored to different backend
@@ -321,7 +321,7 @@ the eraseblock again. This significantly reduces the need 
for a block erases.
 .. important:: One copy of the *state* variable set is limited to the page size
of the used backend (e.g. NAND type flash memory)
 
-Redundant *state* variable set copies
+Redundant *state* Variable Set Copies
 -
 
 To avoid data loss when changing the *state* variable set, more than one
@@ -431,7 +431,7 @@ variable set has a size of 17 bytes (16 bytes header plus 
one byte variables).
 .. note:: For a more detailed description of the used *state* variable set
properties here, refer to :ref:`barebox,state`.
 
-NOR flash memories
+NOR Flash Memories
 ##
 
 This type of memory can be written on a single byte/word basis (depending on 
its bus
@@ -482,7 +482,7 @@ content, its backend-type and *state* variable set layout.
};
};
 
-NAND flash memories
+NAND Flash Memories
 ###
 
 This type of memory can be written on a *page* base (typically 512 bytes,
-- 
2.18.0


___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


[PATCH 2/3] Documentation: state: fix typos

2018-07-10 Thread Ulrich Ölmann
Signed-off-by: Ulrich Ölmann 
---
 Documentation/user/state.rst | 62 ++--
 1 file changed, 31 insertions(+), 31 deletions(-)

diff --git a/Documentation/user/state.rst b/Documentation/user/state.rst
index 97e45d43b7cb..843705bdb6f3 100644
--- a/Documentation/user/state.rst
+++ b/Documentation/user/state.rst
@@ -37,9 +37,9 @@ section.
 Backends (e.g. Supported Memory Types)
 --
 
-Some non-volatile memory is need for storing a *state* variable set:
+Some non-volatile memory is needed for storing a *state* variable set:
 
-- Disk like devices: SD, (e)MMC, ATA
+- disk like devices: SD, (e)MMC, ATA
 - all kinds of NAND and NOR flash memories (mtd)
 - MRAM
 - EEPROM
@@ -91,9 +91,9 @@ the binary data blob with the following content and layout:
 
 - 'magic value' is an unsigned value with native endianness, refer to
   :ref:`'magic' property ` about its value.
-- 'byte count' is an unsigned value with native endianness
-- 'binary data blob CRC32' is an unsigned value with native endianness
-- 'header CRC32' is an unsigned value with native endianness
+- 'byte count' is an unsigned value with native endianness.
+- 'binary data blob CRC32' is an unsigned value with native endianness.
+- 'header CRC32' is an unsigned value with native endianness.
 
 .. note:: the 32-bit CRC calculation uses the polynomial:
 
@@ -140,7 +140,7 @@ Currently two backend storage type implementations do 
exist, ``circular`` and
 ``direct``.
 
 The state framework can select the correct backend storage type depending on 
the
-backend medium. Media requiring erase operations (NAND, NOR flash) defaults to
+backend medium. Media requiring erase operations (NAND, NOR flash) default to
 the ``circular`` backend storage type automatically. In contrast EEPROMs and
 RAMs are candidates for the ``direct`` backend storage type.
 
@@ -151,9 +151,9 @@ This kind of backend storage type is intended to be used 
with persistent RAMs or
 EEPROMs.
 These media are characterized by:
 
-- memory cells can be simply written at any time (no previous erase required)
-- memory cells can be written as often as required (unlimted or very high 
endurance)
-- can be written on a byte-by-byte manner
+- memory cells can be simply written at any time (no previous erase required).
+- memory cells can be written as often as required (unlimted or very high 
endurance).
+- memory cells can be written on a byte-by-byte manner.
 
 Example: MRAM with 64 bytes at device's offset 0:
 
@@ -183,10 +183,10 @@ This kind of backend storage type is intended to be used 
with regular flash memo
 
 Flash memories are characterized by:
 
-- only erased memory cells can be written with new data
-- written data cannot be written twice (at least not for modern flash devices)
-- erase can happen on eraseblock sizes only (detectable, physical value)
-- an eraseblock only supports a limited number of write-erase-cycles (as low 
as a few thousand cycles)
+- only erased memory cells can be written with new data.
+- written data cannot be written twice (at least not for modern flash devices).
+- erase can happen on eraseblock sizes only (detectable, physical value).
+- an eraseblock only supports a limited number of write-erase-cycles (as low 
as a few thousand cycles).
 
 The purpose of the ``circular`` backend storage type is to save erase cycles
 which may wear out the flash's eraseblocks. This type instead incrementally 
fills
@@ -196,7 +196,7 @@ eraseblock again.
 
 **NOR type flash memory is additionally characterized by**
 
-- can be written on a byte-by-byte manner
+- memory cells can be written on a byte-by-byte manner.
 
 .. _state_framework,nor:
 
@@ -258,10 +258,10 @@ the eraseblock again. This reduces the need for a flash 
memory erase by factors.
 
 **NAND type flash memory is additionally characterized by**
 
-- organized in pages (size is a detectable, physical value)
-- writes can only happen in multiples of the page size (which much less than 
the eraseblock size)
+- it is organized in pages (size is a detectable, physical value).
+- writes can only happen in multiples of the page size (which much less than 
the eraseblock size).
 - partially writing a page can be limited in count or be entirely forbidden (in
-  the case of *MLC* NANDs)
+  the case of *MLC* NANDs).
 
 Example: NAND type flash memory with 128 kiB eraseblock size and 2 kiB page
 size and a 2 kiB write size
@@ -327,7 +327,7 @@ Redundant *state* Variable Set Copies
 To avoid data loss when changing the *state* variable set, more than one
 *state* variable set copy can be stored into the backend. Whenever the *state*
 variable set changes, only one *state* variable set copy gets changed at a 
time.
-In the case of an interruption and/or power loss resulting into an incomplete
+In the case of an interruption and/or power loss resulting in an incomplete
 write to the backend, the system can fall back to a different *state* variable
 set copy (previous

[PATCH 2/2] fs: remove shortcut in canonicalizing filenames

2018-04-16 Thread Ulrich Ölmann
Only individually getting the file status for every part of the path tells us if
a symbolic link is involved or not. If this is the case the later call to
readlink will check if the filesystem supports symbolic links or not.

Hence this reverts commit d79a81736f64 ("fs: Don't bother filesystems without
link support with additional stat() calls").

Signed-off-by: Ulrich Ölmann <u.oelm...@pengutronix.de>
---
 fs/fs.c | 10 --
 1 file changed, 10 deletions(-)

diff --git a/fs/fs.c b/fs/fs.c
index 7c818eca024f..b2da0a62a29d 100644
--- a/fs/fs.c
+++ b/fs/fs.c
@@ -144,7 +144,6 @@ char *normalise_path(const char *pathname)
 EXPORT_SYMBOL(normalise_path);
 
 static int __lstat(const char *filename, struct stat *s);
-static struct fs_device_d *get_fsdevice_by_path(const char *path);
 
 static char *__canonicalize_path(const char *_pathname, int level)
 {
@@ -167,7 +166,6 @@ static char *__canonicalize_path(const char *_pathname, int 
level)
char *p = strsep(, "/");
char *tmp;
char link[PATH_MAX] = {};
-   struct fs_device_d *fsdev;
 
if (!p)
break;
@@ -186,14 +184,6 @@ static char *__canonicalize_path(const char *_pathname, 
int level)
free(outpath);
outpath = tmp;
 
-   /*
-* Don't bother filesystems without link support
-* with an additional stat() call.
-*/
-   fsdev = get_fsdevice_by_path(outpath);
-   if (!fsdev || !fsdev->driver->readlink)
-   continue;
-
ret = __lstat(outpath, );
if (ret)
goto out;
-- 
2.16.3


___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


[PATCH 1/2] fs: fix error path in __canonicalize_path()

2018-04-16 Thread Ulrich Ölmann
Report failure in resolving links to the caller and only clean up memory then.

Signed-off-by: Ulrich Ölmann <u.oelm...@pengutronix.de>
---
 fs/fs.c | 10 +++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/fs/fs.c b/fs/fs.c
index 5135112c8b81..7c818eca024f 100644
--- a/fs/fs.c
+++ b/fs/fs.c
@@ -202,8 +202,11 @@ static char *__canonicalize_path(const char *_pathname, 
int level)
continue;
 
ret = readlink(outpath, link, PATH_MAX - 1);
-   if (ret < 0)
+   if (ret < 0) {
+   free(outpath);
+   outpath = ERR_PTR(ret);
goto out;
+   }
 
if (link[0] == '/') {
free(outpath);
@@ -218,14 +221,15 @@ static char *__canonicalize_path(const char *_pathname, 
int level)
if (IS_ERR(outpath))
goto out;
}
-out:
-   free(freep);
 
if (!*outpath) {
free(outpath);
outpath = xstrdup("/");
}
 
+out:
+   free(freep);
+
return outpath;
 }
 
-- 
2.16.3


___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


[PATCH] commands/Kconfig: fix copy'n'paste error in CMD_GPIO help

2018-01-24 Thread Ulrich Ölmann
Signed-off-by: Ulrich Ölmann <u.oelm...@pengutronix.de>
---
 commands/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/commands/Kconfig b/commands/Kconfig
index ae2dc4b0947b..24565eb14d4a 100644
--- a/commands/Kconfig
+++ b/commands/Kconfig
@@ -1712,7 +1712,7 @@ config CMD_GPIO
 
  gpio_direction_output - set direction of a GPIO pin to output
 
- Usage: gpio_direction_output GPIO
+ Usage: gpio_direction_output GPIO VALUE
 
 
  gpio_get_value - return value of a GPIO pin
-- 
2.11.0


___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


Re: [PATCH] state: Documentation: fix typo

2018-01-21 Thread Ulrich Ölmann
On Fri, Jan 19, 2018 at 05:25:02PM +0100, Roland Hieber wrote:
> On 19.01.2018 11:20, Ulrich Ölmann wrote:
> > Signed-off-by: Ulrich Ölmann <u.oelm...@pengutronix.de>
> > ---
> >  Documentation/devicetree/bindings/barebox/barebox,state.rst | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/Documentation/devicetree/bindings/barebox/barebox,state.rst 
> > b/Documentation/devicetree/bindings/barebox/barebox,state.rst
> > index cebb5f82879a..4be5f2f6bd7e 100644
> > --- a/Documentation/devicetree/bindings/barebox/barebox,state.rst
> > +++ b/Documentation/devicetree/bindings/barebox/barebox,state.rst
> > @@ -64,7 +64,7 @@ Optional Properties
> >  
> >  The ``backend-stridesize`` is still optional but required whenever the
> >  underlaying backend doesn't provide an information how to pad an instance 
> > of a
> > -*state* variable set. This is valid for all underlaying backends which 
> > supports
> > +*state* variable set. This is valid for all underlaying backends which 
> > support
> 
> Could please also fix this line so it says "underlying"? :-)

Oh yes, of course - the last word in the line attracted my eyes so strongly that
I did not recognize your finding.

Best regards
Ulrich
-- 
Pengutronix e.K.   | |
Industrial Linux Solutions | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0|
Amtsgericht Hildesheim, HRA 2686   | Fax:   +49-5121-206917- |

___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


[PATCH v2] state: Documentation: fix typo

2018-01-21 Thread Ulrich Ölmann
Signed-off-by: Ulrich Ölmann <u.oelm...@pengutronix.de>
---
 Documentation/devicetree/bindings/barebox/barebox,state.rst | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/Documentation/devicetree/bindings/barebox/barebox,state.rst 
b/Documentation/devicetree/bindings/barebox/barebox,state.rst
index cebb5f82879a..872bac061b44 100644
--- a/Documentation/devicetree/bindings/barebox/barebox,state.rst
+++ b/Documentation/devicetree/bindings/barebox/barebox,state.rst
@@ -63,8 +63,8 @@ Optional Properties
 .. _barebox,state_backend_stridesize:
 
 The ``backend-stridesize`` is still optional but required whenever the
-underlaying backend doesn't provide an information how to pad an instance of a
-*state* variable set. This is valid for all underlaying backends which supports
+underlying backend doesn't provide an information how to pad an instance of a
+*state* variable set. This is valid for all underlying backends which support
 writes on a byte-by-byte manner or don't have eraseblocks (EEPROM, SRAM and NOR
 type flash backends).
 The ``backend-stridesize`` value is used by the ``direct`` backend storage type
-- 
2.11.0


___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


[PATCH] state: Documentation: fix typo

2018-01-19 Thread Ulrich Ölmann
Signed-off-by: Ulrich Ölmann <u.oelm...@pengutronix.de>
---
 Documentation/devicetree/bindings/barebox/barebox,state.rst | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Documentation/devicetree/bindings/barebox/barebox,state.rst 
b/Documentation/devicetree/bindings/barebox/barebox,state.rst
index cebb5f82879a..4be5f2f6bd7e 100644
--- a/Documentation/devicetree/bindings/barebox/barebox,state.rst
+++ b/Documentation/devicetree/bindings/barebox/barebox,state.rst
@@ -64,7 +64,7 @@ Optional Properties
 
 The ``backend-stridesize`` is still optional but required whenever the
 underlaying backend doesn't provide an information how to pad an instance of a
-*state* variable set. This is valid for all underlaying backends which supports
+*state* variable set. This is valid for all underlaying backends which support
 writes on a byte-by-byte manner or don't have eraseblocks (EEPROM, SRAM and NOR
 type flash backends).
 The ``backend-stridesize`` value is used by the ``direct`` backend storage type
-- 
2.11.0


___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


[PATCH] ARM: i.MX: bbu-internal: fix typos

2017-11-26 Thread Ulrich Ölmann
Signed-off-by: Ulrich Ölmann <u.oelm...@pengutronix.de>
---
 arch/arm/mach-imx/imx-bbu-internal.c | 12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/arch/arm/mach-imx/imx-bbu-internal.c 
b/arch/arm/mach-imx/imx-bbu-internal.c
index a8433ed901c0..887211d4ca8d 100644
--- a/arch/arm/mach-imx/imx-bbu-internal.c
+++ b/arch/arm/mach-imx/imx-bbu-internal.c
@@ -407,7 +407,7 @@ static int __register_handler(struct 
imx_internal_bbu_handler *imx_handler)
 }
 
 /*
- * Register a i.MX51 internal boot update handler for MMC/SD
+ * Register an i.MX51 internal boot update handler for MMC/SD
  */
 int imx51_bbu_internal_mmc_register_handler(const char *name, char *devicefile,
unsigned long flags)
@@ -424,7 +424,7 @@ int imx51_bbu_internal_mmc_register_handler(const char 
*name, char *devicefile,
 }
 
 /*
- * Register a i.MX53 internal boot update handler for MMC/SD
+ * Register an i.MX53 internal boot update handler for MMC/SD
  */
 int imx53_bbu_internal_mmc_register_handler(const char *name, char *devicefile,
unsigned long flags)
@@ -441,7 +441,7 @@ int imx53_bbu_internal_mmc_register_handler(const char 
*name, char *devicefile,
 }
 
 /*
- * Register a i.MX53 internal boot update handler for i2c/spi
+ * Register an i.MX53 internal boot update handler for i2c/spi
  * EEPROMs / flashes. Nearly the same as MMC/SD, but we do not need to
  * keep a partition table. We have to erase the device beforehand though.
  */
@@ -460,7 +460,7 @@ int imx53_bbu_internal_spi_i2c_register_handler(const char 
*name, char *devicefi
 }
 
 /*
- * Register a i.MX53 internal boot update handler for NAND
+ * Register an i.MX53 internal boot update handler for NAND
  */
 int imx53_bbu_internal_nand_register_handler(const char *name,
unsigned long flags, int partition_size)
@@ -479,7 +479,7 @@ int imx53_bbu_internal_nand_register_handler(const char 
*name,
 }
 
 /*
- * Register a i.MX6 internal boot update handler for MMC/SD
+ * Register an i.MX6 internal boot update handler for MMC/SD
  */
 int imx6_bbu_internal_mmc_register_handler(const char *name, char *devicefile,
unsigned long flags)
@@ -496,7 +496,7 @@ int imx6_bbu_internal_mmc_register_handler(const char 
*name, char *devicefile,
 }
 
 /*
- * Register a i.MX6 internal boot update handler for i2c/spi
+ * Register an i.MX6 internal boot update handler for i2c/spi
  * EEPROMs / flashes. Nearly the same as MMC/SD, but we do not need to
  * keep a partition table. We have to erase the device beforehand though.
  */
-- 
2.11.0


___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


[PATCH] ARM: i.MX: bbu-internal: fix comment

2017-11-25 Thread Ulrich Ölmann
Signed-off-by: Ulrich Ölmann <u.oelm...@pengutronix.de>
---
 arch/arm/mach-imx/imx-bbu-internal.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm/mach-imx/imx-bbu-internal.c 
b/arch/arm/mach-imx/imx-bbu-internal.c
index 51ec8b8270f9..a8433ed901c0 100644
--- a/arch/arm/mach-imx/imx-bbu-internal.c
+++ b/arch/arm/mach-imx/imx-bbu-internal.c
@@ -496,7 +496,7 @@ int imx6_bbu_internal_mmc_register_handler(const char 
*name, char *devicefile,
 }
 
 /*
- * Register a i.MX53 internal boot update handler for i2c/spi
+ * Register a i.MX6 internal boot update handler for i2c/spi
  * EEPROMs / flashes. Nearly the same as MMC/SD, but we do not need to
  * keep a partition table. We have to erase the device beforehand though.
  */
-- 
2.11.0


___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


[PATCH] mtd: spi-nor: mx25l3205d/mx25l6405d: append SECT_4K

2017-11-24 Thread Ulrich Ölmann
This is a port of Linux kernel commit

| commit 0501f2e5ff28a02295e42fc9e7164a20ef4c30d5
| Author: Andreas Fenkart <afenk...@gmail.com>
| Date:   Thu Nov 5 10:04:23 2015 +0100
|
| mtd: spi-nor: mx25l3205d/mx25l6405d: append SECT_4K
|
| according datasheet both chips can erase 4kByte sectors individually
|
| Signed-off-by: Andreas Fenkart <andreas.fenk...@dev.digitalstrom.org>
| Signed-off-by: Brian Norris <computersforpe...@gmail.com>

Signed-off-by: Ulrich Ölmann <u.oelm...@pengutronix.de>
---
 drivers/mtd/spi-nor/spi-nor.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/mtd/spi-nor/spi-nor.c b/drivers/mtd/spi-nor/spi-nor.c
index fb13cd12694a..5cf650c0e230 100644
--- a/drivers/mtd/spi-nor/spi-nor.c
+++ b/drivers/mtd/spi-nor/spi-nor.c
@@ -524,9 +524,9 @@ static const struct spi_device_id spi_nor_ids[] = {
{ "mx25l4005a",  INFO(0xc22013, 0, 64 * 1024,   8, SECT_4K) },
{ "mx25l8005",   INFO(0xc22014, 0, 64 * 1024,  16, 0) },
{ "mx25l1606e",  INFO(0xc22015, 0, 64 * 1024,  32, SECT_4K) },
-   { "mx25l3205d",  INFO(0xc22016, 0, 64 * 1024,  64, 0) },
+   { "mx25l3205d",  INFO(0xc22016, 0, 64 * 1024,  64, SECT_4K) },
{ "mx25l3255e",  INFO(0xc29e16, 0, 64 * 1024,  64, SECT_4K) },
-   { "mx25l6405d",  INFO(0xc22017, 0, 64 * 1024, 128, 0) },
+   { "mx25l6405d",  INFO(0xc22017, 0, 64 * 1024, 128, SECT_4K) },
{ "mx25u2033e",  INFO(0xc22532, 0, 64 * 1024,   4, SECT_4K) },
{ "mx25u4035",   INFO(0xc22533, 0, 64 * 1024,   8, SECT_4K) },
{ "mx25u8035",   INFO(0xc22534, 0, 64 * 1024,  16, SECT_4K) },
-- 
2.11.0


___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


[PATCH] Documentation: devicetree: m25p80: fix referenced filename

2017-11-24 Thread Ulrich Ölmann
Linux changed the filename in commit 8947e396a829 ("Documentation: dt: mtd:
replace "nor-jedec" binding with "jedec, spi-nor"") and barebox imported this
change in commit 8ed978b79062 ("dts: update to v4.1-rc4").

Signed-off-by: Ulrich Ölmann <u.oelm...@pengutronix.de>
---
 Documentation/devicetree/bindings/mtd/m25p80.rst | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Documentation/devicetree/bindings/mtd/m25p80.rst 
b/Documentation/devicetree/bindings/mtd/m25p80.rst
index d7c8914ec5d7..09e8b8eff606 100644
--- a/Documentation/devicetree/bindings/mtd/m25p80.rst
+++ b/Documentation/devicetree/bindings/mtd/m25p80.rst
@@ -1,7 +1,7 @@
 MTD SPI driver for ST M25Pxx (and similar) serial flash chips
 =
 
-Additionally to the Linux bindings in ``dts/Bindings/mtd/m25p80.txt``
+Additionally to the Linux bindings in ``dts/Bindings/mtd/jedec,spi-nor.txt``
 the barebox driver has the following optional properties:
 
 - use-large-blocks : Use large blocks rather than the 4K blocks some devices
-- 
2.11.0


___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


Re: [PATCH 0/2] Allow decimally formatted data for the commands "i2c_write" and "spi"

2017-10-19 Thread Ulrich Ölmann
Args, forgot the v2-infix in the subject...
-- 
Pengutronix e.K.   | |
Industrial Linux Solutions | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0|
Amtsgericht Hildesheim, HRA 2686   | Fax:   +49-5121-206917- |

___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


Re: [PATCH 1/2] commands: i2c: do not restrict i2c_write's data to be hex-formatted

2017-10-19 Thread Ulrich Ölmann
Hi Uwe and list,

On Tue, Oct 17, 2017 at 03:51:37PM +0200, Uwe Kleine-König wrote:
> On Tue, Oct 17, 2017 at 03:16:24PM +0200, Ulrich Ölmann wrote:
> > The price to pay is needing the usual prefix "0x" for each hex-formatted 
> > number.
> > 
> > Signed-off-by: Ulrich Ölmann <u.oelm...@pengutronix.de>
> 
> ack for the change. I'd like to see the motivation (i.e. consistency with
> the other commands in barebox as mentioned in the cover letter) in the
> commit log, though.

just sent a v2.

> [...]
> > -   *(buf + i) = (char) simple_strtol(argv[optind+i], NULL, 16);
> > +   *(buf + i) = (char) simple_strtol(argv[optind+i], NULL, 0);
> 
> Maybe change that to:
> 
>   buf[i] = simple_strtol(...);
> 
> which is a bit easier to read and drops an unnecessary cast? (Or should
> that better go in a separate change?)

Fully agreed. Will you prepare a patch?

Best regards
Ulrich
-- 
Pengutronix e.K.   | |
Industrial Linux Solutions | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0|
Amtsgericht Hildesheim, HRA 2686   | Fax:   +49-5121-206917- |

___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


[PATCH 1/2] commands: i2c: do not restrict i2c_write's data to be hex-formatted

2017-10-19 Thread Ulrich Ölmann
Change the default base to 0 to be consistent with the "mw" command and
particularly allow decimally formatted data.

The price to pay is needing the usual prefix "0x" for each hex-formatted number.

Signed-off-by: Ulrich Ölmann <u.oelm...@pengutronix.de>
Acked-by: Uwe Kleine-König <u.kleine-koe...@pengutronix.de>
---
 commands/i2c.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/commands/i2c.c b/commands/i2c.c
index 573032ab1588..b74c53509f38 100644
--- a/commands/i2c.c
+++ b/commands/i2c.c
@@ -129,7 +129,7 @@ static int do_i2c_write(int argc, char *argv[])
 
buf = xmalloc(count);
for (i = 0; i < count; i++)
-   *(buf + i) = (char) simple_strtol(argv[optind+i], NULL, 16);
+   *(buf + i) = (char) simple_strtol(argv[optind+i], NULL, 0);
 
ret = i2c_write_reg(, reg | wide, buf, count);
if (ret != count) {
-- 
2.11.0


___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


[PATCH 2/2] commands: spi: do not restrict spi's data to be hex-formatted

2017-10-19 Thread Ulrich Ölmann
Change the default base to 0 to be consistent with the "mw" command and
particularly allow decimally formatted data.

The price to pay is needing the usual prefix "0x" for each hex-formatted number.

Signed-off-by: Ulrich Ölmann <u.oelm...@pengutronix.de>
Acked-by: Uwe Kleine-König <u.kleine-koe...@pengutronix.de>
---
 commands/spi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/commands/spi.c b/commands/spi.c
index 6603b34b673c..7bf193b0 100644
--- a/commands/spi.c
+++ b/commands/spi.c
@@ -84,7 +84,7 @@ static int do_spi(int argc, char *argv[])
rx_buf = xmalloc(read);
 
for (i = 0; i < count; i++)
-   tx_buf[i] = (u8) simple_strtol(argv[optind + i], NULL, 16);
+   tx_buf[i] = (u8) simple_strtol(argv[optind + i], NULL, 0);
 
ret = spi_write_then_read(, tx_buf, count, rx_buf, read);
if (ret)
-- 
2.11.0


___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


[PATCH 0/2] Allow decimally formatted data for the commands "i2c_write" and "spi"

2017-10-19 Thread Ulrich Ölmann
Currently both commands set the default base for parsing user supplied data to
16 which makes it impossible at all to parse decimal data.

Presumably this originates from having the convenience to easily copy'n'paste
hex dumped data into these commands without further preprocessing it before.

Change the default base to 0 to particularly allow decimally formatted data.
This is in accordance to what the "mw" command does.

Changes since (implicit) v1 (20171017) 
(http://lists.infradead.org/pipermail/barebox/2017-October/031356.html):
  - extended the commit messages to include the motivation for the change
  - added Uwe's acked-by

Ulrich Ölmann (2):
  commands: i2c: do not restrict i2c_write's data to be hex-formatted
  commands: spi: do not restrict spi's data to be hex-formatted

 commands/i2c.c | 2 +-
 commands/spi.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

--
2.11.0

___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


[PATCH 2/2] commands: spi: do not restrict spi's data to be hex-formatted

2017-10-17 Thread Ulrich Ölmann
The price to pay is needing the usual prefix "0x" for each hex-formatted number.

Signed-off-by: Ulrich Ölmann <u.oelm...@pengutronix.de>
---
 commands/spi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/commands/spi.c b/commands/spi.c
index 6603b34b673c..7bf193b0 100644
--- a/commands/spi.c
+++ b/commands/spi.c
@@ -84,7 +84,7 @@ static int do_spi(int argc, char *argv[])
rx_buf = xmalloc(read);
 
for (i = 0; i < count; i++)
-   tx_buf[i] = (u8) simple_strtol(argv[optind + i], NULL, 16);
+   tx_buf[i] = (u8) simple_strtol(argv[optind + i], NULL, 0);
 
ret = spi_write_then_read(, tx_buf, count, rx_buf, read);
if (ret)
-- 
2.11.0


___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


[PATCH 0/2] Allow decimally formatted data for the commands "i2c_write" and "spi"

2017-10-17 Thread Ulrich Ölmann
Currently both commands set the default base for parsing user supplied data to
16 which makes it impossible at all to parse decimal data.

Presumably this originates from having the convenience to easily copy'n'paste
hex dumped data into these commands without further preprocessing it before.

Change the default base to 0 to particularly allow decimally formatted data.
This is in accordance to what the "mw" command does.

Ulrich Ölmann (2):
  commands: i2c: do not restrict i2c_write's data to be hex-formatted
  commands: spi: do not restrict spi's data to be hex-formatted

 commands/i2c.c | 2 +-
 commands/spi.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

-- 
2.11.0


___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


[PATCH 1/2] commands: i2c: do not restrict i2c_write's data to be hex-formatted

2017-10-17 Thread Ulrich Ölmann
The price to pay is needing the usual prefix "0x" for each hex-formatted number.

Signed-off-by: Ulrich Ölmann <u.oelm...@pengutronix.de>
---
 commands/i2c.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/commands/i2c.c b/commands/i2c.c
index 573032ab1588..b74c53509f38 100644
--- a/commands/i2c.c
+++ b/commands/i2c.c
@@ -129,7 +129,7 @@ static int do_i2c_write(int argc, char *argv[])
 
buf = xmalloc(count);
for (i = 0; i < count; i++)
-   *(buf + i) = (char) simple_strtol(argv[optind+i], NULL, 16);
+   *(buf + i) = (char) simple_strtol(argv[optind+i], NULL, 0);
 
ret = i2c_write_reg(, reg | wide, buf, count);
if (ret != count) {
-- 
2.11.0


___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


[PATCH] docs: update vendor URL for Vincell-LT

2017-04-25 Thread Ulrich Ölmann
Signed-off-by: Ulrich Ölmann <u.oelm...@pengutronix.de>
---
 Documentation/boards/imx/Garz-Fricke-Vincell.rst | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Documentation/boards/imx/Garz-Fricke-Vincell.rst 
b/Documentation/boards/imx/Garz-Fricke-Vincell.rst
index 2eb5f65c64f7..58ab0ab42f23 100644
--- a/Documentation/boards/imx/Garz-Fricke-Vincell.rst
+++ b/Documentation/boards/imx/Garz-Fricke-Vincell.rst
@@ -7,7 +7,7 @@ This CPU card is based on a Freescale i.MX53 CPU. The card is 
shipped with:
   * 512MiB synchronous dynamic RAM
   * microSD slot
 
-see http://www.garz-fricke.com/vincell-lt-core_de.html for more information
+see 
http://www.garz-fricke.com/en/products/embedded-systems/single-board-computer/ia-0086r/
 for more information
 
 
 Bootstrapping barebox
-- 
2.11.0


___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


[PATCH] ARM: mvebu: remove obsolete select

2017-03-17 Thread Ulrich Ölmann
This is a user choice now and has been removed for all other boards in commit
790980bf18af ("Make generic default environment type a use choice").

Signed-off-by: Ulrich Ölmann <u.oelm...@pengutronix.de>
---
 arch/arm/Kconfig | 1 -
 1 file changed, 1 deletion(-)

diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 4d952698fc5c..c665eae30a2a 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -117,7 +117,6 @@ config ARCH_MVEBU
select CLKDEV_LOOKUP
select GPIOLIB
select HAS_DEBUG_LL
-   select HAVE_DEFAULT_ENVIRONMENT_NEW
select HAVE_MACH_ARM_HEAD
select HAVE_PBL_MULTI_IMAGES
select HW_HAS_PCI
-- 
2.11.0


___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


Re: squashfs: corrupted kernel image when booting/reading from squashfs

2017-02-04 Thread Ulrich Ölmann
Hi Falco,

On Fri, Feb 03, 2017 at 12:24:47PM +0100, Falco Hyfing wrote:
> I try to boot a kernel-fit.itb from squashfs (xz compressed) volume while the
> same kernel-fit.itb is bootable from a fat volume:

currently barebox' squashfs driver seems to be broken if not used with lzo
compression: the symptom is barebox only reading the first squashfs block
correctly.

I looked into this some months ago, but did not manage to find and fix the bug
in reasonable time. As the barebox driver has been ported from the linux kernel,
the latter is a working reference to look at when debugging.

So you are welcome to hack on it and send patches. :)

Best regards
Ulrich
-- 
Pengutronix e.K.   | |
Industrial Linux Solutions | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0|
Amtsgericht Hildesheim, HRA 2686   | Fax:   +49-5121-206917- |

___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


[PATCH] x86: update boot message "UBOOT2" to "BAREBOX"

2016-12-01 Thread Ulrich Ölmann
Signed-off-by: Ulrich Ölmann <u.oelm...@pengutronix.de>
---
 arch/x86/boot/boot_hdisk.S | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/boot/boot_hdisk.S b/arch/x86/boot/boot_hdisk.S
index 143336d3b43e..6f98197512a0 100644
--- a/arch/x86/boot/boot_hdisk.S
+++ b/arch/x86/boot/boot_hdisk.S
@@ -164,7 +164,7 @@ output_message:
 
.section .boot_data
 
-notification_string:   .asciz "UBOOT2 "
+notification_string:   .asciz "BAREBOX "
 chs_string:.asciz "CHS "
 jmp_string:.asciz "JMP "
 
-- 
2.1.4


___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


Re: help-UBOOT2 JMP

2016-11-30 Thread Ulrich Ölmann
Hi,

On Wed, Nov 30, 2016 at 06:16:22PM +0330, irlinuxbox wrote:
> barebox is displays “UBOOT2 JMP ” during bootup on x86
> 
> export ARCH=x86
> make generic_defconfig
> make
> 
> ./scripts/setupmbr/setupmbr –s 32 –m ./barebox.bin –d /dev/sdb

doing a quick grep for "UBOOT2" points to arch/x86/boot/boot_hdisk.S and roughly
skimming the code shows that this is normal behaviour notifying the user of
different steps in the boot process.

Regards
Ulrich

___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


[PATCH] environment: fix typo

2016-11-23 Thread Ulrich Ölmann
Signed-off-by: Ulrich Ölmann <u.oelm...@pengutronix.de>
---
 common/environment.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/common/environment.c b/common/environment.c
index c9cef6322a06..0edf34b661d9 100644
--- a/common/environment.c
+++ b/common/environment.c
@@ -382,7 +382,7 @@ EXPORT_SYMBOL(envfs_save);
 static int envfs_check_super(struct envfs_super *super, size_t *size)
 {
if (ENVFS_32(super->magic) != ENVFS_MAGIC) {
-   printf("envfs: no envfs (magic mismatch) - envfs newer 
written?\n");
+   printf("envfs: no envfs (magic mismatch) - envfs never 
written?\n");
return -EIO;
}
 
-- 
2.10.2


___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


[PATCH] Documentation: bootchooser: fix typos

2016-11-22 Thread Ulrich Ölmann
Signed-off-by: Ulrich Ölmann <u.oelm...@pengutronix.de>
---
 Documentation/user/bootchooser.rst | 57 +-
 1 file changed, 31 insertions(+), 26 deletions(-)

diff --git a/Documentation/user/bootchooser.rst 
b/Documentation/user/bootchooser.rst
index 5baa66d9b9f9..cef1d4abb090 100644
--- a/Documentation/user/bootchooser.rst
+++ b/Documentation/user/bootchooser.rst
@@ -67,7 +67,7 @@ Additionally the remaining_attempts counter can be reset 
manually using the
 :ref:`command_bootchooser` command. This allows for custom conditions under 
which
 a system is marked as good.
 In case only the booted system itself knows when it is in a good state, the
-barebox-state tool from the dt-utils_ package can used to reset the 
remaining_attempts
+barebox-state tool from the dt-utils_ package can be used to reset the 
remaining_attempts
 counter from the currently running system.
 
 .. _dt-utils: http://git.pengutronix.de/?p=tools/dt-utils.git;a=summary
@@ -79,8 +79,8 @@ Additionally to the target options described above, 
bootchooser has some general
 options not specific to any target.
 
 ``global.bootchooser.disable_on_zero_attempts``
-  Boolean flag. if 1, bootchooser disables a target (sets priority to 0) 
whenever the
-  remaining attempts counter reaches 0.
+  Boolean flag. If set to 1, bootchooser disables a target (sets priority to 
0) whenever
+  the remaining attempts counter reaches 0.
 ``global.bootchooser.default_attempts``
   The default number of attempts that a target shall be tried starting, used 
when not
   overwritten with the target specific variable of the same name.
@@ -89,25 +89,28 @@ options not specific to any target.
   of the same name.
 ``global.bootchooser.reset_attempts``
   A space separated list of events that cause bootchooser to reset the
-  remaining_attempts counters of each target that has a non zero priority. 
possible values:
-  * empty:  counters will never be reset``
+  remaining_attempts counters of each target that has a non zero priority. 
Possible values:
+
+  * empty: counters will never be reset``
   * power-on: counters will be reset after power-on-reset
   * all-zero: counters will be reset when all targets have zero remaining 
attempts
 ``global.bootchooser.reset_priorities``
   A space separated list of events that cause bootchooser to reset the 
priorities of
   all targets. Possible values:
+
   * empty: priorities will never be reset
   * all-zero: priorities will be reset when all targets have zero priority
 ``global.bootchooser.retry``
-  If 1, bootchooser retries booting until one succeeds or no more valid 
targets exist.
+  If set to 1, bootchooser retries booting until one succeeds or no more valid 
targets
+  exist.
 ``global.bootchooser.state_prefix``
-  Variable prefix when bootchooser used with state framework as backend for 
storing runtime
-  data, see below.
+  Variable prefix when bootchooser is used with the state framework as backend 
for storing
+  runtime data, see below.
 ``global.bootchooser.targets``
   Space separated list of targets that are used. For each entry in the list a 
corresponding
-  set of ``global.bootchooser.``. variables must exist.
+  set of ``global.bootchooser..`` variables must 
exist.
 ``global.bootchooser.last_chosen``
-  bootchooser sets this to the target that was chosen on last boot (index)
+  bootchooser sets this to the target that was chosen on last boot (index).
 
 Using the State Framework as Backend for Runtime Variable Data
 --
@@ -178,7 +181,7 @@ Settings
 - ``global.bootchooser.disable_on_zero_attempts=0``
 - ``global.bootchooser.retry=1``
 - ``global.boot.default="bootchooser recovery"``
-- Userspace marks as good
+- Userspace marks as good.
 
 Deployment
 ^^
@@ -208,21 +211,22 @@ Settings
 - ``global.bootchooser.disable_on_zero_attempts=0``
 - ``global.bootchooser.retry=1``
 - ``global.boot.default="bootchooser recovery"``
-- Userspace marks as good
+- Userspace marks as good.
 
 Deployment
 ^^
 
-#. barebox or flash robot fills all slots with valid systems
+#. barebox or flash robot fills all slots with valid systems.
 #. barebox or flash robot marks slots as good or state contains non zero
-   defaults for the remaining_attempts / priorities
+   defaults for the remaining_attempts/priorities.
 
 Recovery
 
 done by 'recovery' boot target which is booted after the bootchooser falls 
through due to
 the lack of bootable targets. This target can be:
-- A system that will be booted as recovery
-- A barebox script that will be started
+
+- A system that will be booted as recovery.
+- A barebox script that will be started.
 
 Scenario 3
 ##
@@ -238,21 +242,22 @@ Settings
 - ``global.bootchooser.disable_on_zero_attempts=1``
 - ``global.bootchooser.retry=1``
 - ``global.boot.default="bootchooser recovery"``
-- Userspace marks as good
+- Us

[PATCH] ubi: Only read necessary size when reading the VID header

2016-11-22 Thread Ulrich Ölmann
Based on kernel commit 8a8e8d2fdbab ("ubi: Only read necessary size when reading
the VID header") by Sascha Hauer <s.ha...@pengutronix.de>:

When reading the vid hdr from the device UBI always reads a whole
page. Instead, read only the data we actually need and speed up
attachment of UBI devices by potentially making use of reading
subpages if the NAND driver supports it.

Since the VID header may be at offset vid_hdr_shift in the page and
we can only read from the beginning of a page we have to add that
offset to the read size.

Signed-off-by: Ulrich Ölmann <u.oelm...@pengutronix.de>
---
 drivers/mtd/ubi/io.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/mtd/ubi/io.c b/drivers/mtd/ubi/io.c
index 43af4a52dff9..6d08f92ea647 100644
--- a/drivers/mtd/ubi/io.c
+++ b/drivers/mtd/ubi/io.c
@@ -711,7 +711,7 @@ int ubi_io_read_vid_hdr(struct ubi_device *ubi, int pnum,
 
p = (char *)vid_hdr - ubi->vid_hdr_shift;
read_err = ubi_io_read(ubi, p, pnum, ubi->vid_hdr_aloffset,
- ubi->vid_hdr_alsize);
+ ubi->vid_hdr_shift + UBI_VID_HDR_SIZE);
if (read_err && read_err != UBI_IO_BITFLIPS && !mtd_is_eccerr(read_err))
return read_err;
 
-- 
2.10.2


___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


[PATCH] blspec: fix typo

2016-09-27 Thread Ulrich Ölmann
Signed-off-by: Ulrich Ölmann <u.oelm...@pengutronix.de>
---
 common/blspec.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/common/blspec.c b/common/blspec.c
index 40d4546d2880..1846fa277076 100644
--- a/common/blspec.c
+++ b/common/blspec.c
@@ -348,7 +348,7 @@ out:
  * entry_is_of_compatible - check if a bootspec entry is compatible with
  *  the current machine.
  *
- * returns true is the entry is compatible, false otherwise
+ * returns true if the entry is compatible, false otherwise
  */
 static bool entry_is_of_compatible(struct blspec_entry *entry)
 {
-- 
2.9.3


___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


[PATCH] blspec: fix return value of entry_is_of_compatible()

2016-09-27 Thread Ulrich Ölmann
The function returns a boolean and not an integer. Hence the former
explicit/implicit cast of an ERR_PTR to a boolean has led to a return value of
true although a bootspec entry with a faulty devicetree is not compatible.

Signed-off-by: Ulrich Ölmann <u.oelm...@pengutronix.de>
---
 common/blspec.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/common/blspec.c b/common/blspec.c
index c205d481c911..40d4546d2880 100644
--- a/common/blspec.c
+++ b/common/blspec.c
@@ -398,7 +398,7 @@ static bool entry_is_of_compatible(struct blspec_entry 
*entry)
 
root = of_unflatten_dtb(fdt);
if (IS_ERR(root)) {
-   ret = PTR_ERR(root);
+   ret = false;
root = NULL;
goto out;
}
-- 
2.9.3


___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


[PATCH] blspec: fix erroneus free in entry_is_of_compatible()

2016-09-26 Thread Ulrich Ölmann
Whenever of_unflatten_dtb() encountered an error it already released the memory
before returning the error code. Make this apparent by setting the pointer to
NULL to avoid an erroneus free.

Signed-off-by: Ulrich Ölmann <u.oelm...@pengutronix.de>
---
 common/blspec.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/common/blspec.c b/common/blspec.c
index 66decb161ebd..c205d481c911 100644
--- a/common/blspec.c
+++ b/common/blspec.c
@@ -399,6 +399,7 @@ static bool entry_is_of_compatible(struct blspec_entry 
*entry)
root = of_unflatten_dtb(fdt);
if (IS_ERR(root)) {
ret = PTR_ERR(root);
+   root = NULL;
goto out;
}
 
-- 
2.9.3


___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


[PATCH 1/2] commands: ubiupdatevol: store return value of read() in a signed int

2016-09-05 Thread Ulrich Ölmann
Signed-off-by: Ulrich Ölmann <u.oelm...@pengutronix.de>
---
 commands/ubi.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/commands/ubi.c b/commands/ubi.c
index 65d2d256a830..dd981f95ea5d 100644
--- a/commands/ubi.c
+++ b/commands/ubi.c
@@ -14,10 +14,9 @@
 
 static int do_ubiupdatevol(int argc, char *argv[])
 {
-   int fd_img, fd_vol, ret = 0;
+   int count, fd_img, fd_vol, ret = 0;
uint64_t size = 0;
struct stat st;
-   unsigned int count;
void *buf;
 
if (argc - optind < 2)
-- 
2.8.1


___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


[PATCH 1/2] images: write checksum into barebox header

2016-05-23 Thread Ulrich Ölmann
From: Jan Luebbe <j...@pengutronix.de>

Signed-off-by: Jan Luebbe <j...@pengutronix.de>
Signed-off-by: Ulrich Ölmann <u.oelm...@pengutronix.de>
---
 images/Makefile  |   3 +-
 include/filetype.h   |   2 +
 scripts/.gitignore   |   1 +
 scripts/Makefile |   1 +
 scripts/bareboxcrc.c | 219 +++
 5 files changed, 225 insertions(+), 1 deletion(-)
 create mode 100644 scripts/bareboxcrc.c

diff --git a/images/Makefile b/images/Makefile
index da9cc8d396ee..812074e624b0 100644
--- a/images/Makefile
+++ b/images/Makefile
@@ -71,7 +71,8 @@ quiet_cmd_pblx ?= PBLX$@
   cmd_pblx ?= cat $(obj)/$(patsubst %.pblx,%.pblb,$(2)) > $@; \
  $(call size_append, $(obj)/barebox.z) >> $@; \
  cat $(obj)/barebox.z >> $@; \
- $(objtree)/scripts/fix_size -f $@
+ $(objtree)/scripts/fix_size -f $@; \
+ $(objtree)/scripts/bareboxcrc $@
 
 $(obj)/%.pblx: $(obj)/%.pblb $(obj)/barebox.z FORCE
$(call if_changed,pblx,$(@F))
diff --git a/include/filetype.h b/include/filetype.h
index e87ca174a89d..ec0e01f64f9f 100644
--- a/include/filetype.h
+++ b/include/filetype.h
@@ -51,6 +51,8 @@ enum filetype is_fat_or_mbr(const unsigned char *sector, 
unsigned long *bootsec)
 int is_fat_boot_sector(const void *_buf);
 bool filetype_is_barebox_image(enum filetype ft);
 
+#define BAREBOX_CRC_MAGIC_VALUE"crc"
+
 #define ARM_HEAD_SIZE  0x30
 #define ARM_HEAD_MAGICWORD_OFFSET  0x20
 #define ARM_HEAD_SIZE_OFFSET   0x2C
diff --git a/scripts/.gitignore b/scripts/.gitignore
index 533bffd97d36..d11ac7f97f32 100644
--- a/scripts/.gitignore
+++ b/scripts/.gitignore
@@ -2,6 +2,7 @@ bin2c
 mkimage
 fix_size
 bareboxenv
+bareboxcrc
 bareboxcrc32
 kernel-install
 bareboximd
diff --git a/scripts/Makefile b/scripts/Makefile
index a5c16b2f3133..1683d38c222d 100644
--- a/scripts/Makefile
+++ b/scripts/Makefile
@@ -8,6 +8,7 @@ hostprogs-y  += bin2c
 hostprogs-y  += mkimage
 hostprogs-y  += fix_size
 hostprogs-y  += bareboxenv
+hostprogs-y  += bareboxcrc
 hostprogs-y  += bareboxcrc32
 hostprogs-y  += kernel-install
 hostprogs-$(CONFIG_IMD)  += bareboximd
diff --git a/scripts/bareboxcrc.c b/scripts/bareboxcrc.c
new file mode 100644
index ..37cb9b0a6ce8
--- /dev/null
+++ b/scripts/bareboxcrc.c
@@ -0,0 +1,219 @@
+/*
+ * bareboxcrc.c
+ *
+ * Copyright (C) 2016 Jan Luebbe <j.lue...@pengutronix.de>
+ *
+ * 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, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#define _DEFAULT_SOURCE
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include "compiler.h"
+
+#include "../include/filetype.h"
+#include "../crypto/crc32.c"
+
+#define EX_SUCCESS 0
+#define EX_NO_CHECKSUM 1
+#define EX_CHECKSUM_FAULTY 2
+#define EX_NO_BAREBOX_HEADER   3
+#define EX_IMAGE_TOO_SMALL 4
+#define EX_IMAGE_TOO_BIG   5
+#define EX_LOCATION_OCCUPIED   6
+#define EX_OUT_OF_MEMORY   7
+#define EX_IO_ERROR8
+#define EX_WRONG_USAGE 9
+
+void usage(char *prgname)
+{
+   fprintf(stderr, "Usage : %s [OPTION] FILE\n"
+   "\n"
+   "options:\n"
+   "  -cverify checksum\n"
+   "  -fforce\n",
+   prgname);
+}
+
+int get_barebox_head_size(const char *head)
+{
+   if (!strcmp(head + ARM_HEAD_MAGICWORD_OFFSET, "barebox"))
+   return ARM_HEAD_SIZE;
+   else if (!strcmp(head + MIPS_HEAD_MAGICWORD_OFFSET, "barebox"))
+   return MIPS_HEAD_SIZE;
+
+   return 0;
+}
+
+int checksum(FILE *image, bool check, bool force, off_t size)
+{
+   void *buf = malloc(size);
+   int ret = EX_SUCCESS;
+   size_t head_size;
+   uint32_t crc = 0;
+   uint32_t *p;
+
+   if (!buf) {
+   fprintf(stderr, "malloc: out of memory\n");
+   return EX_OUT_OF_ME

[PATCH 2/2] images: add function to verify checksum in barebox header

2016-05-23 Thread Ulrich Ölmann
From: Jan Luebbe <j...@pengutronix.de>

Signed-off-by: Jan Luebbe <j...@pengutronix.de>
Signed-off-by: Ulrich Ölmann <u.oelm...@pengutronix.de>
---
 common/Kconfig |  9 ++
 common/Makefile|  1 +
 common/barebox-image.c | 85 ++
 include/common.h   |  9 ++
 4 files changed, 104 insertions(+)
 create mode 100644 common/barebox-image.c

diff --git a/common/Kconfig b/common/Kconfig
index 928db0a159e1..bebbb614509d 100644
--- a/common/Kconfig
+++ b/common/Kconfig
@@ -580,6 +580,15 @@ config IMD_TARGET
depends on IMD
depends on !SANDBOX
 
+config VERIFY_EMBEDDED_CRC
+   prompt "Verify the CRC checksum embedded into barebox images"
+   bool
+   select CRC32
+   help
+ If you say Y here, the CRC checksum that is embedded into every
+ barebox image directly after the header can be verified to guarantee
+ the integrity of the image.
+
 config KERNEL_INSTALL_TARGET
bool
depends on !SANDBOX
diff --git a/common/Makefile b/common/Makefile
index 99681e21215b..0106f0fe7bd9 100644
--- a/common/Makefile
+++ b/common/Makefile
@@ -48,6 +48,7 @@ obj-$(CONFIG_STATE)   += state.o
 obj-$(CONFIG_RATP) += ratp.o
 obj-$(CONFIG_UIMAGE)   += image.o uimage.o
 obj-$(CONFIG_FITIMAGE) += image-fit.o
+obj-$(CONFIG_VERIFY_EMBEDDED_CRC) += barebox-image.o
 obj-$(CONFIG_MENUTREE) += menutree.o
 obj-$(CONFIG_EFI_GUID) += efi-guid.o
 obj-$(CONFIG_EFI_DEVICEPATH)   += efi-devicepath.o
diff --git a/common/barebox-image.c b/common/barebox-image.c
new file mode 100644
index ..733d9ea2ecdf
--- /dev/null
+++ b/common/barebox-image.c
@@ -0,0 +1,85 @@
+/*
+ * Copyright (c) 2016 Pengutronix, Jan Luebbe <j.lue...@pengutronix.de>
+ *
+ * This program 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.
+ */
+#include 
+#include 
+#include 
+
+static inline size_t get_barebox_head_size(const void *buf)
+{
+   if (is_barebox_arm_head(buf))
+   return ARM_HEAD_SIZE;
+   else if (is_barebox_mips_head(buf))
+   return MIPS_HEAD_SIZE;
+
+   return 0;
+}
+
+static inline size_t get_barebox_head_size_offset(const void *buf)
+{
+   if (is_barebox_arm_head(buf))
+   return ARM_HEAD_SIZE_OFFSET;
+   else if (is_barebox_mips_head(buf))
+   return MIPS_HEAD_SIZE_OFFSET;
+
+   return 0;
+}
+
+bool barebox_verify_image(void *buf, size_t bufsize)
+{
+   unsigned int *psize;
+   size_t head_size;
+   uint32_t crc = 0;
+   uint32_t *p;
+
+   if (bufsize < ARM_HEAD_SIZE) {
+   pr_err("buffer is smaller than ARM_HEAD_SIZE\n");
+   return false;
+   }
+
+   head_size = get_barebox_head_size(buf);
+   if (!head_size) {
+   pr_err("image does not contain a barebox header\n");
+   return false;
+   }
+
+   psize = buf + get_barebox_head_size_offset(buf);
+
+   if (bufsize < *psize) {
+   pr_err("buffer is too small for image\n");
+   return false;
+   }
+
+   if (*psize < head_size + 2 * sizeof(uint32_t)) {
+   pr_err("image is too small\n");
+   return false;
+   }
+
+   p = buf + head_size;
+
+   if (strcmp((const char*) p, BAREBOX_CRC_MAGIC_VALUE)) {
+   pr_debug("image does not contain a checksum\n");
+   return true;
+   }
+
+   crc = crc32(crc, buf, head_size + sizeof(uint32_t));
+   crc = crc32(crc, buf + head_size + 2 * sizeof(uint32_t),
+   *psize - (head_size + 2 * sizeof(uint32_t)));
+   crc = cpu_to_be32(crc);
+
+   if (crc != *(p + 1)) {
+   pr_err("embedded checksum is faulty\n");
+   return false;
+   }
+
+   return true;
+}
diff --git a/include/common.h b/include/common.h
index 680a0affb6bc..9200328c3e10 100644
--- a/include/common.h
+++ b/include/common.h
@@ -164,4 +164,13 @@ static inline bool region_overlap(unsigned long starta, 
unsigned long lena,
return 1;
 }
 
+#ifdef CONFIG_VERIFY_EMBEDDED_CRC
+bool barebox_verify_image(void*, size_t);
+#else
+static inline bool barebox_verify_image(void *buf, size_t bufsize)
+{
+   return true;
+}
+#endif
+
 #endif /* __COMMON_H_ */
-- 
2.8.1


___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


[PATCH 0/2] evaluate integrity of a barebox image

2016-05-23 Thread Ulrich Ölmann
These two patches provide functionality to assess if a barebox image is
corrupted or not by embedding and checking a hash value. This can be of interest
if for example the image has been loaded from unreliable storage.

Jan Luebbe (2):
  images: write checksum into barebox header
  images: add function to verify checksum in barebox header

 common/Kconfig |   9 ++
 common/Makefile|   1 +
 common/barebox-image.c |  85 +++
 images/Makefile|   3 +-
 include/common.h   |   9 ++
 include/filetype.h |   2 +
 scripts/.gitignore |   1 +
 scripts/Makefile   |   1 +
 scripts/bareboxcrc.c   | 219 +
 9 files changed, 329 insertions(+), 1 deletion(-)
 create mode 100644 common/barebox-image.c
 create mode 100644 scripts/bareboxcrc.c

-- 
2.8.1


___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


[PATCH] images: Makefile.socfpga: fix typo

2016-04-26 Thread Ulrich Ölmann
Signed-off-by: Ulrich Ölmann <u.oelm...@pengutronix.de>
---
 images/Makefile.socfpga | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/images/Makefile.socfpga b/images/Makefile.socfpga
index d52b909ff354..7e642c06c995 100644
--- a/images/Makefile.socfpga
+++ b/images/Makefile.socfpga
@@ -2,7 +2,7 @@
 # barebox image generation Makefile for Altera socfpga
 #
 
-# %.socfpga - convert into socfpga image
+# %.socfpgaimg - convert into socfpga image
 # 
 quiet_cmd_socfpga_image = SOCFPGA-IMG $@
   cmd_socfpga_image = scripts/socfpga_mkimage -b -o $@ $<
-- 
2.8.0.rc3


___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


[PATCH] docs: fix typos

2016-02-03 Thread Ulrich Ölmann
Signed-off-by: Ulrich Ölmann <u.oelm...@pengutronix.de>
---
 Documentation/devicetree/bindings/barebox/barebox,state.rst | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Documentation/devicetree/bindings/barebox/barebox,state.rst 
b/Documentation/devicetree/bindings/barebox/barebox,state.rst
index d1b0627..5643edc 100644
--- a/Documentation/devicetree/bindings/barebox/barebox,state.rst
+++ b/Documentation/devicetree/bindings/barebox/barebox,state.rst
@@ -43,7 +43,7 @@ Variable nodes
 
 These are subnodes of a state node each describing a single
 variable. The node name may end with ``@``, but the suffix is
-sripped from the variable name.
+ripped from the variable name.
 
 State variables have a type. Currenty supported types are: ``uint8``,
 ``uint32``, ``enum32``, ``mac`` address or ``string``. Variable length
-- 
2.7.0.rc3


___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


[PATCH 1/2] docs: remove trailing whitespaces

2015-02-11 Thread Ulrich Ölmann
Signed-off-by: Ulrich Ölmann u.oelm...@pengutronix.de
---
 Documentation/boards/mxs.rst | 14 +++---
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/Documentation/boards/mxs.rst b/Documentation/boards/mxs.rst
index cfcd4c7..d6406e5 100644
--- a/Documentation/boards/mxs.rst
+++ b/Documentation/boards/mxs.rst
@@ -36,11 +36,11 @@ the internal PMIC and the SDRAM. The second image is 
usually the
 bootloader itself. In case of barebox the bootstream is composed
 out of the self extracting barebox image (pblx) and the prepare
 stage for setting up the SDRAM.
-
+
 The bootstream image itself is useful for USB boot, but for booting from
 SD cards or NAND a BCB header has to be prepended to the image. In case
 of SD boot the image has the .mxssd file extension in barebox.
-
+
 Since the bootstream images are encrypted they are not suitable for
 2nd stage execution. For this purpose the 2nd stage images are generated.
 
@@ -67,7 +67,7 @@ The SD images are suitable for booting from SD cards. SD 
cards need a special
 partitioning which can be created with the following fdisk sequence (using
 /dev/sdg as example)::
 
-  fdisk /dev/sdg 
+  fdisk /dev/sdg
 
   Welcome to fdisk (util-linux 2.25.1).
   Changes will remain in memory only, until you decide to write them.
@@ -83,17 +83,17 @@ partitioning which can be created with the following fdisk 
sequence (using
  e   extended (container for logical partitions)
   Select (default p): p
   Partition number (1-4, default 1): 1
-  First sector (2048-7829503, default 2048): 
+  First sector (2048-7829503, default 2048):
   Last sector, +sectors or +size{K,M,G,T,P} (2048-7829503, default 7829503): 
+1M
 
   Created a new partition 1 of type 'Linux' and of size 1 MiB.
 
-  Command (m for help): t 
+  Command (m for help): t
   Selected partition 1
   Hex code (type L to list all codes): 53
   Changed type of partition 'Linux' to 'OnTrack DM6 Aux3'.
 
-  Command (m for help): 
+  Command (m for help):
 
   Command (m for help): w
 
@@ -101,7 +101,7 @@ After writing the new partition table the image can be 
written directly to
 the partition::
 
   cat images/barebox-karo-tx28-sd.img  /dev/sdg1
- 
+
 ** NOTE **
 
 The MXS SoCs require a special partition of type 0x53 (OnTrack DM6 Aux)
-- 
2.1.4


___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


  1   2   >