[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 --- 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 ---

[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

Re: [PATCH 09/17] ARM: i.MX: boot: Move magic values into small functions

2018-04-16 Thread Andrey Smirnov
On Sat, Apr 14, 2018 at 7:24 PM, Marc Reilly wrote: > On Sunday, April 15, 2018 3:50:55 AM AEST Andrey Smirnov wrote: >> Move code to extract appropiate BOOT_CFG bits to decode booutsource on > > s/booutsource/bootsource > Fixed in v2. Thanks, Andrey Smirnov

Re: [PATCH 08/17] ARM: i.MX: boot: Remove unnecessary retruns

2018-04-16 Thread Andrey Smirnov
On Sat, Apr 14, 2018 at 7:22 PM, Marc Reilly wrote: > Nitpick: in subject s/retruns/returns > Fixed in v2. Thanks, Andrey Smirnov ___ barebox mailing list barebox@lists.infradead.org

Re: [PATCH 03/10] ARM: i.MX6: Record reset reason as a part of startup

2018-04-16 Thread Andrey Smirnov
On Mon, Apr 16, 2018 at 12:13 AM, Sascha Hauer wrote: > Hi Andrey, > > On Sat, Apr 14, 2018 at 10:50:17AM -0700, Andrey Smirnov wrote: >> Signed-off-by: Andrey Smirnov >> --- >> arch/arm/mach-imx/imx6.c | 4 +++- >>

Re: [PATCH 02/17] ARM: i.MX: Add function to extract BMOD value

2018-04-16 Thread Andrey Smirnov
On Mon, Apr 16, 2018 at 12:37 AM, Sascha Hauer wrote: > On Sat, Apr 14, 2018 at 10:50:48AM -0700, Andrey Smirnov wrote: >> The location of BMDO field in SBMR/SBMR2 registers is consistent >> across all i.MX SoCs starting from i.MX53. Add simple helper function >>

Re: [PATCH 4/4] pci: don't hide hard to understand sanity check in size calculation

2018-04-16 Thread Andrey Smirnov
On Sun, Apr 15, 2018 at 11:27 AM, Uwe Kleine-König wrote: > Hello Andrey, > > On Sat, Apr 14, 2018 at 09:25:59AM -0700, Andrey Smirnov wrote: >> On Fri, Apr 13, 2018 at 4:30 PM, Uwe Kleine-König >> wrote: >> > + /* >>

Re: [PATCH 08/10] ARM: VFxxx: Add code to detect reset reason

2018-04-16 Thread Andrey Smirnov
On Mon, Apr 16, 2018 at 12:19 AM, Sascha Hauer wrote: > On Sat, Apr 14, 2018 at 10:50:22AM -0700, Andrey Smirnov wrote: >> Signed-off-by: Andrey Smirnov >> --- >> arch/arm/mach-imx/imx.c | 78 >> +--

[PATCH v2 07/19] ARM: i.MX7: boot: Add code to handle SD/MMC manufacture mode

2018-04-16 Thread Andrey Smirnov
Signed-off-by: Andrey Smirnov --- arch/arm/mach-imx/boot.c | 40 1 file changed, 40 insertions(+) diff --git a/arch/arm/mach-imx/boot.c b/arch/arm/mach-imx/boot.c index 7c59c2181..e2696a934 100644 --- a/arch/arm/mach-imx/boot.c

[PATCH v2 00/19] i.MX bootsource bugfixes, refactoring and VFxxx support

2018-04-16 Thread Andrey Smirnov
Everyone: This patchset is the result of my work on adding support for bootsource detection of VFxxx as well as fixing a number of bugs/unsupported corner cases in similar i.MX7 specific code. NOTE: While VFxxx support is added in this series the code integrating it into the SoC initalization

[PATCH v2 01/19] ARM: i.MX: boot: Coalesce copy-pasted code

2018-04-16 Thread Andrey Smirnov
All of the instances of imx*_boot_save_loc() do exactly the same thing with the only difference being SoC-specific imx*_get_boot_source call. Convert the code into a generic function taking function pointer + a macro to take care of the boilerplate. Signed-off-by: Andrey Smirnov

[PATCH v2 02/19] include: Port linux/build_bug.h from Linux kernel

2018-04-16 Thread Andrey Smirnov
Port linux/build_bug.h needed by some of more recent kernel code. Signed-off-by: Andrey Smirnov --- include/linux/bug.h | 25 +- include/linux/build_bug.h | 83 +++ 2 files changed, 84 insertions(+), 24

[PATCH v2 08/19] ARM: i.MX7: boot: Remove incorrect NAND bootsource detection

2018-04-16 Thread Andrey Smirnov
i.MX7 differs from i.MX6 and i.MX53 and bit 7 in SBMR is not used to signify boot from NAND. Signed-off-by: Andrey Smirnov --- arch/arm/mach-imx/boot.c | 4 1 file changed, 4 deletions(-) diff --git a/arch/arm/mach-imx/boot.c b/arch/arm/mach-imx/boot.c index

[PATCH v2 09/19] ARM: i.MX7: boot: Fix SPI-NOR/QSPI boot source mixup

2018-04-16 Thread Andrey Smirnov
As per "Table 6-33. Boot device selection" from "i.MX 7Dual Applications Processor Reference Manual, Rev. 1, 01/2018" QSPI is encoded with 0b0100 and Serial ROM with 0b0110. Fix the original code to use correct values. Signed-off-by: Andrey Smirnov ---

[PATCH v2 05/19] ARM: i.MX: Simplify serial bootsource detection for i.MX6 and 7

2018-04-16 Thread Andrey Smirnov
The algorithm to detect serial mode can be shared between i.M6 and i.MX7 as wall as simplified a bit by replacing swich goto/break/return termination logic with more trivial if statements. This commit also sets the stage for additional improvements in the commits that follow. Signed-off-by:

[PATCH v2 14/19] ARM: i.MX53: boot: Move magic numbers info utility functions

2018-04-16 Thread Andrey Smirnov
Signed-off-by: Andrey Smirnov --- arch/arm/mach-imx/boot.c | 21 +++-- 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/arch/arm/mach-imx/boot.c b/arch/arm/mach-imx/boot.c index f84be5c68..799d5ec93 100644 --- a/arch/arm/mach-imx/boot.c +++

[PATCH v2 10/19] ARM: i.MX: boot: Remove unnecessary returns

2018-04-16 Thread Andrey Smirnov
Signed-off-by: Andrey Smirnov --- arch/arm/mach-imx/boot.c | 4 1 file changed, 4 deletions(-) diff --git a/arch/arm/mach-imx/boot.c b/arch/arm/mach-imx/boot.c index f9d730f6d..4bb26d942 100644 --- a/arch/arm/mach-imx/boot.c +++ b/arch/arm/mach-imx/boot.c @@

[PATCH v2 12/19] ARM: i.MX: boot: Share code to detect NAND as a boot source

2018-04-16 Thread Andrey Smirnov
Share code to detect NAND as a boot source between i.MX53 and i.MX6 which behave the same in that aspect. Signed-off-by: Andrey Smirnov --- arch/arm/mach-imx/boot.c | 10 +++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/arch/arm/mach-imx/boot.c

[PATCH v2 16/19] ARM: i.MX7: boot: Move magic numbers into utility functions

2018-04-16 Thread Andrey Smirnov
Signed-off-by: Andrey Smirnov --- arch/arm/mach-imx/boot.c | 14 -- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/arch/arm/mach-imx/boot.c b/arch/arm/mach-imx/boot.c index 60307ffb6..3f67c2510 100644 --- a/arch/arm/mach-imx/boot.c +++

[PATCH v2 19/19] ARM: i.MX6: boot: Return BOOTSOURCE_SPI_NOR, not BOOTSOURCE_SPI

2018-04-16 Thread Andrey Smirnov
We use BOOTSOURCE_SPI to denote, among other things, QSPI on i.MX7 and VFxxx, whereas on i.MX6 it is used to mean SPI-NOR. To make functions like imx_xload() work consistently across various i.MX platforms use already existent BOOTSOURCE_SPI_NOR constant to mean booting from SPI-NOR on i.MX6 as

[PATCH v2 13/19] ARM: i.MX: boot: Check for NAND boot only if necessary on i.MX53, 6

2018-04-16 Thread Andrey Smirnov
We don't need to check if the boot source is NAND in cases when we already know for a fact that we booted from something else. To avoid that, move the NAND check to be done inside of default branch of the preceeding switch statement. Signed-off-by: Andrey Smirnov ---

[PATCH v2 18/19] ARM: VFxxx: Implement code to detect bootsource

2018-04-16 Thread Andrey Smirnov
Signed-off-by: Andrey Smirnov --- arch/arm/mach-imx/boot.c | 91 arch/arm/mach-imx/include/mach/generic.h | 2 + 2 files changed, 93 insertions(+) diff --git a/arch/arm/mach-imx/boot.c b/arch/arm/mach-imx/boot.c index

[PATCH v2 17/19] bootsource: Add BOOTSOURCE_CAN

2018-04-16 Thread Andrey Smirnov
Add BOOTSOURCE_CAN for SoCs that can boot from CAN interface. Signed-off-by: Andrey Smirnov --- common/bootsource.c | 1 + include/bootsource.h | 1 + 2 files changed, 2 insertions(+) diff --git a/common/bootsource.c b/common/bootsource.c index 707b07924..78ecd8267

[PATCH v2 15/19] ARM: i.MX6: boot: Move magic numbers into utility functions

2018-04-16 Thread Andrey Smirnov
Move magic numbers and algorithm for determining Serial ROM bootsource and boot instance into utility functions. Add a comment on the logic behing the latter while at it. Signed-off-by: Andrey Smirnov --- arch/arm/mach-imx/boot.c | 67

[PATCH v2 06/19] ARM: i.MX: Account for unprogrammed fuses on i.MX6 and i.MX7

2018-04-16 Thread Andrey Smirnov
On both i.MX6 and i.MX7 (also true for VFxxx) there's an additional path that leads mask ROM to switch into serial bootloader mode. Add code to support it. Signed-off-by: Andrey Smirnov --- arch/arm/mach-imx/boot.c | 11 ++- 1 file changed, 10 insertions(+), 1

[PATCH v2 04/19] ARM: i.MX: Add a function to extract BMOD value

2018-04-16 Thread Andrey Smirnov
The location of BMDO field in SBMR/SBMR2 registers is consistent across all i.MX SoCs starting from i.MX53. Add simple helper function imx53_get_bmod and use it to avoid code duplication. Signed-off-by: Andrey Smirnov --- arch/arm/mach-imx/boot.c | 22

[PATCH v2 03/19] include: Port linux/bitfield.h from Linux kernel

2018-04-16 Thread Andrey Smirnov
Signed-off-by: Andrey Smirnov --- include/linux/bitfield.h | 152 +++ 1 file changed, 152 insertions(+) create mode 100644 include/linux/bitfield.h diff --git a/include/linux/bitfield.h b/include/linux/bitfield.h new file

[PATCH v2 11/19] ARM: i.MX: boot: Move magic values into small functions

2018-04-16 Thread Andrey Smirnov
Move code to extract appropiate BOOT_CFG bits to decode bootsource on i.MX53, 6, and 7 into small functions for clarity and to allow sharing the code between i.MX53 and i.MX6. Signed-off-by: Andrey Smirnov --- arch/arm/mach-imx/boot.c | 44

Re: [PATCH] serial/lpuart: Do not enable UART FIFO

2018-04-16 Thread Sascha Hauer
On Thu, Apr 12, 2018 at 02:41:43PM -0700, Andrey Smirnov wrote: > Using FIFO in LPUART results in subtle serial input draining issues > which are quite difficult to reproduce and troubleshoot. Since the > change offered only moderate performance gain revert the code to > operate in no-FIFO mode to

Re: [PATCH 04/10] ARM: i.MX7: Record reset reason as a part of startup

2018-04-16 Thread Sascha Hauer
On Sat, Apr 14, 2018 at 10:50:18AM -0700, Andrey Smirnov wrote: > Signed-off-by: Andrey Smirnov > --- > arch/arm/mach-imx/imx7.c | 3 +++ > arch/arm/mach-imx/include/mach/reset-reason.h | 1 + > 2 files changed, 4 insertions(+) > > diff --git

Re: [PATCH 03/10] ARM: i.MX6: Record reset reason as a part of startup

2018-04-16 Thread Sascha Hauer
Hi Andrey, On Sat, Apr 14, 2018 at 10:50:17AM -0700, Andrey Smirnov wrote: > Signed-off-by: Andrey Smirnov > --- > arch/arm/mach-imx/imx6.c | 4 +++- > arch/arm/mach-imx/include/mach/reset-reason.h | 2 ++ > 2 files changed, 5 insertions(+), 1

Re: [PATCH 08/10] ARM: VFxxx: Add code to detect reset reason

2018-04-16 Thread Sascha Hauer
On Sat, Apr 14, 2018 at 10:50:22AM -0700, Andrey Smirnov wrote: > Signed-off-by: Andrey Smirnov > --- > arch/arm/mach-imx/imx.c | 78 > +-- > arch/arm/mach-imx/include/mach/reset-reason.h | 11 > 2 files changed, 62

Re: [PATCH 4/4] clk: i.MX6: Fix enfc_sel for i.MX6dqp

2018-04-16 Thread Sascha Hauer
On Wed, Apr 11, 2018 at 03:26:54PM +0200, Sascha Hauer wrote: > The plus SoC variants have some differences in the clock controller. > For now fix the NAND controller clock. There are more differences > that might be relevant, but for now are left for a future excercise. > > Signed-off-by: Sascha

Re: [PATCH v2 0/5] Linux's serdev framwork port

2018-04-16 Thread Sascha Hauer
On Thu, Apr 12, 2018 at 02:33:12PM -0700, Andrey Smirnov wrote: > Hi everyone: > > In an effort to bring this kernel driver > https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/mfd/rave-sp.c?h=v4.16-rc7 > to Barebox, I ended up creating a miniature and extremely

Re: [PATCH] gitignore: Add *.pblx files

2018-04-16 Thread Sascha Hauer
On Thu, Apr 12, 2018 at 02:38:59PM -0700, Andrey Smirnov wrote: > Looks like *.pblx was accidentally dropped from ignored files list and > now my "git status" is clobbered by every *.pblx image that is being > built (that's quite a lot for imx_v7_defconfig). Re-add original rule > to prevent that.

Re: [PATCH 02/17] ARM: i.MX: Add function to extract BMOD value

2018-04-16 Thread Sascha Hauer
On Sat, Apr 14, 2018 at 10:50:48AM -0700, Andrey Smirnov wrote: > The location of BMDO field in SBMR/SBMR2 registers is consistent > across all i.MX SoCs starting from i.MX53. Add simple helper function > imx53_get_bmod and use it to avoid code duplication. > > Signed-off-by: Andrey Smirnov

Re: [PATCH v2 1/2] common: state: Add property to protect existing data

2018-04-16 Thread Sascha Hauer
On Thu, Apr 12, 2018 at 11:13:01AM +0200, Daniel Schultz wrote: > After an update to a newer barebox version with an enabled state > framework, existing data in storage memories could be overwritten. > > Add a new property to check in front of every write task, if the meta > magic field only

[PATCH] commands: i2c_write: enable reg == 0 too

2018-04-16 Thread Antony Pavlov
This commit fixes the mistake introduced in the commit 34fadb685905 ('commands: i2c_write: enable raw write to address'). The intended behaviour for i2c_write command is "use raw i2c write only if reg address is not defined". Before the commit 34fadb685905 reg address == 0 was acceptable. After

Re: Question about barebox*/drivers/mfd/mc34704.c and ACCURATE I²C mode ...

2018-04-16 Thread Baruch Siach
Hi Roland, On Mon, Apr 16, 2018 at 09:52:14AM +, Mainz, Roland wrote: > Two small questions about drivers/mfd/mc34704.c in the barebox codebase: > 1. mc34704 has an ACCURATE bit (I2CSET1, see > https://www.nxp.com/docs/en/data-sheet/MC34704.pdf) which requires that all > read/write commands