Re: [U-Boot] [linux-sunxi] [PATCH v2 00/13] Allwinner H6 support (w/ SPL)

2018-07-26 Thread Jagan Teki
On Sat, Jul 21, 2018 at 1:50 PM, Icenowy Zheng  wrote:
> This patchset trys to add support for Allwinner H6 SoC to U-Boot.
>
> Allwinner H6 is a quite new Allwinner SoC, with several parts changed a
> lot (memory map, DRAM controller, CCU, so on). The position which SPL
> will be loaded (SRAM A1) also changed to 0x2.
>
> The Pine H64 board support comes with this patchset, as this is the
> first H6 board that I can get (being early bird).
>
> Icenowy Zheng (13):
>   sunxi: change SUNXI_HIGH_SRAM option to SUNXI_SRAM_ADDRESS
>   sunxi: add basic memory map definitions of H6 SoC
>   sunxi: change RMR64's RVBAR address for H6
>   sunxi: change ATF position for H6
>   sunxi: add config for SPL at 0x2 on H6
>   sunxi: change GIC address on H6
>   sunxi: add clock code for H6
>   sunxi: use sun6i-style watchdog for H6
>   sunxi: add UART0 setup for H6
>   sunxi: add MMC support for H6
>   sunxi: add DRAM support to H6
>   sunxi: add support for Allwinner H6 SoC
>   sunxi: add support for Pine H64 board

Observing SPL hang during relocation switch to board_init_r with
orangepi board[1], will pine boot? look like both seem similar LPDDR3
configs atleast from schematics.

U-Boot SPL 2018.07-00382-g2e8302784f-dirty (Jul 26 2018 - 12:13:35 +0530)
DRAM: 1024 MiB
sunxi_board_init...done!

[1] http://linux-sunxi.org/Xunlong_Orange_Pi_One_Plus
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [linux-sunxi] [PATCH v2 00/13] Allwinner H6 support (w/ SPL)

2018-07-26 Thread Icenowy Zheng


于 2018年7月26日 GMT+08:00 下午3:02:50, Jagan Teki  写到:
>On Sat, Jul 21, 2018 at 1:50 PM, Icenowy Zheng  wrote:
>> This patchset trys to add support for Allwinner H6 SoC to U-Boot.
>>
>> Allwinner H6 is a quite new Allwinner SoC, with several parts changed
>a
>> lot (memory map, DRAM controller, CCU, so on). The position which SPL
>> will be loaded (SRAM A1) also changed to 0x2.
>>
>> The Pine H64 board support comes with this patchset, as this is the
>> first H6 board that I can get (being early bird).
>>
>> Icenowy Zheng (13):
>>   sunxi: change SUNXI_HIGH_SRAM option to SUNXI_SRAM_ADDRESS
>>   sunxi: add basic memory map definitions of H6 SoC
>>   sunxi: change RMR64's RVBAR address for H6
>>   sunxi: change ATF position for H6
>>   sunxi: add config for SPL at 0x2 on H6
>>   sunxi: change GIC address on H6
>>   sunxi: add clock code for H6
>>   sunxi: use sun6i-style watchdog for H6
>>   sunxi: add UART0 setup for H6
>>   sunxi: add MMC support for H6
>>   sunxi: add DRAM support to H6
>>   sunxi: add support for Allwinner H6 SoC
>>   sunxi: add support for Pine H64 board
>
>Observing SPL hang during relocation switch to board_init_r with
>orangepi board[1], will pine boot? look like both seem similar LPDDR3
>configs atleast from schematics.

Use v2.1 DRAM patch.

>
>U-Boot SPL 2018.07-00382-g2e8302784f-dirty (Jul 26 2018 - 12:13:35
>+0530)
>DRAM: 1024 MiB
>sunxi_board_init...done!
>
>[1] http://linux-sunxi.org/Xunlong_Orange_Pi_One_Plus
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH v2 1/8] Enable CONFIG_BLK and CONFIG_DM_MMC to Kconfig

2018-07-26 Thread Yinbo Zhu


-Original Message-
From: York Sun 
Sent: 2018年7月17日 22:52
To: Yinbo Zhu ; u-boot@lists.denx.de
Cc: Y.b. Lu ; Xiaobo Xie 
Subject: Re: [PATCH v2 1/8] Enable CONFIG_BLK and CONFIG_DM_MMC to Kconfig

On 07/17/2018 03:50 AM, Yinbo Zhu wrote:
> 
> 
> -Original Message-
> From: York Sun
> Sent: 2018年7月9日 23:50
> To: Yinbo Zhu ; u-boot@lists.denx.de
> Cc: Y.b. Lu ; Xiaobo Xie 
> Subject: Re: [PATCH v2 1/8] Enable CONFIG_BLK and CONFIG_DM_MMC to 
> Kconfig
> 
> On 07/08/2018 09:46 PM, Yinbo Zhu wrote:
>> This enables the folowing to Kconfig:
>>  CONFIG_BLK
>>  CONFIG_DM_MMC
> 
>> The order of patches seems wrong. Don't you need patch 2 & 3 before enabling 
>> these options?
> 
>> York
> 
> HI York,
> 
> Thanks your feedback! And the patch 1 is applied then that it reported some 
> compiled error, so add patch 

>2 to fix compile error, and I will only put the patch 3 in front of patch 1, 
>Do you think that's okay?

>Every single patch must be successfully compiled. U-Boot must be functional, 
>too. Otherwise, you will face 

>problem when you try to bisect an issue.

>York

Hi York

I had updated the patch order, Could you give me a feedback?
http://patchwork.ozlabs.org/project/uboot/list/?series=&submitter=71513&state=*&q=&archive=both&delegate=

Thanks,
Yinbo
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH] Makefile: Fix make clean with DocBook

2018-07-26 Thread Jagan Teki
doc/DocBook has removed in below commit
"doc: Replace DocBook with sphinx-based docs"
(sha1: 78a88f7930becb78afef09c1237a8e4edc1b01e1)

and missed to remove it from clean-dirs, otherwise
'make clean' shows an error as below.

$ make clean
scripts/Makefile.clean:15: doc/DocBook/Makefile: No such file or directory
make[1]: *** No rule to make target 'doc/DocBook/Makefile'.  Stop.
Makefile:1610: recipe for target '_clean_doc/DocBook' failed
make: *** [_clean_doc/DocBook] Error 2

Cc: Mario Six 
Signed-off-by: Jagan Teki 
---
 Makefile | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/Makefile b/Makefile
index d1246e063f..5224c34c96 100644
--- a/Makefile
+++ b/Makefile
@@ -1603,7 +1603,7 @@ clean: rm-files := $(CLEAN_FILES)
 
 clean-dirs := $(foreach f,$(u-boot-alldirs),$(if $(wildcard 
$(srctree)/$f/Makefile),$f))
 
-clean-dirs  := $(addprefix _clean_, $(clean-dirs) doc/DocBook)
+clean-dirs  := $(addprefix _clean_, $(clean-dirs))
 
 PHONY += $(clean-dirs) clean archclean
 $(clean-dirs):
@@ -1685,7 +1685,6 @@ help:
@echo  '  coccicheck  - Execute static code analysis with 
Coccinelle'
@echo  ''
@echo  'Documentation targets:'
-   @$(MAKE) -f $(srctree)/doc/DocBook/Makefile dochelp
@echo  ''
@echo  '  make V=0|1 [targets] 0 => quiet build (default), 1 => verbose 
build'
@echo  '  make V=2   [targets] 2 => give reason for rebuild of target'
-- 
2.17.1

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


Re: [U-Boot] [PATCH v4 00/27] SPI-NAND support

2018-07-26 Thread Miquel Raynal
Hi Jagan,

Jagan Teki  wrote on Thu, 26 Jul 2018
11:00:56 +0530:

> On Fri, Jul 13, 2018 at 6:01 PM, Miquel Raynal
>  wrote:
> > During the last months, Boris Brezillon shared his work to support
> > serial flashes within Linux. First, he delivered (and merged) a new
> > layer called spi-mem. He also initiated in Linux MTD subsystem the move
> > of all 'raw' NAND related code to a raw/ subdirectory, adding at the
> > same time a NAND core that would be shared with all NAND devices. Then,
> > he contributed a generic SPI-NAND driver, making use of this NAND core,
> > as well as some vendor code to drive a few chips.
> >
> > On top of this work, I added an 'mtd' U-Boot command to handle all sort
> > of MTD devices. This should become the default command instead of having
> > one per flash flavor ('sf', 'nand', 'spi-nand' ?).
> >
> > The series has been tested on an Ocelot board PCB123 (VSC7514),
> > featuring a Macronix SPI NAND chip.
> >
> > TL;DR: the series contains:
> > - A few patches from Linux to resynchronize some areas of the MTD layer.
> > - Various fixes and re-organization of the MTD subsystem.
> > - The introduction of the SPI-mem interface.
> > - The addition of the generic SPI-NAND driver (and its bindings).
> > - Several SPI NAND chip drivers (Macronix, Micron, Winbond).
> > - A new 'mtd' command.
> > - Support for spi-nand devices in mtdparts.
> >
> > To test your SPI-NAND device with U-Boot simply follow these lines:
> >  
> >> setenv mtdparts mtdparts=spi-nand0:1m(foo),-(bar)
> >> setenv mtdids spi-nand0=spi-nand0
> >> mtdparts # show the spi-nand device partitions
> >> ubi part bar # create a static UBI volume in the bar partition  
> >
> > Thanks,
> > Miquèl
> >
> > Changes since v3:
> > -
> > * Fixed the debug messages in spi-mem to print either Rx or Tx data.
> > * Fixed a Kconfig error that prevented to build mtdparts with plain
> >   defconfig.
> > * Fixed a compilation error due to the above error that prevented one
> >   file to be compiled.
> > * Adapted the mtd command to probe MTD partitions also.
> > * Declared mtd_probe_devices() in a header so mtdparts or UBI could
> >   use it too (to probe all devices and MTD partitions in a clean way).
> > * As I worked on mtdparts, I found annoying and completely useless the
> >   fact that we need to prefix the environment variable with
> >   "mtdparts=". Canceled this obligation.
> > * Added one patch to allow spi-nand devices to be recognized by mtdparts
> >   (this is purely useless but needed to be done in order to use this
> >   command).
> > * Removed useless definitions of MTD device types in UBI code.
> > * Wrote a generic mtdparts environment variable parser, used by the mtd
> >   command.
> > * Used the mtd_probe_devices() function from get_mtd_info() in
> >   cmd/mtdparts.c to be sure the desired partition really does not exist
> >   (otherwise it will be probed and then found).
> >
> > Changes since v2:
> > -
> > * Rebased on u-boot master branch.
> > * Removed extra-parenthesis in
> >   "mtd: Fallback to ->_read/write() when ->_read/write_oob() is missing"
> > * s/fiels/files/ in "mtd: move NAND fiels into a raw/ subdirectory"
> > * Do not describe generic SPI device properties in SPI NAND bindings.
> > * Changes in the mtd command:
> >   * Printing more information in 'mtd list' (device type, device
> > characteristics)
> >   * Switch to do_div() instead of '(u32)value64b % value32b' which only
> > worked because value32b was a power of 2.
> >   * Removed erase.chip option.
> >   * By default, erase/read/write happen on the full MTD device while a
> > dump will only work on a single page.
> >
> > Changes since v1:
> > -
> > * Fixed the nand_memorg structure of the MX35LF2GE4AB chip.
> > * Added Reviewed-by tags from Jagan.
> > * Backported and squashed two patches fixing things in the SPI NAND core
> >   received on the Linux ML.
> > * Backported more changes in mtdcore.c from Linux.
> > * Added a patch to add a fallback on mtd->_read/_write() in mtdcore.c
> >   when mtd->_read/write_oob() is not supported.
> > * Removed the DT changes, useless as the DTs are not available in
> >   mainline yet.
> > * Addressed Boris/Stefan comments on the 'mtd' command.
> > * Added support for multi-pages OOB read/write.
> >
> >
> > Boris Brezillon (7):
> >   mtd: Fallback to ->_read/write_oob() when ->_read/write() is missing
> >   mtd: Add sanity checks in mtd_write/read_oob()
> >   mtd: nand: Add core infrastructure to deal with NAND devices
> >   mtd: nand: Pass mode information to nand_page_io_req
> >   spi: Extend the core to ease integration of SPI memory controllers
> >   mtd: spinand: Add initial support for the MX35LF1GE4AB chip
> >   dt-bindings: Add bindings for SPI NAND devices
> >
> > Brian Norris (1):
> >   mtd: add get/set of_node/flash_node helpers
> >
> > Ezequiel Garcia (1):
> >   mtd: Uninline mtd_write_oob and move it to mtdcore.c
> >
> > F

[U-Boot] [PULL] u-boot-sh/master

2018-07-26 Thread Marek Vasut
The following changes since commit 323a73adc9a1bf2de43fe03bdd9c3038ce7c2784:

  mtd: nand: add new enum for storing ECC algorithm (2018-07-23 14:33:21
-0400)

are available in the Git repository at:

  git://git.denx.de/u-boot-sh.git master

for you to fetch changes up to a6759e3dfca217ba8cc518edcd4972671a97109a:

  ARM: rmobile: gen2: Enable ACTLR[0] (Enable invalidates of BTB) to
facilitate CVE_2017-5715 WA in OS (2018-07-25 00:14:19 +0200)


Marek Vasut (1):
  ARM: rmobile: gen2: Enable ACTLR[0] (Enable invalidates of BTB) to
facilitate CVE_2017-5715 WA in OS

 arch/arm/mach-rmobile/Kconfig.32 | 4 
 1 file changed, 4 insertions(+)
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PULL] u-boot-usb/master

2018-07-26 Thread Marek Vasut
The following changes since commit 323a73adc9a1bf2de43fe03bdd9c3038ce7c2784:

  mtd: nand: add new enum for storing ECC algorithm (2018-07-23 14:33:21
-0400)

are available in the Git repository at:

  git://git.denx.de/u-boot-usb.git master

for you to fetch changes up to 67f1c59f40fde73cb2cbb51ebf0a05156ec403b7:

  usb: dwc3: convert to livetree (2018-07-25 00:13:44 +0200)


Alberto Panizzo (7):
  usb: rockchip: fix command failed on host side due to missing data
  usb: rockchip: implement skeleton for K_FW_GET_CHIP_VER command
  usb: rockchip: implement K_FW_LBA_READ_10 command
  usb: rockchip: implement K_FW_LBA_ERASE_10 command
  usb: rockchip: be quiet on serial port while transferring data
  usb: rockchip: fix printing csw debug info
  usb: rockchip: on K_FW_LBA_WRITE_10 remove magic block size of 512
bytes

Sam Protsenko (3):
  dfu: Fix data abort in dfu_free_entities()
  dfu: Fix memory leak in dfu_init_env_entities()
  dfu: Provide more verbose error message

Seung-Woo Kim (1):
  gadget: f_thor: fix hang-up with ctrl-c

Vipul Kumar (1):
  usb: dwc3: convert to livetree

 arch/arm/include/asm/arch-rockchip/f_rockusb.h |   4 +++
 doc/README.rockusb |  11 --
 drivers/dfu/dfu.c  |  10 +++---
 drivers/usb/common/common.c|  11 +++---
 drivers/usb/dwc3/dwc3-generic.c|  17 --
 drivers/usb/gadget/f_rockusb.c | 261
+++-
 drivers/usb/gadget/f_thor.c|   4 +--
 drivers/usb/host/xhci-dwc3.c   |   3 +-
 drivers/usb/host/xhci-zynqmp.c |   3 +-
 include/linux/usb/otg.h|   6 ++--
 10 files changed, 276 insertions(+), 54 deletions(-)
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PULL] u-boot-socfpga/master

2018-07-26 Thread Marek Vasut
The following changes since commit 323a73adc9a1bf2de43fe03bdd9c3038ce7c2784:

  mtd: nand: add new enum for storing ECC algorithm (2018-07-23 14:33:21
-0400)

are available in the Git repository at:

  git://git.denx.de/u-boot-socfpga.git master

for you to fetch changes up to 64eeb1585428b71e29022e22d1aae86b65b9e052:

  ARM: dts: socfpga: Adjust NAND register layout on Arria10 (2018-07-25
00:13:32 +0200)


Ley Foon Tan (1):
  arm: socfpga: Fixes: Rename CONFIG_SPL_RESET_SUPPORT to
CONFIG_SPL_DM_RESET

Marek Vasut (3):
  ARM: socfpga: Assure correct CPACR configuration
  ARM: socfpga: Init missing security policies on A10
  ARM: dts: socfpga: Adjust NAND register layout on Arria10

 arch/arm/Kconfig |  2 +-
 arch/arm/dts/socfpga_arria10.dtsi|  4 ++--
 arch/arm/mach-socfpga/board.c|  4 +++-
 arch/arm/mach-socfpga/misc_arria10.c | 13 +
 4 files changed, 19 insertions(+), 4 deletions(-)
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH 0/3] Example of using generic FS loader with FPGA manager

2018-07-26 Thread tien . fong . chee
From: Tien Fong Chee 

The purpose of this patchset provides example of using the generic FS loader
which is currently under review at
/data/tfchee/a10_upstreaming/mainstream/17_1_18/patches/firmware_loader_usage .

Basically, the whole machanism is working in two ways:
1. SPL -> spl_board_init -> fpga_fsload -> socfpga_loadfs -> fs_flash_preinit(
process rbf mkimage header with loader) -> init FPGA -> chunk by
chunk to program FPGA using loader

The patchset include this :
2. U-Boot console -> fpga loadfs command -> fpga_fsload -> socfpga_loadfs -> 
fs_flash_preinit(process rbf mkimage header with loader) -> init FPGA ->
chunk by chunk to program FPGA using loader

Tien Fong Chee (3):
  ARM: socfpga: Add FPGA drivers for Arria 10 FPGA loadfs
  enable fpga loadfs
  arm: socfpga: Add Arria 10 SoCFPGA programming interface

 arch/arm/dts/socfpga_arria10.dtsi  |   12 +
 arch/arm/dts/socfpga_arria10_socdk_sdmmc.dts   |6 +
 .../include/mach/fpga_manager_arria10.h|   22 +
 cmd/fpga.c |2 +-
 configs/socfpga_arria10_defconfig  |   12 +
 drivers/fpga/altera.c  |   41 ++-
 drivers/fpga/fpga.c|8 +
 drivers/fpga/socfpga_arria10.c |  402 
 include/altera.h   |6 +
 include/fpga.h |2 +
 10 files changed, 504 insertions(+), 9 deletions(-)

-- 
1.7.7.4

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


[U-Boot] [PATCH 1/3] ARM: socfpga: Add FPGA drivers for Arria 10 FPGA loadfs

2018-07-26 Thread tien . fong . chee
From: Tien Fong Chee 

Add FPGA drivers to support FPGA loadfs to program FPGA.
The drivers are designed based on generic firmware loader framework,
specific firmware loader handling is defined in fpga_manager_arria10.c.
These drivers can handle FPGA program operation from
loading RBF image in flash to memory and then to program FPGA.

Signed-off-by: Tien Fong Chee 
---
 .../include/mach/fpga_manager_arria10.h|   22 +
 drivers/fpga/socfpga_arria10.c |  402 
 include/altera.h   |4 +
 3 files changed, 428 insertions(+), 0 deletions(-)

diff --git a/arch/arm/mach-socfpga/include/mach/fpga_manager_arria10.h 
b/arch/arm/mach-socfpga/include/mach/fpga_manager_arria10.h
index a112453..743d6b7 100644
--- a/arch/arm/mach-socfpga/include/mach/fpga_manager_arria10.h
+++ b/arch/arm/mach-socfpga/include/mach/fpga_manager_arria10.h
@@ -7,6 +7,9 @@
 #ifndef _FPGA_MANAGER_ARRIA10_H_
 #define _FPGA_MANAGER_ARRIA10_H_
 
+#include 
+#include 
+
 #define ALT_FPGAMGR_IMGCFG_STAT_F2S_CRC_ERROR_SET_MSK  BIT(0)
 #define ALT_FPGAMGR_IMGCFG_STAT_F2S_EARLY_USERMODE_SET_MSK BIT(1)
 #define ALT_FPGAMGR_IMGCFG_STAT_F2S_USERMODE_SET_MSK   BIT(2)
@@ -88,6 +91,25 @@ struct socfpga_fpga_manager {
u32  imgcfg_fifo_status;
 };
 
+#if defined(CONFIG_CMD_FPGA_LOADFS)
+enum rbf_type {unknown, periph_section, core_section};
+enum rbf_security {invalid, unencrypted, encrypted};
+
+struct rbf_info {
+   enum rbf_type section;
+   enum rbf_security security;
+};
+
+struct fpga_info {
+   char *filename;
+   int fstype;
+   u32 remaining;
+   u32 offset;
+   struct rbf_info rbfinfo;
+   struct image_header header;
+};
+#endif
+
 /* Functions */
 int fpgamgr_program_init(u32 * rbf_data, size_t rbf_size);
 int fpgamgr_program_finish(void);
diff --git a/drivers/fpga/socfpga_arria10.c b/drivers/fpga/socfpga_arria10.c
index c0252fb..2f9006f 100644
--- a/drivers/fpga/socfpga_arria10.c
+++ b/drivers/fpga/socfpga_arria10.c
@@ -12,6 +12,13 @@
 #include 
 #include 
 #include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
 #include 
 #include 
 
@@ -21,6 +28,12 @@
 #define COMPRESSION_OFFSET 229
 #define FPGA_TIMEOUT_MSEC  1000  /* timeout in ms */
 #define FPGA_TIMEOUT_CNT   0x100
+#define RBF_UNENCRYPTED0xa65c
+#define RBF_ENCRYPTED  0xa65d
+#define ARRIA10RBF_PERIPH  0x0001
+#define ARRIA10RBF_CORE0x8001
+#define PERIPH_RBF 0
+#define CORE_RBF   1
 
 static const struct socfpga_fpga_manager *fpga_manager_base =
(void *)SOCFPGA_FPGAMGRREGS_ADDRESS;
@@ -30,6 +43,8 @@ static const struct socfpga_system_manager 
*system_manager_base =
 
 static void fpgamgr_set_cd_ratio(unsigned long ratio);
 
+struct firmware *fw = NULL;
+
 static uint32_t fpgamgr_get_msel(void)
 {
u32 reg;
@@ -471,3 +486,390 @@ int socfpga_load(Altera_desc *desc, const void *rbf_data, 
size_t rbf_size)
 
return fpgamgr_program_finish();
 }
+
+#if defined(CONFIG_CMD_FPGA_LOADFS)
+const char *get_fpga_filename(const void *fdt, int *len, u32 core)
+{
+   const char *fpga_filename = NULL;
+   const char *cell;
+   int nodeoffset;
+
+   nodeoffset = fdtdec_next_compatible(fdt, 0,
+COMPAT_ALTERA_SOCFPGA_FPGA0);
+   if (nodeoffset >= 0) {
+   if (core) {
+   cell = fdt_getprop(fdt,
+   nodeoffset,
+   "altr,bitstream_core",
+   len);
+   }
+   else {
+   cell = fdt_getprop(fdt, nodeoffset,
+   "altr,bitstream_periph", len);
+   }
+
+   if (cell)
+   fpga_filename = cell;
+   }
+
+   return fpga_filename;
+}
+
+void get_rbf_image_info(struct rbf_info *rbf, u16 *buffer)
+{
+   /*
+* Magic ID starting at:
+* -> 1st dword in periph.rbf
+* -> 2nd dword in core.rbf
+*/
+   u32 word_reading_max = 2;
+   u32 i;
+
+   for (i = 0; i < word_reading_max; i++) {
+   if (*(buffer + i) == RBF_UNENCRYPTED) { /* PERIPH RBF */
+   rbf->security = unencrypted;
+   }
+   else if (*(buffer + i) == RBF_ENCRYPTED) {
+   rbf->security = encrypted;
+   }
+   else if (*(buffer + i + 1) == RBF_UNENCRYPTED) { /* CORE RBF */
+   rbf->security = unencrypted;
+   }
+   else if (*(buffer + i + 1) == RBF_ENCRYPTED) {
+   rbf->security = encrypted;
+   }
+   else {
+   rbf->security = invalid;
+   continue;
+   }
+
+   /* PERIPH RBF(buffer + i + 1), CORE 

[U-Boot] [PATCH 3/3] arm: socfpga: Add Arria 10 SoCFPGA programming interface

2018-07-26 Thread tien . fong . chee
From: Tien Fong Chee 

Add code necessary into the FPGA driver framework in U-Boot
so it can be used via the 'fpga' command for programing Arria 10
SoCFPGA.

Signed-off-by: Tien Fong Chee 
---
 cmd/fpga.c|2 +-
 drivers/fpga/altera.c |   41 +
 drivers/fpga/fpga.c   |8 
 include/altera.h  |2 ++
 include/fpga.h|2 ++
 5 files changed, 46 insertions(+), 9 deletions(-)

diff --git a/cmd/fpga.c b/cmd/fpga.c
index 14ad4e5..207cec3 100644
--- a/cmd/fpga.c
+++ b/cmd/fpga.c
@@ -362,7 +362,7 @@ U_BOOT_CMD(fpga, 6, 1, do_fpga,
   "(Xilinx only)\n"
 #endif
 #if defined(CONFIG_CMD_FPGA_LOADFS)
-  "Load device from filesystem (FAT by default) (Xilinx only)\n"
+  "Load device from filesystem (FAT by default)\n"
   "  loadfs [dev] [address] [image size] [blocksize] \n"
   "[] \n"
 #endif
diff --git a/drivers/fpga/altera.c b/drivers/fpga/altera.c
index 9605554..3c9474c 100644
--- a/drivers/fpga/altera.c
+++ b/drivers/fpga/altera.c
@@ -12,6 +12,7 @@
  */
 #include 
 #include 
+#include  /* altera specific definitions */
 #include 
 #include 
 
@@ -22,25 +23,31 @@ static const struct altera_fpga {
enum altera_family  family;
const char  *name;
int (*load)(Altera_desc *, const void *, size_t);
+   int (*loadfs)(Altera_desc *, const void *, size_t, fpga_fs_info *);
int (*dump)(Altera_desc *, const void *, size_t);
int (*info)(Altera_desc *);
 } altera_fpga[] = {
 #if defined(CONFIG_FPGA_ACEX1K)
-   { Altera_ACEX1K, "ACEX1K", ACEX1K_load, ACEX1K_dump, ACEX1K_info },
-   { Altera_CYC2,   "ACEX1K", ACEX1K_load, ACEX1K_dump, ACEX1K_info },
+   { Altera_ACEX1K, "ACEX1K", ACEX1K_load, NULL, ACEX1K_dump,
+ACEX1K_info },
+   { Altera_CYC2,   "ACEX1K", ACEX1K_load, NULL, ACEX1K_dump,
+ACEX1K_info },
 #elif defined(CONFIG_FPGA_CYCLON2)
-   { Altera_ACEX1K, "CycloneII", CYC2_load, CYC2_dump, CYC2_info },
-   { Altera_CYC2,   "CycloneII", CYC2_load, CYC2_dump, CYC2_info },
+   { Altera_ACEX1K, "CycloneII", CYC2_load, NULL, CYC2_dump, CYC2_info },
+   { Altera_CYC2,   "CycloneII", CYC2_load, NULL, CYC2_dump, CYC2_info },
 #endif
 #if defined(CONFIG_FPGA_STRATIX_II)
-   { Altera_StratixII, "StratixII", StratixII_load,
+   { Altera_StratixII, "StratixII", StratixII_load, NULL,
  StratixII_dump, StratixII_info },
 #endif
 #if defined(CONFIG_FPGA_STRATIX_V)
-   { Altera_StratixV, "StratixV", stratixv_load, NULL, NULL },
+   { Altera_StratixV, "StratixV", stratixv_load, NULL, NULL, NULL },
 #endif
-#if defined(CONFIG_FPGA_SOCFPGA)
-   { Altera_SoCFPGA, "SoC FPGA", socfpga_load, NULL, NULL },
+#if defined(CONFIG_FPGA_SOCFPGA) && defined(CONFIG_CMD_FPGA_LOADFS)
+   { Altera_SoCFPGA, "SoC FPGA", socfpga_load, socfpga_loadfs, NULL,
+NULL },
+#elif defined(CONFIG_FPGA_SOCFPGA)
+   { Altera_SoCFPGA, "SoC FPGA", socfpga_load, NULL, NULL, NULL },
 #endif
 };
 
@@ -173,3 +180,21 @@ int altera_info(Altera_desc *desc)
 
return FPGA_SUCCESS;
 }
+
+#if defined(CONFIG_CMD_FPGA_LOADFS)
+int altera_loadfs(Altera_desc *desc, const void *buf, size_t bsize,
+  fpga_fs_info *fpga_fsinfo)
+{
+   const struct altera_fpga *fpga = altera_desc_to_fpga(desc, __func__);
+
+   if (!fpga)
+   return FPGA_FAIL;
+
+   debug_cond(FPGA_DEBUG, "%s: Launching the %s FS Loader...\n",
+  __func__, fpga->name);
+   if (fpga->loadfs)
+   return fpga->loadfs(desc, buf, bsize, fpga_fsinfo);
+
+   return -EINVAL;
+}
+#endif
diff --git a/drivers/fpga/fpga.c b/drivers/fpga/fpga.c
index 55bdf9e..67b772d 100644
--- a/drivers/fpga/fpga.c
+++ b/drivers/fpga/fpga.c
@@ -207,6 +207,14 @@ int fpga_fsload(int devnum, const void *buf, size_t size,
fpga_no_sup((char *)__func__, "Xilinx devices");
 #endif
break;
+#if defined(CONFIG_FPGA_ALTERA)
+   case fpga_altera:
+   ret_val = altera_loadfs(desc->devdesc, buf, size,
+   fpga_fsinfo);
+#else
+   fpga_no_sup((char *)__func__, "Altera devices");
+#endif
+   break;
default:
printf("%s: Invalid or unsupported device type %d\n",
   __func__, desc->devtype);
diff --git a/include/altera.h b/include/altera.h
index cf0c021..b641b8a 100644
--- a/include/altera.h
+++ b/include/altera.h
@@ -114,6 +114,8 @@ typedef struct {
 
 #ifdef CONFIG_FPGA_SOCFPGA
 int socfpga_load(Altera_desc *desc, const void *rbf_data, size_t rbf_size);
+int socfpga_loadfs(Altera_desc *desc, const void *buf, size_t bsize,
+  fpga_fs_info *fpga_fsinfo);
 #endif
 
 #ifdef CONFIG_FPGA_STRATIX_V
diff

[U-Boot] [PATCH 2/3] enable fpga loadfs

2018-07-26 Thread tien . fong . chee
From: Tien Fong Chee 

Signed-off-by: Tien Fong Chee 
---
 arch/arm/dts/socfpga_arria10.dtsi|   12 
 arch/arm/dts/socfpga_arria10_socdk_sdmmc.dts |6 ++
 configs/socfpga_arria10_defconfig|   12 
 3 files changed, 30 insertions(+), 0 deletions(-)

diff --git a/arch/arm/dts/socfpga_arria10.dtsi 
b/arch/arm/dts/socfpga_arria10.dtsi
index b51febd..45aef6a 100644
--- a/arch/arm/dts/socfpga_arria10.dtsi
+++ b/arch/arm/dts/socfpga_arria10.dtsi
@@ -48,6 +48,12 @@
  <0xc100 0x100>;
};
 
+   fs_loader0: fs-loader@0 {
+   u-boot,dm-pre-reloc;
+   compatible = "u-boot,fs-loader";
+   phandlepart = <&mmc 1>;
+   };
+
soc {
#address-cells = <1>;
#size-cells = <1>;
@@ -532,12 +538,18 @@
};
 
fpga_mgr: fpga-mgr@ffd03000 {
+   u-boot,dm-pre-reloc;
compatible = "altr,socfpga-a10-fpga-mgr";
reg = <0xffd03000 0x100
   0xffcfe400 0x20>;
clocks = <&l4_mp_clk>;
resets = <&rst FPGAMGR_RESET>;
reset-names = "fpgamgr";
+   altr,bitstream_periph =
+"ghrd_10as066n2.periph.rbf.mkimage";
+   altr,bitstream_core =
+"ghrd_10as066n2.core.rbf.mkimage";
+   altr,bitstream_devpart = "0:1";
};
 
i2c0: i2c@ffc02200 {
diff --git a/arch/arm/dts/socfpga_arria10_socdk_sdmmc.dts 
b/arch/arm/dts/socfpga_arria10_socdk_sdmmc.dts
index 9c6070d..4b9705b 100644
--- a/arch/arm/dts/socfpga_arria10_socdk_sdmmc.dts
+++ b/arch/arm/dts/socfpga_arria10_socdk_sdmmc.dts
@@ -18,6 +18,12 @@
 /dts-v1/;
 #include "socfpga_arria10_socdk.dtsi"
 
+/ {
+   chosen {
+   firmware-loader = &fs_loader0;
+   };
+};
+
 &mmc {
u-boot,dm-pre-reloc;
status = "okay";
diff --git a/configs/socfpga_arria10_defconfig 
b/configs/socfpga_arria10_defconfig
index f24ea77..675f4da 100644
--- a/configs/socfpga_arria10_defconfig
+++ b/configs/socfpga_arria10_defconfig
@@ -4,6 +4,8 @@ CONFIG_SYS_TEXT_BASE=0x0140
 CONFIG_SYS_MALLOC_F_LEN=0x8000
 CONFIG_TARGET_SOCFPGA_ARRIA10_SOCDK=y
 CONFIG_SPL=y
+CONFIG_HUSH_PARSER=y
+CONFIG_CMD_PART=y
 CONFIG_IDENT_STRING="socfpga_arria10"
 CONFIG_DEFAULT_DEVICE_TREE="socfpga_arria10_socdk_sdmmc"
 CONFIG_DISTRO_DEFAULTS=y
@@ -18,6 +20,8 @@ CONFIG_SYS_CONSOLE_IS_IN_ENV=y
 CONFIG_SYS_CONSOLE_OVERWRITE_ROUTINE=y
 CONFIG_SYS_CONSOLE_ENV_OVERWRITE=y
 CONFIG_DEFAULT_FDT_FILE="socfpga_arria10_socdk_sdmmc.dtb"
+# CONFIG_OF_LIVE=y
+CONFIG_SPL_DRIVERS_MISC_SUPPORT=y
 CONFIG_VERSION_VARIABLE=y
 CONFIG_DISPLAY_BOARDINFO_LATE=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x800
@@ -39,12 +43,20 @@ CONFIG_CMD_EXT4_WRITE=y
 CONFIG_MTDIDS_DEFAULT="nor0=ff705000.spi.0"
 CONFIG_OF_SPL_REMOVE_PROPS="clocks clock-names interrupts interrupt-parent 
dmas dma-names"
 CONFIG_ENV_IS_IN_MMC=y
+CONFIG_SPL_DOS_PARTITION=y
+CONFIG_CMD_FAT=y
 CONFIG_SPL_DM=y
 CONFIG_SPL_DM_SEQ_ALIAS=y
 CONFIG_DFU_MMC=y
 CONFIG_FPGA_SOCFPGA=y
 CONFIG_DM_GPIO=y
 CONFIG_DWAPB_GPIO=y
+CONFIG_FS_LOADER=y
+CONFIG_SPL_DM_MMC=y
+CONFIG_SPL_MMC_SUPPORT=y
+CONFIG_FPGA=y
+CONFIG_FPGA_ALTERA=y
+CONFIG_CMD_FPGA_LOADFS=y
 CONFIG_SYS_I2C_DW=y
 CONFIG_DM_MMC=y
 CONFIG_MMC_DW=y
-- 
1.7.7.4

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


Re: [U-Boot] [PATCH 2/3] enable fpga loadfs

2018-07-26 Thread Marek Vasut
On 07/26/2018 09:54 AM, tien.fong.c...@intel.com wrote:
> From: Tien Fong Chee 
> 
> Signed-off-by: Tien Fong Chee 
> ---
>  arch/arm/dts/socfpga_arria10.dtsi|   12 
>  arch/arm/dts/socfpga_arria10_socdk_sdmmc.dts |6 ++
>  configs/socfpga_arria10_defconfig|   12 
>  3 files changed, 30 insertions(+), 0 deletions(-)
> 
> diff --git a/arch/arm/dts/socfpga_arria10.dtsi 
> b/arch/arm/dts/socfpga_arria10.dtsi
> index b51febd..45aef6a 100644
> --- a/arch/arm/dts/socfpga_arria10.dtsi
> +++ b/arch/arm/dts/socfpga_arria10.dtsi
> @@ -48,6 +48,12 @@
> <0xc100 0x100>;
>   };
>  
> + fs_loader0: fs-loader@0 {
> + u-boot,dm-pre-reloc;
> + compatible = "u-boot,fs-loader";
> + phandlepart = <&mmc 1>;

Which hardware does this describe ?
DT is hardware description ...

> + };
[...]
-- 
Best regards,
Marek Vasut
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [RFC PATCH] gpio: zynq: Setup bank_name to dev->name

2018-07-26 Thread Michal Simek
On 25.7.2018 21:17, Stefan Herbrechtsmeier wrote:
> Hi Michal,
> 
> Am 25.07.2018 um 08:07 schrieb Michal Simek:
>> On 24.7.2018 21:39, Stefan Herbrechtsmeier wrote:
>>> Am 24.07.2018 um 10:37 schrieb Michal Simek:
 On 23.7.2018 20:29, Stefan Herbrechtsmeier wrote:
> Am 23.07.2018 um 11:08 schrieb Michal Simek:
>> On 20.7.2018 21:31, Stefan Herbrechtsmeier wrote:
>>> Am 12.07.2018 um 16:04 schrieb Michal Simek:
 There should be proper bank name setup to distiguish between
 different
 gpio drivers. Use dev->name for it.

 Signed-off-by: Michal Simek 
 ---

  drivers/gpio/zynq_gpio.c | 2 ++
  1 file changed, 2 insertions(+)

 diff --git a/drivers/gpio/zynq_gpio.c b/drivers/gpio/zynq_gpio.c
 index 26f69b1a713f..f793ee5754a8 100644
 --- a/drivers/gpio/zynq_gpio.c
 +++ b/drivers/gpio/zynq_gpio.c
 @@ -337,6 +337,8 @@ static int zynq_gpio_probe(struct udevice *dev)
  struct zynq_gpio_privdata *priv = dev_get_priv(dev);
  struct gpio_dev_priv *uc_priv = dev_get_uclass_priv(dev);
  +    uc_priv->bank_name = dev->name;
 +
  if (priv->p_data)
  uc_priv->gpio_count = priv->p_data->ngpio;
  
>>> Does this not lead to ugly names because the gpio number is
>>> append to
>>> the bank_name? Have you check the "gpio status -a" output?
>> Yes I was checking it. Names are composed together but also just
>> numbers
>> works as before.
>>
>> gpio@ff0a0: input: 0 [ ]
>> gpio@ff0a1: input: 0 [ ]
>> gpio@ff0a2: input: 0 [ ]
>> gpio@ff0a3: input: 0 [ ]
>> gpio@ff0a4: input: 0 [ ]
>> gpio@ff0a5: input: 0 [ ]
>> gpio@ff0a6: input: 0 [ ]
>> gpio@ff0a7: input: 0 [ ]
>> gpio@ff0a8: input: 0 [ ]
>> gpio@ff0a9: input: 0 [ ]
> Do you think that this are meaningful names? It isn't possible to
> separate the device and pin number as well as it mix hex and decimal
> numbers.
>
>> If you know better way how to setup a bank name please let me know
>> but I
>> need to distinguish ps gpio from pl one and for pl we need to know
>> the
>> address.
> I know the use case.
>
> A lot of drivers use the bank_name from the device tree, some drivers
> append an underscore to the bank name and others add the req_seq of
> the
> device to an alphabetic character.
>
>>> Other drivers use the gpio-bank-name from the device tree.
>> I can't see this property inside Linux kernel. If this has been
>> reviewed
>> by dt guys please let me know.
> This property is only used by u-boot. I think it isn't needed by the
> Linux kernel.
 I am happy to use consistent solution but what's that?
>>> Consistent solution between what?
>> all drivers. Name should be composed consistently among all drivers.
>> It means drivers shouldn't add additional "_" in driver code for example.
>>
 Mixing name with hex and int is not nice but adding "_" or something
 else is just a pain in driver code. If this is done in core I am fine
 with that but adding this code to all drivers don't look like generic
 solution at all.
>>> Normally the bank name is an alphabetic character or string. Maybe we
>>> could add the device name to the gpio_lookup_name function and add an
>>> additional optional device name parameter to the gpio command.
>>>
 Using additional u-boot property is not good too.

 I have mentioned in "gpio: xilinx: Convert driver to DM"
 (sha1:10441ec9224d0d269dc512819a32c0785a6338d3)
 that uc-priv->name is completely unused. Maybe this should be dev->name
 and bank_name should be really used for banks.
>>> Isn't the uc-priv->name used for the label of the request?
>> Last time when I looked at it and I didn't see this name listed anywhere
>> in output.
>>
>>
 Then in gpio status -a can be

 Device gpio@a0001000:
 Bank:
 ...

 but not sure how gpio commands will work to address exact pin from
 prompt. Because this is normally working
 gpio toggle gpio@a00010001
>>> With an optional device name this would be:
>>> gpio toggle gpio@a0001000 1
>>>
>>> Alternative the gpio command could support the requested labels:
>>> gpio toggle second-gpio
>> I am open to see this solution. Feel free to invest your time support
>> this but I have no time for that.
> 
> What does this mean?
> 
> I understand that you don't have the time to develop a new common solution.
> 
> But the discussion disappoints me. You misuse the bank name in a poor
> way and decline alternative solutions with additional requirements even
> if they are already used in u-boot.
> 
> The name "gpio@a000100011" for pin 11 of the device gpio@a0001000 isn't
> consistent between the u-boot drivers nor is the name used in

Re: [U-Boot] [U-Boot, 1/2] env: Include bootdelay in environment if negative

2018-07-26 Thread Alex Kiernan
On Fri, Jul 20, 2018 at 11:34 PM Tom Rini  wrote:
>
> On Thu, Jul 05, 2018 at 12:38:15PM +, Alex Kiernan wrote:
>
> > The test for (CONFIG_BOOTDELAY >= 0) has been in U-Boot since the
> > beginning, but the meaning of it has changed over time. Allow the
> > default to be set for any value, including -ve ones. This allows
> > (for example) CONFIG_ENV_IS_NOWHERE to have values for bootdelay in
> > its compiled in environment.
> >
> > The only thing this changes is where the default for bootdelay can be
> > fetched from; before this change you get a compiled in default, after
> > you'll pull it from the default value in the environment, but both values
> > will be the same. Also if there's a value set in the environment then
> > that will take precedence (as before).
> >
> > Signed-off-by: Alex Kiernan 
>
> Applied to u-boot/master, thanks!
>

I've just realised that if you had an existing hardcoded bootdelay= to
cover the case where it wasn't being inserted through env_defaults you
would now end up with two.

However checking there's 6 boards (9 configs) which possibly have this
problem, but none of them have a -ve value for CONFIG_BOOTDELAY. If I
revert this change and then grep out bootdelay from the generated
environments for those configs, 7 have duplicates before this change
(the last two are odroid-c2 and odroid-xu3 which are fine):

cl-som-am57x/uboot.env: bootdelay=2
cl-som-am57x/uboot.env: bootdelay=3
cm_t54/uboot.env: bootdelay=3
cm_t54/uboot.env: bootdelay=3
display5_factory/uboot.env: bootdelay=3
display5_factory/uboot.env: bootdelay=1
display5/uboot.env: bootdelay=2
display5/uboot.env: bootdelay=1
nas220/uboot.env: bootdelay=3
nas220/uboot.env: bootdelay=-1
odroid/uboot.env: bootdelay=2
odroid/uboot.env: bootdelay=0
vinco/uboot.env: bootdelay=3
vinco/uboot.env: bootdelay=0

I don't think there's anything here for me to fix up, but the
maintainers of those boards probably want to figure out which of the
bootdelay values they wanted.

I wonder if we want some QA process off the end of the build (or in
buildman?) which verifies the extracted environment for duplicate
entries.

--
Alex Kiernan
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH 3/4] gpio: xilinx: Not read output values via regs

2018-07-26 Thread Michal Simek
On 25.7.2018 20:21, Stefan Herbrechtsmeier wrote:
> Am 25.07.2018 um 08:39 schrieb Michal Simek:
>> On 24.7.2018 21:56, Stefan Herbrechtsmeier wrote:
>>> Am 24.07.2018 um 12:31 schrieb Michal Simek:
 On 23.7.2018 20:42, Stefan Herbrechtsmeier wrote:
> Am 23.07.2018 um 13:43 schrieb Michal Simek:
>> Reading registers for finding out output value is not working because
>> input value is read instead in case of tristate.
>>
>> Reported-by: Stefan Herbrechtsmeier 
>> Signed-off-by: Michal Simek 
>> ---
>>
>>     drivers/gpio/xilinx_gpio.c | 38
>> +-
>>     1 file changed, 33 insertions(+), 5 deletions(-)
>>
>> diff --git a/drivers/gpio/xilinx_gpio.c b/drivers/gpio/xilinx_gpio.c
>> index 4da9ae114d87..9d3e9379d0e5 100644
>> --- a/drivers/gpio/xilinx_gpio.c
>> +++ b/drivers/gpio/xilinx_gpio.c
>>> [snip]
>>>
>>     +    priv->output_val[bank] = val;
>> +
>>     return val;
>>     };
>>     @@ -441,6 +449,7 @@ static int xilinx_gpio_get_function(struct
>> udevice *dev, unsigned offset)
>>     static int xilinx_gpio_get_value(struct udevice *dev, unsigned
>> offset)
>>     {
>>     struct xilinx_gpio_platdata *platdata =
>> dev_get_platdata(dev);
>> +    struct xilinx_gpio_privdata *priv = dev_get_priv(dev);
>>     int val, ret;
>>     u32 bank, pin;
>>     @@ -451,7 +460,14 @@ static int xilinx_gpio_get_value(struct
>> udevice
>> *dev, unsigned offset)
>>     debug("%s: regs: %lx, gpio: %x, bank %x, pin %x\n", __func__,
>>   (ulong)platdata->regs, offset, bank, pin);
>>     -    val = readl(&platdata->regs->gpiodata + bank * 2);
>> +    if (xilinx_gpio_get_function(dev, offset) == GPIOF_INPUT) {
>> +    debug("%s: Read input value from reg\n", __func__);
>> +    val = readl(&platdata->regs->gpiodata + bank * 2);
>> +    } else {
>> +    debug("%s: Read saved output value\n", __func__);
>> +    val = priv->output_val[bank];
>> +    }
> Why you don't always read the data register? This doesn't work for
> three
> state outputs.
 In three state register every bit/pin is 0 - output, 1 input.
 It means else part is output and I read saved value in
 priv->output_val.
 If pin is setup as INPUT then I need read data reg to find out input
 value.
 Maybe you are commenting something else but please let me know if there
 is any other bug.
>>> What happen if I have an open drain output. Even if the gpio output is 1
>>> the input could read a 0. You driver will always return the output value
>>> and not the real input value. According to the picture in documentation
>>> and my tests a data register write writes the output registers and a
>>> data register read reads the input registers.
>>>
>>> Why should the driver return the desired state (output register) and not
>>> the real state (input register)?
>> First of all thanks for description.
>>
>> I have another example where you have output only and you can't read
>> input because there is no wire.
> 
> Does you mean the all outputs configuration? Does this removes the
> "gpio_io_i" signal from the IP?

I am not sure what synthesis is doing with that unused IP pins but I
would consider as a bug if this is automatically connected together. And
also wasting a logic if there is unused part.
But in Vivado you should be able to setup output pins to and input pins
separately. There are In/Out/Tristate.
If you don't want to deal with external pin you can connect them inside PL.


>> Regarding open drain output.
>>
>> Also this is what it is written in manual:
>> "AXI GPIO Data Register Description"
>> "For each I/O bit programmed as output:
>> • R: Reads to these bits always return zeros"
> 
> This must be a mistake in the documentation. I could read the input value.
> 
> The old driver and the Linux driver always read the register.

In old u-boot driver I see
 179 if (gpio_get_direction(gpio) == GPIO_DIRECTION_OUT)
 180 val = gpio_get_output_value(gpio);
 181 else
 182 val = gpio_get_input_value(gpio);

gpio_get_output_value() reads it from gpiodata_store for output
gpio_get_input_value() reads the reg.

In Linux you are right it is read from reg in both cases.

> 
> Additionally the documentation states that a write to an input doesn't
> work:
> AXI GPIO Data Register.
> For each I/O bit programmed as input:
> •  R: Reads value on the input pin.
> •  W: No effect.
> 
> However the Linux driver use the common sequence and sets first the data
> register and afterwards the direction register.

Possible that driver has pretty long history and I don't think it was
tested for all cases.

>> If you want to support this configuration then you would have to change
>> pin to input and read it and revert it back. And all of this should be
>> done base

Re: [U-Boot] [PATCH v4 6/6] common: Generic loader for file system

2018-07-26 Thread Michal Simek
On 25.7.2018 18:03, Tom Rini wrote:
> On Wed, Jul 25, 2018 at 09:47:17AM -0600, Simon Glass wrote:
>> Hi,
>>
>> On 25 July 2018 at 03:48, Michal Simek  wrote:
>>>
>>> On 25.7.2018 08:31, Chee, Tien Fong wrote:
 On Wed, 2018-07-18 at 16:48 +0200, Michal Simek wrote:
> On 6.7.2018 10:28, tien.fong.c...@intel.com wrote:
>>
>> From: Tien Fong Chee 
>>
>> [...]
>>
>
> Also that DT binding is quite weird and I don't think you will get
> ACK
> for this from device tree community at all. I think that calling via
> platdata and avoid DT nodes would be better way to go.
 Why do you think DT binding is weird? The DT is designed based on Simon
 proposal, and i believe following the rules in DTS spec.
 There are some DT benefits with current design, i think someone may be
 maintainer need to made the final decision on the design.
>>>
>>> It is software configuration in file which should mostly describe
>>> hardware and state for hardware configuration.
>>>
>>> Your fs_loader node is purely describe sw configuration which shouldn't
>>> be here.
>>> You have there run time configuration via variables. I think using only
>>> this way is enough. Default variables will match what you would want to
>>> add to DT.
>>
>> I think DT makes sense in the U-Boot context.
>>
>> We don't have a user space to handle policy decisions, and the
>> 'chosen' node is a good place to configure these common features.
>>
>> While you can argue that the partition or filesystem where an image
>> comes from is a software config, it is something that has to be
>> configured. It has impact on hardware too, since the FPGA has to get
>> its firmware from somewhere. We use the chosen node to specify the
>> UART to use, and this is no different. Again, we don't have user-space
>> config files in U-Boot.
>>
>> This argument comes up from time to time and I'd really like to put it
>> to bed for U-Boot. I understand that Linux has its own approach and
>> rules, but in some cases they serve U-Boot poorly.
> 
> I want to second this as well.  So long as we're using our prefix and
> we've thought through and discussed what we're trying to do here, it's
> OK to do things that might not be accepted for Linux.
> 

I have not a problem with using chosen node with u-boot prefix
properties and my colleague hopefully with finish work about moving
u-boot,dm-pre-reloc; to chosen node where it should be (because current
solution has also problem with ordering).

In this loader case doc is saying that you can rewrite it with variables
on the prompt (or via script).
For cases that you want to autodetect platform and pass/load correct dtb
which setup u-boot this can be problematic and using DT is could be
considered as easier for use.

In this case this is what was proposed:

+   fs_loader0: fs-loader@0 {
+   u-boot,dm-pre-reloc;
+   compatible = "u-boot,fs-loader";
+   phandlepart = <&mmc 1>;
+   };

+   fs_loader1: fs-loader@1 {
+   u-boot,dm-pre-reloc;
+   compatible = "u-boot,fs-loader";
+   mtdpart = "UBI",
+   ubivol = "ubi0";
+   };

u-boot,dm-pre-reloc; requires DM_FLAG_PRE_RELOC which is not setup for
this driver - it means this should be here.

compatible = "u-boot,fs-loader"; - bind and probe are empty that's why
this is only used for filling platdata but driver has no user that's why
this is unused till someone calls that functions.

phandlepart/mtdpart/ubivol is just for setup.

For the first case you can just use in chosen node:
u-boot,fs-loader = <&mmc 1>;

And for UBIfs. I have never played with that but I expect it shouldn't
be big problem to describe it differently too (something like)
u-boot,fs-loader = <0 ubi0>;

Then this driver/interface can stay in DT where it should stay. The only
thing is how this should be initialized because there is no compatible
string. But you can do that via platdata for platforms which want to use
this.

Thanks,
Michal

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


Re: [U-Boot] [PATCH v4 8/8] armv8: ls1046a: setup SEC ICIDs and fix up device tree

2018-07-26 Thread Laurentiu Tudor
Hi Horia,

Thanks for having a look. Comments inline.

On 25.07.2018 20:55, Horia Geanta wrote:
> On 7/24/2018 5:05 PM, laurentiu.tu...@nxp.com wrote:
>> From: Laurentiu Tudor 
>>
>> Add support for SEC ICID configuration and apply it for ls1046a.
>> Also add code to make the necessary device tree fixups.
>> Also included in this patch, while adding the new required JR
>> defines sanitize the preexisting ones by dropping the CONFIG_
>> prefixes.
>>
>> Signed-off-by: Laurentiu Tudor 
>> ---
>>   .../arm/cpu/armv8/fsl-layerscape/ls1046_ids.c | 15 
>>   .../asm/arch-fsl-layerscape/fsl_icid.h| 24 +++
>>   .../asm/arch-fsl-layerscape/immap_lsch2.h | 11 ++---
>>   drivers/crypto/fsl/jr.c   |  2 +-
>>   scripts/config_whitelist.txt  |  2 --
>>   5 files changed, 48 insertions(+), 6 deletions(-)
>>
>> diff --git a/arch/arm/cpu/armv8/fsl-layerscape/ls1046_ids.c 
>> b/arch/arm/cpu/armv8/fsl-layerscape/ls1046_ids.c
>> index 30c7d8d28a..84f7665929 100644
>> --- a/arch/arm/cpu/armv8/fsl-layerscape/ls1046_ids.c
>> +++ b/arch/arm/cpu/armv8/fsl-layerscape/ls1046_ids.c
>> @@ -7,6 +7,7 @@
>>   #include 
>>   #include 
>>   #include 
>> +#include 
> The header should be included where it's used, in fsl_icid.h.

Ok.

>>   
>>   #ifdef CONFIG_SYS_DPAA_QBMAN
>>   struct qportal_info qp_info[CONFIG_SYS_QMAN_NUM_PORTALS] = {
>> @@ -40,6 +41,20 @@ struct icid_id_table icid_tbl[] = {
>>  SET_EDMA_ICID(FSL_EDMA_STREAM_ID),
>>  SET_ETR_ICID(FSL_ETR_STREAM_ID),
>>  SET_DEBUG_ICID(FSL_DEBUG_STREAM_ID),
>> +#ifdef CONFIG_FSL_CAAM
>> +SET_SEC_QI_ICID(FSL_DPAA1_STREAM_ID_START + 2),
>> +SET_SEC_JR_ICID_ENTRY(0, FSL_DPAA1_STREAM_ID_START + 2),
>> +SET_SEC_JR_ICID_ENTRY(1, FSL_DPAA1_STREAM_ID_START + 2),
>> +SET_SEC_JR_ICID_ENTRY(2, FSL_DPAA1_STREAM_ID_START + 2),
>> +SET_SEC_JR_ICID_ENTRY(3, FSL_DPAA1_STREAM_ID_START + 2),
>> +SET_SEC_RTIC_ICID_ENTRY(0, FSL_DPAA1_STREAM_ID_START + 2),
>> +SET_SEC_RTIC_ICID_ENTRY(1, FSL_DPAA1_STREAM_ID_START + 2),
>> +SET_SEC_RTIC_ICID_ENTRY(2, FSL_DPAA1_STREAM_ID_START + 2),
>> +SET_SEC_RTIC_ICID_ENTRY(3, FSL_DPAA1_STREAM_ID_START + 2),
>> +SET_SEC_DECO_ICID_ENTRY(0, FSL_DPAA1_STREAM_ID_START + 2),
>> +SET_SEC_DECO_ICID_ENTRY(1, FSL_DPAA1_STREAM_ID_START + 2),
>> +SET_SEC_DECO_ICID_ENTRY(2, FSL_DPAA1_STREAM_ID_START + 2),
>> +#endif
>>   };
>>   
> PPA firmware running in secure world is using JR3 (what
> sec_firmware_used_jobring_offset() returns).
> I think a different ICID should be allocated for it, considering it has
> different security requirements.

Ok, will try.

> BTW, is it clear that U-boot is responsible for ICID programming, and not PPA?

That's how we currently setup the ICIDs / LIODNs (on ppc). Not idea if 
this will change in the future.

>>   int icid_tbl_sz = ARRAY_SIZE(icid_tbl);
>> diff --git a/arch/arm/include/asm/arch-fsl-layerscape/fsl_icid.h 
>> b/arch/arm/include/asm/arch-fsl-layerscape/fsl_icid.h
>> index 5be50a17ab..bd613219b6 100644
>> --- a/arch/arm/include/asm/arch-fsl-layerscape/fsl_icid.h
>> +++ b/arch/arm/include/asm/arch-fsl-layerscape/fsl_icid.h
>> @@ -82,6 +82,30 @@ void fdt_fixup_icid(void *blob);
>>   #define SET_FMAN_ICID_ENTRY(_port_id, streamid) \
>>  { .port_id = (_port_id), .icid = (streamid) }
>>   
>> +#define SET_SEC_QI_ICID(streamid) \
>> +SET_ICID_ENTRY("fsl,sec-v4.0", streamid, \
>> +(((streamid) << 16) | (streamid)), \
>> +offsetof(struct ccsr_sec, qilcr_ls) + \
> s/struct ccsr_sec/ccsr_sec_t
> 
>> +CONFIG_SYS_FSL_SEC_ADDR, \
>> +CONFIG_SYS_FSL_SEC_ADDR)
>> +
>> +#define SET_SEC_JR_ICID_ENTRY(jr_num, streamid) \
>> +SET_ICID_ENTRY("fsl,sec-v4.0-job-ring", streamid, \
>> +(((streamid) << 16) | (streamid)), \
>> +offsetof(struct ccsr_sec, jrliodnr[jr_num].ls) + \
>> +CONFIG_SYS_FSL_SEC_ADDR, \
>> +FSL_SEC_JR##jr_num##_BASE_ADDR)
>> +
>> +#define SET_SEC_DECO_ICID_ENTRY(deco_num, streamid) \
>> +SET_ICID_ENTRY(NULL, streamid, (((streamid) << 16) | (streamid)), \
>> +offsetof(struct ccsr_sec, decoliodnr[deco_num].ls) + \
>> +CONFIG_SYS_FSL_SEC_ADDR, 0)
>> +
>> +#define SET_SEC_RTIC_ICID_ENTRY(rtic_num, streamid) \
>> +SET_ICID_ENTRY(NULL, streamid, (((streamid) << 16) | (streamid)), \
>> +offsetof(struct ccsr_sec, rticliodnr[rtic_num].ls) + \
>> +CONFIG_SYS_FSL_SEC_ADDR, 0)
>> +
>>   extern struct icid_id_table icid_tbl[];
>>   extern struct fman_icid_id_table fman_icid_tbl[];
>>   extern int icid_tbl_sz;
>> diff --git a/arch/arm/include/asm/arch-fsl-layerscape/immap_lsch2.h 
>> b/arch/arm/include/asm/arch-fsl-layerscape/immap_lsch2.h
>> index d22ec70aa5..0dd09a5d81 100644
>> --- a/arch/arm/include/asm/arch-fsl-layerscape/immap_lsch2.h
>> +++ b/arch/arm/include/asm/arch-fsl-layerscape/immap_lsch2.h
>> @@ -199,11 +199,16 @@ struct sys_info {
>>  (CONF

Re: [U-Boot] [PATCH 3/3] arm: socfpga: Add Arria 10 SoCFPGA programming interface

2018-07-26 Thread Michal Simek
On 26.7.2018 09:54, tien.fong.c...@intel.com wrote:
> From: Tien Fong Chee 
> 
> Add code necessary into the FPGA driver framework in U-Boot
> so it can be used via the 'fpga' command for programing Arria 10
> SoCFPGA.
> 
> Signed-off-by: Tien Fong Chee 
> ---
>  cmd/fpga.c|2 +-
>  drivers/fpga/altera.c |   41 +
>  drivers/fpga/fpga.c   |8 
>  include/altera.h  |2 ++
>  include/fpga.h|2 ++
>  5 files changed, 46 insertions(+), 9 deletions(-)
> 
> diff --git a/cmd/fpga.c b/cmd/fpga.c
> index 14ad4e5..207cec3 100644
> --- a/cmd/fpga.c
> +++ b/cmd/fpga.c
> @@ -362,7 +362,7 @@ U_BOOT_CMD(fpga, 6, 1, do_fpga,
>  "(Xilinx only)\n"
>  #endif
>  #if defined(CONFIG_CMD_FPGA_LOADFS)
> -"Load device from filesystem (FAT by default) (Xilinx only)\n"
> +"Load device from filesystem (FAT by default)\n"
>  "  loadfs [dev] [address] [image size] [blocksize] \n"
>  "[] \n"
>  #endif
> diff --git a/drivers/fpga/altera.c b/drivers/fpga/altera.c
> index 9605554..3c9474c 100644
> --- a/drivers/fpga/altera.c
> +++ b/drivers/fpga/altera.c
> @@ -12,6 +12,7 @@
>   */
>  #include 
>  #include 
> +#include  /* altera specific definitions */
>  #include 
>  #include 
>  
> @@ -22,25 +23,31 @@ static const struct altera_fpga {
>   enum altera_family  family;
>   const char  *name;
>   int (*load)(Altera_desc *, const void *, size_t);
> + int (*loadfs)(Altera_desc *, const void *, size_t, fpga_fs_info *);

when you put this as last then you don't need to fill NULLs below.

>   int (*dump)(Altera_desc *, const void *, size_t);
>   int (*info)(Altera_desc *);
>  } altera_fpga[] = {
>  #if defined(CONFIG_FPGA_ACEX1K)
> - { Altera_ACEX1K, "ACEX1K", ACEX1K_load, ACEX1K_dump, ACEX1K_info },
> - { Altera_CYC2,   "ACEX1K", ACEX1K_load, ACEX1K_dump, ACEX1K_info },
> + { Altera_ACEX1K, "ACEX1K", ACEX1K_load, NULL, ACEX1K_dump,
> +  ACEX1K_info },
> + { Altera_CYC2,   "ACEX1K", ACEX1K_load, NULL, ACEX1K_dump,
> +  ACEX1K_info },
>  #elif defined(CONFIG_FPGA_CYCLON2)
> - { Altera_ACEX1K, "CycloneII", CYC2_load, CYC2_dump, CYC2_info },
> - { Altera_CYC2,   "CycloneII", CYC2_load, CYC2_dump, CYC2_info },
> + { Altera_ACEX1K, "CycloneII", CYC2_load, NULL, CYC2_dump, CYC2_info },
> + { Altera_CYC2,   "CycloneII", CYC2_load, NULL, CYC2_dump, CYC2_info },
>  #endif
>  #if defined(CONFIG_FPGA_STRATIX_II)
> - { Altera_StratixII, "StratixII", StratixII_load,
> + { Altera_StratixII, "StratixII", StratixII_load, NULL,
> StratixII_dump, StratixII_info },
>  #endif
>  #if defined(CONFIG_FPGA_STRATIX_V)
> - { Altera_StratixV, "StratixV", stratixv_load, NULL, NULL },
> + { Altera_StratixV, "StratixV", stratixv_load, NULL, NULL, NULL },
>  #endif
> -#if defined(CONFIG_FPGA_SOCFPGA)
> - { Altera_SoCFPGA, "SoC FPGA", socfpga_load, NULL, NULL },
> +#if defined(CONFIG_FPGA_SOCFPGA) && defined(CONFIG_CMD_FPGA_LOADFS)
> + { Altera_SoCFPGA, "SoC FPGA", socfpga_load, socfpga_loadfs, NULL,
> +  NULL },
> +#elif defined(CONFIG_FPGA_SOCFPGA)
> + { Altera_SoCFPGA, "SoC FPGA", socfpga_load, NULL, NULL, NULL },
>  #endif
>  };
>  
> @@ -173,3 +180,21 @@ int altera_info(Altera_desc *desc)
>  
>   return FPGA_SUCCESS;
>  }
> +
> +#if defined(CONFIG_CMD_FPGA_LOADFS)
> +int altera_loadfs(Altera_desc *desc, const void *buf, size_t bsize,
> +fpga_fs_info *fpga_fsinfo)
> +{
> + const struct altera_fpga *fpga = altera_desc_to_fpga(desc, __func__);
> +
> + if (!fpga)
> + return FPGA_FAIL;
> +
> + debug_cond(FPGA_DEBUG, "%s: Launching the %s FS Loader...\n",
> +__func__, fpga->name);
> + if (fpga->loadfs)
> + return fpga->loadfs(desc, buf, bsize, fpga_fsinfo);
> +
> + return -EINVAL;
> +}
> +#endif
> diff --git a/drivers/fpga/fpga.c b/drivers/fpga/fpga.c
> index 55bdf9e..67b772d 100644
> --- a/drivers/fpga/fpga.c
> +++ b/drivers/fpga/fpga.c
> @@ -207,6 +207,14 @@ int fpga_fsload(int devnum, const void *buf, size_t size,
>   fpga_no_sup((char *)__func__, "Xilinx devices");
>  #endif
>   break;
> +#if defined(CONFIG_FPGA_ALTERA)
> + case fpga_altera:
> + ret_val = altera_loadfs(desc->devdesc, buf, size,
> + fpga_fsinfo);
> +#else
> + fpga_no_sup((char *)__func__, "Altera devices");
> +#endif
> + break;
>   default:
>   printf("%s: Invalid or unsupported device type %d\n",
>  __func__, desc->devtype);
> diff --git a/include/altera.h b/include/altera.h
> index cf0c021..b641b8a 100644
> --- a/include/altera.h
> +++ b/include/altera.h
> @@ -114,6 +114,8 @@ typedef struct {
>  
>  

Re: [U-Boot] [PATCH v4 6/6] common: Generic loader for file system

2018-07-26 Thread Chee, Tien Fong
On Wed, 2018-07-25 at 11:48 +0200, Michal Simek wrote:
> On 25.7.2018 08:31, Chee, Tien Fong wrote:
> > 
> > On Wed, 2018-07-18 at 16:48 +0200, Michal Simek wrote:
> > > 
> > > On 6.7.2018 10:28, tien.fong.c...@intel.com wrote:
> > > > 
> > > > 
> > > > From: Tien Fong Chee 
> > > > 
> > > > This is file system generic loader which can be used to load
> > > > the file image from the storage into target such as memory.
> > > > The consumer driver would then use this loader to program
> > > > whatever,
> > > > ie. the FPGA device.
> > > > 
> > > > Signed-off-by: Tien Fong Chee 
> > > > ---
> > > >  drivers/misc/Kconfig |  10 ++
> > > >  drivers/misc/Makefile|   1 +
> > > >  drivers/misc/fs_loader.c | 295
> > > > +++
> > > >  include/dm/uclass-id.h   |   1 +
> > > >  include/fs_loader.h  |  79 +
> > > >  5 files changed, 386 insertions(+)
> > > >  create mode 100644 drivers/misc/fs_loader.c
> > > >  create mode 100644 include/fs_loader.h
> > > > 
> > > > diff --git a/drivers/misc/Kconfig b/drivers/misc/Kconfig
> > > > index 17b3a80..4163b4f 100644
> > > > --- a/drivers/misc/Kconfig
> > > > +++ b/drivers/misc/Kconfig
> > > > @@ -277,4 +277,14 @@ config GDSYS_RXAUI_CTRL
> > > >     depends on MISC
> > > >     help
> > > >       Support gdsys FPGA's RXAUI control.
> > > > +
> > > > +config FS_LOADER
> > > > +   bool "Enable loader driver for file system"
> > > > +   help
> > > > +     This is file system generic loader which can be used
> > > > to
> > > > load
> > > > +     the file image from the storage into target such as
> > > > memory.
> > > > +
> > > > +     The consumer driver would then use this loader to
> > > > program whatever,
> > > > +     ie. the FPGA device.
> > > > +
> > > >  endmenu
> > > > diff --git a/drivers/misc/Makefile b/drivers/misc/Makefile
> > > > index 4ce9d21..67a36f8 100644
> > > > --- a/drivers/misc/Makefile
> > > > +++ b/drivers/misc/Makefile
> > > > @@ -54,3 +54,4 @@ obj-$(CONFIG_STM32_RCC) += stm32_rcc.o
> > > >  obj-$(CONFIG_STM32MP_FUSE) += stm32mp_fuse.o
> > > >  obj-$(CONFIG_SYS_DPAA_QBMAN) += fsl_portals.o
> > > >  obj-$(CONFIG_GDSYS_RXAUI_CTRL) += gdsys_rxaui_ctrl.o
> > > > +obj-$(CONFIG_FS_LOADER) += fs_loader.o
> > > > diff --git a/drivers/misc/fs_loader.c
> > > > b/drivers/misc/fs_loader.c
> > > > new file mode 100644
> > > > index 000..5fe642b
> > > > --- /dev/null
> > > > +++ b/drivers/misc/fs_loader.c
> > > > @@ -0,0 +1,295 @@
> > > > +/*
> > > > + * Copyright (C) 2018 Intel Corporation 
> > > > + *
> > > > + * SPDX-License-Identifier:GPL-2.0
> > > > + */
> > > > +#include 
> > > > +#include 
> > > > +#include 
> > > > +#include 
> > > > +#include 
> > > > +#include 
> > > > +#include 
> > > > +#include 
> > > > +#include 
> > > > +#include 
> > > > +
> > > > +DECLARE_GLOBAL_DATA_PTR;
> > > > +
> > > > +struct firmware_priv {
> > > > +   const char *name;   /* Filename */
> > > > +   u32 offset; /* Offset of reading a file
> > > > */
> > > > +};
> > > > +
> > > > +#ifdef CONFIG_CMD_UBIFS
> > > > +static int mount_ubifs(char *mtdpart, char *ubivol)
> > > > +{
> > > > +   int ret = ubi_part(mtdpart, NULL);
> > > > +
> > > > +   if (ret) {
> > > > +   debug("Cannot find mtd partition %s\n",
> > > > mtdpart);
> > > > +   return ret;
> > > > +   }
> > > > +
> > > > +   return cmd_ubifs_mount(ubivol);
> > > > +}
> > > > +
> > > > +static int umount_ubifs(void)
> > > > +{
> > > > +   return cmd_ubifs_umount();
> > > > +}
> > > > +#else
> > > > +static int mount_ubifs(char *mtdpart, char *ubivol)
> > > > +{
> > > > +   debug("Error: Cannot load image: no UBIFS support\n");
> > > > +   return -ENOSYS;
> > > > +}
> > > > +#endif
> > > > +
> > > > +static int select_fs_dev(struct device_platdata *plat)
> > > > +{
> > > > +   int ret;
> > > > +
> > > > +   if (plat->phandlepart.phandle) {
> > > > +   ofnode node;
> > > > +
> > > > +   node = ofnode_get_by_phandle(plat-
> > > > > 
> > > > > phandlepart.phandle);
> > > > +
> > > > +   int of_offset = ofnode_to_offset(node);
> > > > +
> > > > +   struct udevice *dev;
> > > > +
> > > > +   ret =
> > > > device_get_global_by_of_offset(of_offset,
> > > > &dev);
> > > > +   if (!ret) {
> > > > +   struct blk_desc *desc =
> > > > blk_get_by_device(dev);
> > > > +   if (desc) {
> > > > +   ret =
> > > > fs_set_blk_dev_with_part(desc,
> > > > +   plat-
> > > > > 
> > > > > phandlepart.partition);
> > > > +   } else {
> > > > +   debug("%s: No device found\n",
> > > > __func__);
> > > > +   return -ENODEV;
> > > > +   }
> > > > +   }
> > > > +   } else if (plat->mtd

[U-Boot] [PATCH 1/2] linux/mii.h: Sync with Linux kernel v4.17

2018-07-26 Thread Bin Meng
This syncs U-Boot's include/linux/mii.h with Linux kernel v4.17
include/uapi/linux/mii.h.

While we are here, this also fixes some style issues.

Signed-off-by: Bin Meng 
---

 include/linux/mii.h | 126 
 1 file changed, 69 insertions(+), 57 deletions(-)

diff --git a/include/linux/mii.h b/include/linux/mii.h
index 19afb74..21db032 100644
--- a/include/linux/mii.h
+++ b/include/linux/mii.h
@@ -1,3 +1,4 @@
+/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
 /*
  * linux/mii.h: definitions for MII-compatible transceivers
  * Originally drivers/net/sunhme.h.
@@ -9,53 +10,55 @@
 #define __LINUX_MII_H__
 
 /* Generic MII registers. */
-
-#define MII_BMCR   0x00/* Basic mode control register */
-#define MII_BMSR   0x01/* Basic mode status register  */
-#define MII_PHYSID10x02/* PHYS ID 1   */
-#define MII_PHYSID20x03/* PHYS ID 2   */
-#define MII_ADVERTISE  0x04/* Advertisement control reg   */
-#define MII_LPA0x05/* Link partner ability reg
*/
-#define MII_EXPANSION  0x06/* Expansion register  */
-#define MII_CTRL1000   0x09/* 1000BASE-T control  */
-#define MII_STAT1000   0x0a/* 1000BASE-T status   */
-#define MII_ESTATUS0x0f/* Extended Status */
-#define MII_DCOUNTER   0x12/* Disconnect counter  */
-#define MII_FCSCOUNTER 0x13/* False carrier counter   */
-#define MII_NWAYTEST   0x14/* N-way auto-neg test reg */
-#define MII_RERRCOUNTER 0x15   /* Receive error counter   */
-#define MII_SREVISION  0x16/* Silicon revision*/
-#define MII_RESV1  0x17/* Reserved... */
-#define MII_LBRERROR   0x18/* Lpback, rx, bypass error*/
-#define MII_PHYADDR0x19/* PHY address */
-#define MII_RESV2  0x1a/* Reserved... */
-#define MII_TPISTATUS  0x1b/* TPI status for 10mbps   */
-#define MII_NCONFIG0x1c/* Network interface config*/
+#define MII_BMCR   0x00/* Basic mode control register */
+#define MII_BMSR   0x01/* Basic mode status register  */
+#define MII_PHYSID10x02/* PHYS ID 1   */
+#define MII_PHYSID20x03/* PHYS ID 2   */
+#define MII_ADVERTISE  0x04/* Advertisement control reg   */
+#define MII_LPA0x05/* Link partner ability reg
*/
+#define MII_EXPANSION  0x06/* Expansion register  */
+#define MII_CTRL1000   0x09/* 1000BASE-T control  */
+#define MII_STAT1000   0x0a/* 1000BASE-T status   */
+#define MII_MMD_CTRL   0x0d/* MMD Access Control Register */
+#define MII_MMD_DATA   0x0e/* MMD Access Data Register */
+#define MII_ESTATUS0x0f/* Extended Status */
+#define MII_DCOUNTER   0x12/* Disconnect counter  */
+#define MII_FCSCOUNTER 0x13/* False carrier counter   */
+#define MII_NWAYTEST   0x14/* N-way auto-neg test reg */
+#define MII_RERRCOUNTER0x15/* Receive error counter   
*/
+#define MII_SREVISION  0x16/* Silicon revision*/
+#define MII_RESV1  0x17/* Reserved... */
+#define MII_LBRERROR   0x18/* Lpback, rx, bypass error*/
+#define MII_PHYADDR0x19/* PHY address */
+#define MII_RESV2  0x1a/* Reserved... */
+#define MII_TPISTATUS  0x1b/* TPI status for 10mbps   */
+#define MII_NCONFIG0x1c/* Network interface config*/
 
 /* Basic mode control register. */
-#define BMCR_RESV  0x003f  /* Unused...   */
-#define BMCR_SPEED1000 0x0040  /* MSB of Speed (1000) */
-#define BMCR_CTST  0x0080  /* Collision test  */
-#define BMCR_FULLDPLX  0x0100  /* Full duplex */
+#define BMCR_RESV  0x003f  /* Unused...   */
+#define BMCR_SPEED1000 0x0040  /* MSB of Speed (1000) */
+#define BMCR_CTST  0x0080  /* Collision test  */
+#define BMCR_FULLDPLX  0x0100  /* Full duplex */
 #define BMCR_ANRESTART 0x0200  /* Auto negotiation restart*/
-#define BMCR_ISOLATE   0x0400  /* Disconnect DP83840 from MII */
-#define BMCR_PDOWN 0x0800  /* Powerdown the DP83840   */
+#define BMCR_ISOLATE   0x0400  /* Isolate data paths from MII */
+#define BMCR_PDOWN 0x0800  /* Enable low power state  */
 #define BMCR_ANENABLE

[U-Boot] [PATCH 2/2] linux/mdio.h: Sync with Linux kernel v4.17

2018-07-26 Thread Bin Meng
This syncs U-Boot's include/linux/mdio.h with Linux kernel v4.17
include/uapi/linux/mdio.h.

Signed-off-by: Bin Meng 
---

 include/linux/mdio.h | 34 ++
 1 file changed, 30 insertions(+), 4 deletions(-)

diff --git a/include/linux/mdio.h b/include/linux/mdio.h
index ea20608..6e821d9 100644
--- a/include/linux/mdio.h
+++ b/include/linux/mdio.h
@@ -1,3 +1,4 @@
+/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
 /*
  * linux/mdio.h: definitions for MDIO (clause 45) transceivers
  * Copyright 2006-2009 Solarflare Communications Inc.
@@ -42,7 +43,11 @@
 #define MDIO_PKGID215
 #define MDIO_AN_ADVERTISE  16  /* AN advertising (base page) */
 #define MDIO_AN_LPA19  /* AN LP abilities (base page) */
+#define MDIO_PCS_EEE_ABLE  20  /* EEE Capability register */
+#define MDIO_PCS_EEE_WK_ERR22  /* EEE wake error counter */
 #define MDIO_PHYXS_LNSTAT  24  /* PHY XGXS lane state */
+#define MDIO_AN_EEE_ADV60  /* EEE advertisement */
+#define MDIO_AN_EEE_LPABLE 61  /* EEE link partner ability */
 
 /* Media-dependent registers. */
 #define MDIO_PMA_10GBT_SWAPPOL 130 /* 10GBASE-T pair swap & polarity */
@@ -55,7 +60,6 @@
 #define MDIO_PCS_10GBRT_STAT2  33  /* 10GBASE-R/-T PCS status 2 */
 #define MDIO_AN_10GBT_CTRL 32  /* 10GBASE-T auto-negotiation control */
 #define MDIO_AN_10GBT_STAT 33  /* 10GBASE-T auto-negotiation status */
-#define MDIO_AN_EEE_ADV60  /* EEE advertisement */
 
 /* LASI (Link Alarm Status Interrupt) registers, defined by XENPAK MSA. */
 #define MDIO_PMA_LASI_RXCTRL   0x9000  /* RX_ALARM control */
@@ -81,6 +85,7 @@
 #define MDIO_AN_CTRL1_RESTART  BMCR_ANRESTART
 #define MDIO_AN_CTRL1_ENABLE   BMCR_ANENABLE
 #define MDIO_AN_CTRL1_XNP  0x2000  /* Enable extended next page */
+#define MDIO_PCS_CTRL1_CLKSTOP_EN  0x400   /* Stop the clock during LPI */
 
 /* 10 Gb/s */
 #define MDIO_CTRL1_SPEED10G(MDIO_CTRL1_SPEEDSELEXT | 0x00)
@@ -245,9 +250,25 @@
 #define MDIO_AN_10GBT_STAT_MS  0x4000  /* Master/slave config */
 #define MDIO_AN_10GBT_STAT_MSFLT   0x8000  /* Master/slave config fault */
 
-/* AN EEE Advertisement register. */
-#define MDIO_AN_EEE_ADV_100TX  0x0002  /* Advertise 100TX EEE cap */
-#define MDIO_AN_EEE_ADV_1000T  0x0004  /* Advertise 1000T EEE cap */
+/* EEE Supported/Advertisement/LP Advertisement registers.
+ *
+ * EEE capability Register (3.20), Advertisement (7.60) and
+ * Link partner ability (7.61) registers have and can use the same identical
+ * bit masks.
+ */
+#define MDIO_AN_EEE_ADV_100TX  0x0002  /* Advertise 100TX EEE cap */
+#define MDIO_AN_EEE_ADV_1000T  0x0004  /* Advertise 1000T EEE cap */
+/* Note: the two defines above can be potentially used by the user-land
+ * and cannot remove them now.
+ * So, we define the new generic MDIO_EEE_100TX and MDIO_EEE_1000T macros
+ * using the previous ones (that can be considered obsolete).
+ */
+#define MDIO_EEE_100TX MDIO_AN_EEE_ADV_100TX   /* 100TX EEE cap */
+#define MDIO_EEE_1000T MDIO_AN_EEE_ADV_1000T   /* 1000T EEE cap */
+#define MDIO_EEE_10GT  0x0008  /* 10GT EEE cap */
+#define MDIO_EEE_1000KX0x0010  /* 1000KX EEE cap */
+#define MDIO_EEE_10GKX40x0020  /* 10G KX4 EEE cap */
+#define MDIO_EEE_10GKR 0x0040  /* 10G KR EEE cap */
 
 /* LASI RX_ALARM control/status registers. */
 #define MDIO_PMA_LASI_RX_PHYXSLFLT 0x0001  /* PHY XS RX local fault */
@@ -281,4 +302,9 @@
 #define MDIO_DEVAD_NONE(-1)
 #define MDIO_EMULATE_C22   4
 
+static inline __u16 mdio_phy_id_c45(int prtad, int devad)
+{
+   return MDIO_PHY_ID_C45 | (prtad << 5) | devad;
+}
+
 #endif /* __LINUX_MDIO_H__ */
-- 
2.7.4

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


[U-Boot] [PATCH] linux/compat.h: Add netdev_### log macros

2018-07-26 Thread Bin Meng
Currently there are two ethernet drivers (mvneta.c and mvpp2.c) that
has netdev_### (eg: netdev_dbg) log macros defined in its own driver
file. This adds these log macros in a common place linux/compat.h.

Signed-off-by: Bin Meng 
---

 drivers/net/mvneta.c   |  8 
 drivers/net/mvpp2.c| 10 --
 include/linux/compat.h | 19 +++
 3 files changed, 19 insertions(+), 18 deletions(-)

diff --git a/drivers/net/mvneta.c b/drivers/net/mvneta.c
index ab697b9..8cb04b5 100644
--- a/drivers/net/mvneta.c
+++ b/drivers/net/mvneta.c
@@ -34,14 +34,6 @@ DECLARE_GLOBAL_DATA_PTR;
 # error Marvell mvneta requires PHYLIB
 #endif
 
-/* Some linux -> U-Boot compatibility stuff */
-#define netdev_err(dev, fmt, args...)  \
-   printf(fmt, ##args)
-#define netdev_warn(dev, fmt, args...) \
-   printf(fmt, ##args)
-#define netdev_info(dev, fmt, args...) \
-   printf(fmt, ##args)
-
 #define CONFIG_NR_CPUS 1
 #define ETH_HLEN   14  /* Total octets in header */
 
diff --git a/drivers/net/mvpp2.c b/drivers/net/mvpp2.c
index 62c0c2b..5c1f5fc 100644
--- a/drivers/net/mvpp2.c
+++ b/drivers/net/mvpp2.c
@@ -35,16 +35,6 @@
 
 DECLARE_GLOBAL_DATA_PTR;
 
-/* Some linux -> U-Boot compatibility stuff */
-#define netdev_err(dev, fmt, args...)  \
-   printf(fmt, ##args)
-#define netdev_warn(dev, fmt, args...) \
-   printf(fmt, ##args)
-#define netdev_info(dev, fmt, args...) \
-   printf(fmt, ##args)
-#define netdev_dbg(dev, fmt, args...)  \
-   printf(fmt, ##args)
-
 #define ETH_ALEN   6   /* Octets in one ethernet addr  */
 
 #define __verify_pcpu_ptr(ptr) \
diff --git a/include/linux/compat.h b/include/linux/compat.h
index 6e3feb6..d0f51ba 100644
--- a/include/linux/compat.h
+++ b/include/linux/compat.h
@@ -43,6 +43,25 @@ extern struct p_current *current;
 #define dev_warn(dev, fmt, args...)\
printf(fmt, ##args)
 
+#define netdev_emerg(dev, fmt, args...)\
+   printf(fmt, ##args)
+#define netdev_alert(dev, fmt, args...)\
+   printf(fmt, ##args)
+#define netdev_crit(dev, fmt, args...) \
+   printf(fmt, ##args)
+#define netdev_err(dev, fmt, args...)  \
+   printf(fmt, ##args)
+#define netdev_warn(dev, fmt, args...) \
+   printf(fmt, ##args)
+#define netdev_notice(dev, fmt, args...)   \
+   printf(fmt, ##args)
+#define netdev_info(dev, fmt, args...) \
+   printf(fmt, ##args)
+#define netdev_dbg(dev, fmt, args...)  \
+   debug(fmt, ##args)
+#define netdev_vdbg(dev, fmt, args...) \
+   debug(fmt, ##args)
+
 #define GFP_ATOMIC ((gfp_t) 0)
 #define GFP_KERNEL ((gfp_t) 0)
 #define GFP_NOFS ((gfp_t) 0)
-- 
2.7.4

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


Re: [U-Boot] [PATCH v4 6/6] common: Generic loader for file system

2018-07-26 Thread Michal Simek
On 26.7.2018 11:23, Chee, Tien Fong wrote:
> On Wed, 2018-07-25 at 11:48 +0200, Michal Simek wrote:
>> On 25.7.2018 08:31, Chee, Tien Fong wrote:
>>>
>>> On Wed, 2018-07-18 at 16:48 +0200, Michal Simek wrote:

 On 6.7.2018 10:28, tien.fong.c...@intel.com wrote:
>
>
> From: Tien Fong Chee 
>
> This is file system generic loader which can be used to load
> the file image from the storage into target such as memory.
> The consumer driver would then use this loader to program
> whatever,
> ie. the FPGA device.
>
> Signed-off-by: Tien Fong Chee 
> ---
>  drivers/misc/Kconfig |  10 ++
>  drivers/misc/Makefile|   1 +
>  drivers/misc/fs_loader.c | 295
> +++
>  include/dm/uclass-id.h   |   1 +
>  include/fs_loader.h  |  79 +
>  5 files changed, 386 insertions(+)
>  create mode 100644 drivers/misc/fs_loader.c
>  create mode 100644 include/fs_loader.h
>
> diff --git a/drivers/misc/Kconfig b/drivers/misc/Kconfig
> index 17b3a80..4163b4f 100644
> --- a/drivers/misc/Kconfig
> +++ b/drivers/misc/Kconfig
> @@ -277,4 +277,14 @@ config GDSYS_RXAUI_CTRL
>   depends on MISC
>   help
>     Support gdsys FPGA's RXAUI control.
> +
> +config FS_LOADER
> + bool "Enable loader driver for file system"
> + help
> +   This is file system generic loader which can be used
> to
> load
> +   the file image from the storage into target such as
> memory.
> +
> +   The consumer driver would then use this loader to
> program whatever,
> +   ie. the FPGA device.
> +
>  endmenu
> diff --git a/drivers/misc/Makefile b/drivers/misc/Makefile
> index 4ce9d21..67a36f8 100644
> --- a/drivers/misc/Makefile
> +++ b/drivers/misc/Makefile
> @@ -54,3 +54,4 @@ obj-$(CONFIG_STM32_RCC) += stm32_rcc.o
>  obj-$(CONFIG_STM32MP_FUSE) += stm32mp_fuse.o
>  obj-$(CONFIG_SYS_DPAA_QBMAN) += fsl_portals.o
>  obj-$(CONFIG_GDSYS_RXAUI_CTRL) += gdsys_rxaui_ctrl.o
> +obj-$(CONFIG_FS_LOADER) += fs_loader.o
> diff --git a/drivers/misc/fs_loader.c
> b/drivers/misc/fs_loader.c
> new file mode 100644
> index 000..5fe642b
> --- /dev/null
> +++ b/drivers/misc/fs_loader.c
> @@ -0,0 +1,295 @@
> +/*
> + * Copyright (C) 2018 Intel Corporation 
> + *
> + * SPDX-License-Identifier:GPL-2.0
> + */
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +
> +DECLARE_GLOBAL_DATA_PTR;
> +
> +struct firmware_priv {
> + const char *name;   /* Filename */
> + u32 offset; /* Offset of reading a file
> */
> +};
> +
> +#ifdef CONFIG_CMD_UBIFS
> +static int mount_ubifs(char *mtdpart, char *ubivol)
> +{
> + int ret = ubi_part(mtdpart, NULL);
> +
> + if (ret) {
> + debug("Cannot find mtd partition %s\n",
> mtdpart);
> + return ret;
> + }
> +
> + return cmd_ubifs_mount(ubivol);
> +}
> +
> +static int umount_ubifs(void)
> +{
> + return cmd_ubifs_umount();
> +}
> +#else
> +static int mount_ubifs(char *mtdpart, char *ubivol)
> +{
> + debug("Error: Cannot load image: no UBIFS support\n");
> + return -ENOSYS;
> +}
> +#endif
> +
> +static int select_fs_dev(struct device_platdata *plat)
> +{
> + int ret;
> +
> + if (plat->phandlepart.phandle) {
> + ofnode node;
> +
> + node = ofnode_get_by_phandle(plat-
>>
>> phandlepart.phandle);
> +
> + int of_offset = ofnode_to_offset(node);
> +
> + struct udevice *dev;
> +
> + ret =
> device_get_global_by_of_offset(of_offset,
> &dev);
> + if (!ret) {
> + struct blk_desc *desc =
> blk_get_by_device(dev);
> + if (desc) {
> + ret =
> fs_set_blk_dev_with_part(desc,
> + plat-
>>
>> phandlepart.partition);
> + } else {
> + debug("%s: No device found\n",
> __func__);
> + return -ENODEV;
> + }
> + }
> + } else if (plat->mtdpart && plat->ubivol) {
> + ret = mount_ubifs(plat->mtdpart, plat-
>> ubivol);
> + if (ret)
> + return ret;
> +
> + ret = fs_set_blk_dev("ubi", NULL,
> FS_TYPE_UBIFS);
 I am curious why it is in generic FS loader any code which target
 any
 filesystem. It should be filesystem independent.
>>> Because it supports our use case, and our preference using file
>>> system
>>> instead of RAW. As I agree with To

Re: [U-Boot] [PATCH 1/3] ARM: socfpga: Add FPGA drivers for Arria 10 FPGA loadfs

2018-07-26 Thread Michal Simek
On 26.7.2018 09:54, tien.fong.c...@intel.com wrote:
> From: Tien Fong Chee 
> 
> Add FPGA drivers to support FPGA loadfs to program FPGA.
> The drivers are designed based on generic firmware loader framework,
> specific firmware loader handling is defined in fpga_manager_arria10.c.
> These drivers can handle FPGA program operation from
> loading RBF image in flash to memory and then to program FPGA.
> 
> Signed-off-by: Tien Fong Chee 
> ---
>  .../include/mach/fpga_manager_arria10.h|   22 +
>  drivers/fpga/socfpga_arria10.c |  402 
> 
>  include/altera.h   |4 +
>  3 files changed, 428 insertions(+), 0 deletions(-)
> 
> diff --git a/arch/arm/mach-socfpga/include/mach/fpga_manager_arria10.h 
> b/arch/arm/mach-socfpga/include/mach/fpga_manager_arria10.h
> index a112453..743d6b7 100644
> --- a/arch/arm/mach-socfpga/include/mach/fpga_manager_arria10.h
> +++ b/arch/arm/mach-socfpga/include/mach/fpga_manager_arria10.h
> @@ -7,6 +7,9 @@
>  #ifndef _FPGA_MANAGER_ARRIA10_H_
>  #define _FPGA_MANAGER_ARRIA10_H_
>  
> +#include 
> +#include 
> +
>  #define ALT_FPGAMGR_IMGCFG_STAT_F2S_CRC_ERROR_SET_MSKBIT(0)
>  #define ALT_FPGAMGR_IMGCFG_STAT_F2S_EARLY_USERMODE_SET_MSK   BIT(1)
>  #define ALT_FPGAMGR_IMGCFG_STAT_F2S_USERMODE_SET_MSK BIT(2)
> @@ -88,6 +91,25 @@ struct socfpga_fpga_manager {
>   u32  imgcfg_fifo_status;
>  };
>  
> +#if defined(CONFIG_CMD_FPGA_LOADFS)
> +enum rbf_type {unknown, periph_section, core_section};
> +enum rbf_security {invalid, unencrypted, encrypted};
> +
> +struct rbf_info {
> + enum rbf_type section;
> + enum rbf_security security;
> +};
> +
> +struct fpga_info {
> + char *filename;
> + int fstype;
> + u32 remaining;
> + u32 offset;
> + struct rbf_info rbfinfo;
> + struct image_header header;
> +};
> +#endif
> +
>  /* Functions */
>  int fpgamgr_program_init(u32 * rbf_data, size_t rbf_size);
>  int fpgamgr_program_finish(void);
> diff --git a/drivers/fpga/socfpga_arria10.c b/drivers/fpga/socfpga_arria10.c
> index c0252fb..2f9006f 100644
> --- a/drivers/fpga/socfpga_arria10.c
> +++ b/drivers/fpga/socfpga_arria10.c
> @@ -12,6 +12,13 @@
>  #include 
>  #include 
>  #include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
>  #include 
>  #include 
>  
> @@ -21,6 +28,12 @@
>  #define COMPRESSION_OFFSET   229
>  #define FPGA_TIMEOUT_MSEC1000  /* timeout in ms */
>  #define FPGA_TIMEOUT_CNT 0x100
> +#define RBF_UNENCRYPTED  0xa65c
> +#define RBF_ENCRYPTED0xa65d
> +#define ARRIA10RBF_PERIPH0x0001
> +#define ARRIA10RBF_CORE  0x8001
> +#define PERIPH_RBF   0
> +#define CORE_RBF 1
>  
>  static const struct socfpga_fpga_manager *fpga_manager_base =
>   (void *)SOCFPGA_FPGAMGRREGS_ADDRESS;
> @@ -30,6 +43,8 @@ static const struct socfpga_system_manager 
> *system_manager_base =
>  
>  static void fpgamgr_set_cd_ratio(unsigned long ratio);
>  
> +struct firmware *fw = NULL;
> +
>  static uint32_t fpgamgr_get_msel(void)
>  {
>   u32 reg;
> @@ -471,3 +486,390 @@ int socfpga_load(Altera_desc *desc, const void 
> *rbf_data, size_t rbf_size)
>  
>   return fpgamgr_program_finish();
>  }
> +
> +#if defined(CONFIG_CMD_FPGA_LOADFS)
> +const char *get_fpga_filename(const void *fdt, int *len, u32 core)
> +{
> + const char *fpga_filename = NULL;
> + const char *cell;
> + int nodeoffset;
> +
> + nodeoffset = fdtdec_next_compatible(fdt, 0,
> +  COMPAT_ALTERA_SOCFPGA_FPGA0);
> + if (nodeoffset >= 0) {
> + if (core) {
> + cell = fdt_getprop(fdt,
> + nodeoffset,
> + "altr,bitstream_core",
> + len);
> + }
> + else {
> + cell = fdt_getprop(fdt, nodeoffset,
> + "altr,bitstream_periph", len);
> + }
> +
> + if (cell)
> + fpga_filename = cell;
> + }
> +
> + return fpga_filename;
> +}
> +
> +void get_rbf_image_info(struct rbf_info *rbf, u16 *buffer)
> +{
> + /*
> +  * Magic ID starting at:
> +  * -> 1st dword in periph.rbf
> +  * -> 2nd dword in core.rbf
> +  */
> + u32 word_reading_max = 2;
> + u32 i;
> +
> + for (i = 0; i < word_reading_max; i++) {
> + if (*(buffer + i) == RBF_UNENCRYPTED) { /* PERIPH RBF */
> + rbf->security = unencrypted;
> + }
> + else if (*(buffer + i) == RBF_ENCRYPTED) {
> + rbf->security = encrypted;
> + }
> + else if (*(buffer + i + 1) == RBF_UNENCRYPTED) { /* CORE RBF */
> + rbf->security = unencrypted;
> + }
> + else if (*(buffer + i + 1) == RBF_E

Re: [U-Boot] [PATCH 3/3] rockchip: fix incorrect detection of ram size

2018-07-26 Thread Carlo Caione
On Tue, 2018-07-24 at 10:07 +0200, Dr. Philipp Tomsich wrote:
> 
> I have a patchset for changing the relevant fields in U-Boot to allow
> for 33bits (i.e. using u64) for the RAM size and it finally passes
> Travis cleanly.
> It will be another round or two of cleanup before I can submit the
> series — once this happens, I’ll copy you so you can give your
> Tested-by if it works…

I'm interested. Please put me in CC as well.

-- 
Carlo Caione 
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH 0/3] Prepare for net: phy: prevent uclass_eth device "node" field overwriting

2018-07-26 Thread Joe Hershberger
Prepare for [1] so that it doesn't break the build for a bunch of
boards. There are a number of reasons this series broke the build
but none of them depend on changes in the series, so fix up those
situations ahead of applying that series.

[1] https://patchwork.ozlabs.org/cover/940104/


Joe Hershberger (3):
  arm: Prevent redefinition error in fsl-layerscape
  phy: Break include cycle
  net: phy: Clean up includes of common.h

 arch/arm/cpu/armv8/fsl-layerscape/cpu.c |  2 +-
 drivers/net/phy/atheros.c   |  1 +
 drivers/net/phy/broadcom.c  |  1 -
 drivers/net/phy/davicom.c   |  1 +
 drivers/net/phy/generic_10g.c   |  2 -
 drivers/net/phy/lxt.c   |  1 +
 drivers/net/phy/marvell.c   |  1 -
 drivers/net/phy/micrel_ksz8xxx.c|  1 -
 drivers/net/phy/micrel_ksz90x1.c|  2 -
 drivers/net/phy/natsemi.c   |  1 +
 drivers/net/phy/phy.c   |  2 -
 drivers/net/phy/realtek.c   |  1 -
 drivers/net/phy/smsc.c  |  1 +
 drivers/net/phy/teranetics.c|  1 -
 drivers/net/phy/vitesse.c   |  1 +
 include/exports.h   |  3 +-
 include/phy.h   | 55 +---
 include/phy_interface.h | 65 +
 18 files changed, 74 insertions(+), 68 deletions(-)
 create mode 100644 include/phy_interface.h

-- 
1.7.11.5

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


Re: [U-Boot] [PATCH v4 8/8] armv8: ls1046a: setup SEC ICIDs and fix up device tree

2018-07-26 Thread Horia Geanta
On 7/24/2018 5:05 PM, laurentiu.tu...@nxp.com wrote:
> From: Laurentiu Tudor 
> 
> Add support for SEC ICID configuration and apply it for ls1046a.
> Also add code to make the necessary device tree fixups.
> Also included in this patch, while adding the new required JR
> defines sanitize the preexisting ones by dropping the CONFIG_
> prefixes.
> 
> Signed-off-by: Laurentiu Tudor 
> ---
>  .../arm/cpu/armv8/fsl-layerscape/ls1046_ids.c | 15 
>  .../asm/arch-fsl-layerscape/fsl_icid.h| 24 +++
>  .../asm/arch-fsl-layerscape/immap_lsch2.h | 11 ++---
>  drivers/crypto/fsl/jr.c   |  2 +-
>  scripts/config_whitelist.txt  |  2 --
>  5 files changed, 48 insertions(+), 6 deletions(-)
> 
> diff --git a/arch/arm/cpu/armv8/fsl-layerscape/ls1046_ids.c 
> b/arch/arm/cpu/armv8/fsl-layerscape/ls1046_ids.c
> index 30c7d8d28a..84f7665929 100644
> --- a/arch/arm/cpu/armv8/fsl-layerscape/ls1046_ids.c
> +++ b/arch/arm/cpu/armv8/fsl-layerscape/ls1046_ids.c
> @@ -7,6 +7,7 @@
>  #include 
>  #include 
>  #include 
> +#include 
The header should be included where it's used, in fsl_icid.h.

>  
>  #ifdef CONFIG_SYS_DPAA_QBMAN
>  struct qportal_info qp_info[CONFIG_SYS_QMAN_NUM_PORTALS] = {
> @@ -40,6 +41,20 @@ struct icid_id_table icid_tbl[] = {
>   SET_EDMA_ICID(FSL_EDMA_STREAM_ID),
>   SET_ETR_ICID(FSL_ETR_STREAM_ID),
>   SET_DEBUG_ICID(FSL_DEBUG_STREAM_ID),
> +#ifdef CONFIG_FSL_CAAM
> + SET_SEC_QI_ICID(FSL_DPAA1_STREAM_ID_START + 2),
> + SET_SEC_JR_ICID_ENTRY(0, FSL_DPAA1_STREAM_ID_START + 2),
> + SET_SEC_JR_ICID_ENTRY(1, FSL_DPAA1_STREAM_ID_START + 2),
> + SET_SEC_JR_ICID_ENTRY(2, FSL_DPAA1_STREAM_ID_START + 2),
> + SET_SEC_JR_ICID_ENTRY(3, FSL_DPAA1_STREAM_ID_START + 2),
> + SET_SEC_RTIC_ICID_ENTRY(0, FSL_DPAA1_STREAM_ID_START + 2),
> + SET_SEC_RTIC_ICID_ENTRY(1, FSL_DPAA1_STREAM_ID_START + 2),
> + SET_SEC_RTIC_ICID_ENTRY(2, FSL_DPAA1_STREAM_ID_START + 2),
> + SET_SEC_RTIC_ICID_ENTRY(3, FSL_DPAA1_STREAM_ID_START + 2),
> + SET_SEC_DECO_ICID_ENTRY(0, FSL_DPAA1_STREAM_ID_START + 2),
> + SET_SEC_DECO_ICID_ENTRY(1, FSL_DPAA1_STREAM_ID_START + 2),
> + SET_SEC_DECO_ICID_ENTRY(2, FSL_DPAA1_STREAM_ID_START + 2),
> +#endif
>  };
>  
PPA firmware running in secure world is using JR3 (what
sec_firmware_used_jobring_offset() returns).
I think a different ICID should be allocated for it, considering it has
different security requirements.

BTW, is it clear that U-boot is responsible for ICID programming, and not PPA?

>  int icid_tbl_sz = ARRAY_SIZE(icid_tbl);
> diff --git a/arch/arm/include/asm/arch-fsl-layerscape/fsl_icid.h 
> b/arch/arm/include/asm/arch-fsl-layerscape/fsl_icid.h
> index 5be50a17ab..bd613219b6 100644
> --- a/arch/arm/include/asm/arch-fsl-layerscape/fsl_icid.h
> +++ b/arch/arm/include/asm/arch-fsl-layerscape/fsl_icid.h
> @@ -82,6 +82,30 @@ void fdt_fixup_icid(void *blob);
>  #define SET_FMAN_ICID_ENTRY(_port_id, streamid) \
>   { .port_id = (_port_id), .icid = (streamid) }
>  
> +#define SET_SEC_QI_ICID(streamid) \
> + SET_ICID_ENTRY("fsl,sec-v4.0", streamid, \
> + (((streamid) << 16) | (streamid)), \
> + offsetof(struct ccsr_sec, qilcr_ls) + \
s/struct ccsr_sec/ccsr_sec_t

> + CONFIG_SYS_FSL_SEC_ADDR, \
> + CONFIG_SYS_FSL_SEC_ADDR)
> +
> +#define SET_SEC_JR_ICID_ENTRY(jr_num, streamid) \
> + SET_ICID_ENTRY("fsl,sec-v4.0-job-ring", streamid, \
> + (((streamid) << 16) | (streamid)), \
> + offsetof(struct ccsr_sec, jrliodnr[jr_num].ls) + \
> + CONFIG_SYS_FSL_SEC_ADDR, \
> + FSL_SEC_JR##jr_num##_BASE_ADDR)
> +
> +#define SET_SEC_DECO_ICID_ENTRY(deco_num, streamid) \
> + SET_ICID_ENTRY(NULL, streamid, (((streamid) << 16) | (streamid)), \
> + offsetof(struct ccsr_sec, decoliodnr[deco_num].ls) + \
> + CONFIG_SYS_FSL_SEC_ADDR, 0)
> +
> +#define SET_SEC_RTIC_ICID_ENTRY(rtic_num, streamid) \
> + SET_ICID_ENTRY(NULL, streamid, (((streamid) << 16) | (streamid)), \
> + offsetof(struct ccsr_sec, rticliodnr[rtic_num].ls) + \
> + CONFIG_SYS_FSL_SEC_ADDR, 0)
> +
>  extern struct icid_id_table icid_tbl[];
>  extern struct fman_icid_id_table fman_icid_tbl[];
>  extern int icid_tbl_sz;
> diff --git a/arch/arm/include/asm/arch-fsl-layerscape/immap_lsch2.h 
> b/arch/arm/include/asm/arch-fsl-layerscape/immap_lsch2.h
> index d22ec70aa5..0dd09a5d81 100644
> --- a/arch/arm/include/asm/arch-fsl-layerscape/immap_lsch2.h
> +++ b/arch/arm/include/asm/arch-fsl-layerscape/immap_lsch2.h
> @@ -199,11 +199,16 @@ struct sys_info {
>   (CONFIG_SYS_IMMR + CONFIG_SYS_FSL_FM1_DTSEC1_OFFSET)
>  
>  #define CONFIG_SYS_FSL_SEC_OFFSET0x70ull
> -#define CONFIG_SYS_FSL_JR0_OFFSET0x71ull
> +#define FSL_SEC_JR0_OFFSET   0x71ull
> +#define FSL_SEC_JR1_OFFSET   0x72ull
> +#define FSL_SEC_JR2_OF

Re: [U-Boot] [PATCH v3 5/5] sandbox: led: use new function to configure default state

2018-07-26 Thread Patrick Brünn
>From: Patrick Delaunay [mailto:patrick.delau...@st.com]
>Sent: Dienstag, 24. Juli 2018 10:59
>Subject: [PATCH v3 5/5] sandbox: led: use new function to configure default
>state
>
>Initialize the led with the default state defined in device tree
>in board_init and solve issue with test for led default state.
>
>Reviewed-by: Simon Glass 
>
>
>Signed-off-by: Patrick Delaunay 
>---
>Led default-state is correctly handle in Sandbox, tested with:
>  ./u-boot -d ./arch/sandbox/dts/test.dtb
>  => led list
>  sandbox:red 
>  sandbox:green   
>  sandbox:default_on on
>  sandbox:default_off off
>
>This patch solve "make tests" issue introduced by
>http://patchwork.ozlabs.org/patch/943651/
>
>Changes in v3: None
>Changes in v2:
>  - add sandbox impact and test update
>
> board/sandbox/sandbox.c | 9 +
> common/board_r.c| 3 ++-
> test/dm/led.c   | 3 +++
> 3 files changed, 14 insertions(+), 1 deletion(-)
>
>diff --git a/board/sandbox/sandbox.c b/board/sandbox/sandbox.c
>index 195f620..66b5f24 100644
>--- a/board/sandbox/sandbox.c
>+++ b/board/sandbox/sandbox.c
>@@ -6,6 +6,7 @@
> #include 
> #include 
> #include 
>+#include 
> #include 
> #include 
> #include 
>@@ -47,6 +48,14 @@ int dram_init(void)
>   return 0;
> }
>
>+int board_init(void)
>+{
>+#ifdef CONFIG_LED
>+  led_default_state();
>+#endif /* CONFIG_LED */

I think you forgot to apply Simons suggestion here, like you did for 4/5

>+  return 0;
>+}
>...

Beckhoff Automation GmbH & Co. KG | Managing Director: Dipl. Phys. Hans Beckhoff
Registered office: Verl, Germany | Register court: Guetersloh HRA 7075



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


Re: [U-Boot] [PATCH v3 3/5] dm: led: move default state support in led uclass

2018-07-26 Thread Patrick Brünn
Hi Patrick,
sorry, for responding so late, I am in the middle of a vacation at the moment.
>From: Patrick Delaunay [mailto:patrick.delau...@st.com]
>Sent: Dienstag, 24. Juli 2018 10:59
>Subject: [PATCH v3 3/5] dm: led: move default state support in led uclass
>
>This patch save common LED property "default-state" value
>in post bind of LED uclass.
>The configuration for this default state is only performed when
>led_default_state() is called;
>It can be called in your board_init()
>or it could added in init_sequence_r[] in future.
>
>Reviewed-by: Simon Glass 
>Signed-off-by: Patrick Delaunay 
>---
>
>Changes in v3: None
>Changes in v2: None
>
> drivers/led/led-uclass.c | 54
>
> drivers/led/led_gpio.c   |  8 ---
> include/led.h| 23 +
> 3 files changed, 77 insertions(+), 8 deletions(-)
>
>diff --git a/drivers/led/led-uclass.c b/drivers/led/led-uclass.c
>index 2f4d69e..141401d 100644
>--- a/drivers/led/led-uclass.c
>+++ b/drivers/led/led-uclass.c
>@@ -8,6 +8,7 @@
> #include 
> #include 
> #include 
>+#include 
> #include 
> #include 
>
>@@ -63,8 +64,61 @@ int led_set_period(struct udevice *dev, int period_ms)
> }
> #endif
>
>+static int led_post_bind(struct udevice *dev)
>+{
>+  struct led_uc_plat *uc_pdata;
>+  const char *default_state;
>+
>+  uc_pdata = dev_get_uclass_platdata(dev);
>+
>+  /* common optional properties */
>+  uc_pdata->default_state = LED_DEF_NO;
>+  default_state = dev_read_string(dev, "default-state");
>+  if (default_state) {
>+  if (!strncmp(default_state, "on", 2))
>+  uc_pdata->default_state = LED_DEF_ON;
>+  else if (!strncmp(default_state, "off", 3))
>+  uc_pdata->default_state = LED_DEF_OFF;
>+  else if (!strncmp(default_state, "keep", 4))
>+  uc_pdata->default_state = LED_DEF_KEEP;
>+  }
>+
>+  return 0;
>+}
>+
>+int led_default_state(void)
>+{
>+  struct udevice *dev;
>+  struct uclass *uc;
>+  struct led_uc_plat *uc_pdata;
>+  int ret;
>+
>+  ret = uclass_get(UCLASS_LED, &uc);
>+  if (ret)
>+  return ret;
>+  for (uclass_find_first_device(UCLASS_LED, &dev);
>+   dev;
>+   uclass_find_next_device(&dev)) {
>+  uc_pdata = dev_get_uclass_platdata(dev);
>+  if (!uc_pdata || uc_pdata->default_state == LED_DEF_NO)
>+  continue;
>+  ret = device_probe(dev);
>+  if (ret)
>+  return ret;
>+  if (uc_pdata->default_state == LED_DEF_ON)
>+  led_set_state(dev, LEDST_ON);
>+  else if (uc_pdata->default_state == LED_DEF_OFF)
>+  led_set_state(dev, LEDST_OFF);
>+  printf("%s: default_state=%d\n",
>+ uc_pdata->label, uc_pdata->default_state);
Do you really want to keep this printf()?
>+  }
>+
>+  return ret;
>+}
>+
> UCLASS_DRIVER(led) = {
>   .id = UCLASS_LED,
>   .name   = "led",
>+  .post_bind  = led_post_bind,
>   .per_device_platdata_auto_alloc_size = sizeof(struct led_uc_plat),
> };
>diff --git a/drivers/led/led_gpio.c b/drivers/led/led_gpio.c
>index 533587d..93f6b91 100644
>--- a/drivers/led/led_gpio.c
>+++ b/drivers/led/led_gpio.c
>@@ -57,7 +57,6 @@ static int led_gpio_probe(struct udevice *dev)
> {
>   struct led_uc_plat *uc_plat = dev_get_uclass_platdata(dev);
>   struct led_gpio_priv *priv = dev_get_priv(dev);
>-  const char *default_state;
>   int ret;
>
>   /* Ignore the top-level LED node */
>@@ -68,13 +67,6 @@ static int led_gpio_probe(struct udevice *dev)
>   if (ret)
>   return ret;
>
>-  default_state = dev_read_string(dev, "default-state");
>-  if (default_state) {
>-  if (!strncmp(default_state, "on", 2))
>-  gpio_led_set_state(dev, LEDST_ON);
>-  else if (!strncmp(default_state, "off", 3))
>-  gpio_led_set_state(dev, LEDST_OFF);
>-  }
Is it necessary to move this code out of led_gpio_probe()?
If possible I would keep it here and implement led_default_state()
similar to mmc_initialize(->mmc_probe()). Than we could avoid
enum led_def_state_t and the double evaluation of default_state.

>   return 0;
> }
>
>diff --git a/include/led.h b/include/led.h
>index 940b97f..ff45f03 100644
>--- a/include/led.h
>+++ b/include/led.h
>@@ -8,12 +8,27 @@
> #define __LED_H
>
> /**
>+ * enum led_default_state - The initial state of the LED.
>+ * see Documentation/devicetree/bindings/leds/common.txt
>+ */
>+enum led_def_state_t {
>+  LED_DEF_NO,
>+  LED_DEF_ON,
>+  LED_DEF_OFF,
>+  LED_DEF_KEEP
>+};
>+
>+/**
>  * struct led_uc_plat - Platform data the uclass stores about each device
>  *
>  * @label:LED label
>+ * @default_state* - The initial state of the LED.
>+  se

[U-Boot] [PATCH v2] rsa: Fix LibreSSL before v2.7.0

2018-07-26 Thread nomble
From: Caliph Nomble 

Fix LibreSSL compilation for versions before v2.7.0.

Signed-off-by: Caliph Nomble 
---
Tested compilation on LibreSSL v2.7.4 and v2.6.4 with no new errors or
warnings.

Changes for v2:
- fixed commit message conventions
- fixed coding style

 lib/rsa/rsa-sign.c | 18 --
 1 file changed, 12 insertions(+), 6 deletions(-)

diff --git a/lib/rsa/rsa-sign.c b/lib/rsa/rsa-sign.c
index cfe09cc94c..05ac67b822 100644
--- a/lib/rsa/rsa-sign.c
+++ b/lib/rsa/rsa-sign.c
@@ -20,7 +20,8 @@
 #define HAVE_ERR_REMOVE_THREAD_STATE
 #endif
 
-#if OPENSSL_VERSION_NUMBER < 0x1010L
+#if OPENSSL_VERSION_NUMBER < 0x1010L || \
+   (defined(LIBRESSL_VERSION_NUMBER) && LIBRESSL_VERSION_NUMBER < 
0x0207fL)
 static void RSA_get0_key(const RSA *r,
  const BIGNUM **n, const BIGNUM **e, const BIGNUM **d)
 {
@@ -299,7 +300,8 @@ static int rsa_init(void)
 {
int ret;
 
-#if OPENSSL_VERSION_NUMBER < 0x1010L
+#if OPENSSL_VERSION_NUMBER < 0x1010L || \
+   (defined(LIBRESSL_VERSION_NUMBER) && LIBRESSL_VERSION_NUMBER < 
0x0207fL)
ret = SSL_library_init();
 #else
ret = OPENSSL_init_ssl(0, NULL);
@@ -308,7 +310,8 @@ static int rsa_init(void)
fprintf(stderr, "Failure to init SSL library\n");
return -1;
}
-#if OPENSSL_VERSION_NUMBER < 0x1010L
+#if OPENSSL_VERSION_NUMBER < 0x1010L || \
+   (defined(LIBRESSL_VERSION_NUMBER) && LIBRESSL_VERSION_NUMBER < 
0x0207fL)
SSL_load_error_strings();
 
OpenSSL_add_all_algorithms();
@@ -354,7 +357,8 @@ err_set_rsa:
 err_engine_init:
ENGINE_free(e);
 err_engine_by_id:
-#if OPENSSL_VERSION_NUMBER < 0x1010L
+#if OPENSSL_VERSION_NUMBER < 0x1010L || \
+   (defined(LIBRESSL_VERSION_NUMBER) && LIBRESSL_VERSION_NUMBER < 
0x0207fL)
ENGINE_cleanup();
 #endif
return ret;
@@ -362,7 +366,8 @@ err_engine_by_id:
 
 static void rsa_remove(void)
 {
-#if OPENSSL_VERSION_NUMBER < 0x1010L
+#if OPENSSL_VERSION_NUMBER < 0x1010L || \
+   (defined(LIBRESSL_VERSION_NUMBER) && LIBRESSL_VERSION_NUMBER < 
0x0207fL)
CRYPTO_cleanup_all_ex_data();
ERR_free_strings();
 #ifdef HAVE_ERR_REMOVE_THREAD_STATE
@@ -432,7 +437,8 @@ static int rsa_sign_with_key(RSA *rsa, struct checksum_algo 
*checksum_algo,
ret = rsa_err("Could not obtain signature");
goto err_sign;
}
-   #if OPENSSL_VERSION_NUMBER < 0x1010L
+   #if OPENSSL_VERSION_NUMBER < 0x1010L || \
+   (defined(LIBRESSL_VERSION_NUMBER) && LIBRESSL_VERSION_NUMBER < 
0x0207fL)
EVP_MD_CTX_cleanup(context);
#else
EVP_MD_CTX_reset(context);
-- 
2.16.4

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


[U-Boot] [PATCH v3] mtd: add spi flash id s25fl128l

2018-07-26 Thread Clément Laigle
Add support for SPANSION s25fl128l

Changes for v2:
- Fix EXT_ID

Changes for v3:
- s25fl128l have only one version and no EXT_ID

Signed-off-by: Clément Laigle 
Cc: Jagan Teki 
---
 drivers/mtd/spi/spi_flash_ids.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/mtd/spi/spi_flash_ids.c b/drivers/mtd/spi/spi_flash_ids.c
index 3cdee508c8..604b445e87 100644
--- a/drivers/mtd/spi/spi_flash_ids.c
+++ b/drivers/mtd/spi/spi_flash_ids.c
@@ -109,6 +109,7 @@ const struct spi_flash_info spi_flash_ids[] = {
{"s25fl064p",  INFO(0x010216, 0x4d00,  64 * 1024,   128, RD_FULL | 
WR_QPP) },
{"s25fl128s_256k", INFO(0x012018, 0x4d00, 256 * 1024,64, RD_FULL | 
WR_QPP) },
{"s25fl128s_64k",  INFO(0x012018, 0x4d01,  64 * 1024,   256, RD_FULL | 
WR_QPP) },
+   {"s25fl128l",  INFO(0x016018, 0, 64 * 1024,256, RD_FULL | 
WR_QPP) }
{"s25fl256s_256k", INFO(0x010219, 0x4d00, 256 * 1024,   128, RD_FULL | 
WR_QPP) },
{"s25fs256s_64k",  INFO6(0x010219, 0x4d0181, 64 * 1024, 512, RD_FULL | 
WR_QPP | SECT_4K) },
{"s25fl256s_64k",  INFO(0x010219, 0x4d01,  64 * 1024,   512, RD_FULL | 
WR_QPP) },
-- 
2.17.1

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


Re: [U-Boot] [GIT PULL] u-boot-uniphier/master

2018-07-26 Thread Tom Rini
On Wed, Jul 25, 2018 at 08:52:40AM +0900, Masahiro Yamada wrote:

> Hi Tom,
> 
> Please pull UniPhier updates + Kconfig warning fix.
> 
> Thanks.
> 
> 
> 
> The following changes since commit 323a73adc9a1bf2de43fe03bdd9c3038ce7c2784:
> 
>   mtd: nand: add new enum for storing ECC algorithm (2018-07-23 14:33:21 
> -0400)
> 
> are available in the git repository at:
> 
>   git://git.denx.de/u-boot-uniphier.git master
> 
> for you to fetch changes up to 7ef5b1e7ed040683ff551f0234c471ce0d76828c:
> 
>   ARM: uniphier: enable distro boot (2018-07-25 08:47:53 +0900)
> 

Applied to u-boot/master, thanks!

-- 
Tom


signature.asc
Description: PGP signature
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH] Makefile: Fix 'clean' target

2018-07-26 Thread Tom Rini
On Wed, Jul 25, 2018 at 11:40:30AM -0400, Tom Rini wrote:

> Now that we have removed the DocBook files we need to not try and clean
> that directory.
> 
> Reported-by: ericywl 
> Fixes: 78a88f7930be ("doc: Replace DocBook with sphinx-based docs")
> Signed-off-by: Tom Rini 

Applied to u-boot/master, thanks!

-- 
Tom


signature.asc
Description: PGP signature
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH V2] drivers: regulator: fixed: add u-boot, off-on-delay-us

2018-07-26 Thread Peng Fan
Add u-boot,off-on-delay-us for fixed regulator.

Depends on board design, the gpio regulator sometimes
connects with a big capacitance. When need to off, then
on the regulator, if there is no enough delay,
the voltage does not drop to 0, so introduce this
property to handle such case.

Signed-off-by: Peng Fan 
Reviewed-by: Simon Glass 
Cc: Masahiro Yamada 
---

V2:
 Moved device tree bindings to new directory.
 Simon, I keep you reviewed by tag. Thanks.

 doc/device-tree-bindings/regulator/fixed.txt | 1 +
 drivers/power/regulator/fixed.c  | 6 ++
 2 files changed, 7 insertions(+)

diff --git a/doc/device-tree-bindings/regulator/fixed.txt 
b/doc/device-tree-bindings/regulator/fixed.txt
index 5fd9033fea..453d2bef44 100644
--- a/doc/device-tree-bindings/regulator/fixed.txt
+++ b/doc/device-tree-bindings/regulator/fixed.txt
@@ -11,6 +11,7 @@ Required properties:
 Optional properties:
 - gpio: GPIO to use for enable control
 - startup-delay-us: startup time in microseconds
+- u-boot,off-on-delay-us: off delay time in microseconds
 - regulator constraints (binding info: regulator.txt)
 - enable-active-high: Polarity of GPIO is Active high. If this property
   is missing, the default assumed is Active low.
diff --git a/drivers/power/regulator/fixed.c b/drivers/power/regulator/fixed.c
index 0be5b7bd51..a99aa78310 100644
--- a/drivers/power/regulator/fixed.c
+++ b/drivers/power/regulator/fixed.c
@@ -16,6 +16,7 @@
 struct fixed_regulator_platdata {
struct gpio_desc gpio; /* GPIO for regulator enable control */
unsigned int startup_delay_us;
+   unsigned int off_on_delay_us;
 };
 
 static int fixed_regulator_ofdata_to_platdata(struct udevice *dev)
@@ -50,6 +51,8 @@ static int fixed_regulator_ofdata_to_platdata(struct udevice 
*dev)
/* Get optional ramp up delay */
dev_pdata->startup_delay_us = dev_read_u32_default(dev,
"startup-delay-us", 0);
+   dev_pdata->off_on_delay_us =
+   dev_read_u32_default(dev, "u-boot,off-on-delay-us", 0);
 
return 0;
 }
@@ -123,6 +126,9 @@ static int fixed_regulator_set_enable(struct udevice *dev, 
bool enable)
udelay(dev_pdata->startup_delay_us);
debug("%s: done\n", __func__);
 
+   if (!enable && dev_pdata->off_on_delay_us)
+   udelay(dev_pdata->off_on_delay_us);
+
return 0;
 }
 
-- 
2.14.1

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


Re: [U-Boot] [PATCH V2] drivers: regulator: fixed: add u-boot, off-on-delay-us

2018-07-26 Thread Fabio Estevam
Hi Tom,

On Wed, Jul 25, 2018 at 12:25 PM, Tom Rini  wrote:

> I just yesterday consolidated into just doc/device-tree-bindings/ as
> everything else was already in there.

Excellent, I saw that Breno's patch has been applied.

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


[U-Boot] [PATCH] clk: clk_set_default: accept no-op skip fields

2018-07-26 Thread Neil Armstrong
The Assigned Clock parents and rates misses the fact that a "0" entry can
be passed to skip setting a parent or rate of an assigned clock as
described in the Linux clock bindings at [1].

This patch simply skips the clock reparenting if the DT parsing returns
-ENOENT and the clock rate setting if "0" is passed as clock rate.

[1] 
https://github.com/torvalds/linux/blob/master/Documentation/devicetree/bindings/clock/clock-bindings.txt#L135

Fixes: f4fcba5c5baa "clk: implement clk_set_defaults()"
Signed-off-by: Neil Armstrong 
---
 drivers/clk/clk-uclass.c | 8 
 1 file changed, 8 insertions(+)

diff --git a/drivers/clk/clk-uclass.c b/drivers/clk/clk-uclass.c
index 419d451..2b15978 100644
--- a/drivers/clk/clk-uclass.c
+++ b/drivers/clk/clk-uclass.c
@@ -154,6 +154,10 @@ static int clk_set_default_parents(struct udevice *dev)
for (index = 0; index < num_parents; index++) {
ret = clk_get_by_indexed_prop(dev, "assigned-clock-parents",
  index, &parent_clk);
+   /* If -ENOENT, this is a no-op entry */
+   if (ret == -ENOENT)
+   continue;
+
if (ret) {
debug("%s: could not get parent clock %d for %s\n",
  __func__, index, dev_read_name(dev));
@@ -210,6 +214,10 @@ static int clk_set_default_rates(struct udevice *dev)
goto fail;
 
for (index = 0; index < num_rates; index++) {
+   /* If 0 is passed, this is a no-op */
+   if (!rates[index])
+   continue;
+
ret = clk_get_by_indexed_prop(dev, "assigned-clocks",
  index, &clk);
if (ret) {
-- 
2.7.4

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


Re: [U-Boot] [PATCH v2 0/2] env: Make environment loading log more clear

2018-07-26 Thread Wolfgang Denk
Dear Sam,

In message  
you wrote:
>
> Does this series look ok to you? Can you please review?

Sorry for the delay.

Hm... I wonder if we should handle patch 1/2 in the same way as done
in 2/2, i. e. not remove the printf() in the error case, but turn it
into a debug() ?

Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH,  Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: w...@denx.de
God made the integers; all else is the work of Man.   - Kronecker
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] ext4: massive corruption with ext4write

2018-07-26 Thread Wolfgang Denk
Dear Aaron,

In message <610.LK6WS1oxaM@awilliams-suse> you wrote:
>
...
> While mainline U-Boot does not support Octeon, we have our own fork of it 
> that 
> I maintain. I am using the 2018.07 release with only a few minor changes 
> around the periphery to support the older version of U-Boot Octeon is based 
> off of. I found one source of the corruption in ext4fs_get_new_inode_no() 
> where it is setting bgd->bg_itable_unused without cpu_to_le16, which causes 
> this to break on big-endian systems. Additionally, for 64-bit filesystems, 
> bg_itable_unused_high never gets set.

So when you know the/one cause of the problems, and how to fix it,
then why don't you submit a patch?

Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH,  Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: w...@denx.de
Computers are not intelligent. They only think they are.
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH u-boot 1/2] power: domain: Add the VPU Power Domain driver

2018-07-26 Thread Neil Armstrong
The Amlogic Meson SoCs embeds a specific Power Domain dedicated to the
Video Processing Unit.
This patch implements support for this power domain in preparation of the
future support for the Video display support in U-Boot.

This driver will depend on changes in the clock driver to handle the setup
of the VPU and VAPB clocks configured from DT using assigned-clocks entries.

Signed-off-by: Neil Armstrong 
---
 drivers/power/domain/Kconfig |   7 ++
 drivers/power/domain/Makefile|   1 +
 drivers/power/domain/meson-gx-pwrc-vpu.c | 198 +++
 3 files changed, 206 insertions(+)
 create mode 100644 drivers/power/domain/meson-gx-pwrc-vpu.c

diff --git a/drivers/power/domain/Kconfig b/drivers/power/domain/Kconfig
index 7cfa761..4618847 100644
--- a/drivers/power/domain/Kconfig
+++ b/drivers/power/domain/Kconfig
@@ -16,6 +16,13 @@ config BCM6328_POWER_DOMAIN
  Enable support for manipulating BCM6345 power domains via MMIO
  mapped registers.
 
+config MESON_GX_VPU_POWER_DOMAIN
+   bool "Enable Amlogic Meson GX VPU power domain driver"
+   depends on ARCH_MESON
+   help
+ Enable support for manipulating Amlogic Meson GX Video Processing
+ Unit power domain.
+
 config SANDBOX_POWER_DOMAIN
bool "Enable the sandbox power domain test driver"
depends on POWER_DOMAIN && SANDBOX
diff --git a/drivers/power/domain/Makefile b/drivers/power/domain/Makefile
index c7d7644..4a3282b 100644
--- a/drivers/power/domain/Makefile
+++ b/drivers/power/domain/Makefile
@@ -4,6 +4,7 @@
 
 obj-$(CONFIG_POWER_DOMAIN) += power-domain-uclass.o
 obj-$(CONFIG_BCM6328_POWER_DOMAIN) += bcm6328-power-domain.o
+obj-$(CONFIG_MESON_GX_VPU_POWER_DOMAIN) += meson-gx-pwrc-vpu.o
 obj-$(CONFIG_SANDBOX_POWER_DOMAIN) += sandbox-power-domain.o
 obj-$(CONFIG_SANDBOX_POWER_DOMAIN) += sandbox-power-domain-test.o
 obj-$(CONFIG_TEGRA186_POWER_DOMAIN) += tegra186-power-domain.o
diff --git a/drivers/power/domain/meson-gx-pwrc-vpu.c 
b/drivers/power/domain/meson-gx-pwrc-vpu.c
new file mode 100644
index 000..d631d3e
--- /dev/null
+++ b/drivers/power/domain/meson-gx-pwrc-vpu.c
@@ -0,0 +1,198 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Amlogic Meson VPU Power Domain Controller driver
+ *
+ * Copyright (c) 2018 BayLibre, SAS.
+ * Author: Neil Armstrong 
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+/* AO Offsets */
+
+#define AO_RTI_GEN_PWR_SLEEP0  (0x3a << 2)
+
+#define GEN_PWR_VPU_HDMI   BIT(8)
+#define GEN_PWR_VPU_HDMI_ISO   BIT(9)
+
+/* HHI Offsets */
+
+#define HHI_MEM_PD_REG0(0x40 << 2)
+#define HHI_VPU_MEM_PD_REG0(0x41 << 2)
+#define HHI_VPU_MEM_PD_REG1(0x42 << 2)
+
+struct meson_gx_pwrc_vpu_priv {
+   struct regmap *regmap_ao;
+   struct regmap *regmap_hhi;
+   struct reset_ctl_bulk resets;
+   struct clk_bulk clks;
+};
+
+static int meson_gx_pwrc_vpu_request(struct power_domain *power_domain)
+{
+   return 0;
+}
+
+static int meson_gx_pwrc_vpu_free(struct power_domain *power_domain)
+{
+   return 0;
+}
+
+static int meson_gx_pwrc_vpu_on(struct power_domain *power_domain)
+{
+   struct meson_gx_pwrc_vpu_priv *priv = dev_get_priv(power_domain->dev);
+   int i, ret;
+
+   regmap_update_bits(priv->regmap_ao, AO_RTI_GEN_PWR_SLEEP0,
+  GEN_PWR_VPU_HDMI, 0);
+   udelay(20);
+
+   /* Power Up Memories */
+   for (i = 0; i < 32; i += 2) {
+   regmap_update_bits(priv->regmap_hhi, HHI_VPU_MEM_PD_REG0,
+  0x3 << i, 0);
+   udelay(5);
+   }
+
+   for (i = 0; i < 32; i += 2) {
+   regmap_update_bits(priv->regmap_hhi, HHI_VPU_MEM_PD_REG1,
+  0x3 << i, 0);
+   udelay(5);
+   }
+
+   for (i = 8; i < 16; i++) {
+   regmap_update_bits(priv->regmap_hhi, HHI_MEM_PD_REG0,
+  BIT(i), 0);
+   udelay(5);
+   }
+   udelay(20);
+
+   ret = reset_assert_bulk(&priv->resets);
+   if (ret)
+   return ret;
+
+   regmap_update_bits(priv->regmap_ao, AO_RTI_GEN_PWR_SLEEP0,
+  GEN_PWR_VPU_HDMI_ISO, 0);
+
+   ret = reset_deassert_bulk(&priv->resets);
+   if (ret)
+   return ret;
+
+   ret = clk_enable_bulk(&priv->clks);
+   if (ret)
+   return ret;
+
+   return 0;
+}
+
+static int meson_gx_pwrc_vpu_off(struct power_domain *power_domain)
+{
+   struct meson_gx_pwrc_vpu_priv *priv = dev_get_priv(power_domain->dev);
+   int i;
+
+   regmap_update_bits(priv->regmap_ao, AO_RTI_GEN_PWR_SLEEP0,
+  GEN_PWR_VPU_HDMI_ISO, GEN_PWR_VPU_HDMI_ISO);
+   udelay(20);
+
+   /* Power Down Memories */
+   for (i = 0; i < 32; i += 2) {
+   regmap_update_bits(priv->regmap_hhi, HHI_V

[U-Boot] [PATCH u-boot 0/2] Add the VPU Power Domain support

2018-07-26 Thread Neil Armstrong
The Amlogic Meson SoCs embeds a specific Power Domain dedicated to the
Video Processing Unit.
The first patch implements support for this power domain in preparation of the
future support for the Video display support in U-Boot.

The second patch adds changes in the clock driver to handle the setup
of the VPU and VAPB clocks configured from DT using assigned-clocks entries.

Neil Armstrong (2):
  power: domain: Add the VPU Power Domain driver
  clk: clk_meson: Add mux and div support for reparent and rate setting

 drivers/clk/clk_meson.c  | 533 ++-
 drivers/power/domain/Kconfig |   7 +
 drivers/power/domain/Makefile|   1 +
 drivers/power/domain/meson-gx-pwrc-vpu.c | 198 
 4 files changed, 734 insertions(+), 5 deletions(-)
 create mode 100644 drivers/power/domain/meson-gx-pwrc-vpu.c

-- 
2.7.4

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


[U-Boot] [PATCH u-boot 2/2] clk: clk_meson: Add mux and div support for reparent and rate setting

2018-07-26 Thread Neil Armstrong
This patch adds support for :
- Rate calculation through muxes and generic dividers
- Basic gate setting propagation
- Reparenting for muxes
- Clock rate setting through generic dividers without reparenting

Support is only added to the Composite VPU and VAPB clocks in order
to support the Video Processing Unit Power Domain clock setup.

Signed-off-by: Neil Armstrong 
---
 drivers/clk/clk_meson.c | 533 +++-
 1 file changed, 528 insertions(+), 5 deletions(-)

diff --git a/drivers/clk/clk_meson.c b/drivers/clk/clk_meson.c
index 3850128..be1cc66 100644
--- a/drivers/clk/clk_meson.c
+++ b/drivers/clk/clk_meson.c
@@ -14,12 +14,69 @@
 #include 
 #include "clk_meson.h"
 
+/* This driver support only basic clock tree operations :
+ * - Can calculate clock frequency on a limited tree
+ * - Can Read muxes and basic dividers (0-based only)
+ * - Can enable/disable gates with limited propagation
+ * - Can reparent without propagation, only on muxes
+ * - Can set rates without reparenting
+ * This driver is adapted to what is actually supported by U-Boot
+ */
+
+/* Only the clocks ids we don't want to expose, such as the internal muxes
+ * and dividers of composite clocks, will remain defined here.
+ */
+#define CLKID_MPEG_SEL   10
+#define CLKID_MPEG_DIV   11
+#define CLKID_SAR_ADC_DIV99
+#define CLKID_MALI_0_DIV 101
+#define CLKID_MALI_1_DIV 104
+#define CLKID_CTS_AMCLK_SEL  108
+#define CLKID_CTS_AMCLK_DIV  109
+#define CLKID_CTS_MCLK_I958_SEL  111
+#define CLKID_CTS_MCLK_I958_DIV  112
+#define CLKID_32K_CLK_SEL115
+#define CLKID_32K_CLK_DIV116
+#define CLKID_SD_EMMC_A_CLK0_SEL  117
+#define CLKID_SD_EMMC_A_CLK0_DIV  118
+#define CLKID_SD_EMMC_B_CLK0_SEL  120
+#define CLKID_SD_EMMC_B_CLK0_DIV  121
+#define CLKID_SD_EMMC_C_CLK0_SEL  123
+#define CLKID_SD_EMMC_C_CLK0_DIV  124
+#define CLKID_VPU_0_DIV  127
+#define CLKID_VPU_1_DIV  130
+#define CLKID_VAPB_0_DIV 134
+#define CLKID_VAPB_1_DIV 137
+#define CLKID_HDMI_PLL_PRE_MULT  141
+#define CLKID_MPLL0_DIV  142
+#define CLKID_MPLL1_DIV  143
+#define CLKID_MPLL2_DIV  144
+#define CLKID_MPLL_PREDIV145
+#define CLKID_FCLK_DIV2_DIV  146
+#define CLKID_FCLK_DIV3_DIV  147
+#define CLKID_FCLK_DIV4_DIV  148
+#define CLKID_FCLK_DIV5_DIV  149
+#define CLKID_FCLK_DIV7_DIV  150
+#define CLKID_VDEC_1_SEL 151
+#define CLKID_VDEC_1_DIV 152
+#define CLKID_VDEC_HEVC_SEL  154
+#define CLKID_VDEC_HEVC_DIV  155
+
 #define XTAL_RATE 2400
 
 struct meson_clk {
void __iomem *addr;
 };
 
+static ulong meson_div_get_rate(struct clk *clk, unsigned long id);
+static ulong meson_div_set_rate(struct clk *clk, unsigned long id, ulong rate,
+   ulong current_rate);
+static ulong meson_mux_set_parent(struct clk *clk, unsigned long id,
+ unsigned long parent_id);
+static ulong meson_mux_get_rate(struct clk *clk, unsigned long id);
+static ulong meson_clk_set_rate_by_id(struct clk *clk, unsigned long id,
+ ulong rate, ulong current_rate);
+static ulong meson_mux_get_parent(struct clk *clk, unsigned long id);
 static ulong meson_clk_get_rate_by_id(struct clk *clk, unsigned long id);
 
 struct meson_gate gates[] = {
@@ -126,34 +183,387 @@ struct meson_gate gates[] = {
MESON_GATE(CLKID_SD_EMMC_A_CLK0, HHI_SD_EMMC_CLK_CNTL, 7),
MESON_GATE(CLKID_SD_EMMC_B_CLK0, HHI_SD_EMMC_CLK_CNTL, 23),
MESON_GATE(CLKID_SD_EMMC_C_CLK0, HHI_NAND_CLK_CNTL, 7),
+   MESON_GATE(CLKID_VPU_0, HHI_VPU_CLK_CNTL, 8),
+   MESON_GATE(CLKID_VPU_1, HHI_VPU_CLK_CNTL, 24),
+   MESON_GATE(CLKID_VAPB_0, HHI_VAPBCLK_CNTL, 8),
+   MESON_GATE(CLKID_VAPB_1, HHI_VAPBCLK_CNTL, 24),
+   MESON_GATE(CLKID_VAPB, HHI_VAPBCLK_CNTL, 30),
 };
 
-static int meson_set_gate(struct clk *clk, bool on)
+static int meson_set_gate_by_id(struct clk *clk, unsigned long id, bool on)
 {
struct meson_clk *priv = dev_get_priv(clk->dev);
struct meson_gate *gate;
 
-   if (clk->id >= ARRAY_SIZE(gates))
+   debug("%s: %sabling %d\n", __func__, on ? "en" : "dis", id);
+
+   /* Propagate through muxes */
+   switch (id) {
+   case CLKID_VPU:
+   return meson_set_gate_by_id(clk,
+   meson_mux_get_parent(clk, CLKID_VPU), on);
+   case CLKID_VAPB_SEL:
+   return meson_set_gate_by_id(clk,
+   meson_mux_get_parent(clk, CLKID_VAPB_SEL), on);
+   }
+
+   if (id >= ARRAY_SIZE(gates))
return -ENOENT;
 
-   gate = &gates[clk->id];
+   gate = &gates[id];
 
if (gate->reg == 0)
return 0;
 
+   debug("%s: really %sabling %d\n", __func__, on ? "en" : "dis", id);
+
clrsetbits_le32

Re: [U-Boot] [PATCH V2] drivers: regulator: fixed: add u-boot, off-on-delay-us

2018-07-26 Thread Peng Fan


> -Original Message-
> From: Peng Fan
> Sent: 2018年7月26日 19:47
> To: s...@chromium.org; tr...@konsulko.com
> Cc: yamada.masah...@socionext.com; u-boot@lists.denx.de; Peng Fan
> 
> Subject: [PATCH V2] drivers: regulator: fixed: add u-boot,off-on-delay-us
> 
> Add u-boot,off-on-delay-us for fixed regulator.
> 
> Depends on board design, the gpio regulator sometimes connects with a big
> capacitance. When need to off, then on the regulator, if there is no enough 
> delay,
> the voltage does not drop to 0, so introduce this property to handle such 
> case.
> 
> Signed-off-by: Peng Fan 
> Reviewed-by: Simon Glass 
> Cc: Masahiro Yamada 
> ---
> 
> V2:
>  Moved device tree bindings to new directory.
>  Simon, I keep you reviewed by tag. Thanks.

Sorry, this patchset should be V3 version.

Tom, should I resend a v3 out? Or you could apply this one?

Thanks,
Peng.

> 
>  doc/device-tree-bindings/regulator/fixed.txt | 1 +
>  drivers/power/regulator/fixed.c  | 6 ++
>  2 files changed, 7 insertions(+)
> 
> diff --git a/doc/device-tree-bindings/regulator/fixed.txt
> b/doc/device-tree-bindings/regulator/fixed.txt
> index 5fd9033fea..453d2bef44 100644
> --- a/doc/device-tree-bindings/regulator/fixed.txt
> +++ b/doc/device-tree-bindings/regulator/fixed.txt
> @@ -11,6 +11,7 @@ Required properties:
>  Optional properties:
>  - gpio: GPIO to use for enable control
>  - startup-delay-us: startup time in microseconds
> +- u-boot,off-on-delay-us: off delay time in microseconds
>  - regulator constraints (binding info: regulator.txt)
>  - enable-active-high: Polarity of GPIO is Active high. If this property
>is missing, the default assumed is Active low.
> diff --git a/drivers/power/regulator/fixed.c b/drivers/power/regulator/fixed.c
> index 0be5b7bd51..a99aa78310 100644
> --- a/drivers/power/regulator/fixed.c
> +++ b/drivers/power/regulator/fixed.c
> @@ -16,6 +16,7 @@
>  struct fixed_regulator_platdata {
>   struct gpio_desc gpio; /* GPIO for regulator enable control */
>   unsigned int startup_delay_us;
> + unsigned int off_on_delay_us;
>  };
> 
>  static int fixed_regulator_ofdata_to_platdata(struct udevice *dev) @@ -50,6
> +51,8 @@ static int fixed_regulator_ofdata_to_platdata(struct udevice *dev)
>   /* Get optional ramp up delay */
>   dev_pdata->startup_delay_us = dev_read_u32_default(dev,
>   "startup-delay-us", 0);
> + dev_pdata->off_on_delay_us =
> + dev_read_u32_default(dev, "u-boot,off-on-delay-us", 0);
> 
>   return 0;
>  }
> @@ -123,6 +126,9 @@ static int fixed_regulator_set_enable(struct udevice
> *dev, bool enable)
>   udelay(dev_pdata->startup_delay_us);
>   debug("%s: done\n", __func__);
> 
> + if (!enable && dev_pdata->off_on_delay_us)
> + udelay(dev_pdata->off_on_delay_us);
> +
>   return 0;
>  }
> 
> --
> 2.14.1

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


[U-Boot] [PATCH 1/9] dm: allow 4GB of DRAM on 32bit systems

2018-07-26 Thread Philipp Tomsich
Even on 32bit systems a full 4GB of DRAM may be installed and reported
by the DRAM controller.  Whether these 4GB are larger available
depends on the size/configuration of address decoding windows and
architectural features (e.g. consider a hypothetical architecture that
uses dedicated instructions to access the 'memory-mapped' peripheral
IO ranges).  In U-Boot, the available DRAM, as reported by the
device-model is independent of the accessible DRAM (i.e. adjusted top
and effective size).

This was first reported against the RK3288, which may have 4GB DRAM
attached, but will have a small (e.g. 128MB) window not accessible due
to address decoding limitations.

The solution is to increase the types used for storing the ram_size to
have at least 33 bits even on 32bit systems... i.e. we need to use a
u64 for these always (this was previously only the case for
PHYS_64BIT, which will have unwanted side-effects for 32bit systems
and would require more intrusive changes).

This commit changes the size-field in 'struct ram' and the ram_size in
'gd' to be a u64.

Reported-by: Marty E. Plummer 
Signed-off-by: Philipp Tomsich 
---

 include/asm-generic/global_data.h | 2 +-
 include/ram.h | 9 -
 2 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/include/asm-generic/global_data.h 
b/include/asm-generic/global_data.h
index 0fd4900..f3d687c 100644
--- a/include/asm-generic/global_data.h
+++ b/include/asm-generic/global_data.h
@@ -55,7 +55,7 @@ typedef struct global_data {
unsigned long ram_base; /* Base address of RAM used by U-Boot */
unsigned long ram_top;  /* Top address of RAM used by U-Boot */
unsigned long relocaddr;/* Start address of U-Boot in RAM */
-   phys_size_t ram_size;   /* RAM size */
+   u64 ram_size;   /* RAM size */
unsigned long mon_len;  /* monitor len */
unsigned long irq_sp;   /* irq stack pointer */
unsigned long start_addr_sp;/* start_addr_stackpointer */
diff --git a/include/ram.h b/include/ram.h
index 67e22d7..1fe024f 100644
--- a/include/ram.h
+++ b/include/ram.h
@@ -9,7 +9,14 @@
 
 struct ram_info {
phys_addr_t base;
-   size_t size;
+   /*
+* We use a 64bit type for the size to correctly handle 32bit
+* systems with 4GB of DRAM (which would overflow a 32bit type
+* and read back as 0).  For 64bit systems, we assume (for now)
+* that they will always have less than 2^65 byte of DRAM
+* installed. -- prt
+*/
+   u64 size;
 };
 
 struct ram_ops {
-- 
2.1.4

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


[U-Boot] [PATCH 0/9] Support 4GB of memory on 32bit systems

2018-07-26 Thread Philipp Tomsich

Even on 32bit systems a full 4GB of DRAM may be installed and reported
by the DRAM controller.  Whether these 4GB are larger available
depends on the size/configuration of address decoding windows and
architectural features.

This increases the fields holding the RAM size to have at least 33bits
(i.e. we use a u64) and fixes the fallout from the change: some casts,
the usage of min() and a few printf formats have to be adjusted.


Philipp Tomsich (9):
  dm: allow 4GB of DRAM on 32bit systems
  rockchip: support 4GB DRAM on 32bit systems
  common: include  always
  MIPS: use PRIx64 macros for printing ram size
  rockchip: rk3368: change type of ram-size field for a
min()-calculation
  ram: stm32mp1: use PRIx64 macros for printing ram size
  board: keymile: add explicit cast to truncate the 64bit ram size field
  board: cm_fx6: use PRIx64 macros for printing ram size
  mpc85xx: add casts for ram size in min() calculation.

 arch/arm/include/asm/arch-rockchip/sdram_common.h | 2 +-
 arch/arm/mach-rockchip/sdram_common.c | 8 
 arch/arm/mach-stm32mp/dram_init.c | 2 +-
 arch/mips/mach-bmips/dram.c   | 2 +-
 arch/powerpc/cpu/mpc85xx/cpu.c| 6 --
 board/compulab/cm_fx6/cm_fx6.c| 3 ++-
 board/keymile/km_arm/km_arm.c | 6 --
 drivers/ram/rockchip/dmc-rk3368.c | 2 +-
 drivers/ram/stm32mp1/stm32mp1_ram.c   | 2 +-
 include/asm-generic/global_data.h | 2 +-
 include/common.h  | 1 +
 include/ram.h | 9 -
 12 files changed, 29 insertions(+), 16 deletions(-)

-- 
2.1.4

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


[U-Boot] [PATCH 4/9] MIPS: use PRIx64 macros for printing ram size

2018-07-26 Thread Philipp Tomsich
With the recent changes of the underlying types for the ram size, we need
to adjust the formatting.  Use PRIx64 to print the (now) u64 field.

Signed-off-by: Philipp Tomsich 
---

 arch/mips/mach-bmips/dram.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/mips/mach-bmips/dram.c b/arch/mips/mach-bmips/dram.c
index 87ced7c..0884bce 100644
--- a/arch/mips/mach-bmips/dram.c
+++ b/arch/mips/mach-bmips/dram.c
@@ -28,7 +28,7 @@ int dram_init(void)
return 0;
}
 
-   debug("SDRAM base=%zx, size=%x\n", ram.base, ram.size);
+   debug("SDRAM base=%zx, size=%" PRIx64 "\n", ram.base, ram.size);
 
gd->ram_size = ram.size;
 
-- 
2.1.4

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


[U-Boot] [PATCH 9/9] mpc85xx: add casts for ram size in min() calculation.

2018-07-26 Thread Philipp Tomsich
With the change of the ram size fields to u64, we need to use explicit
casts to ensure that min()-implementation sees the same type for both
its arguments.

Signed-off-by: Philipp Tomsich 
---

 arch/powerpc/cpu/mpc85xx/cpu.c | 6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/arch/powerpc/cpu/mpc85xx/cpu.c b/arch/powerpc/cpu/mpc85xx/cpu.c
index bf48836..5664872 100644
--- a/arch/powerpc/cpu/mpc85xx/cpu.c
+++ b/arch/powerpc/cpu/mpc85xx/cpu.c
@@ -604,7 +604,8 @@ static int reset_tlb(phys_addr_t p_addr, u32 size, 
phys_addr_t *phys_offset)
 int arch_memory_test_advance(u32 *vstart, u32 *size, phys_addr_t *phys_offset)
 {
phys_addr_t test_cap, p_addr;
-   phys_size_t p_size = min(gd->ram_size, CONFIG_MAX_MEM_MAPPED);
+   phys_size_t p_size = min((phys_size_t)gd->ram_size,
+(phys_size_t)CONFIG_MAX_MEM_MAPPED);
 
 #if !defined(CONFIG_PHYS_64BIT) || \
 !defined(CONFIG_SYS_INIT_RAM_ADDR_PHYS) || \
@@ -632,7 +633,8 @@ int arch_memory_test_advance(u32 *vstart, u32 *size, 
phys_addr_t *phys_offset)
 /* initialization for testing area */
 int arch_memory_test_prepare(u32 *vstart, u32 *size, phys_addr_t *phys_offset)
 {
-   phys_size_t p_size = min(gd->ram_size, CONFIG_MAX_MEM_MAPPED);
+   phys_size_t p_size = min((phys_size_t)gd->ram_size,
+(phys_size_t)CONFIG_MAX_MEM_MAPPED);
 
*vstart = CONFIG_SYS_DDR_SDRAM_BASE;
*size = (u32) p_size;   /* CONFIG_MAX_MEM_MAPPED < 4G */
-- 
2.1.4

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


[U-Boot] [PATCH 5/9] rockchip: rk3368: change type of ram-size field for a min()-calculation

2018-07-26 Thread Philipp Tomsich
With the recent changes of the underlying types for the ram size, we need
to cast the constant used in clamping to u64 instead of size_t.

Signed-off-by: Philipp Tomsich 
---

 drivers/ram/rockchip/dmc-rk3368.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/ram/rockchip/dmc-rk3368.c 
b/drivers/ram/rockchip/dmc-rk3368.c
index 8d1b9fa..35d7605 100644
--- a/drivers/ram/rockchip/dmc-rk3368.c
+++ b/drivers/ram/rockchip/dmc-rk3368.c
@@ -960,7 +960,7 @@ static int rk3368_dmc_probe(struct udevice *dev)
* is SoC register space (i.e. reserved), and 0xfe00~0xfeff is
* inaccessible for some IP controller.
*/
-   priv->info.size = min(priv->info.size, (size_t)0xfe00);
+   priv->info.size = min(priv->info.size, (u64)0xfe00);
 
return 0;
 }
-- 
2.1.4

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


[U-Boot] [PATCH 7/9] board: keymile: add explicit cast to truncate the 64bit ram size field

2018-07-26 Thread Philipp Tomsich
With the change to a 64bit ram size field for 32bit architectures, we need
to add an explicit cast to truncate when converting to a pointer.
This casts to 'void*' through 'uintptr_t'.

Signed-off-by: Philipp Tomsich 
---

 board/keymile/km_arm/km_arm.c | 6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/board/keymile/km_arm/km_arm.c b/board/keymile/km_arm/km_arm.c
index ea03be9..13304cf 100644
--- a/board/keymile/km_arm/km_arm.c
+++ b/board/keymile/km_arm/km_arm.c
@@ -521,13 +521,15 @@ int post_hotkeys_pressed(void)
 
 ulong post_word_load(void)
 {
-   void* addr = (void *) (gd->ram_size - BOOTCOUNT_ADDR + POST_WORD_OFF);
+   void *addr = (void *)((uintptr_t)gd->ram_size -
+ BOOTCOUNT_ADDR + POST_WORD_OFF);
return in_le32(addr);
 
 }
 void post_word_store(ulong value)
 {
-   void* addr = (void *) (gd->ram_size - BOOTCOUNT_ADDR + POST_WORD_OFF);
+   void *addr = (void *)((uintptr_t)gd->ram_size -
+ BOOTCOUNT_ADDR + POST_WORD_OFF);
out_le32(addr, value);
 }
 
-- 
2.1.4

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


[U-Boot] [PATCH 8/9] board: cm_fx6: use PRIx64 macros for printing ram size

2018-07-26 Thread Philipp Tomsich
With the recent changes of the underlying types for the ram size, we
need to adjust the formatting.  Use PRIx64 to print the (now) u64
field.

Signed-off-by: Philipp Tomsich 
---

 board/compulab/cm_fx6/cm_fx6.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/board/compulab/cm_fx6/cm_fx6.c b/board/compulab/cm_fx6/cm_fx6.c
index c114cdc..b163abf 100644
--- a/board/compulab/cm_fx6/cm_fx6.c
+++ b/board/compulab/cm_fx6/cm_fx6.c
@@ -704,7 +704,8 @@ int dram_init(void)
gd->ram_size -= 0x10;
break;
default:
-   printf("ERROR: Unsupported DRAM size 0x%lx\n", gd->ram_size);
+   printf("ERROR: Unsupported DRAM size 0x%" PRIx64 "\n",
+  gd->ram_size);
return -1;
}
 
-- 
2.1.4

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


[U-Boot] [PATCH 3/9] common: include always

2018-07-26 Thread Philipp Tomsich
With the ram-size variable changed to u64, we'll need appropriate
macros for printing u64 values correctly either in 32bit builds
(i.e. ILP32 models) or in 64bit builds (i.e. LP64 models).  Best to
make the PRIx64 macro available everywhere.

This include inttypes.h from common.h to make the various macros for
formatted printing available to everyone.

Signed-off-by: Philipp Tomsich 
---

 include/common.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/include/common.h b/include/common.h
index 940161f..9de9145 100644
--- a/include/common.h
+++ b/include/common.h
@@ -30,6 +30,7 @@ typedef volatile unsigned charvu_char;
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 
-- 
2.1.4

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


[U-Boot] [PATCH 6/9] ram: stm32mp1: use PRIx64 macros for printing ram size

2018-07-26 Thread Philipp Tomsich
With the recent changes of the underlying types for the ram size, we
need to adjust the formatting.  Use PRIx64 to print the (now) u64
field.

Signed-off-by: Philipp Tomsich 
---

 arch/arm/mach-stm32mp/dram_init.c   | 2 +-
 drivers/ram/stm32mp1/stm32mp1_ram.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/arm/mach-stm32mp/dram_init.c 
b/arch/arm/mach-stm32mp/dram_init.c
index 7688b3e..e4c6302 100644
--- a/arch/arm/mach-stm32mp/dram_init.c
+++ b/arch/arm/mach-stm32mp/dram_init.c
@@ -25,7 +25,7 @@ int dram_init(void)
debug("Cannot get RAM size: %d\n", ret);
return ret;
}
-   debug("RAM init base=%lx, size=%x\n", ram.base, ram.size);
+   debug("RAM init base=%lx, size=%" PRIx64 "\n", ram.base, ram.size);
 
gd->ram_size = ram.size;
 
diff --git a/drivers/ram/stm32mp1/stm32mp1_ram.c 
b/drivers/ram/stm32mp1/stm32mp1_ram.c
index bd497a3..faf78b2 100644
--- a/drivers/ram/stm32mp1/stm32mp1_ram.c
+++ b/drivers/ram/stm32mp1/stm32mp1_ram.c
@@ -130,7 +130,7 @@ static __maybe_unused int stm32mp1_ddr_setup(struct udevice 
*dev)
 
/* check memory access for all memory */
if (config.info.size != priv->info.size) {
-   printf("DDR invalid size : 0x%x, expected 0x%x\n",
+   printf("DDR invalid size : 0x%" PRIx64 ", expected 0x%x\n",
   priv->info.size, config.info.size);
return -EINVAL;
}
-- 
2.1.4

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


Re: [U-Boot] [PATCH v5] u-boot: remove driver lookup loop from env_save()

2018-07-26 Thread Maxime Ripard
On Thu, Jul 26, 2018 at 07:16:36AM +0200, Simon Goldschmidt wrote:
> Simon, Maxime,
> 
> any input on this? Via which tree would this be pushed? Should we CC Tom?
> 
> It would be nice if 2018.09 had this bug fixed (endless loop in env_save()
> on error).

This looks good to me but Tom will probably end up this patch, so you
definitely want to cc him.

Maxime

-- 
Maxime Ripard, Bootlin (formerly Free Electrons)
Embedded Linux and Kernel engineering
https://bootlin.com


signature.asc
Description: PGP signature
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH 2/9] rockchip: support 4GB DRAM on 32bit systems

2018-07-26 Thread Philipp Tomsich
The calculation in `rockchip_sdram_size` would overflow for 4GB on
32bit systems (i.e. when PHYS_64BIT is not defined).

This makes the internal variables and the signature prototype use a
u64 to ensure that we can represent the 33rd bit (as in '4GB').

Signed-off-by: Philipp Tomsich 
---

 arch/arm/include/asm/arch-rockchip/sdram_common.h | 2 +-
 arch/arm/mach-rockchip/sdram_common.c | 8 
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/arch/arm/include/asm/arch-rockchip/sdram_common.h 
b/arch/arm/include/asm/arch-rockchip/sdram_common.h
index 671c318..edf5911 100644
--- a/arch/arm/include/asm/arch-rockchip/sdram_common.h
+++ b/arch/arm/include/asm/arch-rockchip/sdram_common.h
@@ -50,7 +50,7 @@
 #define SYS_REG_DBW_MASK   3
 
 /* Get sdram size decode from reg */
-size_t rockchip_sdram_size(phys_addr_t reg);
+u64 rockchip_sdram_size(phys_addr_t reg);
 
 /* Called by U-Boot board_init_r for Rockchip SoCs */
 int dram_init(void);
diff --git a/arch/arm/mach-rockchip/sdram_common.c 
b/arch/arm/mach-rockchip/sdram_common.c
index 650d53e..6bad537 100644
--- a/arch/arm/mach-rockchip/sdram_common.c
+++ b/arch/arm/mach-rockchip/sdram_common.c
@@ -11,11 +11,11 @@
 #include 
 
 DECLARE_GLOBAL_DATA_PTR;
-size_t rockchip_sdram_size(phys_addr_t reg)
+u64 rockchip_sdram_size(phys_addr_t reg)
 {
u32 rank, col, bk, cs0_row, cs1_row, bw, row_3_4;
-   size_t chipsize_mb = 0;
-   size_t size_mb = 0;
+   u64 chipsize_mb = 0;
+   u64 size_mb = 0;
u32 ch;
 
u32 sys_reg = readl(reg);
@@ -48,7 +48,7 @@ size_t rockchip_sdram_size(phys_addr_t reg)
  rank, col, bk, cs0_row, bw, row_3_4);
}
 
-   return (size_t)size_mb << 20;
+   return (u64)size_mb << 20;
 }
 
 int dram_init(void)
-- 
2.1.4

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


[U-Boot] [PATCH v1 00/17] cmd: fpga: Fix fpga command handling and add some fpga tests

2018-07-26 Thread Michal Simek
Hi,

We are using this framework for a while and by adding more and more
features it requires small redesigned how commands are handled.
This is something what I have put together to improve readability of
this code and also remove code which is bogus and completely untested.

The patch
https://lists.denx.de/pipermail/u-boot/2018-June/330651.html
is also included in this series to have full picture.

Thanks,
Michal

Changes in v1:
- Remove debug message checking (unfortunatelly we can't parse them)
- Add dependency on image_format_legacy and gzip
- Setup all FIT tests and legacy uimage tests

Michal Simek (17):
  cmd: fpga: Remove fit image support passed without fpga device
  test/py: Extend fpga command to test all fpga load types
  cmd: fpga: Move error handling to do_fpga()
  cmd: fpga: Move fpga_get_op to avoid local function declaration
  cmd: fpga: Cleanup error handling in connection to FPGA_NONE
  cmd: fpga: Move parameter checking for loadfs/loads
  cmd: fpga: Remove parameter checking from fpga loadfs command
  cmd: fpga: Clean wrong_parms handling
  cmd: fpga: Create new do_fpga_wrapper for using u-boot subcommands
  cmd: fpga: Extract fpga info command to separate function
  cmd: fpga: Fix dump and all direct fpga load commands
  cmd: fpga: Fix loadfs command
  cmd: fpga: Fix loadmk command
  cmd: fpga: Add support for missing fpga loadmk commands
  cmd: fpga: Use CMD_RET_FAILURE instead of simple 1
  cmd: fpga: Fix loads command
  MAINTAINERS: Add myself as the FPGA maintainer

 MAINTAINERS|   8 +
 cmd/fpga.c | 652 +++--
 test/py/tests/test_fpga.py | 552 ++
 3 files changed, 896 insertions(+), 316 deletions(-)
 create mode 100644 test/py/tests/test_fpga.py

-- 
1.9.1

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


[U-Boot] [PATCH v1 01/17] cmd: fpga: Remove fit image support passed without fpga device

2018-07-26 Thread Michal Simek
The patch applied in 2010
"cmd_fpga: cleanup help and check parameters"
(sha1: a790b5b2326be9d7c9ad9e3d9b51a8bfabc62d07"
was adding this checking

+   if (dev == FPGA_INVALID_DEVICE) {
+   puts("FPGA device not specified\n");
+   op = FPGA_NONE;
+   }

which simply broke one command flow which was
setenv fpga 
fpga loadmk  // legacy image
fpga loadmk : //fit image

Also this sequence for FIT image is completely broken
setenv fpga 
setenv fpgadata :
fpga loadmk
(Note: For legacy images this is working fine).

even from code I don't think this has ever worked properly
for fit image (dev = FPGA_INVALID_DEVICE should be rejected
by fpga core). Fit image support was in 2008 added by:
"[new uImage] Add new uImage fromat support to fpga command"
(sha1: c28c4d193dbfb20b2dd3a5447640fd6de7fd0720)

Just a summary of these facts that none found this for pretty long time
it shouldn't be a problem to remove this flow (without fpga dev)
completely to simplify the code.

Signed-off-by: Michal Simek 
---

Changes in v1: None

I am rewriting cmd/fpga.c file to use u-boot subcommand and I found
that these flow are not working.

---
 cmd/fpga.c | 25 -
 1 file changed, 25 deletions(-)

diff --git a/cmd/fpga.c b/cmd/fpga.c
index 74ae80c807e2..791fe5cb7718 100644
--- a/cmd/fpga.c
+++ b/cmd/fpga.c
@@ -127,31 +127,6 @@ int do_fpga(cmd_tbl_t *cmdtp, int flag, int argc, char 
*const argv[])
case 3: /* fpga   */
dev = (int)simple_strtoul(argv[2], NULL, 16);
debug("%s: device = %d\n", __func__, dev);
-   /* FIXME - this is a really weak test */
-   if ((argc == 3) && (dev > fpga_count())) {
-   /* must be buffer ptr */
-   debug("%s: Assuming buffer pointer in arg 3\n",
- __func__);
-
-#if defined(CONFIG_FIT)
-   if (fit_parse_subimage(argv[2], (ulong)fpga_data,
-  &fit_addr, &fit_uname)) {
-   fpga_data = (void *)fit_addr;
-   debug("*  fpga: subimage '%s' from FIT image ",
- fit_uname);
-   debug("at 0x%08lx\n", fit_addr);
-   } else
-#endif
-   {
-   fpga_data = (void *)(uintptr_t)dev;
-   debug("*  fpga: cmdline image addr = 0x%08lx\n",
- (ulong)fpga_data);
-   }
-
-   debug("%s: fpga_data = 0x%lx\n",
- __func__, (ulong)fpga_data);
-   dev = FPGA_INVALID_DEVICE;  /* reset device num */
-   }
}
 
if (dev == FPGA_INVALID_DEVICE) {
-- 
1.9.1

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


[U-Boot] [PATCH v1 03/17] cmd: fpga: Move error handling to do_fpga()

2018-07-26 Thread Michal Simek
Clean fpga_get_op() error handling by moving checking/print to do_fpga.

Signed-off-by: Michal Simek 
Reviewed-by: Simon Glass 
---

Changes in v1: None

 cmd/fpga.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/cmd/fpga.c b/cmd/fpga.c
index 791fe5cb7718..abe683720285 100644
--- a/cmd/fpga.c
+++ b/cmd/fpga.c
@@ -74,6 +74,9 @@ int do_fpga(cmd_tbl_t *cmdtp, int flag, int argc, char *const 
argv[])
op = (int)fpga_get_op(argv[1]);
 
switch (op) {
+   case FPGA_NONE:
+   printf("Unknown fpga operation \"%s\"\n", argv[1]);
+   return CMD_RET_USAGE;
 #if defined(CONFIG_CMD_FPGA_LOADFS)
case FPGA_LOADFS:
if (argc < 9)
@@ -360,9 +363,6 @@ static int fpga_get_op(char *opstr)
op = FPGA_LOADS;
 #endif
 
-   if (op == FPGA_NONE)
-   printf("Unknown fpga operation \"%s\"\n", opstr);
-
return op;
 }
 
-- 
1.9.1

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


[U-Boot] [PATCH v1 04/17] cmd: fpga: Move fpga_get_op to avoid local function declaration

2018-07-26 Thread Michal Simek
Move fpga_get_op() to top of file to remove local function declaration
and also remove useless retyping.

Signed-off-by: Michal Simek 
Reviewed-by: Simon Glass 
---

Changes in v1: None

 cmd/fpga.c | 85 ++
 1 file changed, 41 insertions(+), 44 deletions(-)

diff --git a/cmd/fpga.c b/cmd/fpga.c
index abe683720285..de8505e9d4c8 100644
--- a/cmd/fpga.c
+++ b/cmd/fpga.c
@@ -13,9 +13,6 @@
 #include 
 #include 
 
-/* Local functions */
-static int fpga_get_op(char *opstr);
-
 /* Local defines */
 enum {
FPGA_NONE = -1,
@@ -30,6 +27,46 @@ enum {
FPGA_LOADS,
 };
 
+/*
+ * Map op to supported operations.  We don't use a table since we
+ * would just have to relocate it from flash anyway.
+ */
+static int fpga_get_op(char *opstr)
+{
+   int op = FPGA_NONE;
+
+   if (!strcmp("info", opstr))
+   op = FPGA_INFO;
+   else if (!strcmp("loadb", opstr))
+   op = FPGA_LOADB;
+   else if (!strcmp("load", opstr))
+   op = FPGA_LOAD;
+#if defined(CONFIG_CMD_FPGA_LOADP)
+   else if (!strcmp("loadp", opstr))
+   op = FPGA_LOADP;
+#endif
+#if defined(CONFIG_CMD_FPGA_LOADBP)
+   else if (!strcmp("loadbp", opstr))
+   op = FPGA_LOADBP;
+#endif
+#if defined(CONFIG_CMD_FPGA_LOADFS)
+   else if (!strcmp("loadfs", opstr))
+   op = FPGA_LOADFS;
+#endif
+#if defined(CONFIG_CMD_FPGA_LOADMK)
+   else if (!strcmp("loadmk", opstr))
+   op = FPGA_LOADMK;
+#endif
+   else if (!strcmp("dump", opstr))
+   op = FPGA_DUMP;
+#if defined(CONFIG_CMD_FPGA_LOAD_SECURE)
+   else if (!strcmp("loads", opstr))
+   op = FPGA_LOADS;
+#endif
+
+   return op;
+}
+
 /* - */
 /* command form:
  *   fpga
@@ -71,7 +108,7 @@ int do_fpga(cmd_tbl_t *cmdtp, int flag, int argc, char 
*const argv[])
return CMD_RET_USAGE;
}
 
-   op = (int)fpga_get_op(argv[1]);
+   op = fpga_get_op(argv[1]);
 
switch (op) {
case FPGA_NONE:
@@ -326,46 +363,6 @@ int do_fpga(cmd_tbl_t *cmdtp, int flag, int argc, char 
*const argv[])
return rc;
 }
 
-/*
- * Map op to supported operations.  We don't use a table since we
- * would just have to relocate it from flash anyway.
- */
-static int fpga_get_op(char *opstr)
-{
-   int op = FPGA_NONE;
-
-   if (!strcmp("info", opstr))
-   op = FPGA_INFO;
-   else if (!strcmp("loadb", opstr))
-   op = FPGA_LOADB;
-   else if (!strcmp("load", opstr))
-   op = FPGA_LOAD;
-#if defined(CONFIG_CMD_FPGA_LOADP)
-   else if (!strcmp("loadp", opstr))
-   op = FPGA_LOADP;
-#endif
-#if defined(CONFIG_CMD_FPGA_LOADBP)
-   else if (!strcmp("loadbp", opstr))
-   op = FPGA_LOADBP;
-#endif
-#if defined(CONFIG_CMD_FPGA_LOADFS)
-   else if (!strcmp("loadfs", opstr))
-   op = FPGA_LOADFS;
-#endif
-#if defined(CONFIG_CMD_FPGA_LOADMK)
-   else if (!strcmp("loadmk", opstr))
-   op = FPGA_LOADMK;
-#endif
-   else if (!strcmp("dump", opstr))
-   op = FPGA_DUMP;
-#if defined(CONFIG_CMD_FPGA_LOAD_SECURE)
-   else if (!strcmp("loads", opstr))
-   op = FPGA_LOADS;
-#endif
-
-   return op;
-}
-
 #if defined(CONFIG_CMD_FPGA_LOADFS) || defined(CONFIG_CMD_FPGA_LOAD_SECURE)
 U_BOOT_CMD(fpga, 9, 1, do_fpga,
 #else
-- 
1.9.1

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


[U-Boot] [PATCH v1 06/17] cmd: fpga: Move parameter checking for loadfs/loads

2018-07-26 Thread Michal Simek
There is no reason to check parameters in separate switch before main
one. This patch is simplifying error path and checking parameters right
after assignment.

Signed-off-by: Michal Simek 
Reviewed-by: Simon Glass 
---

Changes in v1: None

 cmd/fpga.c | 44 +---
 1 file changed, 21 insertions(+), 23 deletions(-)

diff --git a/cmd/fpga.c b/cmd/fpga.c
index af2f514dca00..48902286f1d5 100644
--- a/cmd/fpga.c
+++ b/cmd/fpga.c
@@ -123,6 +123,14 @@ int do_fpga(cmd_tbl_t *cmdtp, int flag, int argc, char 
*const argv[])
fpga_fsinfo.interface = argv[6];
fpga_fsinfo.dev_part = argv[7];
fpga_fsinfo.filename = argv[8];
+
+   /* Blocksize can be zero */
+   if (!fpga_fsinfo.interface || !fpga_fsinfo.dev_part ||
+   !fpga_fsinfo.filename) {
+   puts("ERR: Wrong interface, dev_part or filename\n");
+   return CMD_RET_USAGE;
+   }
+
argc = 5;
break;
 #endif
@@ -136,6 +144,19 @@ int do_fpga(cmd_tbl_t *cmdtp, int flag, int argc, char 
*const argv[])
 NULL, 16);
fpga_sec_info.encflag = (u8)simple_strtoul(argv[6], NULL, 16);
fpga_sec_info.authflag = (u8)simple_strtoul(argv[5], NULL, 16);
+
+   if (fpga_sec_info.authflag >= FPGA_NO_ENC_OR_NO_AUTH &&
+   fpga_sec_info.encflag >= FPGA_NO_ENC_OR_NO_AUTH) {
+   puts("ERR: Use  for NonSecure bitstream\n");
+   return CMD_RET_USAGE;
+   }
+
+   if (fpga_sec_info.encflag == FPGA_ENC_USR_KEY &&
+   !fpga_sec_info.userkey_addr) {
+   puts("ERR: User key not provided\n");
+   return CMD_RET_USAGE;
+   }
+
argc = 5;
break;
 #endif
@@ -177,29 +198,6 @@ int do_fpga(cmd_tbl_t *cmdtp, int flag, int argc, char 
*const argv[])
switch (op) {
case FPGA_INFO:
break;
-#if defined(CONFIG_CMD_FPGA_LOADFS)
-   case FPGA_LOADFS:
-   /* Blocksize can be zero */
-   if (!fpga_fsinfo.interface || !fpga_fsinfo.dev_part ||
-   !fpga_fsinfo.filename)
-   wrong_parms = 1;
-   break;
-#endif
-#if defined(CONFIG_CMD_FPGA_LOAD_SECURE)
-   case FPGA_LOADS:
-   if (fpga_sec_info.authflag >= FPGA_NO_ENC_OR_NO_AUTH &&
-   fpga_sec_info.encflag >= FPGA_NO_ENC_OR_NO_AUTH) {
-   puts("ERR: use  for NonSecure bitstream\n");
-   wrong_parms = 1;
-   }
-
-   if (fpga_sec_info.encflag == FPGA_ENC_USR_KEY &&
-   !fpga_sec_info.userkey_addr) {
-   wrong_parms = 1;
-   puts("ERR:User key not provided\n");
-   }
-   break;
-#endif
case FPGA_LOAD:
case FPGA_LOADP:
case FPGA_LOADB:
-- 
1.9.1

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


[U-Boot] [PATCH v1 07/17] cmd: fpga: Remove parameter checking from fpga loadfs command

2018-07-26 Thread Michal Simek
Parameter checking is dead code because all the time there must be all
params assigned. If they are not assigned there is no 9th parameters
passed and checking before return CMD_RET_USAGE.

Signed-off-by: Michal Simek 
Reviewed-by: Simon Glass 
---

Changes in v1: None

 cmd/fpga.c | 7 ---
 1 file changed, 7 deletions(-)

diff --git a/cmd/fpga.c b/cmd/fpga.c
index 48902286f1d5..b03dd9dc0ace 100644
--- a/cmd/fpga.c
+++ b/cmd/fpga.c
@@ -124,13 +124,6 @@ int do_fpga(cmd_tbl_t *cmdtp, int flag, int argc, char 
*const argv[])
fpga_fsinfo.dev_part = argv[7];
fpga_fsinfo.filename = argv[8];
 
-   /* Blocksize can be zero */
-   if (!fpga_fsinfo.interface || !fpga_fsinfo.dev_part ||
-   !fpga_fsinfo.filename) {
-   puts("ERR: Wrong interface, dev_part or filename\n");
-   return CMD_RET_USAGE;
-   }
-
argc = 5;
break;
 #endif
-- 
1.9.1

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


[U-Boot] [PATCH v1 13/17] cmd: fpga: Fix loadmk command

2018-07-26 Thread Michal Simek
Convert loadmk command to fpga subcommands. Not all combinations are
working but they have never worked properly. This will be fixed later.

Signed-off-by: Michal Simek 
---

Changes in v1: None

 cmd/fpga.c | 238 -
 1 file changed, 123 insertions(+), 115 deletions(-)

diff --git a/cmd/fpga.c b/cmd/fpga.c
index 826f63371a66..9cb0116af734 100644
--- a/cmd/fpga.c
+++ b/cmd/fpga.c
@@ -65,7 +65,6 @@ static int do_fpga_check_params(long *dev, long *fpga_data, 
size_t *data_size,
 /* Local defines */
 enum {
FPGA_NONE = -1,
-   FPGA_LOADMK,
FPGA_LOADS,
 };
 
@@ -77,12 +76,8 @@ static int fpga_get_op(char *opstr)
 {
int op = FPGA_NONE;
 
-#if defined(CONFIG_CMD_FPGA_LOADMK)
-   if (!strcmp("loadmk", opstr))
-   op = FPGA_LOADMK;
-#endif
 #if defined(CONFIG_CMD_FPGA_LOAD_SECURE)
-   else if (!strcmp("loads", opstr))
+   if (!strcmp("loads", opstr))
op = FPGA_LOADS;
 #endif
 
@@ -102,24 +97,13 @@ int do_fpga(cmd_tbl_t *cmdtp, int flag, int argc, char 
*const argv[])
int op, dev = FPGA_INVALID_DEVICE;
size_t data_size = 0;
void *fpga_data = NULL;
-   char *devstr = env_get("fpga");
-   char *datastr = env_get("fpgadata");
int rc = FPGA_FAIL;
-#if defined(CONFIG_FIT)
-   const char *fit_uname = NULL;
-   ulong fit_addr;
-#endif
 #if defined(CONFIG_CMD_FPGA_LOAD_SECURE)
struct fpga_secure_info fpga_sec_info;
 
memset(&fpga_sec_info, 0, sizeof(fpga_sec_info));
 #endif
 
-   if (devstr)
-   dev = (int) simple_strtoul(devstr, NULL, 16);
-   if (datastr)
-   fpga_data = (void *)simple_strtoul(datastr, NULL, 16);
-
if (argc > 9 || argc < 2) {
debug("%s: Too many or too few args (%d)\n", __func__, argc);
return CMD_RET_USAGE;
@@ -169,15 +153,6 @@ int do_fpga(cmd_tbl_t *cmdtp, int flag, int argc, char 
*const argv[])
return CMD_RET_USAGE;
}
case 4: /* fpga*/
-#if defined(CONFIG_FIT)
-   if (fit_parse_subimage(argv[3], (ulong)fpga_data,
-  &fit_addr, &fit_uname)) {
-   fpga_data = (void *)fit_addr;
-   debug("*  fpga: subimage '%s' from FIT image ",
- fit_uname);
-   debug("at 0x%08lx\n", fit_addr);
-   } else
-#endif
{
fpga_data = (void *)simple_strtoul(argv[3], NULL, 16);
debug("*  fpga: cmdline image address = 0x%08lx\n",
@@ -204,95 +179,6 @@ int do_fpga(cmd_tbl_t *cmdtp, int flag, int argc, char 
*const argv[])
rc = fpga_loads(dev, fpga_data, data_size, &fpga_sec_info);
break;
 #endif
-#if defined(CONFIG_CMD_FPGA_LOADMK)
-   case FPGA_LOADMK:
-   switch (genimg_get_format(fpga_data)) {
-#if defined(CONFIG_IMAGE_FORMAT_LEGACY)
-   case IMAGE_FORMAT_LEGACY:
-   {
-   image_header_t *hdr =
-   (image_header_t *)fpga_data;
-   ulong data;
-   uint8_t comp;
-
-   comp = image_get_comp(hdr);
-   if (comp == IH_COMP_GZIP) {
-#if defined(CONFIG_GZIP)
-   ulong image_buf = image_get_data(hdr);
-   data = image_get_load(hdr);
-   ulong image_size = ~0UL;
-
-   if (gunzip((void *)data, ~0UL,
-  (void *)image_buf,
-  &image_size) != 0) {
-   puts("GUNZIP: error\n");
-   return 1;
-   }
-   data_size = image_size;
-#else
-   puts("Gunzip image is not supported\n");
-   return 1;
-#endif
-   } else {
-   data = (ulong)image_get_data(hdr);
-   data_size = image_get_data_size(hdr);
-   }
-   rc = fpga_load(dev, (void *)data, data_size,
-  BIT_FULL);
-   }
-   break;
-#endif
-#if defined(CONFIG_FIT)
-   case IMAGE_FORMAT_FIT:
-   {
-   const void *fit_hdr = (const void *)fpga_data;
-   int noffset;
-   const void *fit_data;
-
-   

[U-Boot] [PATCH v1 17/17] MAINTAINERS: Add myself as the FPGA maintainer

2018-07-26 Thread Michal Simek
FPGA subsystem requires special care that's why it should be maintained
via one tree.

Signed-off-by: Michal Simek 
Reviewed-by: Simon Glass 
---

Changes in v1: None

 MAINTAINERS | 8 
 1 file changed, 8 insertions(+)

diff --git a/MAINTAINERS b/MAINTAINERS
index b2c9717cb764..3d3cd855cc6a 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -353,6 +353,14 @@ F: test/py/tests/test_efi*
 F: cmd/bootefi.c
 F: tools/file2include.c
 
+FPGA
+M: Michal Simek 
+S: Maintained
+T: git git://git.denx.de/u-boot-microblaze.git
+F: drivers/fpga/
+F: cmd/fpga.c
+F: include/fpga.h
+
 FLATTENED DEVICE TREE
 M: Simon Glass 
 S: Maintained
-- 
1.9.1

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


[U-Boot] [PATCH v1 10/17] cmd: fpga: Extract fpga info command to separate function

2018-07-26 Thread Michal Simek
Move fpga info to U_BOOT_CMD_MKENT subcommand.
Also use strtol instead of simple_strtoul. The reason is that if -1 is
passed (or fpga info without "fpga" variable) the list of all fpgas is
shown.
This functionality is in the fpga core but it couldn't be performed.

Signed-off-by: Michal Simek 
Reviewed-by: Simon Glass 
---

Changes in v1: None

 cmd/fpga.c | 35 +++
 1 file changed, 27 insertions(+), 8 deletions(-)

diff --git a/cmd/fpga.c b/cmd/fpga.c
index ac12af2fa06d..039803870b02 100644
--- a/cmd/fpga.c
+++ b/cmd/fpga.c
@@ -13,10 +13,26 @@
 #include 
 #include 
 
+static long do_fpga_get_device(char *arg)
+{
+   long dev = FPGA_INVALID_DEVICE;
+   char *devstr = env_get("fpga");
+
+   if (devstr)
+   /* Should be strtol to handle -1 cases */
+   dev = simple_strtol(devstr, NULL, 16);
+
+   if (arg)
+   dev = simple_strtol(arg, NULL, 16);
+
+   debug("%s: device = %ld\n", __func__, dev);
+
+   return dev;
+}
+
 /* Local defines */
 enum {
FPGA_NONE = -1,
-   FPGA_INFO,
FPGA_LOAD,
FPGA_LOADB,
FPGA_DUMP,
@@ -35,9 +51,7 @@ static int fpga_get_op(char *opstr)
 {
int op = FPGA_NONE;
 
-   if (!strcmp("info", opstr))
-   op = FPGA_INFO;
-   else if (!strcmp("loadb", opstr))
+   if (!strcmp("loadb", opstr))
op = FPGA_LOADB;
else if (!strcmp("load", opstr))
op = FPGA_LOAD;
@@ -194,10 +208,6 @@ int do_fpga(cmd_tbl_t *cmdtp, int flag, int argc, char 
*const argv[])
}
 
switch (op) {
-   case FPGA_INFO:
-   rc = fpga_info(dev);
-   break;
-
case FPGA_LOAD:
rc = fpga_load(dev, fpga_data, data_size, BIT_FULL);
break;
@@ -331,7 +341,16 @@ int do_fpga(cmd_tbl_t *cmdtp, int flag, int argc, char 
*const argv[])
return rc;
 }
 
+static int do_fpga_info(cmd_tbl_t *cmdtp, int flag, int argc,
+   char * const argv[])
+{
+   long dev = do_fpga_get_device(argv[0]);
+
+   return fpga_info(dev);
+}
+
 static cmd_tbl_t fpga_commands[] = {
+   U_BOOT_CMD_MKENT(info, 1, 1, do_fpga_info, "", ""),
 };
 
 static int do_fpga_wrapper(cmd_tbl_t *cmdtp, int flag, int argc,
-- 
1.9.1

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


[U-Boot] [PATCH v1 09/17] cmd: fpga: Create new do_fpga_wrapper for using u-boot subcommands

2018-07-26 Thread Michal Simek
Create command wrapper to clean fpga subcommands.
The function logic is taken from cmd_dm.c

Signed-off-by: Michal Simek 
Reviewed-by: Simon Glass 
---

Changes in v1: None

 cmd/fpga.c | 42 --
 1 file changed, 40 insertions(+), 2 deletions(-)

diff --git a/cmd/fpga.c b/cmd/fpga.c
index 0e5f4117c02e..ac12af2fa06d 100644
--- a/cmd/fpga.c
+++ b/cmd/fpga.c
@@ -331,10 +331,48 @@ int do_fpga(cmd_tbl_t *cmdtp, int flag, int argc, char 
*const argv[])
return rc;
 }
 
+static cmd_tbl_t fpga_commands[] = {
+};
+
+static int do_fpga_wrapper(cmd_tbl_t *cmdtp, int flag, int argc,
+  char *const argv[])
+{
+   cmd_tbl_t *fpga_cmd;
+   int ret;
+
+   if (argc < 2)
+   return CMD_RET_USAGE;
+
+   fpga_cmd = find_cmd_tbl(argv[1], fpga_commands,
+   ARRAY_SIZE(fpga_commands));
+
+   /* This should be removed when all functions are converted */
+   if (!fpga_cmd)
+   return do_fpga(cmdtp, flag, argc, argv);
+
+   /* FIXME This can't be reached till all functions are converted */
+   if (!fpga_cmd) {
+   debug("fpga: non existing command\n");
+   return CMD_RET_USAGE;
+   }
+
+   argc -= 2;
+   argv += 2;
+
+   if (argc > fpga_cmd->maxargs) {
+   debug("fpga: more parameters passed\n");
+   return CMD_RET_USAGE;
+   }
+
+   ret = fpga_cmd->cmd(fpga_cmd, flag, argc, argv);
+
+   return cmd_process_error(fpga_cmd, ret);
+}
+
 #if defined(CONFIG_CMD_FPGA_LOADFS) || defined(CONFIG_CMD_FPGA_LOAD_SECURE)
-U_BOOT_CMD(fpga, 9, 1, do_fpga,
+U_BOOT_CMD(fpga, 9, 1, do_fpga_wrapper,
 #else
-U_BOOT_CMD(fpga, 6, 1, do_fpga,
+U_BOOT_CMD(fpga, 6, 1, do_fpga_wrapper,
 #endif
   "loadable FPGA image support",
   "[operation type] [device number] [image address] [image size]\n"
-- 
1.9.1

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


[U-Boot] [PATCH v1 08/17] cmd: fpga: Clean wrong_parms handling

2018-07-26 Thread Michal Simek
There is no reason to check parameters in separate switch. Check them
directly when they are read. Also there is no reason to check loadmk
case separately because fpga_data address must be non zero too.

Signed-off-by: Michal Simek 
Reviewed-by: Simon Glass 
---

Changes in v1: None

 cmd/fpga.c | 35 ---
 1 file changed, 8 insertions(+), 27 deletions(-)

diff --git a/cmd/fpga.c b/cmd/fpga.c
index b03dd9dc0ace..0e5f4117c02e 100644
--- a/cmd/fpga.c
+++ b/cmd/fpga.c
@@ -83,7 +83,6 @@ int do_fpga(cmd_tbl_t *cmdtp, int flag, int argc, char *const 
argv[])
char *devstr = env_get("fpga");
char *datastr = env_get("fpgadata");
int rc = FPGA_FAIL;
-   int wrong_parms = 0;
 #if defined(CONFIG_FIT)
const char *fit_uname = NULL;
ulong fit_addr;
@@ -160,7 +159,10 @@ int do_fpga(cmd_tbl_t *cmdtp, int flag, int argc, char 
*const argv[])
switch (argc) {
case 5: /* fpga */
data_size = simple_strtoul(argv[4], NULL, 16);
-
+   if (!data_size) {
+   puts("Zero data_size\n");
+   return CMD_RET_USAGE;
+   }
case 4: /* fpga*/
 #if defined(CONFIG_FIT)
if (fit_parse_subimage(argv[3], (ulong)fpga_data,
@@ -177,7 +179,10 @@ int do_fpga(cmd_tbl_t *cmdtp, int flag, int argc, char 
*const argv[])
  (ulong)fpga_data);
}
debug("%s: fpga_data = 0x%lx\n", __func__, (ulong)fpga_data);
-
+   if (!fpga_data) {
+   puts("Zero fpga_data address\n");
+   return CMD_RET_USAGE;
+   }
case 3: /* fpga   */
dev = (int)simple_strtoul(argv[2], NULL, 16);
debug("%s: device = %d\n", __func__, dev);
@@ -190,30 +195,6 @@ int do_fpga(cmd_tbl_t *cmdtp, int flag, int argc, char 
*const argv[])
 
switch (op) {
case FPGA_INFO:
-   break;
-   case FPGA_LOAD:
-   case FPGA_LOADP:
-   case FPGA_LOADB:
-   case FPGA_LOADBP:
-   case FPGA_DUMP:
-   if (!fpga_data || !data_size)
-   wrong_parms = 1;
-   break;
-#if defined(CONFIG_CMD_FPGA_LOADMK)
-   case FPGA_LOADMK:
-   if (!fpga_data)
-   wrong_parms = 1;
-   break;
-#endif
-   }
-
-   if (wrong_parms) {
-   puts("Wrong parameters for FPGA request\n");
-   return CMD_RET_USAGE;
-   }
-
-   switch (op) {
-   case FPGA_INFO:
rc = fpga_info(dev);
break;
 
-- 
1.9.1

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


[U-Boot] [PATCH v1 02/17] test/py: Extend fpga command to test all fpga load types

2018-07-26 Thread Michal Simek
Add support for info, load, loadp, loadb, loadbp, loadmk_legacy,
loadmk_legacy_gz, loadmk_fit, loadfs also with variable support.

There are probably missing failed tests.

Signed-off-by: Michal Simek 
Reviewed-by: Simon Glass 
---

Changes in v1:
- Remove debug message checking (unfortunatelly we can't parse them)
- Add dependency on image_format_legacy and gzip
- Setup all FIT tests and legacy uimage tests

 test/py/tests/test_fpga.py | 552 +
 1 file changed, 552 insertions(+)
 create mode 100644 test/py/tests/test_fpga.py

diff --git a/test/py/tests/test_fpga.py b/test/py/tests/test_fpga.py
new file mode 100644
index ..7459ce586740
--- /dev/null
+++ b/test/py/tests/test_fpga.py
@@ -0,0 +1,552 @@
+# SPDX-License-Identifier: GPL-2.0
+#
+# Copyright (c) 2018, Xilinx Inc.
+#
+# Michal Simek
+# Siva Durga Prasad Paladugu
+
+import pytest
+import re
+import random
+import u_boot_utils
+
+"""
+Note: This test relies on boardenv_* containing configuration values to define
+the network available and files to be used for testing. Without this, this test
+will be automatically skipped.
+
+For example:
+
+# True if a DHCP server is attached to the network, and should be tested.
+env__net_dhcp_server = True
+
+# A list of environment variables that should be set in order to configure a
+# static IP. In this test case we atleast need serverip for performing tftpb
+# to get required files.
+env__net_static_env_vars = [
+("ipaddr", "10.0.0.100"),
+("netmask", "255.255.255.0"),
+("serverip", "10.0.0.1"),
+]
+
+# Details regarding the files that may be read from a TFTP server. .
+env__fpga_secure_readable_file = {
+"fn": "auth_bhdr_ppk1_bit.bin",
+"enckupfn": "auth_bhdr_enc_kup_load_bit.bin",
+"addr": 0x100,
+"keyaddr": 0x10,
+"keyfn": "key.txt",
+}
+
+env__fpga_under_test = {
+"dev": 0,
+"addr" : 0x100,
+"bitstream_load": "compress.bin",
+"bitstream_load_size": 1831960,
+"bitstream_loadp": "compress_pr.bin",
+"bitstream_loadp_size": 423352,
+"bitstream_loadb": "compress.bit",
+"bitstream_loadb_size": 1832086,
+"bitstream_loadbp": "compress_pr.bit",
+"bitstream_loadbp_size": 423491,
+"mkimage_legacy": "download.ub",
+"mkimage_legacy_size": 13321468,
+"mkimage_legacy_gz": "download.gz.ub",
+"mkimage_legacy_gz_size": 53632,
+"mkimage_fit": "download-fit.ub",
+"mkimage_fit_size": 13322784,
+"loadfs": "mmc 0 compress.bin",
+"loadfs_size": 1831960,
+"loadfs_block_size": 0x1,
+}
+"""
+
+import test_net
+
+def check_dev(u_boot_console):
+f = u_boot_console.config.env.get('env__fpga_under_test', None)
+if not f:
+pytest.skip('No FPGA to test')
+
+dev = f.get('dev', -1)
+if dev < 0:
+pytest.fail('No dev specified via env__fpga_under_test')
+
+return dev, f
+
+def load_file_from_var(u_boot_console, name):
+dev, f = check_dev(u_boot_console)
+
+addr = f.get('addr', -1)
+if addr < 0:
+pytest.fail('No address specified via env__fpga_under_test')
+
+test_net.test_net_dhcp(u_boot_console)
+test_net.test_net_setup_static(u_boot_console)
+bit = f['%s' % (name)]
+bit_size = f['%s_size' % (name)]
+
+expected_tftp = 'Bytes transferred = %d' % bit_size
+output = u_boot_console.run_command('tftpboot %x %s' % (addr, bit))
+assert expected_tftp in output
+
+return f, dev, addr, bit, bit_size
+
+## FPGA FAIL test ##
+expected_usage = 'fpga - loadable FPGA image support'
+
+@pytest.mark.xfail
+@pytest.mark.buildconfigspec('cmd_fpga')
+def test_fpga_fail(u_boot_console):
+# Test non valid fpga subcommand
+expected = 'fpga: non existing command'
+output = u_boot_console.run_command('fpga broken 0')
+#assert expected in output
+assert expected_usage in output
+
+@pytest.mark.buildconfigspec('cmd_fpga')
+def test_fpga_help(u_boot_console):
+# Just show help
+output = u_boot_console.run_command('fpga')
+assert expected_usage in output
+
+
+## FPGA DUMP tests ##
+
+@pytest.mark.buildconfigspec('cmd_fpga')
+def test_fpga_dump(u_boot_console):
+pytest.skip('Not implemented now')
+
+@pytest.mark.buildconfigspec('cmd_fpga')
+def test_fpga_dump_variable(u_boot_console):
+# Same as above but via "fpga" variable
+pytest.skip('Not implemented now')
+
+## FPGA INFO tests ##
+
+@pytest.mark.buildconfigspec('cmd_fpga')
+def test_fpga_info_fail(u_boot_console):
+# Maybe this can be skipped completely
+dev, f = check_dev(u_boot_console)
+
+# Multiple parameters to fpga info should fail
+expected = 'fpga: more parameters passed'
+output = u_boot_console.run_command('fpga info 0 0')
+#assert expected in output
+assert expected_usage in output
+
+@pytest.mark.buildconfigspec('cmd_fpga')
+def test_fpga_info_list(u_boot_console):
+# Maybe this can be skipped completely
+dev, f = check_dev(u_boot_console)

[U-Boot] [PATCH v1 05/17] cmd: fpga: Cleanup error handling in connection to FPGA_NONE

2018-07-26 Thread Michal Simek
Incorrect command is already handled and FPGA_NONE should be used only
one. In case of error CMD_RET_USAGE can be returned directly without any
addition logic around.

Signed-off-by: Michal Simek 
Reviewed-by: Simon Glass 
---

Changes in v1: None

 cmd/fpga.c | 8 ++--
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/cmd/fpga.c b/cmd/fpga.c
index de8505e9d4c8..af2f514dca00 100644
--- a/cmd/fpga.c
+++ b/cmd/fpga.c
@@ -171,11 +171,10 @@ int do_fpga(cmd_tbl_t *cmdtp, int flag, int argc, char 
*const argv[])
 
if (dev == FPGA_INVALID_DEVICE) {
puts("FPGA device not specified\n");
-   op = FPGA_NONE;
+   return CMD_RET_USAGE;
}
 
switch (op) {
-   case FPGA_NONE:
case FPGA_INFO:
break;
 #if defined(CONFIG_CMD_FPGA_LOADFS)
@@ -219,13 +218,10 @@ int do_fpga(cmd_tbl_t *cmdtp, int flag, int argc, char 
*const argv[])
 
if (wrong_parms) {
puts("Wrong parameters for FPGA request\n");
-   op = FPGA_NONE;
+   return CMD_RET_USAGE;
}
 
switch (op) {
-   case FPGA_NONE:
-   return CMD_RET_USAGE;
-
case FPGA_INFO:
rc = fpga_info(dev);
break;
-- 
1.9.1

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


[U-Boot] [PATCH v1 14/17] cmd: fpga: Add support for missing fpga loadmk commands

2018-07-26 Thread Michal Simek
Not all 4 fpga loadmk FIT image commands

Signed-off-by: Michal Simek 
- New patch from RFC

---

Changes in v1: None

 cmd/fpga.c | 55 +++
 1 file changed, 35 insertions(+), 20 deletions(-)

diff --git a/cmd/fpga.c b/cmd/fpga.c
index 9cb0116af734..de9d19dd8e91 100644
--- a/cmd/fpga.c
+++ b/cmd/fpga.c
@@ -22,7 +22,7 @@ static long do_fpga_get_device(char *arg)
/* Should be strtol to handle -1 cases */
dev = simple_strtol(devstr, NULL, 16);
 
-   if (arg)
+   if (dev == FPGA_INVALID_DEVICE && arg)
dev = simple_strtol(arg, NULL, 16);
 
debug("%s: device = %ld\n", __func__, dev);
@@ -312,29 +312,44 @@ static int do_fpga_loadmk(cmd_tbl_t *cmdtp, int flag, int 
argc,
ulong dev = do_fpga_get_device(argv[0]);
char *datastr = env_get("fpgadata");
 
-   if (datastr)
-   fpga_data = (void *)simple_strtoul(datastr, NULL, 16);
+   debug("fpga: argc %x, dev %lx, datastr %s\n", argc, dev, datastr);
+
+   if (dev == FPGA_INVALID_DEVICE) {
+   debug("fpga: Invalid fpga device\n");
+   return CMD_RET_USAGE;
+   }
+
+   if (argc == 0 && !datastr) {
+   debug("fpga: No datastr passed\n");
+   return CMD_RET_USAGE;
+   }
 
if (argc == 2) {
+   datastr = argv[1];
+   debug("fpga: Full command with two args\n");
+   } else if (argc == 1 && !datastr) {
+   debug("fpga: Dev is setup - fpgadata passed\n");
+   datastr = argv[0];
+   }
+
 #if defined(CONFIG_FIT)
-   if (fit_parse_subimage(argv[1], (ulong)fpga_data,
-  &fit_addr, &fit_uname)) {
-   fpga_data = (void *)fit_addr;
-   debug("*  fpga: subimage '%s' from FIT image ",
- fit_uname);
-   debug("at 0x%08lx\n", fit_addr);
-   } else
+   if (fit_parse_subimage(datastr, (ulong)fpga_data,
+  &fit_addr, &fit_uname)) {
+   fpga_data = (void *)fit_addr;
+   debug("*  fpga: subimage '%s' from FIT image ",
+ fit_uname);
+   debug("at 0x%08lx\n", fit_addr);
+   } else
 #endif
-   {
-   fpga_data = (void *)simple_strtoul(argv[1], NULL, 16);
-   debug("*  fpga: cmdline image address = 0x%08lx\n",
- (ulong)fpga_data);
-   }
-   debug("%s: fpga_data = 0x%lx\n", __func__, (ulong)fpga_data);
-   if (!fpga_data) {
-   puts("Zero fpga_data address\n");
-   return CMD_RET_USAGE;
-   }
+   {
+   fpga_data = (void *)simple_strtoul(datastr, NULL, 16);
+   debug("*  fpga: cmdline image address = 0x%08lx\n",
+ (ulong)fpga_data);
+   }
+   debug("%s: fpga_data = 0x%lx\n", __func__, (ulong)fpga_data);
+   if (!fpga_data) {
+   puts("Zero fpga_data address\n");
+   return CMD_RET_USAGE;
}
 
switch (genimg_get_format(fpga_data)) {
-- 
1.9.1

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


[U-Boot] [PATCH v1 15/17] cmd: fpga: Use CMD_RET_FAILURE instead of simple 1

2018-07-26 Thread Michal Simek
Use standard return command failure macro.

Signed-off-by: Michal Simek 
Reviewed-by: Simon Glass 
---

Changes in v1: None

 cmd/fpga.c | 14 +++---
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/cmd/fpga.c b/cmd/fpga.c
index de9d19dd8e91..89fae86b8253 100644
--- a/cmd/fpga.c
+++ b/cmd/fpga.c
@@ -371,7 +371,7 @@ static int do_fpga_loadmk(cmd_tbl_t *cmdtp, int flag, int 
argc,
if (gunzip((void *)data, ~0UL, (void *)image_buf,
   &image_size) != 0) {
puts("GUNZIP: error\n");
-   return 1;
+   return CMD_RET_FAILURE;
}
data_size = image_size;
 #else
@@ -395,32 +395,32 @@ static int do_fpga_loadmk(cmd_tbl_t *cmdtp, int flag, int 
argc,
 
if (!fit_uname) {
puts("No FIT subimage unit name\n");
-   return 1;
+   return CMD_RET_FAILURE;
}
 
if (!fit_check_format(fit_hdr)) {
puts("Bad FIT image format\n");
-   return 1;
+   return CMD_RET_FAILURE;
}
 
/* get fpga component image node offset */
noffset = fit_image_get_node(fit_hdr, fit_uname);
if (noffset < 0) {
printf("Can't find '%s' FIT subimage\n", fit_uname);
-   return 1;
+   return CMD_RET_FAILURE;
}
 
/* verify integrity */
if (!fit_image_verify(fit_hdr, noffset)) {
puts("Bad Data Hash\n");
-   return 1;
+   return CMD_RET_FAILURE;
}
 
/* get fpga subimage data address and length */
if (fit_image_get_data(fit_hdr, noffset, &fit_data,
   &data_size)) {
puts("Fpga subimage data not found\n");
-   return 1;
+   return CMD_RET_FAILURE;
}
 
return fpga_load(dev, fit_data, data_size, BIT_FULL);
@@ -428,7 +428,7 @@ static int do_fpga_loadmk(cmd_tbl_t *cmdtp, int flag, int 
argc,
 #endif
default:
puts("** Unknown image type\n");
-   return FPGA_FAIL;
+   return CMD_RET_FAILURE;
}
 }
 #endif
-- 
1.9.1

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


[U-Boot] [PATCH v1 11/17] cmd: fpga: Fix dump and all direct fpga load commands

2018-07-26 Thread Michal Simek
Separate dump, load, loadb, loadp and loadbp commands to separate
functions to make it clear how they are called and what parameters they
need.

Signed-off-by: Michal Simek 
Reviewed-by: Simon Glass 
---

Changes in v1: None

Maybe they can be still groupped together with one switch/case but it
can be done later.

---
 cmd/fpga.c | 166 +
 1 file changed, 122 insertions(+), 44 deletions(-)

diff --git a/cmd/fpga.c b/cmd/fpga.c
index 039803870b02..9c715db80512 100644
--- a/cmd/fpga.c
+++ b/cmd/fpga.c
@@ -30,15 +30,42 @@ static long do_fpga_get_device(char *arg)
return dev;
 }
 
+static int do_fpga_check_params(long *dev, long *fpga_data, size_t *data_size,
+   cmd_tbl_t *cmdtp, int argc, char *const argv[])
+{
+   size_t local_data_size;
+   long local_fpga_data;
+
+   debug("%s %d, %d\n", __func__, argc, cmdtp->maxargs);
+
+   if (argc != cmdtp->maxargs) {
+   debug("fpga: incorrect parameters passed\n");
+   return CMD_RET_USAGE;
+   }
+
+   *dev = do_fpga_get_device(argv[0]);
+
+   local_fpga_data = simple_strtol(argv[1], NULL, 16);
+   if (!local_fpga_data) {
+   debug("fpga: zero fpga_data address\n");
+   return CMD_RET_USAGE;
+   }
+   *fpga_data = local_fpga_data;
+
+   local_data_size = simple_strtoul(argv[2], NULL, 16);
+   if (!local_data_size) {
+   debug("fpga: zero size\n");
+   return CMD_RET_USAGE;
+   }
+   *data_size = local_data_size;
+
+   return 0;
+}
+
 /* Local defines */
 enum {
FPGA_NONE = -1,
-   FPGA_LOAD,
-   FPGA_LOADB,
-   FPGA_DUMP,
FPGA_LOADMK,
-   FPGA_LOADP,
-   FPGA_LOADBP,
FPGA_LOADFS,
FPGA_LOADS,
 };
@@ -51,28 +78,14 @@ static int fpga_get_op(char *opstr)
 {
int op = FPGA_NONE;
 
-   if (!strcmp("loadb", opstr))
-   op = FPGA_LOADB;
-   else if (!strcmp("load", opstr))
-   op = FPGA_LOAD;
-#if defined(CONFIG_CMD_FPGA_LOADP)
-   else if (!strcmp("loadp", opstr))
-   op = FPGA_LOADP;
-#endif
-#if defined(CONFIG_CMD_FPGA_LOADBP)
-   else if (!strcmp("loadbp", opstr))
-   op = FPGA_LOADBP;
-#endif
 #if defined(CONFIG_CMD_FPGA_LOADFS)
-   else if (!strcmp("loadfs", opstr))
+   if (!strcmp("loadfs", opstr))
op = FPGA_LOADFS;
 #endif
 #if defined(CONFIG_CMD_FPGA_LOADMK)
else if (!strcmp("loadmk", opstr))
op = FPGA_LOADMK;
 #endif
-   else if (!strcmp("dump", opstr))
-   op = FPGA_DUMP;
 #if defined(CONFIG_CMD_FPGA_LOAD_SECURE)
else if (!strcmp("loads", opstr))
op = FPGA_LOADS;
@@ -208,26 +221,6 @@ int do_fpga(cmd_tbl_t *cmdtp, int flag, int argc, char 
*const argv[])
}
 
switch (op) {
-   case FPGA_LOAD:
-   rc = fpga_load(dev, fpga_data, data_size, BIT_FULL);
-   break;
-
-#if defined(CONFIG_CMD_FPGA_LOADP)
-   case FPGA_LOADP:
-   rc = fpga_load(dev, fpga_data, data_size, BIT_PARTIAL);
-   break;
-#endif
-
-   case FPGA_LOADB:
-   rc = fpga_loadbitstream(dev, fpga_data, data_size, BIT_FULL);
-   break;
-
-#if defined(CONFIG_CMD_FPGA_LOADBP)
-   case FPGA_LOADBP:
-   rc = fpga_loadbitstream(dev, fpga_data, data_size, BIT_PARTIAL);
-   break;
-#endif
-
 #if defined(CONFIG_CMD_FPGA_LOADFS)
case FPGA_LOADFS:
rc = fpga_fsload(dev, fpga_data, data_size, &fpga_fsinfo);
@@ -330,10 +323,6 @@ int do_fpga(cmd_tbl_t *cmdtp, int flag, int argc, char 
*const argv[])
break;
 #endif
 
-   case FPGA_DUMP:
-   rc = fpga_dump(dev, fpga_data, data_size);
-   break;
-
default:
printf("Unknown operation\n");
return CMD_RET_USAGE;
@@ -349,8 +338,97 @@ static int do_fpga_info(cmd_tbl_t *cmdtp, int flag, int 
argc,
return fpga_info(dev);
 }
 
+static int do_fpga_dump(cmd_tbl_t *cmdtp, int flag, int argc,
+   char * const argv[])
+{
+   size_t data_size = 0;
+   long fpga_data, dev;
+   int ret;
+
+   ret = do_fpga_check_params(&dev, &fpga_data, &data_size,
+  cmdtp, argc, argv);
+   if (ret)
+   return ret;
+
+   return fpga_dump(dev, (void *)fpga_data, data_size);
+}
+
+static int do_fpga_load(cmd_tbl_t *cmdtp, int flag, int argc,
+   char * const argv[])
+{
+   size_t data_size = 0;
+   long fpga_data, dev;
+   int ret;
+
+   ret = do_fpga_check_params(&dev, &fpga_data, &data_size,
+  cmdtp, argc, argv);
+   if (ret)
+   return ret;
+
+   return fpga_load(dev, (void *)fpga_data, data_size, BIT_FULL);
+}
+
+static int do_fpga_loadb(cmd_tbl_t *cmdtp, int fla

[U-Boot] [PATCH v1 16/17] cmd: fpga: Fix loads command

2018-07-26 Thread Michal Simek
Convert last loads command to fpga subcommands.

Signed-off-by: Michal Simek 
---

Changes in v1: None

 cmd/fpga.c | 148 +++--
 1 file changed, 36 insertions(+), 112 deletions(-)

diff --git a/cmd/fpga.c b/cmd/fpga.c
index 89fae86b8253..88a8e3f3186b 100644
--- a/cmd/fpga.c
+++ b/cmd/fpga.c
@@ -62,130 +62,57 @@ static int do_fpga_check_params(long *dev, long 
*fpga_data, size_t *data_size,
return 0;
 }
 
-/* Local defines */
-enum {
-   FPGA_NONE = -1,
-   FPGA_LOADS,
-};
-
-/*
- * Map op to supported operations.  We don't use a table since we
- * would just have to relocate it from flash anyway.
- */
-static int fpga_get_op(char *opstr)
-{
-   int op = FPGA_NONE;
-
 #if defined(CONFIG_CMD_FPGA_LOAD_SECURE)
-   if (!strcmp("loads", opstr))
-   op = FPGA_LOADS;
-#endif
-
-   return op;
-}
-
-/* - */
-/* command form:
- *   fpga
- * where op is 'load', 'dump', or 'info'
- * If there is no device number field, the fpga environment variable is used.
- * If there is no data addr field, the fpgadata environment variable is used.
- * The info command requires no data address field.
- */
-int do_fpga(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])
+int do_fpga_loads(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])
 {
-   int op, dev = FPGA_INVALID_DEVICE;
size_t data_size = 0;
-   void *fpga_data = NULL;
-   int rc = FPGA_FAIL;
-#if defined(CONFIG_CMD_FPGA_LOAD_SECURE)
+   long fpga_data, dev;
+   int ret;
struct fpga_secure_info fpga_sec_info;
 
memset(&fpga_sec_info, 0, sizeof(fpga_sec_info));
-#endif
 
-   if (argc > 9 || argc < 2) {
-   debug("%s: Too many or too few args (%d)\n", __func__, argc);
+   if (argc < 5) {
+   debug("fpga: incorrect parameters passed\n");
return CMD_RET_USAGE;
}
 
-   op = fpga_get_op(argv[1]);
-
-   switch (op) {
-   case FPGA_NONE:
-   printf("Unknown fpga operation \"%s\"\n", argv[1]);
+   if (argc == 6)
+   fpga_sec_info.userkey_addr = (u8 *)(uintptr_t)
+ simple_strtoull(argv[5],
+ NULL, 16);
+   else
+   /*
+* If 6th parameter is not passed then do_fpga_check_params
+* will get 5 instead of expected 6 which means that function
+* return CMD_RET_USAGE. Increase number of params +1 to pass
+* this.
+*/
+   argc++;
+
+   fpga_sec_info.encflag = (u8)simple_strtoul(argv[4], NULL, 16);
+   fpga_sec_info.authflag = (u8)simple_strtoul(argv[3], NULL, 16);
+
+   if (fpga_sec_info.authflag >= FPGA_NO_ENC_OR_NO_AUTH &&
+   fpga_sec_info.encflag >= FPGA_NO_ENC_OR_NO_AUTH) {
+   debug("fpga: Use  for NonSecure bitstream\n");
return CMD_RET_USAGE;
-#if defined(CONFIG_CMD_FPGA_LOAD_SECURE)
-   case FPGA_LOADS:
-   if (argc < 7)
-   return CMD_RET_USAGE;
-   if (argc == 8)
-   fpga_sec_info.userkey_addr = (u8 *)(uintptr_t)
-simple_strtoull(argv[7],
-NULL, 16);
-   fpga_sec_info.encflag = (u8)simple_strtoul(argv[6], NULL, 16);
-   fpga_sec_info.authflag = (u8)simple_strtoul(argv[5], NULL, 16);
-
-   if (fpga_sec_info.authflag >= FPGA_NO_ENC_OR_NO_AUTH &&
-   fpga_sec_info.encflag >= FPGA_NO_ENC_OR_NO_AUTH) {
-   puts("ERR: Use  for NonSecure bitstream\n");
-   return CMD_RET_USAGE;
-   }
-
-   if (fpga_sec_info.encflag == FPGA_ENC_USR_KEY &&
-   !fpga_sec_info.userkey_addr) {
-   puts("ERR: User key not provided\n");
-   return CMD_RET_USAGE;
-   }
-
-   argc = 5;
-   break;
-#endif
-   default:
-   break;
}
 
-   switch (argc) {
-   case 5: /* fpga */
-   data_size = simple_strtoul(argv[4], NULL, 16);
-   if (!data_size) {
-   puts("Zero data_size\n");
-   return CMD_RET_USAGE;
-   }
-   case 4: /* fpga*/
-   {
-   fpga_data = (void *)simple_strtoul(argv[3], NULL, 16);
-   debug("*  fpga: cmdline image address = 0x%08lx\n",
- (ulong)fpga_data);
-   }
-   debug("%s: fpga_data = 0x%lx\n", __func__, (ulong)fpga_data);
-   if (!fpga_data) {
-   puts("Zero fpga_dat

[U-Boot] [PATCH v1 12/17] cmd: fpga: Fix loadfs command

2018-07-26 Thread Michal Simek
Convert loadfs command to fpga subcommands.

Signed-off-by: Michal Simek 
---

Changes in v1: None

 cmd/fpga.c | 58 --
 1 file changed, 28 insertions(+), 30 deletions(-)

diff --git a/cmd/fpga.c b/cmd/fpga.c
index 9c715db80512..826f63371a66 100644
--- a/cmd/fpga.c
+++ b/cmd/fpga.c
@@ -66,7 +66,6 @@ static int do_fpga_check_params(long *dev, long *fpga_data, 
size_t *data_size,
 enum {
FPGA_NONE = -1,
FPGA_LOADMK,
-   FPGA_LOADFS,
FPGA_LOADS,
 };
 
@@ -78,12 +77,8 @@ static int fpga_get_op(char *opstr)
 {
int op = FPGA_NONE;
 
-#if defined(CONFIG_CMD_FPGA_LOADFS)
-   if (!strcmp("loadfs", opstr))
-   op = FPGA_LOADFS;
-#endif
 #if defined(CONFIG_CMD_FPGA_LOADMK)
-   else if (!strcmp("loadmk", opstr))
+   if (!strcmp("loadmk", opstr))
op = FPGA_LOADMK;
 #endif
 #if defined(CONFIG_CMD_FPGA_LOAD_SECURE)
@@ -114,10 +109,6 @@ int do_fpga(cmd_tbl_t *cmdtp, int flag, int argc, char 
*const argv[])
const char *fit_uname = NULL;
ulong fit_addr;
 #endif
-#if defined(CONFIG_CMD_FPGA_LOADFS)
-   fpga_fs_info fpga_fsinfo;
-   fpga_fsinfo.fstype = FS_TYPE_ANY;
-#endif
 #if defined(CONFIG_CMD_FPGA_LOAD_SECURE)
struct fpga_secure_info fpga_sec_info;
 
@@ -140,19 +131,6 @@ int do_fpga(cmd_tbl_t *cmdtp, int flag, int argc, char 
*const argv[])
case FPGA_NONE:
printf("Unknown fpga operation \"%s\"\n", argv[1]);
return CMD_RET_USAGE;
-#if defined(CONFIG_CMD_FPGA_LOADFS)
-   case FPGA_LOADFS:
-   if (argc < 9)
-   return CMD_RET_USAGE;
-   fpga_fsinfo.blocksize = (unsigned int)
-   simple_strtoul(argv[5], NULL, 16);
-   fpga_fsinfo.interface = argv[6];
-   fpga_fsinfo.dev_part = argv[7];
-   fpga_fsinfo.filename = argv[8];
-
-   argc = 5;
-   break;
-#endif
 #if defined(CONFIG_CMD_FPGA_LOAD_SECURE)
case FPGA_LOADS:
if (argc < 7)
@@ -221,18 +199,11 @@ int do_fpga(cmd_tbl_t *cmdtp, int flag, int argc, char 
*const argv[])
}
 
switch (op) {
-#if defined(CONFIG_CMD_FPGA_LOADFS)
-   case FPGA_LOADFS:
-   rc = fpga_fsload(dev, fpga_data, data_size, &fpga_fsinfo);
-   break;
-#endif
-
 #if defined(CONFIG_CMD_FPGA_LOAD_SECURE)
case FPGA_LOADS:
rc = fpga_loads(dev, fpga_data, data_size, &fpga_sec_info);
break;
 #endif
-
 #if defined(CONFIG_CMD_FPGA_LOADMK)
case FPGA_LOADMK:
switch (genimg_get_format(fpga_data)) {
@@ -330,6 +301,30 @@ int do_fpga(cmd_tbl_t *cmdtp, int flag, int argc, char 
*const argv[])
return rc;
 }
 
+#if defined(CONFIG_CMD_FPGA_LOADFS)
+static int do_fpga_loadfs(cmd_tbl_t *cmdtp, int flag, int argc,
+ char *const argv[])
+{
+   size_t data_size = 0;
+   long fpga_data, dev;
+   int ret;
+   fpga_fs_info fpga_fsinfo;
+
+   ret = do_fpga_check_params(&dev, &fpga_data, &data_size,
+  cmdtp, argc, argv);
+   if (ret)
+   return ret;
+
+   fpga_fsinfo.fstype = FS_TYPE_ANY;
+   fpga_fsinfo.blocksize = (unsigned int)simple_strtoul(argv[3], NULL, 16);
+   fpga_fsinfo.interface = argv[4];
+   fpga_fsinfo.dev_part = argv[5];
+   fpga_fsinfo.filename = argv[6];
+
+   return fpga_fsload(dev, (void *)fpga_data, data_size, &fpga_fsinfo);
+}
+#endif
+
 static int do_fpga_info(cmd_tbl_t *cmdtp, int flag, int argc,
char * const argv[])
 {
@@ -429,6 +424,9 @@ static cmd_tbl_t fpga_commands[] = {
 #if defined(CONFIG_CMD_FPGA_LOADBP)
U_BOOT_CMD_MKENT(loadbp, 3, 1, do_fpga_loadbp, "", ""),
 #endif
+#if defined(CONFIG_CMD_FPGA_LOADFS)
+   U_BOOT_CMD_MKENT(loadfs, 7, 1, do_fpga_loadfs, "", ""),
+#endif
 };
 
 static int do_fpga_wrapper(cmd_tbl_t *cmdtp, int flag, int argc,
-- 
1.9.1

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


Re: [U-Boot] [PATCH v2] rsa: Fix LibreSSL before v2.7.0

2018-07-26 Thread Jonathan Gray
On Wed, Jul 25, 2018 at 10:13:03PM -0400, nom...@palism.com wrote:
> From: Caliph Nomble 
> 
> Fix LibreSSL compilation for versions before v2.7.0.
> 
> Signed-off-by: Caliph Nomble 
> ---
> Tested compilation on LibreSSL v2.7.4 and v2.6.4 with no new errors or
> warnings.

Builds on OpenBSD -current with 2.8.0.  bcm7445 config resulted in
building it.

Could be 0x207fL not 0x0207fL to match the other uses but that
is just cosmetic.

Reviewed-by: Jonathan Gray 

> 
> Changes for v2:
> - fixed commit message conventions
> - fixed coding style
> 
>  lib/rsa/rsa-sign.c | 18 --
>  1 file changed, 12 insertions(+), 6 deletions(-)
> 
> diff --git a/lib/rsa/rsa-sign.c b/lib/rsa/rsa-sign.c
> index cfe09cc94c..05ac67b822 100644
> --- a/lib/rsa/rsa-sign.c
> +++ b/lib/rsa/rsa-sign.c
> @@ -20,7 +20,8 @@
>  #define HAVE_ERR_REMOVE_THREAD_STATE
>  #endif
>  
> -#if OPENSSL_VERSION_NUMBER < 0x1010L
> +#if OPENSSL_VERSION_NUMBER < 0x1010L || \
> + (defined(LIBRESSL_VERSION_NUMBER) && LIBRESSL_VERSION_NUMBER < 
> 0x0207fL)
>  static void RSA_get0_key(const RSA *r,
>   const BIGNUM **n, const BIGNUM **e, const BIGNUM **d)
>  {
> @@ -299,7 +300,8 @@ static int rsa_init(void)
>  {
>   int ret;
>  
> -#if OPENSSL_VERSION_NUMBER < 0x1010L
> +#if OPENSSL_VERSION_NUMBER < 0x1010L || \
> + (defined(LIBRESSL_VERSION_NUMBER) && LIBRESSL_VERSION_NUMBER < 
> 0x0207fL)
>   ret = SSL_library_init();
>  #else
>   ret = OPENSSL_init_ssl(0, NULL);
> @@ -308,7 +310,8 @@ static int rsa_init(void)
>   fprintf(stderr, "Failure to init SSL library\n");
>   return -1;
>   }
> -#if OPENSSL_VERSION_NUMBER < 0x1010L
> +#if OPENSSL_VERSION_NUMBER < 0x1010L || \
> + (defined(LIBRESSL_VERSION_NUMBER) && LIBRESSL_VERSION_NUMBER < 
> 0x0207fL)
>   SSL_load_error_strings();
>  
>   OpenSSL_add_all_algorithms();
> @@ -354,7 +357,8 @@ err_set_rsa:
>  err_engine_init:
>   ENGINE_free(e);
>  err_engine_by_id:
> -#if OPENSSL_VERSION_NUMBER < 0x1010L
> +#if OPENSSL_VERSION_NUMBER < 0x1010L || \
> + (defined(LIBRESSL_VERSION_NUMBER) && LIBRESSL_VERSION_NUMBER < 
> 0x0207fL)
>   ENGINE_cleanup();
>  #endif
>   return ret;
> @@ -362,7 +366,8 @@ err_engine_by_id:
>  
>  static void rsa_remove(void)
>  {
> -#if OPENSSL_VERSION_NUMBER < 0x1010L
> +#if OPENSSL_VERSION_NUMBER < 0x1010L || \
> + (defined(LIBRESSL_VERSION_NUMBER) && LIBRESSL_VERSION_NUMBER < 
> 0x0207fL)
>   CRYPTO_cleanup_all_ex_data();
>   ERR_free_strings();
>  #ifdef HAVE_ERR_REMOVE_THREAD_STATE
> @@ -432,7 +437,8 @@ static int rsa_sign_with_key(RSA *rsa, struct 
> checksum_algo *checksum_algo,
>   ret = rsa_err("Could not obtain signature");
>   goto err_sign;
>   }
> - #if OPENSSL_VERSION_NUMBER < 0x1010L
> + #if OPENSSL_VERSION_NUMBER < 0x1010L || \
> + (defined(LIBRESSL_VERSION_NUMBER) && LIBRESSL_VERSION_NUMBER < 
> 0x0207fL)
>   EVP_MD_CTX_cleanup(context);
>   #else
>   EVP_MD_CTX_reset(context);
> -- 
> 2.16.4
> 
> ___
> U-Boot mailing list
> U-Boot@lists.denx.de
> https://lists.denx.de/listinfo/u-boot
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PULL] u-boot-usb/master

2018-07-26 Thread Tom Rini
On Thu, Jul 26, 2018 at 09:35:54AM +0200, Marek Vasut wrote:

> The following changes since commit 323a73adc9a1bf2de43fe03bdd9c3038ce7c2784:
> 
>   mtd: nand: add new enum for storing ECC algorithm (2018-07-23 14:33:21
> -0400)
> 
> are available in the Git repository at:
> 
>   git://git.denx.de/u-boot-usb.git master
> 
> for you to fetch changes up to 67f1c59f40fde73cb2cbb51ebf0a05156ec403b7:
> 
>   usb: dwc3: convert to livetree (2018-07-25 00:13:44 +0200)
> 

NAK.  This breaks at least: am335x_hs_evm am335x_hs_evm_uart brppt1_spi
brppt1_mmc am335x_evm brppt1_nand and stih410-b2260

-- 
Tom


signature.asc
Description: PGP signature
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH v1 9/9] ARM: Odroid XU3: Modify Odroid XU3 config to boot by default from SD card

2018-07-26 Thread Anand Moon
Hi Lukasz,

On 26 July 2018 at 03:55, Lukasz Majewski  wrote:
> This commit allows by default booting Odroid XU3 from the SD card (when
> e.g. eMMC module is not present).
>
> Signed-off-by: Lukasz Majewski 
>
> ---
>
>  include/configs/odroid_xu3.h | 7 +--
>  1 file changed, 5 insertions(+), 2 deletions(-)
>
> diff --git a/include/configs/odroid_xu3.h b/include/configs/odroid_xu3.h
> index f495f6219ba9..818a06515cb2 100644
> --- a/include/configs/odroid_xu3.h
> +++ b/include/configs/odroid_xu3.h
> @@ -94,6 +94,9 @@
>  #undef CONFIG_SYS_BOARD
>  #define CONFIG_SYS_BOARD   "odroid"
>
> +#undef CONFIG_SYS_MMC_ENV_DEV
> +#define CONFIG_SYS_MMC_ENV_DEV 2
> +
>  /* Define new extra env settings, including DFU settings */
>  #undef CONFIG_EXTRA_ENV_SETTINGS
>  #define CONFIG_EXTRA_ENV_SETTINGS \
> @@ -105,8 +108,8 @@
> "console=" CONFIG_DEFAULT_CONSOLE "\0"\
> "fdtfile=exynos5422-odroidxu3.dtb\0" \
> "boardname=odroidxu3\0" \
> -   "mmcbootdev=0\0" \
> -   "mmcrootdev=0\0" \
> +   "mmcbootdev=2\0" \
> +   "mmcrootdev=1\0" \
> "mmcbootpart=1\0" \
> "mmcrootpart=2\0" \
> "dfu_alt_system="CONFIG_DFU_ALT_SYSTEM \
> --
> 2.11.0
>

This changes probably breaks the booting from eMMC on  Odroid-XU4

U-Boot 2018.07-00377-g80df37b417 (Jul 26 2018 - 10:50:16 +) for
ODROID-XU3/XU4/HC1

CPU:   Exynos5422 @ 800 MHz
Model: Odroid XU3 based on EXYNOS5422
Board: Odroid XU3 based on EXYNOS5422
Type:  xu4
DRAM:  2 GiB
MMC:   EXYNOS DWMMC: 0, EXYNOS DWMMC: 2
Loading Environment from MMC... Card did not respond to voltage select!
*** Warning - No block device, using default environment

Failed (-5)
In:serial
Out:   serial
Err:   serial
Net:   No ethernet found.
Hit any key to stop autoboot:  0
MMC Device 1 not found
no mmc device at slot 1
switch to partitions #0, OK
mmc0(part 0) is current device
Scanning mmc 0:1...
Found U-Boot script /boot.scr
3069 bytes read in 6 ms (499 KiB/s)
## Executing script at 5000
Card did not respond to voltage select!
** Bad device mmc 2 **
Card did not respond to voltage select!
** Bad device mmc 2 **
Card did not respond to voltage select!
** Bad device mmc 2 **
SCRIPT FAILED: continuing...
63776 bytes read in 7 ms (8.7 MiB/s)
Card did not respond to voltage select!
starting USB...
USB0:   USB EHCI 1.00
USB1:   Register 2000140 NbrPorts 2
Starting the controller
USB XHCI 1.00
USB2:   Register 2000140 NbrPorts 2
Starting the controller
USB XHCI 1.00
scanning bus 0 for devices... 1 USB Device(s) found
scanning bus 1 for devices... 3 USB Device(s) found
scanning bus 2 for devices... 2 USB Device(s) found
   scanning usb for storage devices... 0 Storage Device(s) found
   scanning usb for ethernet devices... 1 Ethernet Device(s) found
Waiting for Ethernet connection... done.
BOOTP broadcast 1
BOOTP broadcast 2
DHCP client bound to address 10.0.0.144 (1021 ms)
*** Warning: no boot file name; using '0A90.img'
Using r8152#0 device
TFTP from server 0.0.0.0; our IP address is 10.0.0.144; sending
through gateway 10.0.0.1
Filename '0A90.img'.
Load address: 0x43e0
Loading: T

Best Regards
-Anand
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH] cmd/ubi.c: Fix format warning

2018-07-26 Thread Tom Rini
On 64bit platforms we would otherwise see:
../cmd/ubi.c: In function 'ubi_volume_read':
../cmd/ubi.c:359:16: warning: format '%u' expects argument of type 'unsigned 
int', but argument 2 has type 'size_t {aka long unsigned int}' [-Wformat=]

Fixes: 68c7025d99db ("cmd: ubi: print load size after establishing volume size")
Signed-off-by: Tom Rini 
---
 cmd/ubi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/cmd/ubi.c b/cmd/ubi.c
index 0e935e34b8e6..04bbd01da396 100644
--- a/cmd/ubi.c
+++ b/cmd/ubi.c
@@ -356,7 +356,7 @@ int ubi_volume_read(char *volume, char *buf, size_t size)
size = vol->used_bytes;
}
 
-   printf("Read %u bytes from volume %s to %p\n", size, volume, buf);
+   printf("Read %zd bytes from volume %s to %p\n", size, volume, buf);
 
if (vol->corrupted)
printf("read from corrupted volume %d", vol->vol_id);
-- 
2.7.4

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


Re: [U-Boot] [PATCH] cmd/ubi.c: Fix format warning

2018-07-26 Thread Martin Husemann
On Thu, Jul 26, 2018 at 11:32:25AM -0400, Tom Rini wrote:
> - printf("Read %u bytes from volume %s to %p\n", size, volume, buf);
> + printf("Read %zd bytes from volume %s to %p\n", size, volume, buf);

Why make it signed? "%zu bytes" should be better.

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


Re: [U-Boot] [PATCH] cmd/ubi.c: Fix format warning

2018-07-26 Thread Tom Rini
On Thu, Jul 26, 2018 at 05:36:01PM +0200, Martin Husemann wrote:
> On Thu, Jul 26, 2018 at 11:32:25AM -0400, Tom Rini wrote:
> > -   printf("Read %u bytes from volume %s to %p\n", size, volume, buf);
> > +   printf("Read %zd bytes from volume %s to %p\n", size, volume, buf);
> 
> Why make it signed? "%zu bytes" should be better.

Whoops, thanks.

-- 
Tom


signature.asc
Description: PGP signature
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCHv2] cmd/ubi.c: Fix format warning

2018-07-26 Thread Tom Rini
On 64bit platforms we would otherwise see:
../cmd/ubi.c: In function 'ubi_volume_read':
../cmd/ubi.c:359:16: warning: format '%u' expects argument of type 'unsigned 
int', but argument 2 has type 'size_t {aka long unsigned int}' [-Wformat=]

Fixes: 68c7025d99db ("cmd: ubi: print load size after establishing volume size")
Signed-off-by: Tom Rini 
---
 cmd/ubi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/cmd/ubi.c b/cmd/ubi.c
index 0e935e34b8e6..913f0f71fd99 100644
--- a/cmd/ubi.c
+++ b/cmd/ubi.c
@@ -356,7 +356,7 @@ int ubi_volume_read(char *volume, char *buf, size_t size)
size = vol->used_bytes;
}
 
-   printf("Read %u bytes from volume %s to %p\n", size, volume, buf);
+   printf("Read %zu bytes from volume %s to %p\n", size, volume, buf);
 
if (vol->corrupted)
printf("read from corrupted volume %d", vol->vol_id);
-- 
2.7.4

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


Re: [U-Boot] [PATCH v1 9/9] ARM: Odroid XU3: Modify Odroid XU3 config to boot by default from SD card

2018-07-26 Thread Lukasz Majewski
Hi Anand,

> Hi Lukasz,
> 
> On 26 July 2018 at 03:55, Lukasz Majewski  wrote:
> > This commit allows by default booting Odroid XU3 from the SD card
> > (when e.g. eMMC module is not present).
> >
> > Signed-off-by: Lukasz Majewski 
> >
> > ---
> >
> >  include/configs/odroid_xu3.h | 7 +--
> >  1 file changed, 5 insertions(+), 2 deletions(-)
> >
> > diff --git a/include/configs/odroid_xu3.h
> > b/include/configs/odroid_xu3.h index f495f6219ba9..818a06515cb2
> > 100644 --- a/include/configs/odroid_xu3.h
> > +++ b/include/configs/odroid_xu3.h
> > @@ -94,6 +94,9 @@
> >  #undef CONFIG_SYS_BOARD
> >  #define CONFIG_SYS_BOARD   "odroid"
> >
> > +#undef CONFIG_SYS_MMC_ENV_DEV
> > +#define CONFIG_SYS_MMC_ENV_DEV 2
> > +
> >  /* Define new extra env settings, including DFU settings */
> >  #undef CONFIG_EXTRA_ENV_SETTINGS
> >  #define CONFIG_EXTRA_ENV_SETTINGS \
> > @@ -105,8 +108,8 @@
> > "console=" CONFIG_DEFAULT_CONSOLE "\0"\
> > "fdtfile=exynos5422-odroidxu3.dtb\0" \
> > "boardname=odroidxu3\0" \
> > -   "mmcbootdev=0\0" \
> > -   "mmcrootdev=0\0" \
> > +   "mmcbootdev=2\0" \
> > +   "mmcrootdev=1\0" \
> > "mmcbootpart=1\0" \
> > "mmcrootpart=2\0" \
> > "dfu_alt_system="CONFIG_DFU_ALT_SYSTEM \
> > --
> > 2.11.0
> >  
> 
> This changes probably breaks the booting from eMMC on  Odroid-XU4

I suppose, that XU4 is also equipped with SD card slot as XU3.

Nonetheless, as I don't have eMMC card for mine XU3, the only way to
boot my device is SD card.

If you believe that this may be a problem, then I can drop this patch.

Have you checked patches from 1-8?
Does it work for you? If yes, please send tested-by tag.

> 
> U-Boot 2018.07-00377-g80df37b417 (Jul 26 2018 - 10:50:16 +) for
> ODROID-XU3/XU4/HC1
> 
> CPU:   Exynos5422 @ 800 MHz
> Model: Odroid XU3 based on EXYNOS5422
> Board: Odroid XU3 based on EXYNOS5422
> Type:  xu4
> DRAM:  2 GiB
> MMC:   EXYNOS DWMMC: 0, EXYNOS DWMMC: 2
> Loading Environment from MMC... Card did not respond to voltage
> select! *** Warning - No block device, using default environment
> 
> Failed (-5)
> In:serial
> Out:   serial
> Err:   serial
> Net:   No ethernet found.
> Hit any key to stop autoboot:  0
> MMC Device 1 not found
> no mmc device at slot 1
> switch to partitions #0, OK
> mmc0(part 0) is current device
> Scanning mmc 0:1...
> Found U-Boot script /boot.scr
> 3069 bytes read in 6 ms (499 KiB/s)
> ## Executing script at 5000
> Card did not respond to voltage select!
> ** Bad device mmc 2 **
> Card did not respond to voltage select!
> ** Bad device mmc 2 **
> Card did not respond to voltage select!
> ** Bad device mmc 2 **
> SCRIPT FAILED: continuing...
> 63776 bytes read in 7 ms (8.7 MiB/s)
> Card did not respond to voltage select!
> starting USB...
> USB0:   USB EHCI 1.00
> USB1:   Register 2000140 NbrPorts 2
> Starting the controller
> USB XHCI 1.00
> USB2:   Register 2000140 NbrPorts 2
> Starting the controller
> USB XHCI 1.00
> scanning bus 0 for devices... 1 USB Device(s) found
> scanning bus 1 for devices... 3 USB Device(s) found
> scanning bus 2 for devices... 2 USB Device(s) found
>scanning usb for storage devices... 0 Storage Device(s) found
>scanning usb for ethernet devices... 1 Ethernet Device(s) found
> Waiting for Ethernet connection... done.
> BOOTP broadcast 1
> BOOTP broadcast 2
> DHCP client bound to address 10.0.0.144 (1021 ms)
> *** Warning: no boot file name; using '0A90.img'
> Using r8152#0 device
> TFTP from server 0.0.0.0; our IP address is 10.0.0.144; sending
> through gateway 10.0.0.1
> Filename '0A90.img'.
> Load address: 0x43e0
> Loading: T
> 
> Best Regards
> -Anand




Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH,  Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: w...@denx.de


pgp2VJNtrSxuV.pgp
Description: OpenPGP digital signature
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH] MAINTAINERS: Mark NAND as Orphaned

2018-07-26 Thread Tom Rini
Scott is no longer maintaining the NAND subsystem, mark as orphaned for
now.

Cc: Scott Wood 
Signed-off-by: Tom Rini 
---
Thanks again for your time and contributions Scott!
---
 MAINTAINERS| 4 ++--
 doc/git-mailrc | 3 +--
 2 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/MAINTAINERS b/MAINTAINERS
index a2293b7c88d4..e44280ceb6d2 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -437,8 +437,8 @@ T:  git git://git.denx.de/u-boot-mmc.git
 F: drivers/mmc/
 
 NAND FLASH
-M: Scott Wood 
-S: Maintained
+#M:Scott Wood 
+S: Orphaned (Since 2018-07)
 T: git git://git.denx.de/u-boot-nand-flash.git
 F: drivers/mtd/nand/
 
diff --git a/doc/git-mailrc b/doc/git-mailrc
index af8e3358a983..75aa675c08bd 100644
--- a/doc/git-mailrc
+++ b/doc/git-mailrc
@@ -39,7 +39,6 @@ alias prafulla   Prafulla Wadaskar 
 alias prom   Minkyu Kang 
 alias ptomsich   Philipp Tomsich 
 alias sbabic Stefano Babic 
-alias scottwood  Scott Wood 
 alias sjgSimon Glass 
 alias smcnuttScott McNutt 
 alias stroeseStefan Roese 
@@ -113,7 +112,7 @@ alias fdtuboot, sjg
 alias i2cuboot, hs
 alias kconfiguboot, masahiro
 alias mmcuboot, jaehoon
-alias nand   uboot, scottwood
+alias nand   uboot
 alias netuboot, jhersh
 alias phyuboot, jhersh
 alias spiuboot, jagan
-- 
2.7.4

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


Re: [U-Boot] [PATCH 9/9] mpc85xx: add casts for ram size in min() calculation.

2018-07-26 Thread York Sun
On 07/26/2018 07:00 AM, Philipp Tomsich wrote:
> With the change of the ram size fields to u64, we need to use explicit
> casts to ensure that min()-implementation sees the same type for both
> its arguments.
> 
> Signed-off-by: Philipp Tomsich 
> ---
> 
>  arch/powerpc/cpu/mpc85xx/cpu.c | 6 --
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/arch/powerpc/cpu/mpc85xx/cpu.c b/arch/powerpc/cpu/mpc85xx/cpu.c
> index bf48836..5664872 100644
> --- a/arch/powerpc/cpu/mpc85xx/cpu.c
> +++ b/arch/powerpc/cpu/mpc85xx/cpu.c
> @@ -604,7 +604,8 @@ static int reset_tlb(phys_addr_t p_addr, u32 size, 
> phys_addr_t *phys_offset)
>  int arch_memory_test_advance(u32 *vstart, u32 *size, phys_addr_t 
> *phys_offset)
>  {
>   phys_addr_t test_cap, p_addr;
> - phys_size_t p_size = min(gd->ram_size, CONFIG_MAX_MEM_MAPPED);
> + phys_size_t p_size = min((phys_size_t)gd->ram_size,
> +  (phys_size_t)CONFIG_MAX_MEM_MAPPED);
>  
>  #if !defined(CONFIG_PHYS_64BIT) || \
>  !defined(CONFIG_SYS_INIT_RAM_ADDR_PHYS) || \
> @@ -632,7 +633,8 @@ int arch_memory_test_advance(u32 *vstart, u32 *size, 
> phys_addr_t *phys_offset)
>  /* initialization for testing area */
>  int arch_memory_test_prepare(u32 *vstart, u32 *size, phys_addr_t 
> *phys_offset)
>  {
> - phys_size_t p_size = min(gd->ram_size, CONFIG_MAX_MEM_MAPPED);
> + phys_size_t p_size = min((phys_size_t)gd->ram_size,
> +  (phys_size_t)CONFIG_MAX_MEM_MAPPED);
>  
>   *vstart = CONFIG_SYS_DDR_SDRAM_BASE;
>   *size = (u32) p_size;   /* CONFIG_MAX_MEM_MAPPED < 4G */
> 

We didn't have any issue with 36-bit physical address on mpc85xx. I see
this change is needed after you change gd->ram_size.

Reviewed-by: York Sun 
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH] spl: fit: Enable GZIP compression also for no kernel partitions

2018-07-26 Thread York Sun
On 07/25/2018 11:52 PM, Michal Simek wrote:
> On 25.7.2018 23:18, York Sun wrote:
>> On 07/24/2018 10:58 PM, Michal Simek wrote:
>>> On 24.7.2018 18:26, York Sun wrote:
 On 07/24/2018 06:07 AM, Michal Simek wrote:
> There is no reason to limit gzip usage only for OS_BOOT and kernel image
> type.
>
> Signed-off-by: Michal Simek 
> ---
>
>  common/spl/spl_fit.c | 5 +
>  1 file changed, 1 insertion(+), 4 deletions(-)
>
> diff --git a/common/spl/spl_fit.c b/common/spl/spl_fit.c
> index 9eabb1c1058b..dbf5ac33a845 100644
> --- a/common/spl/spl_fit.c
> +++ b/common/spl/spl_fit.c
> @@ -257,10 +257,7 @@ static int spl_load_fit_image(struct spl_load_info 
> *info, ulong sector,
>   board_fit_image_post_process(&src, &length);
>  #endif
>  
> - if (IS_ENABLED(CONFIG_SPL_OS_BOOT)  &&
> - IS_ENABLED(CONFIG_SPL_GZIP) &&
> - image_comp == IH_COMP_GZIP  &&
> - type == IH_TYPE_KERNEL) {
> + if (IS_ENABLED(CONFIG_SPL_GZIP) && image_comp == IH_COMP_GZIP) {
>   size = length;
>   if (gunzip((void *)load_addr, CONFIG_SYS_BOOTM_LEN,
>  src, &size)) {
>

 This will uncompress ramdisk unnecessarily.
>>>
>>> Can you please share your its fragment? Also is there any other image
>>> which should be exclude?
>>
>> I used it for falcon boot. I guess the executable image should have "entry". 
>> In
>> my setup, only kernel image has "entry". Here is my its file.
>>
>> /dts-v1/;
>>
>> / {
>>  description = "Image file for the LS1046A Linux Kernel";
>>  #address-cells = <1>;
>>
>>  images {
>>  kernel@1 {
>>  description = "ARM64 Linux kernel";
>>  data = /incbin/("./arch/arm64/boot/Image.gz");
>>  type = "kernel";
>>  arch = "arm64";
>>  os = "linux";
>>  compression = "gzip";
>>  load = <0x8008>;
>>  entry = <0x8008>;
>>  };
>>  fdt@1 {
>>  description = "Flattened Device Tree blob";
>>  data = /incbin/("./fsl-ls1046ardb.dtb");
>>  type = "flat_dt";
>>  arch = "arm64";
>>  compression = "none";
>>  load = <0x9000>;
>>  };
>>  ramdisk@1 {
>>  description = "Buildroot initramfs";
>> data = /incbin/("./rootfs.cpio.gz");
>>  type = "ramdisk";
>>  arch = "arm64";
>>  os = "linux";
>>  compression = "gzip";
> 
> I have tested full u-boot and there is also no uncompression for ramdisk
> when you put gzip compress there.
> I have even tried gzip compression for fdt with expectation that u-boot
> will uncompress it.
> 
> Based on doc/uImage.FIT/source_file_format.txt:
> 165  - compression : Compression used by included data. Supported
> compressions
> 166 are "gzip" and "bzip2". If no compression is used compression
> property
> 167 should be set to "none".
> 
> 
> Based on me this means that data inside fit are compressed and you are
> asking u-boot in boot to uncompress it. If you are not asking for that
> you should put none there.
> But it doesn't look like this is supported at all for fdt/ramdisk and it
> is only handled for OS.
> I see here two cases.
> 1. I want u-boot to uncompress my data in fit image (whatever it is)
> before passing control to OS that's why I putting there compression method.
> 2. I want OS to uncompress data but I want pass this data unchanged from
> u-boot to OS that's why I am putting compression method at "none"
> 
> I am expecting when you put "none" there than you will boot in falcon
> mode without any issue.

That will work. I can put "none" for the images I don't want U-Boot to
uncompress.

> 
> I have no problem to change this patch and include only kernel and fpga
> image but it sounds to me that we have gaps in implementation that not
> all images inside the fit image have the same range of functionalities.
> 
> Also I think that "load" entry is that one which matters not "entry".
> 

Not true here. The "entry" matters if you want to run it, for example
Linux kernel. It may be different from "load".

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


Re: [U-Boot] [PATCH] MAINTAINERS: Mark NAND as Orphaned

2018-07-26 Thread Scott Wood
On Thu, 2018-07-26 at 12:03 -0400, Tom Rini wrote:
> Scott is no longer maintaining the NAND subsystem, mark as orphaned for
> now.
> 
> Cc: Scott Wood 
> Signed-off-by: Tom Rini 
> ---
> Thanks again for your time and contributions Scott!
> ---
>  MAINTAINERS| 4 ++--
>  doc/git-mailrc | 3 +--
>  2 files changed, 3 insertions(+), 4 deletions(-)

Acked-by: Scott Wood 

-Scott

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


Re: [U-Boot] [PATCH] armv8: layerscape: Enable EHCI access for LS1012A

2018-07-26 Thread York Sun
On 07/25/2018 10:27 PM, Ran Wang wrote:
> Hi York,
> 
>> -Original Message-
>> From: York Sun
>> Sent: Tuesday, July 24, 2018 23:40
>> To: Ran Wang ; Albert Aribaud
>> 
>> Cc: u-boot@lists.denx.de
>> Subject: Re: [PATCH] armv8: layerscape: Enable EHCI access for LS1012A
>>
>> On 07/10/2018 07:11 PM, Ran Wang wrote:
>>> Hi York,
>>>
 -Original Message-
 From: York Sun
 Sent: Wednesday, July 11, 2018 05:06
 To: Ran Wang ; Albert Aribaud
 
 Cc: u-boot@lists.denx.de
 Subject: Re: [PATCH] armv8: layerscape: Enable EHCI access for
 LS1012A

 On 07/02/2018 10:34 PM, Ran Wang wrote:
> Program Central Security Unit (CSU) to grant access permission for
> USB
> 2.0 controller, otherwiase EHCI funciton will down.
>
> Signed-off-by: Ran Wang 
> ---
>  arch/arm/cpu/armv8/fsl-layerscape/soc.c  | 8 
>  arch/arm/include/asm/arch-fsl-layerscape/ns_access.h | 1 +
>  2 files changed, 9 insertions(+)
>
> diff --git a/arch/arm/cpu/armv8/fsl-layerscape/soc.c
> b/arch/arm/cpu/armv8/fsl-layerscape/soc.c
> index 6a56269..2c4cf7f 100644
> --- a/arch/arm/cpu/armv8/fsl-layerscape/soc.c
> +++ b/arch/arm/cpu/armv8/fsl-layerscape/soc.c
> @@ -14,6 +14,7 @@
>  #include 
>  #include 
>  #include 
> +#include 
>  #ifdef CONFIG_LAYERSCAPE_NS_ACCESS
>  #include 
>  #endif
> @@ -668,6 +669,13 @@ void fsl_lsch2_early_init_f(void)
>CCI400_DVM_MESSAGE_REQ_EN |
 CCI400_SNOOP_REQ_EN);
>   }
>
> + /*
> +  * Program Central Security Unit (CSU) to grant access
> +  * permission for USB 2.0 controller
> +  */
> +#if defined(CONFIG_ARCH_LS1012A) &&
>> defined(CONFIG_USB_EHCI_FSL)
> + set_devices_ns_access(CSU_CSLX_USB_2, CSU_ALL_RW); #endif

 Is this LS1012A specific?

>>> For Layerscape platforms, only LS1012A and LS1021A have USB2.0(EHCI)
>>> controller, Others have USB3.0 controller only. For now I can only
>>> verify on LS1012A, so didn't cover LS1021A yet.
>>>
>>
>> Ran,
>>
>> I think calling function set_devices_ns_access() may have an issue. It is not
>> EL2 safe, is it? Please check enable_layerscape_ns_access(). It detects
>> exception level before accessing EL3-only registers.
>>
> Yes, I re-checked the code and the experiments prove your point, I will send 
> v2 patch soon.
> Thanks for reminding.
> 
> BTW, I observed that in function board_late_init(), the return value of 
> current_el() will be different:
> Case 1: Boot with PPA: return 2
> ...
> Using SERDES1 Protocol: 13576 (0x3508)
> PPA Firmware: Version LSDK-1712-TC1-dirty
> SEC Firmware: 'loadables' present in config
> loadables: 'trustedOS@1'
> ...
> FPGA: v4 (LS1012QDS_2016_0405_1443), build 100 on Tue Apr 05 09:13:13 2016
> wangran!!!
> current_el():2
> 
> Case 2: without PPA: return 3
>...
>Using SERDES1 Protocol: 13576 (0x3508)
>SEC Firmware: config-1: no such config
>SEC Firmware: error (-2)
>SEC Firmware: Failed to load image
>...
>FPGA: v4 (LS1012QDS_2016_0405_1443), build 100 on Tue Apr 05 09:13:13 2016
>wangran!!!
>current_el():3
> 
> Do you know the reason?
> 

That's exactly what PPA does -- drop to EL2.

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


Re: [U-Boot] [PATCH V2] drivers: regulator: fixed: add u-boot, off-on-delay-us

2018-07-26 Thread Tom Rini
On Thu, Jul 26, 2018 at 01:59:20PM +, Peng Fan wrote:

> > -Original Message-
> > From: Peng Fan
> > Sent: 2018年7月26日 19:47
> > To: s...@chromium.org; tr...@konsulko.com
> > Cc: yamada.masah...@socionext.com; u-boot@lists.denx.de; Peng Fan
> > 
> > Subject: [PATCH V2] drivers: regulator: fixed: add u-boot,off-on-delay-us
> > 
> > Add u-boot,off-on-delay-us for fixed regulator.
> > 
> > Depends on board design, the gpio regulator sometimes connects with a big
> > capacitance. When need to off, then on the regulator, if there is no enough 
> > delay,
> > the voltage does not drop to 0, so introduce this property to handle such 
> > case.
> > 
> > Signed-off-by: Peng Fan 
> > Reviewed-by: Simon Glass 
> > Cc: Masahiro Yamada 
> > ---
> > 
> > V2:
> >  Moved device tree bindings to new directory.
> >  Simon, I keep you reviewed by tag. Thanks.
> 
> Sorry, this patchset should be V3 version.
> 
> Tom, should I resend a v3 out? Or you could apply this one?

Barring further comments from people, you can just keep this version.
FWIW, I think that if people register with patchwork they can manage the
state of their own patches and that always helps keep me from failing to
notice something / grab the wrong version :)  Thanks!

-- 
Tom


signature.asc
Description: PGP signature
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH] spl: fit: Enable GZIP compression also for no kernel partitions

2018-07-26 Thread Tom Rini
On Thu, Jul 26, 2018 at 04:23:14PM +, York Sun wrote:
> On 07/25/2018 11:52 PM, Michal Simek wrote:
> > On 25.7.2018 23:18, York Sun wrote:
> >> On 07/24/2018 10:58 PM, Michal Simek wrote:
> >>> On 24.7.2018 18:26, York Sun wrote:
>  On 07/24/2018 06:07 AM, Michal Simek wrote:
> > There is no reason to limit gzip usage only for OS_BOOT and kernel image
> > type.
> >
> > Signed-off-by: Michal Simek 
> > ---
> >
> >  common/spl/spl_fit.c | 5 +
> >  1 file changed, 1 insertion(+), 4 deletions(-)
> >
> > diff --git a/common/spl/spl_fit.c b/common/spl/spl_fit.c
> > index 9eabb1c1058b..dbf5ac33a845 100644
> > --- a/common/spl/spl_fit.c
> > +++ b/common/spl/spl_fit.c
> > @@ -257,10 +257,7 @@ static int spl_load_fit_image(struct spl_load_info 
> > *info, ulong sector,
> > board_fit_image_post_process(&src, &length);
> >  #endif
> >  
> > -   if (IS_ENABLED(CONFIG_SPL_OS_BOOT)  &&
> > -   IS_ENABLED(CONFIG_SPL_GZIP) &&
> > -   image_comp == IH_COMP_GZIP  &&
> > -   type == IH_TYPE_KERNEL) {
> > +   if (IS_ENABLED(CONFIG_SPL_GZIP) && image_comp == IH_COMP_GZIP) {
> > size = length;
> > if (gunzip((void *)load_addr, CONFIG_SYS_BOOTM_LEN,
> >src, &size)) {
> >
> 
>  This will uncompress ramdisk unnecessarily.
> >>>
> >>> Can you please share your its fragment? Also is there any other image
> >>> which should be exclude?
> >>
> >> I used it for falcon boot. I guess the executable image should have 
> >> "entry". In
> >> my setup, only kernel image has "entry". Here is my its file.
> >>
> >> /dts-v1/;
> >>
> >> / {
> >>description = "Image file for the LS1046A Linux Kernel";
> >>#address-cells = <1>;
> >>
> >>images {
> >>kernel@1 {
> >>description = "ARM64 Linux kernel";
> >>data = /incbin/("./arch/arm64/boot/Image.gz");
> >>type = "kernel";
> >>arch = "arm64";
> >>os = "linux";
> >>compression = "gzip";
> >>load = <0x8008>;
> >>entry = <0x8008>;
> >>};
> >>fdt@1 {
> >>description = "Flattened Device Tree blob";
> >>data = /incbin/("./fsl-ls1046ardb.dtb");
> >>type = "flat_dt";
> >>arch = "arm64";
> >>compression = "none";
> >>load = <0x9000>;
> >>};
> >>ramdisk@1 {
> >>description = "Buildroot initramfs";
> >> data = /incbin/("./rootfs.cpio.gz");
> >>type = "ramdisk";
> >>arch = "arm64";
> >>os = "linux";
> >>compression = "gzip";
> > 
> > I have tested full u-boot and there is also no uncompression for ramdisk
> > when you put gzip compress there.
> > I have even tried gzip compression for fdt with expectation that u-boot
> > will uncompress it.
> > 
> > Based on doc/uImage.FIT/source_file_format.txt:
> > 165  - compression : Compression used by included data. Supported
> > compressions
> > 166 are "gzip" and "bzip2". If no compression is used compression
> > property
> > 167 should be set to "none".
> > 
> > 
> > Based on me this means that data inside fit are compressed and you are
> > asking u-boot in boot to uncompress it. If you are not asking for that
> > you should put none there.
> > But it doesn't look like this is supported at all for fdt/ramdisk and it
> > is only handled for OS.
> > I see here two cases.
> > 1. I want u-boot to uncompress my data in fit image (whatever it is)
> > before passing control to OS that's why I putting there compression method.
> > 2. I want OS to uncompress data but I want pass this data unchanged from
> > u-boot to OS that's why I am putting compression method at "none"
> > 
> > I am expecting when you put "none" there than you will boot in falcon
> > mode without any issue.
> 
> That will work. I can put "none" for the images I don't want U-Boot to
> uncompress.

Please also update the document to be clear that "none" for "don't touch
my compressed data!" is expected.  The existing language isn't clear but
I agree it makes sense (and follows the long standing practice of "-C
none" on compressed ramdisks for legacy style images).

And per Simon Goldschmidt's suggestion, after we've made the docs
clearer, making it so that U-Boot does decompress things would be good,
but we may also need to make that behavior configurable as I can see
people having put the correct compression in and not wanting it to be
uncompressed as we have examples of both none and gzip for ramdisks
today.  It's also possible (and if someone wants to dig back /
experiment and c

Re: [U-Boot] doc: Replace DocBook with sphinx-based docs

2018-07-26 Thread York Sun
On 07/24/2018 05:44 AM, Tom Rini wrote:
> On Tue, Jul 10, 2018 at 08:40:17AM +0200, Mario Six wrote:
> 
>> The Linux kernel moved to sphinx-based documentation and got rid of the
>> DocBook based documentation quite a while ago. Hence, the DocBook
>> documentation for U-Boot should be converted as well.
>>
>> To achieve this, import the necessary files from Linux v4.17, and
>> convert the current DocBook documentation (three files altogether) to
>> sphinx/reStructuredText.
>>
>> For now, all old DocBook documentation was merged into a single
>> handbook, tentatively named "U-Boot Hacker Manual".
>>
>> For some source files, the documentation style was changed to comply
>> with kernel-doc; no functional changes were applied.
>>
>> Signed-off-by: Mario Six 
> 
> Applied to u-boot/master, thanks!
> 

Does anyone see this error?

$ make distclean
scripts/Makefile.clean:15: doc/DocBook/Makefile: No such file or directory
make[1]: *** No rule to make target 'doc/DocBook/Makefile'.  Stop.
Makefile:1610: recipe for target '_clean_doc/DocBook' failed
make: *** [_clean_doc/DocBook] Error 2

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


Re: [U-Boot] doc: Replace DocBook with sphinx-based docs

2018-07-26 Thread Tom Rini
On Thu, Jul 26, 2018 at 05:58:24PM +, York Sun wrote:

> On 07/24/2018 05:44 AM, Tom Rini wrote:
> > On Tue, Jul 10, 2018 at 08:40:17AM +0200, Mario Six wrote:
> > 
> >> The Linux kernel moved to sphinx-based documentation and got rid of the
> >> DocBook based documentation quite a while ago. Hence, the DocBook
> >> documentation for U-Boot should be converted as well.
> >>
> >> To achieve this, import the necessary files from Linux v4.17, and
> >> convert the current DocBook documentation (three files altogether) to
> >> sphinx/reStructuredText.
> >>
> >> For now, all old DocBook documentation was merged into a single
> >> handbook, tentatively named "U-Boot Hacker Manual".
> >>
> >> For some source files, the documentation style was changed to comply
> >> with kernel-doc; no functional changes were applied.
> >>
> >> Signed-off-by: Mario Six 
> > 
> > Applied to u-boot/master, thanks!
> > 
> 
> Does anyone see this error?
> 
> $ make distclean
> scripts/Makefile.clean:15: doc/DocBook/Makefile: No such file or directory
> make[1]: *** No rule to make target 'doc/DocBook/Makefile'.  Stop.
> Makefile:1610: recipe for target '_clean_doc/DocBook' failed
> make: *** [_clean_doc/DocBook] Error 2

Yeah, sorry, I've pushed a fix for this earlier today.

-- 
Tom


signature.asc
Description: PGP signature
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] doc: Replace DocBook with sphinx-based docs

2018-07-26 Thread York Sun
On 07/26/2018 10:58 AM, York Sun wrote:
> On 07/24/2018 05:44 AM, Tom Rini wrote:
>> On Tue, Jul 10, 2018 at 08:40:17AM +0200, Mario Six wrote:
>>
>>> The Linux kernel moved to sphinx-based documentation and got rid of the
>>> DocBook based documentation quite a while ago. Hence, the DocBook
>>> documentation for U-Boot should be converted as well.
>>>
>>> To achieve this, import the necessary files from Linux v4.17, and
>>> convert the current DocBook documentation (three files altogether) to
>>> sphinx/reStructuredText.
>>>
>>> For now, all old DocBook documentation was merged into a single
>>> handbook, tentatively named "U-Boot Hacker Manual".
>>>
>>> For some source files, the documentation style was changed to comply
>>> with kernel-doc; no functional changes were applied.
>>>
>>> Signed-off-by: Mario Six 
>>
>> Applied to u-boot/master, thanks!
>>
> 
> Does anyone see this error?
> 
> $ make distclean
> scripts/Makefile.clean:15: doc/DocBook/Makefile: No such file or directory
> make[1]: *** No rule to make target 'doc/DocBook/Makefile'.  Stop.
> Makefile:1610: recipe for target '_clean_doc/DocBook' failed
> make: *** [_clean_doc/DocBook] Error 2

Ah! Never mind. I see Tom's patch sent yesterday.

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


Re: [U-Boot] [PATCH] linux/compat.h: Add netdev_### log macros

2018-07-26 Thread Joe Hershberger
On Thu, Jul 26, 2018 at 5:15 AM, Bin Meng  wrote:
> Currently there are two ethernet drivers (mvneta.c and mvpp2.c) that
> has netdev_### (eg: netdev_dbg) log macros defined in its own driver
> file. This adds these log macros in a common place linux/compat.h.
>
> Signed-off-by: Bin Meng 

Acked-by: Joe Hershberger 
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH 1/2] linux/mii.h: Sync with Linux kernel v4.17

2018-07-26 Thread Joe Hershberger
On Thu, Jul 26, 2018 at 4:39 AM, Bin Meng  wrote:
> This syncs U-Boot's include/linux/mii.h with Linux kernel v4.17
> include/uapi/linux/mii.h.
>
> While we are here, this also fixes some style issues.
>
> Signed-off-by: Bin Meng 

Acked-by: Joe Hershberger 
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH 2/2] linux/mdio.h: Sync with Linux kernel v4.17

2018-07-26 Thread Joe Hershberger
On Thu, Jul 26, 2018 at 4:39 AM, Bin Meng  wrote:
> This syncs U-Boot's include/linux/mdio.h with Linux kernel v4.17
> include/uapi/linux/mdio.h.
>
> Signed-off-by: Bin Meng 

Acked-by: Joe Hershberger 
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH] kconfig: Replace spaces with tabs

2018-07-26 Thread Joe Hershberger
On Tue, Jul 24, 2018 at 7:47 AM, Michal Simek  wrote:
> Trivial Kconfig cleanup. Use tabs instead of spaces.
>
> Signed-off-by: Michal Simek 

Reviewed-by: Joe Hershberger 
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH v2 2/5] Kconfig: Replace spaces with tabs and missing newline

2018-07-26 Thread Joe Hershberger
On Mon, Jul 23, 2018 at 8:55 AM, Michal Simek  wrote:
> Trivial Kconfig cleanup. Use tabs instead of spaces and every Kconfig
> entry should be separated by newline.
>
> Signed-off-by: Michal Simek 

Reviewed-by: Joe Hershberger 
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH v2 4/5] dm: Change CMD_DM enabling

2018-07-26 Thread Joe Hershberger
On Mon, Jul 23, 2018 at 8:55 AM, Michal Simek  wrote:
> CMD_DM is used for debug purpose and it shouldn't be enabled by default
> via Kconfig. Unfortunately this is in the tree for quite a long time
> that's why solution is to use imply DM for all targets which are
> enabling DM.
>
> Signed-off-by: Michal Simek 

Reviewed-by: Joe Hershberger 
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH v2 5/5] Kconfig: Sort bool, default, select and imply options

2018-07-26 Thread Joe Hershberger
On Mon, Jul 23, 2018 at 8:55 AM, Michal Simek  wrote:
> Another round of sorting Kconfig entries aplhabetically.
>
> Signed-off-by: Michal Simek 

Reviewed-by: Joe Hershberger 
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] Pull request: u-boot-net.git master

2018-07-26 Thread Joe Hershberger
Hi Tom,

All tests are passing: https://travis-ci.org/jhershbe/u-boot/builds/408198713

The following changes since commit 08fcdd332f3d6bc7842e21a97c80789d9233e147:

  Makefile: Fix 'clean' target (2018-07-26 07:12:31 -0400)

are available in the git repository at:

  git://git.denx.de/u-boot-net.git master

for you to fetch changes up to 26026e695afa794ac018a09e79a48120d322b60d:

  net: zynq_gem: convert to use livetree (2018-07-26 14:08:23 -0500)


Andrew Thomas (1):
  initialize net_mode.if_type

Chris Packham (2):
  net: mvgbe: prepare for conversion to driver model
  net: mvgbe: convert to DM

Grygorii Strashko (6):
  net: phy: dp83867: switch to use ofnode api
  net: phy: add ofnode node to struct phy_device
  net: phy: dp83867: switch to use phy_get_ofnode()
  net: phy: xilinx: switch to use phy_get_ofnode()
  drivers: net: cpsw: fix phy dt node setting
  drivers: net: zynq_gem: fix phy dt node setting

Joe Hershberger (24):
  console: Remember if ctrlc is disabled in console_tstc()
  sandbox: Don't disable ctrlc() on sandbox if in raw mode
  sandbox: eth-raw: Correct valid socket test in send/recv
  sandbox: Fix format of fake-host-hwaddr in test.dts
  net: Only call halt on a driver that has been init'ed
  sandbox: eth-raw: Make sure descriptors are always initialized
  net: Correct comment in Kconfig
  net: sandbox: Convert sandbox mock eth driver to livetree
  net: sandbox-raw: Convert raw eth driver to livetree
  sandbox: eth-raw: Add a function to ask the host about localhost
  sandbox: eth-raw: Allow interface to be specified by index
  sandbox: eth-raw: Make random MAC addresses available to eth-raw
  sandbox: eth-raw: Add a SIMPLE_BUS to enumerate host interfaces
  net: Correct size of NFS buffers
  net: Check subnet against the actual ip address in use for nfs
  net: Always print basic info for nfs, just like tftp
  net: When checking prerequisites, consider boot_file_name
  net: Re-check prerequisites when autoloading
  net: Make copy_filename() accept NULL src
  net: Read bootfile from env on netboot_common()
  net: Consolidate the parsing of bootfile
  arm: Prevent redefinition error in fsl-layerscape
  phy: Break include cycle
  net: phy: Clean up includes of common.h

Murali Karicheri (1):
  net: phy: dp83867: add workaround for incorrect RX_CTRL pin strap

Siva Durga Prasad Paladugu (1):
  net: zynq_gem: convert to use livetree

 arch/arm/cpu/armv8/fsl-layerscape/cpu.c |   2 +-
 arch/sandbox/cpu/eth-raw-os.c   |  81 +--
 arch/sandbox/dts/sandbox.dts|  18 +-
 arch/sandbox/dts/sandbox64.dts  |  18 +-
 arch/sandbox/dts/test.dts   |   8 +-
 arch/sandbox/include/asm/eth-raw-os.h   |  38 ++-
 cmd/net.c   |   6 +
 common/console.c|   9 +-
 drivers/net/Kconfig |   5 +-
 drivers/net/Makefile|   1 +
 drivers/net/cpsw.c  |   2 +-
 drivers/net/mvgbe.c | 416 ++--
 drivers/net/mvgbe.h |  16 ++
 drivers/net/phy/atheros.c   |   1 +
 drivers/net/phy/broadcom.c  |   1 -
 drivers/net/phy/davicom.c   |   1 +
 drivers/net/phy/generic_10g.c   |   2 -
 drivers/net/phy/lxt.c   |   1 +
 drivers/net/phy/marvell.c   |   1 -
 drivers/net/phy/micrel_ksz8xxx.c|   1 -
 drivers/net/phy/micrel_ksz90x1.c|   2 -
 drivers/net/phy/natsemi.c   |   1 +
 drivers/net/phy/phy.c   |   6 +-
 drivers/net/phy/realtek.c   |   1 -
 drivers/net/phy/smsc.c  |   1 +
 drivers/net/phy/teranetics.c|   1 -
 drivers/net/phy/ti.c|  41 +++-
 drivers/net/phy/vitesse.c   |   1 +
 drivers/net/phy/xilinx_phy.c|  10 +-
 drivers/net/sandbox-raw-bus.c   |  66 +
 drivers/net/sandbox-raw.c   |  53 +++-
 drivers/net/sandbox.c   |  16 +-
 drivers/net/zynq_gem.c  |  30 ++-
 drivers/serial/sandbox.c|   4 +
 include/exports.h   |   3 +-
 include/net.h   |  14 ++
 include/phy.h   |  68 ++
 include/phy_interface.h |  65 +
 lib/efi_loader/efi_net.c|   1 +
 net/eth-uclass.c|   2 +-
 net/net.c   |  71 --
 net/nfs.c   |  43 ++--
 net/nfs.h   |   7 +-
 net/tftp.c  |  13 +-
 44 files changed, 830 insertions(+), 318 deletions(-)
 create mode 100644 drivers/net/sandbox-raw-bus.c
 create mode 100644 include/phy_interface.h

Thanks!
-Jo

Re: [U-Boot] console: Remember if ctrlc is disabled in console_tstc()

2018-07-26 Thread Joe Hershberger
Hi Joe,

https://patchwork.ozlabs.org/patch/938298/ was applied to 
http://git.denx.de/?p=u-boot/u-boot-net.git

Thanks!
-Joe
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] sandbox: eth-raw: Correct valid socket test in send/recv

2018-07-26 Thread Joe Hershberger
Hi Joe,

https://patchwork.ozlabs.org/patch/938157/ was applied to 
http://git.denx.de/?p=u-boot/u-boot-net.git

Thanks!
-Joe
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


  1   2   3   >