Re: [U-Boot] [PATCH 2/2] fs-test.sh: Update expected results

2016-11-05 Thread Stephen Warren

On 11/05/2016 06:32 PM, Stefan Brüns wrote:

After the latest changes, ext4 no longer has any fails.


Acked-by: Stephen Warren 
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 1/2] ext4: Allow reading files with non-zero offset, clamp read len

2016-11-05 Thread Stephen Warren

On 11/05/2016 06:32 PM, Stefan Brüns wrote:

Support was already implemented, but not hooked up. This fixes several
fails in the test cases.



diff --git a/fs/ext4/ext4fs.c b/fs/ext4/ext4fs.c



@@ -217,21 +217,16 @@ int ext4_read_file(const char *filename, void *buf, 
loff_t offset, loff_t len,



-   if (len == 0)
-   len = file_len;
+   if ((len == 0) || (offset + len > file_len))
+   len = (file_len - offset);


Isn't (offset + len > file_len) an error? It seems find to "read to EOF" 
if the caller specified len==0, but if they specified a specific len, 
then isn't it an error if len+offset exceeds the length of the file?


On the other hand, if this is how other filesystems work in U-Boot, it's 
fine. I suppose this is consistent with how POSIX read() works.



diff --git a/include/ext4fs.h b/include/ext4fs.h



-int ext4fs_read(char *buf, loff_t len, loff_t *actread);
+int ext4fs_read(char *buf, loff_t offset, loff_t len, loff_t *actread);


Don't you need to update all callers of this function in this patch so 
the build doesn't break?

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 2/3] test/py: Allow to pass u_boot_log instead of console for run_and_log

2016-11-05 Thread Stephen Warren

On 11/05/2016 10:45 AM, Stefan Brüns wrote:

The runner actually has no console dependency, only on the log provided
by the console. Accept both u_boot_console or a multiplexed_log.



diff --git a/test/py/u_boot_utils.py b/test/py/u_boot_utils.py



-def run_and_log(u_boot_console, cmd, ignore_errors=False):
+def run_and_log(u_boot_console_or_log, cmd, ignore_errors=False):
 """Run a command and log its output.

 Args:


I expect you also need to update the documentation for the function 
parameter in the "Args" section of the docs too.



@@ -171,7 +171,10 @@ def run_and_log(u_boot_console, cmd, ignore_errors=False):
 """
 if isinstance(cmd, str):
 cmd = cmd.split()
-runner = u_boot_console.log.get_runner(cmd[0], sys.stdout)
+try:
+runner = u_boot_console_or_log.get_runner(cmd[0], sys.stdout)
+except:
+runner = u_boot_console_or_log.log.get_runner(cmd[0], sys.stdout)


I don't like this because:

a) It duplicates the call to get_runner(), even though both calls are 
logically the same thing, just with different parameter values.


b) It can catch exceptions that occur inside get_runner(), and then 
potentially repeat that call.


Better would be:

if hasattr(u_boot_console_or_log, 'get_runner'):
get_runner = u_boot_console_or_log.get_runner
else:
get_runner = u_boot_console_or_log.log.get_runner
runner = get_runner(cmd[0], sys.stdout)

Same comment for the similar change in run_and_log_expect_exception(). 
You could perhaps even create a helper function 
get_get_runner(u_boot_console_or_log) to share the code.

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 1/3] test/py: expose config and log as session scoped fixture

2016-11-05 Thread Stephen Warren

On 11/05/2016 10:45 AM, Stefan Brüns wrote:

If a test uses a fixture which is expensive to setup, the fixture can
possibly created with session or module scope. As u_boot_console has
function scope, it can not be used in this case.


Acked-by: Stephen Warren 

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH v3 3/3] bcm2835: Reserve the spin table in efi memory map

2016-11-05 Thread Stephen Warren

On 11/02/2016 03:36 AM, Alexander Graf wrote:

Firmware provides a spin table on the raspberry pi. This table shouldn't
get overwritten by payloads, so we need to mark it as reserved.


This is probably fine for now so,
Acked-by: Stephen Warren 

However in the long term I wonder if U-Boot shouldn't find out the spin 
table address from the FW-provided DTB, then boot all CPUs into a 
spin-table implementation that's provided by U-Boot. That would avoid 
having to hard-code the address/size of the spin table code/data in 
U-Boot, which in theory at least could change to an arbitrary location 
in a future FW release.

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH v3 2/3] bcm2835 video: Map frame buffer as 32bpp

2016-11-05 Thread Stephen Warren

On 11/02/2016 03:36 AM, Alexander Graf wrote:

To enable working efifb support, let's map the frame buffer as 32bpp
instead of 16bpp.


Hmmm. I feel like there was some good reason why I picked 16bpp when I 
first wrote this, especially since I had to add 16bpp support into the 
kernel's simplefb driver specifically to support the RPI. However, I 
honestly can't remember why now. So, if you've tested this on all 3 
generations of RPi and HDMI still works on all 3,


Acked-by: Stephen Warren 
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH v3 1/3] ARM: bcm283x: Implement EFI RTS reset_system

2016-11-05 Thread Stephen Warren

On 11/02/2016 03:36 AM, Alexander Graf wrote:

The rpi has a pretty simple way of resetting the whole system. All it takes
is to poke a few registers at a well defined location in MMIO space.

This patch adds support for the EFI loader implementation to allow an OS to
reset and power off the system when we're outside of boot time.


(As an aside, I'm not sure why someone wanting EFI wouldn't just use a 
complete EFI implementation such as TianoCore.)



diff --git a/arch/arm/mach-bcm283x/reset.c b/arch/arm/mach-bcm283x/reset.c



+__efi_runtime_data struct bcm2835_wdog_regs *wdog_regs =
+   (struct bcm2835_wdog_regs *)BCM2835_WDOG_PHYSADDR;
+
+void __efi_runtime reset_cpu(ulong addr)
 {
-   struct bcm2835_wdog_regs *regs =
-   (struct bcm2835_wdog_regs *)BCM2835_WDOG_PHYSADDR;


I'm not sure why that change is required. The value of the variable is 
the same in both cases?


Perhaps it's trying to ensure that if this gets compiled into an ldr 
instruction, the referenced data value is in a linker section that's 
still around when EFI runs? If so fine, but how is that ensured for all 
the other constants that this code uses, and if that happens 
automatically due to the __efi_runtime marker above, why doesn't it work 
for this one constant?


Does U-Boot have a halt/poweroff/shutdown shell command? If so, it might 
be nice to enable it as part of this series, since the code to perform 
that operation is now present.

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 2/2] rpi: expose the firmware provided FDT blob in ${fw_fdt_addr}

2016-11-05 Thread Stephen Warren

On 11/02/2016 12:06 PM, Cédric Schieli wrote:

If the fw_boot_param saved at an early stage points to a valid FDT
blob, let's expose it in ${fw_fdt_addr}.


I'd suggest naming the variable dtb_addr not fw_fdt_addr. Both names are 
just as easy to use from custom U-Boot scripts, however certain parts of 
U-Boot (such as the extlinux.conf interpreter) automatically use the 
value stored in $fdt_addr if not DTB statement is found in 
extlinux.conf. That will make it much easier for people to actually pass 
this FW-supplied DTB to the kernel automatically.



diff --git a/board/raspberrypi/rpi/rpi.c b/board/raspberrypi/rpi/rpi.c



+/*
+ * If the firmware provided us with a valid FDT at boot time, let's expose it
+ * in ${fw_fdt_addr} so it may be passed unmodified to the kernel.
+ */
+static void set_fw_fdt_addr(void)
+{
+   char s[3 + 2 * sizeof(fw_boot_param)];
+
+   if (getenv("fw_fdt_addr"))
+   return;
+
+   if (fdt_magic(fw_boot_param) != FDT_MAGIC)
+   return;
+
+   snprintf(s, sizeof(s), "0x%X", (unsigned int)fw_boot_param);
+   setenv("fw_fdt_addr", s);


If you use setenv_hex(), that will simplify the code here.

Also, for this to work, you probably want to implement 
board_get_usable_ram_top(). Doing so will guarantee that when U-Boot 
relocates to the top of RAM, it won't over-write the FW-supplied DTB 
content. For an example (only partially tested, and that will only 
build/run on a subset of supported RPi models), see:



https://github.com/swarren/u-boot/commit/8097d58931b42e88c74c1e88819f67b2e3cfb6bf#diff-e3f2f2e4eec27fe7837b4853cb5be10bR292


___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 1/2] rpi: save firmware provided boot param for later use

2016-11-05 Thread Stephen Warren

On 11/02/2016 12:06 PM, Cédric Schieli wrote:

At U-Boot entry point, the r2 register holds the address of the
firmware provided boot param. Let's save it for further processing.



diff --git a/board/raspberrypi/rpi/lowlevel_init.S 
b/board/raspberrypi/rpi/lowlevel_init.S



+.global fw_boot_param
+fw_boot_param:
+   .word 0x


fw_dtb_pointer might be a better name; there are multiple different 
registers set up by the FW in some cases; best to be explicit about what 
kind of parameter is being saved.


See the note later about the size/alignment requirements for this value.


+/*
+ * Routine: save_boot_params (called after reset from start.S)
+ * Description: save ATAG/FDT address provided by the firmware at boot time
+ */
+
+.global save_boot_params
+save_boot_params:
+
+   /* The firmware provided ATAG/FDT address can be found in r2 */
+   str r2, fw_boot_param


For the 64-bit RPi builds, you need to save x0 not r2. The assembly 
above doesn't compile since r2 isn't a valid register (it's named x2 on 
64-bit), plus the DTB pointer is actually in x0 not x2.



+   /* Returns */
+   b   save_boot_params_ret


With these patches applied, the build of rpi_defconfig fails since the 
ARM1176 CPU startup file doesn't define that symbol.



diff --git a/include/configs/rpi.h b/include/configs/rpi.h



+#ifndef __ASSEMBLY__
+/* Firmware provided boot param */
+extern const void *fw_boot_param;
+#endif


For the rpi_3 build, a void* is a 64-bit value, yet in lowlevel_init.S, 
it's defined a a .word (32-bit) rather than a .dword (64-bit).


I'd suggest adjusting the assembly file so that fw_boot_param is either 
a .word or a .dword depending on whether the code is being built for 
32-bit or 64-bit mode. That will allow the C definition to be identical 
across all RPi builds.


Note: In the .dword case the symbol must be aligned to 8-bytes, and it 
won't hurt in the 32-bit case; see the following patch:


https://patchwork.ozlabs.org/patch/684429/
ARM: tegra: ensure nvtboot_boot_x0 alignment
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 1/2] rpi: save firmware provided boot param for later use

2016-11-05 Thread Jonathan Liu
Hi Cédric,

On 3 November 2016 at 05:06, Cédric Schieli  wrote:
> At U-Boot entry point, the r2 register holds the address of the
> firmware provided boot param. Let's save it for further processing.
>
> Signed-off-by: Cédric Schieli 
> ---
>
>  board/raspberrypi/rpi/Makefile|  1 +
>  board/raspberrypi/rpi/lowlevel_init.S | 26 ++
>  include/configs/rpi.h |  4 
>  3 files changed, 31 insertions(+)
>  create mode 100644 board/raspberrypi/rpi/lowlevel_init.S
>
> diff --git a/board/raspberrypi/rpi/Makefile b/board/raspberrypi/rpi/Makefile
> index 4ce2c98..dcb25ac 100644
> --- a/board/raspberrypi/rpi/Makefile
> +++ b/board/raspberrypi/rpi/Makefile
> @@ -5,3 +5,4 @@
>  #
>
>  obj-y  := rpi.o
> +obj-y  += lowlevel_init.o
> diff --git a/board/raspberrypi/rpi/lowlevel_init.S 
> b/board/raspberrypi/rpi/lowlevel_init.S
> new file mode 100644
> index 000..446a70b
> --- /dev/null
> +++ b/board/raspberrypi/rpi/lowlevel_init.S
> @@ -0,0 +1,26 @@
> +/*
> + * (C) Copyright 2016
> + * Cédric Schieli 
> + *
> + * SPDX-License-Identifier:GPL-2.0+
> + */
> +
> +#include 
> +
> +.global fw_boot_param
> +fw_boot_param:
> +   .word 0x
> +
> +/*
> + * Routine: save_boot_params (called after reset from start.S)
> + * Description: save ATAG/FDT address provided by the firmware at boot time
> + */
> +
> +.global save_boot_params
> +save_boot_params:
> +
> +   /* The firmware provided ATAG/FDT address can be found in r2 */
> +   str r2, fw_boot_param
> +
> +   /* Returns */
> +   b   save_boot_params_ret
> diff --git a/include/configs/rpi.h b/include/configs/rpi.h
> index 8d4ad5d..2d1e619 100644
> --- a/include/configs/rpi.h
> +++ b/include/configs/rpi.h
> @@ -208,5 +208,9 @@
> ENV_MEM_LAYOUT_SETTINGS \
> BOOTENV
>
> +#ifndef __ASSEMBLY__
> +/* Firmware provided boot param */
> +extern const void *fw_boot_param;
> +#endif
>
>  #endif
> --
> 2.7.3

I did a similar patch without noticing you already submitted this series.
The save_boot_params function can be written in C instead of assembly
and placed in rpi.c.
See https://lists.yoctoproject.org/pipermail/yocto/2016-November/032934.html
for how to write save_boot_params in C as this can simplify your
patch. It also has a U-Boot script for using the FDT provided by the
firmware, though you would need to change ${fdt_addr_r} to
${fw_fdt_addr} for it to work with your patch series.

Regards,
Jonathan
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH 2/2] fs-test.sh: Update expected results

2016-11-05 Thread Stefan Brüns
After the latest changes, ext4 no longer has any fails.

Signed-off-by: Stefan Brüns 
---
 test/fs/fs-test.sh | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/test/fs/fs-test.sh b/test/fs/fs-test.sh
index 6e71b61..b194864 100755
--- a/test/fs/fs-test.sh
+++ b/test/fs/fs-test.sh
@@ -10,13 +10,13 @@
 # Expected results are as follows:
 # EXT4 tests:
 # fs-test.sb.ext4.out: Summary: PASS: 23 FAIL: 0
-# fs-test.ext4.out: Summary: PASS: 14 FAIL: 9
-# fs-test.fs.ext4.out: Summary: PASS: 14 FAIL: 9
+# fs-test.ext4.out: Summary: PASS: 23 FAIL: 0
+# fs-test.fs.ext4.out: Summary: PASS: 23 FAIL: 0
 # FAT tests:
 # fs-test.sb.fat.out: Summary: PASS: 23 FAIL: 0
 # fs-test.fat.out: Summary: PASS: 20 FAIL: 3
 # fs-test.fs.fat.out: Summary: PASS: 20 FAIL: 3
-# Total Summary: TOTAL PASS: 114 TOTAL FAIL: 24
+# Total Summary: TOTAL PASS: 132 TOTAL FAIL: 6
 
 # pre-requisite binaries list.
 PREREQ_BINS="md5sum mkfs mount umount dd fallocate mkdir"
-- 
2.10.1

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH 1/2] ext4: Allow reading files with non-zero offset, clamp read len

2016-11-05 Thread Stefan Brüns
Support was already implemented, but not hooked up. This fixes several
fails in the test cases.

Signed-off-by: Stefan Brüns 
---
 fs/ext4/ext4fs.c | 15 +--
 include/ext4fs.h |  2 +-
 2 files changed, 6 insertions(+), 11 deletions(-)

diff --git a/fs/ext4/ext4fs.c b/fs/ext4/ext4fs.c
index 3078737..f8cf6cd 100644
--- a/fs/ext4/ext4fs.c
+++ b/fs/ext4/ext4fs.c
@@ -190,12 +190,12 @@ int ext4fs_size(const char *filename, loff_t *size)
return ext4fs_open(filename, size);
 }
 
-int ext4fs_read(char *buf, loff_t len, loff_t *actread)
+int ext4fs_read(char *buf, loff_t offset, loff_t len, loff_t *actread)
 {
if (ext4fs_root == NULL || ext4fs_file == NULL)
return 0;
 
-   return ext4fs_read_file(ext4fs_file, 0, len, buf, actread);
+   return ext4fs_read_file(ext4fs_file, offset, len, buf, actread);
 }
 
 int ext4fs_probe(struct blk_desc *fs_dev_desc,
@@ -217,21 +217,16 @@ int ext4_read_file(const char *filename, void *buf, 
loff_t offset, loff_t len,
loff_t file_len;
int ret;
 
-   if (offset != 0) {
-   printf("** Cannot support non-zero offset **\n");
-   return -1;
-   }
-
ret = ext4fs_open(filename, _len);
if (ret < 0) {
printf("** File not found %s **\n", filename);
return -1;
}
 
-   if (len == 0)
-   len = file_len;
+   if ((len == 0) || (offset + len > file_len))
+   len = (file_len - offset);
 
-   return ext4fs_read(buf, len, len_read);
+   return ext4fs_read(buf, offset, len, len_read);
 }
 
 int ext4fs_uuid(char *uuid_str)
diff --git a/include/ext4fs.h b/include/ext4fs.h
index 965cd9e..bb55639 100644
--- a/include/ext4fs.h
+++ b/include/ext4fs.h
@@ -135,7 +135,7 @@ int ext4_write_file(const char *filename, void *buf, loff_t 
offset, loff_t len,
 
 struct ext_filesystem *get_fs(void);
 int ext4fs_open(const char *filename, loff_t *len);
-int ext4fs_read(char *buf, loff_t len, loff_t *actread);
+int ext4fs_read(char *buf, loff_t offset, loff_t len, loff_t *actread);
 int ext4fs_mount(unsigned part_length);
 void ext4fs_close(void);
 void ext4fs_reinit_global(void);
-- 
2.10.1

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH 5/5] Makefile: preserve output for images that can contain HAB Blocks

2016-11-05 Thread Sven Ebenfeld
To being able to sign created binaries, we need to know the HAB Blocks
for that image. Especially for the imximage type the HAB Blocks are
only available during creation of the image. We want to preserve the
information until we get to sign the files.
In the verbose case we still get them printed out instead of writing
to log files.

Signed-off-by: Sven Ebenfeld 
---
 Makefile | 6 +-
 arch/arm/imx-common/Makefile | 3 +++
 doc/README.imx6  | 3 ++-
 scripts/Makefile.lib | 2 +-
 scripts/Makefile.spl | 2 +-
 5 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/Makefile b/Makefile
index 15151ff..37d1a7a 100644
--- a/Makefile
+++ b/Makefile
@@ -804,9 +804,11 @@ cmd_zobjcopy = $(OBJCOPY) $(OBJCOPYFLAGS) 
$(OBJCOPYFLAGS_$(@F)) $< $@
 quiet_cmd_efipayload = OBJCOPY $@
 cmd_efipayload = $(OBJCOPY) -I binary -O $(EFIPAYLOAD_BFDTARGET) -B 
$(EFIPAYLOAD_BFDARCH) $< $@
 
+MKIMAGEOUTPUT = /dev/null
+
 quiet_cmd_mkimage = MKIMAGE $@
 cmd_mkimage = $(objtree)/tools/mkimage $(MKIMAGEFLAGS_$(@F)) -d $< $@ \
-   $(if $(KBUILD_VERBOSE:1=), >/dev/null)
+   $(if $(KBUILD_VERBOSE:1=), >$(MKIMAGEOUTPUT_$(@F)))
 
 quiet_cmd_cat = CAT $@
 cmd_cat = cat $(filter-out $(PHONY), $^) > $@
@@ -928,6 +930,8 @@ MKIMAGEFLAGS_u-boot.img = -A $(ARCH) -T firmware -C none -O 
u-boot \
 MKIMAGEFLAGS_u-boot-ivt.img = -A $(ARCH) -T firmware_ivt -C none -O u-boot \
-a $(CONFIG_SYS_TEXT_BASE) -e $(CONFIG_SYS_UBOOT_START) \
-n "U-Boot $(UBOOTRELEASE) for $(BOARD) board"
+MKIMAGEOUTPUT_u-boot-ivt.img = u-boot-ivt.img.log
+CLEAN_FILES += u-boot-ivt.img.log u-boot-dtb.imx.log SPL.log u-boot.imx.log
 endif
 
 MKIMAGEFLAGS_u-boot-dtb.img = $(MKIMAGEFLAGS_u-boot.img)
diff --git a/arch/arm/imx-common/Makefile b/arch/arm/imx-common/Makefile
index 03b3c12..0bc51aa 100644
--- a/arch/arm/imx-common/Makefile
+++ b/arch/arm/imx-common/Makefile
@@ -68,6 +68,7 @@ $(IMX_CONFIG): %.cfgtmp: % FORCE
 
 MKIMAGEFLAGS_u-boot.imx = -n $(filter-out $(PLUGIN).bin $< $(PHONY),$^) -T 
imximage \
-e $(CONFIG_SYS_TEXT_BASE)
+MKIMAGEOUTPUT_u-boot.imx = u-boot.imx.log
 
 u-boot.imx: u-boot.bin $(IMX_CONFIG) $(PLUGIN).bin FORCE
$(call if_changed,mkimage)
@@ -75,6 +76,7 @@ u-boot.imx: u-boot.bin $(IMX_CONFIG) $(PLUGIN).bin FORCE
 ifeq ($(CONFIG_OF_SEPARATE),y)
 MKIMAGEFLAGS_u-boot-dtb.imx = -n $(filter-out $(PLUGIN).bin $< $(PHONY),$^) -T 
imximage \
-e $(CONFIG_SYS_TEXT_BASE)
+MKIMAGEOUTPUT_u-boot.imx = u-boot-dtb.imx.log
 
 u-boot-dtb.imx: u-boot-dtb.bin $(IMX_CONFIG) $(PLUGIN).bin FORCE
$(call if_changed,mkimage)
@@ -82,6 +84,7 @@ endif
 
 MKIMAGEFLAGS_SPL = -n $(filter-out $(PLUGIN).bin $< $(PHONY),$^) -T imximage \
-e $(CONFIG_SPL_TEXT_BASE)
+MKIMAGEOUTPUT_SPL = SPL.log
 
 SPL: spl/u-boot-spl.bin $(IMX_CONFIG) $(PLUGIN).bin FORCE
$(call if_changed,mkimage)
diff --git a/doc/README.imx6 b/doc/README.imx6
index add1d80..0e00968 100644
--- a/doc/README.imx6
+++ b/doc/README.imx6
@@ -150,7 +150,8 @@ CONFIG_SECURE_BOOT is needed to build those two binaries.
 After building, you need to create a command sequence file and use
 Freescales Code Signing Tool to sign both binaries. After creation,
 the mkimage tool outputs the required information about the HAB Blocks
-parameter for the CSF.
+parameter for the CSF. During the build, the information is preserved
+in log files named as the binaries. (SPL.log and u-boot-ivt.log).
 
 More information about the CSF and HAB can be found in the AN4581.
 https://cache.freescale.com/files/32bit/doc/app_note/AN4581.pdf
diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib
index 45a0e1d..4fc4f94 100644
--- a/scripts/Makefile.lib
+++ b/scripts/Makefile.lib
@@ -433,4 +433,4 @@ cmd_xzmisc = (cat $(filter-out FORCE,$^) | \
 # ---
 quiet_cmd_mkimage = MKIMAGE $@
 cmd_mkimage = $(objtree)/tools/mkimage $(MKIMAGEFLAGS_$(@F)) -d $< $@ \
-   $(if $(KBUILD_VERBOSE:1=), >/dev/null)
+   $(if $(KBUILD_VERBOSE:1=), >$(MKIMAGEOUTPUT_$(@F)))
diff --git a/scripts/Makefile.spl b/scripts/Makefile.spl
index e8cf9f3..6369478 100644
--- a/scripts/Makefile.spl
+++ b/scripts/Makefile.spl
@@ -124,7 +124,7 @@ LDPPFLAGS += \
 
 quiet_cmd_mkimage = MKIMAGE $@
 cmd_mkimage = $(objtree)/tools/mkimage $(MKIMAGEFLAGS_$(@F)) -d $< $@ \
-   $(if $(KBUILD_VERBOSE:1=), >/dev/null)
+   $(if $(KBUILD_VERBOSE:1=), >$(MKIMAGEOUTPUT_$(@F)))
 
 MKIMAGEFLAGS_MLO = -T omapimage -a $(CONFIG_SPL_TEXT_BASE)
 
-- 
2.7.4

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH 3/5] tools: mkimage: add firmware-ivt image type for HAB verification

2016-11-05 Thread Sven Ebenfeld
When we want to use Secure Boot with HAB from SPL over U-Boot.img,
we need to append the IVT to the image and leave space for the CSF.
Images generated as firmware_ivt can directly be signed using the
Freescale code signing tool. For creation of a CSF, mkimage outputs
the correct HAB Blocks for the image.
The changes to the usual firmware image class are quite small,
that is why I implemented that directly into the default_image.

Signed-off-by: Sven Ebenfeld 
---
 Makefile  |  9 -
 common/image.c|  6 ++
 include/image.h   |  1 +
 tools/default_image.c | 10 --
 tools/mkimage.c   | 32 
 5 files changed, 55 insertions(+), 3 deletions(-)

diff --git a/Makefile b/Makefile
index dcba7db..15151ff 100644
--- a/Makefile
+++ b/Makefile
@@ -754,7 +754,11 @@ ALL-$(CONFIG_RAMBOOT_PBL) += u-boot.pbl
 endif
 endif
 ALL-$(CONFIG_SPL) += spl/u-boot-spl.bin
+ifeq ($(CONFIG_MX6)$(CONFIG_SECURE_BOOT), yy)
+ALL-$(CONFIG_SPL_FRAMEWORK) += u-boot-ivt.img
+else
 ALL-$(CONFIG_SPL_FRAMEWORK) += u-boot.img
+endif
 ALL-$(CONFIG_TPL) += tpl/u-boot-tpl.bin
 ALL-$(CONFIG_OF_SEPARATE) += u-boot.dtb
 ifeq ($(CONFIG_SPL_FRAMEWORK),y)
@@ -921,6 +925,9 @@ else
 MKIMAGEFLAGS_u-boot.img = -A $(ARCH) -T firmware -C none -O u-boot \
-a $(CONFIG_SYS_TEXT_BASE) -e $(CONFIG_SYS_UBOOT_START) \
-n "U-Boot $(UBOOTRELEASE) for $(BOARD) board"
+MKIMAGEFLAGS_u-boot-ivt.img = -A $(ARCH) -T firmware_ivt -C none -O u-boot \
+   -a $(CONFIG_SYS_TEXT_BASE) -e $(CONFIG_SYS_UBOOT_START) \
+   -n "U-Boot $(UBOOTRELEASE) for $(BOARD) board"
 endif
 
 MKIMAGEFLAGS_u-boot-dtb.img = $(MKIMAGEFLAGS_u-boot.img)
@@ -934,7 +941,7 @@ MKIMAGEFLAGS_u-boot-spl.kwb = -n 
$(srctree)/$(CONFIG_SYS_KWD_CONFIG:"%"=%) \
 MKIMAGEFLAGS_u-boot.pbl = -n $(srctree)/$(CONFIG_SYS_FSL_PBL_RCW:"%"=%) \
-R $(srctree)/$(CONFIG_SYS_FSL_PBL_PBI:"%"=%) -T pblimage
 
-u-boot-dtb.img u-boot.img u-boot.kwb u-boot.pbl: \
+u-boot-dtb.img u-boot.img u-boot.kwb u-boot.pbl u-boot-ivt.img: \
$(if $(CONFIG_SPL_LOAD_FIT),u-boot-nodtb.bin 
dts/dt.dtb,u-boot.bin) FORCE
$(call if_changed,mkimage)
 
diff --git a/common/image.c b/common/image.c
index 0e86c13..01e1dea 100644
--- a/common/image.c
+++ b/common/image.c
@@ -165,6 +165,7 @@ static const table_entry_t uimage_type[] = {
{   IH_TYPE_ZYNQIMAGE,  "zynqimage",  "Xilinx Zynq Boot Image" },
{   IH_TYPE_ZYNQMPIMAGE, "zynqmpimage", "Xilinx ZynqMP Boot Image" 
},
{   IH_TYPE_FPGA,   "fpga",   "FPGA Image" },
+   {   IH_TYPE_FIRMWARE_IVT, "firmware_ivt", "Firmware with HABv4 IVT" 
},
{   -1, "",   "",   },
 };
 
@@ -364,6 +365,11 @@ void image_print_contents(const void *ptr)
printf("%sOffset = 0x%08lx\n", p, data);
}
}
+   } else if (image_check_type(hdr, IH_TYPE_FIRMWARE_IVT)) {
+   printf("HAB Blocks:   0x%08x   0x   0x%08x\n",
+   image_get_load(hdr) - image_get_header_size(),
+   image_get_size(hdr) + image_get_header_size()
+   - 0x1FE0);
}
 }
 
diff --git a/include/image.h b/include/image.h
index 2b1296c..14d0a3d 100644
--- a/include/image.h
+++ b/include/image.h
@@ -279,6 +279,7 @@ enum {
IH_TYPE_ZYNQMPIMAGE,/* Xilinx ZynqMP Boot Image */
IH_TYPE_FPGA,   /* FPGA Image */
IH_TYPE_VYBRIDIMAGE,/* VYBRID .vyb Image */
+   IH_TYPE_FIRMWARE_IVT,   /* Firmware Image with HABv4 IVT */
 
IH_TYPE_COUNT,  /* Number of image types */
 };
diff --git a/tools/default_image.c b/tools/default_image.c
index 6e4ae14..4e5568e 100644
--- a/tools/default_image.c
+++ b/tools/default_image.c
@@ -25,7 +25,7 @@ static image_header_t header;
 static int image_check_image_types(uint8_t type)
 {
if (((type > IH_TYPE_INVALID) && (type < IH_TYPE_FLATDT)) ||
-   (type == IH_TYPE_KERNEL_NOLOAD))
+   (type == IH_TYPE_KERNEL_NOLOAD) || (type == IH_TYPE_FIRMWARE_IVT))
return EXIT_SUCCESS;
else
return EXIT_FAILURE;
@@ -89,6 +89,7 @@ static void image_set_header(void *ptr, struct stat *sbuf, 
int ifd,
 {
uint32_t checksum;
time_t time;
+   uint32_t imagesize;
 
image_header_t * hdr = (image_header_t *)ptr;
 
@@ -98,11 +99,16 @@ static void image_set_header(void *ptr, struct stat *sbuf, 
int ifd,
sbuf->st_size - sizeof(image_header_t));
 
time = imagetool_get_source_date(params, sbuf->st_mtime);
+   if (params->type == IH_TYPE_FIRMWARE_IVT)
+   /* Add size of CSF minus IVT */
+   imagesize = sbuf->st_size - sizeof(image_header_t) + 0x1FE0;
+   else
+   imagesize = 

[U-Boot] [PATCH 2/5] arm: imx: add HAB authentication of image to SPL boot

2016-11-05 Thread Sven Ebenfeld
When using HAB as secure boot mechanism on Wandboard, the chain of
trust breaks immediately after the SPL. As this is not checking
the authenticity of the loaded image before jumping to it.

The HAB status output will not be implemented in SPL as it adds
a lot of strings that are only required in debug cases. With those
it exceeds the maximum size of the available OCRAM (69 KiB).

The SPL MISC driver support must be enabled, so that the driver can use OTP fuse
to check if HAB is enabled.

Signed-off-by: Sven Ebenfeld 
---
 arch/arm/imx-common/hab.c | 129 ++
 arch/arm/imx-common/spl.c |  25 +++
 arch/arm/imx-common/spl_sd.cfg|  10 +++
 arch/arm/include/asm/imx-common/hab.h |   2 +
 include/configs/mx6_common.h  |   3 +
 5 files changed, 110 insertions(+), 59 deletions(-)

diff --git a/arch/arm/imx-common/hab.c b/arch/arm/imx-common/hab.c
index 6731825..7449487 100644
--- a/arch/arm/imx-common/hab.c
+++ b/arch/arm/imx-common/hab.c
@@ -110,6 +110,10 @@
  * ++ + CSF_PAD_SIZE
  */
 
+static bool is_hab_enabled(void);
+
+#if !defined(CONFIG_SPL_BUILD)
+
 #define MAX_RECORD_BYTES (8*1024) /* 4 kbytes */
 
 struct record {
@@ -257,22 +261,6 @@ uint8_t hab_engines[16] = {
-1
 };
 
-bool is_hab_enabled(void)
-{
-   struct imx_sec_config_fuse_t *fuse =
-   (struct imx_sec_config_fuse_t *)_sec_config_fuse;
-   uint32_t reg;
-   int ret;
-
-   ret = fuse_read(fuse->bank, fuse->word, );
-   if (ret) {
-   puts("\nSecure boot fuse read error\n");
-   return ret;
-   }
-
-   return (reg & IS_HAB_ENABLED_BIT) == IS_HAB_ENABLED_BIT;
-}
-
 static inline uint8_t get_idx(uint8_t *list, uint8_t tgt)
 {
uint8_t idx = 0;
@@ -359,6 +347,68 @@ int get_hab_status(void)
return 0;
 }
 
+int do_hab_status(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+{
+   if ((argc != 1)) {
+   cmd_usage(cmdtp);
+   return 1;
+   }
+
+   get_hab_status();
+
+   return 0;
+}
+
+static int do_authenticate_image(cmd_tbl_t *cmdtp, int flag, int argc,
+   char * const argv[])
+{
+   ulong   addr, ivt_offset;
+   int rcode = 0;
+
+   if (argc < 3)
+   return CMD_RET_USAGE;
+
+   addr = simple_strtoul(argv[1], NULL, 16);
+   ivt_offset = simple_strtoul(argv[2], NULL, 16);
+
+   rcode = authenticate_image(addr, ivt_offset);
+
+   return rcode;
+}
+
+U_BOOT_CMD(
+   hab_status, CONFIG_SYS_MAXARGS, 1, do_hab_status,
+   "display HAB status",
+   ""
+ );
+
+U_BOOT_CMD(
+   hab_auth_img, 3, 0, do_authenticate_image,
+   "authenticate image via HAB",
+   "addr ivt_offset\n"
+   "addr - image hex address\n"
+   "ivt_offset - hex offset of IVT in the image"
+ );
+
+
+#endif /* !defined(CONFIG_SPL_BUILD) */
+
+static bool is_hab_enabled(void)
+{
+   struct imx_sec_config_fuse_t *fuse =
+   (struct imx_sec_config_fuse_t *)_sec_config_fuse;
+   uint32_t reg;
+   int ret;
+
+   ret = fuse_read(fuse->bank, fuse->word, );
+   if (ret) {
+   puts("\nSecure boot fuse read error\n");
+   return ret;
+   }
+
+   return (reg & IS_HAB_ENABLED_BIT) == IS_HAB_ENABLED_BIT;
+}
+
 uint32_t authenticate_image(uint32_t ddr_start, uint32_t image_size)
 {
uint32_t load_addr = 0;
@@ -400,7 +450,9 @@ uint32_t authenticate_image(uint32_t ddr_start, uint32_t 
image_size)
 (void *)(ddr_start + ivt_offset+IVT_SIZE),
 4, 0x10, 0);
 
+#if  !defined(CONFIG_SPL_BUILD)
get_hab_status();
+#endif
 
puts("\nCalling authenticate_image in ROM\n");
printf("\tivt_offset = 0x%x\n", ivt_offset);
@@ -449,7 +501,9 @@ uint32_t authenticate_image(uint32_t ddr_start, uint32_t 
image_size)
 
hab_caam_clock_enable(0);
 
+#if !defined(CONFIG_SPL_BUILD)
get_hab_status();
+#endif
} else {
puts("hab fuse not enabled\n");
}
@@ -459,46 +513,3 @@ uint32_t authenticate_image(uint32_t ddr_start, uint32_t 
image_size)
 
return result;
 }
-
-int do_hab_status(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
-{
-   if ((argc != 1)) {
-   cmd_usage(cmdtp);
-   return 1;
-   }
-
-   get_hab_status();
-
-   return 0;
-}
-
-static int do_authenticate_image(cmd_tbl_t *cmdtp, int flag, int argc,
-   char * const argv[])
-{
-   ulong   addr, ivt_offset;
-   int rcode = 0;
-
-   if (argc < 3)
-   return CMD_RET_USAGE;
-
-   addr = simple_strtoul(argv[1], NULL, 16);
-   ivt_offset = 

[U-Boot] [PATCH 4/5] doc: imx6: add section for secure boot with SPL

2016-11-05 Thread Sven Ebenfeld
Signed-off-by: Sven Ebenfeld 
---
 doc/README.imx6 | 48 
 1 file changed, 48 insertions(+)

diff --git a/doc/README.imx6 b/doc/README.imx6
index 73b8b0b..add1d80 100644
--- a/doc/README.imx6
+++ b/doc/README.imx6
@@ -138,3 +138,51 @@ c
 The last "c" command tells kermit (from ckermit package in most distros)
 to switch from command line mode to communication mode, and when the
 script is finished, the U-Boot prompt is shown in the same shell.
+
+3. Using Secure Boot on i.MX6 machines with SPL support
+---
+
+This version of U-Boot is able to build a signable version of the SPL
+as well as a signable version of the U-Boot image. The signature can
+be verified through High Assurance Boot (HAB).
+
+CONFIG_SECURE_BOOT is needed to build those two binaries.
+After building, you need to create a command sequence file and use
+Freescales Code Signing Tool to sign both binaries. After creation,
+the mkimage tool outputs the required information about the HAB Blocks
+parameter for the CSF.
+
+More information about the CSF and HAB can be found in the AN4581.
+https://cache.freescale.com/files/32bit/doc/app_note/AN4581.pdf
+
+We don't want to explain how to create a PKI tree or SRK table as
+this is well explained in the Application Note.
+
+Example Output of the SPL (imximage) creation:
+ Image Type:   Freescale IMX Boot Image
+ Image Ver:2 (i.MX53/6/7 compatible)
+ Mode: DCD
+ Data Size:61440 Bytes = 60.00 kB = 0.06 MB
+ Load Address: 00907420
+ Entry Point:  00908000
+ HAB Blocks:   00907400  cc00
+
+Example Output of the u-boot-ivt.img (firmware_ivt) creation:
+ Image Name:   U-Boot 2016.11-rc1-31589-g2a4411
+ Created:  Sat Nov  5 21:53:28 2016
+ Image Type:   ARM U-Boot Firmware with HABv4 IVT (uncompressed)
+ Data Size:352192 Bytes = 343.94 kB = 0.34 MB
+ Load Address: 1780
+ Entry Point:  
+ HAB Blocks:   0x177fffc0   0x   0x00054020
+
+The CST (Code Signing Tool) can be downloaded from NXP.
+# Compile CSF and create signature
+./cst --o csf-u-boot.bin < command_sequence_uboot.csf
+./cst --o csf-SPL.bin < command_sequence_spl.csf
+# Append compiled CSF to Binary
+cat SPL csf-SPL.bin > SPL-signed
+cat u-boot-ivt.img csf-u-boot.bin > u-boot-signed.img
+
+These two signed binaries can be used on an i.MX6 in closed
+configuration when the according SRK Table Hash has been flashed.
\ No newline at end of file
-- 
2.7.4

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH 0/5] arm: imx6: Enable Secure Boot (HAB) with SPL Builds

2016-11-05 Thread Sven Ebenfeld
When trying to build U-Boot for Wandboard with Secure Boot, the build fails
because it tries to compile the dekblob commands within the SPL. The dekblob
command depends on the CAAM driver, which is also not required in the SPL. 
Additionally, this blows the SPL up to a size beyond the limit of 69KiB in
i.MX6DL OCRAM. Therefore I deactivate building the commands during SPL build.

Next I implemented HAB verification before jumping to the loaded image. To
create images that are HAB compatible, I updated the mkimage tool and added some
documentation. At last I try to make the signing process easier as the output of
the mkimage tool will be preserverd within the build dir. The output contains
informationen required to correctly sign HAB images.

Sven Ebenfeld (5):
  arm: imx: remove bmode , hdmidet and dek commands from SPL
  arm: imx: add HAB authentication of image to SPL boot
  tools: mkimage: add firmware-ivt image type for HAB verification
  doc: imx6: add section for secure boot with SPL
  Makefile: preserve output for images that can contain HAB Blocks

 Makefile  |  15 +++-
 arch/arm/imx-common/Makefile  |   5 ++
 arch/arm/imx-common/hab.c | 129 ++
 arch/arm/imx-common/spl.c |  25 +++
 arch/arm/imx-common/spl_sd.cfg|  10 +++
 arch/arm/include/asm/imx-common/hab.h |   2 +
 common/image.c|   6 ++
 doc/README.imx6   |  49 +
 include/configs/mx6_common.h  |   3 +
 include/image.h   |   1 +
 scripts/Makefile.lib  |   2 +-
 scripts/Makefile.spl  |   2 +-
 tools/default_image.c |  10 ++-
 tools/mkimage.c   |  32 +
 14 files changed, 226 insertions(+), 65 deletions(-)

-- 
2.7.4

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH 1/5] arm: imx: remove bmode , hdmidet and dek commands from SPL

2016-11-05 Thread Sven Ebenfeld
These files are blowing up the SPL and should not be required
there as the SPL delivers no command console.

Signed-off-by: Sven Ebenfeld 
---
 arch/arm/imx-common/Makefile | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/arch/arm/imx-common/Makefile b/arch/arm/imx-common/Makefile
index 1873185..03b3c12 100644
--- a/arch/arm/imx-common/Makefile
+++ b/arch/arm/imx-common/Makefile
@@ -34,9 +34,11 @@ endif
 ifeq ($(SOC),$(filter $(SOC),vf610))
 obj-y += ddrmc-vf610.o
 endif
+ifneq ($(CONFIG_SPL_BUILD),y)
 obj-$(CONFIG_CMD_BMODE) += cmd_bmode.o
 obj-$(CONFIG_CMD_HDMIDETECT) += cmd_hdmidet.o
 obj-$(CONFIG_CMD_DEKBLOB) += cmd_dek.o
+endif
 
 PLUGIN = board/$(BOARDDIR)/plugin
 
-- 
2.7.4

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] cubieboard sunxi u-boot help me

2016-11-05 Thread 崔超
Hi ,
I' from China. I am studying u-boot on Cubieboard and I have a problem.
https://github.com/OSer916/u-boot.git .
My code is on the "cubieboard" branch.


When I do "make sunny_defconfig && make CROSS_COMPILE=arm-linux-gnueabihf-", 
the trouble comes out last:


arm-linux-gnueabihf-ld.bfd: BFD (GNU Binutils) 2.25.0 Linaro 2015_10 assertion 
fail 
/home/tcwg-buildslave/workspace/tcwg-make-release/label/tcwg-x86_64-ex40/target/arm-linux-gnueabihf/snapshots/binutils-gdb.git~linaro_binutils-2_25-branch/bfd/elf32-arm.c:7827
arm-linux-gnueabihf-ld.bfd: error: required section '.rel.plt' not found in the 
linker script
arm-linux-gnueabihf-ld.bfd: final link failed: Invalid operation
Makefile:1207: recipe for target 'u-boot' failed
make: *** [u-boot] Error 1


I used the compiler version is 
"gcc-linaro-5.3-2016.02-x86_64_arm-linux-gnueabihf"





Hi, thanks!
My mean is that I am porting u-boot to the Cubieboard board from stratch for 
studying the internal construction of the u-boot.
So I create a new defconfig named "sunny_defconfig".
The "diff" of the branch "cubieboard" and the "master":


https://github.com/OSer916/u-boot/commit/df3b61630806ab2fbcfdfb48aee048a076d78324


When I do "make sunny_defconfig" and "make CROSS_COMPILE=arm-linux-gnueabihf-", 
I have the trouble that " arm-linux-gnueabihf-ld.bfd: error: required section 
'.rel.plt' not found in the linker script"


Thanks!
--
OSer









 






 
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] Issues coupling am335x with VSC8601 PHY

2016-11-05 Thread Alex

Hi,

I'm trying to enable ethernet on a custom board with an am335x soc, and 
a VSC8601 connected through RGMII. The plan is to use u-boot as a first 
stage loader to load a proprietary application (called "the app"). The 
app already has its own ethernet stack and drivers, and can successfully 
do network talk.


I started with the am3355x config, and with a few trivial hacks, [1], 
[2], and [3], I was able to get the PHY recognized in u-boot. 
Auto-negotiation works correctly on 100Mbit link.
The issue is that while packets seem to get transmitted when doing DHCP 
queries (light on the switch blinks), they aren't legible. I tried 
hooking up the board to an ethernet port with static IPs, and watching 
traffic with wireshark, but did not observe any packets.


I also probed the RGMII link and it seems the TX clock is running at 10 
MHz, instead of 25MHz, when the app is running. At this point I suspect 
either a gross misconfiguration on my part, or a bug in the cpsw code.


I was hoping someone here might have an idea what to do to get ethernet 
working.


Thanks,
Alex

[1]
diff --git a/include/configs/am335x_evm.h b/include/configs/am335x_evm.h
index ec70b72..63a5b29 100644
--- a/include/configs/am335x_evm.h
+++ b/include/configs/am335x_evm.h
@@ -433,6 +433,7 @@
 #define CONFIG_PHY_SMSC
 /* Enable Atheros phy driver */
 #define CONFIG_PHY_ATHEROS
+#define CONFIG_PHY_VITESSE

 /*
  * NOR Size = 16 MiB

[2]
diff --git a/arch/arm/dts/am335x-evm.dts b/arch/arm/dts/am335x-evm.dts
index c1a53e2..153a06f 100644
--- a/arch/arm/dts/am335x-evm.dts
+++ b/arch/arm/dts/am335x-evm.dts
@@ -585,8 +585,8 @@
 };

 _emac0 {
-   phy_id = <_mdio>, <0>;
-   phy-mode = "rgmii-txid";
+   phy_id = <_mdio>, <8>;
+   phy-mode = "rgmii";
 };

 _emac1 {

[3]
diff --git a/board/ti/am335x/mux.c b/board/ti/am335x/mux.c
index 27979bd..e758429 100644
--- a/board/ti/am335x/mux.c
+++ b/board/ti/am335x/mux.c
@@ -341,7 +341,7 @@ static unsigned short 
detect_daughter_board_profile(void)

 void enable_board_pin_mux(void)
 {
/* Do board-specific muxes. */
-   if (board_is_bone()) {
+   if (0 && board_is_bone()) {
/* Beaglebone pinmux */
configure_module_pin_mux(mii1_pin_mux);
configure_module_pin_mux(mmc0_pin_mux);
@@ -352,7 +352,7 @@ void enable_board_pin_mux(void)
 #else
configure_module_pin_mux(mmc1_pin_mux);
 #endif
-   } else if (board_is_gp_evm()) {
+   } else if (1 || board_is_gp_evm()) {
/* General Purpose EVM */
unsigned short profile = detect_daughter_board_profile();
configure_module_pin_mux(rgmii1_pin_mux);
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH] travis-ci: Try harder to build all ARM targets

2016-11-05 Thread Tom Rini
The way that we have things broken down currently allows for some
combinations of vendor or CPU to not be built.  To fix this, create a
new catch-all job that excludes everything we've built elsewhere.  For
the sake of simplicity we are allowing for the possibility of some
overlap between the vendor-based jobs and the CPU-based jobs.  While
we're in here, make a failed build provide the summary of failure.

Signed-off-by: Tom Rini 
---
 .travis.yml | 47 +++
 1 file changed, 39 insertions(+), 8 deletions(-)

diff --git a/.travis.yml b/.travis.yml
index bb9325bacc33..3d7fffe0bd3e 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -78,6 +78,7 @@ script:
  tools/buildman/buildman -P ${BUILDMAN};
  ret=$?;
  if [[ $ret -ne 0 && $ret -ne 129 ]]; then
+   tools/buildman/buildman -sdeP ${BUILDMAN};
exit $ret;
  fi;
fi
@@ -96,31 +97,54 @@ matrix:
   # we need to build by vendor due to 50min time limit for builds
   # each env setting here is a dedicated build
 - env:
-- BUILDMAN="arm1136"
+- BUILDMAN="arm11"
 - env:
-- BUILDMAN="arm1176"
-- env:
-- BUILDMAN="arm720t"
+- BUILDMAN="arm7"
 - env:
 - BUILDMAN="arm920t"
 - env:
+- JOB="arm926ejs"
+  BUILDMAN="arm926ejs -x mx,siemens,atmel"
+- env:
+- BUILDMAN="arm946es"
+- env:
 - BUILDMAN="atmel -x avr32"
 - env:
 - BUILDMAN="avr32"
   TOOLCHAIN="avr32"
 - env:
-- BUILDMAN="davinci"
-- env:
 - BUILDMAN="denx"
 - env:
 - JOB="Freescale ARM"
   BUILDMAN="freescale -x powerpc,m68k"
 - env:
+- JOB="i.MX (non-Freescale)"
+  BUILDMAN="mx -x freescale"
+- env:
+- BUILDMAN="sun4i"
+- env:
+- BUILDMAN="sun5i"
+- env:
+- BUILDMAN="sun6i"
+- env:
+- BUILDMAN="sun7i"
+- env:
+- BUILDMAN="sun8i"
+- env:
+- BUILDMAN="sun9i"
+- env:
+- BUILDMAN="sun50i"
+- env:
+- JOB="Catch-all ARM"
+  BUILDMAN="arm -x 
arm11,arm7,arm9,aarch64,atmel,denx,freescale,kirkwood,siemens,tegra,uniphier,mx,sunxi,am33xx,omap3,omap4,omap5,pxa"
+- env:
 - BUILDMAN="sandbox x86"
   TOOLCHAIN="x86_64"
 - env:
 - BUILDMAN="kirkwood"
 - env:
+- BUILDMAN="pxa"
+- env:
 - BUILDMAN="m68k"
   TOOLCHAIN="m68k"
 - env:
@@ -158,11 +182,18 @@ matrix:
 - env:
 - BUILDMAN="tegra"
 - env:
-- BUILDMAN="ti"
+- JOB="am33xx"
+  BUILDMAN="am33xx -x siemens"
+- env:
+- BUILDMAN="omap3"
+- env:
+- BUILDMAN="omap4"
+- env:
+- BUILDMAN="omap5"
 - env:
 - BUILDMAN="uniphier"
 - env:
-- BUILDMAN="aarch64 -x tegra,freescale,uniphier"
+- BUILDMAN="aarch64 -x tegra,freescale,uniphier,sunxi"
   TOOLCHAIN="aarch64"
 - env:
 - BUILDMAN="sh4"
-- 
1.9.1

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH] api: Use hashtable function for API_env_enum

2016-11-05 Thread Emmanuel Vadot
Since the env is an hashtable, use the hashtable function for the API_ENV_ENUM
api call.

Signed-off-by: Emmanuel Vadot 
---
 api/api.c | 60 +++-
 1 file changed, 31 insertions(+), 29 deletions(-)

diff --git a/api/api.c b/api/api.c
index 8a1433a..c368511 100644
--- a/api/api.c
+++ b/api/api.c
@@ -495,45 +495,47 @@ static int API_env_set(va_list ap)
  */
 static int API_env_enum(va_list ap)
 {
-   int i, n;
-   char *last, **next;
+   int i, buflen;
+   char *last, **next, *s;
+   ENTRY *match, search;
+   static char *var;
 
last = (char *)va_arg(ap, unsigned long);
 
if ((next = (char **)va_arg(ap, uintptr_t)) == NULL)
return API_EINVAL;
 
-   if (last == NULL)
-   /* start over */
-   *next = ((char *)env_get_addr(0));
-   else {
-   *next = last;
-
-   for (i = 0; env_get_char(i) != '\0'; i = n + 1) {
-   for (n = i; env_get_char(n) != '\0'; ++n) {
-   if (n >= CONFIG_ENV_SIZE) {
-   /* XXX shouldn't we set *next = NULL?? 
*/
-   return 0;
-   }
-   }
-
-   if (envmatch((uchar *)last, i) < 0)
-   continue;
-
-   /* try to get next name */
-   i = n + 1;
-   if (env_get_char(i) == '\0') {
-   /* no more left */
-   *next = NULL;
-   return 0;
-   }
-
-   *next = ((char *)env_get_addr(i));
-   return 0;
+   if (last == NULL) {
+   var = NULL;
+   i = 0;
+   } else {
+   var = strdup(last);
+   s = strchr(var, '=');
+   if (s != NULL)
+   *s = 0;
+   search.key = var;
+   i = hsearch_r(search, FIND, , _htab, 0);
+   if (i == 0) {
+   i = API_EINVAL;
+   goto done;
}
}
 
+   /* match the next entry after i */
+   i = hmatch_r("", i, , _htab);
+   if (i == 0)
+   goto done;
+   buflen = strlen(match->key) + strlen(match->data) + 2;
+   var = realloc(var, buflen);
+   snprintf(var, buflen, "%s=%s", match->key, match->data);
+   *next = var;
return 0;
+
+done:
+   free(var);
+   var = NULL;
+   *next = NULL;
+   return i;
 }
 
 /*
-- 
2.9.2

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH] ext4: Fix handling of sparse files

2016-11-05 Thread Stefan Brüns
A sparse file may have regions not mapped by any extents, at the start
or at the end of the file, or anywhere between, thus not finding a
matching extent region is never an error.

Found by python filesystem tests.

Signed-off-by: Stefan Brüns 
---
 fs/ext4/ext4_common.c | 31 +++
 1 file changed, 15 insertions(+), 16 deletions(-)

diff --git a/fs/ext4/ext4_common.c b/fs/ext4/ext4_common.c
index 4248ac1..bfebe7e 100644
--- a/fs/ext4/ext4_common.c
+++ b/fs/ext4/ext4_common.c
@@ -1617,12 +1617,13 @@ long int read_allocated_block(struct ext2_inode *inode, 
int fileblock)
- get_fs()->dev_desc->log2blksz;
 
if (le32_to_cpu(inode->flags) & EXT4_EXTENTS_FL) {
+   long int startblock, endblock;
char *buf = zalloc(blksz);
if (!buf)
return -ENOMEM;
struct ext4_extent_header *ext_block;
struct ext4_extent *extent;
-   int i = -1;
+   int i;
ext_block =
ext4fs_get_extent_block(ext4fs_root, buf,
(struct ext4_extent_header *)
@@ -1636,28 +1637,26 @@ long int read_allocated_block(struct ext2_inode *inode, 
int fileblock)
 
extent = (struct ext4_extent *)(ext_block + 1);
 
-   do {
-   i++;
-   if (i >= le16_to_cpu(ext_block->eh_entries))
-   break;
-   } while (fileblock >= le32_to_cpu(extent[i].ee_block));
-   if (--i >= 0) {
-   fileblock -= le32_to_cpu(extent[i].ee_block);
-   if (fileblock >= le16_to_cpu(extent[i].ee_len)) {
+   for (i = 0; i < le16_to_cpu(ext_block->eh_entries); i++) {
+   startblock = le32_to_cpu(extent[i].ee_block);
+   endblock = startblock + le16_to_cpu(extent[i].ee_len);
+
+   if (startblock > fileblock) {
+   /* Sparse file */
free(buf);
return 0;
-   }
 
-   start = le16_to_cpu(extent[i].ee_start_hi);
-   start = (start << 32) +
+   } else if (fileblock < endblock) {
+   start = le16_to_cpu(extent[i].ee_start_hi);
+   start = (start << 32) +
le32_to_cpu(extent[i].ee_start_lo);
-   free(buf);
-   return fileblock + start;
+   free(buf);
+   return (fileblock - startblock) + start;
+   }
}
 
-   printf("Extent Error\n");
free(buf);
-   return -1;
+   return 0;
}
 
/* Direct blocks. */
-- 
2.10.1

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH] sunxi: mmc: Set CONFIG_SYS_MMC_MAX_DEVICE

2016-11-05 Thread Emmanuel Vadot
Set CONFIG_SYS_MMC_MAX_DEVICE to 4 for sunxi SoC.
This define is needed in the API code.

Signed-off-by: Emmanuel Vadot 
---
 include/configs/sunxi-common.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/include/configs/sunxi-common.h b/include/configs/sunxi-common.h
index 8363414..edb3ff7 100644
--- a/include/configs/sunxi-common.h
+++ b/include/configs/sunxi-common.h
@@ -145,6 +145,7 @@
 #define CONFIG_MMC_SUNXI_SLOT  0
 #define CONFIG_ENV_IS_IN_MMC
 #define CONFIG_SYS_MMC_ENV_DEV 0   /* first detected MMC 
controller */
+#define CONFIG_SYS_MMC_MAX_DEVICE  4
 #endif
 
 /* 64MB of malloc() pool */
-- 
2.9.2

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH v5 1/2] spl: Convert CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR to Kconfig

2016-11-05 Thread Tom Rini
On Thu, Nov 03, 2016 at 09:47:48PM +0200, Sam Protsenko wrote:
> Signed-off-by: Sam Protsenko 
[snip]
> diff --git a/configs/Chuwi_V7_CW0825_defconfig 
> b/configs/Chuwi_V7_CW0825_defconfig
> index a67038b..8507f73 100644
> --- a/configs/Chuwi_V7_CW0825_defconfig
> +++ b/configs/Chuwi_V7_CW0825_defconfig
> @@ -22,4 +22,3 @@ CONFIG_USB_MUSB_HOST=y
>  CONFIG_VIDEO_LCD_SPI_CS="PA0"
>  CONFIG_VIDEO_LCD_SPI_SCLK="PA1"
>  CONFIG_VIDEO_LCD_SPI_MOSI="PA2"
> -CONFIG_CFB_CONSOLE=y

I see similar things in other configs too.  When you use moveconfig.py
you normally do not want to use '-s'.  Or when you do, you don't want to
include those otherwise unrelated changes in your patch, just the
changes related to the options you've migrated.

-- 
Tom


signature.asc
Description: Digital signature
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH] mx6sabresd: Make Ethernet functional again

2016-11-05 Thread Stefano Babic


On 05/11/2016 17:35, Fabio Estevam wrote:
> Hi Stefano,
> 
> On Mon, Oct 24, 2016 at 10:22 AM, Fabio Estevam  wrote:
>> From: Fabio Estevam 
>>
>> Since commit ce412b79e7255770 ("drivers: net: phy: atheros: add separate
>> config for AR8031") ethernet does not work on mx6sabresd.
>>
>> This commit correctly assigns ar8031_config() as the configuration
>> function for AR8031 in the same way as done in the Linux kernel.
>>
>> However, on mx6sabresd design we need some additional configuration,
>> such as enabling the 125 MHz AR8031 output that needs to be done
>> in the board file.
>>
>> This also aligns with the same method that the kernel performs
>> the AR8031 fixup in arch/arm/mach-imx/mach-imx6q.c.
>>
>> Signed-off-by: Fabio Estevam 
> 
> This one (and the similar patch for wandboard) is a regression fix, so
> hopefully it can reach 2016.11 release.

I pick it up

Stefano
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH] tools: Makefile: improve cross_tools target usability

2016-11-05 Thread Masahiro Yamada
Hi.

2016-10-31 22:15 GMT+09:00 Stefan Müller-Klieser :
> When building the cross_tools target, HOSTCFLAGS and HOSTLDFLAGS will
> propagate to the target build. This should not happen and is easy to
> prevent.
>
> Signed-off-by: Stefan Müller-Klieser 
> ---
>  tools/Makefile | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/tools/Makefile b/tools/Makefile
> index 400588c..305336c 100644
> --- a/tools/Makefile
> +++ b/tools/Makefile
> @@ -263,6 +263,8 @@ subdir- += env
>
>  ifneq ($(CROSS_BUILD_TOOLS),)
>  HOSTCC = $(CC)
> +HOSTCFLAGS = $(CFLAGS)
> +HOSTLDFLAGS = $(LDFLAGS)


In the current U-Boot build system (= Kbuild),
CFLAGS is never set, never referenced.

For the target build, KBUILD_CFLAGS is used instead.


So, $(CFLAGS) is always empty unless your environment
explicitly sets it.
Likewise for LDFLAGS.


Did you mean

HOSTCFLAGS =
HOSTLDFLAGS =

or

HOSTCFLAGS = $(KBUILD_CFLAGS)
HOSTLDFLAGS =

?


-- 
Best Regards
Masahiro Yamada
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH 1/3] test/py: expose config and log as session scoped fixture

2016-11-05 Thread Stefan Brüns
If a test uses a fixture which is expensive to setup, the fixture can
possibly created with session or module scope. As u_boot_console has
function scope, it can not be used in this case.

Signed-off-by: Stefan Brüns 
---
 test/py/conftest.py | 26 ++
 1 file changed, 26 insertions(+)

diff --git a/test/py/conftest.py b/test/py/conftest.py
index 1f15e3e..65e1d75 100644
--- a/test/py/conftest.py
+++ b/test/py/conftest.py
@@ -298,6 +298,32 @@ def pytest_generate_tests(metafunc):
 continue
 generate_config(metafunc, fn)
 
+@pytest.fixture(scope='session')
+def u_boot_log(request):
+ """Generate the value of a test's log fixture.
+
+ Args:
+ request: The pytest request.
+
+ Returns:
+ The fixture value.
+ """
+
+ return console.log
+
+@pytest.fixture(scope='session')
+def u_boot_config(request):
+ """Generate the value of a test's u_boot_config fixture.
+
+ Args:
+ request: The pytest request.
+
+ Returns:
+ The fixture value.
+ """
+
+ return console.config
+
 @pytest.fixture(scope='function')
 def u_boot_console(request):
 """Generate the value of a test's u_boot_console fixture.
-- 
2.10.1

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH 2/3] test/py: Allow to pass u_boot_log instead of console for run_and_log

2016-11-05 Thread Stefan Brüns
The runner actually has no console dependency, only on the log provided
by the console. Accept both u_boot_console or a multiplexed_log.

Signed-off-by: Stefan Brüns 
---
 test/py/u_boot_utils.py | 10 --
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/test/py/u_boot_utils.py b/test/py/u_boot_utils.py
index 2ba4bae..c80cf07 100644
--- a/test/py/u_boot_utils.py
+++ b/test/py/u_boot_utils.py
@@ -153,7 +153,7 @@ def wait_until_file_open_fails(fn, ignore_errors):
 return
 raise Exception('File can still be opened')
 
-def run_and_log(u_boot_console, cmd, ignore_errors=False):
+def run_and_log(u_boot_console_or_log, cmd, ignore_errors=False):
 """Run a command and log its output.
 
 Args:
@@ -171,7 +171,10 @@ def run_and_log(u_boot_console, cmd, ignore_errors=False):
 """
 if isinstance(cmd, str):
 cmd = cmd.split()
-runner = u_boot_console.log.get_runner(cmd[0], sys.stdout)
+try:
+runner = u_boot_console_or_log.get_runner(cmd[0], sys.stdout)
+except:
+runner = u_boot_console_or_log.log.get_runner(cmd[0], sys.stdout)
 output = runner.run(cmd, ignore_errors=ignore_errors)
 runner.close()
 return output
@@ -189,7 +192,10 @@ def run_and_log_expect_exception(u_boot_console, cmd, 
retcode, msg):
 msg: String that should be contained within the command's output.
 """
 try:
+runner = u_boot_console.get_runner(cmd[0], sys.stdout)
+except:
 runner = u_boot_console.log.get_runner(cmd[0], sys.stdout)
+try:
 runner.run(cmd)
 except Exception as e:
 assert(retcode == runner.exit_status)
-- 
2.10.1

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH 3/3] test/py: Create tests for ext4 and fat testing on sandbox

2016-11-05 Thread Stefan Brüns
The following checks are currently implemented:
1. listing a directory
2. verifying size of a file
3. veryfying md5sum for a file region
4. reading the beginning of a file

Signed-off-by: Stefan Brüns 
---
 test/py/tests/test_fs.py | 298 +++
 1 file changed, 298 insertions(+)
 create mode 100644 test/py/tests/test_fs.py

diff --git a/test/py/tests/test_fs.py b/test/py/tests/test_fs.py
new file mode 100644
index 000..5ac91e4
--- /dev/null
+++ b/test/py/tests/test_fs.py
@@ -0,0 +1,298 @@
+# Copyright (c) 2016, Stefan Bruens 
+#
+# SPDX-License-Identifier: GPL-2.0
+
+# Test U-Boot's filesystem implementations
+
+import hashlib
+import pytest
+import os
+import random
+import re
+import u_boot_utils as util
+
+
+mkfs_opts = {
+   "fat" :'-t vfat',
+   "ext4" : '-t ext4 -F',
+}
+
+fs_commands = {
+   "fat" : {
+   'listcmd'   : 'ls',
+   'readcmd'   : 'load',
+   'sizecmd'   : 'size',
+   'writecmd'  : 'size',
+   },
+   "ext4" : {
+   'listcmd'   : 'ls',
+   'readcmd'   : 'load',
+   'sizecmd'   : 'size',
+   'writecmd'  : 'size',
+   },
+}
+
+cmd_parameters = {
+   "hostfs" : {
+   'prefix': 'host ',
+   'interface' : 'hostfs -',
+   },
+   "generic" : {
+   'prefix': '',
+   'interface' : 'host 0:0',
+   },
+}
+
+files = {
+"empty.file" : [(0, 0)],
+"1MB.file"   : [(0, 1e6)],
+"1MB.sparse.file"   : [(1e6-1, 1e6)],
+}
+# "2_5GB.sparse.file"   : [(0, 1e6), (1e9, 1e9+1e6), (2.5e9-1e6, 2.5e9)],
+
+@pytest.fixture(scope="session")
+def prereq_commands():
+from distutils.spawn import find_executable
+for command in ["mkfs", "mount", "umount"]:
+if find_executable(command) is None:
+pytest.skip('Filesystem tests, "{0}" not in PATH'.format(command))
+
+class FsImage:
+def __init__(self, fstype, imagename, mountpath):
+self.fstype = fstype
+self.imagename = imagename
+self.mountpath = mountpath
+self.md5s = {}
+with open(self.imagename, 'w') as fd:
+fd.truncate(0)
+fd.seek(3e9)
+fd.write(bytes([0]))
+
+def mkfs(self, log):
+mkfsopts = mkfs_opts.get(self.fstype)
+util.run_and_log(log,
+'mkfs {0} {1}'.format(mkfsopts, self.imagename))
+
+def create_file(self, log, filename):
+md5sums = []
+with open(self.mountpath + "/" + filename, 'w') as fd:
+for stride in files[filename]:
+length = int(stride[1] - stride[0])
+data = bytearray(random.getrandbits(8) for _ in xrange(length))
+md5 = hashlib.md5(data).hexdigest()
+md5sums.append(md5)
+log.info("{0}: write {1} bytes @ {2} : {3}".format(
+filename, int(stride[1] - stride[0]),
+int(stride[0]), md5))
+fd.seek(stride[0])
+fd.write(data);
+self.md5s[filename] = md5sums
+
+def create_files(self, log):
+with log.section("Create initial files"):
+for filename in files:
+self.create_file(log, filename)
+log.info("Created test files in {0}".format(self.mountpath))
+util.run_and_log(log, 'ls -la {0}'.format(self.mountpath))
+util.run_and_log(log, 'sync {0}'.format(self.mountpath))
+
+def mount(self, log):
+if not os.path.exists(self.mountpath):
+os.mkdir(self.mountpath)
+log.info("Mounting {0} at {1}".format(self.imagename, self.mountpath))
+if self.fstype == "ext4":
+cmd = 'sudo -n mount -o loop,rw {0} {1}'.format(self.imagename, 
self.mountpath)
+else:
+cmd = 'sudo -n mount -o loop,rw,umask=000 {0} 
{1}'.format(self.imagename, self.mountpath)
+util.run_and_log(log, cmd)
+if self.fstype == "ext4":
+cmd = 'sudo -n chmod og+rw {0}'.format(self.mountpath)
+return util.run_and_log(log, cmd)
+
+def unmount(self, log):
+log.info("Unmounting {0}".format(self.imagename))
+cmd = 'sudo -n umount -l {0}'.format(self.mountpath)
+util.run_and_log(log, cmd, ignore_errors=True)
+
+
+@pytest.fixture(scope="module", params=["fat", "ext4"])
+def fsimage(prereq_commands, u_boot_config, u_boot_log, request):
+datadir = u_boot_config.result_dir + '/'
+fstype = request.param
+imagename = datadir + "3GB." + fstype + ".img"
+mountpath = datadir + "mnt_" + fstype
+
+with u_boot_log.section('Create image {0}'.format(imagename)):
+fsimage = FsImage(fstype, imagename, mountpath)
+fsimage.mkfs(u_boot_log)
+
+yield fsimage
+fsimage.unmount(u_boot_log)
+
+@pytest.fixture(scope="module")
+def populated_image(fsimage, 

[U-Boot] [PATCH 0/3] Create python filesystem tests

2016-11-05 Thread Stefan Brüns
This is a first attempt to create filesystem tests in python. It is currently
targetting sandbox, although it should be possible to make it work with e.g.
the qemu based testruns.

First two patches are prep work, first patch is copied verbatim from a mail
from Stephen Warren.

The actual tests are in patch 3. CUrrently it is a subset of what can be tested
with the old shell script, most importantly no write tests.

The following tests are currently implemented:
1. Listing a directory and checking for a set of files
2. Verifying the size of a file
3. Verifying the md5sums of specified regions of a file
4. Reading the head of a file

3. and 4. have some overlap, but the latter will also read sparse file regions.

As the old test, some parts need root privileges to mount the image.

Stefan Brüns (3):
  test/py: expose config and log as session scoped fixture
  test/py: Allow to pass u_boot_log instead of console for run_and_log
  test/py: Create tests for ext4 and fat testing on sandbox

 test/py/conftest.py  |  26 +
 test/py/tests/test_fs.py | 298 +++
 test/py/u_boot_utils.py  |  10 +-
 3 files changed, 332 insertions(+), 2 deletions(-)
 create mode 100644 test/py/tests/test_fs.py

-- 
2.10.1

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH] mx6sabresd: Make Ethernet functional again

2016-11-05 Thread Fabio Estevam
Hi Stefano,

On Mon, Oct 24, 2016 at 10:22 AM, Fabio Estevam  wrote:
> From: Fabio Estevam 
>
> Since commit ce412b79e7255770 ("drivers: net: phy: atheros: add separate
> config for AR8031") ethernet does not work on mx6sabresd.
>
> This commit correctly assigns ar8031_config() as the configuration
> function for AR8031 in the same way as done in the Linux kernel.
>
> However, on mx6sabresd design we need some additional configuration,
> such as enabling the 125 MHz AR8031 output that needs to be done
> in the board file.
>
> This also aligns with the same method that the kernel performs
> the AR8031 fixup in arch/arm/mach-imx/mach-imx6q.c.
>
> Signed-off-by: Fabio Estevam 

This one (and the similar patch for wandboard) is a regression fix, so
hopefully it can reach 2016.11 release.

Thanks
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH v3] gpio: dwapb: Add support for port B

2016-11-05 Thread Simon Glass
On 3 November 2016 at 05:05, Phil Edworthy  wrote:
> The IP supports two ports, A and B, each providing up to 32 gpios.
> The driver already creates a 2nd gpio bank by reading the 2nd node
> from DT, so this is quite a simple change to support the 2nd bank.
>
> Signed-off-by: Phil Edworthy 
> ---
> v3:
>  Pass the bank nr to the register offset macro, to cope with
>  irregular register locations.
> v2:
>  Use an offset element in the platform data instead of if-elses.
> ---
>  drivers/gpio/dwapb_gpio.c | 20 ++--
>  1 file changed, 10 insertions(+), 10 deletions(-)

Reviewed-by: Simon Glass 
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH] mkimage: Allow including a ramdisk in FIT auto mode

2016-11-05 Thread Simon Glass
On 4 November 2016 at 07:22, Tomeu Vizoso  wrote:
> Adds -i option that allows specifying a ramdisk file to be added to the
> FIT image when we are using the automatic FIT mode (no ITS file).
>
> This makes adding Depthcharge support to LAVA much more convenient, as
> no additional configuration files need to be kept around in the machine
> that dispatches jobs to the boards.
>
> Signed-off-by: Tomeu Vizoso 
> Cc: Simon Glass 
> Cc: Matt Hart 
> Cc: Neil Williams 
> ---
>  doc/mkimage.1 |  4 
>  tools/fit_image.c | 33 -
>  tools/imagetool.h |  1 +
>  tools/mkimage.c   | 10 +++---
>  4 files changed, 44 insertions(+), 4 deletions(-)

Reviewed-by: Simon Glass 
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [RFC PATCH 02/10] Makefile: use "arm64" architecture for U-Boot image files

2016-11-05 Thread Simon Glass
On 2 November 2016 at 19:36, Andre Przywara  wrote:
> At the moment we use the arch/arm directory for arm64 boards as well,
> so the Makefile will pick up the "arm" name for the architecture to use
> for tagging binaries in U-Boot image files.
> Differentiate between the two by looking at the CPU variable being defined
> to "armv8", and use the arm64 architecture name on creating the image
> file if that matches.
>
> Signed-off-by: Andre Przywara 
> ---
>  Makefile | 9 +++--
>  1 file changed, 7 insertions(+), 2 deletions(-)

Reviewed-by: Simon Glass 
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH v9 19/21] cmd: Add mtd command support

2016-11-05 Thread Simon Glass
On 30 October 2016 at 12:23, Jagan Teki  wrote:
> cmd/mtd.c is a generic command to access all low level
> MTD devices, like SPI-NOR, Parallel NOR and NAND.
>
> This is implemented based on u-boot driver model, so any
> new driver added for using this command must follow dm principles.
>
> Signed-off-by: Jagan Teki 
> ---
>  cmd/Kconfig  |   6 +
>  cmd/Makefile |   1 +
>  cmd/mtd.c| 285 
> +++
>  drivers/mtd/Makefile |   2 +-
>  drivers/mtd/mtd-uclass.c |  17 +++
>  include/mtd.h|   9 ++
>  6 files changed, 319 insertions(+), 1 deletion(-)
>  create mode 100644 cmd/mtd.c

Reviewed-by: Simon Glass 
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [RFC PATCH 09/10] sunxi: introduce RMR switch to enter payloads in 64-bit mode

2016-11-05 Thread Simon Glass
Hi Andre,

On 2 November 2016 at 19:36, Andre Przywara  wrote:
> The ARMv8 capable Allwinner A64 SoC comes out of reset in AArch32 mode.
> To run AArch64 code, we have to trigger a warm reset via the RMR register,
> which proceeds with code execution at the address stored in the RVBAR
> register.
> If the bootable payload in the FIT image is using a different
> architecture than the SPL has been compiled for, enter it via this said
> RMR switch mechanism, by writing the entry point address into the MMIO
> mapped, writable version of the RVBAR register.
> Then the warm reset is triggered via a system register write.
> If the payload architecture is the same as the SPL, we use the normal
> branch as usual.
>
> Signed-off-by: Andre Przywara 
> ---
>  arch/arm/lib/spl.c   | 14 ++

I think the changes to this file should go in a separate patch as they
are generic to ARM.

>  arch/arm/mach-sunxi/Makefile |  1 +
>  arch/arm/mach-sunxi/spl_switch.c | 60 
> 
>  3 files changed, 75 insertions(+)
>  create mode 100644 arch/arm/mach-sunxi/spl_switch.c
[...]

Regards,
Simon
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [RFC PATCH 08/10] SPL: read and store arch property from U-Boot image

2016-11-05 Thread Simon Glass
Hi Andre,

On 2 November 2016 at 19:36, Andre Przywara  wrote:
> Read the specified "arch" value from a legacy or FIT U-Boot image and
> store it in our SPL data structure.
> This allows loaders to take the target architecture in account for
> custom loading procedures.
> Having the complete string -> arch mapping for FIT based images in the
> SPL would be too big, so we leave it up to architectures (or boards) to
> overwrite the weak function that does the actual translation, possibly
> covering only the required subset there.
>
> Signed-off-by: Andre Przywara 
> ---
>  common/spl/spl.c | 1 +
>  common/spl/spl_fit.c | 8 
>  include/spl.h| 3 ++-
>  3 files changed, 11 insertions(+), 1 deletion(-)
>

Reviewed-by: Simon Glass 

> diff --git a/common/spl/spl.c b/common/spl/spl.c
> index bdb165a..f76ddd2 100644
> --- a/common/spl/spl.c
> +++ b/common/spl/spl.c
> @@ -114,6 +114,7 @@ int spl_parse_image_header(struct spl_image_info 
> *spl_image,
> header_size;
> }
> spl_image->os = image_get_os(header);
> +   spl_image->arch = image_get_arch(header);
> spl_image->name = image_get_name(header);
> debug("spl: payload image: %.*s load addr: 0x%x size: %d\n",
> (int)sizeof(spl_image->name), spl_image->name,
> diff --git a/common/spl/spl_fit.c b/common/spl/spl_fit.c
> index aae556f..a5d903b 100644
> --- a/common/spl/spl_fit.c
> +++ b/common/spl/spl_fit.c
> @@ -123,6 +123,11 @@ static int get_aligned_image_size(struct spl_load_info 
> *info, int data_size,
> return (data_size + info->bl_len - 1) / info->bl_len;
>  }
>
> +__weak u8 spl_genimg_get_arch_id(const char *arch_str)
> +{
> +   return IH_ARCH_DEFAULT;
> +}
> +

Do we need this weak function, or could we just add a normal function
in the ARM code somewhere?

If you don't think we need much error checking you could do something like:

#ifdef CONFIG_ARM
... possible strcmp() here
return IH_ARCH_ARM;
#endif

>  int spl_load_simple_fit(struct spl_image_info *spl_image,
> struct spl_load_info *info, ulong sector, void *fit)
>  {
> @@ -136,6 +141,7 @@ int spl_load_simple_fit(struct spl_image_info *spl_image,
> int base_offset, align_len = ARCH_DMA_MINALIGN - 1;
> int src_sector;
> void *dst, *src;
> +   const char *arch_str;
>
> /*
>  * Figure out where the external images start. This is the base for 
> the
> @@ -184,10 +190,12 @@ int spl_load_simple_fit(struct spl_image_info 
> *spl_image,
> data_offset = fdt_getprop_u32(fit, node, "data-offset");
> data_size = fdt_getprop_u32(fit, node, "data-size");
> load = fdt_getprop_u32(fit, node, "load");
> +   arch_str = fdt_getprop(fit, node, "arch", NULL);
> debug("data_offset=%x, data_size=%x\n", data_offset, data_size);
> spl_image->load_addr = load;
> spl_image->entry_point = load;
> spl_image->os = IH_OS_U_BOOT;
> +   spl_image->arch = spl_genimg_get_arch_id(arch_str);
>
> /*
>  * Work out where to place the image. We read it so that the first
> diff --git a/include/spl.h b/include/spl.h
> index e080a82..6a9d2fb 100644
> --- a/include/spl.h
> +++ b/include/spl.h
> @@ -22,11 +22,12 @@
>
>  struct spl_image_info {
> const char *name;
> -   u8 os;
> u32 load_addr;
> u32 entry_point;
> u32 size;
> u32 flags;
> +   u8 os;
> +   u8 arch;

Can you please add a struct comment?

>  };
>
>  /*
> --
> 2.8.2
>

Regards,
Simon
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH v5 21/21] sf: dataflash: Minor cleanups

2016-11-05 Thread Simon Glass
On 30 October 2016 at 11:46, Jagan Teki  wrote:
> - fix single line comments
> - remove unneeded spaces
> - ascending order of include files
> - rename SPI DATAFLASH to dataflash
> - rename SPI DataFlash to dataflash
> - return NULL replaced with error code
>
> Cc: Bin Meng 
> Cc: Simon Glass 
> Cc: York Sun 
> Signed-off-by: Jagan Teki 
> ---
>  drivers/mtd/spi/sf_dataflash.c | 38 +++---
>  1 file changed, 15 insertions(+), 23 deletions(-)

Reviewed-by: Simon Glass 
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH v9 17/21] dm: mtd: Add uclass_driver.flags

2016-11-05 Thread Simon Glass
On 30 October 2016 at 12:23, Jagan Teki  wrote:
> Add flags for mtd-uclass driver.
>
> Signed-off-by: Jagan Teki 
> ---
>  drivers/mtd/mtd-uclass.c | 1 +
>  1 file changed, 1 insertion(+)

Reviewed-by: Simon Glass 
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH v9 18/21] dm: mtd: Add post_bind

2016-11-05 Thread Simon Glass
On 30 October 2016 at 12:23, Jagan Teki  wrote:
> Add .post_bind on mtd-uclass driver
>
> Signed-off-by: Jagan Teki 
> ---
>  drivers/mtd/mtd-uclass.c | 3 +++
>  1 file changed, 3 insertions(+)

Reviewed-by: Simon Glass 
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH] buildman: Fix building based on 'options' field

2016-11-05 Thread Simon Glass
On 4 November 2016 at 20:59, Tom Rini  wrote:
> The README for buildman says that we can use any field in boards.cfg to
> decide what to build.  However, we were not saving the options field
> correctly.
>
> Cc: Simon Glass 
> Signed-off-by: Tom Rini 
> ---
>  tools/buildman/board.py | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)

Acked-by: Simon Glass 
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH v9 13/21] mtd: spi-nor: Kconfig: Add MTD_M25P80 entry

2016-11-05 Thread Simon Glass
On 30 October 2016 at 12:23, Jagan Teki  wrote:
> Add CONFIG_MTD_M25P80 kconfig entry
>
> Signed-off-by: Jagan Teki 
> ---
>  drivers/mtd/spi-nor/Kconfig | 17 +
>  1 file changed, 17 insertions(+)

Reviewed-by: Simon Glass 
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH v9 02/21] mtd: Add SPI-NOR core support

2016-11-05 Thread Simon Glass
Hi Jagan,

On 30 October 2016 at 12:23, Jagan Teki  wrote:
> Some of the SPI device drivers at drivers/spi not a real
> spi controllers, Unlike normal/generic SPI controllers they
> operates only with SPI-NOR flash devices. these were technically
> termed as SPI-NOR controllers, Ex: drivers/spi/fsl_qspi.c
>
> The problem with these were resides at drivers/spi is entire
> SPI layer becomes SPI-NOR flash oriented which is absolutely
> a wrong indication where SPI layer getting effected more with
> flash operations - So this SPI-NOR core will resolve this issue
> by separating all SPI-NOR flash operations from spi layer and
> creats a generic layer called SPI-NOR core which can be used to
> interact SPI-NOR to SPI driver interface layer and the SPI-NOR
> controller driver. The idea is taken from Linux spi-nor framework.
>
> --
> cmd_sf.c
> --
> mtd-uclass
> ---
> SPI-NOR Core
> ---
> m25p80.czynq_qspi
> ---
> spi-uclass  SPI NOR chip
> ---
> spi drivers
> ---
> SPI NOR chip
> ---
>
> Signed-off-by: Jagan Teki 
> ---
>  Makefile  |   1 +
>  drivers/mtd/spi-nor/Makefile  |   9 +
>  drivers/mtd/spi-nor/spi-nor-ids.c | 176 +++
>  drivers/mtd/spi-nor/spi-nor.c | 648 
> ++
>  include/linux/err.h   |   5 +
>  include/linux/mtd/spi-nor.h   | 207 
>  6 files changed, 1046 insertions(+)
>  create mode 100644 drivers/mtd/spi-nor/Makefile
>  create mode 100644 drivers/mtd/spi-nor/spi-nor-ids.c
>  create mode 100644 drivers/mtd/spi-nor/spi-nor.c
>  create mode 100644 include/linux/mtd/spi-nor.h
>
[...]

> diff --git a/include/linux/mtd/spi-nor.h b/include/linux/mtd/spi-nor.h
> new file mode 100644
> index 000..4e5b3ba
> --- /dev/null
> +++ b/include/linux/mtd/spi-nor.h
> @@ -0,0 +1,207 @@
> +/*
> + * SPI NOR Core header file.
> + *
> + * Copyright (C) 2016 Jagan Teki 
> + *
> + * SPDX-License-Identifier:GPL-2.0+
> + */
> +
> +#ifndef __MTD_SPI_NOR_H
> +#define __MTD_SPI_NOR_H
> +
> +#include 
> +
> +/*
> + * Manufacturer IDs
> + *
> + * The first byte returned from the flash after sending opcode 
> SPINOR_OP_RDID.
> + * Sometimes these are the same as CFI IDs, but sometimes they aren't.
> + */
> +#define SNOR_MFR_ATMEL 0x1f
> +#define SNOR_MFR_MACRONIX  0xc2
> +#define SNOR_MFR_MICRON0x20/* ST Micro <--> Micron */
> +#define SNOR_MFR_SPANSION  0x01
> +#define SNOR_MFR_SST   0xbf
> +#define SNOR_MFR_WINBOND   0xef
> +
> +/**
> + * SPI NOR opcodes.
> + *
> + * Note on opcode nomenclature: some opcodes have a format like
> + * SNOR_OP_FUNCTION{4,}_x_y_z. The numbers x, y, and z stand for the number
> + * of I/O lines used for the opcode, address, and data (respectively). The
> + * FUNCTION has an optional suffix of '4', to represent an opcode which
> + * requires a 4-byte (32-bit) address.
> + */
> +#define SNOR_OP_WRDI   0x04/* Write disable */
> +#define SNOR_OP_WREN   0x06/* Write enable */
> +#define SNOR_OP_RDSR   0x05/* Read status register */
> +#define SNOR_OP_WRSR   0x01/* Write status register 1 byte */
> +#define SNOR_OP_READ   0x03/* Read data bytes (low frequency) */
> +#define SNOR_OP_READ_FAST  0x0b/* Read data bytes (high frequency) */
> +#define SNOR_OP_READ_1_1_2 0x3b/* Read data bytes (Dual SPI) */
> +#define SNOR_OP_READ_1_1_2_IO  0xbb/* Read data bytes (Dual IO SPI) */
> +#define SNOR_OP_READ_1_1_4 0x6b/* Read data bytes (Quad SPI) */
> +#define SNOR_OP_READ_1_1_4_IO  0xeb/* Read data bytes (Quad IO SPI) */
> +#define SNOR_OP_BRWR   0x17/* Bank register write */
> +#define SNOR_OP_BRRD   0x16/* Bank register read */
> +#define SNOR_OP_WREAR  0xC5/* Write extended address register */
> +#define SNOR_OP_RDEAR  0xC8/* Read extended address register */
> +#define SNOR_OP_PP 0x02/* Page program (up to 256 bytes) */
> +#define SNOR_OP_QPP0x32/* Quad Page program */
> +#define SNOR_OP_BE_4K  0x20/* Erase 4KiB block */
> +#define SNOR_OP_BE_4K_PMC  0xd7/* Erase 4KiB block on PMC chips */
> +#define SNOR_OP_BE_32K 0x52/* Erase 32KiB block */
> +#define SPINOR_OP_CHIP_ERASE   0xc7/* Erase whole flash chip */
> +#define SNOR_OP_SE 0xd8/* Sector erase (usually 64KiB) */
> +#define SNOR_OP_RDID   0x9f/* Read JEDEC ID */
> +#define SNOR_OP_RDCR   0x35/* Read configuration register */
> +#define SNOR_OP_RDFSR  0x70/* Read flag status register */
> +
> +/* Used for SST flashes only. */
> 

Re: [U-Boot] [PATCH v9 12/21] mtd: spi-nor: Add m25p80 driver

2016-11-05 Thread Simon Glass
Hi Jagan,

On 30 October 2016 at 12:23, Jagan Teki  wrote:
> This is MTD SPI-NOR driver for ST M25Pxx (and similar)
> serial flash chips which is written as MTD_UCLASS.
>
> Signed-off-by: Jagan Teki 
> ---
>  drivers/mtd/spi-nor/Makefile |   3 +
>  drivers/mtd/spi-nor/m25p80.c | 217 
> +++
>  2 files changed, 220 insertions(+)
>  create mode 100644 drivers/mtd/spi-nor/m25p80.c
>
> diff --git a/drivers/mtd/spi-nor/Makefile b/drivers/mtd/spi-nor/Makefile
> index 15e43ea..d11ccf4 100644
> --- a/drivers/mtd/spi-nor/Makefile
> +++ b/drivers/mtd/spi-nor/Makefile
> @@ -7,3 +7,6 @@
>  ifdef CONFIG_MTD_SPI_NOR
>  obj-y  += spi-nor.o spi-nor-ids.o
>  endif
> +
> +## spi-nor to spi interface driver
> +obj-$(CONFIG_MTD_M25P80)   += m25p80.o
> diff --git a/drivers/mtd/spi-nor/m25p80.c b/drivers/mtd/spi-nor/m25p80.c
> new file mode 100644
> index 000..740d3f6
> --- /dev/null
> +++ b/drivers/mtd/spi-nor/m25p80.c

[...]

> +static const struct udevice_id m25p_ids[] = {
> +   /*
> +* Generic compatibility for SPI NOR that can be identified by the
> +* JEDEC READ ID opcode (0x9F). Use this, if possible.
> +*/
> +   { .compatible = "jedec,spi-nor" },
> +   { }
> +};
> +
> +U_BOOT_DRIVER(m25p80) = {
> +   .name   = "m25p80",
> +   .id = UCLASS_MTD,
> +   .of_match   = m25p_ids,
> +   .probe  = m25p_probe,
> +   .priv_auto_alloc_size = sizeof(struct m25p),

Should this not have some MTD operations from the UCLASS_MTD? i.e.
struct dm_mtd_ops?

> +};
> --
> 2.7.4
>

Regards,
Simon
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH v9 11/21] spi: Add spi_write_then_read

2016-11-05 Thread Simon Glass
On 30 October 2016 at 12:23, Jagan Teki  wrote:
> Add support for SPI synchronous write followed by read,
> this is common interface call from spi-nor to spi drivers.
>
> Signed-off-by: Jagan Teki 
> ---
>  drivers/spi/spi-uclass.c | 24 
>  include/spi.h| 20 
>  2 files changed, 44 insertions(+)

Reviewed-by: Simon Glass 
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH v9 06/21] mtd: spi-nor: Kconfig: Add SPI_NOR_MACRONIX entry

2016-11-05 Thread Simon Glass
On 30 October 2016 at 12:23, Jagan Teki  wrote:
> Added CONFIG_SPI_NOR_MACRONIX kconfig entry
>
> Signed-off-by: Jagan Teki 
> ---
>  drivers/mtd/spi-nor/Kconfig | 5 +
>  1 file changed, 5 insertions(+)

Reviewed-by: Simon Glass 
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH v9 07/21] mtd: spi-nor: Kconfig: Add SPI_NOR_SPANSION entry

2016-11-05 Thread Simon Glass
On 30 October 2016 at 12:23, Jagan Teki  wrote:
> Added CONFIG_SPI_NOR_SPANSION kconfig entry
>
> Signed-off-by: Jagan Teki 
> ---
>  drivers/mtd/spi-nor/Kconfig | 5 +
>  1 file changed, 5 insertions(+)

Reviewed-by: Simon Glass 
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH v9 08/21] mtd: spi-nor: Kconfig: Add SPI_NOR_STMICRO entry

2016-11-05 Thread Simon Glass
On 30 October 2016 at 12:23, Jagan Teki  wrote:
> Added CONFIG_SPI_NOR_STMICRO kconfig entry
>
> Signed-off-by: Jagan Teki 
> ---
>  drivers/mtd/spi-nor/Kconfig | 5 +
>  1 file changed, 5 insertions(+)

Reviewed-by: Simon Glass 
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH v9 10/21] mtd: spi-nor: Kconfig: Add SPI_NOR_WINBOND entry

2016-11-05 Thread Simon Glass
On 30 October 2016 at 12:23, Jagan Teki  wrote:
> Added CONFIG_SPI_NOR_WINBOND kconfig entry
>
> Signed-off-by: Jagan Teki 
> ---
>  drivers/mtd/spi-nor/Kconfig | 5 +
>  1 file changed, 5 insertions(+)

Reviewed-by: Simon Glass 
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH v9 09/21] mtd: spi-nor: Kconfig: Add SPI_NOR_SST entry

2016-11-05 Thread Simon Glass
On 30 October 2016 at 12:23, Jagan Teki  wrote:
> Added CONFIG_SPI_NOR_SST kconfig entry
>
> Signed-off-by: Jagan Teki 
> ---
>  drivers/mtd/spi-nor/Kconfig | 5 +
>  1 file changed, 5 insertions(+)

Reviewed-by: Simon Glass 
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH v9 05/21] mtd: spi-nor: Kconfig: Add SPI_NOR_MISC entry

2016-11-05 Thread Simon Glass
On 30 October 2016 at 12:23, Jagan Teki  wrote:
> Added CONFIG_SPI_NOR_MISC kconfig entry
>
> Signed-off-by: Jagan Teki 
> ---
>  drivers/mtd/spi-nor/Kconfig | 6 ++
>  1 file changed, 6 insertions(+)

Reviewed-by: Simon Glass 
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH v9 03/21] mtd: spi-nor: Kconfig: Add MTD_SPI_NOR entry

2016-11-05 Thread Simon Glass
On 30 October 2016 at 12:23, Jagan Teki  wrote:
> Added CONFIG_MTD_SPI_NOR kconfig entry
>
> Signed-off-by: Jagan Teki 
> ---
>  drivers/mtd/Kconfig |  2 ++
>  drivers/mtd/spi-nor/Kconfig | 14 ++
>  2 files changed, 16 insertions(+)
>  create mode 100644 drivers/mtd/spi-nor/Kconfig

Reviewed-by: Simon Glass 
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH v9 04/21] mtd: spi-nor: Kconfig: Add MTD_SPI_NOR_USE_4K_SECTORS

2016-11-05 Thread Simon Glass
On 30 October 2016 at 12:23, Jagan Teki  wrote:
> Added CONFIG_MTD_SPI_NOR_USE_4K_SECTORS kconfig entry
>
> Signed-off-by: Jagan Teki 
> ---
>  drivers/mtd/spi-nor/Kconfig | 18 ++
>  1 file changed, 18 insertions(+)

Reviewed-by: Simon Glass 
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH v5 20/21] sf: dataflash: Fix add_dataflash return logic

2016-11-05 Thread Simon Glass
On 30 October 2016 at 11:46, Jagan Teki  wrote:
> This patch fixed the add_dataflash return logic,
> so-that it can handle both jedec and older chips
> same as Linux.
>
> Cc: Bin Meng 
> Cc: Simon Glass 
> Cc: York Sun 
> Signed-off-by: Jagan Teki 
> ---
>  drivers/mtd/spi/sf_dataflash.c | 127 
> -
>  1 file changed, 61 insertions(+), 66 deletions(-)

Reviewed-by: Simon Glass 
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH v5 18/21] sf: dataflash: Remove unneeded spi data

2016-11-05 Thread Simon Glass
Hi Jagan,

On 30 October 2016 at 11:46, Jagan Teki  wrote:
> dataflash doesn't require options, memory_map from spi.
>
> Cc: Bin Meng 
> Cc: Simon Glass 
> Cc: York Sun 
> Signed-off-by: Jagan Teki 
> ---
>  drivers/mtd/spi/sf_dataflash.c | 6 +-
>  1 file changed, 1 insertion(+), 5 deletions(-)
>

Reviewed-by: Simon Glass 
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH v5 19/21] sf: dataflash: Move flash id detection into jedec_probe

2016-11-05 Thread Simon Glass
On 30 October 2016 at 11:46, Jagan Teki  wrote:
> Flash id detection should be the first step to enumerate
> the connected flash on the board, once ie done checking
> with respective id codes locally in the driver all this
> should be part of jedec_probe instead of id detection and
> validated through flash_info{} table separatly.
>
> Cc: Bin Meng 
> Cc: Simon Glass 
> Cc: York Sun 
> Signed-off-by: Jagan Teki 
> ---
>  drivers/mtd/spi/sf_dataflash.c | 19 ++-
>  1 file changed, 10 insertions(+), 9 deletions(-)

Reviewed-by: Simon Glass 
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH v5 17/21] spi: Remove dual flash code

2016-11-05 Thread Simon Glass
Hi Jagan,

On 30 October 2016 at 11:46, Jagan Teki  wrote:
> Dual flash code in spi are usually take the spi controller
> to work with dual connected flash devices. Usually these
> dual connection operation's are referred to flash controller
> protocol rather with spi controller protocol, these are still
> present in flash side for the usage of spi-nor controllers.

That seems like good background information.

But after that you should write what this patch does. It seems like we
are missing the purpose of this patch, or are left to infer it.

>
> Cc: Simon Glass 
> Cc: Bin Meng 
> Cc: York Sun 
> Cc: Vignesh R 
> Cc: Mugunthan V N 
> Cc: Michal Simek 
> Cc: Siva Durga Prasad Paladugu 
> Signed-off-by: Jagan Teki 
> ---
>  drivers/mtd/spi/sf.c| 4 
>  drivers/mtd/spi/spi_flash.c | 1 -
>  include/spi.h   | 6 --
>  3 files changed, 11 deletions(-)
>

Reviewed-by: Simon Glass 

> diff --git a/drivers/mtd/spi/sf.c b/drivers/mtd/spi/sf.c
> index 664e860..d5e175c 100644
> --- a/drivers/mtd/spi/sf.c
> +++ b/drivers/mtd/spi/sf.c
> @@ -18,10 +18,6 @@ static int spi_flash_read_write(struct spi_slave *spi,
> unsigned long flags = SPI_XFER_BEGIN;
> int ret;
>
> -#ifdef CONFIG_SF_DUAL_FLASH
> -   if (spi->flags & SPI_XFER_U_PAGE)
> -   flags |= SPI_XFER_U_PAGE;
> -#endif
> if (data_len == 0)
> flags |= SPI_XFER_END;
>
> diff --git a/drivers/mtd/spi/spi_flash.c b/drivers/mtd/spi/spi_flash.c
> index b4001a5..708991c 100644
> --- a/drivers/mtd/spi/spi_flash.c
> +++ b/drivers/mtd/spi/spi_flash.c
> @@ -1016,7 +1016,6 @@ int spi_flash_scan(struct spi_flash *flash)
>
> flash->name = info->name;
> flash->memory_map = spi->memory_map;
> -   flash->dual_flash = spi->option;
>
> if (info->flags & SST_WR)
> flash->flags |= SNOR_F_SST_WR;
> diff --git a/include/spi.h b/include/spi.h
> index 4c17983..deb65ef 100644
> --- a/include/spi.h
> +++ b/include/spi.h
> @@ -30,10 +30,6 @@
>  #define SPI_RX_DUALBIT(12) /* receive with 2 wires */
>  #define SPI_RX_QUADBIT(13) /* receive with 4 wires */
>
> -/* SPI bus connection options - see enum spi_dual_flash */
> -#define SPI_CONN_DUAL_SHARED   (1 << 0)
> -#define SPI_CONN_DUAL_SEPARATED(1 << 1)
> -
>  /* Header byte that marks the start of the message */
>  #define SPI_PREAMBLE_END_BYTE  0xec
>
> @@ -93,7 +89,6 @@ struct dm_spi_slave_platdata {
>   * @max_write_size:If non-zero, the maximum number of bytes which can
>   * be written at once, excluding command bytes.
>   * @memory_map:Address of read-only SPI flash access.
> - * @option:Varies SPI bus options - separate, shared bus.
>   * @flags: Indication of SPI flags.
>   */
>  struct spi_slave {
> @@ -117,7 +112,6 @@ struct spi_slave {
>  #define SPI_XFER_ONCE  (SPI_XFER_BEGIN | SPI_XFER_END)
>  #define SPI_XFER_MMAP  BIT(2)  /* Memory Mapped start */
>  #define SPI_XFER_MMAP_END  BIT(3)  /* Memory Mapped End */
> -#define SPI_XFER_U_PAGEBIT(4)
>  };
>
>  /**
> --
> 2.7.4
>
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH v5 15/21] sf: ids: Use small letter in ext_jedec

2016-11-05 Thread Simon Glass
On 30 October 2016 at 11:46, Jagan Teki  wrote:
> Use small 'd' in s25s512s ext_jedec
>
> Cc: Simon Glass 
> Cc: Bin Meng 
> Cc: York Sun 
> Cc: Vignesh R 
> Cc: Mugunthan V N 
> Cc: Michal Simek 
> Cc: Siva Durga Prasad Paladugu 
> Signed-off-by: Jagan Teki 
> ---
>  drivers/mtd/spi/spi_flash_ids.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Reviewed-by: Simon Glass 
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH v5 14/21] sf: ids: Use small letter's with flash name

2016-11-05 Thread Simon Glass
On 30 October 2016 at 11:46, Jagan Teki  wrote:
> For readability use small letter's with flash name.
>
> Cc: Simon Glass 
> Cc: Bin Meng 
> Cc: York Sun 
> Cc: Vignesh R 
> Cc: Mugunthan V N 
> Cc: Michal Simek 
> Cc: Siva Durga Prasad Paladugu 
> Signed-off-by: Jagan Teki 
> ---
>  drivers/mtd/spi/spi_flash_ids.c | 220 
> 
>  1 file changed, 110 insertions(+), 110 deletions(-)

Reviewed-by: Simon Glass 
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH v5 16/21] sf: Rename few local functions

2016-11-05 Thread Simon Glass
On 30 October 2016 at 11:46, Jagan Teki  wrote:
> spi_flash_write_bar-> write_bar
> spi_flash_write_bar -> read_bar
> spi_flash_cmd_wait_ready -> spi_flash_wait_till_ready

nit: how about wait_until_ready or wait_ready? 'till' is an abreviation

>
> Cc: Simon Glass 
> Cc: Bin Meng 
> Cc: York Sun 
> Cc: Vignesh R 
> Cc: Mugunthan V N 
> Cc: Michal Simek 
> Cc: Siva Durga Prasad Paladugu 
> Signed-off-by: Jagan Teki 
> ---
>  drivers/mtd/spi/sf_internal.h |  2 +-
>  drivers/mtd/spi/spi_flash.c   | 23 +++
>  2 files changed, 12 insertions(+), 13 deletions(-)

Reviewed-by: Simon Glass 
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH v5 09/21] sf: Add INFO6 flash_info macro

2016-11-05 Thread Simon Glass
On 30 October 2016 at 11:46, Jagan Teki  wrote:
> INFO6 is for tabulating 6 byte flash parts, Ex: S25FS256S_64K
>
> Cc: Simon Glass 
> Cc: Bin Meng 
> Cc: York Sun 
> Cc: Vignesh R 
> Cc: Mugunthan V N 
> Cc: Michal Simek 
> Cc: Siva Durga Prasad Paladugu 
> Signed-off-by: Jagan Teki 
> ---
>  drivers/mtd/spi/sf_params.c | 15 +++
>  1 file changed, 15 insertions(+)

Reviewed-by: Simon Glass 
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH v5 12/21] sf: Remove non-meaningful comments

2016-11-05 Thread Simon Glass
On 30 October 2016 at 11:46, Jagan Teki  wrote:
> Cc: Simon Glass 
> Cc: Bin Meng 
> Cc: York Sun 
> Cc: Vignesh R 
> Cc: Mugunthan V N 
> Cc: Michal Simek 
> Cc: Siva Durga Prasad Paladugu 
> Signed-off-by: Jagan Teki 
> ---
>  drivers/mtd/spi/spi_flash.c | 3 ---
>  1 file changed, 3 deletions(-)

Reviewed-by: Simon Glass 

Good to have a commit message.
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH v5 13/21] sf: Rename sf_params.c to spi_flash_ids

2016-11-05 Thread Simon Glass
Hi Jagan,

On 30 October 2016 at 11:46, Jagan Teki  wrote:
> spi_flash_ids.c is more meaningful name as the flash_info
> table structure spi_flash_info has spi_flash_ids instance.
>
> Cc: Simon Glass 
> Cc: Bin Meng 
> Cc: York Sun 
> Cc: Vignesh R 
> Cc: Mugunthan V N 
> Cc: Michal Simek 
> Cc: Siva Durga Prasad Paladugu 
> Signed-off-by: Jagan Teki 
> ---
>  drivers/mtd/spi/Makefile|   2 +-
>  drivers/mtd/spi/spi_flash_ids.c | 176 
> 
>  2 files changed, 177 insertions(+), 1 deletion(-)
>  create mode 100644 drivers/mtd/spi/spi_flash_ids.c

Where did this code come from? Is it a rename of an existing file?

Regards,
Simon
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH v5 10/21] sf: params: Add S25FS256S_64K spi flash support

2016-11-05 Thread Simon Glass
On 30 October 2016 at 11:46, Jagan Teki  wrote:
> Add Spansion S25FS256S_64K spi flash to the list of spi_flash_ids.
>
> In spansion S25FS-S family the physical sectors are grouped as
> normal and parameter sectors. Parameter sectors are 4kB in size
> with 8 set located at the bottom or top address of a device.
> Normal sectors are similar to other flash family with sizes of
> 64kB or 32 kB.
>
> To erase whole flash using sector erase(D8h or DCh) won't effect
> the parameter sectors, so in order to erase these we must use 4K
> sector erase commands (20h or 21h) separately.
>
> So better to erase the whole flash using 4K sector erase instead
> of detecting these family parts again and do two different erase
> operations.
>
> Cc: Yunhui Cui 
> Cc: Simon Glass 
> Cc: Bin Meng 
> Cc: York Sun 
> Cc: Vignesh R 
> Cc: Mugunthan V N 
> Cc: Michal Simek 
> Cc: Michael Trimarchi 
> Cc: Siva Durga Prasad Paladugu 
> Signed-off-by: Jagan Teki 
> ---
>  drivers/mtd/spi/sf_params.c | 1 +
>  1 file changed, 1 insertion(+)

Reviewed-by: Simon Glass 
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH v5 11/21] sf: Remove legacy idcode detection code

2016-11-05 Thread Simon Glass
On 30 October 2016 at 11:46, Jagan Teki  wrote:
> Since flash detection code is more mature to
> detect even with 6 bytes id length devices
> removed old code and related references.
>
> Cc: Yunhui Cui 
> Cc: Simon Glass 
> Cc: Bin Meng 
> Cc: York Sun 
> Cc: Vignesh R 
> Cc: Mugunthan V N 
> Cc: Michal Simek 
> Cc: Michael Trimarchi 
> Cc: Siva Durga Prasad Paladugu 
> Signed-off-by: Jagan Teki 
> ---
>  drivers/mtd/spi/sf_internal.h |  6 
>  drivers/mtd/spi/spi_flash.c   | 78 
> ---
>  2 files changed, 84 deletions(-)

Reviewed-by: Simon Glass 
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH v5 08/21] sf: Increase max id length by 1 byte

2016-11-05 Thread Simon Glass
On 30 October 2016 at 11:46, Jagan Teki  wrote:
> So, now SPI_FLASH_ID_MAX_LEN is 6 bytes useful for
> few spansion flash families S25FS-S
>
> Cc: Simon Glass 
> Cc: Bin Meng 
> Cc: York Sun 
> Cc: Vignesh R 
> Cc: Mugunthan V N 
> Cc: Michal Simek 
> Cc: Siva Durga Prasad Paladugu 
> Signed-off-by: Jagan Teki 
> ---
>  drivers/mtd/spi/sf_internal.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Reviewed-by: Simon Glass 
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH v5 06/21] sf: nr_sectors -> n_sectors

2016-11-05 Thread Simon Glass
On 30 October 2016 at 11:46, Jagan Teki  wrote:
> Rename nr_sectors as n_sectors to sync with Linux.
>
> Cc: Simon Glass 
> Cc: Bin Meng 
> Cc: York Sun 
> Cc: Vignesh R 
> Cc: Mugunthan V N 
> Cc: Michal Simek 
> Cc: Siva Durga Prasad Paladugu 
> Signed-off-by: Jagan Teki 
> ---
>  drivers/mtd/spi/sandbox.c | 2 +-
>  drivers/mtd/spi/sf_internal.h | 2 +-
>  drivers/mtd/spi/sf_params.c   | 2 +-
>  drivers/mtd/spi/spi_flash.c   | 2 +-
>  4 files changed, 4 insertions(+), 4 deletions(-)

Reviewed-by: Simon Glass 
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH v5 07/21] sf: Add SPI_FLASH_MAX_ID_LEN

2016-11-05 Thread Simon Glass
On 30 October 2016 at 11:46, Jagan Teki  wrote:
> Add id length of 5 bytes numerical value to macro.
>
> Cc: Simon Glass 
> Cc: Bin Meng 
> Cc: York Sun 
> Cc: Vignesh R 
> Cc: Mugunthan V N 
> Cc: Michal Simek 
> Cc: Siva Durga Prasad Paladugu 
> Signed-off-by: Jagan Teki 
> ---
>  drivers/mtd/spi/sf_internal.h | 3 ++-
>  drivers/mtd/spi/spi_flash.c   | 4 ++--
>  2 files changed, 4 insertions(+), 3 deletions(-)

Reviewed-by: Simon Glass 
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH v5 04/21] sf: Cleanup spi_flash_info{}

2016-11-05 Thread Simon Glass
Hi Jagan,

On 30 October 2016 at 11:46, Jagan Teki  wrote:
> - Proper tabs spaces
> - Removed unnecessary
> - Added meaningful comments
>
> Cc: Simon Glass 
> Cc: Bin Meng 
> Cc: York Sun 
> Cc: Vignesh R 
> Cc: Mugunthan V N 
> Cc: Michal Simek 
> Cc: Siva Durga Prasad Paladugu 
> Signed-off-by: Jagan Teki 
> ---
>  drivers/mtd/spi/sf_internal.h | 22 --
>  1 file changed, 8 insertions(+), 14 deletions(-)
>
> diff --git a/drivers/mtd/spi/sf_internal.h b/drivers/mtd/spi/sf_internal.h
> index a9455ac..71feba9 100644
> --- a/drivers/mtd/spi/sf_internal.h
> +++ b/drivers/mtd/spi/sf_internal.h
> @@ -108,17 +108,8 @@ int sst_write_bp(struct spi_flash *flash, u32 offset, 
> size_t len,
>  #define JEDEC_ID(info) (((info)->id[1]) << 8 | ((info)->id[2]))
>  #define JEDEC_EXT(info)(((info)->id[3]) << 8 | 
> ((info)->id[4]))
>
> -/**
> - * struct spi_flash_info - SPI/QSPI flash device params structure
> - *
> - * @name:  Device name 
> ([MANUFLETTER][DEVTYPE][DENSITY][EXTRAINFO])
> - * @sector_size:   Isn't necessarily a sector size from vendor,
> - * the size listed here is what works with CMD_ERASE_64K
> - * @nr_sectors:No.of sectors on this device
> - * @flags: Important param, for flash specific behaviour

Why remove these comments? For 'flags' it would be good to point to
the enum / #define that describes its values.

> - */
>  struct spi_flash_info {
> -   const char *name;
> +   const char  *name;
>
> /*
>  * This array stores the ID bytes.
> @@ -128,12 +119,15 @@ struct spi_flash_info {
> u8  id[5];
> u8  id_len;
>
> -   u32 sector_size;
> -   u32 nr_sectors;
> +   /* The size listed here is what works with SPINOR_OP_SE, which isn't

/*
 * The size

> +* necessarily called a "sector" by the vendor.
> +*/
> +   u32 sector_size;
> +   u32 nr_sectors;
>
> -   u16 page_size;
> +   u16 page_size;
>
> -   u16 flags;
> +   u16 flags;
>  #define SECT_4KBIT(0)
>  #define E_FSR  BIT(1)
>  #define SST_WR BIT(2)
> --
> 2.7.4
>

Regards,
Simon
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH v5 05/21] sf: Cleanup sf_params

2016-11-05 Thread Simon Glass
Hi Jagan,

On 30 October 2016 at 11:46, Jagan Teki  wrote:
> - Move headers froms sf_params to common header file
> - Removed unnecessary comment
>
> Cc: Simon Glass 
> Cc: Bin Meng 
> Cc: York Sun 
> Cc: Vignesh R 
> Cc: Mugunthan V N 
> Cc: Michal Simek 
> Cc: Siva Durga Prasad Paladugu 
> Signed-off-by: Jagan Teki 
> ---
>  drivers/mtd/spi/sf_internal.h | 5 +++--
>  drivers/mtd/spi/sf_params.c   | 5 -
>  2 files changed, 3 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/mtd/spi/sf_internal.h b/drivers/mtd/spi/sf_internal.h
> index 71feba9..4a88cf7 100644
> --- a/drivers/mtd/spi/sf_internal.h
> +++ b/drivers/mtd/spi/sf_internal.h
> @@ -10,8 +10,9 @@
>  #ifndef _SF_INTERNAL_H_
>  #define _SF_INTERNAL_H_
>
> -#include 
> -#include 
> +#include 
> +#include 
> +#include 

No, these headers should remain in the C file that needs them.
Transitive include should be minimised.

>
>  /* Dual SPI flash memories - see SPI_COMM_DUAL_... */
>  enum spi_dual_flash {
> diff --git a/drivers/mtd/spi/sf_params.c b/drivers/mtd/spi/sf_params.c
> index 7fcc3bc..7314455 100644
> --- a/drivers/mtd/spi/sf_params.c
> +++ b/drivers/mtd/spi/sf_params.c
> @@ -6,10 +6,6 @@
>   * SPDX-License-Identifier:GPL-2.0+
>   */
>
> -#include 
> -#include 
> -#include 
> -
>  #include "sf_internal.h"
>
>  /* Used when the "_ext_id" is two bytes at most */
> @@ -27,7 +23,6 @@
> .page_size = 256,   \
> .flags = (_flags),
>
> -/* SPI/QSPI flash device params structure */
>  const struct spi_flash_info spi_flash_ids[] = {
>  #ifdef CONFIG_SPI_FLASH_ATMEL  /* ATMEL */
> {"AT45DB011D", INFO(0x1f2200, 0x0, 64 * 1024, 4, SECT_4K) },
> --
> 2.7.4
>

Regards,
Simon
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH v9 00/21] dm: Generic MTD Subsystem/SPI-NOR

2016-11-05 Thread Simon Glass
Hi Jagan,

On 30 October 2016 at 12:23, Jagan Teki  wrote:
> The previous series [1] [2] are added SPI-NOR on top of
> mtd/spi where it bypassing DM_SPI_FLASH and use the existing
> mtd core (which is non-dm), I feel this is moving in a reverse
> direction where adding new feature with the help of non-dm mtd
> core support and also few of the spi drivers are not fully dm-driven.
>
> Previous design series[3]: keep the mtd/spi as it is and start adding
> spi-nor features separately. The idea here is to add the dm features
> to MTD first and then add UCLASS_MTD spi-nor drivers so-that the commands
> are interfacing to spi-nor through dm-driven MTD core to spi-nor.
>
> This series adding a new command 'mtd.c' which is common for all MTD devices
> SPI-NOR, SPI-NOR(master) and Parallel NOR with dm-driven.
>
> SPI-NOR and Parallel NOR:
> 
>
> 
>   mtd.c
> 
> mtd-uclass
> 
>SPI-NOR CoreCFI FLASH
> 
> m25p80.czynq_qspi
> ---
> spi-uclass  SPI NOR chip
> ---
> spi drivers
> ---
> SPI NOR chip
> ---
>
> drivers/mtd/spi-nor/
>
> - Add dm mtd operations
> - spi-nor.c:   Add basic SPI-NOR core like erase/read/write ops and lock's 
> will add later
> - m25p80.c:spi-nor to spi divers interface layer drivers/spi-nor
> - zynq_qspi.c: zynq qspi spi-nor controller driver.
>
> Current Status:
> --
> - SPI-NOR Controller design flow working, see Log
>
> TODO:
> 
> - SPI-NOR with SPI bus
> - Parallel NOR.
>
> Log:
> 
> Zynq> mtd
> mtd - MTD Sub-system
>
> Usage:
> mtd list- show list of MTD devices
> mtd info- show current MTD device info
> mtd probe devnum- probe the 'devnum' MTD device
> mtd erase offset len- erase 'len' bytes from 'offset'
> mtd write addr to len   - write 'len' bytes to 'to' from 'addr'
> mtd read addr from len  - read 'len' bytes from 'from' to 'addr'
> Zynq> mtd list
> MTD 1:  spi-nor@e000d000
> Zynq>
> MTD 1:  spi-nor@e000d000
> Zynq> mtd list
> MTD 1:  spi-nor@e000d000
> Zynq> mtd probe 0
> failing to set MTD device 0
> Zynq> mtd probe 1
> SPI-NOR: detected s25fl128s_64k with page size 256 Bytes, erase size 64 KiB, 
> total 16 MiB
> Zynq> mtd info
> MTD Device 1: s25fl128s_64k
>  Page size: 256 B
>  Erase size:64 KiB
>  Size:  16 MiB
> Zynq> mtd list
> MTD 1:  spi-nor@e000d000  (active 1)
> Zynq> mtd erase 0xE0 0x10
> MTD: 1048576 bytes @ 0xe0 Erased: OK
> Zynq> mw.b 0x100 0xaa 0x10
> Zynq> mtd write 0x100 0xE0 0x10
> device 0 offset 0xe0, size 0x10
> MTD: 1048576 bytes @ 0xe0 Written: OK
> Zynq> mtd read 0x300 0xE0 0x10
> device 0 offset 0xe0, size 0x10
> MTD: 1048576 bytes @ 0xe0 Read: OK
> Zynq> cmp.b 0x300 0x100 0x10
> Total of 1048576 byte(s) were the same
>
> Testing:
> ---
> $ git clone git://git.denx.de/u-boot-spi.git
> $ cd u-boot-spi
> $ git checkout -b mtd origin/mtd-working
>
> [1] http://lists.denx.de/pipermail/u-boot/2016-March/249286.html
> [2] http://lists.denx.de/pipermail/u-boot/2016-February/245418.html
> [3] [PATCH RFC v8 00/16]  SPI-NOR/MTD addition
>
> Jagan Teki (21):
>   dm: mtd: Add dm mtd core ops
>   mtd: Add SPI-NOR core support
>   mtd: spi-nor: Kconfig: Add MTD_SPI_NOR entry
>   mtd: spi-nor: Kconfig: Add MTD_SPI_NOR_USE_4K_SECTORS
>   mtd: spi-nor: Kconfig: Add SPI_NOR_MISC entry
>   mtd: spi-nor: Kconfig: Add SPI_NOR_MACRONIX entry
>   mtd: spi-nor: Kconfig: Add SPI_NOR_SPANSION entry
>   mtd: spi-nor: Kconfig: Add SPI_NOR_STMICRO entry
>   mtd: spi-nor: Kconfig: Add SPI_NOR_SST entry
>   mtd: spi-nor: Kconfig: Add SPI_NOR_WINBOND entry
>   spi: Add spi_write_then_read
>   mtd: spi-nor: Add m25p80 driver
>   mtd: spi-nor: Kconfig: Add MTD_M25P80 entry
>   mtd: spi-nor: Add zynq qspinor driver
>   mtd: spi-nor: zynq_qspi: Kconfig: Add MTD_ZYNQ
>   mtd: spi-nor: Add 4-byte addresswidth support
>   dm: mtd: Add uclass_driver.flags
>   dm: mtd: Add post_bind
>   cmd: Add mtd command support
>   arm: dts: zynq: Add zynq-qspinor node
>   dm: zynq: microzed: Enable MTD/SPI-NOR
>
>  Makefile   |   1 +
>  arch/arm/dts/zynq-7000.dtsi|  12 +
>  arch/arm/dts/zynq-microzed.dts |   6 +
>  cmd/Kconfig|   6 +
>  cmd/Makefile   |   1 +
>  cmd/mtd.c  | 285 
>  configs/zynq_microzed_defconfig|  14 +-
>  drivers/mtd/Kconfig|   2 +
>  drivers/mtd/Makefile   |   2 +-
>  drivers/mtd/mtd-uclass.c   |  93 +
>  drivers/mtd/spi-nor/Kconfig|  89 +
>  

Re: [U-Boot] [PATCH v5 03/21] sf: sandbox: Use JEDEC_MFR|ID in id exctract

2016-11-05 Thread Simon Glass
On 30 October 2016 at 11:46, Jagan Teki  wrote:
> Instead of extracting id's separately better
> to use JEDEC_MFR|ID for code simplicity.
>
> Cc: Simon Glass 
> Cc: Bin Meng 
> Signed-off-by: Jagan Teki 
> ---
>  drivers/mtd/spi/sandbox.c | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)

Reviewed-by: Simon Glass 
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH v5 02/21] sf: Simplify lock ops detection code

2016-11-05 Thread Simon Glass
Hi Jagan,

On 30 October 2016 at 11:46, Jagan Teki  wrote:
> Simplify the flash_lock ops detection code and added
> meaningful comment.
>
> Cc: Simon Glass 
> Cc: Bin Meng 
> Cc: York Sun 
> Cc: Vignesh R 
> Cc: Mugunthan V N 
> Cc: Michal Simek 
> Cc: Siva Durga Prasad Paladugu 
> Signed-off-by: Jagan Teki 
> ---
>  drivers/mtd/spi/spi_flash.c | 12 
>  1 file changed, 4 insertions(+), 8 deletions(-)

Reviewed-by: Simon Glass 

>
> diff --git a/drivers/mtd/spi/spi_flash.c b/drivers/mtd/spi/spi_flash.c
> index daa9014..b92b0bf 100644
> --- a/drivers/mtd/spi/spi_flash.c
> +++ b/drivers/mtd/spi/spi_flash.c
> @@ -1117,19 +1117,15 @@ int spi_flash_scan(struct spi_flash *flash)
> flash->read = spi_flash_cmd_read_ops;
>  #endif
>
> -   /* lock hooks are flash specific - assign them based on idcode0 */
> -   switch (JEDEC_MFR(info)) {
>  #if defined(CONFIG_SPI_FLASH_STMICRO) || defined(CONFIG_SPI_FLASH_SST)
> -   case SPI_FLASH_CFI_MFR_STMICRO:
> -   case SPI_FLASH_CFI_MFR_SST:
> +   /* NOR protection support for STmicro/Micron chips and similar */
> +   if (JEDEC_MFR(info) == SPI_FLASH_CFI_MFR_STMICRO ||
> +   JEDEC_MFR(info) == SPI_FLASH_CFI_MFR_SST) {
> flash->flash_lock = stm_lock;
> flash->flash_unlock = stm_unlock;
> flash->flash_is_locked = stm_is_locked;
> -#endif
> -   break;
> -   default:
> -   debug("SF: Lock ops not supported for %02x flash\n", 
> JEDEC_MFR(info));

Did you intentionally drop this?

> }
> +#endif
>
> /* Compute the flash size */
> flash->shift = (flash->dual_flash & SF_DUAL_PARALLEL_FLASH) ? 1 : 0;
> --
> 2.7.4
>


Regards,
Simon
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH v9 01/21] dm: mtd: Add dm mtd core ops

2016-11-05 Thread Simon Glass
Hi Jagan,

On 30 October 2016 at 12:23, Jagan Teki  wrote:
> - Add generic dm_mtd operations
> - Add mtd_read|erase|write_dm
> - Add add_mtd_device_dm
>
> The respetive MTD_UCLASS drivers must install the hooks to these
> dm_mtd_ops and other core ops are act as a interface b/w drivers
> vs command code.
>
> Signed-off-by: Jagan Teki 
> ---
>  drivers/mtd/mtd-uclass.c | 72 
> 
>  include/mtd.h| 54 
>  2 files changed, 126 insertions(+)

Reviewed-by: Simon Glass 

But please see changes below.

>
> diff --git a/drivers/mtd/mtd-uclass.c b/drivers/mtd/mtd-uclass.c
> index 7b7c48e..acbd713 100644
> --- a/drivers/mtd/mtd-uclass.c
> +++ b/drivers/mtd/mtd-uclass.c
> @@ -1,4 +1,5 @@
>  /*
> + * Copyright (C) 2016 Jagan Teki 
>   * Copyright (C) 2015 Thomas Chou 
>   *
>   * SPDX-License-Identifier:GPL-2.0+
> @@ -8,6 +9,77 @@
>  #include 
>  #include 
>  #include 
> +#include 
> +
> +int dm_mtd_read(struct udevice *dev, loff_t from, size_t len, size_t *retlen,
> +   u_char *buf)
> +{
> +   struct mtd_info *mtd = mtd_get_info(dev);
> +
> +   *retlen = 0;
> +   if (from < 0 || from > mtd->size || len > mtd->size - from)
> +   return -EINVAL;
> +   if (!len)
> +   return 0;
> +
> +   return mtd_get_ops(dev)->_read(dev, from, len, retlen, buf);
> +}
> +
> +int dm_mtd_erase(struct udevice *dev, struct erase_info *instr)
> +{
> +   struct mtd_info *mtd = mtd_get_info(dev);
> +
> +   if (instr->addr > mtd->size || instr->len > mtd->size - instr->addr)
> +   return -EINVAL;
> +   if (!(mtd->flags & MTD_WRITEABLE))
> +   return -EROFS;
> +   instr->fail_addr = MTD_FAIL_ADDR_UNKNOWN;
> +   if (!instr->len) {
> +   instr->state = MTD_ERASE_DONE;
> +   return 0;
> +   }
> +
> +   return mtd_get_ops(dev)->_erase(dev, instr);
> +}
> +
> +int dm_mtd_write(struct udevice *dev, loff_t to, size_t len, size_t *retlen,
> +const u_char *buf)
> +{
> +   struct mtd_info *mtd = mtd_get_info(dev);
> +
> +   *retlen = 0;
> +   if (to < 0 || to > mtd->size || len > mtd->size - to)
> +   return -EINVAL;
> +   if (!mtd_get_ops(dev)->_write || !(mtd->flags & MTD_WRITEABLE))
> +   return -EROFS;
> +   if (!len)
> +   return 0;
> +
> +   return mtd_get_ops(dev)->_write(dev, to, len, retlen, buf);
> +}
> +
> +int dm_add_mtd_device(struct udevice *dev)
> +{
> +   struct mtd_info *mtd = mtd_get_info(dev);
> +
> +   BUG_ON(mtd->writesize == 0);
> +   mtd->usecount = 0;
> +
> +   if (is_power_of_2(mtd->erasesize))
> +   mtd->erasesize_shift = ffs(mtd->erasesize) - 1;
> +   else
> +   mtd->erasesize_shift = 0;
> +
> +   if (is_power_of_2(mtd->writesize))
> +   mtd->writesize_shift = ffs(mtd->writesize) - 1;
> +   else
> +   mtd->writesize_shift = 0;
> +
> +   mtd->erasesize_mask = (1 << mtd->erasesize_shift) - 1;
> +   mtd->writesize_mask = (1 << mtd->writesize_shift) - 1;
> +
> +   return 0;
> +}
>
>  /*
>   * Implement a MTD uclass which should include most flash drivers.
> diff --git a/include/mtd.h b/include/mtd.h
> index 3f8c293..93b5eaf 100644
> --- a/include/mtd.h
> +++ b/include/mtd.h
> @@ -20,4 +20,58 @@ static inline struct mtd_info *mtd_get_info(struct udevice 
> *dev)
> return dev_get_uclass_priv(dev);
>  }
>
> +struct dm_mtd_ops {
> +   int (*_erase)(struct udevice *dev, struct erase_info *instr);
> +   int (*_read)(struct udevice *dev, loff_t from, size_t len,
> +size_t *retlen, u_char *buf);
> +   int (*_write)(struct udevice *dev, loff_t to, size_t len,
> + size_t *retlen, const u_char *buf);

Please add detailed comments to the struct and each method. Also can
you drop the underscore?

> +};
> +
> +/* Access the serial operations for a device */
> +#define mtd_get_ops(dev) ((struct dm_mtd_ops *)(dev)->driver->ops)
> +
> +/**
> + * dm_mtd_read() - Read data from MTD device
> + *
> + * @dev:   MTD device
> + * @from:  Offset into device in bytes to read from
> + * @len:   Length of bytes to read
> + * @retlen:Length of return bytes read to
> + * @buf:   Buffer to put the data that is read
> + * @return 0 if OK, -ve on error
> + */
> +int dm_mtd_read(struct udevice *dev, loff_t from, size_t len, size_t *retlen,
> +   u_char *buf);
> +
> +/**
> + * dm_mtd_write() - Write data to MTD device
> + *
> + * @dev:   MTD device
> + * @to:Offset into device in bytes to write to
> + * @len:   Length of bytes to write
> + * @retlen:Length of return bytes to write to
> + * @buf:   Buffer containing bytes to write
> + * @return 0 if OK, -ve 

Re: [U-Boot] engicam: icorem6: Fix config files

2016-11-05 Thread Tom Rini
On Sun, Oct 30, 2016 at 01:14:31AM +0530, Jagan Teki wrote:

> From: Jagan Teki 
> 
> Config file names on MAINTAINERS and README in
> board/engicam/icorem6 seems to be wrong, hence fixed the same.
> 
> Cc: Stefano Babic 
> Cc: Michael Trimarchi 
> Signed-off-by: Jagan Teki 

Applied to u-boot/master, thanks!

-- 
Tom


signature.asc
Description: Digital signature
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH] engicam: icorem6: Fix config files

2016-11-05 Thread Tom Rini
On Sat, Nov 05, 2016 at 05:14:18PM +0530, Jagan Teki wrote:
> Hi Stefano,
> 
> On Sun, Oct 30, 2016 at 1:14 AM, Jagan Teki  wrote:
> > From: Jagan Teki 
> >
> > Config file names on MAINTAINERS and README in
> > board/engicam/icorem6 seems to be wrong, hence fixed the same.
> >
> > Cc: Stefano Babic 
> > Cc: Michael Trimarchi 
> > Signed-off-by: Jagan Teki 
> > ---
> >  board/engicam/icorem6/MAINTAINERS | 5 +++--
> >  board/engicam/icorem6/README  | 2 +-
> >  2 files changed, 4 insertions(+), 3 deletions(-)
> >
> > diff --git a/board/engicam/icorem6/MAINTAINERS 
> > b/board/engicam/icorem6/MAINTAINERS
> > index 3e06c6b..a425afb 100644
> > --- a/board/engicam/icorem6/MAINTAINERS
> > +++ b/board/engicam/icorem6/MAINTAINERS
> > @@ -2,5 +2,6 @@ ICOREM6QDL BOARD
> >  M: Jagan Teki 
> >  S: Maintained
> >  F: board/engicam/icorem6
> > -F: include/configs/icorem6qdl.h
> > -F: configs/icorem6qdl_defconfig
> > +F: include/configs/imx6qdl_icore.h
> > +F: configs/imx6qdl_icore_mmc_defconfig
> > +F: configs/imx6qdl_icore_nand_defconfig
> > diff --git a/board/engicam/icorem6/README b/board/engicam/icorem6/README
> > index 12d1e21..e47f85f 100644
> > --- a/board/engicam/icorem6/README
> > +++ b/board/engicam/icorem6/README
> > @@ -4,7 +4,7 @@ How to use U-Boot on Engicam i.CoreM6 DualLite/Solo and 
> > Quad/Dual Starter Kit:
> >  - Configure U-Boot for Engicam i.CoreM6 QDL:
> >
> >  $ make mrproper
> > -$ make icorem6qdl_mmc_defconfig
> > +$ make imx6qdl_icore_mmc_defconfig
> >
> >  - Build for i.CoreM6 DualLite/Solo
> 
> Are you planning to take this? may be I can take it along with my PR.
> Please let me know if you're OK?

I'll take this directly so it's in, in time, thanks!

-- 
Tom


signature.asc
Description: Digital signature
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH] engicam: icorem6: Fix config files

2016-11-05 Thread Jagan Teki
Hi Stefano,

On Sun, Oct 30, 2016 at 1:14 AM, Jagan Teki  wrote:
> From: Jagan Teki 
>
> Config file names on MAINTAINERS and README in
> board/engicam/icorem6 seems to be wrong, hence fixed the same.
>
> Cc: Stefano Babic 
> Cc: Michael Trimarchi 
> Signed-off-by: Jagan Teki 
> ---
>  board/engicam/icorem6/MAINTAINERS | 5 +++--
>  board/engicam/icorem6/README  | 2 +-
>  2 files changed, 4 insertions(+), 3 deletions(-)
>
> diff --git a/board/engicam/icorem6/MAINTAINERS 
> b/board/engicam/icorem6/MAINTAINERS
> index 3e06c6b..a425afb 100644
> --- a/board/engicam/icorem6/MAINTAINERS
> +++ b/board/engicam/icorem6/MAINTAINERS
> @@ -2,5 +2,6 @@ ICOREM6QDL BOARD
>  M: Jagan Teki 
>  S: Maintained
>  F: board/engicam/icorem6
> -F: include/configs/icorem6qdl.h
> -F: configs/icorem6qdl_defconfig
> +F: include/configs/imx6qdl_icore.h
> +F: configs/imx6qdl_icore_mmc_defconfig
> +F: configs/imx6qdl_icore_nand_defconfig
> diff --git a/board/engicam/icorem6/README b/board/engicam/icorem6/README
> index 12d1e21..e47f85f 100644
> --- a/board/engicam/icorem6/README
> +++ b/board/engicam/icorem6/README
> @@ -4,7 +4,7 @@ How to use U-Boot on Engicam i.CoreM6 DualLite/Solo and 
> Quad/Dual Starter Kit:
>  - Configure U-Boot for Engicam i.CoreM6 QDL:
>
>  $ make mrproper
> -$ make icorem6qdl_mmc_defconfig
> +$ make imx6qdl_icore_mmc_defconfig
>
>  - Build for i.CoreM6 DualLite/Solo

Are you planning to take this? may be I can take it along with my PR.
Please let me know if you're OK?

thanks!
-- 
Jagan Teki
Free Software Engineer | www.openedev.com
U-Boot, Linux | Upstream Maintainer
Hyderabad, India.
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [bug report] sunxi: booting from eMMC

2016-11-05 Thread Alexandr Bochkarev
Hi,

I have tried it, no success

>>U-Boot SPL 2016.11-rc3-1-g9fa5bf3-dirty (Nov 05 2016 - 16:18:14)
>>DRAM: 1024 MiB
>>CPU: 91200Hz, AXI/AHB/APB: 3/2/2
>>Trying to boot from MMC1
>>mmc_load_image_raw_sector: mmc block read error
>>SPL: failed to boot from all boot devices
>>### ERROR ### Please RESET the board ###


In my case, i am sure, that problem not in emmc card.
First MMC_CMD_SWITCH in mmc_change_func works well without patches, but get 
stuck in second, when change bus width.

I have two almost similar socs, Allwinner A13(sun5i) and A20(sun7i).
They uses same sunxi_mmc.c driver. A13 boots well with master branch, but A20 
only with my patch.

Below link shows diff in boot logs, A20 CONFIG_MACH_SUN7I on left, and A13 
CONFIG_MACH_SUN5I on right side. A13 works well
https://www.diffchecker.com/XrmlaZfH 

Using logic analyzer, i analyzed all command and all responses. 
Diagrams absolutely the same, from u-boot spl start, on both socs, until 
mmc_rint_wait return error.

https://dl.dropboxusercontent.com/u/10252748/A20vsA13.png 

https://dl.dropboxusercontent.com/u/10252748/A20vsA13_ZOMMED.png 


at first look, looks like emmc not respond to A20, but if zoom more, 
https://www.dropbox.com/s/80u232i7wod93gf/A20.png?dl=0 

we see, that no clocks in some time. If take A13 diagram, no empty clocks!
I have no jtag to debug more. I am not sure, but i think, for some reason, this 
empty clocks cause card fail.

So, only with this patch, Allwinner A20 soc can boot from emmc 
https://www.dropbox.com/s/0lfe2xifzbdbokb/emmcFix.patch?dl=0 




> 5 нояб. 2016 г., в 14:18, Hans de Goede  написал(а):
> 
> Hi,
> 
> Maxime posted a proper fix for this issue yesterday:
> 
> https://patchwork.ozlabs.org/patch/691284/
> 
> Can you give that one a try and see if it fixes things for you
> as well ?
> 
> Regards,
> 
> Hans
> 
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH RESEND v2 2/2] spi: ti_qspi: Fix baudrate divider calculation

2016-11-05 Thread R, Vignesh
[...]

On 11/4/2016 4:31 PM, Jagan Teki wrote:
>>> >> diff --git a/drivers/spi/ti_qspi.c b/drivers/spi/ti_qspi.c
>>> >> index 52520dff6325..b5de70bf40e3 100644
>>> >> --- a/drivers/spi/ti_qspi.c
>>> >> +++ b/drivers/spi/ti_qspi.c
>>> >> @@ -16,6 +16,7 @@
>>> >>  #include 
>>> >>  #include 
>>> >>  #include 
>>> >> +#include 
>>> >>
>>> >>  DECLARE_GLOBAL_DATA_PTR;
>>> >>
>>> >> @@ -118,21 +119,19 @@ static void ti_spi_set_speed(struct ti_qspi_priv 
>>> >> *priv, uint hz)
>>> >> if (!hz)
>>> >> clk_div = 0;
>>> >> else
>>> >> -   clk_div = (priv->fclk / hz) - 1;
>>> >> -
>>> >> -   debug("ti_spi_set_speed: hz: %d, clock divider %d\n", hz, 
>>> >> clk_div);
>>> >> +   clk_div = DIV_ROUND_UP(priv->fclk, hz) - 1;
>>> >>
>>> >> /* disable SCLK */
>>> >> writel(readl(>base->clk_ctrl) & ~QSPI_CLK_EN,
>>> >>>base->clk_ctrl);
>> >
>> > Move this before enable SCLK.

Ok...

> Do send the updated v3 or discusses further, I need to send the release PR?

Sorry for the delay.. Posted v3 with above change.

-- 
Regards
Vignesh
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH v3 1/2] ARM: dts: dra7xx: Update spi-max-frequency for qspi slave node

2016-11-05 Thread Vignesh R
Update the spi-max-frequency property of m25p80 flash slave to match
that of TI QSPI controller node, so that QSPI operations happen at
maximum supported frequency of 76.8MHz.

Signed-off-by: Vignesh R 
Reviewed-by: Jagan Teki 
---

v3: No changes.

 arch/arm/dts/dra7-evm.dts  | 2 +-
 arch/arm/dts/dra72-evm-common.dtsi | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/arm/dts/dra7-evm.dts b/arch/arm/dts/dra7-evm.dts
index fe755c05841d..be36d456206d 100644
--- a/arch/arm/dts/dra7-evm.dts
+++ b/arch/arm/dts/dra7-evm.dts
@@ -505,7 +505,7 @@
spi-max-frequency = <7680>;
m25p80@0 {
compatible = "s25fl256s1","spi-flash";
-   spi-max-frequency = <6400>;
+   spi-max-frequency = <7680>;
reg = <0>;
spi-tx-bus-width = <1>;
spi-rx-bus-width = <4>;
diff --git a/arch/arm/dts/dra72-evm-common.dtsi 
b/arch/arm/dts/dra72-evm-common.dtsi
index b0993e5bf7e0..1e1ca725577f 100644
--- a/arch/arm/dts/dra72-evm-common.dtsi
+++ b/arch/arm/dts/dra72-evm-common.dtsi
@@ -441,7 +441,7 @@
spi-max-frequency = <7680>;
m25p80@0 {
compatible = "s25fl256s1", "spi-flash";
-   spi-max-frequency = <6400>;
+   spi-max-frequency = <7680>;
reg = <0>;
spi-tx-bus-width = <1>;
spi-rx-bus-width = <4>;
-- 
2.10.2

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH v3 2/2] spi: ti_qspi: Fix baudrate divider calculation

2016-11-05 Thread Vignesh R
Fix the divider calculation logic to choose a value so that the
resulting baudrate is either equal to or closest possible baudrate less
than the requested value. While at that, cleanup ti_spi_set_speed().

Signed-off-by: Vignesh R 
---

v3: Move SCLK disable and enable blocks together.
v2: cleanup ti_spi_set_speed() a bit.

 drivers/spi/ti_qspi.c | 16 +++-
 1 file changed, 7 insertions(+), 9 deletions(-)

diff --git a/drivers/spi/ti_qspi.c b/drivers/spi/ti_qspi.c
index 52520dff6325..da0488659049 100644
--- a/drivers/spi/ti_qspi.c
+++ b/drivers/spi/ti_qspi.c
@@ -16,6 +16,7 @@
 #include 
 #include 
 #include 
+#include 
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -118,21 +119,18 @@ static void ti_spi_set_speed(struct ti_qspi_priv *priv, 
uint hz)
if (!hz)
clk_div = 0;
else
-   clk_div = (priv->fclk / hz) - 1;
+   clk_div = DIV_ROUND_UP(priv->fclk, hz) - 1;
+
+   /* truncate clk_div value to QSPI_CLK_DIV_MAX */
+   if (clk_div > QSPI_CLK_DIV_MAX)
+   clk_div = QSPI_CLK_DIV_MAX;
 
debug("ti_spi_set_speed: hz: %d, clock divider %d\n", hz, clk_div);
 
/* disable SCLK */
writel(readl(>base->clk_ctrl) & ~QSPI_CLK_EN,
   >base->clk_ctrl);
-
-   /* assign clk_div values */
-   if (clk_div < 0)
-   clk_div = 0;
-   else if (clk_div > QSPI_CLK_DIV_MAX)
-   clk_div = QSPI_CLK_DIV_MAX;
-
-   /* enable SCLK */
+   /* enable SCLK and program the clk divider */
writel(QSPI_CLK_EN | clk_div, >base->clk_ctrl);
 }
 
-- 
2.10.2

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [bug report] sunxi: booting from eMMC

2016-11-05 Thread Hans de Goede

Hi,

On 04-11-16 23:57, Alexandr Bochkarev wrote:

I have found problem place, this patch with hotfix allows to boot Allwinner A20 
from eMMC.
Dont know how to full fix it.


Maxime posted a proper fix for this issue yesterday:

https://patchwork.ozlabs.org/patch/691284/

Can you give that one a try and see if it fixes things for you
as well ?

Regards,

Hans



commit 9fa5bf30e95ead17eb0c50375b305fb8615427a9
Author: root >
Date:   Sat Nov 5 04:41:30 2016 +0600

allow to boot A20 from eMMC, fix

diff --git a/drivers/mmc/sunxi_mmc.c b/drivers/mmc/sunxi_mmc.c
index 6953acc..87cf964 100644
--- a/drivers/mmc/sunxi_mmc.c
+++ b/drivers/mmc/sunxi_mmc.c
@@ -293,11 +293,17 @@ static int mmc_trans_data_by_cpu(struct mmc *mmc, struct 
mmc_data *data)
 }

 static int mmc_rint_wait(struct mmc *mmc, unsigned int timeout_msecs,
-unsigned int done_bit, const char *what)
+unsigned int done_bit, const char *what, struct 
mmc_cmd *cmd)
 {
struct sunxi_mmc_host *mmchost = mmc->priv;
unsigned int status;

+   if (cmd->cmdidx == MMC_CMD_SWITCH)
+   {
+   printf("mmc_rint_wait: fix me\n");
+   return 0;
+   }
+
do {
status = readl(>reg->rint);
if (!timeout_msecs-- ||
@@ -380,7 +386,7 @@ static int sunxi_mmc_send_cmd(struct mmc *mmc, struct 
mmc_cmd *cmd,
}
}

-   error = mmc_rint_wait(mmc, 1000, SUNXI_MMC_RINT_COMMAND_DONE, "cmd");
+   error = mmc_rint_wait(mmc, 1000, SUNXI_MMC_RINT_COMMAND_DONE, "cmd", 
cmd);
if (error)
goto out;

@@ -391,7 +397,7 @@ static int sunxi_mmc_send_cmd(struct mmc *mmc, struct 
mmc_cmd *cmd,
  data->blocks > 1 ?
  SUNXI_MMC_RINT_AUTO_COMMAND_DONE :
  SUNXI_MMC_RINT_DATA_OVER,
- "data");
+ "data", cmd);
if (error)
goto out;
}




___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot