[U-Boot] [PATCH] arm: kirkwood: openrd: Change environment location

2018-05-17 Thread Stefan Roese
With GCC 7.3 and the addition of device-tree to Kirkwood, the U-Boot
image does not fit any more into its 0x6 area. Let's move the
environment so that U-Boot will fit also with the upcoming changes
for Kirkwood (add DM support etc).

Signed-off-by: Stefan Roese 
Cc: Tom Rini 
Cc: Chris Packham 
Cc: Albert ARIBAUD 
Cc: Clint Adams 
---
 include/configs/openrd.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/include/configs/openrd.h b/include/configs/openrd.h
index dfdad56dcc..3fe0a32a55 100644
--- a/include/configs/openrd.h
+++ b/include/configs/openrd.h
@@ -42,8 +42,8 @@
  * it has to be rounded to sector size
  */
 #define CONFIG_ENV_SIZE0x2 /* 128k */
-#define CONFIG_ENV_ADDR0x6
-#define CONFIG_ENV_OFFSET  0x6 /* env starts here */
+#define CONFIG_ENV_ADDR0x8
+#define CONFIG_ENV_OFFSET  0x8 /* env starts here */
 /*
  * Environment is right behind U-Boot in flash. Make sure U-Boot
  * doesn't grow into the environment area.
-- 
2.17.0

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


Re: [U-Boot] [PATCH V6 1/2] imx6: Convert sabrelite and nitrogen6x boards to distro boot support

2018-05-17 Thread Denis Pynkin

On 04/18/2018 06:04 PM, Guillaume GARDET wrote:

Boot tested on sabrelite board.

Signed-off-by: Guillaume GARDET 
Cc: Troy Kisky 
Cc: Stefano Babic 
Cc: Fabio Estevam 
Cc: Gary Bisson 

---
  include/configs/nitrogen6x.h | 179 +++
  1 file changed, 43 insertions(+), 136 deletions(-)


Tested-by: Denis Pynkin 

Tested with SabreLite board:

mmc0 is current device
Scanning mmc 0:1...
Found /extlinux/extlinux.conf
Retrieving file: /extlinux/extlinux.conf
318 bytes read in 47 ms (5.9 KiB/s)
1:  Linux 4.14.0-0.bpo.2-armmp
Retrieving file: /initrd.img-4.14.0-0.bpo.2-armmp
6654596 bytes read in 481 ms (13.2 MiB/s)
Retrieving file: /vmlinuz-4.14.0-0.bpo.2-armmp
3985920 bytes read in 309 ms (12.3 MiB/s)
append: root=UUID=ddc5cc49-8a42-4eef-b36f-c5202cb6573aconsole=tty0 
console=ttymxc1,115200n8 plymouth.ignore-serial-consoles root=LABEL=system

Retrieving file: /dtbs/4.14.0-0.bpo.2-armmp/imx6q-sabrelite.dtb
42927 bytes read in 614 ms (67.4 KiB/s)


Used own defconfig file with this patch and enabled 
"CONFIG_DISTRO_DEFAULTS=y"


Guillaume, thank you for adding the patch.

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


Re: [U-Boot] [PATCH 1/6] usb: dwc3: Add dwc3_init/remove with DM_USB

2018-05-17 Thread Michal Simek
On 16.5.2018 16:40, Marek Vasut wrote:
> On 05/16/2018 04:26 PM, Michal Simek wrote:
>> From: Mugunthan V N 
>>
>> The patch is preparing dwc3 core for enabling DM_USB with peripheral
>> driver with using driver model support.
>> The driver will be bound by the DWC3 wrapper driver based on the
>> dr_mode device tree entry.
>>
>> Signed-off-by: Mugunthan V N 
>> (Remove dwc3-omap changes)
>> Signed-off-by: Michal Simek 
>> ---
> [...]
>> diff --git a/drivers/usb/dwc3/core.h b/drivers/usb/dwc3/core.h
>> index cbe9850a0bda..ad16c9b7c46c 100644
>> --- a/drivers/usb/dwc3/core.h
>> +++ b/drivers/usb/dwc3/core.h
>> @@ -712,7 +712,11 @@ struct dwc3 {
>>  /* device lock */
>>  spinlock_t  lock;
>>  
>> +#ifndef CONFIG_DM_USB
> 
> Shouldnt this be ifdef __UBOOT__ ?
> 
>>  struct device   *dev;
>> +#else
>> +struct udevice  *dev;
>> +#endif

What about this?

#if defined(__UBOOT__) && defined(CONFIG_DM_USB)
struct udevice  *dev;
#else
struct device   *dev;
#endif

Thanks,
Michal



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


[U-Boot] [UBOOT PATCH] env: mmc: Fix misaligned buffer address when saving envvars to FAT

2018-05-17 Thread Vipul Kumar
From: Gary Mussar 

When doing a u-boot saveenv with the environment in FAT we see the
following warning:

ZynqMP> saveenv
Saving Environment to FAT...
writing uboot.env
FAT: Misaligned buffer address (7deb9b60)
done

This can be eliminated by aligning the environment to an appropriate
boundary.

Signed-off-by: Gary Mussar 
Signed-off-by: Vipul Kumar 
---
 include/environment.h | 6 +-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/include/environment.h b/include/environment.h
index 50c62c5..d6c530d 100644
--- a/include/environment.h
+++ b/include/environment.h
@@ -150,7 +150,11 @@ typedef struct environment_s {
unsigned char   flags;  /* active/obsolete flags*/
 #endif
unsigned char   data[ENV_SIZE]; /* Environment data */
-} env_t;
+} env_t
+#ifdef ARCH_DMA_MINALIGN
+__aligned(ARCH_DMA_MINALIGN)
+#endif
+;

 #ifdef ENV_IS_EMBEDDED
 extern env_t environment;
--
2.7.4

This email and any attachments are intended for the sole use of the named 
recipient(s) and contain(s) confidential information that may be proprietary, 
privileged or copyrighted under applicable law. If you are not the intended 
recipient, do not read, copy, or forward this email message or any attachments. 
Delete this email message and any attachments immediately.
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [UBOOT PATCH] env: mmc: Fix misaligned buffer address when saving envvars to FAT

2018-05-17 Thread Alex Kiernan
On Thu, May 17, 2018 at 8:46 AM Vipul Kumar  wrote:

> From: Gary Mussar 

> When doing a u-boot saveenv with the environment in FAT we see the
> following warning:

> ZynqMP> saveenv
> Saving Environment to FAT...
> writing uboot.env
> FAT: Misaligned buffer address (7deb9b60)
> done

> This can be eliminated by aligning the environment to an appropriate
> boundary.


Are you still seeing after this commit?

cda87ec Fix misaligned buffer in env_fat_save

> Signed-off-by: Gary Mussar 
> Signed-off-by: Vipul Kumar 
> ---
>   include/environment.h | 6 +-
>   1 file changed, 5 insertions(+), 1 deletion(-)

> diff --git a/include/environment.h b/include/environment.h
> index 50c62c5..d6c530d 100644
> --- a/include/environment.h
> +++ b/include/environment.h
> @@ -150,7 +150,11 @@ typedef struct environment_s {
>  unsigned char   flags;  /* active/obsolete flags*/
>   #endif
>  unsigned char   data[ENV_SIZE]; /* Environment data */
> -} env_t;
> +} env_t
> +#ifdef ARCH_DMA_MINALIGN
> +__aligned(ARCH_DMA_MINALIGN)
> +#endif
> +;

>   #ifdef ENV_IS_EMBEDDED
>   extern env_t environment;
> --
> 2.7.4

> This email and any attachments are intended for the sole use of the named
recipient(s) and contain(s) confidential information that may be
proprietary, privileged or copyrighted under applicable law. If you are not
the intended recipient, do not read, copy, or forward this email message or
any attachments. Delete this email message and any attachments immediately.
> ___
> U-Boot mailing list
> U-Boot@lists.denx.de
> https://lists.denx.de/listinfo/u-boot



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


[U-Boot] [RFC PATCH 0/3] sunxi: extend SPL header to propagate DRAM size

2018-05-17 Thread Andre Przywara
This series tries to solve three issues we currently have on
Allwinner boards:
- The DRAM sizing routine can only cope with power-of-two sized DRAM.
- The DRAM sizing routine steps through all DRAM, possibly hitting secure
  memory.
- The SPL header versioning is quite strict and tends to break every time
  we need to update it.

So I thought about introducing something along the lines of semantic
versioning[1], where we can add backwards-compatible changes to the SPL
header without breaking every tool. This is introduced in the first patch.
The second patch does some refactoring, so that the third patch can use
the newly gained freedom to store the DRAM size. The SPL knows the DRAM
size very well, so we store this in the SPL header, so that U-Boot proper
can pick it up from there. This saves the call to get_ram_size() with
its deficiencies.
More information in the respective commit messages.

I understand that this versioning solution is not fully future-proof, but
we have only one byte for the version, and I just wanted to start
discussion on this.
There is a corresponding patch for sunxi-tools as well I am posting shortly.

[1] https://semver.org

Cheers,
Andre.

Andre Przywara (3):
  sunxi: Extend SPL header versioning
  sunxi: board.c: refactor SPL header checks
  sunxi: store DRAM size in SPL header

 arch/arm/include/asm/arch-sunxi/spl.h | 22 
 board/sunxi/board.c   | 66 ---
 2 files changed, 70 insertions(+), 18 deletions(-)

-- 
2.14.1

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


[U-Boot] [RFC PATCH 1/3] sunxi: Extend SPL header versioning

2018-05-17 Thread Andre Przywara
On Allwinner SoCs we use some free bytes at the beginning of the SPL image
to store various information. We have a version byte to allow updates,
but changing this always requires all tools to be updated as well.

Introduce the concept of semantic versioning [1] to the SPL header:
The major part of the version number only changes on incompatible
updates, a minor number bump indicates backward compatibility.
This patch just documents the major/minor split, adds some comments
to the header file and uses the versioning information for the existing
users.

[1] https://semver.org

Signed-off-by: Andre Przywara 
---
 arch/arm/include/asm/arch-sunxi/spl.h | 19 ++-
 board/sunxi/board.c   |  4 ++--
 2 files changed, 16 insertions(+), 7 deletions(-)

diff --git a/arch/arm/include/asm/arch-sunxi/spl.h 
b/arch/arm/include/asm/arch-sunxi/spl.h
index 4277d836e5..7cf89c8db2 100644
--- a/arch/arm/include/asm/arch-sunxi/spl.h
+++ b/arch/arm/include/asm/arch-sunxi/spl.h
@@ -9,7 +9,16 @@
 
 #define BOOT0_MAGIC"eGON.BT0"
 #define SPL_SIGNATURE  "SPL" /* marks "sunxi" SPL header */
-#define SPL_HEADER_VERSION 2
+#define SPL_MAJOR_BITS 3
+#define SPL_MINOR_BITS 5
+#define SPL_VERSION(maj, min)  \
+   maj) & ((1U << SPL_MAJOR_BITS) - 1)) << SPL_MINOR_BITS) | \
+   ((min) & ((1U << SPL_MINOR_BITS) - 1)))
+
+#define SPL_HEADER_VERSION SPL_VERSION(0, 2)
+
+#define SPL_ENV_HEADER_VERSION SPL_VERSION(0, 1)
+#define SPL_DT_HEADER_VERSION  SPL_VERSION(0, 2)
 
 #ifdef CONFIG_SUNXI_HIGH_SRAM
 #define SPL_ADDR   0x1
@@ -49,14 +58,14 @@ struct boot_file_head {
uint32_t pub_head_size;
uint8_t spl_signature[4];
};
-   uint32_t fel_script_address;
+   uint32_t fel_script_address;/* since v0.1, set by sunxi-fel */
/*
 * If the fel_uEnv_length member below is set to a non-zero value,
 * it specifies the size (byte count) of data at fel_script_address.
 * At the same time this indicates that the data is in uEnv.txt
 * compatible format, ready to be imported via "env import -t".
 */
-   uint32_t fel_uEnv_length;
+   uint32_t fel_uEnv_length;   /* since v0.1, set by sunxi-fel */
/*
 * Offset of an ASCIIZ string (relative to the SPL header), which
 * contains the default device tree name (CONFIG_DEFAULT_DEVICE_TREE).
@@ -64,11 +73,11 @@ struct boot_file_head {
 * by flash programming tools for providing nice informative messages
 * to the users.
 */
-   uint32_t dt_name_offset;
+   uint32_t dt_name_offset;/* since v0.2, set by mksunxiboot */
uint32_t reserved1;
uint32_t boot_media;/* written here by the boot ROM */
/* A padding area (may be used for storing text strings) */
-   uint32_t string_pool[13];
+   uint32_t string_pool[13];   /* since v0.2, filled by mksunxiboot */
/* The header must be a multiple of 32 bytes (for VBAR alignment) */
 };
 
diff --git a/board/sunxi/board.c b/board/sunxi/board.c
index 3d364c6db5..a105d0a5ab 100644
--- a/board/sunxi/board.c
+++ b/board/sunxi/board.c
@@ -631,9 +631,9 @@ static void parse_spl_header(const uint32_t spl_addr)
return; /* signature mismatch, no usable header */
 
uint8_t spl_header_version = spl->spl_signature[3];
-   if (spl_header_version != SPL_HEADER_VERSION) {
+   if (spl_header_version < SPL_ENV_HEADER_VERSION) {
printf("sunxi SPL version mismatch: expected %u, got %u\n",
-  SPL_HEADER_VERSION, spl_header_version);
+  SPL_ENV_HEADER_VERSION, spl_header_version);
return;
}
if (!spl->fel_script_address)
-- 
2.14.1

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


[U-Boot] [RFC PATCH 2/3] sunxi: board.c: refactor SPL header checks

2018-05-17 Thread Andre Przywara
So far we have two users which want to look at the SPL header. We will
get more in the future.
Refactor the existing SPL header checks into a common function, to
simplify reusing the code.
Now that this is easy, add proper version checks to the DT name parsing.

Signed-off-by: Andre Przywara 
---
 board/sunxi/board.c | 41 ++---
 1 file changed, 30 insertions(+), 11 deletions(-)

diff --git a/board/sunxi/board.c b/board/sunxi/board.c
index a105d0a5ab..0bb7b023ed 100644
--- a/board/sunxi/board.c
+++ b/board/sunxi/board.c
@@ -253,6 +253,30 @@ int board_init(void)
return soft_i2c_board_init();
 }
 
+/*
+ * On older SoCs the SPL is actually at address zero, so using NULL as
+ * an error value does not work.
+ */
+#define INVALID_SPL_HEADER ((void *)~0UL)
+
+static struct boot_file_head * get_spl_header(uint8_t req_version)
+{
+   struct boot_file_head *spl = (void *)(ulong)SPL_ADDR;
+   uint8_t spl_header_version = spl->spl_signature[3];
+
+   /* Is there really the SPL header (still) there? */
+   if (memcmp(spl->spl_signature, SPL_SIGNATURE, 3) != 0)
+   return INVALID_SPL_HEADER;
+
+   if (spl_header_version < req_version) {
+   printf("sunxi SPL version mismatch: expected %u, got %u\n",
+  req_version, spl_header_version);
+   return INVALID_SPL_HEADER;
+   }
+
+   return spl;
+}
+
 int dram_init(void)
 {
gd->ram_size = get_ram_size((long *)PHYS_SDRAM_0, PHYS_SDRAM_0_SIZE);
@@ -626,16 +650,11 @@ void get_board_serial(struct tag_serialnr *serialnr)
  */
 static void parse_spl_header(const uint32_t spl_addr)
 {
-   struct boot_file_head *spl = (void *)(ulong)spl_addr;
-   if (memcmp(spl->spl_signature, SPL_SIGNATURE, 3) != 0)
-   return; /* signature mismatch, no usable header */
+   struct boot_file_head *spl = get_spl_header(SPL_ENV_HEADER_VERSION);
 
-   uint8_t spl_header_version = spl->spl_signature[3];
-   if (spl_header_version < SPL_ENV_HEADER_VERSION) {
-   printf("sunxi SPL version mismatch: expected %u, got %u\n",
-  SPL_ENV_HEADER_VERSION, spl_header_version);
+   if (spl == INVALID_SPL_HEADER)
return;
-   }
+
if (!spl->fel_script_address)
return;
 
@@ -777,11 +796,11 @@ int ft_board_setup(void *blob, bd_t *bd)
 #ifdef CONFIG_SPL_LOAD_FIT
 int board_fit_config_name_match(const char *name)
 {
-   struct boot_file_head *spl = (void *)(ulong)SPL_ADDR;
-   const char *cmp_str = (void *)(ulong)SPL_ADDR;
+   struct boot_file_head *spl = get_spl_header(SPL_DT_HEADER_VERSION);
+   const char *cmp_str = (const char *)spl;
 
/* Check if there is a DT name stored in the SPL header and use that. */
-   if (spl->dt_name_offset) {
+   if (spl != INVALID_SPL_HEADER && spl->dt_name_offset) {
cmp_str += spl->dt_name_offset;
} else {
 #ifdef CONFIG_DEFAULT_DEVICE_TREE
-- 
2.14.1

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


[U-Boot] [RFC PATCH 3/3] sunxi: store DRAM size in SPL header

2018-05-17 Thread Andre Przywara
At the moment we rely on the infamous get_ram_size() function to learn
the actual DRAM size in U-Boot proper. This function has two issues:
1) It only works if the DRAM size is a power of two. We start to see
boards which have 3GB of (usable) DRAM, so this does not fit anymore.
2) As U-Boot has no notion of reserved memory so far, it will happily
ride through the DRAM, possibly stepping on secure-only memory. This
could be a region of DRAM reserved for OP-TEE or some other secure
payload, for instance. It will most likely crash in that case.

As the SPL DRAM init routine has very accurate knowledge of the actual
DRAM size, lets propagate this wisdom to U-Boot proper.
We re-purpose a currently reserved word in our SPL header for that.
The SPL itself stores the detected DRAM size there, and bumps the SPL
header version number in that case. U-Boot proper checks for a valid
SPL header and a high enough version number, then uses the DRAM size
from there. If the SPL header field is not sufficient, we fall back to
the old DRAM scanning routine.

Signed-off-by: Andre Przywara 
---
 arch/arm/include/asm/arch-sunxi/spl.h |  3 ++-
 board/sunxi/board.c   | 25 -
 2 files changed, 26 insertions(+), 2 deletions(-)

diff --git a/arch/arm/include/asm/arch-sunxi/spl.h 
b/arch/arm/include/asm/arch-sunxi/spl.h
index 7cf89c8db2..c5386b3f24 100644
--- a/arch/arm/include/asm/arch-sunxi/spl.h
+++ b/arch/arm/include/asm/arch-sunxi/spl.h
@@ -19,6 +19,7 @@
 
 #define SPL_ENV_HEADER_VERSION SPL_VERSION(0, 1)
 #define SPL_DT_HEADER_VERSION  SPL_VERSION(0, 2)
+#define SPL_DRAM_HEADER_VERSIONSPL_VERSION(0, 3)
 
 #ifdef CONFIG_SUNXI_HIGH_SRAM
 #define SPL_ADDR   0x1
@@ -74,7 +75,7 @@ struct boot_file_head {
 * to the users.
 */
uint32_t dt_name_offset;/* since v0.2, set by mksunxiboot */
-   uint32_t reserved1;
+   uint32_t dram_size; /* in MiB, since v0.3, set by SPL */
uint32_t boot_media;/* written here by the boot ROM */
/* A padding area (may be used for storing text strings) */
uint32_t string_pool[13];   /* since v0.2, filled by mksunxiboot */
diff --git a/board/sunxi/board.c b/board/sunxi/board.c
index 0bb7b023ed..2b92d33cf1 100644
--- a/board/sunxi/board.c
+++ b/board/sunxi/board.c
@@ -279,7 +279,13 @@ static struct boot_file_head * get_spl_header(uint8_t 
req_version)
 
 int dram_init(void)
 {
-   gd->ram_size = get_ram_size((long *)PHYS_SDRAM_0, PHYS_SDRAM_0_SIZE);
+   struct boot_file_head *spl = get_spl_header(SPL_DRAM_HEADER_VERSION);
+
+   if (spl == INVALID_SPL_HEADER)
+   gd->ram_size = get_ram_size((long *)PHYS_SDRAM_0,
+   PHYS_SDRAM_0_SIZE);
+   else
+   gd->ram_size = (phys_addr_t)spl->dram_size << 20;
 
return 0;
 }
@@ -537,6 +543,21 @@ int board_mmc_init(bd_t *bis)
 #endif
 
 #ifdef CONFIG_SPL_BUILD
+
+static void sunxi_spl_store_dram_size(phys_addr_t dram_size)
+{
+   struct boot_file_head *spl = get_spl_header(SPL_DT_HEADER_VERSION);
+
+   if (spl == INVALID_SPL_HEADER)
+   return;
+
+   /* Promote the header version for U-Boot proper, if needed. */
+   if (spl->spl_signature[3] < SPL_DRAM_HEADER_VERSION)
+   spl->spl_signature[3] = SPL_DRAM_HEADER_VERSION;
+
+   spl->dram_size = dram_size >> 20;
+}
+
 void sunxi_board_init(void)
 {
int power_failed = 0;
@@ -605,6 +626,8 @@ void sunxi_board_init(void)
if (!gd->ram_size)
hang();
 
+   sunxi_spl_store_dram_size(gd->ram_size);
+
/*
 * Only clock up the CPU to full speed if we are reasonably
 * assured it's being powered with suitable core voltage
-- 
2.14.1

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


Re: [U-Boot] [RFC PATCH 0/3] sunxi: extend SPL header to propagate DRAM size

2018-05-17 Thread Maxime Ripard
On Thu, May 17, 2018 at 09:16:58AM +0100, Andre Przywara wrote:
> This series tries to solve three issues we currently have on
> Allwinner boards:
> - The DRAM sizing routine can only cope with power-of-two sized DRAM.
> - The DRAM sizing routine steps through all DRAM, possibly hitting secure
>   memory.
> - The SPL header versioning is quite strict and tends to break every time
>   we need to update it.
> 
> So I thought about introducing something along the lines of semantic
> versioning[1], where we can add backwards-compatible changes to the SPL
> header without breaking every tool. This is introduced in the first patch.
> The second patch does some refactoring, so that the third patch can use
> the newly gained freedom to store the DRAM size. The SPL knows the DRAM
> size very well, so we store this in the SPL header, so that U-Boot proper
> can pick it up from there. This saves the call to get_ram_size() with
> its deficiencies.
> More information in the respective commit messages.
> 
> I understand that this versioning solution is not fully future-proof, but
> we have only one byte for the version, and I just wanted to start
> discussion on this.
> There is a corresponding patch for sunxi-tools as well I am posting shortly.
> 
> [1] https://semver.org

I'm not sure I have a lot of comments to make, this looks sane to me :)

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


Re: [U-Boot] [PATCH 01/12] ARM: socfpga: Sync A10 clock manager binding parser

2018-05-17 Thread Marek Vasut
On 05/17/2018 06:38 AM, Chee, Tien Fong wrote:
> On Sat, 2018-05-12 at 22:30 +0200, Marek Vasut wrote:
>> The A10 clock manager parsed DT bindings generated by Quartus the
>> bsp-editor to configure the A10 clocks. Sadly, those DT bindings
>> changed at some point. The clock manager patch used the old ones,
>> this patch replaces the bindings parser with one for the new set.
>>
>> Signed-off-by: Marek Vasut 
>> Cc: Chin Liang See 
>> Cc: Dinh Nguyen 
>> ---
>>  arch/arm/mach-socfpga/clock_manager_arria10.c  | 158
>> ++---
>>  .../include/mach/clock_manager_arria10.h   |   2 +-
>>  2 files changed, 111 insertions(+), 49 deletions(-)
>>
>> diff --git a/arch/arm/mach-socfpga/clock_manager_arria10.c
>> b/arch/arm/mach-socfpga/clock_manager_arria10.c
>> index 4ee6a82b5f..defa2f6261 100644
>> --- a/arch/arm/mach-socfpga/clock_manager_arria10.c
>> +++ b/arch/arm/mach-socfpga/clock_manager_arria10.c
>> @@ -9,6 +9,9 @@
>>  #include 
>>  #include 
>>  
>> +static const struct socfpga_clock_manager *clock_manager_base =
>> +(struct socfpga_clock_manager *)SOCFPGA_CLKMGR_ADDRESS;
>> +
>>  static u32 eosc1_hz;
>>  static u32 cb_intosc_hz;
>>  static u32 f2s_free_hz;
>> @@ -64,89 +67,150 @@ struct perpll_cfg {
>>  u32 cntr8clk_cnt;
>>  u32 cntr8clk_src;
>>  u32 cntr9clk_cnt;
>> +u32 cntr9clk_src;
> Why add this? I believe this is not exist.

It exists in the altera sources and it matches the pattern. What do you
mean by "this is not exist" ?

>>  u32 emacctl_emac0sel;
>>  u32 emacctl_emac1sel;
>>  u32 emacctl_emac2sel;
>>  u32 gpiodiv_gpiodbclk;
>>  };
>>  
[...]

-- 
Best regards,
Marek Vasut
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH 3/6] usb: dwc3: Add generic DWC3 glue logic driver

2018-05-17 Thread Marek Vasut
On 05/17/2018 08:27 AM, Michal Simek wrote:
> On 16.5.2018 16:41, Marek Vasut wrote:
>> On 05/16/2018 04:26 PM, Michal Simek wrote:
>>> By enabling BLK by default this is the next driver which needs to get
>>> support for DM_USB. Adding generic DWC3 glue logic which only
>>> parse nodes and read device mode. Based on it probe proper
>>> host/peripheral DWC3 drivers for it.
>>>
>>> Signed-off-by: Michal Simek 
>>> ---
>>>
>>>  drivers/usb/dwc3/Kconfig|   6 ++
>>>  drivers/usb/dwc3/Makefile   |   1 +
>>>  drivers/usb/dwc3/dwc3-generic.c | 165 
>>>  3 files changed, 172 insertions(+)
>>>  create mode 100644 drivers/usb/dwc3/dwc3-generic.c
>>>
>>> diff --git a/drivers/usb/dwc3/Kconfig b/drivers/usb/dwc3/Kconfig
>>> index ae7fc1c6304d..943b7630eba4 100644
>>> --- a/drivers/usb/dwc3/Kconfig
>>> +++ b/drivers/usb/dwc3/Kconfig
>>> @@ -37,6 +37,12 @@ config USB_DWC3_OMAP
>>>  
>>>   Say 'Y' here if you have one such device
>>>  
>>> +config USB_DWC3_GENERIC
>>> +   bool "Xilinx ZynqMP and similar Platforms"
>>> +   depends on DM_USB && USB_DWC3
>>> +   help
>>> + Some platforms can reuse this DWC3 generic implementation.
>>> +
>>>  config USB_DWC3_UNIPHIER
>>> bool "DesignWare USB3 Host Support on UniPhier Platforms"
>>> depends on ARCH_UNIPHIER && USB_XHCI_DWC3
>>> diff --git a/drivers/usb/dwc3/Makefile b/drivers/usb/dwc3/Makefile
>>> index cd18b8d9ec02..60b5515a67da 100644
>>> --- a/drivers/usb/dwc3/Makefile
>>> +++ b/drivers/usb/dwc3/Makefile
>>> @@ -7,6 +7,7 @@ dwc3-y  := core.o
>>>  obj-$(CONFIG_USB_DWC3_GADGET)  += gadget.o ep0.o
>>>  
>>>  obj-$(CONFIG_USB_DWC3_OMAP)+= dwc3-omap.o
>>> +obj-$(CONFIG_USB_DWC3_GENERIC) += dwc3-generic.o
>>>  obj-$(CONFIG_USB_DWC3_UNIPHIER)+= dwc3-uniphier.o
>>>  obj-$(CONFIG_USB_DWC3_PHY_OMAP)+= ti_usb_phy.o
>>>  obj-$(CONFIG_USB_DWC3_PHY_SAMSUNG) += samsung_usb_phy.o
>>> diff --git a/drivers/usb/dwc3/dwc3-generic.c 
>>> b/drivers/usb/dwc3/dwc3-generic.c
>>> new file mode 100644
>>> index ..7dd2555c2042
>>> --- /dev/null
>>> +++ b/drivers/usb/dwc3/dwc3-generic.c
>>> @@ -0,0 +1,165 @@
>>> +// SPDX-License-Identifier: GPL-2.0
>>> +/*
>>> + * Generic DWC3 Glue layer
>>> + *
>>> + * Copyright (C) 2016 - 2018 Xilinx, Inc.
>>> + *
>>> + * Based on dwc3-omap.c.
>>> + */
>>> +
>>> +#include 
>>> +#include 
>>> +#include 
>>> +#include 
>>> +#include 
>>> +#include 
>>> +#include 
>>> +#include 
>>> +#include 
>>> +#include 
>>> +#include "core.h"
>>> +#include "gadget.h"
>>> +#include "linux-compat.h"
>>> +
>>> +DECLARE_GLOBAL_DATA_PTR;
>>> +
>>> +int usb_gadget_handle_interrupts(int index)
>>> +{
>>> +   struct dwc3 *priv;
>>> +   struct udevice *dev;
>>> +   int ret;
>>> +
>>> +   ret = uclass_first_device(UCLASS_USB_DEV_GENERIC, &dev);
>>> +   if (!dev || ret) {
>>> +   pr_err("No USB device found\n");
>>> +   return -ENODEV;
>>> +   }
>>> +
>>> +   priv = dev_get_priv(dev);
>>> +
>>> +   dwc3_gadget_uboot_handle_interrupt(priv);
>>> +
>>> +   return 0;
>>> +}
>>> +
>>> +static int dwc3_generic_peripheral_probe(struct udevice *dev)
>>> +{
>>> +   struct dwc3 *priv = dev_get_priv(dev);
>>> +
>>> +   return dwc3_init(priv);
>>> +}
>>> +
>>> +static int dwc3_generic_peripheral_remove(struct udevice *dev)
>>> +{
>>> +   struct dwc3 *priv = dev_get_priv(dev);
>>> +
>>> +   dwc3_remove(priv);
>>> +
>>> +   return 0;
>>> +}
>>> +
>>> +static int dwc3_generic_peripheral_ofdata_to_platdata(struct udevice *dev)
>>> +{
>>> +   struct dwc3 *priv = dev_get_priv(dev);
>>> +   int node = dev_of_offset(dev);
>>> +
>>> +   priv->regs = (void *)devfdt_get_addr(dev);
>>> +   priv->regs += DWC3_GLOBALS_REGS_START;
>>> +
>>> +   priv->maximum_speed = usb_get_maximum_speed(node);
>>> +   if (priv->maximum_speed == USB_SPEED_UNKNOWN) {
>>> +   pr_err("Invalid usb maximum speed\n");
>>> +   return -ENODEV;
>>> +   }
>>> +
>>> +   priv->dr_mode = usb_get_dr_mode(node);
>>> +   if (priv->dr_mode == USB_DR_MODE_UNKNOWN) {
>>> +   pr_err("Invalid usb mode setup\n");
>>> +   return -ENODEV;
>>> +   }
>>> +
>>> +   return 0;
>>> +}
>>> +
>>> +static int dwc3_generic_peripheral_bind(struct udevice *dev)
>>> +{
>>> +   return device_probe(dev);
>>> +}
>>> +
>>> +U_BOOT_DRIVER(dwc3_generic_peripheral) = {
>>> +   .name   = "dwc3-generic-peripheral",
>>> +   .id = UCLASS_USB_DEV_GENERIC,
>>> +   .ofdata_to_platdata = dwc3_generic_peripheral_ofdata_to_platdata,
>>> +   .probe = dwc3_generic_peripheral_probe,
>>> +   .remove = dwc3_generic_peripheral_remove,
>>> +   .bind = dwc3_generic_peripheral_bind,
>>> +   .platdata_auto_alloc_size = sizeof(struct usb_platdata),
>>> +   .priv_auto_alloc_size = sizeof(struct dwc3),
>>> +   .flags  = DM_FLAG_ALLOC_PRIV_DMA,
>>> +};
>>> +
>>> +static int dwc3_generic_bind(struct udevice *parent)
>>> +{
>>> +   const void *fdt = gd->fdt_blob;
>>> +   int node;

Re: [U-Boot] [PATCH 1/6] usb: dwc3: Add dwc3_init/remove with DM_USB

2018-05-17 Thread Marek Vasut
On 05/17/2018 09:40 AM, Michal Simek wrote:
> On 16.5.2018 16:40, Marek Vasut wrote:
>> On 05/16/2018 04:26 PM, Michal Simek wrote:
>>> From: Mugunthan V N 
>>>
>>> The patch is preparing dwc3 core for enabling DM_USB with peripheral
>>> driver with using driver model support.
>>> The driver will be bound by the DWC3 wrapper driver based on the
>>> dr_mode device tree entry.
>>>
>>> Signed-off-by: Mugunthan V N 
>>> (Remove dwc3-omap changes)
>>> Signed-off-by: Michal Simek 
>>> ---
>> [...]
>>> diff --git a/drivers/usb/dwc3/core.h b/drivers/usb/dwc3/core.h
>>> index cbe9850a0bda..ad16c9b7c46c 100644
>>> --- a/drivers/usb/dwc3/core.h
>>> +++ b/drivers/usb/dwc3/core.h
>>> @@ -712,7 +712,11 @@ struct dwc3 {
>>> /* device lock */
>>> spinlock_t  lock;
>>>  
>>> +#ifndef CONFIG_DM_USB
>>
>> Shouldnt this be ifdef __UBOOT__ ?
>>
>>> struct device   *dev;
>>> +#else
>>> +   struct udevice  *dev;
>>> +#endif
> 
> What about this?
> 
> #if defined(__UBOOT__) && defined(CONFIG_DM_USB)
>   struct udevice  *dev;
> #else
>   struct device   *dev;
> #endif

Yes. I am kinda surprised we don't have some udevice<->device mapping
layer, but I guess that might have it's own problems.

-- 
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 0/3] sunxi: extend SPL header to propagate DRAM size

2018-05-17 Thread Icenowy Zheng


于 2018年5月17日 GMT+08:00 下午4:16:58, Andre Przywara  写到:
>This series tries to solve three issues we currently have on
>Allwinner boards:
>- The DRAM sizing routine can only cope with power-of-two sized DRAM.
>- The DRAM sizing routine steps through all DRAM, possibly hitting
>secure
>  memory.
>- The SPL header versioning is quite strict and tends to break every
>time
>  we need to update it.
>
>So I thought about introducing something along the lines of semantic
>versioning[1], where we can add backwards-compatible changes to the SPL
>header without breaking every tool. This is introduced in the first

How to define the "backwards-compatible"?

Should it have a standard? (e.g. tools have no change needed
and U-Boot will have fallback code)

>patch.
>The second patch does some refactoring, so that the third patch can use
>the newly gained freedom to store the DRAM size. The SPL knows the DRAM
>size very well, so we store this in the SPL header, so that U-Boot
>proper
>can pick it up from there. This saves the call to get_ram_size() with
>its deficiencies.
>More information in the respective commit messages.
>
>I understand that this versioning solution is not fully future-proof,
>but
>we have only one byte for the version, and I just wanted to start
>discussion on this.
>There is a corresponding patch for sunxi-tools as well I am posting
>shortly.
>
>[1] https://semver.org
>
>Cheers,
>Andre.
>
>Andre Przywara (3):
>  sunxi: Extend SPL header versioning
>  sunxi: board.c: refactor SPL header checks
>  sunxi: store DRAM size in SPL header
>
> arch/arm/include/asm/arch-sunxi/spl.h | 22 
>board/sunxi/board.c   | 66
>---
> 2 files changed, 70 insertions(+), 18 deletions(-)
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] Please pull u-boot-marvell/master

2018-05-17 Thread Chris Packham
On Thu, May 17, 2018 at 3:37 AM Tom Rini  wrote:

> On Wed, May 16, 2018 at 02:05:03PM +0200, Stefan Roese wrote:

> > Hi Tom,
> >
> > please pull the Kirkwood DT patches from Chris.
> >
> > Thanks,
> > Stefan
> >
> > The following changes since commit
0315d6959fdd9d2a4d89016c311e9c8c8d239a10:
> >
> >   ARM: mvebu: a38x: Add missing SPDX license identfier (2018-05-15
09:08:00 -0400)
> >
> > are available in the Git repository at:
> >
> >   git://www.denx.de/git/u-boot-marvell.git
> >
> > for you to fetch changes up to a7925926dc7f81fb5c137d2b4b7c6457694b1ac0:
> >
> >   ARM: kirkwood: Add device-tree for sheevaplug (2018-05-16 10:29:53
+0200)
> >

> NAK.  With gcc-7.3
> (
https://mirrors.edge.kernel.org/pub/tools/crosstool/files/bin/x86_64/7.3.0/)
> I get:
> arm:  +   openrd_base openrd_ultimate openrd_client
> +(openrd_base,openrd_ultimate,openrd_client) u-boot-nodtb.bin exceeds
file size limit:
> +(openrd_base,openrd_ultimate,openrd_client)   limit:  393216 bytes
> +(openrd_base)   actual: 395632 bytes
> +(openrd_base)   excess: 2416 bytes
> +(openrd_base,openrd_ultimate,openrd_client) make[1]: *** [Makefile:1014:
u-boot-nodtb.bin] Error 1
> +(openrd_ultimate)   actual: 395664 bytes
> +(openrd_ultimate)   excess: 2448 bytes
> +(openrd_client)   actual: 395680 bytes
> +(openrd_client)   excess: 2464 bytes

> And I will be pushing those changes to finally switch travis over to
> gcc-7.3 soon (I had thought I had posted them a long while back so that
> I could have pulled them in right after v2018.05, but I forgot, so here
> we are now..).

Odd I did get those failures initially but then I rebased against master
and didn't see them again. I've been using gcc 7.3 throughout. At the time
I assumed there were some other changes that had shrunk openrd enough for
the dtb to fit. I see Stefan's patch to move the env location. Is that
sufficient or do you want me to either drop openrd or find something that
can be left out?
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] Please pull u-boot-marvell/master

2018-05-17 Thread Chris Packham
On Thu, May 17, 2018 at 8:36 PM Chris Packham 
wrote:


> On Thu, May 17, 2018 at 3:37 AM Tom Rini  wrote:
> >
> > On Wed, May 16, 2018 at 02:05:03PM +0200, Stefan Roese wrote:
> >
> > > Hi Tom,
> > >
> > > please pull the Kirkwood DT patches from Chris.
> > >
> > > Thanks,
> > > Stefan
> > >
> > > The following changes since commit
0315d6959fdd9d2a4d89016c311e9c8c8d239a10:
> > >
> > >   ARM: mvebu: a38x: Add missing SPDX license identfier (2018-05-15
09:08:00 -0400)
> > >
> > > are available in the Git repository at:
> > >
> > >   git://www.denx.de/git/u-boot-marvell.git
> > >
> > > for you to fetch changes up to
a7925926dc7f81fb5c137d2b4b7c6457694b1ac0:
> > >
> > >   ARM: kirkwood: Add device-tree for sheevaplug (2018-05-16 10:29:53
+0200)
> > >
> >
> > NAK.  With gcc-7.3
> > (
https://mirrors.edge.kernel.org/pub/tools/crosstool/files/bin/x86_64/7.3.0/)
> > I get:
> >arm:  +   openrd_base openrd_ultimate openrd_client
> > +(openrd_base,openrd_ultimate,openrd_client) u-boot-nodtb.bin exceeds
file size limit:
> > +(openrd_base,openrd_ultimate,openrd_client)   limit:  393216 bytes
> > +(openrd_base)   actual: 395632 bytes
> > +(openrd_base)   excess: 2416 bytes
> > +(openrd_base,openrd_ultimate,openrd_client) make[1]: ***
[Makefile:1014: u-boot-nodtb.bin] Error 1
> > +(openrd_ultimate)   actual: 395664 bytes
> > +(openrd_ultimate)   excess: 2448 bytes
> > +(openrd_client)   actual: 395680 bytes
> > +(openrd_client)   excess: 2464 bytes
> >
> > And I will be pushing those changes to finally switch travis over to
> > gcc-7.3 soon (I had thought I had posted them a long while back so that
> > I could have pulled them in right after v2018.05, but I forgot, so here
> > we are now..).

> Odd I did get those failures initially but then I rebased against master
and didn't see them again. I've been using gcc 7.3 throughout. At the time
I assumed there were some other changes that had shrunk openrd enough for
the dtb to fit. I see Stefan's patch to move the env location. Is that
sufficient or do you want me to either drop openrd or find something that
can be left out?

(gmail seems to have forgotten how to wrap quotes)

Sure enough my local branch with this series based on commit cc95535867f4
("bootm.c: Correct the flush_len used in bootm_load_os()") builds
openrd_ultimate is fine. But if I rebase onto commit f2d0f5e7ab3b ("ARM:
re-enable MVGBE for edminiv2") I see the build size errors. I'll do some
digging. Chances are my other MVGBE patch has enabled something unwanted.
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH 01/12] ARM: socfpga: Sync A10 clock manager binding parser

2018-05-17 Thread Chee, Tien Fong
On Thu, 2018-05-17 at 10:24 +0200, Marek Vasut wrote:
> On 05/17/2018 06:38 AM, Chee, Tien Fong wrote:
> > 
> > On Sat, 2018-05-12 at 22:30 +0200, Marek Vasut wrote:
> > > 
> > > The A10 clock manager parsed DT bindings generated by Quartus the
> > > bsp-editor to configure the A10 clocks. Sadly, those DT bindings
> > > changed at some point. The clock manager patch used the old ones,
> > > this patch replaces the bindings parser with one for the new set.
> > > 
> > > Signed-off-by: Marek Vasut 
> > > Cc: Chin Liang See 
> > > Cc: Dinh Nguyen 
> > > ---
> > >  arch/arm/mach-socfpga/clock_manager_arria10.c  | 158
> > > ++---
> > >  .../include/mach/clock_manager_arria10.h   |   2 +-
> > >  2 files changed, 111 insertions(+), 49 deletions(-)
> > > 
> > > diff --git a/arch/arm/mach-socfpga/clock_manager_arria10.c
> > > b/arch/arm/mach-socfpga/clock_manager_arria10.c
> > > index 4ee6a82b5f..defa2f6261 100644
> > > --- a/arch/arm/mach-socfpga/clock_manager_arria10.c
> > > +++ b/arch/arm/mach-socfpga/clock_manager_arria10.c
> > > @@ -9,6 +9,9 @@
> > >  #include 
> > >  #include 
> > >  
> > > +static const struct socfpga_clock_manager *clock_manager_base =
> > > + (struct socfpga_clock_manager *)SOCFPGA_CLKMGR_ADDRESS;
> > > +
> > >  static u32 eosc1_hz;
> > >  static u32 cb_intosc_hz;
> > >  static u32 f2s_free_hz;
> > > @@ -64,89 +67,150 @@ struct perpll_cfg {
> > >   u32 cntr8clk_cnt;
> > >   u32 cntr8clk_src;
> > >   u32 cntr9clk_cnt;
> > > + u32 cntr9clk_src;
> > Why add this? I believe this is not exist.
> It exists in the altera sources and it matches the pattern. What do
> you
> mean by "this is not exist" ?
> 
we don't have cntr9clk_src in perpll.
> > 
> > > 
> > >   u32 emacctl_emac0sel;
> > >   u32 emacctl_emac1sel;
> > >   u32 emacctl_emac2sel;
> > >   u32 gpiodiv_gpiodbclk;
> > >  };
> > >  
> [...]
> 
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] Please pull u-boot-marvell/master

2018-05-17 Thread Stefan Roese

Hi Chris,

On 17.05.2018 10:45, Chris Packham wrote:

On Thu, May 17, 2018 at 8:36 PM Chris Packham 
wrote:



On Thu, May 17, 2018 at 3:37 AM Tom Rini  wrote:


On Wed, May 16, 2018 at 02:05:03PM +0200, Stefan Roese wrote:


Hi Tom,

please pull the Kirkwood DT patches from Chris.

Thanks,
Stefan

The following changes since commit

0315d6959fdd9d2a4d89016c311e9c8c8d239a10:


   ARM: mvebu: a38x: Add missing SPDX license identfier (2018-05-15

09:08:00 -0400)


are available in the Git repository at:

   git://www.denx.de/git/u-boot-marvell.git

for you to fetch changes up to

a7925926dc7f81fb5c137d2b4b7c6457694b1ac0:


   ARM: kirkwood: Add device-tree for sheevaplug (2018-05-16 10:29:53

+0200)




NAK.  With gcc-7.3
(

https://mirrors.edge.kernel.org/pub/tools/crosstool/files/bin/x86_64/7.3.0/)

I get:
arm:  +   openrd_base openrd_ultimate openrd_client
+(openrd_base,openrd_ultimate,openrd_client) u-boot-nodtb.bin exceeds

file size limit:

+(openrd_base,openrd_ultimate,openrd_client)   limit:  393216 bytes
+(openrd_base)   actual: 395632 bytes
+(openrd_base)   excess: 2416 bytes
+(openrd_base,openrd_ultimate,openrd_client) make[1]: ***

[Makefile:1014: u-boot-nodtb.bin] Error 1

+(openrd_ultimate)   actual: 395664 bytes
+(openrd_ultimate)   excess: 2448 bytes
+(openrd_client)   actual: 395680 bytes
+(openrd_client)   excess: 2464 bytes

And I will be pushing those changes to finally switch travis over to
gcc-7.3 soon (I had thought I had posted them a long while back so that
I could have pulled them in right after v2018.05, but I forgot, so here
we are now..).



Odd I did get those failures initially but then I rebased against master

and didn't see them again. I've been using gcc 7.3 throughout. At the time
I assumed there were some other changes that had shrunk openrd enough for
the dtb to fit. I see Stefan's patch to move the env location. Is that
sufficient or do you want me to either drop openrd or find something that
can be left out?

(gmail seems to have forgotten how to wrap quotes)

Sure enough my local branch with this series based on commit cc95535867f4
("bootm.c: Correct the flush_len used in bootm_load_os()") builds
openrd_ultimate is fine. But if I rebase onto commit f2d0f5e7ab3b ("ARM:
re-enable MVGBE for edminiv2") I see the build size errors. I'll do some
digging. Chances are my other MVGBE patch has enabled something unwanted.


Thanks Chris. But perhaps its also good to increase the image size
for those openrd boards, since we most likely will increase the
size in the near future even further (addition of DM support etc).
Please see:

http://patchwork.ozlabs.org/patch/915135/

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


Re: [U-Boot] [RFC PATCH 0/3] sunxi: extend SPL header to propagate DRAM size

2018-05-17 Thread Andre Przywara
Hi,

On 17/05/18 09:35, Icenowy Zheng wrote:
> 
> 
> 于 2018年5月17日 GMT+08:00 下午4:16:58, Andre Przywara  写到:
>> This series tries to solve three issues we currently have on
>> Allwinner boards:
>> - The DRAM sizing routine can only cope with power-of-two sized DRAM.
>> - The DRAM sizing routine steps through all DRAM, possibly hitting
>> secure
>>  memory.
>> - The SPL header versioning is quite strict and tends to break every
>> time
>>  we need to update it.
>>
>> So I thought about introducing something along the lines of semantic
>> versioning[1], where we can add backwards-compatible changes to the SPL
>> header without breaking every tool. This is introduced in the first
> 
> How to define the "backwards-compatible"?

Yeah, that's a good question I was hoping to get some input on.
Ideally backwards-compatible means that older tools can cope with the
new feature, so for instance anyone not knowing about the DRAM size
introduced in v3 would still be happy (either ignoring it or not using it).

Now what's special about our situation is that we have several agents
dealing with the SPL header:
- The BootROM puts the boot source in there. That's probably a
no-brainer for now, but later BootROMs might behave differently. We
might need to update the major version when they do so without changing
the magic number.
- mksunxiboot creates the header and puts the version number in there.
It populates the DT name field since v2. I kept it at v2 for now, since
it's only the SPL populating the v3 DRAM size field.
- sunxi-fel reads the header and adds the FEL script address in there,
requiring at least v1. In the moment it insists on the version number
being at most 2, which my sunxi-tools patch tries to fix.
- Now the SPL and U-Boot use a field themselves (DRAM size), and I
bumped the version if needed.

> Should it have a standard? (e.g. tools have no change needed
> and U-Boot will have fallback code)

Yeah, that sounds like some sensible definition.

The only problem I see is what happens when we need a v4 feature for
mksunxiboot. This would lead U-Boot proper to believe the DRAM size
field is valid, even though the SPL might not have populated it. Not
sure we care about it, or if there is a better solution (feature bits?).

Cheers,
Andre.

>> patch.
>> The second patch does some refactoring, so that the third patch can use
>> the newly gained freedom to store the DRAM size. The SPL knows the DRAM
>> size very well, so we store this in the SPL header, so that U-Boot
>> proper
>> can pick it up from there. This saves the call to get_ram_size() with
>> its deficiencies.
>> More information in the respective commit messages.
>>
>> I understand that this versioning solution is not fully future-proof,
>> but
>> we have only one byte for the version, and I just wanted to start
>> discussion on this.
>> There is a corresponding patch for sunxi-tools as well I am posting
>> shortly.
>>
>> [1] https://semver.org
>>
>> Cheers,
>> Andre.
>>
>> Andre Przywara (3):
>>  sunxi: Extend SPL header versioning
>>  sunxi: board.c: refactor SPL header checks
>>  sunxi: store DRAM size in SPL header
>>
>> arch/arm/include/asm/arch-sunxi/spl.h | 22 
>> board/sunxi/board.c   | 66
>> ---
>> 2 files changed, 70 insertions(+), 18 deletions(-)
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH] net: MVGBE don't automatically select PHYLIB

2018-05-17 Thread Chris Packham
Not all users of MVGBE need PHYLIB and it increases the size of the
openrd images too much.

Fixes: commit ed52ea507f12 ("net: add Kconfig for MVGBE")
Signed-off-by: Chris Packham 
Cc: Tom Rini 
Cc: Stefan Roese 
---

 drivers/net/Kconfig | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig
index c962d7a72c0c..f2cc75f494e8 100644
--- a/drivers/net/Kconfig
+++ b/drivers/net/Kconfig
@@ -181,7 +181,6 @@ config FTMAC100
 config MVGBE
bool "Marvell Orion5x/Kirkwood network interface support"
depends on KIRKWOOD || ORION5X
-   select PHYLIB
help
  This driver supports the network interface units in the
  Marvell Orion5x and Kirkwood SoCs
-- 
2.17.0

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


Re: [U-Boot] Please pull u-boot-marvell/master

2018-05-17 Thread Chris Packham
On Thu, May 17, 2018 at 8:48 PM Stefan Roese  wrote:

> Hi Chris,

> On 17.05.2018 10:45, Chris Packham wrote:
> > On Thu, May 17, 2018 at 8:36 PM Chris Packham 
> > wrote:
> >
> >
> >> On Thu, May 17, 2018 at 3:37 AM Tom Rini  wrote:
> >>>
> >>> On Wed, May 16, 2018 at 02:05:03PM +0200, Stefan Roese wrote:
> >>>
>  Hi Tom,
> 
>  please pull the Kirkwood DT patches from Chris.
> 
>  Thanks,
>  Stefan
> 
>  The following changes since commit
> > 0315d6959fdd9d2a4d89016c311e9c8c8d239a10:
> 
> ARM: mvebu: a38x: Add missing SPDX license identfier (2018-05-15
> > 09:08:00 -0400)
> 
>  are available in the Git repository at:
> 
> git://www.denx.de/git/u-boot-marvell.git
> 
>  for you to fetch changes up to
> > a7925926dc7f81fb5c137d2b4b7c6457694b1ac0:
> 
> ARM: kirkwood: Add device-tree for sheevaplug (2018-05-16 10:29:53
> > +0200)
> 
> >>>
> >>> NAK.  With gcc-7.3
> >>> (
> >
https://mirrors.edge.kernel.org/pub/tools/crosstool/files/bin/x86_64/7.3.0/)
> >>> I get:
> >>> arm:  +   openrd_base openrd_ultimate openrd_client
> >>> +(openrd_base,openrd_ultimate,openrd_client) u-boot-nodtb.bin exceeds
> > file size limit:
> >>> +(openrd_base,openrd_ultimate,openrd_client)   limit:  393216 bytes
> >>> +(openrd_base)   actual: 395632 bytes
> >>> +(openrd_base)   excess: 2416 bytes
> >>> +(openrd_base,openrd_ultimate,openrd_client) make[1]: ***
> > [Makefile:1014: u-boot-nodtb.bin] Error 1
> >>> +(openrd_ultimate)   actual: 395664 bytes
> >>> +(openrd_ultimate)   excess: 2448 bytes
> >>> +(openrd_client)   actual: 395680 bytes
> >>> +(openrd_client)   excess: 2464 bytes
> >>>
> >>> And I will be pushing those changes to finally switch travis over to
> >>> gcc-7.3 soon (I had thought I had posted them a long while back so
that
> >>> I could have pulled them in right after v2018.05, but I forgot, so
here
> >>> we are now..).
> >
> >> Odd I did get those failures initially but then I rebased against
master
> > and didn't see them again. I've been using gcc 7.3 throughout. At the
time
> > I assumed there were some other changes that had shrunk openrd enough
for
> > the dtb to fit. I see Stefan's patch to move the env location. Is that
> > sufficient or do you want me to either drop openrd or find something
that
> > can be left out?
> >
> > (gmail seems to have forgotten how to wrap quotes)
> >
> > Sure enough my local branch with this series based on commit
cc95535867f4
> > ("bootm.c: Correct the flush_len used in bootm_load_os()") builds
> > openrd_ultimate is fine. But if I rebase onto commit f2d0f5e7ab3b ("ARM:
> > re-enable MVGBE for edminiv2") I see the build size errors. I'll do some
> > digging. Chances are my other MVGBE patch has enabled something
unwanted.

> Thanks Chris. But perhaps its also good to increase the image size
> for those openrd boards, since we most likely will increase the
> size in the near future even further (addition of DM support etc).
> Please see:

> http://patchwork.ozlabs.org/patch/915135/

I'm fine with that. We'll probably end up needing it.

I've just sent a patch to not automatically select PHYLIB anyway since my
MVGBE changes weren't the no-op they should have been.
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH] net: MVGBE don't automatically select PHYLIB

2018-05-17 Thread Stefan Roese

On 17.05.2018 11:03, Chris Packham wrote:

Not all users of MVGBE need PHYLIB and it increases the size of the
openrd images too much.

Fixes: commit ed52ea507f12 ("net: add Kconfig for MVGBE")
Signed-off-by: Chris Packham 
Cc: Tom Rini 
Cc: Stefan Roese 
---

  drivers/net/Kconfig | 1 -
  1 file changed, 1 deletion(-)

diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig
index c962d7a72c0c..f2cc75f494e8 100644
--- a/drivers/net/Kconfig
+++ b/drivers/net/Kconfig
@@ -181,7 +181,6 @@ config FTMAC100
  config MVGBE
bool "Marvell Orion5x/Kirkwood network interface support"
depends on KIRKWOOD || ORION5X
-   select PHYLIB
help
  This driver supports the network interface units in the
  Marvell Orion5x and Kirkwood SoCs



Reviewed-by: Stefan Roese 

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


Re: [U-Boot] [PATCH] arm: kirkwood: openrd: Change environment location

2018-05-17 Thread Chris Packham
On Thu, May 17, 2018 at 7:08 PM Stefan Roese  wrote:

> With GCC 7.3 and the addition of device-tree to Kirkwood, the U-Boot
> image does not fit any more into its 0x6 area. Let's move the
> environment so that U-Boot will fit also with the upcoming changes
> for Kirkwood (add DM support etc).

> Signed-off-by: Stefan Roese 
> Cc: Tom Rini 
> Cc: Chris Packham 
> Cc: Albert ARIBAUD 
> Cc: Clint Adams 
> ---

Reviewed-by: Chris Packham 

Do we need to worry about a migration path for old -> new?

>   include/configs/openrd.h | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)

> diff --git a/include/configs/openrd.h b/include/configs/openrd.h
> index dfdad56dcc..3fe0a32a55 100644
> --- a/include/configs/openrd.h
> +++ b/include/configs/openrd.h
> @@ -42,8 +42,8 @@
>* it has to be rounded to sector size
>*/
>   #define CONFIG_ENV_SIZE0x2 /* 128k */
> -#define CONFIG_ENV_ADDR0x6
> -#define CONFIG_ENV_OFFSET  0x6 /* env starts here */
> +#define CONFIG_ENV_ADDR0x8
> +#define CONFIG_ENV_OFFSET  0x8 /* env starts here */
>   /*
>* Environment is right behind U-Boot in flash. Make sure U-Boot
>* doesn't grow into the environment area.
> --
> 2.17.0
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH] arm: kirkwood: openrd: Change environment location

2018-05-17 Thread Stefan Roese

On 17.05.2018 11:08, Chris Packham wrote:

On Thu, May 17, 2018 at 7:08 PM Stefan Roese  wrote:


With GCC 7.3 and the addition of device-tree to Kirkwood, the U-Boot
image does not fit any more into its 0x6 area. Let's move the
environment so that U-Boot will fit also with the upcoming changes
for Kirkwood (add DM support etc).



Signed-off-by: Stefan Roese 
Cc: Tom Rini 
Cc: Chris Packham 
Cc: Albert ARIBAUD 
Cc: Clint Adams 
---


Reviewed-by: Chris Packham 

Do we need to worry about a migration path for old -> new?


Thats definitely not perfect - I agree. But I'm not the
maintainer of this board (Albert is) and he or somebody else
might speak up to object on this.

We could also decide to not apply this patch right now and
wait until we really need it, since its most likely not
needed with your PHYLIB patch now.

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


Re: [U-Boot] [PATCH 1/4] phy: marvell: Support changing SERDES map in board file

2018-05-17 Thread Stefan Roese

On 16.05.2018 16:39, Marek Behún wrote:

This adds a weak definition of board_update_comphy_map to comphy_core,
which does nothing. If this function is defined elsewhere, for example
in board file, the board file can change some parameters of SERDES
configuration.

This is needed on Turris Mox, where the SERDES speed on lane 1 has to
be set differently when SFP module is connected and when Topaz Switch
module is connected.

This is a temporary solution. When the comphy driver for armada-3720
will be added to the kernel, the comphy driver in u-boot shall also be
updated and this should be done differently then.

Signed-off-by: Marek Behun 

  rename drivers/phy/marvell/{comphy.h => comphy_core.h} (96%)
  create mode 100644 include/comphy.h

diff --git a/drivers/phy/marvell/comphy_a3700.h 
b/drivers/phy/marvell/comphy_a3700.h
index a14767d809..b0941ffb37 100644
--- a/drivers/phy/marvell/comphy_a3700.h
+++ b/drivers/phy/marvell/comphy_a3700.h
@@ -6,7 +6,7 @@
  #ifndef _COMPHY_A3700_H_
  #define _COMPHY_A3700_H_
  
-#include "comphy.h"

+#include "comphy_core.h"
  #include "comphy_hpipe.h"
  
  #define MVEBU_REG(offs)			\

diff --git a/drivers/phy/marvell/comphy_core.c 
b/drivers/phy/marvell/comphy_core.c
index c6e2cc8897..74b9f11b08 100644
--- a/drivers/phy/marvell/comphy_core.c
+++ b/drivers/phy/marvell/comphy_core.c
@@ -11,7 +11,7 @@
  #include 
  #include 
  
-#include "comphy.h"

+#include "comphy_core.h"
  
  #define COMPHY_MAX_CHIP 4
  
@@ -66,6 +66,10 @@ void comphy_print(struct chip_serdes_phy_config *chip_cfg,

}
  }
  
+__weak void board_update_comphy_map(struct comphy_map *serdes_map, int count)

+{
+}
+


Perhaps its better to move "comphy_" to the beginning of this
function name, like:

comphy_update_map()

What do you think?


  static int comphy_probe(struct udevice *dev)
  {
const void *blob = gd->fdt_blob;
@@ -143,6 +147,8 @@ static int comphy_probe(struct udevice *dev)
lane++;
}
  
+	board_update_comphy_map(comphy_map_data, chip_cfg->comphy_lanes_count);

+


I would prefer to add a return code this this function and bail
out here, if something goes wrong.


/* Save CP index for MultiCP devices (A8K) */
chip_cfg->cp_index = current_idx++;
/* PHY power UP sequence */
diff --git a/drivers/phy/marvell/comphy.h b/drivers/phy/marvell/comphy_core.h
similarity index 96%
rename from drivers/phy/marvell/comphy.h
rename to drivers/phy/marvell/comphy_core.h
index b588ae41f0..e1da90e75b 100644
--- a/drivers/phy/marvell/comphy.h
+++ b/drivers/phy/marvell/comphy_core.h
@@ -3,11 +3,11 @@
   * Copyright (C) 2015-2016 Marvell International Ltd.
   */
  
-#ifndef _COMPHY_H_

-#define _COMPHY_H_
+#ifndef _COMPHY_CORE_H_
+#define _COMPHY_CORE_H_
  
-#include 

  #include 
+#include 
  
  #if defined(DEBUG)

  #define debug_enter() printf("> Enter %s\n", __func__);
@@ -80,14 +80,6 @@ struct comphy_mux_data {
struct comphy_mux_options mux_values[MAX_LANE_OPTIONS];
  };
  
-struct comphy_map {

-   u32 type;
-   u32 speed;
-   u32 invert;
-   bool clk_src;
-   bool end_point;
-};
-
  struct chip_serdes_phy_config {
struct comphy_mux_data *mux_data;
int (*ptr_comphy_chip_init)(struct chip_serdes_phy_config *,
@@ -183,5 +175,5 @@ void comphy_pcie_config_detect(u32 comphy_max_count,
   struct comphy_map *serdes_map);
  void comphy_pcie_unit_general_config(u32 pex_index);
  
-#endif /* _COMPHY_H_ */

+#endif /* _COMPHY_CORE_H_ */
  
diff --git a/drivers/phy/marvell/comphy_cp110.c b/drivers/phy/marvell/comphy_cp110.c

index b0d5d5ca26..6a60da3df0 100644
--- a/drivers/phy/marvell/comphy_cp110.c
+++ b/drivers/phy/marvell/comphy_cp110.c
@@ -9,7 +9,7 @@
  #include 
  #include 
  
-#include "comphy.h"

+#include "comphy_core.h"
  #include "comphy_hpipe.h"
  #include "sata.h"
  #include "utmi_phy.h"
diff --git a/drivers/phy/marvell/comphy_mux.c b/drivers/phy/marvell/comphy_mux.c
index 1f757d8e04..c67ba99762 100644
--- a/drivers/phy/marvell/comphy_mux.c
+++ b/drivers/phy/marvell/comphy_mux.c
@@ -6,7 +6,7 @@
  #include 
  #include 
  
-#include "comphy.h"

+#include "comphy_core.h"
  #include "comphy_hpipe.h"
  
  /*

diff --git a/include/comphy.h b/include/comphy.h
new file mode 100644
index 00..2ebb50d418
--- /dev/null
+++ b/include/comphy.h
@@ -0,0 +1,22 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
+/*
+ * Copyright (C) 2015-2016 Marvell International Ltd.
+ */
+
+#ifndef _COMPHY_H_
+#define _COMPHY_H_
+
+#include 
+
+struct comphy_map {
+   u32 type;
+   u32 speed;
+   u32 invert;
+   bool clk_src;
+   bool end_point;
+};
+
+void board_update_comphy_map(struct comphy_map *serdes_map, int count);
+
+#endif /* _COMPHY_H_ */


I'm not so happy with "polluting" the common "include" directory with
board / platform specific files. Please at least make this file name
platform specific, like "mvebu_comphy.h". Or add a mvebu subdirectory
here.

Thanks,
Stefan
___

Re: [U-Boot] [PATCH v5 4/9] board: ti: dra7xx-evm: turn on USB clocks in late init stage

2018-05-17 Thread Jean-Jacques Hiblot



On 16/05/2018 17:21, Tom Rini wrote:

On Wed, May 16, 2018 at 11:04:18AM +0200, Marek Vasut wrote:

On 05/16/2018 11:00 AM, Jean-Jacques Hiblot wrote:


On 16/05/2018 00:13, Marek Vasut wrote:

On 05/15/2018 06:10 PM, Jean-Jacques Hiblot wrote:

Hi Marek,


On 04/05/2018 21:06, Marek Vasut wrote:

Shouldnt the driver turn this on?

AFAIK there is no clock driver for the OMAP. So we have to do it
before
the driver is probed.

Maybe it's time to implement it instead of piling up those hacks ?

I was thinking along the same lines at some point but then I realized
that it will make the SPL really big. And we are already tight on some
platforms like am335x.

But this is not only SPL , right ? And yes, for SPL you might need to
poke registers or something.

IMHO having 2 different ways to enable the clocks in SPL and in u-boot
is an not improvement over the current situation.
In any case, This is a subject that can be discussed.

Do you have a better idea ?

I would keep it as it is today.

After studying the clock management in Linux, I believe that
implementing the clock drivers in u-boot won't be an easy task and
moreover won't make things much cleaner.
The way clocks are handled in Linux for the omap platforms is not
completely standard. There are a lot of clocks that are handled by the
clock framework (pll, mux, some gates, ...) but most of the clock gating
for peripherals is handled the HWMOD subsystem which automatically
enables/disables the clocks of the peripherals. Parameters for this
subsystem are hard-coded in platform code (in
arch/arm/mach-omap2/omap-hwmod_xxx_data.c) not in the DTS. It also
handle clock and power domains.
HWMOD is probably going to go away some day, I'm not sure that we want
to implement it in u-boot. Until hwmod has completely replaced by more
generic frameworks, I would stick to platform code to enable clocks in
u-boot.

But if this keeps going on, eventually we will regress to where we were
years ago -- having huge platform specific list of registers to poke to
set a platform up and that'd be it ?

We should certainly re-evaluate the situation once hwmod finally gets
replaced in the kernel.  That's a long-standing and slowly-but-surely
happening thing.

I understand it is frustrating to merge this kind of platform code when
a generic framework exists, but it is  one step in having DM_USB
support which in the end will remove more platform code.





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


Re: [U-Boot] [PATCH] board: turris_mox: Add fixed regulator support to defconfig

2018-05-17 Thread Stefan Roese

For the next, could you please use different tagging in the patch
subject? In this case, something like:

arm64: mvebu: defconfig: Add fixed regulator support on turris_mox

On 16.05.2018 22:13, Marek Behún wrote:

Without this USB3 won't work in U-Boot.

Signed-off-by: Marek Behun 
---
  configs/turris_mox_defconfig | 2 ++
  1 file changed, 2 insertions(+)

diff --git a/configs/turris_mox_defconfig b/configs/turris_mox_defconfig
index 9538903bd3..45c1399687 100644
--- a/configs/turris_mox_defconfig
+++ b/configs/turris_mox_defconfig
@@ -63,6 +63,8 @@ CONFIG_DEBUG_UART_SHIFT=2
  CONFIG_DEBUG_UART_ANNOUNCE=y
  CONFIG_MVEBU_A3700_UART=y
  CONFIG_MVEBU_A3700_SPI=y
+CONFIG_DM_REGULATOR=y
+CONFIG_DM_REGULATOR_FIXED=y
  CONFIG_USB=y
  CONFIG_DM_USB=y
  CONFIG_USB_XHCI_HCD=y



Other that this:

Reviewed-by: Stefan Roese 

Thanks,
Stefan

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


Re: [U-Boot] [PATCH 01/12] ARM: socfpga: Sync A10 clock manager binding parser

2018-05-17 Thread Marek Vasut
On 05/17/2018 10:44 AM, Chee, Tien Fong wrote:
> On Thu, 2018-05-17 at 10:24 +0200, Marek Vasut wrote:
>> On 05/17/2018 06:38 AM, Chee, Tien Fong wrote:
>>>
>>> On Sat, 2018-05-12 at 22:30 +0200, Marek Vasut wrote:

 The A10 clock manager parsed DT bindings generated by Quartus the
 bsp-editor to configure the A10 clocks. Sadly, those DT bindings
 changed at some point. The clock manager patch used the old ones,
 this patch replaces the bindings parser with one for the new set.

 Signed-off-by: Marek Vasut 
 Cc: Chin Liang See 
 Cc: Dinh Nguyen 
 ---
  arch/arm/mach-socfpga/clock_manager_arria10.c  | 158
 ++---
  .../include/mach/clock_manager_arria10.h   |   2 +-
  2 files changed, 111 insertions(+), 49 deletions(-)

 diff --git a/arch/arm/mach-socfpga/clock_manager_arria10.c
 b/arch/arm/mach-socfpga/clock_manager_arria10.c
 index 4ee6a82b5f..defa2f6261 100644
 --- a/arch/arm/mach-socfpga/clock_manager_arria10.c
 +++ b/arch/arm/mach-socfpga/clock_manager_arria10.c
 @@ -9,6 +9,9 @@
  #include 
  #include 
  
 +static const struct socfpga_clock_manager *clock_manager_base =
 +  (struct socfpga_clock_manager *)SOCFPGA_CLKMGR_ADDRESS;
 +
  static u32 eosc1_hz;
  static u32 cb_intosc_hz;
  static u32 f2s_free_hz;
 @@ -64,89 +67,150 @@ struct perpll_cfg {
    u32 cntr8clk_cnt;
    u32 cntr8clk_src;
    u32 cntr9clk_cnt;
 +  u32 cntr9clk_src;
>>> Why add this? I believe this is not exist.
>> It exists in the altera sources and it matches the pattern. What do
>> you
>> mean by "this is not exist" ?
>>
> we don't have cntr9clk_src in perpll.

https://github.com/altera-opensource/u-boot-socfpga/blob/socfpga_v2014.10_arria10_bringup/arch/arm/cpu/armv7/socfpga_arria10/clock_manager.c#L229

You do ...

-- 
Best regards,
Marek Vasut
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH 0/6] ARM: kirkwood: dts conversion round 2

2018-05-17 Thread Chris Packham
This is the second round of updating kirkwood boards to OF_CONTROL. Most
of these boards use spi flash so I've added the u-boot specific
"spi-flash" compatible string where appropriate.


Chris Packham (6):
  ARM: kirkwood: Add device-tree for d2net_v2 & net2big_v2
  ARM: kirkwood: Add device-tree for dreamplug
  ARM: kirkwood: Add device-tree for ds109
  ARM: kirkwood: Add device-tree for lschlv2 & lsxhl
  ARM: kirkwood: Add device-tree for netspace & inetspace
  ARM: kirkwood: Add device-tree for keymile

 arch/arm/dts/kirkwood-d2net.dts |  45 ++
 arch/arm/dts/kirkwood-dreamplug.dts | 127 
 arch/arm/dts/kirkwood-ds109.dts |  40 ++
 arch/arm/dts/kirkwood-is2.dts   |  40 ++
 arch/arm/dts/kirkwood-km_common.dtsi|  47 ++
 arch/arm/dts/kirkwood-km_kirkwood.dts   |  31 +
 arch/arm/dts/kirkwood-lschlv2.dts   |  20 +
 arch/arm/dts/kirkwood-lsxhl.dts |  20 +
 arch/arm/dts/kirkwood-lsxl.dtsi | 237 +++
 arch/arm/dts/kirkwood-net2big.dts   |  63 ++
 arch/arm/dts/kirkwood-netxbig.dtsi  | 232 +++
 arch/arm/dts/kirkwood-ns2-common.dtsi   |  97 +++
 arch/arm/dts/kirkwood-ns2.dts   |  40 ++
 arch/arm/dts/kirkwood-ns2lite.dts   |  35 +
 arch/arm/dts/kirkwood-ns2max.dts|  59 ++
 arch/arm/dts/kirkwood-ns2mini.dts   |  60 ++
 arch/arm/dts/kirkwood-synology.dtsi | 855 
 configs/d2net_v2_defconfig  |   3 +-
 configs/dreamplug_defconfig |   3 +-
 configs/ds109_defconfig |   2 +
 configs/inetspace_v2_defconfig  |   3 +-
 configs/km_kirkwood_128m16_defconfig|   3 +-
 configs/km_kirkwood_defconfig   |   3 +-
 configs/km_kirkwood_pci_defconfig   |   3 +-
 configs/kmcoge5un_defconfig |   3 +-
 configs/kmnusa_defconfig|   3 +-
 configs/kmsugp1_defconfig   |   3 +-
 configs/kmsuv31_defconfig   |   3 +-
 configs/lschlv2_defconfig   |   3 +-
 configs/lsxhl_defconfig |   3 +-
 configs/mgcoge3un_defconfig |   3 +-
 configs/net2big_v2_defconfig|   3 +-
 configs/netspace_lite_v2_defconfig  |   3 +-
 configs/netspace_max_v2_defconfig   |   3 +-
 configs/netspace_mini_v2_defconfig  |   3 +-
 configs/netspace_v2_defconfig   |   3 +-
 include/dt-bindings/leds/leds-netxbig.h |  18 +
 include/dt-bindings/leds/leds-ns2.h |   9 +
 38 files changed, 2113 insertions(+), 18 deletions(-)
 create mode 100644 arch/arm/dts/kirkwood-d2net.dts
 create mode 100644 arch/arm/dts/kirkwood-dreamplug.dts
 create mode 100644 arch/arm/dts/kirkwood-ds109.dts
 create mode 100644 arch/arm/dts/kirkwood-is2.dts
 create mode 100644 arch/arm/dts/kirkwood-km_common.dtsi
 create mode 100644 arch/arm/dts/kirkwood-km_kirkwood.dts
 create mode 100644 arch/arm/dts/kirkwood-lschlv2.dts
 create mode 100644 arch/arm/dts/kirkwood-lsxhl.dts
 create mode 100644 arch/arm/dts/kirkwood-lsxl.dtsi
 create mode 100644 arch/arm/dts/kirkwood-net2big.dts
 create mode 100644 arch/arm/dts/kirkwood-netxbig.dtsi
 create mode 100644 arch/arm/dts/kirkwood-ns2-common.dtsi
 create mode 100644 arch/arm/dts/kirkwood-ns2.dts
 create mode 100644 arch/arm/dts/kirkwood-ns2lite.dts
 create mode 100644 arch/arm/dts/kirkwood-ns2max.dts
 create mode 100644 arch/arm/dts/kirkwood-ns2mini.dts
 create mode 100644 arch/arm/dts/kirkwood-synology.dtsi
 create mode 100644 include/dt-bindings/leds/leds-netxbig.h
 create mode 100644 include/dt-bindings/leds/leds-ns2.h

-- 
2.17.0

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


[U-Boot] [PATCH 2/6] ARM: kirkwood: Add device-tree for dreamplug

2018-05-17 Thread Chris Packham
Import the dts file from Linux 4.17 and enable CONFIG_OF_CONTROL.

Signed-off-by: Chris Packham 
---

 arch/arm/dts/kirkwood-dreamplug.dts | 127 
 configs/dreamplug_defconfig |   3 +-
 2 files changed, 129 insertions(+), 1 deletion(-)
 create mode 100644 arch/arm/dts/kirkwood-dreamplug.dts

diff --git a/arch/arm/dts/kirkwood-dreamplug.dts 
b/arch/arm/dts/kirkwood-dreamplug.dts
new file mode 100644
index ..a647a65c20a0
--- /dev/null
+++ b/arch/arm/dts/kirkwood-dreamplug.dts
@@ -0,0 +1,127 @@
+// SPDX-License-Identifier: GPL-2.0
+/dts-v1/;
+
+#include "kirkwood.dtsi"
+#include "kirkwood-6281.dtsi"
+
+/ {
+   model = "Globalscale Technologies Dreamplug";
+   compatible = "globalscale,dreamplug-003-ds2001", 
"globalscale,dreamplug", "marvell,kirkwood-88f6281", "marvell,kirkwood";
+
+   memory {
+   device_type = "memory";
+   reg = <0x 0x2000>;
+   };
+
+   chosen {
+   bootargs = "console=ttyS0,115200n8 earlyprintk";
+   stdout-path = &uart0;
+   };
+
+   ocp@f100 {
+   pinctrl: pin-controller@1 {
+   pmx_led_bluetooth: pmx-led-bluetooth {
+   marvell,pins = "mpp47";
+   marvell,function = "gpio";
+   };
+   pmx_led_wifi: pmx-led-wifi {
+   marvell,pins = "mpp48";
+   marvell,function = "gpio";
+   };
+   pmx_led_wifi_ap: pmx-led-wifi-ap {
+   marvell,pins = "mpp49";
+   marvell,function = "gpio";
+   };
+   };
+   serial@12000 {
+   status = "ok";
+   };
+
+   spi@10600 {
+   status = "okay";
+
+   m25p40@0 {
+   #address-cells = <1>;
+   #size-cells = <1>;
+   compatible = "mxicy,mx25l1606e", 
"jedec,spi-nor", "spi-flash";
+   reg = <0>;
+   spi-max-frequency = <5000>;
+   mode = <0>;
+
+   partition@0 {
+   reg = <0x0 0x8>;
+   label = "u-boot";
+   };
+
+   partition@10 {
+   reg = <0x10 0x1>;
+   label = "u-boot env";
+   };
+
+   partition@18 {
+   reg = <0x18 0x1>;
+   label = "dtb";
+   };
+   };
+   };
+
+   sata@8 {
+   status = "okay";
+   nr-ports = <1>;
+   };
+
+   mvsdio@9 {
+   pinctrl-0 = <&pmx_sdio>;
+   pinctrl-names = "default";
+   status = "okay";
+   /* No CD or WP GPIOs */
+   broken-cd;
+   };
+   };
+
+   gpio-leds {
+   compatible = "gpio-leds";
+   pinctrl-0 = <&pmx_led_bluetooth &pmx_led_wifi
+&pmx_led_wifi_ap >;
+   pinctrl-names = "default";
+
+   bluetooth {
+   label = "dreamplug:blue:bluetooth";
+   gpios = <&gpio1 15 GPIO_ACTIVE_LOW>;
+   };
+   wifi {
+   label = "dreamplug:green:wifi";
+   gpios = <&gpio1 16 GPIO_ACTIVE_LOW>;
+   };
+   wifi-ap {
+   label = "dreamplug:green:wifi_ap";
+   gpios = <&gpio1 17 GPIO_ACTIVE_LOW>;
+   };
+   };
+};
+
+&mdio {
+   status = "okay";
+
+   ethphy0: ethernet-phy@0 {
+   reg = <0>;
+   };
+
+   ethphy1: ethernet-phy@1 {
+   reg = <1>;
+   };
+};
+
+ð0 {
+   status = "okay";
+   ethernet0-port@0 {
+   phy-handle = <ðphy0>;
+   };
+};
+
+ð1 {
+   status = "okay";
+   ethernet1-port@0 {
+   phy-handle = <ðphy1>;
+   };
+};
diff --git a/configs/dreamplug_defconfig b/configs/dreamplug_defconfig
index cbd2fb68ad92..8090c9a37793 100644
--- a/configs/dreamplug_defconfig
+++ b/configs/dreamplug_defconfig
@@ -3,6 +3,7 @@ CONFIG_KIRKWOOD=y
 CONFIG_SYS_TEXT_BASE=0x60
 CONFIG_TARGET_DREAMPLUG=y
 CONFIG_IDENT_STRING="\nMarvell-DreamPlug"
+CONFIG_DEFAULT_DEVICE_TREE="kirkwood-dreamplug"
 CONFIG_BOOTDELAY=3
 # CONFIG_DISPLAY_BOARDINFO is not set
 CONFIG_HU

[U-Boot] [PATCH 1/6] ARM: kirkwood: Add device-tree for d2net_v2 & net2big_v2

2018-05-17 Thread Chris Packham
Import the dts files from Linux 4.17 and enable CONFIG_OF_CONTROL.

Signed-off-by: Chris Packham 
---

 arch/arm/dts/kirkwood-d2net.dts |  45 +
 arch/arm/dts/kirkwood-net2big.dts   |  63 +++
 arch/arm/dts/kirkwood-netxbig.dtsi  | 232 
 configs/d2net_v2_defconfig  |   3 +-
 configs/net2big_v2_defconfig|   3 +-
 include/dt-bindings/leds/leds-netxbig.h |  18 ++
 6 files changed, 362 insertions(+), 2 deletions(-)
 create mode 100644 arch/arm/dts/kirkwood-d2net.dts
 create mode 100644 arch/arm/dts/kirkwood-net2big.dts
 create mode 100644 arch/arm/dts/kirkwood-netxbig.dtsi
 create mode 100644 include/dt-bindings/leds/leds-netxbig.h

diff --git a/arch/arm/dts/kirkwood-d2net.dts b/arch/arm/dts/kirkwood-d2net.dts
new file mode 100644
index ..bd3b266dd766
--- /dev/null
+++ b/arch/arm/dts/kirkwood-d2net.dts
@@ -0,0 +1,45 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Device Tree file for d2 Network v2
+ *
+ * Copyright (C) 2014 Simon Guinot 
+ *
+*/
+
+/dts-v1/;
+
+#include 
+#include "kirkwood-netxbig.dtsi"
+
+/ {
+   model = "LaCie d2 Network v2";
+   compatible = "lacie,d2net_v2", "lacie,netxbig", 
"marvell,kirkwood-88f6281", "marvell,kirkwood";
+
+   memory {
+   device_type = "memory";
+   reg = <0x 0x1000>;
+   };
+
+   ns2-leds {
+   compatible = "lacie,ns2-leds";
+
+   blue-sata {
+   label = "d2net_v2:blue:sata";
+   slow-gpio = <&gpio0 29 GPIO_ACTIVE_HIGH>;
+   cmd-gpio = <&gpio0 30 GPIO_ACTIVE_HIGH>;
+   modes-map = ;
+   };
+   };
+
+   gpio-leds {
+   compatible = "gpio-leds";
+
+   red-fail {
+   label = "d2net_v2:red:fail";
+   gpios = <&gpio0 12 GPIO_ACTIVE_HIGH>;
+   };
+   };
+};
diff --git a/arch/arm/dts/kirkwood-net2big.dts 
b/arch/arm/dts/kirkwood-net2big.dts
new file mode 100644
index ..3e3ac289e5b0
--- /dev/null
+++ b/arch/arm/dts/kirkwood-net2big.dts
@@ -0,0 +1,63 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Device Tree file for LaCie 2Big Network v2
+ *
+ * Copyright (C) 2014
+ *
+ * Andrew Lunn 
+ *
+ * Based on netxbig_v2-setup.c,
+ * Copyright (C) 2010 Simon Guinot 
+ *
+*/
+
+/dts-v1/;
+
+#include "kirkwood.dtsi"
+#include "kirkwood-6281.dtsi"
+#include "kirkwood-netxbig.dtsi"
+
+/ {
+   model = "LaCie 2Big Network v2";
+   compatible = "lacie,net2big_v2", "lacie,netxbig", 
"marvell,kirkwood-88f6281", "marvell,kirkwood";
+
+   memory {
+   device_type = "memory";
+   reg = <0x 0x1000>;
+   };
+
+   fan {
+   compatible = "gpio-fan";
+   alarm-gpios = <&gpio0 25 GPIO_ACTIVE_LOW>;
+   };
+};
+
+®ulators {
+   regulator@2 {
+   compatible = "regulator-fixed";
+   reg = <2>;
+   regulator-name = "hdd1power";
+   regulator-min-microvolt = <500>;
+   regulator-max-microvolt = <500>;
+   enable-active-high;
+   regulator-always-on;
+   regulator-boot-on;
+   gpio = <&gpio0 17 GPIO_ACTIVE_HIGH>;
+   };
+
+   clocks {
+  g762_clk: g762-oscillator {
+compatible = "fixed-clock";
+#clock-cells = <0>;
+clock-frequency = <32768>;
+  };
+   };
+};
+
+&i2c0 {
+   g762@3e {
+   compatible = "gmt,g762";
+   reg = <0x3e>;
+   clocks = <&g762_clk>;
+   };
+};
diff --git a/arch/arm/dts/kirkwood-netxbig.dtsi 
b/arch/arm/dts/kirkwood-netxbig.dtsi
new file mode 100644
index ..135ac8021c8c
--- /dev/null
+++ b/arch/arm/dts/kirkwood-netxbig.dtsi
@@ -0,0 +1,232 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Device Tree common file for LaCie 2Big and 5Big Network v2
+ *
+ * Copyright (C) 2014
+ *
+ * Andrew Lunn 
+ *
+ * Based on netxbig_v2-setup.c,
+ * Copyright (C) 2010 Simon Guinot 
+ *
+*/
+
+#include 
+#include "kirkwood.dtsi"
+#include "kirkwood-6281.dtsi"
+
+/ {
+   chosen {
+   bootargs = "console=ttyS0,115200n8";
+   stdout-path = &uart0;
+   };
+
+   ocp@f100 {
+   serial@12000 {
+   status = "okay";
+   };
+
+   spi@10600 {
+   status = "okay";
+
+   flash@0 {
+   #address-cells = <1>;
+   #size-cells = <1>;
+   compatible = "mxicy,mx25l4005a", 
"jedec,spi-nor", "spi-flash";
+   reg = <0>;
+   spi-max-frequency = <2000>;
+   mode = <0>;
+
+   partition@0 {
+

[U-Boot] [PATCH 3/6] ARM: kirkwood: Add device-tree for ds109

2018-05-17 Thread Chris Packham
Import the dts files from Linux 4.17 and enable CONFIG_OF_CONTROL.

Signed-off-by: Chris Packham 
---

 arch/arm/dts/kirkwood-ds109.dts |  40 ++
 arch/arm/dts/kirkwood-synology.dtsi | 855 
 configs/ds109_defconfig |   2 +
 3 files changed, 897 insertions(+)
 create mode 100644 arch/arm/dts/kirkwood-ds109.dts
 create mode 100644 arch/arm/dts/kirkwood-synology.dtsi

diff --git a/arch/arm/dts/kirkwood-ds109.dts b/arch/arm/dts/kirkwood-ds109.dts
new file mode 100644
index ..29982e7acb7f
--- /dev/null
+++ b/arch/arm/dts/kirkwood-ds109.dts
@@ -0,0 +1,40 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Andrew Lunn 
+ * Ben Peddell 
+ *
+ */
+
+/dts-v1/;
+
+#include "kirkwood.dtsi"
+#include "kirkwood-6281.dtsi"
+#include "kirkwood-synology.dtsi"
+
+/ {
+   model = "Synology DS109, DS110, DS110jv20";
+   compatible = "synology,ds109", "synology,ds110jv20",
+"synology,ds110", "marvell,kirkwood";
+
+   memory {
+   device_type = "memory";
+   reg = <0x 0x800>;
+   };
+
+   chosen {
+   bootargs = "console=ttyS0,115200n8";
+   stdout-path = &uart0;
+   };
+
+   gpio-fan-150-32-35 {
+   status = "okay";
+   };
+
+   gpio-leds-hdd-21-1 {
+   status = "okay";
+   };
+};
+
+&rs5c372 {
+   status = "okay";
+};
diff --git a/arch/arm/dts/kirkwood-synology.dtsi 
b/arch/arm/dts/kirkwood-synology.dtsi
new file mode 100644
index ..b80d8ee37093
--- /dev/null
+++ b/arch/arm/dts/kirkwood-synology.dtsi
@@ -0,0 +1,855 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Nodes for Marvell 628x Synology devices
+ *
+ * Andrew Lunn 
+ * Ben Peddell 
+ *
+ */
+
+/ {
+   ocp@f100 {
+   pinctrl: pin-controller@1 {
+   pmx_alarmled_12: pmx-alarmled-12 {
+   marvell,pins = "mpp12";
+   marvell,function = "gpio";
+   };
+
+   pmx_fanctrl_15: pmx-fanctrl-15 {
+   marvell,pins = "mpp15";
+   marvell,function = "gpio";
+   };
+
+   pmx_fanctrl_16: pmx-fanctrl-16 {
+   marvell,pins = "mpp16";
+   marvell,function = "gpio";
+   };
+
+   pmx_fanctrl_17: pmx-fanctrl-17 {
+   marvell,pins = "mpp17";
+   marvell,function = "gpio";
+   };
+
+   pmx_fanalarm_18: pmx-fanalarm-18 {
+   marvell,pins = "mpp18";
+   marvell,function = "gpo";
+   };
+
+   pmx_hddled_20: pmx-hddled-20 {
+   marvell,pins = "mpp20";
+   marvell,function = "gpio";
+   };
+
+   pmx_hddled_21: pmx-hddled-21 {
+   marvell,pins = "mpp21";
+   marvell,function = "gpio";
+   };
+
+   pmx_hddled_22: pmx-hddled-22 {
+   marvell,pins = "mpp22";
+   marvell,function = "gpio";
+   };
+
+   pmx_hddled_23: pmx-hddled-23 {
+   marvell,pins = "mpp23";
+   marvell,function = "gpio";
+   };
+
+   pmx_hddled_24: pmx-hddled-24 {
+   marvell,pins = "mpp24";
+   marvell,function = "gpio";
+   };
+
+   pmx_hddled_25: pmx-hddled-25 {
+   marvell,pins = "mpp25";
+   marvell,function = "gpio";
+   };
+
+   pmx_hddled_26: pmx-hddled-26 {
+   marvell,pins = "mpp26";
+   marvell,function = "gpio";
+   };
+
+   pmx_hddled_27: pmx-hddled-27 {
+   marvell,pins = "mpp27";
+   marvell,function = "gpio";
+   };
+
+   pmx_hddled_28: pmx-hddled-28 {
+   marvell,pins = "mpp28";
+   marvell,function = "gpio";
+   };
+
+   pmx_hdd1_pwr_29: pmx-hdd1-pwr-29 {
+   marvell,pins = "mpp29";
+   marvell,function = "gpio";
+   };
+
+   pmx_hdd1_pwr_30: pmx-hdd-pwr-30 {
+   marvell,pins = "mpp30";
+   marvell,

[U-Boot] [PATCH 5/6] ARM: kirkwood: Add device-tree for netspace & inetspace

2018-05-17 Thread Chris Packham
Import the dts files from Linux 4.17 and enable CONFIG_OF_CONTROL.

Signed-off-by: Chris Packham 
---

 arch/arm/dts/kirkwood-is2.dts | 40 +++
 arch/arm/dts/kirkwood-ns2-common.dtsi | 97 +++
 arch/arm/dts/kirkwood-ns2.dts | 40 +++
 arch/arm/dts/kirkwood-ns2lite.dts | 35 ++
 arch/arm/dts/kirkwood-ns2max.dts  | 59 
 arch/arm/dts/kirkwood-ns2mini.dts | 60 +
 configs/inetspace_v2_defconfig|  3 +-
 configs/netspace_lite_v2_defconfig|  3 +-
 configs/netspace_max_v2_defconfig |  3 +-
 configs/netspace_mini_v2_defconfig|  3 +-
 configs/netspace_v2_defconfig |  3 +-
 include/dt-bindings/leds/leds-ns2.h   |  9 +++
 12 files changed, 350 insertions(+), 5 deletions(-)
 create mode 100644 arch/arm/dts/kirkwood-is2.dts
 create mode 100644 arch/arm/dts/kirkwood-ns2-common.dtsi
 create mode 100644 arch/arm/dts/kirkwood-ns2.dts
 create mode 100644 arch/arm/dts/kirkwood-ns2lite.dts
 create mode 100644 arch/arm/dts/kirkwood-ns2max.dts
 create mode 100644 arch/arm/dts/kirkwood-ns2mini.dts
 create mode 100644 include/dt-bindings/leds/leds-ns2.h

diff --git a/arch/arm/dts/kirkwood-is2.dts b/arch/arm/dts/kirkwood-is2.dts
new file mode 100644
index ..1bc16a5cdbaa
--- /dev/null
+++ b/arch/arm/dts/kirkwood-is2.dts
@@ -0,0 +1,40 @@
+// SPDX-License-Identifier: GPL-2.0
+/dts-v1/;
+
+#include 
+#include "kirkwood-ns2-common.dtsi"
+
+/ {
+   model = "LaCie Internet Space v2";
+   compatible = "lacie,inetspace_v2", "marvell,kirkwood-88f6281", 
"marvell,kirkwood";
+
+   memory {
+   device_type = "memory";
+   reg = <0x 0x800>;
+   };
+
+   ocp@f100 {
+   sata@8 {
+   pinctrl-0 = <&pmx_ns2_sata0>;
+   pinctrl-names = "default";
+   status = "okay";
+   nr-ports = <1>;
+   };
+   };
+
+   ns2-leds {
+   compatible = "lacie,ns2-leds";
+
+   blue-sata {
+   label = "ns2:blue:sata";
+   slow-gpio = <&gpio0 29 0>;
+   cmd-gpio = <&gpio0 30 0>;
+   modes-map = ;
+   };
+   };
+};
+
+ðphy0 { reg = <8>; };
diff --git a/arch/arm/dts/kirkwood-ns2-common.dtsi 
b/arch/arm/dts/kirkwood-ns2-common.dtsi
new file mode 100644
index ..f997bb4df202
--- /dev/null
+++ b/arch/arm/dts/kirkwood-ns2-common.dtsi
@@ -0,0 +1,97 @@
+// SPDX-License-Identifier: GPL-2.0
+#include "kirkwood.dtsi"
+#include "kirkwood-6281.dtsi"
+
+/ {
+   chosen {
+   bootargs = "console=ttyS0,115200n8";
+   stdout-path = &uart0;
+   };
+
+   ocp@f100 {
+   pinctrl: pin-controller@1 {
+   pmx_ns2_sata0: pmx-ns2-sata0 {
+   marvell,pins = "mpp21";
+   marvell,function = "sata0";
+   };
+   pmx_ns2_sata1: pmx-ns2-sata1 {
+   marvell,pins = "mpp20";
+   marvell,function = "sata1";
+   };
+   };
+
+   serial@12000 {
+   status = "okay";
+   };
+
+   spi@10600 {
+   status = "okay";
+
+   flash@0 {
+   #address-cells = <1>;
+   #size-cells = <1>;
+   compatible = "mxicy,mx25l4005a", 
"jedec,spi-nor", "spi-flash";
+   reg = <0>;
+   spi-max-frequency = <2000>;
+   mode = <0>;
+
+   partition@0 {
+   reg = <0x0 0x8>;
+   label = "u-boot";
+   };
+   };
+   };
+
+   i2c@11000 {
+   status = "okay";
+
+   eeprom@50 {
+   compatible = "atmel,24c04";
+   pagesize = <16>;
+   reg = <0x50>;
+   };
+   };
+   };
+
+   gpio_keys {
+   compatible = "gpio-keys";
+   #address-cells = <1>;
+   #size-cells = <0>;
+
+   power {
+   label = "Power push button";
+   linux,code = ;
+   gpios = <&gpio1 0 GPIO_ACTIVE_HIGH>;
+   };
+   };
+
+   gpio-leds {
+   compatible = "gpio-leds";
+
+   red-fail {
+   label = "ns2:red:fail";
+   gpios = <&gpio0 12 GPIO_ACTIVE_HIGH>;
+   };
+   };
+
+   gpio_poweroff {

[U-Boot] [PATCH 4/6] ARM: kirkwood: Add device-tree for lschlv2 & lsxhl

2018-05-17 Thread Chris Packham
Import the dts files from Linux 4.17 and enable CONFIG_OF_CONTROL.

Signed-off-by: Chris Packham 
---

 arch/arm/dts/kirkwood-lschlv2.dts |  20 +++
 arch/arm/dts/kirkwood-lsxhl.dts   |  20 +++
 arch/arm/dts/kirkwood-lsxl.dtsi   | 237 ++
 configs/lschlv2_defconfig |   3 +-
 configs/lsxhl_defconfig   |   3 +-
 5 files changed, 281 insertions(+), 2 deletions(-)
 create mode 100644 arch/arm/dts/kirkwood-lschlv2.dts
 create mode 100644 arch/arm/dts/kirkwood-lsxhl.dts
 create mode 100644 arch/arm/dts/kirkwood-lsxl.dtsi

diff --git a/arch/arm/dts/kirkwood-lschlv2.dts 
b/arch/arm/dts/kirkwood-lschlv2.dts
new file mode 100644
index ..1d737d903f5f
--- /dev/null
+++ b/arch/arm/dts/kirkwood-lschlv2.dts
@@ -0,0 +1,20 @@
+// SPDX-License-Identifier: GPL-2.0
+/dts-v1/;
+
+#include "kirkwood-lsxl.dtsi"
+
+/ {
+   model = "Buffalo Linkstation LS-CHLv2";
+   compatible = "buffalo,lschlv2", "buffalo,lsxl", 
"marvell,kirkwood-88f6281", "marvell,kirkwood";
+
+   memory {
+   device_type = "memory";
+   reg = <0x 0x400>;
+   };
+
+   ocp@f100 {
+   serial@12000 {
+   status = "okay";
+   };
+   };
+};
diff --git a/arch/arm/dts/kirkwood-lsxhl.dts b/arch/arm/dts/kirkwood-lsxhl.dts
new file mode 100644
index ..a56e0d797778
--- /dev/null
+++ b/arch/arm/dts/kirkwood-lsxhl.dts
@@ -0,0 +1,20 @@
+// SPDX-License-Identifier: GPL-2.0
+/dts-v1/;
+
+#include "kirkwood-lsxl.dtsi"
+
+/ {
+   model = "Buffalo Linkstation LS-XHL";
+   compatible = "buffalo,lsxhl", "buffalo,lsxl", 
"marvell,kirkwood-88f6281", "marvell,kirkwood";
+
+   memory {
+   device_type = "memory";
+   reg = <0x 0x1000>;
+   };
+
+   ocp@f100 {
+   serial@12000 {
+   status = "okay";
+   };
+   };
+};
diff --git a/arch/arm/dts/kirkwood-lsxl.dtsi b/arch/arm/dts/kirkwood-lsxl.dtsi
new file mode 100644
index ..92b11c75b8fb
--- /dev/null
+++ b/arch/arm/dts/kirkwood-lsxl.dtsi
@@ -0,0 +1,237 @@
+// SPDX-License-Identifier: GPL-2.0
+#include "kirkwood.dtsi"
+#include "kirkwood-6281.dtsi"
+
+/ {
+   chosen {
+   bootargs = "console=ttyS0,115200n8 earlyprintk";
+   stdout-path = &uart0;
+   };
+
+   ocp@f100 {
+   pinctrl: pin-controller@1 {
+   pmx_power_hdd: pmx-power-hdd {
+   marvell,pins = "mpp10";
+   marvell,function = "gpo";
+   };
+   pmx_usb_vbus: pmx-usb-vbus {
+   marvell,pins = "mpp11";
+   marvell,function = "gpio";
+   };
+   pmx_fan_high: pmx-fan-high {
+   marvell,pins = "mpp18";
+   marvell,function = "gpo";
+   };
+   pmx_fan_low: pmx-fan-low {
+   marvell,pins = "mpp19";
+   marvell,function = "gpo";
+   };
+   pmx_led_function_blue: pmx-led-function-blue {
+   marvell,pins = "mpp36";
+   marvell,function = "gpio";
+   };
+   pmx_led_alarm: pmx-led-alarm {
+   marvell,pins = "mpp37";
+   marvell,function = "gpio";
+   };
+   pmx_led_info: pmx-led-info {
+   marvell,pins = "mpp38";
+   marvell,function = "gpio";
+   };
+   pmx_led_power: pmx-led-power {
+   marvell,pins = "mpp39";
+   marvell,function = "gpio";
+   };
+   pmx_fan_lock: pmx-fan-lock {
+   marvell,pins = "mpp40";
+   marvell,function = "gpio";
+   };
+   pmx_button_function: pmx-button-function {
+   marvell,pins = "mpp41";
+   marvell,function = "gpio";
+   };
+   pmx_power_switch: pmx-power-switch {
+   marvell,pins = "mpp42";
+   marvell,function = "gpio";
+   };
+   pmx_power_auto_switch: pmx-power-auto-switch {
+   marvell,pins = "mpp43";
+   marvell,function = "gpio";
+   };
+   pmx_led_function_red: pmx-led-function_red {
+   marvell,pins = "mpp48";
+  

[U-Boot] [PATCH 6/6] ARM: kirkwood: Add device-tree for keymile

2018-05-17 Thread Chris Packham
Import the dts files from Linux 4.17 and enable CONFIG_OF_CONTROL.

Signed-off-by: Chris Packham 
---

 arch/arm/dts/kirkwood-km_common.dtsi  | 47 +++
 arch/arm/dts/kirkwood-km_kirkwood.dts | 31 ++
 configs/km_kirkwood_128m16_defconfig  |  3 +-
 configs/km_kirkwood_defconfig |  3 +-
 configs/km_kirkwood_pci_defconfig |  3 +-
 configs/kmcoge5un_defconfig   |  3 +-
 configs/kmnusa_defconfig  |  3 +-
 configs/kmsugp1_defconfig |  3 +-
 configs/kmsuv31_defconfig |  3 +-
 configs/mgcoge3un_defconfig   |  3 +-
 10 files changed, 94 insertions(+), 8 deletions(-)
 create mode 100644 arch/arm/dts/kirkwood-km_common.dtsi
 create mode 100644 arch/arm/dts/kirkwood-km_kirkwood.dts

diff --git a/arch/arm/dts/kirkwood-km_common.dtsi 
b/arch/arm/dts/kirkwood-km_common.dtsi
new file mode 100644
index ..75dc83914f56
--- /dev/null
+++ b/arch/arm/dts/kirkwood-km_common.dtsi
@@ -0,0 +1,47 @@
+// SPDX-License-Identifier: GPL-2.0
+/ {
+   chosen {
+   bootargs = "console=ttyS0,115200n8 earlyprintk";
+   stdout-path = &uart0;
+   };
+
+   ocp@f100 {
+   pinctrl: pin-controller@1 {
+   pinctrl-0 = < &pmx_i2c_gpio_sda &pmx_i2c_gpio_scl >;
+   pinctrl-names = "default";
+
+   pmx_i2c_gpio_sda: pmx-gpio-sda {
+   marvell,pins = "mpp8";
+   marvell,function = "gpio";
+   };
+   pmx_i2c_gpio_scl: pmx-gpio-scl {
+   marvell,pins = "mpp9";
+   marvell,function = "gpio";
+   };
+   };
+
+   serial@12000 {
+   status = "okay";
+   };
+   };
+
+   i2c {
+   compatible = "i2c-gpio";
+   gpios = < &gpio0 8 GPIO_ACTIVE_HIGH /* sda */
+ &gpio0 9 GPIO_ACTIVE_HIGH>;   /* scl */
+   i2c-gpio,delay-us = <2>;/* ~100 kHz */
+   };
+};
+
+&nand {
+   status = "okay";
+   chip-delay = <25>;
+};
+
+&pciec {
+status = "okay";
+};
+
+&pcie0 {
+   status = "okay";
+};
diff --git a/arch/arm/dts/kirkwood-km_kirkwood.dts 
b/arch/arm/dts/kirkwood-km_kirkwood.dts
new file mode 100644
index ..f035eff1c111
--- /dev/null
+++ b/arch/arm/dts/kirkwood-km_kirkwood.dts
@@ -0,0 +1,31 @@
+// SPDX-License-Identifier: GPL-2.0
+/dts-v1/;
+
+#include "kirkwood.dtsi"
+#include "kirkwood-98dx4122.dtsi"
+#include "kirkwood-km_common.dtsi"
+
+/ {
+   model = "Keymile Kirkwood Reference Design";
+   compatible = "keymile,km_kirkwood", "marvell,kirkwood-98DX4122", 
"marvell,kirkwood";
+
+   memory {
+   device_type = "memory";
+   reg = <0x 0x0800>;
+   };
+};
+
+&mdio {
+   status = "okay";
+
+   ethphy0: ethernet-phy@0 {
+   reg = <0>;
+   };
+};
+
+ð0 {
+   status = "okay";
+   ethernet0-port@0 {
+   phy-handle = <ðphy0>;
+   };
+};
diff --git a/configs/km_kirkwood_128m16_defconfig 
b/configs/km_kirkwood_128m16_defconfig
index 5d5b485cf716..e41ec8990d98 100644
--- a/configs/km_kirkwood_128m16_defconfig
+++ b/configs/km_kirkwood_128m16_defconfig
@@ -3,6 +3,7 @@ CONFIG_KIRKWOOD=y
 CONFIG_SYS_TEXT_BASE=0x07d0
 CONFIG_TARGET_KM_KIRKWOOD=y
 CONFIG_IDENT_STRING="\nKeymile Kirkwood 128M16"
+CONFIG_DEFAULT_DEVICE_TREE="kirkwood-km_kirkwood"
 CONFIG_SYS_EXTRA_OPTIONS="KM_KIRKWOOD_128M16"
 CONFIG_VERSION_VARIABLE=y
 # CONFIG_DISPLAY_BOARDINFO is not set
@@ -25,6 +26,7 @@ CONFIG_MTDIDS_DEFAULT="nand0=orion_nand"
 CONFIG_MTDPARTS_DEFAULT="mtdparts=orion_nand:-(ubi0);"
 CONFIG_CMD_UBI=y
 # CONFIG_CMD_UBIFS is not set
+CONFIG_OF_CONTROL=y
 CONFIG_ENV_IS_IN_EEPROM=y
 CONFIG_BOOTCOUNT_LIMIT=y
 CONFIG_BOOTCOUNT_RAM=y
@@ -37,4 +39,3 @@ CONFIG_SYS_NS16550=y
 CONFIG_SPI=y
 CONFIG_KIRKWOOD_SPI=y
 CONFIG_BCH=y
-CONFIG_OF_LIBFDT=y
diff --git a/configs/km_kirkwood_defconfig b/configs/km_kirkwood_defconfig
index b07f36beaf47..fcab051ad63a 100644
--- a/configs/km_kirkwood_defconfig
+++ b/configs/km_kirkwood_defconfig
@@ -3,6 +3,7 @@ CONFIG_KIRKWOOD=y
 CONFIG_SYS_TEXT_BASE=0x07d0
 CONFIG_TARGET_KM_KIRKWOOD=y
 CONFIG_IDENT_STRING="\nKeymile Kirkwood"
+CONFIG_DEFAULT_DEVICE_TREE="kirkwood-km_kirkwood"
 CONFIG_SYS_EXTRA_OPTIONS="KM_KIRKWOOD"
 CONFIG_VERSION_VARIABLE=y
 # CONFIG_DISPLAY_BOARDINFO is not set
@@ -25,6 +26,7 @@ CONFIG_MTDIDS_DEFAULT="nand0=orion_nand"
 CONFIG_MTDPARTS_DEFAULT="mtdparts=orion_nand:-(ubi0);"
 CONFIG_CMD_UBI=y
 # CONFIG_CMD_UBIFS is not set
+CONFIG_OF_CONTROL=y
 CONFIG_ENV_IS_IN_EEPROM=y
 CONFIG_BOOTCOUNT_LIMIT=y
 CONFIG_BOOTCOUNT_RAM=y
@@ -37,4 +39,3 @@ CONFIG_SYS_NS16550=y
 CONFIG_SPI=y
 CONFIG_KIRKWOOD_SPI=y
 CONFIG_BCH=y
-CONFIG_OF_LIBFDT=y
diff --git a/configs/km_kirkwood_pci_defconfig 
b/

Re: [U-Boot] [PATCH V6 0/2] Update sabrelite and nitrogen6x boards to use distro boot support

2018-05-17 Thread Stefano Babic
Hi Guillaume,

On 18/04/2018 17:04, Guillaume GARDET wrote:
> This patch serie updates sabrelite and nitrogen6x boards to use distro boot 
> support.
> Sabrelite has been boot tested with boot.scr script and EFI/Grub2 on mmc0 and 
> mmc1 slots.
> Nitrogen6* boards have been build tested only.
> 
> Currently, only the Sabrelite has fdtfile defined.
> 

Fine, but Troy is the maintainer for this board and I have not yet seen
if he agrees to switch the board to the distro environment. I would like
to have his ACK before pushing this.

Best regards,
Stefano Babic

> Signed-off-by: Guillaume GARDET 
> Cc: Troy Kisky 
> Cc: Stefano Babic 
> Cc: Fabio Estevam 
> Cc: Gary Bisson 
> 
> Changes in V6:
>   * added CONFIG_CMD_GPT to sabrelite defconfig
>   * remove CONFIG_ARCH_MISC_INIT to sabrelite defconfig
> 
> Changes in V5:
>   * remove obsolete code from include/configs/nitrogen6x.h
>   
> Changes in V4:
>   * Remove imx6 soc definition
>   * Change comment on not defined fdtfile (no more fallback)
> 
> Changes in V3:
>   * Add imx6 soc definition
>   * Also update nitrogen6x config, not only sabrelite
>   * Split mx6qsabrelite_defconfig update to a separate patch
> Changes in V2:
>   * add mx6qsabrelite_defconfig update
> 
> 
> Guillaume GARDET (2):
>   imx6: Convert sabrelite and nitrogen6x boards to distro boot support
>   imx6: sabrelite: update defconfig to use distro defaults
> 
>  configs/mx6qsabrelite_defconfig |  15 ++--
>  include/configs/nitrogen6x.h| 179 
> ++--
>  2 files changed, 48 insertions(+), 146 deletions(-)
> 


-- 
=
DENX Software Engineering GmbH,  Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sba...@denx.de
=
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH v3 1/7] i.MX6: board: Add BTicino i.MX6DL Mamoj initial support

2018-05-17 Thread Stefano Babic
Hi Jagan,

On 07/05/2018 07:51, Jagan Teki wrote:
> Add initial support for i.MX6DL BTicino Mamoj board.
> 
> Mamoh board added:
> - SPL
> - SPL_DM
> - SPL_OF_CONTROL
> - DM for U-Boot proper
> - OF_CONTROL for U-Boot proper
> - eMMC
> - FEC
> - Boot from eMMC
> - Boot from USB SDP
> 
> Signed-off-by: Simone CIANNI 
> Signed-off-by: Raffaele RECALCATI 
> Signed-off-by: Jagan Teki 
> ---
>  arch/arm/dts/Makefile |   1 +
>  arch/arm/dts/imx6dl-mamoj-u-boot.dtsi |  15 
>  arch/arm/dts/imx6dl-mamoj.dts |  84 ++
>  arch/arm/mach-imx/mx6/Kconfig |  29 ++
>  board/bticino/mamoj/Kconfig   |  12 +++
>  board/bticino/mamoj/MAINTAINERS   |  10 +++
>  board/bticino/mamoj/Makefile  |   8 ++
>  board/bticino/mamoj/README|  60 +
>  board/bticino/mamoj/mamoj.c   |  27 ++
>  board/bticino/mamoj/spl.c | 161 
> ++
>  configs/imx6dl_mamoj_defconfig|  39 
>  include/configs/imx6dl-mamoj.h|  88 +++
>  12 files changed, 534 insertions(+)
>  create mode 100644 arch/arm/dts/imx6dl-mamoj-u-boot.dtsi
>  create mode 100644 arch/arm/dts/imx6dl-mamoj.dts
>  create mode 100644 board/bticino/mamoj/Kconfig
>  create mode 100644 board/bticino/mamoj/MAINTAINERS
>  create mode 100644 board/bticino/mamoj/Makefile
>  create mode 100644 board/bticino/mamoj/README
>  create mode 100644 board/bticino/mamoj/mamoj.c
>  create mode 100644 board/bticino/mamoj/spl.c
>  create mode 100644 configs/imx6dl_mamoj_defconfig
>  create mode 100644 include/configs/imx6dl-mamoj.h
> 
> diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile
> index 389ca63717..289e11551a 100644
> --- a/arch/arm/dts/Makefile
> +++ b/arch/arm/dts/Makefile
> @@ -399,6 +399,7 @@ dtb-$(CONFIG_MX6QDL) += \
>   imx6dl-icore.dtb \
>   imx6dl-icore-mipi.dtb \
>   imx6dl-icore-rqs.dtb \
> + imx6dl-mamoj.dtb \
>   imx6q-cm-fx6.dtb \
>   imx6q-icore.dtb \
>   imx6q-icore-mipi.dtb \
> diff --git a/arch/arm/dts/imx6dl-mamoj-u-boot.dtsi 
> b/arch/arm/dts/imx6dl-mamoj-u-boot.dtsi
> new file mode 100644
> index 00..d4c3c0bdf0
> --- /dev/null
> +++ b/arch/arm/dts/imx6dl-mamoj-u-boot.dtsi
> @@ -0,0 +1,15 @@
> +/*
> + * Copyright (C) 2018 Jagan Teki 
> + *
> + * SPDX-License-Identifier: GPL-2.0+
> + */
> +
> +#include "imx6qdl-u-boot.dtsi"

Something wrong here - this file is not part of the patchset. Should be
this imx6qdl.dtsi ?


Best regards,
Stefano

> +
> +&usdhc3 {
> + u-boot,dm-spl;
> +};
> +
> +&pinctrl_usdhc3 {
> + u-boot,dm-spl;
> +};
> diff --git a/arch/arm/dts/imx6dl-mamoj.dts b/arch/arm/dts/imx6dl-mamoj.dts
> new file mode 100644
> index 00..068d518de3
> --- /dev/null
> +++ b/arch/arm/dts/imx6dl-mamoj.dts
> @@ -0,0 +1,84 @@
> +// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
> +/*
> + * Copyright (C) 2018 BTicino
> + * Copyright (C) 2018 Amarula Solutions B.V.
> + */
> +
> +/dts-v1/;
> +
> +#include 
> +#include "imx6dl.dtsi"
> +
> +/ {
> + model = "BTicino i.MX6DL Mamoj board";
> + compatible = "bticino,imx6dl-mamoj", "fsl,imx6dl";
> +};
> +
> +&fec {
> + pinctrl-names = "default";
> + pinctrl-0 = <&pinctrl_enet>;
> + phy-mode = "mii";
> + status = "okay";
> +};
> +
> +&uart3 {
> + pinctrl-names = "default";
> + pinctrl-0 = <&pinctrl_uart3>;
> + status = "okay";
> +};
> +
> +&usdhc3 {
> + pinctrl-names = "default";
> + pinctrl-0 = <&pinctrl_usdhc3>;
> + bus-width = <8>;
> + non-removable;
> + keep-power-in-suspend;
> + status = "okay";
> +};
> +
> +&iomuxc {
> + pinctrl_enet: enetgrp {
> + fsl,pins = <
> + MX6QDL_PAD_ENET_MDIO__ENET_MDIO 0x1b0b0
> + MX6QDL_PAD_ENET_MDC__ENET_MDC   0x1b0b0
> + MX6QDL_PAD_ENET_REF_CLK__ENET_TX_CLK0x1b0b1
> + MX6QDL_PAD_ENET_TXD0__ENET_TX_DATA0 0x1b0b0
> + MX6QDL_PAD_ENET_TXD1__ENET_TX_DATA1 0x1b0b0
> + MX6QDL_PAD_KEY_ROW2__ENET_TX_DATA2  0x1b0b0
> + MX6QDL_PAD_KEY_ROW0__ENET_TX_DATA3  0x1b0b0
> + MX6QDL_PAD_ENET_TX_EN__ENET_TX_EN   0x1b0b0
> + MX6QDL_PAD_GPIO_19__ENET_TX_ER  0x1b0b0
> + MX6QDL_PAD_GPIO_18__ENET_RX_CLK 0x1b0b1
> + MX6QDL_PAD_ENET_RXD0__ENET_RX_DATA0 0x1b0b0
> + MX6QDL_PAD_ENET_RXD1__ENET_RX_DATA1 0x1b0b0
> + MX6QDL_PAD_KEY_COL2__ENET_RX_DATA2  0x1b0b0
> + MX6QDL_PAD_KEY_COL0__ENET_RX_DATA3  0x1b0b0
> + MX6QDL_PAD_ENET_CRS_DV__ENET_RX_EN  0x1b0b0
> + MX6QDL_PAD_ENET_RX_ER__ENET_RX_ER   0x1b0b0
> + MX6QDL_PAD_KEY_COL3__ENET_CRS   0x1b0b0
> + MX6QDL_PAD_KEY_ROW1__ENET_COL   

Re: [U-Boot] [PATCH] twister: Let SPL load U-Boot from MMC

2018-05-17 Thread Stefano Babic
Hi Ladislav,

On 14/05/2018 09:17, Ladislav Michl wrote:
> MMC is not initialized in SPL, so it cannot load u-boot.img
> preventing boot from MMC.
> 
> Also driver specific functions are guarded with generic
> configuration options which leads to build failures when device
> driver is not enabled in config. Fix that by using driver
> specific defines.
> 
> Signed-off-by: Ladislav Michl 
> ---
>  Stefano,
> 
>  if want this patch to be splitted, just let me know.
>  I didn't want to make it two fewliners...
> 

Patch is fine IMHO. It will be pushed by Tom's TI tree.

>  board/technexion/twister/twister.c | 17 -
>  1 file changed, 8 insertions(+), 9 deletions(-)
> 
> diff --git a/board/technexion/twister/twister.c 
> b/board/technexion/twister/twister.c
> index 1166886e1d..0590e5f8af 100644
> --- a/board/technexion/twister/twister.c
> +++ b/board/technexion/twister/twister.c
> @@ -18,10 +18,8 @@
>  #include 
>  #include 
>  #include 
> -#ifdef CONFIG_USB_EHCI_HCD
>  #include 
>  #include 
> -#endif
>  #include "twister.h"
>  
>  DECLARE_GLOBAL_DATA_PTR;
> @@ -45,7 +43,7 @@ static const u32 gpmc_XR16L2751[] = {
>   XR16L2751_GPMC_CONFIG6,
>  };
>  
> -#ifdef CONFIG_USB_EHCI_HCD
> +#ifdef CONFIG_USB_EHCI_OMAP
>  static struct omap_usbhs_board_data usbhs_bdata = {
>   .port_mode[0] = OMAP_EHCI_PORT_MODE_PHY,
>   .port_mode[1] = OMAP_EHCI_PORT_MODE_PHY,
> @@ -118,19 +116,20 @@ void set_muxconf_regs(void)
>  
>  int board_eth_init(bd_t *bis)
>  {
> +#ifdef CONFIG_DRIVER_TI_EMAC
>   davinci_emac_initialize();
> -
> +#endif
>   /* init cs for extern lan */
>   enable_gpmc_cs_config(gpmc_smc911, &gpmc_cfg->cs[5],
>   CONFIG_SMC911X_BASE, GPMC_SIZE_16M);
> - if (smc911x_initialize(0, CONFIG_SMC911X_BASE) <= 0)
> - printf("\nError initializing SMC911x controlleri\n");
> -
> +#ifdef CONFIG_SMC911X
> + return smc911x_initialize(0, CONFIG_SMC911X_BASE);
> +#else
>   return 0;
> +#endif
>  }
>  
> -#if defined(CONFIG_MMC_OMAP_HS) && \
> - !defined(CONFIG_SPL_BUILD)
> +#if defined(CONFIG_MMC_OMAP_HS)
>  int board_mmc_init(bd_t *bis)
>  {
>   return omap_mmc_init(0, 0, 0, -1, -1);
> 

Acked-by: Stefano Babic 

Best regards,
Stefano Babic

-- 
=
DENX Software Engineering GmbH,  Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sba...@denx.de
=
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH] net: MVGBE don't automatically select PHYLIB

2018-05-17 Thread Stefan Roese

Hi Joe,

On 17.05.2018 11:03, Chris Packham wrote:

Not all users of MVGBE need PHYLIB and it increases the size of the
openrd images too much.

Fixes: commit ed52ea507f12 ("net: add Kconfig for MVGBE")
Signed-off-by: Chris Packham 
Cc: Tom Rini 
Cc: Stefan Roese 
---

  drivers/net/Kconfig | 1 -
  1 file changed, 1 deletion(-)

diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig
index c962d7a72c0c..f2cc75f494e8 100644
--- a/drivers/net/Kconfig
+++ b/drivers/net/Kconfig
@@ -181,7 +181,6 @@ config FTMAC100
  config MVGBE
bool "Marvell Orion5x/Kirkwood network interface support"
depends on KIRKWOOD || ORION5X
-   select PHYLIB
help
  This driver supports the network interface units in the
  Marvell Orion5x and Kirkwood SoCs



Joe, are you okay with me pulling this patch via the Marvell
repository? As it fixes a size limitation error on some of the
Kirkwood board, where I have some device-tree patches queued.

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


[U-Boot] IMX6 NAND booting failure

2018-05-17 Thread Rasheed, Abdul
Hi,
I am working on VAR-SOM-MX6 SOC. I'm trying to boot a custom SPL from NAND.
After programming NAND with custom SPL, system goes to serial downloader mode. 
I have taken the ROM code buffer log (also attached below). It shows that 
authentication fails. My boot security settings are OPEN, so even though 
authentication fails it should handover the control to SPL, which ROM code 
doesn't and system goes to serial downloader mode. I was able to attach JTAG 
and read the registers of core and it shows that LR is 0x000B. Which is 
exactly what it should be. Because it was expected to jump to entry point.


00902190 = 00010002 000200F0 0003 0004
009021A0 = 00050001 0006 0007 000700F0
009021B0 = 0008 0280 000800F0 0008
009021C0 = 0282 00080033 0009 000A1E33
009021D0 = 00061FFF 000C  
009021E0 =    
009021F0 =    
00902200 =    
00902210 =    
00902220 =    
00902230 =    
00902240 =    
00902250 =    
00902260 =    
00902270 =    
00902280 =    
00902290 =  03040103 0409 00030101
009022A0 = 06810040 2200 0112008C 0200
009022B0 = 15A24000 00010054 01000201 0200060A


Regards,
Abdul Rasheed

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


Re: [U-Boot] [UBOOT PATCH] env: mmc: Fix misaligned buffer address when saving envvars to FAT

2018-05-17 Thread Vipul Kumar
Hi,

> -Original Message-
> From: Alex Kiernan [mailto:alex.kier...@gmail.com]
> Sent: Thursday, May 17, 2018 1:31 PM
> To: Vipul Kumar 
> Cc: u-boot ; gmus...@ciena.com; Michal Simek
> ; Siva Durga Prasad Paladugu
> 
> Subject: Re: [U-Boot] [UBOOT PATCH] env: mmc: Fix misaligned buffer
> address when saving envvars to FAT
> 
> On Thu, May 17, 2018 at 8:46 AM Vipul Kumar 
> wrote:
> 
> > From: Gary Mussar 
> 
> > When doing a u-boot saveenv with the environment in FAT we see the
> > following warning:
> 
> > ZynqMP> saveenv
> > Saving Environment to FAT...
> > writing uboot.env
> > FAT: Misaligned buffer address (7deb9b60) done
> 
> > This can be eliminated by aligning the environment to an appropriate
> > boundary.
> 
> 
> Are you still seeing after this commit?

With cda87ec commit, it's working fine. I didn’t test with this commit earlier. 
So, there is no need of this patch.

Regards,
Vipul

> 
> cda87ec Fix misaligned buffer in env_fat_save
> 
> > Signed-off-by: Gary Mussar 
> > Signed-off-by: Vipul Kumar 
> > ---
> >   include/environment.h | 6 +-
> >   1 file changed, 5 insertions(+), 1 deletion(-)
> 
> > diff --git a/include/environment.h b/include/environment.h index
> > 50c62c5..d6c530d 100644
> > --- a/include/environment.h
> > +++ b/include/environment.h
> > @@ -150,7 +150,11 @@ typedef struct environment_s {
> >  unsigned char   flags;  /* active/obsolete flags*/
> >   #endif
> >  unsigned char   data[ENV_SIZE]; /* Environment data */
> > -} env_t;
> > +} env_t
> > +#ifdef ARCH_DMA_MINALIGN
> > +__aligned(ARCH_DMA_MINALIGN)
> > +#endif
> > +;
> 
> >   #ifdef ENV_IS_EMBEDDED
> >   extern env_t environment;
> > --
> > 2.7.4
> 
> > This email and any attachments are intended for the sole use of the
> > named
> recipient(s) and contain(s) confidential information that may be proprietary,
> privileged or copyrighted under applicable law. If you are not the intended
> recipient, do not read, copy, or forward this email message or any
> attachments. Delete this email message and any attachments immediately.
> > ___
> > U-Boot mailing list
> > U-Boot@lists.denx.de
> > https://lists.denx.de/listinfo/u-boot
> 
> 
> 
> --
> Alex Kiernan
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH] ARM: uniphier: rename environment variable fdt_name to fdtname

2018-05-17 Thread Masahiro Yamada
For booting Linux in the generic distro mechanism, cmd/pxe.c
retrieves the FDT file name from "fdtname" environment variable.

Rename "fdt_name" to "fdtname" for easier migration to distro boot.

Signed-off-by: Masahiro Yamada 
---

 arch/arm/mach-uniphier/board_late_init.c | 4 ++--
 include/configs/uniphier.h   | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/arch/arm/mach-uniphier/board_late_init.c 
b/arch/arm/mach-uniphier/board_late_init.c
index 9dff3f1..6a99572 100644
--- a/arch/arm/mach-uniphier/board_late_init.c
+++ b/arch/arm/mach-uniphier/board_late_init.c
@@ -38,7 +38,7 @@ static int uniphier_set_fdt_file(void)
char dtb_name[256];
int buf_len = sizeof(dtb_name);
 
-   if (env_get("fdt_file"))
+   if (env_get("fdtfile"))
return 0;   /* do nothing if it is already set */
 
compat = fdt_stringlist_get(gd->fdt_blob, 0, "compatible", 0, NULL);
@@ -56,7 +56,7 @@ static int uniphier_set_fdt_file(void)
 
strncat(dtb_name, ".dtb", buf_len);
 
-   return env_set("fdt_file", dtb_name);
+   return env_set("fdtfile", dtb_name);
 }
 
 int board_late_init(void)
diff --git a/include/configs/uniphier.h b/include/configs/uniphier.h
index f710c8f..b631f79 100644
--- a/include/configs/uniphier.h
+++ b/include/configs/uniphier.h
@@ -168,10 +168,10 @@
"run boot_common\0" \
"tftpboot=tftpboot $kernel_addr_load $bootfile && " \
"tftpboot $ramdisk_addr_r $ramdisk_file &&" \
-   "tftpboot $fdt_addr_r $fdt_file &&" \
+   "tftpboot $fdt_addr_r $fdtfile &&" \
"run boot_common\0" \
"__nfsboot=tftpboot $kernel_addr_load $bootfile && " \
-   "tftpboot $fdt_addr_r $fdt_file &&" \
+   "tftpboot $fdt_addr_r $fdtfile &&" \
"setenv ramdisk_addr_r - &&" \
"run boot_common\0"
 #endif
-- 
2.7.4

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


[U-Boot] RFC: Alternative boot_jump_linux() function

2018-05-17 Thread Ramon Fried
Hi.
I'm currently working on snapdragon bootloader support and in the
particular case where U-boot is running in Aarch32 and the kernel is
Aarch64 the specific implementation is to jump to Linux through SCM
call.

I try to find the best possible way to provide an alternative boot function.
Adding #ifdef ARCH_SNAPDRAGON will just be too specific in
arm/lib/bootm.c in my opinion and I'm thinking of introducing kind of
a callback function in gd. that if exists will jump there instead of
executing boot_jump_linux().

What do you think ?

Waiting for your thoughts on the subject.

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


Re: [U-Boot] [RFC PATCH 1/3] sunxi: Extend SPL header versioning

2018-05-17 Thread Siarhei Siamashka
On Thu, 17 May 2018 09:16:59 +0100
Andre Przywara  wrote:

> On Allwinner SoCs we use some free bytes at the beginning of the SPL image
> to store various information. We have a version byte to allow updates,
> but changing this always requires all tools to be updated as well.

The tools do not need to be updated together with U-Boot even now.

U-Boot may freely increment the SPL version number as long as the new
header is a superset of the old one.

> Introduce the concept of semantic versioning [1] to the SPL header:
> The major part of the version number only changes on incompatible
> updates, a minor number bump indicates backward compatibility.
> This patch just documents the major/minor split, adds some comments
> to the header file and uses the versioning information for the existing
> users.
> 
> [1] https://semver.org

So basically you are implementing the versioning scheme that I proposed
back in 2015:
https://lists.denx.de/pipermail/u-boot/2015-September/228727.html

Hans de Goede thought that the major/minor versioning was too complex
and unnecessary (if I remember correctly, we had several discussion
threads which concluded in the same way), so we did not implement it
explicitly back then. But a potential non-compatible SPL header upgrade
still could be handled, albeit less gracefully:

Yes, we can also always change the SPL header signature in the case
of introducing incompatible changes. But the down side is that the
"fel" tool would treat this situation as "unknown bootloader"
instead of "incompatible U-Boot".

> Signed-off-by: Andre Przywara 

In general, improvements in this area are welcome. Just some
comments below.

> ---
>  arch/arm/include/asm/arch-sunxi/spl.h | 19 ++-
>  board/sunxi/board.c   |  4 ++--
>  2 files changed, 16 insertions(+), 7 deletions(-)
> 
> diff --git a/arch/arm/include/asm/arch-sunxi/spl.h 
> b/arch/arm/include/asm/arch-sunxi/spl.h
> index 4277d836e5..7cf89c8db2 100644
> --- a/arch/arm/include/asm/arch-sunxi/spl.h
> +++ b/arch/arm/include/asm/arch-sunxi/spl.h
> @@ -9,7 +9,16 @@
>  
>  #define BOOT0_MAGIC  "eGON.BT0"
>  #define SPL_SIGNATURE"SPL" /* marks "sunxi" SPL header */
> -#define SPL_HEADER_VERSION   2
> +#define SPL_MAJOR_BITS   3
> +#define SPL_MINOR_BITS   5
> +#define SPL_VERSION(maj, min)
> \
> + maj) & ((1U << SPL_MAJOR_BITS) - 1)) << SPL_MINOR_BITS) | \
> + ((min) & ((1U << SPL_MINOR_BITS) - 1)))
> +
> +#define SPL_HEADER_VERSION   SPL_VERSION(0, 2)
> +
> +#define SPL_ENV_HEADER_VERSION   SPL_VERSION(0, 1)
> +#define SPL_DT_HEADER_VERSIONSPL_VERSION(0, 2)
>  
>  #ifdef CONFIG_SUNXI_HIGH_SRAM
>  #define SPL_ADDR 0x1
> @@ -49,14 +58,14 @@ struct boot_file_head {
>   uint32_t pub_head_size;
>   uint8_t spl_signature[4];
>   };
> - uint32_t fel_script_address;
> + uint32_t fel_script_address;/* since v0.1, set by sunxi-fel */

Thanks, it's nice to have these comments about the versions where these
features were introduced.

>   /*
>* If the fel_uEnv_length member below is set to a non-zero value,
>* it specifies the size (byte count) of data at fel_script_address.
>* At the same time this indicates that the data is in uEnv.txt
>* compatible format, ready to be imported via "env import -t".
>*/
> - uint32_t fel_uEnv_length;
> + uint32_t fel_uEnv_length;   /* since v0.1, set by sunxi-fel */
>   /*
>* Offset of an ASCIIZ string (relative to the SPL header), which
>* contains the default device tree name (CONFIG_DEFAULT_DEVICE_TREE).
> @@ -64,11 +73,11 @@ struct boot_file_head {
>* by flash programming tools for providing nice informative messages
>* to the users.
>*/
> - uint32_t dt_name_offset;
> + uint32_t dt_name_offset;/* since v0.2, set by mksunxiboot */
>   uint32_t reserved1;
>   uint32_t boot_media;/* written here by the boot ROM */
>   /* A padding area (may be used for storing text strings) */
> - uint32_t string_pool[13];
> + uint32_t string_pool[13];   /* since v0.2, filled by mksunxiboot */

The 0.2 version of the SPL header does not specify the exact
format of this 'string_pool' padding area. So I think that this
comment is unnecessary.

In principle, the device tree name string can be stored even
somewhere in the const data section of the SPL binary and
referenced from the SPL header. Not that it makes any sense to
do this, but it is technically possible.

>   /* The header must be a multiple of 32 bytes (for VBAR alignment) */
>  };
>  
> diff --git a/board/sunxi/board.c b/board/sunxi/board.c
> index 3d364c6db5..a105d0a5ab 100644
> --- a/board/sunxi/board.c
> +++ b/board/sunxi/board.c
> @@ -631,9 +631,9 @@ static void parse_spl_header(const uint32_t spl_addr)
>   

Re: [U-Boot] [RFC PATCH 1/3] sunxi: Extend SPL header versioning

2018-05-17 Thread Icenowy Zheng


于 2018年5月17日 GMT+08:00 下午7:05:15, Siarhei Siamashka 
 写到:
>On Thu, 17 May 2018 09:16:59 +0100
>Andre Przywara  wrote:
>
>> On Allwinner SoCs we use some free bytes at the beginning of the SPL
>image
>> to store various information. We have a version byte to allow
>updates,
>> but changing this always requires all tools to be updated as well.
>
>The tools do not need to be updated together with U-Boot even now.
>
>U-Boot may freely increment the SPL version number as long as the new
>header is a superset of the old one.

But now sunxi-fel will work when SPL ver not recognized.

>
>> Introduce the concept of semantic versioning [1] to the SPL header:
>> The major part of the version number only changes on incompatible
>> updates, a minor number bump indicates backward compatibility.
>> This patch just documents the major/minor split, adds some comments
>> to the header file and uses the versioning information for the
>existing
>> users.
>> 
>> [1] https://semver.org
>
>So basically you are implementing the versioning scheme that I proposed
>back in 2015:
>https://lists.denx.de/pipermail/u-boot/2015-September/228727.html
>
>Hans de Goede thought that the major/minor versioning was too complex
>and unnecessary (if I remember correctly, we had several discussion
>threads which concluded in the same way), so we did not implement it
>explicitly back then. But a potential non-compatible SPL header upgrade
>still could be handled, albeit less gracefully:
>
>Yes, we can also always change the SPL header signature in the case
>of introducing incompatible changes. But the down side is that the
>"fel" tool would treat this situation as "unknown bootloader"
>instead of "incompatible U-Boot".
>
>> Signed-off-by: Andre Przywara 
>
>In general, improvements in this area are welcome. Just some
>comments below.
>
>> ---
>>  arch/arm/include/asm/arch-sunxi/spl.h | 19 ++-
>>  board/sunxi/board.c   |  4 ++--
>>  2 files changed, 16 insertions(+), 7 deletions(-)
>> 
>> diff --git a/arch/arm/include/asm/arch-sunxi/spl.h
>b/arch/arm/include/asm/arch-sunxi/spl.h
>> index 4277d836e5..7cf89c8db2 100644
>> --- a/arch/arm/include/asm/arch-sunxi/spl.h
>> +++ b/arch/arm/include/asm/arch-sunxi/spl.h
>> @@ -9,7 +9,16 @@
>>  
>>  #define BOOT0_MAGIC "eGON.BT0"
>>  #define SPL_SIGNATURE   "SPL" /* marks "sunxi" SPL header */
>> -#define SPL_HEADER_VERSION  2
>> +#define SPL_MAJOR_BITS  3
>> +#define SPL_MINOR_BITS  5
>> +#define SPL_VERSION(maj, min)   
>> \
>> +maj) & ((1U << SPL_MAJOR_BITS) - 1)) << SPL_MINOR_BITS) | \
>> +((min) & ((1U << SPL_MINOR_BITS) - 1)))
>> +
>> +#define SPL_HEADER_VERSION  SPL_VERSION(0, 2)
>> +
>> +#define SPL_ENV_HEADER_VERSION  SPL_VERSION(0, 1)
>> +#define SPL_DT_HEADER_VERSION   SPL_VERSION(0, 2)
>>  
>>  #ifdef CONFIG_SUNXI_HIGH_SRAM
>>  #define SPL_ADDR0x1
>> @@ -49,14 +58,14 @@ struct boot_file_head {
>>  uint32_t pub_head_size;
>>  uint8_t spl_signature[4];
>>  };
>> -uint32_t fel_script_address;
>> +uint32_t fel_script_address;/* since v0.1, set by sunxi-fel */
>
>Thanks, it's nice to have these comments about the versions where these
>features were introduced.
>
>>  /*
>>   * If the fel_uEnv_length member below is set to a non-zero value,
>>   * it specifies the size (byte count) of data at
>fel_script_address.
>>   * At the same time this indicates that the data is in uEnv.txt
>>   * compatible format, ready to be imported via "env import -t".
>>   */
>> -uint32_t fel_uEnv_length;
>> +uint32_t fel_uEnv_length;   /* since v0.1, set by sunxi-fel */
>>  /*
>>   * Offset of an ASCIIZ string (relative to the SPL header), which
>>   * contains the default device tree name
>(CONFIG_DEFAULT_DEVICE_TREE).
>> @@ -64,11 +73,11 @@ struct boot_file_head {
>>   * by flash programming tools for providing nice informative
>messages
>>   * to the users.
>>   */
>> -uint32_t dt_name_offset;
>> +uint32_t dt_name_offset;/* since v0.2, set by mksunxiboot */
>>  uint32_t reserved1;
>>  uint32_t boot_media;/* written here by the boot ROM */
>>  /* A padding area (may be used for storing text strings) */
>> -uint32_t string_pool[13];
>> +uint32_t string_pool[13];   /* since v0.2, filled by mksunxiboot */
>
>The 0.2 version of the SPL header does not specify the exact
>format of this 'string_pool' padding area. So I think that this
>comment is unnecessary.
>
>In principle, the device tree name string can be stored even
>somewhere in the const data section of the SPL binary and
>referenced from the SPL header. Not that it makes any sense to
>do this, but it is technically possible.
>
>>  /* The header must be a multiple of 32 bytes (for VBAR alignment)
>*/
>>  };
>>  
>> diff --git a/board/sunxi/boar

Re: [U-Boot] [PATCH] net: MVGBE don't automatically select PHYLIB

2018-05-17 Thread Tom Rini
On Thu, May 17, 2018 at 09:03:15PM +1200, Chris Packham wrote:
> Not all users of MVGBE need PHYLIB and it increases the size of the
> openrd images too much.
> 
> Fixes: commit ed52ea507f12 ("net: add Kconfig for MVGBE")
> Signed-off-by: Chris Packham 
> Cc: Tom Rini 
> Cc: Stefan Roese 
> ---
> 
>  drivers/net/Kconfig | 1 -
>  1 file changed, 1 deletion(-)
> 
> diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig
> index c962d7a72c0c..f2cc75f494e8 100644
> --- a/drivers/net/Kconfig
> +++ b/drivers/net/Kconfig
> @@ -181,7 +181,6 @@ config FTMAC100
>  config MVGBE
>   bool "Marvell Orion5x/Kirkwood network interface support"
>   depends on KIRKWOOD || ORION5X
> - select PHYLIB
>   help
> This driver supports the network interface units in the
> Marvell Orion5x and Kirkwood SoCs

This results in phylib never being set now as the configs were getting
it implicitly.  Do any of the boards need it?  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 1/3] doc: Add new doc for file system firmware loader driver model

2018-05-17 Thread Tom Rini
On Thu, May 17, 2018 at 04:27:27AM +, Chee, Tien Fong wrote:
> On Wed, 2018-05-16 at 08:48 -0400, Tom Rini wrote:
> > On Wed, May 16, 2018 at 05:21:39PM +0800, tien.fong.c...@intel.com
> > wrote:
> > 
> > > 
> > > From: Tien Fong Chee 
> > > 
> > > Provide information about
> > > 
> > > - overview of file system firmware loader driver model
> > > - describe default storage device in device tree source
> > > - describe fie system firmware loader API
> > > 
> > > Signed-off-by: Tien Fong Chee 
> > > ---
> > >  doc/driver-model/fs_firmware_loader.txt |  100
> > > +++
> > >  1 files changed, 100 insertions(+), 0 deletions(-)
> > >  create mode 100644 doc/driver-model/fs_firmware_loader.txt
> > > 
> > > diff --git a/doc/driver-model/fs_firmware_loader.txt b/doc/driver-
> > > model/fs_firmware_loader.txt
> > > new file mode 100644
> > > index 000..167660a
> > > --- /dev/null
> > > +++ b/doc/driver-model/fs_firmware_loader.txt
> > > @@ -0,0 +1,100 @@
> > > +/*
> > > + * Copyright (C) 2018 Intel Corporation 
> > > + *
> > > + * SPDX-License-Identifier:GPL-2.0
> > > + */
> > As this isn't code please don't put a code header up for the first
> > comment block.  Frankly I'd rather see an rST comment block up front
> > even with the rest being plain text as long term I imagine we'll move
> > to
> > rST.
> > 
> Okay, i will remove the license and changing it to rST format.

You don't need to remove it, just move it :)

-- 
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] mtd: spi-nor: new NXP FlexSPI driver location & framework to use ?

2018-05-17 Thread Prabhakar Kushwaha
Dear Jagan,

> -Original Message-
> From: U-Boot [mailto:u-boot-boun...@lists.denx.de] On Behalf Of
> Prabhakar Kushwaha
> Sent: Monday, May 14, 2018 6:55 PM
> To: Jagan Teki 
> Cc: u-boot@lists.denx.de
> Subject: Re: [U-Boot] mtd: spi-nor: new NXP FlexSPI driver location &
> framework to use ?
> 
> Thanks Jagan,
> 
> > -Original Message-
> > From: Jagan Teki [mailto:jagannadh.t...@gmail.com]
> > Sent: Friday, May 11, 2018 11:31 AM
> > To: Prabhakar Kushwaha 
> > Cc: Jagan Teki ; York Sun
> > ; Yogesh Narayan Gaur
> ;
> > Poonam Aggrwal ; Ashish Kumar
> > ; u- b...@lists.denx.de
> > Subject: Re: mtd: spi-nor: new NXP FlexSPI driver location & framework
> > to use ?
> >
> > On Fri, May 11, 2018 at 11:08 AM, Prabhakar Kushwaha
> >  wrote:
> > > Dear Jagan,
> > >
> > > NXP is coming up with new FlexSPI controller. It is similar to
> > > existing QSPI
> > with enhanced feature-set.
> > > We have the driver ready as per existing framework i.e. driver/spi.
> > >
> > > From recend discussion, we go to know about framework change.
> > > Migration of qspi drivers in u-boot-spi/drivers/mtd/spi-nor/
> > git://git.denx.de/u-boot-spi.git branch mtd-spinor-working.
> > >
> > > We are in dilemma for sending FlexSPI driver upstream.
> > > Do we follow existing framework i.e. driver/spi   or new proposed
> > framework i.e. u-boot-spi/drivers/mtd/spi-nor/
> > >
> > > Also, do we have any timeline of u-boot-spi/drivers/mtd/spi-nor/ to
> > become default.
> >
> > Idea is to move spi-nor, mtd-spinor-working is paused because of
> > non-dm drivers accessing.
> 
> This means, flexspi controller driver should be upstream'ed via u-boot-
> spi/drivers/mtd/spi-nor branch mtd-spinor-working
> 

Please help me with the query. 
We don’t want to end up with 2 FlexSPI drivers being posted in upstream. 

--pk




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


Re: [U-Boot] [RFC PATCH 1/3] sunxi: Extend SPL header versioning

2018-05-17 Thread Andre Przywara
Hi,

On 17/05/18 12:05, Siarhei Siamashka wrote:
> On Thu, 17 May 2018 09:16:59 +0100
> Andre Przywara  wrote:
> 
>> On Allwinner SoCs we use some free bytes at the beginning of the SPL image
>> to store various information. We have a version byte to allow updates,
>> but changing this always requires all tools to be updated as well.
> 
> The tools do not need to be updated together with U-Boot even now.
> 
> U-Boot may freely increment the SPL version number as long as the new
> header is a superset of the old one.
> 
>> Introduce the concept of semantic versioning [1] to the SPL header:
>> The major part of the version number only changes on incompatible
>> updates, a minor number bump indicates backward compatibility.
>> This patch just documents the major/minor split, adds some comments
>> to the header file and uses the versioning information for the existing
>> users.
>>
>> [1] https://semver.org
> 
> So basically you are implementing the versioning scheme that I proposed
> back in 2015:
> https://lists.denx.de/pipermail/u-boot/2015-September/228727.html

Ah, sorry, that predates my sunxi involvement ;-)

> Hans de Goede thought that the major/minor versioning was too complex
> and unnecessary (if I remember correctly, we had several discussion
> threads which concluded in the same way), so we did not implement it
> explicitly back then. But a potential non-compatible SPL header upgrade
> still could be handled, albeit less gracefully:
> 
> Yes, we can also always change the SPL header signature in the case
> of introducing incompatible changes. But the down side is that the
> "fel" tool would treat this situation as "unknown bootloader"
> instead of "incompatible U-Boot".
> 
>> Signed-off-by: Andre Przywara 
> 
> In general, improvements in this area are welcome. Just some
> comments below.
> 
>> ---
>>  arch/arm/include/asm/arch-sunxi/spl.h | 19 ++-
>>  board/sunxi/board.c   |  4 ++--
>>  2 files changed, 16 insertions(+), 7 deletions(-)
>>
>> diff --git a/arch/arm/include/asm/arch-sunxi/spl.h 
>> b/arch/arm/include/asm/arch-sunxi/spl.h
>> index 4277d836e5..7cf89c8db2 100644
>> --- a/arch/arm/include/asm/arch-sunxi/spl.h
>> +++ b/arch/arm/include/asm/arch-sunxi/spl.h
>> @@ -9,7 +9,16 @@
>>  
>>  #define BOOT0_MAGIC "eGON.BT0"
>>  #define SPL_SIGNATURE   "SPL" /* marks "sunxi" SPL header */
>> -#define SPL_HEADER_VERSION  2
>> +#define SPL_MAJOR_BITS  3
>> +#define SPL_MINOR_BITS  5
>> +#define SPL_VERSION(maj, min)   
>> \
>> +maj) & ((1U << SPL_MAJOR_BITS) - 1)) << SPL_MINOR_BITS) | \
>> +((min) & ((1U << SPL_MINOR_BITS) - 1)))
>> +
>> +#define SPL_HEADER_VERSION  SPL_VERSION(0, 2)
>> +
>> +#define SPL_ENV_HEADER_VERSION  SPL_VERSION(0, 1)
>> +#define SPL_DT_HEADER_VERSION   SPL_VERSION(0, 2)
>>  
>>  #ifdef CONFIG_SUNXI_HIGH_SRAM
>>  #define SPL_ADDR0x1
>> @@ -49,14 +58,14 @@ struct boot_file_head {
>>  uint32_t pub_head_size;
>>  uint8_t spl_signature[4];
>>  };
>> -uint32_t fel_script_address;
>> +uint32_t fel_script_address;/* since v0.1, set by sunxi-fel */
> 
> Thanks, it's nice to have these comments about the versions where these
> features were introduced.
> 
>>  /*
>>   * If the fel_uEnv_length member below is set to a non-zero value,
>>   * it specifies the size (byte count) of data at fel_script_address.
>>   * At the same time this indicates that the data is in uEnv.txt
>>   * compatible format, ready to be imported via "env import -t".
>>   */
>> -uint32_t fel_uEnv_length;
>> +uint32_t fel_uEnv_length;   /* since v0.1, set by sunxi-fel */
>>  /*
>>   * Offset of an ASCIIZ string (relative to the SPL header), which
>>   * contains the default device tree name (CONFIG_DEFAULT_DEVICE_TREE).
>> @@ -64,11 +73,11 @@ struct boot_file_head {
>>   * by flash programming tools for providing nice informative messages
>>   * to the users.
>>   */
>> -uint32_t dt_name_offset;
>> +uint32_t dt_name_offset;/* since v0.2, set by mksunxiboot */
>>  uint32_t reserved1;
>>  uint32_t boot_media;/* written here by the boot ROM */
>>  /* A padding area (may be used for storing text strings) */
>> -uint32_t string_pool[13];
>> +uint32_t string_pool[13];   /* since v0.2, filled by mksunxiboot */
> 
> The 0.2 version of the SPL header does not specify the exact
> format of this 'string_pool' padding area. So I think that this
> comment is unnecessary.

Well, I understand that it *could* be everywhere, but I wanted to give a
heads up to the reader that the actual mksunxiboot implementation fills
that area, so it's not really vacant anymore. That may become of
importance if we need more fields.

> In principle, the device tree name string can be stored even
> somewhere in the const data se

Re: [U-Boot] RFC: Alternative boot_jump_linux() function

2018-05-17 Thread Peter Robinson
Hi,

> I'm currently working on snapdragon bootloader support and in the
> particular case where U-boot is running in Aarch32 and the kernel is
> Aarch64 the specific implementation is to jump to Linux through SCM
> call.

I seem to remember the Allwinner A64 Pine64 starts in 32 bit mode and
switches too so you might get some ideas from there or the maintainer
might have some suggestions.

> I try to find the best possible way to provide an alternative boot function.
> Adding #ifdef ARCH_SNAPDRAGON will just be too specific in
> arm/lib/bootm.c in my opinion and I'm thinking of introducing kind of
> a callback function in gd. that if exists will jump there instead of
> executing boot_jump_linux().
>
> What do you think ?
>
> Waiting for your thoughts on the subject.
>
> Warm regards,
> Ramon.
> ___
> 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] [PATCH] net: MVGBE don't automatically select PHYLIB

2018-05-17 Thread Chris Packham
On Thu, 17 May 2018, 11:09 PM Tom Rini,  wrote:

> On Thu, May 17, 2018 at 09:03:15PM +1200, Chris Packham wrote:
> > Not all users of MVGBE need PHYLIB and it increases the size of the
> > openrd images too much.
> >
> > Fixes: commit ed52ea507f12 ("net: add Kconfig for MVGBE")
> > Signed-off-by: Chris Packham 
> > Cc: Tom Rini 
> > Cc: Stefan Roese 
> > ---
> >
> >  drivers/net/Kconfig | 1 -
> >  1 file changed, 1 deletion(-)
> >
> > diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig
> > index c962d7a72c0c..f2cc75f494e8 100644
> > --- a/drivers/net/Kconfig
> > +++ b/drivers/net/Kconfig
> > @@ -181,7 +181,6 @@ config FTMAC100
> >  config MVGBE
> >   bool "Marvell Orion5x/Kirkwood network interface support"
> >   depends on KIRKWOOD || ORION5X
> > - select PHYLIB
> >   help
> > This driver supports the network interface units in the
> > Marvell Orion5x and Kirkwood SoCs
>
> This results in phylib never being set now as the configs were getting
> it implicitly.  Do any of the boards need it?
>

I compile tested the affected boards and they all build. I've fired this at
github and should have some travis results soon.

My mistake was to copy the mvneta kconfig which had the select. Commit
ed52ea507f ("net: add Kconfig for MVGBE") didn't remove any CONFIG_PHYLIB
lines so if they need it it's already in the board.h file or selected
somewhere else.
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH 0/6] ARM: kirkwood: dts conversion round 2

2018-05-17 Thread Simon Guinot
On Thu, May 17, 2018 at 09:45:55PM +1200, Chris Packham wrote:
> This is the second round of updating kirkwood boards to OF_CONTROL. Most
> of these boards use spi flash so I've added the u-boot specific
> "spi-flash" compatible string where appropriate.

Hi Chris,

Thanks for converting the LaCie boards to device tree. I'll test them
as soon as possible.

Simon

> 
> 
> Chris Packham (6):
>   ARM: kirkwood: Add device-tree for d2net_v2 & net2big_v2
>   ARM: kirkwood: Add device-tree for dreamplug
>   ARM: kirkwood: Add device-tree for ds109
>   ARM: kirkwood: Add device-tree for lschlv2 & lsxhl
>   ARM: kirkwood: Add device-tree for netspace & inetspace
>   ARM: kirkwood: Add device-tree for keymile
> 
>  arch/arm/dts/kirkwood-d2net.dts |  45 ++
>  arch/arm/dts/kirkwood-dreamplug.dts | 127 
>  arch/arm/dts/kirkwood-ds109.dts |  40 ++
>  arch/arm/dts/kirkwood-is2.dts   |  40 ++
>  arch/arm/dts/kirkwood-km_common.dtsi|  47 ++
>  arch/arm/dts/kirkwood-km_kirkwood.dts   |  31 +
>  arch/arm/dts/kirkwood-lschlv2.dts   |  20 +
>  arch/arm/dts/kirkwood-lsxhl.dts |  20 +
>  arch/arm/dts/kirkwood-lsxl.dtsi | 237 +++
>  arch/arm/dts/kirkwood-net2big.dts   |  63 ++
>  arch/arm/dts/kirkwood-netxbig.dtsi  | 232 +++
>  arch/arm/dts/kirkwood-ns2-common.dtsi   |  97 +++
>  arch/arm/dts/kirkwood-ns2.dts   |  40 ++
>  arch/arm/dts/kirkwood-ns2lite.dts   |  35 +
>  arch/arm/dts/kirkwood-ns2max.dts|  59 ++
>  arch/arm/dts/kirkwood-ns2mini.dts   |  60 ++
>  arch/arm/dts/kirkwood-synology.dtsi | 855 
>  configs/d2net_v2_defconfig  |   3 +-
>  configs/dreamplug_defconfig |   3 +-
>  configs/ds109_defconfig |   2 +
>  configs/inetspace_v2_defconfig  |   3 +-
>  configs/km_kirkwood_128m16_defconfig|   3 +-
>  configs/km_kirkwood_defconfig   |   3 +-
>  configs/km_kirkwood_pci_defconfig   |   3 +-
>  configs/kmcoge5un_defconfig |   3 +-
>  configs/kmnusa_defconfig|   3 +-
>  configs/kmsugp1_defconfig   |   3 +-
>  configs/kmsuv31_defconfig   |   3 +-
>  configs/lschlv2_defconfig   |   3 +-
>  configs/lsxhl_defconfig |   3 +-
>  configs/mgcoge3un_defconfig |   3 +-
>  configs/net2big_v2_defconfig|   3 +-
>  configs/netspace_lite_v2_defconfig  |   3 +-
>  configs/netspace_max_v2_defconfig   |   3 +-
>  configs/netspace_mini_v2_defconfig  |   3 +-
>  configs/netspace_v2_defconfig   |   3 +-
>  include/dt-bindings/leds/leds-netxbig.h |  18 +
>  include/dt-bindings/leds/leds-ns2.h |   9 +
>  38 files changed, 2113 insertions(+), 18 deletions(-)
>  create mode 100644 arch/arm/dts/kirkwood-d2net.dts
>  create mode 100644 arch/arm/dts/kirkwood-dreamplug.dts
>  create mode 100644 arch/arm/dts/kirkwood-ds109.dts
>  create mode 100644 arch/arm/dts/kirkwood-is2.dts
>  create mode 100644 arch/arm/dts/kirkwood-km_common.dtsi
>  create mode 100644 arch/arm/dts/kirkwood-km_kirkwood.dts
>  create mode 100644 arch/arm/dts/kirkwood-lschlv2.dts
>  create mode 100644 arch/arm/dts/kirkwood-lsxhl.dts
>  create mode 100644 arch/arm/dts/kirkwood-lsxl.dtsi
>  create mode 100644 arch/arm/dts/kirkwood-net2big.dts
>  create mode 100644 arch/arm/dts/kirkwood-netxbig.dtsi
>  create mode 100644 arch/arm/dts/kirkwood-ns2-common.dtsi
>  create mode 100644 arch/arm/dts/kirkwood-ns2.dts
>  create mode 100644 arch/arm/dts/kirkwood-ns2lite.dts
>  create mode 100644 arch/arm/dts/kirkwood-ns2max.dts
>  create mode 100644 arch/arm/dts/kirkwood-ns2mini.dts
>  create mode 100644 arch/arm/dts/kirkwood-synology.dtsi
>  create mode 100644 include/dt-bindings/leds/leds-netxbig.h
>  create mode 100644 include/dt-bindings/leds/leds-ns2.h
> 
> -- 
> 2.17.0


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] net: MVGBE don't automatically select PHYLIB

2018-05-17 Thread Stefan Roese

On 17.05.2018 13:53, Chris Packham wrote:



On Thu, 17 May 2018, 11:09 PM Tom Rini, > wrote:


On Thu, May 17, 2018 at 09:03:15PM +1200, Chris Packham wrote:
 > Not all users of MVGBE need PHYLIB and it increases the size of the
 > openrd images too much.
 >
 > Fixes: commit ed52ea507f12 ("net: add Kconfig for MVGBE")
 > Signed-off-by: Chris Packham mailto:judge.pack...@gmail.com>>
 > Cc: Tom Rini mailto:tr...@konsulko.com>>
 > Cc: Stefan Roese mailto:s...@denx.de>>
 > ---
 >
 >  drivers/net/Kconfig | 1 -
 >  1 file changed, 1 deletion(-)
 >
 > diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig
 > index c962d7a72c0c..f2cc75f494e8 100644
 > --- a/drivers/net/Kconfig
 > +++ b/drivers/net/Kconfig
 > @@ -181,7 +181,6 @@ config FTMAC100
 >  config MVGBE
 >       bool "Marvell Orion5x/Kirkwood network interface support"
 >       depends on KIRKWOOD || ORION5X
 > -     select PHYLIB
 >       help
 >         This driver supports the network interface units in the
 >         Marvell Orion5x and Kirkwood SoCs

This results in phylib never being set now as the configs were getting
it implicitly.  Do any of the boards need it?


I compile tested the affected boards and they all build. I've fired this 
at github and should have some travis results soon.


My mistake was to copy the mvneta kconfig which had the select. Commit 
ed52ea507f ("net: add Kconfig for MVGBE") didn't remove any 
CONFIG_PHYLIB lines so if they need it it's already in the board.h file 
or selected somewhere else.


Yes, this is also my understanding. ed52ea507f ("net: add Kconfig for
MVGBE") selected PHYLIB via Kconfig, which changed the configuration
for these Kirkwood boards. *If* some of them needed / selected PHYLIB
before this patch, it was most likely done in their config header.

So this patch restores the board configuration again. PHYLIB is not
needed for MVGBE - it compiles without it as well.

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


Re: [U-Boot] [PATCH] sunxi: allow CONFIG_DEFAULT_FDT_FILE override

2018-05-17 Thread Maxime Ripard
On Tue, May 01, 2018 at 05:46:41PM -0700, Martin Kelly wrote:
> Currently, sunxi-common.h ignores CONFIG_DEFAULT_FDT_FILE and assumes
> the kernel fdtfile and the u-boot devicetree names are the same.
> Although this is typically the case, sometimes you might want to
> customize one of these differently, so it's useful to allow them to be
> different.
> 
> Add logic in sunxi-common.h to respect CONFIG_DEFAULT_FDT_FILE, if set,
> and default to the values it currently uses.
> 
> Signed-off-by: Martin Kelly 

Acked-by: Maxime Ripard 

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


Re: [U-Boot] [PATCH] net: MVGBE don't automatically select PHYLIB

2018-05-17 Thread Tom Rini
On Thu, May 17, 2018 at 01:59:36PM +0200, Stefan Roese wrote:
> On 17.05.2018 13:53, Chris Packham wrote:
> >
> >
> >On Thu, 17 May 2018, 11:09 PM Tom Rini,  >> wrote:
> >
> >On Thu, May 17, 2018 at 09:03:15PM +1200, Chris Packham wrote:
> > > Not all users of MVGBE need PHYLIB and it increases the size of the
> > > openrd images too much.
> > >
> > > Fixes: commit ed52ea507f12 ("net: add Kconfig for MVGBE")
> > > Signed-off-by: Chris Packham  >>
> > > Cc: Tom Rini mailto:tr...@konsulko.com>>
> > > Cc: Stefan Roese mailto:s...@denx.de>>
> > > ---
> > >
> > >  drivers/net/Kconfig | 1 -
> > >  1 file changed, 1 deletion(-)
> > >
> > > diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig
> > > index c962d7a72c0c..f2cc75f494e8 100644
> > > --- a/drivers/net/Kconfig
> > > +++ b/drivers/net/Kconfig
> > > @@ -181,7 +181,6 @@ config FTMAC100
> > >  config MVGBE
> > >       bool "Marvell Orion5x/Kirkwood network interface support"
> > >       depends on KIRKWOOD || ORION5X
> > > -     select PHYLIB
> > >       help
> > >         This driver supports the network interface units in the
> > >         Marvell Orion5x and Kirkwood SoCs
> >
> >This results in phylib never being set now as the configs were getting
> >it implicitly.  Do any of the boards need it?
> >
> >
> >I compile tested the affected boards and they all build. I've fired this
> >at github and should have some travis results soon.
> >
> >My mistake was to copy the mvneta kconfig which had the select. Commit
> >ed52ea507f ("net: add Kconfig for MVGBE") didn't remove any CONFIG_PHYLIB
> >lines so if they need it it's already in the board.h file or selected
> >somewhere else.
> 
> Yes, this is also my understanding. ed52ea507f ("net: add Kconfig for
> MVGBE") selected PHYLIB via Kconfig, which changed the configuration
> for these Kirkwood boards. *If* some of them needed / selected PHYLIB
> before this patch, it was most likely done in their config header.
> 
> So this patch restores the board configuration again. PHYLIB is not
> needed for MVGBE - it compiles without it as well.

OK, thanks.  Can you please do a v2 with a commit message that reflects
this and a Fixes tag?

-- 
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] net: MVGBE don't automatically select PHYLIB

2018-05-17 Thread Chris Packham
When Kconfig support was added for MVGBE it included automatically
selected PHYLIB support. But MVGBE does not need PHYLIB it will build
fine without it. Commit ed52ea507f12 ("net: add Kconfig for MVGBE")
should have been a no-op in terms of build size but because of the
selecting PHYLIB the openrd configs increased in size.

Remove the automatic selection of PHYLIB, boards that need it will have
already enabled it in their config header file.

Fixes: commit ed52ea507f12 ("net: add Kconfig for MVGBE")
Signed-off-by: Chris Packham 
---

Changes in v2:
- reword commit message to make the intent a bit clearer

 drivers/net/Kconfig | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig
index c962d7a72c0c..f2cc75f494e8 100644
--- a/drivers/net/Kconfig
+++ b/drivers/net/Kconfig
@@ -181,7 +181,6 @@ config FTMAC100
 config MVGBE
bool "Marvell Orion5x/Kirkwood network interface support"
depends on KIRKWOOD || ORION5X
-   select PHYLIB
help
  This driver supports the network interface units in the
  Marvell Orion5x and Kirkwood SoCs
-- 
2.17.0

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


Re: [U-Boot] [PATCH] net: MVGBE don't automatically select PHYLIB

2018-05-17 Thread Chris Packham
On Fri, May 18, 2018 at 12:02 AM Tom Rini  wrote:

> On Thu, May 17, 2018 at 01:59:36PM +0200, Stefan Roese wrote:
> > On 17.05.2018 13:53, Chris Packham wrote:
> > >
> > >
> > >On Thu, 17 May 2018, 11:09 PM Tom Rini,  > >> wrote:
> > >
> > >On Thu, May 17, 2018 at 09:03:15PM +1200, Chris Packham wrote:
> > > > Not all users of MVGBE need PHYLIB and it increases the size of
the
> > > > openrd images too much.
> > > >
> > > > Fixes: commit ed52ea507f12 ("net: add Kconfig for MVGBE")
> > > > Signed-off-by: Chris Packham  > >>
> > > > Cc: Tom Rini mailto:tr...@konsulko.com>>
> > > > Cc: Stefan Roese mailto:s...@denx.de>>
> > > > ---
> > > >
> > > >  drivers/net/Kconfig | 1 -
> > > >  1 file changed, 1 deletion(-)
> > > >
> > > > diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig
> > > > index c962d7a72c0c..f2cc75f494e8 100644
> > > > --- a/drivers/net/Kconfig
> > > > +++ b/drivers/net/Kconfig
> > > > @@ -181,7 +181,6 @@ config FTMAC100
> > > >  config MVGBE
> > > >   bool "Marvell Orion5x/Kirkwood network interface support"
> > > >   depends on KIRKWOOD || ORION5X
> > > > - select PHYLIB
> > > >   help
> > > > This driver supports the network interface units in the
> > > > Marvell Orion5x and Kirkwood SoCs
> > >
> > >This results in phylib never being set now as the configs were
getting
> > >it implicitly.  Do any of the boards need it?
> > >
> > >
> > >I compile tested the affected boards and they all build. I've fired
this
> > >at github and should have some travis results soon.
> > >
> > >My mistake was to copy the mvneta kconfig which had the select. Commit
> > >ed52ea507f ("net: add Kconfig for MVGBE") didn't remove any
CONFIG_PHYLIB
> > >lines so if they need it it's already in the board.h file or selected
> > >somewhere else.
> >
> > Yes, this is also my understanding. ed52ea507f ("net: add Kconfig for
> > MVGBE") selected PHYLIB via Kconfig, which changed the configuration
> > for these Kirkwood boards. *If* some of them needed / selected PHYLIB
> > before this patch, it was most likely done in their config header.
> >
> > So this patch restores the board configuration again. PHYLIB is not
> > needed for MVGBE - it compiles without it as well.

> OK, thanks.  Can you please do a v2 with a commit message that reflects
> this and a Fixes tag?


Done http://patchwork.ozlabs.org/patch/915392/
Travis builds running now
https://travis-ci.org/cpackham/u-boot/builds/380175749
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH V2] sf: Add Macronix MX25U25635F ID

2018-05-17 Thread Marek Vasut
Add ID for the Macronix MX25U25635F flash.

Signed-off-by: Marek Vasut 
Cc: Jagan Teki 
---
V2: Change the flash type on maintainer request. This doesn't match
the actual hardware with which this was tested anymore though.
---
 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 a46227f172..cbf2069177 100644
--- a/drivers/mtd/spi/spi_flash_ids.c
+++ b/drivers/mtd/spi/spi_flash_ids.c
@@ -85,6 +85,7 @@ const struct spi_flash_info spi_flash_ids[] = {
{"mx25u6435f", INFO(0xc22537, 0x0, 64 * 1024,   128, RD_FULL | 
WR_QPP) },
{"mx25l12855e",INFO(0xc22618, 0x0, 64 * 1024,   256, RD_FULL | 
WR_QPP) },
{"mx25u1635e", INFO(0xc22535, 0x0, 64 * 1024,  32, SECT_4K) },
+   {"mx25u25635f",INFO(0xc22539, 0x0, 64 * 1024,   512, RD_FULL | 
WR_QPP) },
{"mx66u51235f",INFO(0xc2253a, 0x0, 64 * 1024,  1024, RD_FULL | 
WR_QPP) },
{"mx66l1g45g", INFO(0xc2201b, 0x0, 64 * 1024,  2048, RD_FULL | 
WR_QPP) },
 #endif
-- 
2.16.2

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


[U-Boot] [PATCH v1 0/5] Update STM32 serial driver

2018-05-17 Thread Patrice Chotard

This series :
  _ adds support of DEBUG_UART
  _ fixes bit register define names
  _ add new setparity ops support in DM and in STM32 serial driver
  _ update STM32MP1 machine to allow DEBUG_UART activation


Patrice Chotard (1):
  serial: stm32: Fix bits defines name

Patrick Delaunay (4):
  serial: stm32: Add debug uart support
  dm: serial: Add setparity
  serial: stm32: Add setparity support
  stm32mp1: Allow to activate CONFIG_DEBUG_UART

 arch/arm/mach-stm32mp/Kconfig  |  15 +++
 arch/arm/mach-stm32mp/cpu.c|  14 ++-
 arch/arm/mach-stm32mp/include/mach/stm32.h |  12 +++
 board/st/stm32mp1/board.c  |  27 +
 drivers/serial/Kconfig |   9 ++
 drivers/serial/serial_stm32.c  | 158 -
 drivers/serial/serial_stm32.h  |  16 ++-
 include/serial.h   |  16 +++
 8 files changed, 234 insertions(+), 33 deletions(-)

-- 
1.9.1

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


[U-Boot] [PATCH v1 2/5] serial: stm32: Fix bits defines name

2018-05-17 Thread Patrice Chotard
Rename USART_ISR_FLAG_xxx bits to USART_ISR_xxx bits and
USART_ICR_OREF to USART_ICR_ORECF in order to match datasheets.
Sort defines by descendant order.

Signed-off-by: Patrice Chotard 
---

 drivers/serial/serial_stm32.c | 12 ++--
 drivers/serial/serial_stm32.h |  8 
 2 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/drivers/serial/serial_stm32.c b/drivers/serial/serial_stm32.c
index 724d6f967246..eeaa8ab050d9 100644
--- a/drivers/serial/serial_stm32.c
+++ b/drivers/serial/serial_stm32.c
@@ -54,12 +54,12 @@ static int stm32_serial_getc(struct udevice *dev)
fdt_addr_t base = plat->base;
u32 isr = readl(base + ISR_OFFSET(stm32f4));
 
-   if ((isr & USART_ISR_FLAG_RXNE) == 0)
+   if ((isr & USART_ISR_RXNE) == 0)
return -EAGAIN;
 
-   if (isr & USART_ISR_FLAG_ORE) {
+   if (isr & (USART_ISR_ORE)) {
if (!stm32f4)
-   setbits_le32(base + ICR_OFFSET, USART_ICR_OREF);
+   setbits_le32(base + ICR_OFFSET, USART_ICR_ORECF);
else
readl(base + RDR_OFFSET(stm32f4));
return -EIO;
@@ -74,7 +74,7 @@ static int _stm32_serial_putc(fdt_addr_t base,
 {
bool stm32f4 = uart_info->stm32f4;
 
-   if ((readl(base + ISR_OFFSET(stm32f4)) & USART_ISR_FLAG_TXE) == 0)
+   if ((readl(base + ISR_OFFSET(stm32f4)) & USART_ISR_TXE) == 0)
return -EAGAIN;
 
writel(c, base + TDR_OFFSET(stm32f4));
@@ -97,10 +97,10 @@ static int stm32_serial_pending(struct udevice *dev, bool 
input)
 
if (input)
return readl(base + ISR_OFFSET(stm32f4)) &
-   USART_ISR_FLAG_RXNE ? 1 : 0;
+   USART_ISR_RXNE ? 1 : 0;
else
return readl(base + ISR_OFFSET(stm32f4)) &
-   USART_ISR_FLAG_TXE ? 0 : 1;
+   USART_ISR_TXE ? 0 : 1;
 }
 
 static void _stm32_serial_init(fdt_addr_t base,
diff --git a/drivers/serial/serial_stm32.h b/drivers/serial/serial_stm32.h
index 8a1a24fda8f4..c478e3507020 100644
--- a/drivers/serial/serial_stm32.h
+++ b/drivers/serial/serial_stm32.h
@@ -59,13 +59,13 @@ struct stm32x7_serial_platdata {
 
 #define USART_CR3_OVRDIS   BIT(12)
 
-#define USART_ISR_FLAG_ORE BIT(3)
-#define USART_ISR_FLAG_RXNEBIT(5)
-#define USART_ISR_FLAG_TXE BIT(7)
+#define USART_ISR_TXE  BIT(7)
+#define USART_ISR_RXNE BIT(5)
+#define USART_ISR_ORE  BIT(3)
 
 #define USART_BRR_F_MASK   GENMASK(7, 0)
 #define USART_BRR_M_SHIFT  4
 #define USART_BRR_M_MASK   GENMASK(15, 4)
 
-#define USART_ICR_OREF BIT(3)
+#define USART_ICR_ORECFBIT(3)
 #endif
-- 
1.9.1

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


[U-Boot] [PATCH v1 1/5] serial: stm32: Add debug uart support

2018-05-17 Thread Patrice Chotard
From: Patrick Delaunay 

Add support for early debug printf, before the availability of
driver model and device tree support.

Signed-off-by: Patrick Delaunay 
Signed-off-by: Patrice Chotard 
---

 drivers/serial/Kconfig|   9 
 drivers/serial/serial_stm32.c | 105 +-
 2 files changed, 92 insertions(+), 22 deletions(-)

diff --git a/drivers/serial/Kconfig b/drivers/serial/Kconfig
index 5937910e5bf9..25ac869b0e64 100644
--- a/drivers/serial/Kconfig
+++ b/drivers/serial/Kconfig
@@ -315,6 +315,15 @@ config DEBUG_UART_MXC
  will need to provide parameters to make this work. The driver will
  be available until the real driver model serial is running.
 
+config DEBUG_UART_STM32
+   bool "STMicroelectronics STM32"
+   depends on STM32_SERIAL
+   help
+ Select this to enable a debug UART using the serial_stm32 driver
+ You will need to provide parameters to make this work.
+ The driver will be available until the real driver model
+ serial is running.
+
 config DEBUG_UART_UNIPHIER
bool "UniPhier on-chip UART"
depends on ARCH_UNIPHIER
diff --git a/drivers/serial/serial_stm32.c b/drivers/serial/serial_stm32.c
index 6717ffaaa5b9..724d6f967246 100644
--- a/drivers/serial/serial_stm32.c
+++ b/drivers/serial/serial_stm32.c
@@ -7,19 +7,21 @@
 #include 
 #include 
 #include 
-#include 
 #include 
+#include 
+#include 
 #include 
 #include "serial_stm32.h"
 
-static int stm32_serial_setbrg(struct udevice *dev, int baudrate)
+static void _stm32_serial_setbrg(fdt_addr_t base,
+struct stm32_uart_info *uart_info,
+u32 clock_rate,
+int baudrate)
 {
-   struct stm32x7_serial_platdata *plat = dev_get_platdata(dev);
-   bool stm32f4 = plat->uart_info->stm32f4;
-   fdt_addr_t base = plat->base;
+   bool stm32f4 = uart_info->stm32f4;
u32 int_div, mantissa, fraction, oversampling;
 
-   int_div = DIV_ROUND_CLOSEST(plat->clock_rate, baudrate);
+   int_div = DIV_ROUND_CLOSEST(clock_rate, baudrate);
 
if (int_div < 16) {
oversampling = 8;
@@ -33,6 +35,14 @@ static int stm32_serial_setbrg(struct udevice *dev, int 
baudrate)
fraction = int_div % oversampling;
 
writel(mantissa | fraction, base + BRR_OFFSET(stm32f4));
+}
+
+static int stm32_serial_setbrg(struct udevice *dev, int baudrate)
+{
+   struct stm32x7_serial_platdata *plat = dev_get_platdata(dev);
+
+   _stm32_serial_setbrg(plat->base, plat->uart_info,
+plat->clock_rate, baudrate);
 
return 0;
 }
@@ -58,11 +68,11 @@ static int stm32_serial_getc(struct udevice *dev)
return readl(base + RDR_OFFSET(stm32f4));
 }
 
-static int stm32_serial_putc(struct udevice *dev, const char c)
+static int _stm32_serial_putc(fdt_addr_t base,
+ struct stm32_uart_info *uart_info,
+ const char c)
 {
-   struct stm32x7_serial_platdata *plat = dev_get_platdata(dev);
-   bool stm32f4 = plat->uart_info->stm32f4;
-   fdt_addr_t base = plat->base;
+   bool stm32f4 = uart_info->stm32f4;
 
if ((readl(base + ISR_OFFSET(stm32f4)) & USART_ISR_FLAG_TXE) == 0)
return -EAGAIN;
@@ -72,6 +82,13 @@ static int stm32_serial_putc(struct udevice *dev, const char 
c)
return 0;
 }
 
+static int stm32_serial_putc(struct udevice *dev, const char c)
+{
+   struct stm32x7_serial_platdata *plat = dev_get_platdata(dev);
+
+   return _stm32_serial_putc(plat->base, plat->uart_info, c);
+}
+
 static int stm32_serial_pending(struct udevice *dev, bool input)
 {
struct stm32x7_serial_platdata *plat = dev_get_platdata(dev);
@@ -86,18 +103,28 @@ static int stm32_serial_pending(struct udevice *dev, bool 
input)
USART_ISR_FLAG_TXE ? 0 : 1;
 }
 
+static void _stm32_serial_init(fdt_addr_t base,
+  struct stm32_uart_info *uart_info)
+{
+   bool stm32f4 = uart_info->stm32f4;
+   u8 uart_enable_bit = uart_info->uart_enable_bit;
+
+   /* Disable uart-> enable fifo -> enable uart */
+   clrbits_le32(base + CR1_OFFSET(stm32f4), USART_CR1_RE | USART_CR1_TE |
+BIT(uart_enable_bit));
+   if (uart_info->has_fifo)
+   setbits_le32(base + CR1_OFFSET(stm32f4), USART_CR1_FIFOEN);
+   setbits_le32(base + CR1_OFFSET(stm32f4), USART_CR1_RE | USART_CR1_TE |
+BIT(uart_enable_bit));
+}
+
 static int stm32_serial_probe(struct udevice *dev)
 {
struct stm32x7_serial_platdata *plat = dev_get_platdata(dev);
struct clk clk;
-   fdt_addr_t base = plat->base;
int ret;
-   bool stm32f4;
-   u8 uart_enable_bit;
 
plat->uart_info = (struct stm32_uart_info *)dev_get_driver_data(dev);
-   stm32f4 = plat->uart_info->stm32f4;
-   uart_enable_b

[U-Boot] [PATCH v1 3/5] dm: serial: Add setparity

2018-05-17 Thread Patrice Chotard
From: Patrick Delaunay 

Implements serial setparity ops to allow uart parity change.
It allows to select ODD, EVEN or NONE parity.

Signed-off-by: Patrick Delaunay 
Signed-off-by: Patrice Chotard 
---

 include/serial.h | 16 
 1 file changed, 16 insertions(+)

diff --git a/include/serial.h b/include/serial.h
index 384df94ed0b3..b9ef6d91c9c5 100644
--- a/include/serial.h
+++ b/include/serial.h
@@ -67,6 +67,12 @@ extern int usbtty_tstc(void);
 
 struct udevice;
 
+enum serial_par {
+   SERIAL_PAR_NONE,
+   SERIAL_PAR_ODD,
+   SERIAL_PAR_EVEN
+};
+
 /**
  * struct struct dm_serial_ops - Driver model serial operations
  *
@@ -143,6 +149,16 @@ struct dm_serial_ops {
 */
int (*loop)(struct udevice *dev, int on);
 #endif
+   /**
+* setparity() - Set up the parity
+*
+* Set up a new parity for this device.
+*
+* @dev: Device pointer
+* @parity: parity to use
+* @return 0 if OK, -ve on error
+*/
+   int (*setparity)(struct udevice *dev, enum serial_par parity);
 };
 
 /**
-- 
1.9.1

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


[U-Boot] [PATCH v1 5/5] stm32mp1: Allow to activate CONFIG_DEBUG_UART

2018-05-17 Thread Patrice Chotard
From: Patrick Delaunay 

Add the needed information to enable the debug uart
to have printf before the serial driver probe
(so before probe for clock, pincontrol and reset drivers)

To enable the debug on uart 4 (default console):
+ CONFIG_DEBUG_UART=y
+ CONFIG_DEBUG_UART_STM32=y

Signed-off-by: Patrick Delaunay 
Signed-off-by: Patrice Chotard 
---

 arch/arm/mach-stm32mp/Kconfig  | 15 +++
 arch/arm/mach-stm32mp/cpu.c| 14 +-
 arch/arm/mach-stm32mp/include/mach/stm32.h | 12 
 board/st/stm32mp1/board.c  | 27 +++
 4 files changed, 67 insertions(+), 1 deletion(-)

diff --git a/arch/arm/mach-stm32mp/Kconfig b/arch/arm/mach-stm32mp/Kconfig
index ccbeb5c38815..abceeded24a2 100644
--- a/arch/arm/mach-stm32mp/Kconfig
+++ b/arch/arm/mach-stm32mp/Kconfig
@@ -54,4 +54,19 @@ config SYS_MMCSD_RAW_MODE_U_BOOT_PARTITION_MMC2
 
 source "board/st/stm32mp1/Kconfig"
 
+# currently activated for debug / should be deactivated for real product
+if DEBUG_UART
+
+config DEBUG_UART_BOARD_INIT
+   default y
+
+# debug on UART4 by default
+config DEBUG_UART_BASE
+   default 0x4001
+
+# clock source is HSI on reset
+config DEBUG_UART_CLOCK
+   default 6400
+endif
+
 endif
diff --git a/arch/arm/mach-stm32mp/cpu.c b/arch/arm/mach-stm32mp/cpu.c
index dfcbbd231463..2deee0961822 100644
--- a/arch/arm/mach-stm32mp/cpu.c
+++ b/arch/arm/mach-stm32mp/cpu.c
@@ -4,6 +4,7 @@
  */
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -152,6 +153,8 @@ static u32 get_bootmode(void)
  */
 int arch_cpu_init(void)
 {
+   u32 boot_mode;
+
/* early armv7 timer init: needed for polling */
timer_init();
 
@@ -160,8 +163,17 @@ int arch_cpu_init(void)
 
security_init();
 #endif
+
/* get bootmode from BootRom context: saved in TAMP register */
-   get_bootmode();
+   boot_mode = get_bootmode();
+
+   if ((boot_mode & TAMP_BOOT_DEVICE_MASK) == BOOT_SERIAL_UART)
+   gd->flags |= GD_FLG_SILENT | GD_FLG_DISABLE_CONSOLE;
+#if defined(CONFIG_DEBUG_UART) && \
+   (!defined(CONFIG_SPL) || defined(CONFIG_SPL_BUILD))
+   else
+   debug_uart_init();
+#endif
 
return 0;
 }
diff --git a/arch/arm/mach-stm32mp/include/mach/stm32.h 
b/arch/arm/mach-stm32mp/include/mach/stm32.h
index a8142013b086..129f9f558eac 100644
--- a/arch/arm/mach-stm32mp/include/mach/stm32.h
+++ b/arch/arm/mach-stm32mp/include/mach/stm32.h
@@ -17,6 +17,18 @@
 #define STM32_ETZPC_BASE   0x5C007000
 #define STM32_TAMP_BASE0x5C00A000
 
+#ifdef CONFIG_DEBUG_UART_BASE
+/* hardcoded value can be only used for DEBUG UART */
+#define STM32_USART1_BASE  0x5C00
+#define STM32_USART2_BASE  0x4000E000
+#define STM32_USART3_BASE  0x4000F000
+#define STM32_UART4_BASE   0x4001
+#define STM32_UART5_BASE   0x40011000
+#define STM32_USART6_BASE  0x44003000
+#define STM32_UART7_BASE   0x40018000
+#define STM32_UART8_BASE   0x40019000
+#endif
+
 #define STM32_SYSRAM_BASE  0x2FFC
 #define STM32_SYSRAM_SIZE  SZ_256K
 
diff --git a/board/st/stm32mp1/board.c b/board/st/stm32mp1/board.c
index 956768f04479..5f31ea99f597 100644
--- a/board/st/stm32mp1/board.c
+++ b/board/st/stm32mp1/board.c
@@ -10,6 +10,33 @@
 #include 
 #include 
 
+#ifdef CONFIG_DEBUG_UART_BOARD_INIT
+void board_debug_uart_init(void)
+{
+#if (CONFIG_DEBUG_UART_BASE == STM32_UART4_BASE)
+
+#define RCC_MP_APB1ENSETR (STM32_RCC_BASE + 0x0A00)
+#define RCC_MP_AHB4ENSETR (STM32_RCC_BASE + 0x0A28)
+
+   /* UART4 clock enable */
+   setbits_le32(RCC_MP_APB1ENSETR, BIT(16));
+
+#define GPIOG_BASE 0x50008000
+   /* GPIOG clock enable */
+   writel(BIT(6), RCC_MP_AHB4ENSETR);
+   /* GPIO configuration for EVAL board
+* => Uart4 TX = G11
+*/
+   writel(0xffbf, GPIOG_BASE + 0x00);
+   writel(0x6000, GPIOG_BASE + 0x24);
+#else
+
+#error("CONFIG_DEBUG_UART_BASE: not supported value")
+
+#endif
+}
+#endif
+
 #ifdef CONFIG_PMIC_STPMU1
 int board_ddr_power_init(void)
 {
-- 
1.9.1

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


[U-Boot] [PATCH v1 4/5] serial: stm32: Add setparity support

2018-05-17 Thread Patrice Chotard
From: Patrick Delaunay 

Add possibility to update the serial parity used.

Signed-off-by: Patrick Delaunay 
Signed-off-by: Patrice Chotard 
---

 drivers/serial/serial_stm32.c | 45 +--
 drivers/serial/serial_stm32.h |  8 
 2 files changed, 51 insertions(+), 2 deletions(-)

diff --git a/drivers/serial/serial_stm32.c b/drivers/serial/serial_stm32.c
index eeaa8ab050d9..f26234549c3e 100644
--- a/drivers/serial/serial_stm32.c
+++ b/drivers/serial/serial_stm32.c
@@ -47,6 +47,45 @@ static int stm32_serial_setbrg(struct udevice *dev, int 
baudrate)
return 0;
 }
 
+static int stm32_serial_setparity(struct udevice *dev, enum serial_par parity)
+{
+   struct stm32x7_serial_platdata *plat = dev_get_platdata(dev);
+   bool stm32f4 = plat->uart_info->stm32f4;
+   u8 uart_enable_bit = plat->uart_info->uart_enable_bit;
+   u32 cr1 = plat->base + CR1_OFFSET(stm32f4);
+   u32 config = 0;
+
+   if (stm32f4)
+   return -EINVAL; /* not supported in driver*/
+
+   clrbits_le32(cr1, USART_CR1_RE | USART_CR1_TE | BIT(uart_enable_bit));
+   /* update usart configuration (uart need to be disable)
+* PCE: parity check control
+* PS : '0' : Even / '1' : Odd
+* M[1:0] = '00' : 8 Data bits
+* M[1:0] = '01' : 9 Data bits with parity
+*/
+   switch (parity) {
+   default:
+   case SERIAL_PAR_NONE:
+   config = 0;
+   break;
+   case SERIAL_PAR_ODD:
+   config = USART_CR1_PCE | USART_CR1_PS | USART_CR1_M0;
+   break;
+   case SERIAL_PAR_EVEN:
+   config = USART_CR1_PCE | USART_CR1_M0;
+   break;
+   }
+   clrsetbits_le32(cr1,
+   USART_CR1_PCE | USART_CR1_PS | USART_CR1_M1 |
+   USART_CR1_M0,
+   config);
+   setbits_le32(cr1, USART_CR1_RE | USART_CR1_TE | BIT(uart_enable_bit));
+
+   return 0;
+}
+
 static int stm32_serial_getc(struct udevice *dev)
 {
struct stm32x7_serial_platdata *plat = dev_get_platdata(dev);
@@ -57,9 +96,10 @@ static int stm32_serial_getc(struct udevice *dev)
if ((isr & USART_ISR_RXNE) == 0)
return -EAGAIN;
 
-   if (isr & (USART_ISR_ORE)) {
+   if (isr & (USART_ISR_PE | USART_ISR_ORE)) {
if (!stm32f4)
-   setbits_le32(base + ICR_OFFSET, USART_ICR_ORECF);
+   setbits_le32(base + ICR_OFFSET,
+USART_ICR_PCECF | USART_ICR_ORECF);
else
readl(base + RDR_OFFSET(stm32f4));
return -EIO;
@@ -170,6 +210,7 @@ static const struct dm_serial_ops stm32_serial_ops = {
.pending = stm32_serial_pending,
.getc = stm32_serial_getc,
.setbrg = stm32_serial_setbrg,
+   .setparity = stm32_serial_setparity
 };
 
 U_BOOT_DRIVER(serial_stm32) = {
diff --git a/drivers/serial/serial_stm32.h b/drivers/serial/serial_stm32.h
index c478e3507020..ccafa31219a1 100644
--- a/drivers/serial/serial_stm32.h
+++ b/drivers/serial/serial_stm32.h
@@ -13,6 +13,7 @@
 #define ISR_OFFSET(x)  (x ? 0x00 : 0x1c)
 
 #define ICR_OFFSET 0x20
+
 /*
  * STM32F4 has one Data Register (DR) for received or transmitted
  * data, so map Receive Data Register (RDR) and Transmit Data
@@ -53,7 +54,11 @@ struct stm32x7_serial_platdata {
 };
 
 #define USART_CR1_FIFOEN   BIT(29)
+#define USART_CR1_M1   BIT(28)
 #define USART_CR1_OVER8BIT(15)
+#define USART_CR1_M0   BIT(12)
+#define USART_CR1_PCE  BIT(10)
+#define USART_CR1_PS   BIT(9)
 #define USART_CR1_TE   BIT(3)
 #define USART_CR1_RE   BIT(2)
 
@@ -62,10 +67,13 @@ struct stm32x7_serial_platdata {
 #define USART_ISR_TXE  BIT(7)
 #define USART_ISR_RXNE BIT(5)
 #define USART_ISR_ORE  BIT(3)
+#define USART_ISR_PE   BIT(0)
 
 #define USART_BRR_F_MASK   GENMASK(7, 0)
 #define USART_BRR_M_SHIFT  4
 #define USART_BRR_M_MASK   GENMASK(15, 4)
 
 #define USART_ICR_ORECFBIT(3)
+#define USART_ICR_PCECFBIT(0)
+
 #endif
-- 
1.9.1

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


Re: [U-Boot] RFC: Alternative boot_jump_linux() function

2018-05-17 Thread Ramon Fried
On Thu, May 17, 2018 at 2:48 PM, Peter Robinson  wrote:
> Hi,
>
>> I'm currently working on snapdragon bootloader support and in the
>> particular case where U-boot is running in Aarch32 and the kernel is
>> Aarch64 the specific implementation is to jump to Linux through SCM
>> call.
>
> I seem to remember the Allwinner A64 Pine64 starts in 32 bit mode and
> switches too so you might get some ideas from there or the maintainer
> might have some suggestions.
Hi Peter.
Thanks for the tip.

I looked at the code, it appears that the Pine64 starts in 32bit SPL and jumps
to U-boot in 64bit mode.
This is done in a way which is not compatible with Snapdragons.
Although it's possible to implement Snapdragon with SPL, but I think it's an
overhead and I generally prefer just to run U-boot completely in 32bit mode.

Thanks,
Ramon.

>
>> I try to find the best possible way to provide an alternative boot function.
>> Adding #ifdef ARCH_SNAPDRAGON will just be too specific in
>> arm/lib/bootm.c in my opinion and I'm thinking of introducing kind of
>> a callback function in gd. that if exists will jump there instead of
>> executing boot_jump_linux().
>>
>> What do you think ?
>>
>> Waiting for your thoughts on the subject.
>>
>> Warm regards,
>> Ramon.
>> ___
>> 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


[U-Boot] [PATCH v1 1/4] stm32mp1: remove the second TAMP_BOOT_CONTEXT update

2018-05-17 Thread Patrice Chotard
From: Patrick Delaunay 

The register TAMP_BOOT_CONTEXT is already updated in
get_bootmode() in cpu.c and no need to be done
twice.

Signed-off-by: Patrick Delaunay 
Signed-off-by: Patrice Chotard 
---

 arch/arm/mach-stm32mp/spl.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/arch/arm/mach-stm32mp/spl.c b/arch/arm/mach-stm32mp/spl.c
index b56f0c5381c3..790973e8b6e9 100644
--- a/arch/arm/mach-stm32mp/spl.c
+++ b/arch/arm/mach-stm32mp/spl.c
@@ -14,9 +14,6 @@ u32 spl_boot_device(void)
 
boot_mode = (readl(TAMP_BOOT_CONTEXT) & TAMP_BOOT_MODE_MASK) >>
TAMP_BOOT_MODE_SHIFT;
-   clrsetbits_le32(TAMP_BOOT_CONTEXT,
-   TAMP_BOOT_MODE_MASK,
-   boot_mode << TAMP_BOOT_MODE_SHIFT);
 
switch (boot_mode) {
case BOOT_FLASH_SD_1:
-- 
1.9.1

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


[U-Boot] [PATCH v1 0/4] Update STM32MP1 machine

2018-05-17 Thread Patrice Chotard

This series :
  _ fixes TAMP_BOOT_CONTEXT which is updated twice
  _ adds bsec IP driver (Boot and Security and OTP control)
  _ adds FUSE command support
  _ updates machine to use OTP to store MAC address and serial number


Patrick Delaunay (4):
  stm32mp1: remove the second TAMP_BOOT_CONTEXT update
  stm32mp1: add bsec driver
  stm32mp1: add FUSE command support
  stm32mp1: use OTP to configure MAC address and serial number

 MAINTAINERS|   1 +
 arch/arm/Kconfig   |   1 +
 arch/arm/mach-stm32mp/Makefile |   8 +-
 arch/arm/mach-stm32mp/bsec.c   | 431 +
 arch/arm/mach-stm32mp/cpu.c|  81 ++
 arch/arm/mach-stm32mp/include/mach/stm32.h |   5 +
 arch/arm/mach-stm32mp/spl.c|   3 -
 configs/stm32mp15_basic_defconfig  |   1 +
 drivers/misc/Kconfig   |   9 +
 drivers/misc/Makefile  |   1 +
 drivers/misc/stm32mp_fuse.c| 116 
 11 files changed, 652 insertions(+), 5 deletions(-)
 create mode 100644 arch/arm/mach-stm32mp/bsec.c
 create mode 100644 drivers/misc/stm32mp_fuse.c

-- 
1.9.1

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


[U-Boot] [PATCH v1 2/4] stm32mp1: add bsec driver

2018-05-17 Thread Patrice Chotard
From: Patrick Delaunay 

Add a MISC driver with read and write access to BSEC IP
(Boot and Security and OTP control)
- offset 0: shadowed values
- offset 0x8000: OTP fuse box values (SAFMEM)

Signed-off-by: Patrick Delaunay 
Signed-off-by: Patrice Chotard 
---

 arch/arm/mach-stm32mp/Makefile |   8 +-
 arch/arm/mach-stm32mp/bsec.c   | 431 +
 arch/arm/mach-stm32mp/include/mach/stm32.h |   5 +
 3 files changed, 442 insertions(+), 2 deletions(-)
 create mode 100644 arch/arm/mach-stm32mp/bsec.c

diff --git a/arch/arm/mach-stm32mp/Makefile b/arch/arm/mach-stm32mp/Makefile
index 08ee642d9086..f59ced5ee1b1 100644
--- a/arch/arm/mach-stm32mp/Makefile
+++ b/arch/arm/mach-stm32mp/Makefile
@@ -1,4 +1,4 @@
-# SPDX-License-Identifier: GPL-2.0+ OR BSD-3-Clause
+# SPDX-License-Identifier: GPL-2.0+
 #
 # Copyright (C) 2018, STMicroelectronics - All Rights Reserved
 #
@@ -7,6 +7,10 @@ obj-y += cpu.o
 obj-y += dram_init.o
 obj-y += syscon.o
 
-obj-$(CONFIG_SPL_BUILD) += spl.o
+ifdef CONFIG_SPL_BUILD
+obj-y += spl.o
+else
+obj-y += bsec.o
+endif
 obj-$(CONFIG_ARMV7_PSCI) += psci.o
 obj-$(CONFIG_$(SPL_)DM_REGULATOR) += pwr_regulator.o
diff --git a/arch/arm/mach-stm32mp/bsec.c b/arch/arm/mach-stm32mp/bsec.c
new file mode 100644
index ..0e152efc045f
--- /dev/null
+++ b/arch/arm/mach-stm32mp/bsec.c
@@ -0,0 +1,431 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright (C) 2018, STMicroelectronics - All Rights Reserved
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#define BSEC_OTP_MAX_VALUE 95
+
+#define BSEC_TIMEOUT_US1
+
+/* BSEC REGISTER OFFSET (base relative) */
+#define BSEC_OTP_CONF_OFF  0x000
+#define BSEC_OTP_CTRL_OFF  0x004
+#define BSEC_OTP_WRDATA_OFF0x008
+#define BSEC_OTP_STATUS_OFF0x00C
+#define BSEC_OTP_LOCK_OFF  0x010
+#define BSEC_DISTURBED_OFF 0x01C
+#define BSEC_ERROR_OFF 0x034
+#define BSEC_SPLOCK_OFF0x064 /* Program safmem sticky 
lock */
+#define BSEC_SWLOCK_OFF0x07C /* write in OTP sticky 
lock */
+#define BSEC_SRLOCK_OFF0x094 /* shadowing sticky lock 
*/
+#define BSEC_OTP_DATA_OFF  0x200
+
+/* BSEC_CONFIGURATION Register MASK */
+#define BSEC_CONF_POWER_UP 0x001
+
+/* BSEC_CONTROL Register */
+#define BSEC_READ  0x000
+#define BSEC_WRITE 0x100
+
+/* LOCK Register */
+#define OTP_LOCK_MASK  0x1F
+#define OTP_LOCK_BANK_SHIFT0x05
+#define OTP_LOCK_BIT_MASK  0x01
+
+/* STATUS Register */
+#define BSEC_MODE_BUSY_MASK0x08
+#define BSEC_MODE_PROGFAIL_MASK0x10
+#define BSEC_MODE_PWR_MASK 0x20
+
+/*
+ * OTP Lock services definition
+ * Value must corresponding to the bit number in the register
+ */
+#define BSEC_LOCK_PROGRAM  0x04
+
+/**
+ * bsec_check_error() - Check status of one otp
+ * @base: base address of bsec IP
+ * @otp: otp number (0 - BSEC_OTP_MAX_VALUE)
+ * Return: 0 if no error, -EAGAIN or -ENOTSUPP
+ */
+static u32 bsec_check_error(u32 base, u32 otp)
+{
+   u32 bit;
+   u32 bank;
+
+   bit = 1 << (otp & OTP_LOCK_MASK);
+   bank = ((otp >> OTP_LOCK_BANK_SHIFT) & OTP_LOCK_MASK) * sizeof(u32);
+
+   if (readl(base + BSEC_DISTURBED_OFF + bank) & bit)
+   return -EAGAIN;
+   else if (readl(base + BSEC_ERROR_OFF + bank) & bit)
+   return -ENOTSUPP;
+
+   return 0;
+}
+
+/**
+ * bsec_lock() - manage lock for each type SR/SP/SW
+ * @address: address of bsec IP register
+ * @otp: otp number (0 - BSEC_OTP_MAX_VALUE)
+ * Return: true if locked else false
+ */
+static bool bsec_read_lock(u32 address, u32 otp)
+{
+   u32 bit;
+   u32 bank;
+
+   bit = 1 << (otp & OTP_LOCK_MASK);
+   bank = ((otp >> OTP_LOCK_BANK_SHIFT) & OTP_LOCK_MASK) * sizeof(u32);
+
+   return !!(readl(address + bank) & bit);
+}
+
+/**
+ * bsec_read_SR_lock() - read SR lock (Shadowing)
+ * @base: base address of bsec IP
+ * @otp: otp number (0 - BSEC_OTP_MAX_VALUE)
+ * Return: true if locked else false
+ */
+static bool bsec_read_SR_lock(u32 base, u32 otp)
+{
+   return bsec_read_lock(base + BSEC_SRLOCK_OFF, otp);
+}
+
+/**
+ * bsec_read_SP_lock() - read SP lock (program Lock)
+ * @base: base address of bsec IP
+ * @otp: otp number (0 - BSEC_OTP_MAX_VALUE)
+ * Return: true if locked else false
+ */
+static bool bsec_read_SP_lock(u32 base, u32 otp)
+{
+   return bsec_read_lock(base + BSEC_SPLOCK_OFF, otp);
+}
+
+/**
+ * bsec_SW_lock() - manage SW lock (Write in Shadow)
+ * @base: base address of bsec IP
+ * @otp: otp number (0 - BSEC_OTP_MAX_VALUE)
+ * Return: true if locked else false
+ */
+static bool bsec_read_SW_lock(u32 base, u32 otp)
+{
+   return bsec_read_lock(base + BSEC_SWLOCK_OFF, otp);
+}
+
+/**
+ * bsec_power_safm

[U-Boot] [PATCH v1 3/4] stm32mp1: add FUSE command support

2018-05-17 Thread Patrice Chotard
From: Patrick Delaunay 

Add support of fuse command (read/write/program/sense)
on bank 0 to access to BSEC SAFMEM (4096 OTP bits).

Signed-off-by: Patrick Delaunay 
Signed-off-by: Patrice Chotard 
---

 MAINTAINERS   |   1 +
 arch/arm/Kconfig  |   1 +
 configs/stm32mp15_basic_defconfig |   1 +
 drivers/misc/Kconfig  |   9 +++
 drivers/misc/Makefile |   1 +
 drivers/misc/stm32mp_fuse.c   | 116 ++
 6 files changed, 129 insertions(+)
 create mode 100644 drivers/misc/stm32mp_fuse.c

diff --git a/MAINTAINERS b/MAINTAINERS
index 5670917b41b9..3209dcd31844 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -204,6 +204,7 @@ M:  Patrick Delaunay 
 S: Maintained
 F: arch/arm/mach-stm32mp
 F: drivers/clk/clk_stm32mp1.c
+F: drivers/misc/stm32mp_fuse.c
 F: drivers/ram/stm32mp1/
 
 ARM STM STV0991
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index c9d6e0a42418..5bd6749309b7 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -1214,6 +1214,7 @@ config ARCH_STM32MP
select DM_SERIAL
select OF_CONTROL
select OF_LIBFDT
+   select MISC
select PINCTRL
select REGMAP
select SUPPORT_SPL
diff --git a/configs/stm32mp15_basic_defconfig 
b/configs/stm32mp15_basic_defconfig
index b1c3690c0094..9e43cc969850 100644
--- a/configs/stm32mp15_basic_defconfig
+++ b/configs/stm32mp15_basic_defconfig
@@ -18,6 +18,7 @@ CONFIG_SYS_PROMPT="STM32MP> "
 # CONFIG_CMD_EXPORTENV is not set
 # CONFIG_CMD_IMPORTENV is not set
 CONFIG_CMD_MEMINFO=y
+CONFIG_CMD_FUSE=y
 CONFIG_CMD_GPIO=y
 CONFIG_CMD_GPT=y
 CONFIG_CMD_I2C=y
diff --git a/drivers/misc/Kconfig b/drivers/misc/Kconfig
index be900cf4d6ec..17b3a805a2d5 100644
--- a/drivers/misc/Kconfig
+++ b/drivers/misc/Kconfig
@@ -158,6 +158,15 @@ config PCA9551_I2C_ADDR
help
  The I2C address of the PCA9551 LED controller.
 
+config STM32MP_FUSE
+   bool "Enable STM32MP fuse wrapper providing the fuse API"
+   depends on ARCH_STM32MP && MISC
+   default y if CMD_FUSE
+   help
+ If you say Y here, you will get support for the fuse API (OTP)
+ for STM32MP architecture.
+ This API is needed for CMD_FUSE.
+
 config STM32_RCC
bool "Enable RCC driver for the STM32 SoC's family"
depends on STM32 && MISC
diff --git a/drivers/misc/Makefile b/drivers/misc/Makefile
index e362609d62a4..4ce9d213f06f 100644
--- a/drivers/misc/Makefile
+++ b/drivers/misc/Makefile
@@ -51,5 +51,6 @@ obj-$(CONFIG_WINBOND_W83627) += winbond_w83627.o
 obj-$(CONFIG_QFW) += qfw.o
 obj-$(CONFIG_ROCKCHIP_EFUSE) += rockchip-efuse.o
 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
diff --git a/drivers/misc/stm32mp_fuse.c b/drivers/misc/stm32mp_fuse.c
new file mode 100644
index ..2d661351a17c
--- /dev/null
+++ b/drivers/misc/stm32mp_fuse.c
@@ -0,0 +1,116 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright (C) 2018, STMicroelectronics - All Rights Reserved
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#define STM32MP_OTP_BANK   0
+
+/*
+ * The 'fuse' command API
+ */
+int fuse_read(u32 bank, u32 word, u32 *val)
+{
+   int ret = 0;
+   struct udevice *dev;
+
+   switch (bank) {
+   case STM32MP_OTP_BANK:
+   ret = uclass_get_device_by_driver(UCLASS_MISC,
+ DM_GET_DRIVER(stm32mp_bsec),
+ &dev);
+   if (ret)
+   return ret;
+   ret = misc_read(dev, word * 4 + STM32_BSEC_SHADOW_OFFSET,
+   val, 4);
+   break;
+
+   default:
+   printf("stm32mp %s: wrong value for bank %i\n", __func__, bank);
+   ret = -EINVAL;
+   break;
+   }
+
+   return ret;
+}
+
+int fuse_prog(u32 bank, u32 word, u32 val)
+{
+   struct udevice *dev;
+   int ret;
+
+   switch (bank) {
+   case STM32MP_OTP_BANK:
+   ret = uclass_get_device_by_driver(UCLASS_MISC,
+ DM_GET_DRIVER(stm32mp_bsec),
+ &dev);
+   if (ret)
+   return ret;
+   ret = misc_write(dev, word * 4 + STM32_BSEC_OTP_OFFSET,
+&val, 4);
+   break;
+
+   default:
+   printf("stm32mp %s: wrong value for bank %i\n", __func__, bank);
+   ret = -EINVAL;
+   break;
+   }
+
+   return ret;
+}
+
+int fuse_sense(u32 bank, u32 word, u32 *val)
+{
+   struct udevice *dev;
+   int ret;
+
+   switch (bank) {
+   case STM32MP_OTP_BANK:
+   ret = uclass_get_device_by_driver(UCLAS

[U-Boot] [PATCH v1 4/4] stm32mp1: use OTP to configure MAC address and serial number

2018-05-17 Thread Patrice Chotard
From: Patrick Delaunay 

Use OTP57 and 58 for MAC address
- OTP57 = MAC address  bits [31:0]
- OTP58 = MAC address  bit  [47:32] stored in OTP  LSB's

Use manufacture information in OTP13 to OTP15 to build unique
chip id saved in env variable "serial#"
(used for USB device enumeration)

Signed-off-by: Patrick Delaunay 
Signed-off-by: Patrice Chotard 
---

 arch/arm/mach-stm32mp/cpu.c | 81 +
 1 file changed, 81 insertions(+)

diff --git a/arch/arm/mach-stm32mp/cpu.c b/arch/arm/mach-stm32mp/cpu.c
index 2deee0961822..0e01f8e61385 100644
--- a/arch/arm/mach-stm32mp/cpu.c
+++ b/arch/arm/mach-stm32mp/cpu.c
@@ -5,9 +5,12 @@
 #include 
 #include 
 #include 
+#include 
+#include 
 #include 
 #include 
 #include 
+#include 
 #include 
 
 /* RCC register */
@@ -51,6 +54,10 @@
 #define BOOTROM_INSTANCE_MASK   GENMASK(31, 16)
 #define BOOTROM_INSTANCE_SHIFT 16
 
+/* BSEC OTP index */
+#define BSEC_OTP_SERIAL13
+#define BSEC_OTP_MAC   57
+
 #if !defined(CONFIG_SPL) || defined(CONFIG_SPL_BUILD)
 static void security_init(void)
 {
@@ -274,9 +281,83 @@ static void setup_boot_mode(void)
}
 }
 
+/*
+ * If there is no MAC address in the environment, then it will be initialized
+ * (silently) from the value in the OTP.
+ */
+static int setup_mac_address(void)
+{
+#if defined(CONFIG_NET)
+   int ret;
+   int i;
+   u32 otp[2];
+   uchar enetaddr[6];
+   struct udevice *dev;
+
+   /* MAC already in environment */
+   if (eth_env_get_enetaddr("ethaddr", enetaddr))
+   return 0;
+
+   ret = uclass_get_device_by_driver(UCLASS_MISC,
+ DM_GET_DRIVER(stm32mp_bsec),
+ &dev);
+   if (ret)
+   return ret;
+
+   ret = misc_read(dev, BSEC_OTP_MAC * 4 + STM32_BSEC_OTP_OFFSET,
+   otp, sizeof(otp));
+   if (ret)
+   return ret;
+
+   for (i = 0; i < 6; i++)
+   enetaddr[i] = ((uint8_t *)&otp)[i];
+
+   if (!is_valid_ethaddr(enetaddr)) {
+   pr_err("invalid MAC address in OTP %pM", enetaddr);
+   return -EINVAL;
+   }
+   pr_debug("OTP MAC address = %pM\n", enetaddr);
+   ret = !eth_env_set_enetaddr("ethaddr", enetaddr);
+   if (!ret)
+   pr_err("Failed to set mac address %pM from OTP: %d\n",
+  enetaddr, ret);
+#endif
+
+   return 0;
+}
+
+static int setup_serial_number(void)
+{
+   char serial_string[25];
+   u32 otp[3] = {0, 0, 0 };
+   struct udevice *dev;
+   int ret;
+
+   if (env_get("serial#"))
+   return 0;
+
+   ret = uclass_get_device_by_driver(UCLASS_MISC,
+ DM_GET_DRIVER(stm32mp_bsec),
+ &dev);
+   if (ret)
+   return ret;
+
+   ret = misc_read(dev, BSEC_OTP_SERIAL * 4 + STM32_BSEC_OTP_OFFSET,
+   otp, sizeof(otp));
+   if (ret)
+   return ret;
+
+   sprintf(serial_string, "%08x%08x%08x", otp[0], otp[1], otp[2]);
+   env_set("serial#", serial_string);
+
+   return 0;
+}
+
 int arch_misc_init(void)
 {
setup_boot_mode();
+   setup_mac_address();
+   setup_serial_number();
 
return 0;
 }
-- 
1.9.1

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


[U-Boot] [PATCH] arm64: zynqmp: Show reset reason

2018-05-17 Thread Michal Simek
Read reset reason reg and show it in log and also save it as variable.
reset_reasons table is setting up priorities for variable.

Signed-off-by: Michal Simek 
---

 arch/arm/include/asm/arch-zynqmp/hardware.h | 12 +-
 board/xilinx/zynqmp/zynqmp.c| 43 +
 2 files changed, 54 insertions(+), 1 deletion(-)

diff --git a/arch/arm/include/asm/arch-zynqmp/hardware.h 
b/arch/arm/include/asm/arch-zynqmp/hardware.h
index 3f1f9498e356..7961a247e196 100644
--- a/arch/arm/include/asm/arch-zynqmp/hardware.h
+++ b/arch/arm/include/asm/arch-zynqmp/hardware.h
@@ -33,6 +33,14 @@
 #define PS_MODE2   BIT(2)
 #define PS_MODE3   BIT(3)
 
+#define RESET_REASON_DEBUG_SYS BIT(6)
+#define RESET_REASON_SOFT  BIT(5)
+#define RESET_REASON_SRST  BIT(4)
+#define RESET_REASON_PSONLYBIT(3)
+#define RESET_REASON_PMU   BIT(2)
+#define RESET_REASON_INTERNAL  BIT(1)
+#define RESET_REASON_EXTERNAL  BIT(0)
+
 struct crlapb_regs {
u32 reserved0[36];
u32 cpu_r5_ctrl; /* 0x90 */
@@ -40,7 +48,9 @@ struct crlapb_regs {
u32 timestamp_ref_ctrl; /* 0x128 */
u32 reserved2[53];
u32 boot_mode; /* 0x200 */
-   u32 reserved3[14];
+   u32 reserved3_0[7];
+   u32 reset_reason; /* 0x220 */
+   u32 reserved3_1[6];
u32 rst_lpd_top; /* 0x23C */
u32 reserved4[4];
u32 boot_pin_ctrl; /* 0x250 */
diff --git a/board/xilinx/zynqmp/zynqmp.c b/board/xilinx/zynqmp/zynqmp.c
index 551921b888a0..4d886a914fa9 100644
--- a/board/xilinx/zynqmp/zynqmp.c
+++ b/board/xilinx/zynqmp/zynqmp.c
@@ -476,6 +476,47 @@ static int create_mmc_boot_commands(void)
return 0;
 }
 
+static const struct {
+   u32 bit;
+   const char *name;
+} reset_reasons[] = {
+   { RESET_REASON_EXTERNAL, "EXTERNAL" },
+   { RESET_REASON_INTERNAL, "INTERNAL" },
+   { RESET_REASON_SOFT, "SOFT" },
+   { RESET_REASON_PSONLY, "PS-ONLY" },
+   { RESET_REASON_SRST, "SRST" },
+   { RESET_REASON_PMU, "PMU" },
+   { RESET_REASON_DEBUG_SYS, "DEBUG" },
+   {}
+};
+
+static u32 reset_reason(bool print)
+{
+   u32 ret;
+   int i;
+   const char *reason = NULL;
+
+   ret = readl(&crlapb_base->reset_reason);
+
+   if (print)
+   puts("Reset reason:\t");
+
+   for (i = 0; i < ARRAY_SIZE(reset_reasons); i++) {
+   if (ret & reset_reasons[i].bit) {
+   reason = reset_reasons[i].name;
+   if (print)
+   printf("%s ", reset_reasons[i].name);
+   }
+   }
+
+   if (print)
+   puts("\n");
+
+   env_set("reset_reason", reason);
+
+   return ret;
+}
+
 int board_late_init(void)
 {
u32 reg = 0;
@@ -593,6 +634,8 @@ int board_late_init(void)
 
env_set("boot_targets", new_targets);
 
+   reset_reason(true);
+
return 0;
 }
 
-- 
2.17.0

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


Re: [U-Boot] [PATCH] soc: zynqmp: Update required API version to 1.0

2018-05-17 Thread Michal Simek
On 14.5.2018 22:55, Marek Vasut wrote:
> On 05/14/2018 03:39 PM, Michal Simek wrote:
>> From: Rajan Vaja 
>>
>> Existing EEMI version is to as 1.0 (available from xilinx v2018.1
>> version). Update required API version to match with EEMI API version.
> 
> Not sure I understand this sentence.

PMUFW contains EEMI api which has also changed and the biggest reason
for bumping up PMUFW version were changes in EEMI api. And these
versions are also aligned.

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


Re: [U-Boot] [PATCH] soc: zynqmp: Update required API version to 1.0

2018-05-17 Thread Marek Vasut
On 05/17/2018 03:59 PM, Michal Simek wrote:
> On 14.5.2018 22:55, Marek Vasut wrote:
>> On 05/14/2018 03:39 PM, Michal Simek wrote:
>>> From: Rajan Vaja 
>>>
>>> Existing EEMI version is to as 1.0 (available from xilinx v2018.1
>>> version). Update required API version to match with EEMI API version.
>>
>> Not sure I understand this sentence.
> 
> PMUFW contains EEMI api which has also changed and the biggest reason
> for bumping up PMUFW version were changes in EEMI api. And these
> versions are also aligned.

So uh, the meta-xilinx 2018.1 release which contains pmufw 2017.3 uses
the new API 1.0 , while meta-xilinx 2018.1 release which contains pmufw
2017.3 as well does not use the API 1.0 ? I think the versioning is a
complete CF then ...

-- 
Best regards,
Marek Vasut
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH] arm64: zynqmp: Show reset reason

2018-05-17 Thread Michal Simek
On 17.5.2018 15:31, Michal Simek wrote:
> Read reset reason reg and show it in log and also save it as variable.
> reset_reasons table is setting up priorities for variable.
> 
> Signed-off-by: Michal Simek 
> ---
> 
>  arch/arm/include/asm/arch-zynqmp/hardware.h | 12 +-
>  board/xilinx/zynqmp/zynqmp.c| 43 +
>  2 files changed, 54 insertions(+), 1 deletion(-)
> 
> diff --git a/arch/arm/include/asm/arch-zynqmp/hardware.h 
> b/arch/arm/include/asm/arch-zynqmp/hardware.h
> index 3f1f9498e356..7961a247e196 100644
> --- a/arch/arm/include/asm/arch-zynqmp/hardware.h
> +++ b/arch/arm/include/asm/arch-zynqmp/hardware.h
> @@ -33,6 +33,14 @@
>  #define PS_MODE2 BIT(2)
>  #define PS_MODE3 BIT(3)
>  
> +#define RESET_REASON_DEBUG_SYS   BIT(6)
> +#define RESET_REASON_SOFTBIT(5)
> +#define RESET_REASON_SRSTBIT(4)
> +#define RESET_REASON_PSONLY  BIT(3)
> +#define RESET_REASON_PMU BIT(2)
> +#define RESET_REASON_INTERNALBIT(1)
> +#define RESET_REASON_EXTERNALBIT(0)
> +
>  struct crlapb_regs {
>   u32 reserved0[36];
>   u32 cpu_r5_ctrl; /* 0x90 */
> @@ -40,7 +48,9 @@ struct crlapb_regs {
>   u32 timestamp_ref_ctrl; /* 0x128 */
>   u32 reserved2[53];
>   u32 boot_mode; /* 0x200 */
> - u32 reserved3[14];
> + u32 reserved3_0[7];
> + u32 reset_reason; /* 0x220 */
> + u32 reserved3_1[6];
>   u32 rst_lpd_top; /* 0x23C */
>   u32 reserved4[4];
>   u32 boot_pin_ctrl; /* 0x250 */
> diff --git a/board/xilinx/zynqmp/zynqmp.c b/board/xilinx/zynqmp/zynqmp.c
> index 551921b888a0..4d886a914fa9 100644
> --- a/board/xilinx/zynqmp/zynqmp.c
> +++ b/board/xilinx/zynqmp/zynqmp.c
> @@ -476,6 +476,47 @@ static int create_mmc_boot_commands(void)
>   return 0;
>  }
>  
> +static const struct {
> + u32 bit;
> + const char *name;
> +} reset_reasons[] = {
> + { RESET_REASON_EXTERNAL, "EXTERNAL" },
> + { RESET_REASON_INTERNAL, "INTERNAL" },
> + { RESET_REASON_SOFT, "SOFT" },
> + { RESET_REASON_PSONLY, "PS-ONLY" },
> + { RESET_REASON_SRST, "SRST" },
> + { RESET_REASON_PMU, "PMU" },
> + { RESET_REASON_DEBUG_SYS, "DEBUG" },
> + {}
> +};
> +
> +static u32 reset_reason(bool print)
> +{
> + u32 ret;
> + int i;
> + const char *reason = NULL;
> +
> + ret = readl(&crlapb_base->reset_reason);
> +
> + if (print)
> + puts("Reset reason:\t");
> +
> + for (i = 0; i < ARRAY_SIZE(reset_reasons); i++) {
> + if (ret & reset_reasons[i].bit) {
> + reason = reset_reasons[i].name;
> + if (print)
> + printf("%s ", reset_reasons[i].name);
> + }
> + }
> +
> + if (print)
> + puts("\n");
> +
> + env_set("reset_reason", reason);

Here should be this line to clear status after read.
 writel(~0, &crlapb_base->reset_reason);


Will add it to v2 when this concept is approved.

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


Re: [U-Boot] [PATCH v2] net: MVGBE don't automatically select PHYLIB

2018-05-17 Thread Tom Rini
On Fri, May 18, 2018 at 12:12:04AM +1200, Chris Packham wrote:

> When Kconfig support was added for MVGBE it included automatically
> selected PHYLIB support. But MVGBE does not need PHYLIB it will build
> fine without it. Commit ed52ea507f12 ("net: add Kconfig for MVGBE")
> should have been a no-op in terms of build size but because of the
> selecting PHYLIB the openrd configs increased in size.
> 
> Remove the automatic selection of PHYLIB, boards that need it will have
> already enabled it in their config header file.
> 
> Fixes: commit ed52ea507f12 ("net: add Kconfig for MVGBE")
> Signed-off-by: Chris Packham 

Reviewed-by: Tom Rini 

-- 
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] RFC: Alternative boot_jump_linux() function

2018-05-17 Thread Tom Rini
On Thu, May 17, 2018 at 02:01:55PM +0300, Ramon Fried wrote:

> Hi.
> I'm currently working on snapdragon bootloader support and in the
> particular case where U-boot is running in Aarch32 and the kernel is
> Aarch64 the specific implementation is to jump to Linux through SCM
> call.
> 
> I try to find the best possible way to provide an alternative boot function.
> Adding #ifdef ARCH_SNAPDRAGON will just be too specific in
> arm/lib/bootm.c in my opinion and I'm thinking of introducing kind of
> a callback function in gd. that if exists will jump there instead of
> executing boot_jump_linux().
> 
> What do you think ?

So, to be clear, we're on an aarch64 SoC, but U-Boot has been entered in
32bit mode.  And we need to boot a 64bit Linux Kernel.  What else, if
anything, is also loaded/still in residence/etc?  Can you explain the
overall usecase a bit more and why we're in 32bit mode?  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] mmc: stm32_sdmmc2: Fix stm32_sdmmc2_start_cmd()

2018-05-17 Thread Patrice Chotard
SDMMC_CMD_CPSMEN bit is wrongly check and set in
SDMMC_ARG register instead of SDMMC_CMD register.

Signed-off-by: Patrice Chotard 
---

 drivers/mmc/stm32_sdmmc2.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/mmc/stm32_sdmmc2.c b/drivers/mmc/stm32_sdmmc2.c
index a0224ca3909c..ae0af48ef330 100644
--- a/drivers/mmc/stm32_sdmmc2.c
+++ b/drivers/mmc/stm32_sdmmc2.c
@@ -238,8 +238,8 @@ static void stm32_sdmmc2_start_data(struct 
stm32_sdmmc2_priv *priv,
 static void stm32_sdmmc2_start_cmd(struct stm32_sdmmc2_priv *priv,
   struct mmc_cmd *cmd, u32 cmd_param)
 {
-   if (readl(priv->base + SDMMC_ARG) & SDMMC_CMD_CPSMEN)
-   writel(0, priv->base + SDMMC_ARG);
+   if (readl(priv->base + SDMMC_CMD) & SDMMC_CMD_CPSMEN)
+   writel(0, priv->base + SDMMC_CMD);
 
cmd_param |= cmd->cmdidx | SDMMC_CMD_CPSMEN;
if (cmd->resp_type & MMC_RSP_PRESENT) {
-- 
1.9.1

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


Re: [U-Boot] [PATCH v2] net: MVGBE don't automatically select PHYLIB

2018-05-17 Thread Joe Hershberger
On Thu, May 17, 2018 at 7:12 AM, Chris Packham  wrote:
> When Kconfig support was added for MVGBE it included automatically
> selected PHYLIB support. But MVGBE does not need PHYLIB it will build
> fine without it. Commit ed52ea507f12 ("net: add Kconfig for MVGBE")
> should have been a no-op in terms of build size but because of the
> selecting PHYLIB the openrd configs increased in size.
>
> Remove the automatic selection of PHYLIB, boards that need it will have
> already enabled it in their config header file.
>
> Fixes: commit ed52ea507f12 ("net: add Kconfig for MVGBE")
> Signed-off-by: Chris Packham 

Acked-by: Joe Hershberger 

Stefan, feel free to pull this through your branch.

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


Re: [U-Boot] [PATCH v2] net: MVGBE don't automatically select PHYLIB

2018-05-17 Thread Stefan Roese

On 17.05.2018 17:30, Joe Hershberger wrote:

On Thu, May 17, 2018 at 7:12 AM, Chris Packham  wrote:

When Kconfig support was added for MVGBE it included automatically
selected PHYLIB support. But MVGBE does not need PHYLIB it will build
fine without it. Commit ed52ea507f12 ("net: add Kconfig for MVGBE")
should have been a no-op in terms of build size but because of the
selecting PHYLIB the openrd configs increased in size.

Remove the automatic selection of PHYLIB, boards that need it will have
already enabled it in their config header file.

Fixes: commit ed52ea507f12 ("net: add Kconfig for MVGBE")
Signed-off-by: Chris Packham 


Acked-by: Joe Hershberger 

Stefan, feel free to pull this through your branch.


Thanks, will do.

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


[U-Boot] Please pull u-boot-marvell/master (v2)

2018-05-17 Thread Stefan Roese
Hi Tom,

please pull the Kirkwood DT patches from Chris. This time with
PHYLIB disabled for some boards (as was before).

Thanks,
Stefan


The following changes since commit f2d0f5e7ab3b8a7b4bf6e2ac499b4867c701d52d:

  ARM: re-enable MVGBE for edminiv2 (2018-05-16 11:38:08 -0400)

are available in the Git repository at:

  git://www.denx.de/git/u-boot-marvell.git 

for you to fetch changes up to f6e62ee04c37bb8d1726848c7fa9bcafb270e0f6:

  net: MVGBE don't automatically select PHYLIB (2018-05-17 17:38:31 +0200)


Chris Packham (12):
  ARM: add devicetree files for kirkwood SoC
  ARM: kirkwood: Add device-tree for dns325
  ARM: kirkwood: Add device-tree for dockstar
  ARM: kirkwood: Add device-tree for goflexhome
  ARM: kirkwood: Add device-tree for guruplug
  ARM: kirkwood: Add device-tree for ib62x0
  ARM: kirkwood: Add device-tree for iconnect
  ARM: kirkwood: Add device-tree for nas220
  ARM: kirkwood: Add device-tree for openrd
  ARM: kirkwood: Add device-tree for pogo_e02
  ARM: kirkwood: Add device-tree for sheevaplug
  net: MVGBE don't automatically select PHYLIB

 arch/arm/dts/kirkwood-6192.dtsi|  88 ++
 arch/arm/dts/kirkwood-6281.dtsi|  90 ++
 arch/arm/dts/kirkwood-98dx4122.dtsi|  53 
 arch/arm/dts/kirkwood-blackarmor-nas220.dts| 172 +++
 arch/arm/dts/kirkwood-dns325.dts   |  63 
 arch/arm/dts/kirkwood-dnskw.dtsi   | 235 +++
 arch/arm/dts/kirkwood-dockstar.dts | 110 +++
 arch/arm/dts/kirkwood-goflexnet.dts| 190 
 arch/arm/dts/kirkwood-guruplug-server-plus.dts | 133 +
 arch/arm/dts/kirkwood-ib62x0.dts   | 146 +
 arch/arm/dts/kirkwood-iconnect.dts | 195 
 arch/arm/dts/kirkwood-openrd-base.dts  |  39 +++
 arch/arm/dts/kirkwood-openrd-client.dts|  73 +
 arch/arm/dts/kirkwood-openrd-ultimate.dts  |  55 
 arch/arm/dts/kirkwood-openrd.dtsi  | 122 
 arch/arm/dts/kirkwood-pogo_e02.dts | 132 +
 arch/arm/dts/kirkwood-sheevaplug-common.dtsi   | 104 +++
 arch/arm/dts/kirkwood-sheevaplug.dts   |  42 +++
 arch/arm/dts/kirkwood.dtsi | 393 +
 configs/dns325_defconfig   |   3 +-
 configs/dockstar_defconfig |   3 +-
 configs/goflexhome_defconfig   |   3 +-
 configs/guruplug_defconfig |   3 +-
 configs/ib62x0_defconfig   |   3 +-
 configs/iconnect_defconfig |   3 +-
 configs/nas220_defconfig   |   3 +-
 configs/openrd_base_defconfig  |   3 +-
 configs/openrd_client_defconfig|   3 +-
 configs/openrd_ultimate_defconfig  |   3 +-
 configs/pogo_e02_defconfig |   3 +-
 configs/sheevaplug_defconfig   |   3 +-
 drivers/net/Kconfig|   1 -
 32 files changed, 2459 insertions(+), 13 deletions(-)
 create mode 100644 arch/arm/dts/kirkwood-6192.dtsi
 create mode 100644 arch/arm/dts/kirkwood-6281.dtsi
 create mode 100644 arch/arm/dts/kirkwood-98dx4122.dtsi
 create mode 100644 arch/arm/dts/kirkwood-blackarmor-nas220.dts
 create mode 100644 arch/arm/dts/kirkwood-dns325.dts
 create mode 100644 arch/arm/dts/kirkwood-dnskw.dtsi
 create mode 100644 arch/arm/dts/kirkwood-dockstar.dts
 create mode 100644 arch/arm/dts/kirkwood-goflexnet.dts
 create mode 100644 arch/arm/dts/kirkwood-guruplug-server-plus.dts
 create mode 100644 arch/arm/dts/kirkwood-ib62x0.dts
 create mode 100644 arch/arm/dts/kirkwood-iconnect.dts
 create mode 100644 arch/arm/dts/kirkwood-openrd-base.dts
 create mode 100644 arch/arm/dts/kirkwood-openrd-client.dts
 create mode 100644 arch/arm/dts/kirkwood-openrd-ultimate.dts
 create mode 100644 arch/arm/dts/kirkwood-openrd.dtsi
 create mode 100644 arch/arm/dts/kirkwood-pogo_e02.dts
 create mode 100644 arch/arm/dts/kirkwood-sheevaplug-common.dtsi
 create mode 100644 arch/arm/dts/kirkwood-sheevaplug.dts
 create mode 100644 arch/arm/dts/kirkwood.dtsi
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH V6 0/2] Update sabrelite and nitrogen6x boards to use distro boot support

2018-05-17 Thread Troy Kisky
On 5/17/2018 2:51 AM, Stefano Babic wrote:
> Hi Guillaume,
> 
> On 18/04/2018 17:04, Guillaume GARDET wrote:
>> This patch serie updates sabrelite and nitrogen6x boards to use distro boot 
>> support.
>> Sabrelite has been boot tested with boot.scr script and EFI/Grub2 on mmc0 
>> and mmc1 slots.
>> Nitrogen6* boards have been build tested only.
>>
>> Currently, only the Sabrelite has fdtfile defined.
>>
> 
> Fine, but Troy is the maintainer for this board and I have not yet seen
> if he agrees to switch the board to the distro environment. I would like
> to have his ACK before pushing this.
> 
> Best regards,
> Stefano Babic

Sorry, for the delay

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


Re: [U-Boot] [PATCH V6 0/2] Update sabrelite and nitrogen6x boards to use distro boot support

2018-05-17 Thread Stefano Babic
On 17/05/2018 17:45, Troy Kisky wrote:
> On 5/17/2018 2:51 AM, Stefano Babic wrote:
>> Hi Guillaume,
>>
>> On 18/04/2018 17:04, Guillaume GARDET wrote:
>>> This patch serie updates sabrelite and nitrogen6x boards to use distro boot 
>>> support.
>>> Sabrelite has been boot tested with boot.scr script and EFI/Grub2 on mmc0 
>>> and mmc1 slots.
>>> Nitrogen6* boards have been build tested only.
>>>
>>> Currently, only the Sabrelite has fdtfile defined.
>>>
>>
>> Fine, but Troy is the maintainer for this board and I have not yet seen
>> if he agrees to switch the board to the distro environment. I would like
>> to have his ACK before pushing this.
>>
>> Best regards,
>> Stefano Babic
> 
> Sorry, for the delay

No worry.
> 
> Acked-by: Troy Kisky 
> 

I apply the patches to u-boot-imx, thanks !

Best regards,
Stefano


-- 
=
DENX Software Engineering GmbH,  Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sba...@denx.de
=
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PULL] Please pull u-boot-imx

2018-05-17 Thread Stefano Babic
Hi Tom,

please pull from u-boot-imx, thanks !

The following changes since commit f2d0f5e7ab3b8a7b4bf6e2ac499b4867c701d52d:

  ARM: re-enable MVGBE for edminiv2 (2018-05-16 11:38:08 -0400)

are available in the git repository at:

  git://www.denx.de/git/u-boot-imx.git master

for you to fetch changes up to 2f5988533d5c447d7bda79b0d9719f84db9e1835:

  imx6: sabrelite: update defconfig to use distro defaults (2018-05-17
17:47:17 +0200)


Guillaume GARDET (2):
  imx6: Convert sabrelite and nitrogen6x boards to distro boot support
  imx6: sabrelite: update defconfig to use distro defaults

Ian Ray (6):
  board: ge: bx50v3: add winbond SPI NOR support
  board: ge: bx50v3: rename detect_baseboard function
  board: ge: bx50v3: fix display support for b{46}50v3
  board: ge: bx50v3: use VPD instead of compile-time checks
  board: ge: bx50v3: configure video arguments using VPD
  board: ge: bx50v3: remove redundant targets

Lukasz Majewski (8):
  dts: imx53: Add gpio and i2c nodes to imx53.dtsi file
  dts: pinctrl: Provide IMX_PAD_SION definition for imx53 pinctrl
  pmic: fsl: Provide some more definitions for MC34708 PMIC
  pmic: fsl: Define number of bytes sent at once by MC34708 PMIC
  pmic: dm: Provide *trans_len() callback for pmic-uclass
  pmic: dm: Rewrite pmic_reg_{read|write} and pmic_clrsetbits to
support transmissions larger than 1 byte
  pmic: dm: Add support for MC34708 for PMIC DM
  arm: imx53: Add support for imx53 boards from K+P

Magnus Lilja (2):
  mx31pdk: Convert CONFIG_MX31 flag to use Kconfig.
  mx31: Convert MX31_HCLK_FREQ and MX31_CLK32 to Kconfig.

Nandor Han (2):
  board: ge: bx50v3: unify two switch statements
  board: ge: bx50v3: detect the monitor type by reading VPD earlier

Peter Robinson (4):
  mx6 common: remove dangling comment
  mx7: remove empty ifndef statement
  mx6: Select CONFIG_MP with MX6_SMP
  mx6: remove duplicated BOUNCE_BUFFER defines

Sebastian Reichel (1):
  ge: ppd: move CONFIG_ENV_IS_IN_MMC to defconfig

 arch/arm/Kconfig |  14 +++
 arch/arm/dts/imx53-kp.dts| 135

 arch/arm/dts/imx53-pinfunc.h |   1 +
 arch/arm/dts/imx53.dtsi  | 101
+++-
 arch/arm/include/asm/arch-mx31/clock.h   |   8 
 arch/arm/mach-imx/mx3/Kconfig|  34
+
 arch/arm/mach-imx/mx5/Kconfig|  12 ++
 arch/arm/mach-imx/mx6/Kconfig|  15 ++--
 board/ge/bx50v3/Kconfig  |   2 +-
 board/ge/bx50v3/bx50v3.c |  71
++
 board/k+p/kp_imx53/Kconfig   |  15 
 board/k+p/kp_imx53/MAINTAINERS   |   6 +++
 board/k+p/kp_imx53/Makefile  |   8 
 board/k+p/kp_imx53/kp_id_rev.c   | 121
++
 board/k+p/kp_imx53/kp_id_rev.h   |  28 ++
 board/k+p/kp_imx53/kp_imx53.c| 212
+
 configs/ge_b650v3_defconfig  |  43
-
 configs/ge_b850v3_defconfig  |  43
-
 configs/{ge_b450v3_defconfig => ge_bx50v3_defconfig} |   4 +-
 configs/kp_imx53_defconfig   |  40
+++
 configs/mx31pdk_defconfig|   3 +-
 configs/mx53ppd_defconfig|   1 +
 configs/mx6qsabrelite_defconfig  |  15 +++-
 drivers/power/pmic/Kconfig   |   7 
 drivers/power/pmic/Makefile  |   1 +
 drivers/power/pmic/mc34708.c | 103
+
 drivers/power/pmic/pmic-uclass.c |  48
+--
 include/configs/advantech_dms-ba16.h |   1 -
 include/configs/apalis_imx6.h|   1 -
 include/configs/colibri_imx6.h   |   1 -
 include/configs/dh_imx6.h|   1 -
 include/configs/ge_bx50v3.h  |  17 +
 include/configs/kp_imx53.h   | 113
++
 include/configs/kp_imx6q_tpc.h   |   2 -
 include/configs/mx31pdk.h|   2 -
 include/configs/mx53ppd.h|   1 -
 include/configs/mx6_common.h |   3

[U-Boot] [BUG] qemu-x86_64_defconfig fails with panic("TSC frequency is ZERO");

2018-05-17 Thread Heinrich Schuchardt
Hello Bin, Simon,

sometimes qemu-x86_64_defconfig fails with panic("TSC frequency is
ZERO") in drivers/timer/tsc_timer.c.

The system may hang in an endless reboot loop with this error or recover
after reboot.

Do we need to panic? Or could we use some default value?

Qemu version used for testing: 2.8.1.

Best regards

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


[U-Boot] [PATCH v5 02/16] fastboot: Refactor fastboot_okay/fail to take response

2018-05-17 Thread Alex Kiernan
Add the response string as a parameter to fastboot_okay/fail, instead
of modifying a global, to match the contract expected by the AOSP
U-Boot code.

Signed-off-by: Alex Kiernan 
Reviewed-by: Joe Hershberger 
---

Changes in v5: None
Changes in v4: None
Changes in v3:
- refactor for changes in master

Changes in v2: None

 cmd/mmc.c   |  2 +-
 common/image-sparse.c   | 32 +---
 drivers/fastboot/fb_mmc.c   | 83 +++--
 drivers/fastboot/fb_nand.c  | 34 +
 drivers/usb/gadget/f_fastboot.c | 35 +++--
 include/fastboot.h  |  4 +-
 include/fb_mmc.h|  4 +-
 include/fb_nand.h   |  4 +-
 include/image-sparse.h  |  4 +-
 9 files changed, 105 insertions(+), 97 deletions(-)

diff --git a/cmd/mmc.c b/cmd/mmc.c
index 68bbf1f..cc44525 100644
--- a/cmd/mmc.c
+++ b/cmd/mmc.c
@@ -367,7 +367,7 @@ static int do_mmc_sparse_write(cmd_tbl_t *cmdtp, int flag,
sparse.mssg = NULL;
sprintf(dest, "0x" LBAF, sparse.start * sparse.blksz);
 
-   if (write_sparse_image(&sparse, dest, addr))
+   if (write_sparse_image(&sparse, dest, addr, NULL))
return CMD_RET_FAILURE;
else
return CMD_RET_SUCCESS;
diff --git a/common/image-sparse.c b/common/image-sparse.c
index 9223b9a..1ae7a4d 100644
--- a/common/image-sparse.c
+++ b/common/image-sparse.c
@@ -48,10 +48,10 @@
 #define CONFIG_FASTBOOT_FLASH_FILLBUF_SIZE (1024 * 512)
 #endif
 
-static void default_log(const char *ignored) {}
+static void default_log(const char *ignored, char *response) {}
 
 int write_sparse_image(struct sparse_storage *info,
-  const char *part_name, void *data)
+  const char *part_name, void *data, char *response)
 {
lbaint_t blk;
lbaint_t blkcnt;
@@ -104,7 +104,7 @@ int write_sparse_image(struct sparse_storage *info,
if (offset) {
printf("%s: Sparse image block size issue [%u]\n",
   __func__, sparse_header->blk_sz);
-   info->mssg("sparse image block size issue");
+   info->mssg("sparse image block size issue", response);
return -1;
}
 
@@ -139,7 +139,8 @@ int write_sparse_image(struct sparse_storage *info,
case CHUNK_TYPE_RAW:
if (chunk_header->total_sz !=
(sparse_header->chunk_hdr_sz + chunk_data_sz)) {
-   info->mssg("Bogus chunk size for chunk type 
Raw");
+   info->mssg("Bogus chunk size for chunk type 
Raw",
+  response);
return -1;
}
 
@@ -147,7 +148,8 @@ int write_sparse_image(struct sparse_storage *info,
printf(
"%s: Request would exceed partition 
size!\n",
__func__);
-   info->mssg("Request would exceed partition 
size!");
+   info->mssg("Request would exceed partition 
size!",
+  response);
return -1;
}
 
@@ -157,7 +159,7 @@ int write_sparse_image(struct sparse_storage *info,
printf("%s: %s" LBAFU " [" LBAFU "]\n",
   __func__, "Write failed, block #",
   blk, blks);
-   info->mssg("flash write failure");
+   info->mssg("flash write failure", response);
return -1;
}
blk += blks;
@@ -169,7 +171,7 @@ int write_sparse_image(struct sparse_storage *info,
case CHUNK_TYPE_FILL:
if (chunk_header->total_sz !=
(sparse_header->chunk_hdr_sz + sizeof(uint32_t))) {
-   info->mssg("Bogus chunk size for chunk type 
FILL");
+   info->mssg("Bogus chunk size for chunk type 
FILL", response);
return -1;
}
 
@@ -179,7 +181,8 @@ int write_sparse_image(struct sparse_storage *info,
info->blksz * fill_buf_num_blks,
ARCH_DMA_MINALIGN));
if (!fill_buf) {
-   info->mssg("Malloc failed for: 
CHUNK_TYPE_FILL");
+   info->mssg("Malloc failed for: CHUNK_TYPE_FILL",
+  response);
return -1;
}
 
@@ -196,7 +199,8 @@ int write_sparse_image(struct sparse_storage *info,
 

[U-Boot] [PATCH v5 03/16] fastboot: Extract fastboot_okay/fail to fb_common.c

2018-05-17 Thread Alex Kiernan
Add drivers/fastboot/fb_common.c, where fastboot_okay/fail are implemented
so we can call them from a non-USB implementation.

Introduce fastboot_response which takes varargs parameters so we can
use it to generate formatted response strings. Refactor fastboot_okay/fail
to use it.

Signed-off-by: Alex Kiernan 
Reviewed-by: Joe Hershberger 
---

Changes in v5:
- fix docbook formatting

Changes in v4:
- add docbook comments

Changes in v3:
- Merge subsequent patch for formatting response strings into this one
- allow NULL to fastboot_okay() when there's no message to send

Changes in v2: None

 drivers/Makefile|  4 +--
 drivers/fastboot/Makefile   |  2 ++
 drivers/fastboot/fb_common.c| 61 +
 drivers/usb/gadget/f_fastboot.c | 13 -
 include/fastboot.h  | 24 
 5 files changed, 88 insertions(+), 16 deletions(-)
 create mode 100644 drivers/fastboot/fb_common.c

diff --git a/drivers/Makefile b/drivers/Makefile
index a79ff2e..d29a6e4 100644
--- a/drivers/Makefile
+++ b/drivers/Makefile
@@ -71,9 +71,7 @@ obj-y += block/
 obj-$(CONFIG_BOOTCOUNT_LIMIT) += bootcount/
 obj-$(CONFIG_CPU) += cpu/
 obj-y += crypto/
-ifneq ($(CONFIG_FASTBOOT_FLASH_MMC_DEV)$(CONFIG_FASTBOOT_FLASH_NAND_DEV),)
-obj-y += fastboot/
-endif
+obj-$(CONFIG_FASTBOOT) += fastboot/
 obj-y += firmware/
 obj-$(CONFIG_FPGA) += fpga/
 obj-y += misc/
diff --git a/drivers/fastboot/Makefile b/drivers/fastboot/Makefile
index 651fbf0..b38dcff 100644
--- a/drivers/fastboot/Makefile
+++ b/drivers/fastboot/Makefile
@@ -1,5 +1,7 @@
 # SPDX-License-Identifier:  GPL-2.0+
 
+obj-y += fb_common.o
+
 ifdef CONFIG_FASTBOOT_FLASH_MMC_DEV
 obj-y += fb_mmc.o
 endif
diff --git a/drivers/fastboot/fb_common.c b/drivers/fastboot/fb_common.c
new file mode 100644
index 000..c4a7702
--- /dev/null
+++ b/drivers/fastboot/fb_common.c
@@ -0,0 +1,61 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * (C) Copyright 2008 - 2009
+ * Windriver, 
+ * Tom Rix 
+ *
+ * Copyright 2011 Sebastian Andrzej Siewior 
+ *
+ * Copyright 2014 Linaro, Ltd.
+ * Rob Herring 
+ */
+
+#include 
+#include 
+
+/**
+ * fastboot_response() - Writes a response of the form "$tag$reason".
+ *
+ * @tag: The first part of the response
+ * @response: Pointer to fastboot response buffer
+ * @format: printf style format string
+ */
+void fastboot_response(const char *tag, char *response,
+  const char *format, ...)
+{
+   va_list args;
+
+   strlcpy(response, tag, FASTBOOT_RESPONSE_LEN);
+   if (format) {
+   va_start(args, format);
+   vsnprintf(response + strlen(response),
+ FASTBOOT_RESPONSE_LEN - strlen(response) - 1,
+ format, args);
+   va_end(args);
+   }
+}
+
+/**
+ * fastboot_fail() - Write a FAIL response of the form "FAIL$reason".
+ *
+ * @reason: Pointer to returned reason string
+ * @response: Pointer to fastboot response buffer
+ */
+void fastboot_fail(const char *reason, char *response)
+{
+   fastboot_response("FAIL", response, "%s", reason);
+}
+
+/**
+ * fastboot_okay() - Write an OKAY response of the form "OKAY$reason".
+ *
+ * @reason: Pointer to returned reason string, or NULL to send a bare "OKAY"
+ * @response: Pointer to fastboot response buffer
+ */
+void fastboot_okay(const char *reason, char *response)
+{
+   if (reason)
+   fastboot_response("OKAY", response, "%s", reason);
+   else
+   fastboot_response("OKAY", response, NULL);
+}
diff --git a/drivers/usb/gadget/f_fastboot.c b/drivers/usb/gadget/f_fastboot.c
index bb60612..2e6e161 100644
--- a/drivers/usb/gadget/f_fastboot.c
+++ b/drivers/usb/gadget/f_fastboot.c
@@ -149,19 +149,6 @@ static struct usb_gadget_strings *fastboot_strings[] = {
 static void rx_handler_command(struct usb_ep *ep, struct usb_request *req);
 static int strcmp_l1(const char *s1, const char *s2);
 
-
-void fastboot_fail(const char *reason, char *response)
-{
-   strncpy(response, "FAIL\0", 5);
-   strncat(response, reason, FASTBOOT_RESPONSE_LEN - 4 - 1);
-}
-
-void fastboot_okay(const char *reason, char *response)
-{
-   strncpy(response, "OKAY\0", 5);
-   strncat(response, reason, FASTBOOT_RESPONSE_LEN - 4 - 1);
-}
-
 static void fastboot_complete(struct usb_ep *ep, struct usb_request *req)
 {
int status = req->status;
diff --git a/include/fastboot.h b/include/fastboot.h
index ed52dae..6cd44d2 100644
--- a/include/fastboot.h
+++ b/include/fastboot.h
@@ -15,7 +15,31 @@
 /* The 64 defined bytes plus \0 */
 #define FASTBOOT_RESPONSE_LEN  (64 + 1)
 
+/**
+ * fastboot_response() - Writes a response of the form "$tag$reason".
+ *
+ * @tag: The first part of the response
+ * @response: Pointer to fastboot response buffer
+ * @format: printf style format string
+ */
+void fastboot_response(const char *tag, char *response,
+  const char *format, ...)
+   __attribute__ ((for

[U-Boot] [PATCH v5 04/16] fastboot: Correct dependencies in FASTBOOT_FLASH

2018-05-17 Thread Alex Kiernan
Ensure that when selecting FASTBOOT_FLASH you end up with a buildable
configuration. Prior to this you could select NAND without MTDPARTS
and end up with an image which (surprisingly) excluded NAND.

Also fix dependencies on FASTBOOT_GPT_NAME/FASTBOOT_MBR_NAME which require
you have EFI_PARTITION/DOS_PARTITION enabled.

Signed-off-by: Alex Kiernan 
Reviewed-by: Joe Hershberger 
---

Changes in v5: None
Changes in v4: None
Changes in v3:
- guard FASTBOOT_GPT_NAME/FASTBOOT_MBR_NAME with EFI/DOS_PARTITION

Changes in v2: None

 arch/arm/mach-omap2/utils.c |  4 ++--
 drivers/fastboot/Kconfig|  8 
 drivers/fastboot/Makefile   |  8 ++--
 drivers/usb/gadget/f_fastboot.c | 14 +++---
 4 files changed, 15 insertions(+), 19 deletions(-)

diff --git a/arch/arm/mach-omap2/utils.c b/arch/arm/mach-omap2/utils.c
index dc7b37f..edf5edc 100644
--- a/arch/arm/mach-omap2/utils.c
+++ b/arch/arm/mach-omap2/utils.c
@@ -85,7 +85,7 @@ static void omap_set_fastboot_board_rev(void)
env_set("fastboot.board_rev", board_rev);
 }
 
-#ifdef CONFIG_FASTBOOT_FLASH_MMC_DEV
+#ifdef CONFIG_FASTBOOT_FLASH_MMC
 static u32 omap_mmc_get_part_size(const char *part)
 {
int res;
@@ -128,7 +128,7 @@ static void omap_set_fastboot_userdata_size(void)
 static inline void omap_set_fastboot_userdata_size(void)
 {
 }
-#endif /* CONFIG_FASTBOOT_FLASH_MMC_DEV */
+#endif /* CONFIG_FASTBOOT_FLASH_MMC */
 void omap_set_fastboot_vars(void)
 {
omap_set_fastboot_cpu();
diff --git a/drivers/fastboot/Kconfig b/drivers/fastboot/Kconfig
index 93a8ac6..51c5789 100644
--- a/drivers/fastboot/Kconfig
+++ b/drivers/fastboot/Kconfig
@@ -56,6 +56,7 @@ config FASTBOOT_USB_DEV
 config FASTBOOT_FLASH
bool "Enable FASTBOOT FLASH command"
default y if ARCH_SUNXI
+   depends on MMC || (NAND && CMD_MTDPARTS)
help
  The fastboot protocol includes a "flash" command for writing
  the downloaded image to a non-volatile storage device. Define
@@ -71,7 +72,7 @@ config FASTBOOT_FLASH_MMC
 
 config FASTBOOT_FLASH_NAND
bool "FASTBOOT on NAND"
-   depends on NAND
+   depends on NAND && CMD_MTDPARTS
 
 endchoice
 
@@ -88,7 +89,6 @@ config FASTBOOT_FLASH_MMC_DEV
 config FASTBOOT_FLASH_NAND_DEV
int "Define FASTBOOT NAND FLASH default device"
depends on FASTBOOT_FLASH_NAND
-   depends on CMD_MTDPARTS
default 0 if ARCH_SUNXI && NAND_SUNXI
help
  The fastboot "flash" command requires additional information
@@ -97,7 +97,7 @@ config FASTBOOT_FLASH_NAND_DEV
 
 config FASTBOOT_GPT_NAME
string "Target name for updating GPT"
-   depends on FASTBOOT_FLASH
+   depends on FASTBOOT_FLASH_MMC && EFI_PARTITION
default "gpt"
help
  The fastboot "flash" command supports writing the downloaded
@@ -110,7 +110,7 @@ config FASTBOOT_GPT_NAME
 
 config FASTBOOT_MBR_NAME
string "Target name for updating MBR"
-   depends on FASTBOOT_FLASH
+   depends on FASTBOOT_FLASH_MMC && DOS_PARTITION
default "mbr"
help
  The fastboot "flash" command allows to write the downloaded image
diff --git a/drivers/fastboot/Makefile b/drivers/fastboot/Makefile
index b38dcff..e4bd389 100644
--- a/drivers/fastboot/Makefile
+++ b/drivers/fastboot/Makefile
@@ -2,9 +2,5 @@
 
 obj-y += fb_common.o
 
-ifdef CONFIG_FASTBOOT_FLASH_MMC_DEV
-obj-y += fb_mmc.o
-endif
-ifdef CONFIG_FASTBOOT_FLASH_NAND_DEV
-obj-y += fb_nand.o
-endif
+obj-$(CONFIG_FASTBOOT_FLASH_MMC) += fb_mmc.o
+obj-$(CONFIG_FASTBOOT_FLASH_NAND) += fb_nand.o
diff --git a/drivers/usb/gadget/f_fastboot.c b/drivers/usb/gadget/f_fastboot.c
index 2e6e161..323ac89 100644
--- a/drivers/usb/gadget/f_fastboot.c
+++ b/drivers/usb/gadget/f_fastboot.c
@@ -20,10 +20,10 @@
 #include 
 #include 
 #include 
-#ifdef CONFIG_FASTBOOT_FLASH_MMC_DEV
+#ifdef CONFIG_FASTBOOT_FLASH_MMC
 #include 
 #endif
-#ifdef CONFIG_FASTBOOT_FLASH_NAND_DEV
+#ifdef CONFIG_FASTBOOT_FLASH_NAND
 #include 
 #endif
 
@@ -583,11 +583,11 @@ static void cb_flash(struct usb_ep *ep, struct 
usb_request *req)
}
 
fastboot_fail("no flash device defined", response);
-#ifdef CONFIG_FASTBOOT_FLASH_MMC_DEV
+#ifdef CONFIG_FASTBOOT_FLASH_MMC
fb_mmc_flash_write(cmd, (void *)CONFIG_FASTBOOT_BUF_ADDR,
   download_bytes, response);
 #endif
-#ifdef CONFIG_FASTBOOT_FLASH_NAND_DEV
+#ifdef CONFIG_FASTBOOT_FLASH_NAND
fb_nand_flash_write(cmd, (void *)CONFIG_FASTBOOT_BUF_ADDR,
download_bytes, response);
 #endif
@@ -598,7 +598,7 @@ static void cb_flash(struct usb_ep *ep, struct usb_request 
*req)
 static void cb_oem(struct usb_ep *ep, struct usb_request *req)
 {
char *cmd = req->buf;
-#ifdef CONFIG_FASTBOOT_FLASH_MMC_DEV
+#ifdef CONFIG_FASTBOOT_FLASH_MMC
if (strncmp("format", cmd + 4, 6) == 0) {
char cmdbuf[32];
 sprintf(cmdbuf, "gpt write mmc %x $partitions",
@@ -631,10 +631,10 @@ sta

[U-Boot] [PATCH v5 05/16] fastboot: Add missing newlines

2018-05-17 Thread Alex Kiernan
Add newlines so we format our output correctly.

Signed-off-by: Alex Kiernan 
Acked-by: Joe Hershberger 
Reviewed-by: Jocelyn Bohr 
---

Changes in v5: None
Changes in v4: None
Changes in v3: None
Changes in v2: None

 drivers/fastboot/fb_mmc.c | 28 ++--
 1 file changed, 14 insertions(+), 14 deletions(-)

diff --git a/drivers/fastboot/fb_mmc.c b/drivers/fastboot/fb_mmc.c
index 1bcb2e5..b1db296 100644
--- a/drivers/fastboot/fb_mmc.c
+++ b/drivers/fastboot/fb_mmc.c
@@ -125,7 +125,7 @@ static lbaint_t fb_mmc_get_boot_header(struct blk_desc 
*dev_desc,
sector_size = info->blksz;
hdr_sectors = DIV_ROUND_UP(sizeof(struct andr_img_hdr), sector_size);
if (hdr_sectors == 0) {
-   pr_err("invalid number of boot sectors: 0");
+   pr_err("invalid number of boot sectors: 0\n");
fastboot_fail("invalid number of boot sectors: 0", response);
return 0;
}
@@ -133,7 +133,7 @@ static lbaint_t fb_mmc_get_boot_header(struct blk_desc 
*dev_desc,
/* Read the boot image header */
res = blk_dread(dev_desc, info->start, hdr_sectors, (void *)hdr);
if (res != hdr_sectors) {
-   pr_err("cannot read header from boot partition");
+   pr_err("cannot read header from boot partition\n");
fastboot_fail("cannot read header from boot partition",
  response);
return 0;
@@ -142,7 +142,7 @@ static lbaint_t fb_mmc_get_boot_header(struct blk_desc 
*dev_desc,
/* Check boot header magic string */
res = android_image_check_header(hdr);
if (res != 0) {
-   pr_err("bad boot image magic");
+   pr_err("bad boot image magic\n");
fastboot_fail("boot partition not initialized", response);
return 0;
}
@@ -181,7 +181,7 @@ static int fb_mmc_update_zimage(struct blk_desc *dev_desc,
/* Get boot partition info */
res = part_get_info_by_name(dev_desc, BOOT_PARTITION_NAME, &info);
if (res < 0) {
-   pr_err("cannot find boot partition");
+   pr_err("cannot find boot partition\n");
fastboot_fail("cannot find boot partition", response);
return -1;
}
@@ -193,14 +193,14 @@ static int fb_mmc_update_zimage(struct blk_desc *dev_desc,
/* Read boot image header */
hdr_sectors = fb_mmc_get_boot_header(dev_desc, &info, hdr, response);
if (hdr_sectors == 0) {
-   pr_err("unable to read boot image header");
+   pr_err("unable to read boot image header\n");
fastboot_fail("unable to read boot image header", response);
return -1;
}
 
/* Check if boot image has second stage in it (we don't support it) */
if (hdr->second_size > 0) {
-   pr_err("moving second stage is not supported yet");
+   pr_err("moving second stage is not supported yet\n");
fastboot_fail("moving second stage is not supported yet",
  response);
return -1;
@@ -219,7 +219,7 @@ static int fb_mmc_update_zimage(struct blk_desc *dev_desc,
res = blk_dread(dev_desc, ramdisk_sector_start, ramdisk_sectors,
ramdisk_buffer);
if (res != ramdisk_sectors) {
-   pr_err("cannot read ramdisk from boot partition");
+   pr_err("cannot read ramdisk from boot partition\n");
fastboot_fail("cannot read ramdisk from boot partition",
  response);
return -1;
@@ -229,7 +229,7 @@ static int fb_mmc_update_zimage(struct blk_desc *dev_desc,
hdr->kernel_size = download_bytes;
res = blk_dwrite(dev_desc, info.start, hdr_sectors, (void *)hdr);
if (res == 0) {
-   pr_err("cannot writeback boot image header");
+   pr_err("cannot writeback boot image header\n");
fastboot_fail("cannot write back boot image header", response);
return -1;
}
@@ -241,7 +241,7 @@ static int fb_mmc_update_zimage(struct blk_desc *dev_desc,
res = blk_dwrite(dev_desc, kernel_sector_start, kernel_sectors,
 download_buffer);
if (res == 0) {
-   pr_err("cannot write new kernel");
+   pr_err("cannot write new kernel\n");
fastboot_fail("cannot write new kernel", response);
return -1;
}
@@ -253,7 +253,7 @@ static int fb_mmc_update_zimage(struct blk_desc *dev_desc,
res = blk_dwrite(dev_desc, ramdisk_sector_start, ramdisk_sectors,
 ramdisk_buffer);
if (res == 0) {
-   pr_err("cannot write back original ramdisk");
+   pr_err("cannot write back original ramdisk\n");
fastboot_fail("cannot write back original ramdisk", response);

[U-Boot] [PATCH v5 07/16] fastboot: Fix parameter types in _fb_nand_write

2018-05-17 Thread Alex Kiernan
Compiling on a 64 bit target the arguments to _fb_nand_write are
incompatible:

  drivers/fastboot/fb_nand.c: In function ‘_fb_nand_write’:
  drivers/fastboot/fb_nand.c:101:42: warning: passing argument 3 of 
‘nand_write_skip_bad’ from incompatible pointer type 
[-Wincompatible-pointer-types]
return nand_write_skip_bad(mtd, offset, &length, written,
  ^
  In file included from drivers/fastboot/fb_nand.c:16:0:
  include/nand.h:107:5: note: expected ‘size_t * {aka long unsigned int *}’ but 
argument is of type ‘unsigned int *’
   int nand_write_skip_bad(struct mtd_info *mtd, loff_t offset, size_t *length,
   ^~~

Signed-off-by: Alex Kiernan 
Reviewed-by: Simon Glass 
Acked-by: Joe Hershberger 
---

Changes in v5: None
Changes in v4: None
Changes in v3:
- new

Changes in v2: None

 drivers/fastboot/fb_nand.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/fastboot/fb_nand.c b/drivers/fastboot/fb_nand.c
index 2ee0d64..849a6f1 100644
--- a/drivers/fastboot/fb_nand.c
+++ b/drivers/fastboot/fb_nand.c
@@ -89,7 +89,7 @@ static int _fb_nand_erase(struct mtd_info *mtd, struct 
part_info *part)
 
 static int _fb_nand_write(struct mtd_info *mtd, struct part_info *part,
  void *buffer, unsigned int offset,
- unsigned int length, size_t *written)
+ size_t length, size_t *written)
 {
int flags = WITH_WR_VERIFY;
 
-- 
2.7.4

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


[U-Boot] [PATCH v5 10/16] fastboot: Rename public fb_ functions to fastboot_

2018-05-17 Thread Alex Kiernan
Rename fb_mmc_flash_write/fb_mmc_erase/fb_nand_flash_write/fb_nand_erase to
fastboot_... as they form a public interface

Signed-off-by: Alex Kiernan 
---

Changes in v5:
- new

Changes in v4: None
Changes in v3: None
Changes in v2: None

 drivers/fastboot/fb_mmc.c   |  6 +++---
 drivers/fastboot/fb_nand.c  |  6 +++---
 drivers/usb/gadget/f_fastboot.c | 12 ++--
 include/fb_mmc.h|  6 +++---
 include/fb_nand.h   |  6 +++---
 5 files changed, 18 insertions(+), 18 deletions(-)

diff --git a/drivers/fastboot/fb_mmc.c b/drivers/fastboot/fb_mmc.c
index 038905f..6bb4b87 100644
--- a/drivers/fastboot/fb_mmc.c
+++ b/drivers/fastboot/fb_mmc.c
@@ -251,8 +251,8 @@ static int fb_mmc_update_zimage(struct blk_desc *dev_desc,
 }
 #endif
 
-void fb_mmc_flash_write(const char *cmd, void *download_buffer,
-   unsigned int download_bytes, char *response)
+void fastboot_mmc_flash_write(const char *cmd, void *download_buffer,
+ unsigned int download_bytes, char *response)
 {
struct blk_desc *dev_desc;
disk_partition_t info;
@@ -349,7 +349,7 @@ void fb_mmc_flash_write(const char *cmd, void 
*download_buffer,
}
 }
 
-void fb_mmc_erase(const char *cmd, char *response)
+void fastboot_mmc_erase(const char *cmd, char *response)
 {
int ret;
struct blk_desc *dev_desc;
diff --git a/drivers/fastboot/fb_nand.c b/drivers/fastboot/fb_nand.c
index 849a6f1..28059b0 100644
--- a/drivers/fastboot/fb_nand.c
+++ b/drivers/fastboot/fb_nand.c
@@ -145,8 +145,8 @@ static lbaint_t fb_nand_sparse_reserve(struct 
sparse_storage *info,
return blkcnt + bad_blocks;
 }
 
-void fb_nand_flash_write(const char *cmd, void *download_buffer,
-unsigned int download_bytes, char *response)
+void fastboot_nand_flash_write(const char *cmd, void *download_buffer,
+  unsigned int download_bytes, char *response)
 {
struct part_info *part;
struct mtd_info *mtd = NULL;
@@ -204,7 +204,7 @@ void fb_nand_flash_write(const char *cmd, void 
*download_buffer,
fastboot_okay(NULL, response);
 }
 
-void fb_nand_erase(const char *cmd, char *response)
+void fastboot_nand_erase(const char *cmd, char *response)
 {
struct part_info *part;
struct mtd_info *mtd = NULL;
diff --git a/drivers/usb/gadget/f_fastboot.c b/drivers/usb/gadget/f_fastboot.c
index 25784a1..07d6a62 100644
--- a/drivers/usb/gadget/f_fastboot.c
+++ b/drivers/usb/gadget/f_fastboot.c
@@ -577,12 +577,12 @@ static void cb_flash(struct usb_ep *ep, struct 
usb_request *req)
 
fastboot_fail("no flash device defined", response);
 #ifdef CONFIG_FASTBOOT_FLASH_MMC
-   fb_mmc_flash_write(cmd, (void *)CONFIG_FASTBOOT_BUF_ADDR,
-  download_bytes, response);
+   fastboot_mmc_flash_write(cmd, (void *)CONFIG_FASTBOOT_BUF_ADDR,
+download_bytes, response);
 #endif
 #ifdef CONFIG_FASTBOOT_FLASH_NAND
-   fb_nand_flash_write(cmd, (void *)CONFIG_FASTBOOT_BUF_ADDR,
-   download_bytes, response);
+   fastboot_nand_flash_write(cmd, (void *)CONFIG_FASTBOOT_BUF_ADDR,
+ download_bytes, response);
 #endif
fastboot_tx_write_str(response);
 }
@@ -625,10 +625,10 @@ static void cb_erase(struct usb_ep *ep, struct 
usb_request *req)
 
fastboot_fail("no flash device defined", response);
 #ifdef CONFIG_FASTBOOT_FLASH_MMC
-   fb_mmc_erase(cmd, response);
+   fastboot_mmc_erase(cmd, response);
 #endif
 #ifdef CONFIG_FASTBOOT_FLASH_NAND
-   fb_nand_erase(cmd, response);
+   fastboot_nand_erase(cmd, response);
 #endif
fastboot_tx_write_str(response);
 }
diff --git a/include/fb_mmc.h b/include/fb_mmc.h
index 39a960c..5243dd5 100644
--- a/include/fb_mmc.h
+++ b/include/fb_mmc.h
@@ -3,6 +3,6 @@
  * Copyright 2014 Broadcom Corporation.
  */
 
-void fb_mmc_flash_write(const char *cmd, void *download_buffer,
-   unsigned int download_bytes, char *response);
-void fb_mmc_erase(const char *cmd, char *response);
+void fastboot_mmc_flash_write(const char *cmd, void *download_buffer,
+ unsigned int download_bytes, char *response);
+void fastboot_mmc_erase(const char *cmd, char *response);
diff --git a/include/fb_nand.h b/include/fb_nand.h
index 2c92a4e..bc34074 100644
--- a/include/fb_nand.h
+++ b/include/fb_nand.h
@@ -4,6 +4,6 @@
  * Copyright 2015 Free Electrons.
  */
 
-void fb_nand_flash_write(const char *cmd, void *download_buffer,
-unsigned int download_bytes, char *response);
-void fb_nand_erase(const char *cmd, char *response);
+void fastboot_nand_flash_write(const char *cmd, void *download_buffer,
+  unsigned int download_bytes, char *response);
+void fastboot_nand_erase(const char *cmd, char *response);
-- 
2.7.4

___
U-

[U-Boot] [PATCH v5 06/16] fastboot: Remove FIXME for CONFIG_FASTBOOT_...NAME

2018-05-17 Thread Alex Kiernan
CONFIG_FASTBOOT_GPT_NAME and CONFIG_FASTBOOT_MBR_NAME are always defined
by Kconfig if you're compiling this code, so remove these redundant
defaults.

Signed-off-by: Alex Kiernan 
Reviewed-by: Simon Glass 
Acked-by: Joe Hershberger 
---

Changes in v5: None
Changes in v4: None
Changes in v3:
- new

Changes in v2: None

 drivers/fastboot/fb_mmc.c | 13 -
 1 file changed, 13 deletions(-)

diff --git a/drivers/fastboot/fb_mmc.c b/drivers/fastboot/fb_mmc.c
index b1db296..038905f 100644
--- a/drivers/fastboot/fb_mmc.c
+++ b/drivers/fastboot/fb_mmc.c
@@ -15,19 +15,6 @@
 #include 
 #include 
 
-/*
- * FIXME: Ensure we always set these names via Kconfig once xxx_PARTITION is
- * migrated
- */
-#ifndef CONFIG_FASTBOOT_GPT_NAME
-#define CONFIG_FASTBOOT_GPT_NAME "gpt"
-#endif
-
-
-#ifndef CONFIG_FASTBOOT_MBR_NAME
-#define CONFIG_FASTBOOT_MBR_NAME "mbr"
-#endif
-
 #define BOOT_PARTITION_NAME "boot"
 
 struct fb_mmc_sparse {
-- 
2.7.4

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


[U-Boot] [PATCH v5 09/16] fastboot: Extract common definitions from USB fastboot

2018-05-17 Thread Alex Kiernan
Move FASTBOOT_VERSION to include/fastboot.h so when we merge the UDP code
we only have one definition.

Signed-off-by: Alex Kiernan 
Reviewed-by: Simon Glass 
Acked-by: Joe Hershberger 
---

Changes in v5: None
Changes in v4:
- leave strcmp_l1() in USB fastboot as we don't need it in UDP path

Changes in v3:
- new

Changes in v2: None

 drivers/usb/gadget/f_fastboot.c | 2 --
 include/fastboot.h  | 2 ++
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/gadget/f_fastboot.c b/drivers/usb/gadget/f_fastboot.c
index 697eee5..25784a1 100644
--- a/drivers/usb/gadget/f_fastboot.c
+++ b/drivers/usb/gadget/f_fastboot.c
@@ -27,8 +27,6 @@
 #include 
 #endif
 
-#define FASTBOOT_VERSION   "0.4"
-
 #define FASTBOOT_INTERFACE_CLASS   0xff
 #define FASTBOOT_INTERFACE_SUB_CLASS   0x42
 #define FASTBOOT_INTERFACE_PROTOCOL0x03
diff --git a/include/fastboot.h b/include/fastboot.h
index 816e71b..bf3d9e2 100644
--- a/include/fastboot.h
+++ b/include/fastboot.h
@@ -12,6 +12,8 @@
 #ifndef _FASTBOOT_H_
 #define _FASTBOOT_H_
 
+#define FASTBOOT_VERSION   "0.4"
+
 /* The 64 defined bytes plus \0 */
 #define FASTBOOT_RESPONSE_LEN  (64 + 1)
 
-- 
2.7.4

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


[U-Boot] [PATCH v5 08/16] fastboot: Rename fb_set_reboot_flag to fastboot_set_reboot_flag

2018-05-17 Thread Alex Kiernan
Rename fb_set_reboot_flag to fastboot_set_reboot_flag so it matches
all other fastboot code in the global name space. Fix the guards around
them so that they're dependent on FASTBOOT, not just USB_FUNCTION_FASTBOOT.

Move the weak implementation of fastboot_set_reboot_flag to fb_common.c
so we can call it from non-USB fastboot code.

Signed-off-by: Alex Kiernan 
Reviewed-by: Simon Glass 
Acked-by: Joe Hershberger 
---

Changes in v5: None
Changes in v4: None
Changes in v3:
- new

Changes in v2: None

 arch/arm/mach-omap2/boot-common.c |  4 ++--
 arch/arm/mach-rockchip/rk3128-board.c |  4 ++--
 arch/arm/mach-rockchip/rk322x-board.c |  4 ++--
 board/amazon/kc1/kc1.c|  2 +-
 board/lg/sniper/sniper.c  |  2 +-
 drivers/fastboot/fb_common.c  | 15 +++
 drivers/usb/gadget/f_fastboot.c   |  7 +--
 include/fastboot.h|  2 +-
 8 files changed, 25 insertions(+), 15 deletions(-)

diff --git a/arch/arm/mach-omap2/boot-common.c 
b/arch/arm/mach-omap2/boot-common.c
index 0e9fd03..b22b671 100644
--- a/arch/arm/mach-omap2/boot-common.c
+++ b/arch/arm/mach-omap2/boot-common.c
@@ -237,8 +237,8 @@ void arch_preboot_os(void)
 }
 #endif
 
-#if defined(CONFIG_USB_FUNCTION_FASTBOOT) && !defined(CONFIG_ENV_IS_NOWHERE)
-int fb_set_reboot_flag(void)
+#if CONFIG_IS_ENABLED(FASTBOOT) && !CONFIG_IS_ENABLED(ENV_IS_NOWHERE)
+int fastboot_set_reboot_flag(void)
 {
printf("Setting reboot to fastboot flag ...\n");
env_set("dofastboot", "1");
diff --git a/arch/arm/mach-rockchip/rk3128-board.c 
b/arch/arm/mach-rockchip/rk3128-board.c
index 48cd8ba..7fd667a 100644
--- a/arch/arm/mach-rockchip/rk3128-board.c
+++ b/arch/arm/mach-rockchip/rk3128-board.c
@@ -111,8 +111,8 @@ int board_usb_cleanup(int index, enum usb_init_type init)
 }
 #endif
 
-#if defined(CONFIG_USB_FUNCTION_FASTBOOT)
-int fb_set_reboot_flag(void)
+#if CONFIG_IS_ENABLED(FASTBOOT)
+int fastboot_set_reboot_flag(void)
 {
struct rk3128_grf *grf;
 
diff --git a/arch/arm/mach-rockchip/rk322x-board.c 
b/arch/arm/mach-rockchip/rk322x-board.c
index 99a60c4..7366d45 100644
--- a/arch/arm/mach-rockchip/rk322x-board.c
+++ b/arch/arm/mach-rockchip/rk322x-board.c
@@ -139,8 +139,8 @@ int board_usb_cleanup(int index, enum usb_init_type init)
 }
 #endif
 
-#if defined(CONFIG_USB_FUNCTION_FASTBOOT)
-int fb_set_reboot_flag(void)
+#if CONFIG_IS_ENABLED(FASTBOOT)
+int fastboot_set_reboot_flag(void)
 {
struct rk322x_grf *grf;
 
diff --git a/board/amazon/kc1/kc1.c b/board/amazon/kc1/kc1.c
index d9ca183..031fd11 100644
--- a/board/amazon/kc1/kc1.c
+++ b/board/amazon/kc1/kc1.c
@@ -161,7 +161,7 @@ void get_board_serial(struct tag_serialnr *serialnr)
omap_die_id_get_board_serial(serialnr);
 }
 
-int fb_set_reboot_flag(void)
+int fastboot_set_reboot_flag(void)
 {
return omap_reboot_mode_store("b");
 }
diff --git a/board/lg/sniper/sniper.c b/board/lg/sniper/sniper.c
index 34a7a11..a7de4c2 100644
--- a/board/lg/sniper/sniper.c
+++ b/board/lg/sniper/sniper.c
@@ -173,7 +173,7 @@ void reset_misc(void)
omap_reboot_mode_store(reboot_mode);
 }
 
-int fb_set_reboot_flag(void)
+int fastboot_set_reboot_flag(void)
 {
return omap_reboot_mode_store("b");
 }
diff --git a/drivers/fastboot/fb_common.c b/drivers/fastboot/fb_common.c
index c4a7702..79e080a 100644
--- a/drivers/fastboot/fb_common.c
+++ b/drivers/fastboot/fb_common.c
@@ -59,3 +59,18 @@ void fastboot_okay(const char *reason, char *response)
else
fastboot_response("OKAY", response, NULL);
 }
+
+/**
+ * fastboot_set_reboot_flag() - Set flag to indicate reboot-bootloader
+ *
+ * Set flag which indicates that we should reboot into the bootloader
+ * following the reboot that fastboot executes after this function.
+ *
+ * This function should be overridden in your board file with one
+ * which sets whatever flag your board specific Android bootloader flow
+ * requires in order to re-enter the bootloader.
+ */
+int __weak fastboot_set_reboot_flag(void)
+{
+   return -ENOSYS;
+}
diff --git a/drivers/usb/gadget/f_fastboot.c b/drivers/usb/gadget/f_fastboot.c
index 323ac89..697eee5 100644
--- a/drivers/usb/gadget/f_fastboot.c
+++ b/drivers/usb/gadget/f_fastboot.c
@@ -357,16 +357,11 @@ static void compl_do_reset(struct usb_ep *ep, struct 
usb_request *req)
do_reset(NULL, 0, 0, NULL);
 }
 
-int __weak fb_set_reboot_flag(void)
-{
-   return -ENOSYS;
-}
-
 static void cb_reboot(struct usb_ep *ep, struct usb_request *req)
 {
char *cmd = req->buf;
if (!strcmp_l1("reboot-bootloader", cmd)) {
-   if (fb_set_reboot_flag()) {
+   if (fastboot_set_reboot_flag()) {
fastboot_tx_write_str("FAILCannot set reboot flag");
return;
}
diff --git a/include/fastboot.h b/include/fastboot.h
index 6cd44d2..816e71b 100644
--- a/include/fastboot.h
+++ b/include/fastboot.h
@@ -41,5 +41,5 @@ void fastboot_fail(const char

[U-Boot] [PATCH v5 15/16] net: fastboot: Merge AOSP UDP fastboot

2018-05-17 Thread Alex Kiernan
Merge UDP fastboot support from AOSP:

  
https://android.googlesource.com/platform/external/u-boot/+/android-o-mr1-iot-preview-8

Signed-off-by: Alex Kiernan 
Signed-off-by: Alex Deymo 
Signed-off-by: Jocelyn Bohr 
Reviewed-by: Simon Glass 
---

Changes in v5:
- make fastboot_bytes_received/expected static and add function
  fastboot_get_bytes_remaining()
- move fastboot_buf_addr/fastboot_buf_size/fastboot_progress_callback
  into fastboot-internal.h
- delete redundant fb_ prefixes from statics

Changes in v4:
- guard fb_getvar/fb_command with UDP_FUNCTION_FASTBOOT in Makefile
- add docbook comments
- remove parameter from fastboot_boot() since we always want
  fastboot_buf_addr (and if we're using fastboot_bootcmd then it's
  ignored)
- split oem format into new patch

Changes in v3:
- use FASTBOOT as our guard in Kconfig not a list of USB || UDP
- correct mis-translation from AOSP introduced when cleaning up for
  checkpatch - we should write when buffer is not NULL, rather than
  erasing, and erase when buffer is NULL
- use CMD_RET_USAGE from do_fastboot
- remove do_fastboot_udp from cmd/net.c and rewrite using net_loop()
- rename timed_send_info to fastboot_send_info, rename fastboot_send_info to
  fastboot_udp_send_info
- replace FASTBOOT_HEADER_SIZE with sizeof(struct fastboot_header)
- move start time into timed_send_info() rather than passing it in
- make calls to fastboot_udp_send_info a runtime dependency, not a compile
  time one
- set ${filesize} to size of downloaded image
- add progress meter from USB path during download
- add support for 'oem format' command from the USB path
- rename 'fastbootcmd' to 'fastboot_bootcmd' to make clear that this is the
  fastboot boot command
- make getvar implementation table driven
- add fastboot_buf_addr, fastboot_buf_size to override buffer address and
  size
- return correct filesystem type in getvar partition-type on MMC
- process "fastboot." prefixed env variables in getvar first so you
  can override the normal values (this also lets you set a fs type for
  NAND devices)
- squash subsequent patches which change this code into this one:
  - If the fastboot flash/erase commands are disabled, remove that support
so we still build correctly.
  - Add NAND support to fastboot UDP flash/erase commands
  - If we don't have a partition name passed, report it as not found.
  - Change the behaviour of the fastboot net code such that
"reboot-bootloader" is no longer written to CONFIG_FASTBOOT_BUF_ADDR for
use as a marker on reboot (the AOSP code in common/android-bootloader.c
uses this marker - this code could be reinstated there if that gets
merged).
  - Merge USB and UDP boot code. The USB implementation stays the same, but
UDP no longer passes an fdt. We introduce a new environment variable
'fastboot_bootcmd' which if set overrides the hardcoded boot command,
setting this then allows the UDP implementation to remain the same. If
after running 'fastboot_bootcmd' the board has not booted, control is
returned to U-Boot and the fastboot process ends.
  - Separate the fastboot protocol handling from the fastboot UDP code in
preparation for reusing it in the USB code.

Changes in v2:
- ensure fastboot syntax is backward compatible - 'fastboot 0' means
  'fastboot usb 0'

 cmd/Kconfig   |   4 +-
 cmd/fastboot.c|  91 +++-
 drivers/fastboot/Kconfig  |   7 +
 drivers/fastboot/Makefile |   3 +-
 drivers/fastboot/fb_command.c | 295 +++
 drivers/fastboot/fb_common.c  |  93 +
 drivers/fastboot/fb_getvar.c  | 230 +++
 drivers/fastboot/fb_mmc.c |  76 +-
 drivers/fastboot/fb_nand.c|  12 +-
 include/fastboot-internal.h   |  36 +
 include/fastboot.h|  97 +
 include/fb_mmc.h  |   8 +-
 include/fb_nand.h |  10 +-
 include/net.h |   2 +-
 include/net/fastboot.h|  21 +++
 net/Makefile  |   1 +
 net/fastboot.c| 312 ++
 net/net.c |   7 +
 18 files changed, 1286 insertions(+), 19 deletions(-)
 create mode 100644 drivers/fastboot/fb_command.c
 create mode 100644 drivers/fastboot/fb_getvar.c
 create mode 100644 include/fastboot-internal.h
 create mode 100644 include/net/fastboot.h
 create mode 100644 net/fastboot.c

diff --git a/cmd/Kconfig b/cmd/Kconfig
index 98763c9..51fa0dd 100644
--- a/cmd/Kconfig
+++ b/cmd/Kconfig
@@ -655,8 +655,8 @@ config CMD_FASTBOOT
  This enables the command "fastboot" which enables the Android
  fastboot mode for the platform. Fastboot is a protocol for
  downloading images, flashing and device control used on
- Android devices. Fastboot requires support for acting as a USB
- device.
+ Android devices. Fastboot requires either the network stack
+ enabled or s

[U-Boot] [PATCH v5 13/16] fastboot: Migrate FASTBOOT_FLASH_NAND_TRIMFFS to Kconfig

2018-05-17 Thread Alex Kiernan
Add FASTBOOT_FLASH_NAND_TRIMFFS to Kconfig; note there are no in-tree
users of it.

Signed-off-by: Alex Kiernan 
---

Changes in v5:
- new

Changes in v4: None
Changes in v3: None
Changes in v2: None

 drivers/fastboot/Kconfig | 6 ++
 scripts/config_whitelist.txt | 1 -
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/fastboot/Kconfig b/drivers/fastboot/Kconfig
index 51c5789..b38f302 100644
--- a/drivers/fastboot/Kconfig
+++ b/drivers/fastboot/Kconfig
@@ -95,6 +95,12 @@ config FASTBOOT_FLASH_NAND_DEV
  regarding the non-volatile storage device. Define this to
  the NAND device that fastboot should use to store the image.
 
+config FASTBOOT_FLASH_NAND_TRIMFFS
+   bool "Skip empty pages when flashing NAND"
+   depends on FASTBOOT_FLASH_NAND
+   help
+ When flashing NAND enable DROP_FFS to drop trailing all-0xff pages.
+
 config FASTBOOT_GPT_NAME
string "Target name for updating GPT"
depends on FASTBOOT_FLASH_MMC && EFI_PARTITION
diff --git a/scripts/config_whitelist.txt b/scripts/config_whitelist.txt
index 71df6db..347c619 100644
--- a/scripts/config_whitelist.txt
+++ b/scripts/config_whitelist.txt
@@ -591,7 +591,6 @@ CONFIG_EXYNOS_SPL
 CONFIG_EXYNOS_TMU
 CONFIG_FACTORYSET
 CONFIG_FASTBOOT_FLASH_FILLBUF_SIZE
-CONFIG_FASTBOOT_FLASH_NAND_TRIMFFS
 CONFIG_FAST_FLASH_BIT
 CONFIG_FB_ADDR
 CONFIG_FB_BACKLIGHT
-- 
2.7.4

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


[U-Boot] [PATCH v5 12/16] fs: Add fs_get_type_name to return current filesystem name

2018-05-17 Thread Alex Kiernan
Add fs_get_type_name so we can get the current filesystem type.

Signed-off-by: Alex Kiernan 
Reviewed-by: Simon Glass 
Reviewed-by: Joe Hershberger 
---

Changes in v5: None
Changes in v4:
- add docbook comments

Changes in v3:
- new

Changes in v2: None

 fs/fs.c  | 13 +
 include/fs.h | 10 ++
 2 files changed, 23 insertions(+)

diff --git a/fs/fs.c b/fs/fs.c
index 94cdc37..33808d5 100644
--- a/fs/fs.c
+++ b/fs/fs.c
@@ -265,6 +265,19 @@ static struct fstype_info *fs_get_info(int fstype)
return info;
 }
 
+/**
+ * fs_get_type_name() - Get type of current filesystem
+ *
+ * Return: Pointer to filesystem name
+ *
+ * Returns a string describing the current filesystem, or the sentinel
+ * "unsupported" for any unrecognised filesystem.
+ */
+const char *fs_get_type_name(void)
+{
+   return fs_get_info(fs_type)->name;
+}
+
 int fs_set_blk_dev(const char *ifname, const char *dev_part_str, int fstype)
 {
struct fstype_info *info;
diff --git a/include/fs.h b/include/fs.h
index d703ed5..163da10 100644
--- a/include/fs.h
+++ b/include/fs.h
@@ -37,6 +37,16 @@ int fs_set_blk_dev(const char *ifname, const char 
*dev_part_str, int fstype);
  */
 int fs_set_blk_dev_with_part(struct blk_desc *desc, int part);
 
+/**
+ * fs_get_type_name() - Get type of current filesystem
+ *
+ * Return: Pointer to filesystem name
+ *
+ * Returns a string describing the current filesystem, or the sentinel
+ * "unsupported" for any unrecognised filesystem.
+ */
+const char *fs_get_type_name(void);
+
 /*
  * Print the list of files on the partition previously set by fs_set_blk_dev(),
  * in directory "dirname".
-- 
2.7.4

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


[U-Boot] [PATCH v5 16/16] fastboot: Add support for 'oem format' command

2018-05-17 Thread Alex Kiernan
Introduce 'oem format' which matches the USB implementation, guard this
with CONFIG_FASTBOOT_CMD_OEM_FORMAT so that you can configure it out.

Signed-off-by: Alex Kiernan 
---

Changes in v5:
- new

Changes in v4: None
Changes in v3: None
Changes in v2: None

 drivers/fastboot/Kconfig  |  8 
 drivers/fastboot/fb_command.c | 33 +
 include/fastboot.h|  3 +++
 3 files changed, 44 insertions(+)

diff --git a/drivers/fastboot/Kconfig b/drivers/fastboot/Kconfig
index 4c0a5b0..b3186b0 100644
--- a/drivers/fastboot/Kconfig
+++ b/drivers/fastboot/Kconfig
@@ -132,6 +132,14 @@ config FASTBOOT_MBR_NAME
  specified on the "fastboot flash" command line matches the value
  defined here. The default target name for updating MBR is "mbr".
 
+config FASTBOOT_CMD_OEM_FORMAT
+   bool "Enable the 'oem format' command"
+   depends on FASTBOOT_FLASH_MMC && CMD_GPT
+   help
+ Add support for the "oem format" command from a client. This
+ relies on the env variable partitions to contain the list of
+ partitions as required by the gpt command.
+
 endif # FASTBOOT
 
 endmenu
diff --git a/drivers/fastboot/fb_command.c b/drivers/fastboot/fb_command.c
index 4db0165..0b8c3b9 100644
--- a/drivers/fastboot/fb_command.c
+++ b/drivers/fastboot/fb_command.c
@@ -34,6 +34,9 @@ static void flash(char *, char *);
 static void erase(char *, char *);
 #endif
 static void reboot_bootloader(char *, char *);
+#if CONFIG_IS_ENABLED(FASTBOOT_CMD_OEM_FORMAT)
+static void oem_format(char *, char *);
+#endif
 
 static const struct {
const char *command;
@@ -77,6 +80,12 @@ static const struct {
.command = "set_active",
.dispatch = okay
},
+#if CONFIG_IS_ENABLED(FASTBOOT_CMD_OEM_FORMAT)
+   [FASTBOOT_COMMAND_OEM_FORMAT] = {
+   .command = "oem format",
+   .dispatch = oem_format,
+   },
+#endif
 };
 
 /**
@@ -293,3 +302,27 @@ static void reboot_bootloader(char *cmd_parameter, char 
*response)
else
fastboot_okay(NULL, response);
 }
+
+#if CONFIG_IS_ENABLED(FASTBOOT_CMD_OEM_FORMAT)
+/**
+ * oem_format() - Execute the OEM format command
+ *
+ * @cmd_parameter: Pointer to command parameter
+ * @response: Pointer to fastboot response buffer
+ */
+static void oem_format(char *cmd_parameter, char *response)
+{
+   char cmdbuf[32];
+
+   if (!env_get("partitions")) {
+   fastboot_fail("partitions not set", response);
+   } else {
+   sprintf(cmdbuf, "gpt write mmc %x $partitions",
+   CONFIG_FASTBOOT_FLASH_MMC_DEV);
+   if (run_command(cmdbuf, 0))
+   fastboot_fail("", response);
+   else
+   fastboot_okay(NULL, response);
+   }
+}
+#endif
diff --git a/include/fastboot.h b/include/fastboot.h
index d7de385..3384c1a 100644
--- a/include/fastboot.h
+++ b/include/fastboot.h
@@ -33,6 +33,9 @@ enum {
FASTBOOT_COMMAND_REBOOT,
FASTBOOT_COMMAND_REBOOT_BOOTLOADER,
FASTBOOT_COMMAND_SET_ACTIVE,
+#if CONFIG_IS_ENABLED(FASTBOOT_CMD_OEM_FORMAT)
+   FASTBOOT_COMMAND_OEM_FORMAT,
+#endif
 
FASTBOOT_COMMAND_COUNT
 };
-- 
2.7.4

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


[U-Boot] [PATCH v5 11/16] ti: fastboot: Move weak overrides to board files

2018-05-17 Thread Alex Kiernan
Overriding fastboot_set_reboot_flag() in arch/arm/mach-omap2/boot-common.c
leaves it applying all boards that derive from this, not just the ones which
have support for Android bootloader flow. Move the weak function override to
the relevant board files.

Signed-off-by: Alex Kiernan 
Reviewed-by: Simon Glass 
---

Changes in v5: None
Changes in v4: None
Changes in v3:
- new

Changes in v2: None

 arch/arm/mach-omap2/boot-common.c | 10 --
 board/ti/am57xx/board.c   | 10 ++
 board/ti/dra7xx/evm.c | 10 ++
 3 files changed, 20 insertions(+), 10 deletions(-)

diff --git a/arch/arm/mach-omap2/boot-common.c 
b/arch/arm/mach-omap2/boot-common.c
index b22b671..d4a1e2e 100644
--- a/arch/arm/mach-omap2/boot-common.c
+++ b/arch/arm/mach-omap2/boot-common.c
@@ -236,13 +236,3 @@ void arch_preboot_os(void)
ahci_reset((void __iomem *)DWC_AHSATA_BASE);
 }
 #endif
-
-#if CONFIG_IS_ENABLED(FASTBOOT) && !CONFIG_IS_ENABLED(ENV_IS_NOWHERE)
-int fastboot_set_reboot_flag(void)
-{
-   printf("Setting reboot to fastboot flag ...\n");
-   env_set("dofastboot", "1");
-   env_save();
-   return 0;
-}
-#endif
diff --git a/board/ti/am57xx/board.c b/board/ti/am57xx/board.c
index fd9d207..177a324 100644
--- a/board/ti/am57xx/board.c
+++ b/board/ti/am57xx/board.c
@@ -1178,5 +1178,15 @@ void board_tee_image_process(ulong tee_image, size_t 
tee_size)
secure_tee_install((u32)tee_image);
 }
 
+#if CONFIG_IS_ENABLED(FASTBOOT) && !CONFIG_IS_ENABLED(ENV_IS_NOWHERE)
+int fastboot_set_reboot_flag(void)
+{
+   printf("Setting reboot to fastboot flag ...\n");
+   env_set("dofastboot", "1");
+   env_save();
+   return 0;
+}
+#endif
+
 U_BOOT_FIT_LOADABLE_HANDLER(IH_TYPE_TEE, board_tee_image_process);
 #endif
diff --git a/board/ti/dra7xx/evm.c b/board/ti/dra7xx/evm.c
index 6918f4d..bbe5445 100644
--- a/board/ti/dra7xx/evm.c
+++ b/board/ti/dra7xx/evm.c
@@ -1188,5 +1188,15 @@ void board_tee_image_process(ulong tee_image, size_t 
tee_size)
secure_tee_install((u32)tee_image);
 }
 
+#if CONFIG_IS_ENABLED(FASTBOOT) && !CONFIG_IS_ENABLED(ENV_IS_NOWHERE)
+int fastboot_set_reboot_flag(void)
+{
+   printf("Setting reboot to fastboot flag ...\n");
+   env_set("dofastboot", "1");
+   env_save();
+   return 0;
+}
+#endif
+
 U_BOOT_FIT_LOADABLE_HANDLER(IH_TYPE_TEE, board_tee_image_process);
 #endif
-- 
2.7.4

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


[U-Boot] [RFC PATCH v2 0/2] Convert USB fastboot code to use shared protocol

2018-05-17 Thread Alex Kiernan

This builds on the fastboot UDP support and migrates the USB fastboot code
to the shared code.

It's currently untested, other than passing in Travis:

https://travis-ci.org/akiernan/u-boot/builds/380023917


Changes in v2:
- remove redundant version.h
- use new fastboot_get_bytes_remaining() function

Alex Kiernan (2):
  usb: fastboot: Convert USB f_fastboot to shared fastboot
  fastboot: Update fastboot documentation

 doc/README.android-fastboot |  80 ++
 drivers/fastboot/Makefile   |   4 +-
 drivers/usb/gadget/f_fastboot.c | 318 +---
 3 files changed, 92 insertions(+), 310 deletions(-)

-- 
2.7.4

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


[U-Boot] [RFC PATCH v2 1/2] usb: fastboot: Convert USB f_fastboot to shared fastboot

2018-05-17 Thread Alex Kiernan
Convert USB fastboot code to use shared fastboot protocol.

Signed-off-by: Alex Kiernan 
---

Changes in v2:
- remove redundant version.h
- use new fastboot_get_bytes_remaining() function

 drivers/fastboot/Makefile   |   4 +-
 drivers/usb/gadget/f_fastboot.c | 318 +---
 2 files changed, 37 insertions(+), 285 deletions(-)

diff --git a/drivers/fastboot/Makefile b/drivers/fastboot/Makefile
index 8831096..a242156 100644
--- a/drivers/fastboot/Makefile
+++ b/drivers/fastboot/Makefile
@@ -1,7 +1,7 @@
 # SPDX-License-Identifier:  GPL-2.0+
 
 obj-y += fb_common.o
-obj-$(CONFIG_UDP_FUNCTION_FASTBOOT) += fb_getvar.o
-obj-$(CONFIG_UDP_FUNCTION_FASTBOOT) += fb_command.o
+obj-y += fb_getvar.o
+obj-y += fb_command.o
 obj-$(CONFIG_FASTBOOT_FLASH_MMC) += fb_mmc.o
 obj-$(CONFIG_FASTBOOT_FLASH_NAND) += fb_nand.o
diff --git a/drivers/usb/gadget/f_fastboot.c b/drivers/usb/gadget/f_fastboot.c
index 07d6a62..4a87dc5 100644
--- a/drivers/usb/gadget/f_fastboot.c
+++ b/drivers/usb/gadget/f_fastboot.c
@@ -18,14 +18,7 @@
 #include 
 #include 
 #include 
-#include 
 #include 
-#ifdef CONFIG_FASTBOOT_FLASH_MMC
-#include 
-#endif
-#ifdef CONFIG_FASTBOOT_FLASH_NAND
-#include 
-#endif
 
 #define FASTBOOT_INTERFACE_CLASS   0xff
 #define FASTBOOT_INTERFACE_SUB_CLASS   0x42
@@ -56,8 +49,6 @@ static inline struct f_fastboot *func_to_fastboot(struct 
usb_function *f)
 }
 
 static struct f_fastboot *fastboot_func;
-static unsigned int download_size;
-static unsigned int download_bytes;
 
 static struct usb_endpoint_descriptor fs_ep_in = {
.bLength= USB_DT_ENDPOINT_SIZE,
@@ -145,7 +136,6 @@ static struct usb_gadget_strings *fastboot_strings[] = {
 };
 
 static void rx_handler_command(struct usb_ep *ep, struct usb_request *req);
-static int strcmp_l1(const char *s1, const char *s2);
 
 static void fastboot_complete(struct usb_ep *ep, struct usb_request *req)
 {
@@ -355,85 +345,9 @@ static void compl_do_reset(struct usb_ep *ep, struct 
usb_request *req)
do_reset(NULL, 0, 0, NULL);
 }
 
-static void cb_reboot(struct usb_ep *ep, struct usb_request *req)
-{
-   char *cmd = req->buf;
-   if (!strcmp_l1("reboot-bootloader", cmd)) {
-   if (fastboot_set_reboot_flag()) {
-   fastboot_tx_write_str("FAILCannot set reboot flag");
-   return;
-   }
-   }
-   fastboot_func->in_req->complete = compl_do_reset;
-   fastboot_tx_write_str("OKAY");
-}
-
-static int strcmp_l1(const char *s1, const char *s2)
-{
-   if (!s1 || !s2)
-   return -1;
-   return strncmp(s1, s2, strlen(s1));
-}
-
-static void cb_getvar(struct usb_ep *ep, struct usb_request *req)
-{
-   char *cmd = req->buf;
-   char response[FASTBOOT_RESPONSE_LEN];
-   const char *s;
-   size_t chars_left;
-
-   strcpy(response, "OKAY");
-   chars_left = sizeof(response) - strlen(response) - 1;
-
-   strsep(&cmd, ":");
-   if (!cmd) {
-   pr_err("missing variable");
-   fastboot_tx_write_str("FAILmissing var");
-   return;
-   }
-
-   if (!strcmp_l1("version", cmd)) {
-   strncat(response, FASTBOOT_VERSION, chars_left);
-   } else if (!strcmp_l1("bootloader-version", cmd)) {
-   strncat(response, U_BOOT_VERSION, chars_left);
-   } else if (!strcmp_l1("downloadsize", cmd) ||
-   !strcmp_l1("max-download-size", cmd)) {
-   char str_num[12];
-
-   sprintf(str_num, "0x%08x", CONFIG_FASTBOOT_BUF_SIZE);
-   strncat(response, str_num, chars_left);
-   } else if (!strcmp_l1("serialno", cmd)) {
-   s = env_get("serial#");
-   if (s)
-   strncat(response, s, chars_left);
-   else
-   strcpy(response, "FAILValue not set");
-   } else {
-   char *envstr;
-
-   envstr = malloc(strlen("fastboot.") + strlen(cmd) + 1);
-   if (!envstr) {
-   fastboot_tx_write_str("FAILmalloc error");
-   return;
-   }
-
-   sprintf(envstr, "fastboot.%s", cmd);
-   s = env_get(envstr);
-   if (s) {
-   strncat(response, s, chars_left);
-   } else {
-   printf("WARNING: unknown variable: %s\n", cmd);
-   strcpy(response, "FAILVariable not implemented");
-   }
-
-   free(envstr);
-   }
-   fastboot_tx_write_str(response);
-}
-
 static unsigned int rx_bytes_expected(struct usb_ep *ep)
 {
-   int rx_remain = download_size - download_bytes;
+   int rx_remain = fastboot_get_bytes_remaining();
unsigned int rem;
unsigned int maxpacket = ep->maxpacket;
 
@@ -455,14 +369,12 @@ static unsigned int rx_bytes_expected(struct usb_ep *ep)
return rx_remain;
 }
 
-#define BYTES_PER_DOT  0

  1   2   >