Re: [U-Boot] [PATCH 03/14] misc: uclass: Introduce misc_init_by_ofnode

2019-08-13 Thread Keerthy



On 13/08/19 3:04 PM, Simon Glass wrote:

Hi Keerthy,

On Tue, 6 Aug 2019 at 04:38, Keerthy  wrote:


Introduce misc_init_by_ofnode to probe a misc device
using its ofnode.


What is the purpose of this? All patches should have a motivation.


Okay. I will add more details in the commit log. In my case pruss which
is the pru subsystem which is a misc device needs to be probed before 
pru device which is an rproc class device. I will try to figure out a 
cleaner way if it exists.






Signed-off-by: Keerthy 
---
  drivers/misc/misc-uclass.c | 25 +
  include/misc.h |  9 +
  2 files changed, 34 insertions(+)

diff --git a/drivers/misc/misc-uclass.c b/drivers/misc/misc-uclass.c
index 55381edc98..835d3f7118 100644
--- a/drivers/misc/misc-uclass.c
+++ b/drivers/misc/misc-uclass.c
@@ -5,6 +5,8 @@

  #include 
  #include 
+#include 
+#include 
  #include 
  #include 

@@ -65,6 +67,29 @@ int misc_set_enabled(struct udevice *dev, bool val)
 return ops->set_enabled(dev, val);
  }

+int misc_init_by_ofnode(ofnode node)
+{
+   struct udevice *dev = NULL;
+   int ret;
+   long temp1, temp2;
+
+   temp1 = ofnode_to_offset(node);


Why convert to offset? Can you just compare the node?


Yes okay.




+
+   for (ret = uclass_find_first_device(UCLASS_MISC, ); dev;
+ret = uclass_find_next_device()) {


uclass_foreach_dev(dev, UCLASS_MISC) {


okay




+   temp2 = ofnode_to_offset(dev_ofnode(dev));


Again hopefully you can avoid this conversion. It won't work with livetree.


okay




+   if (temp1 == temp2) {
+   ret = device_probe(dev);


Hmm can you use uclass_foreach_dev_probe() above instead?


okay. I will try to figure out a cleaner way for my case.

Thanks for the review.





+   if (ret)
+   debug("%s: Failed to initialize - %d\n",
+ dev->name, ret);
+   return ret;
+   }
+   }
+
+   return -ENODEV;
+}
+
  UCLASS_DRIVER(misc) = {
 .id = UCLASS_MISC,
 .name   = "misc",
diff --git a/include/misc.h b/include/misc.h
index 12d1325ee2..79263ed480 100644
--- a/include/misc.h
+++ b/include/misc.h
@@ -76,6 +76,15 @@ int misc_call(struct udevice *dev, int msgid, void *tx_msg, 
int tx_size,
   */
  int misc_set_enabled(struct udevice *dev, bool val);

+/**
+ * misc_init_by_ofnode() - Probe a misc device by using ofnode.
+ * @node: ofnode of the misc device.
+ *
+ * A misc device is probed using ofnode.
+ *
+ * Return: -ve on error, 0 on success
+ */
+int misc_init_by_ofnode(ofnode node);
  /*
   * struct misc_ops - Driver model Misc operations
   *
--
2.17.1


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


Re: [U-Boot] [PATCH v4 3/5] powerpc: dts: t2080: add espi controller node support

2019-08-13 Thread Prabhakar Kushwaha

> -Original Message-
> From: Chuanhua Han 
> Sent: Friday, June 21, 2019 7:52 AM
> To: w...@denx.de; Shengzhou Liu ; Ruchika Gupta
> ; ja...@openedev.com; s...@chromium.org;
> Prabhakar Kushwaha 
> Cc: u-boot@lists.denx.de; Chuanhua Han 
> Subject: [PATCH v4 3/5] powerpc: dts: t2080: add espi controller node
> support
> 
> Add espi controller node to support t2080.
> 
> Signed-off-by: Chuanhua Han 
> ---
> depends on:
> -
> https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fpatch
> work.ozlabs.org%2Fproject%2Fuboot%2Flist%2F%3Fseries%3D99439d
> ata=02%7C01%7Cprabhakar.kushwaha%40nxp.com%7Cc3450ace13cf4318200
> 508d6f5ef0763%7C686ea1d3bc2b4c6fa92cd99c5c301635%7C0%7C0%7C63696
> 6804303104798sdata=D%2BWYX3LJDQ5DYUHgtCSVXGb3F9GblfDhGZw
> No8BEldI%3Dreserved=0
> 
> Changes in v4:
>   - No change.
> Changes in v3:
>   - Add a cover-letter for this patch set.
> Changes in v2:
>   - No change.
> 
>  arch/powerpc/dts/t2080.dtsi | 10 ++
>  1 file changed, 10 insertions(+)
> 

Acked-by: Prabhakar Kushwaha 

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


Re: [U-Boot] [PATCH v4 4/5] powerpc: dts: t2080qds: add espi slave nodes support

2019-08-13 Thread Prabhakar Kushwaha

> -Original Message-
> From: Chuanhua Han 
> Sent: Friday, June 21, 2019 7:52 AM
> To: w...@denx.de; Shengzhou Liu ; Ruchika Gupta
> ; ja...@openedev.com; s...@chromium.org;
> Prabhakar Kushwaha 
> Cc: u-boot@lists.denx.de; Chuanhua Han 
> Subject: [PATCH v4 4/5] powerpc: dts: t2080qds: add espi slave nodes
> support
> 
> Add espi slave nodes  to support t2080qds.
> 
> Signed-off-by: Chuanhua Han 
> ---
> depends on:
> -
> https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fpatch
> work.ozlabs.org%2Fproject%2Fuboot%2Flist%2F%3Fseries%3D99439d
> ata=02%7C01%7Cprabhakar.kushwaha%40nxp.com%7C60e8147b84eb47e543
> 2608d6f5ef09ac%7C686ea1d3bc2b4c6fa92cd99c5c301635%7C0%7C0%7C63696
> 6804334431322sdata=l%2BXzp5DoxG0%2BPKbhOhgEeTmQvn%2FM1Z
> r0qNVVGyckBEc%3Dreserved=0
> 
> Changes in v4:
>   - Modify the spi-max-frequency attribute value of the flash@x node
> of the device tree.
> Changes in v3:
>   - Add a cover-letter for this patch set.
> Changes in v2:
>   - No change.
> 
>  arch/powerpc/dts/t2080qds.dts | 33
> +
>  1 file changed, 33 insertions(+)
> 

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


Re: [U-Boot] [PATCH v4 0/5] dm: spi: Convert Freescale ESPI driver to driver

2019-08-13 Thread Prabhakar Kushwaha
Dear Jagan,

> -Original Message-
> From: Chuanhua Han 
> Sent: Friday, June 21, 2019 7:52 AM
> To: w...@denx.de; Shengzhou Liu ; Ruchika Gupta
> ; ja...@openedev.com; s...@chromium.org;
> Prabhakar Kushwaha 
> Cc: u-boot@lists.denx.de; Chuanhua Han 
> Subject: [PATCH v4 0/5] dm: spi: Convert Freescale ESPI driver to driver
> 
> In order to convert the Freescale ESPI driver to the driver model, there are 5
> related patches in the current patch set:
> 
> 0001-spl-dm-disable-SPI-DM-flash-for-non-DM-SPL.patch
> 0002-dm-spi-Convert-Freescale-ESPI-driver-to-driver-model.patch
> 0003-powerpc-dts-t2080-add-espi-controller-node-support.patch
> 0004-powerpc-dts-t2080qds-add-espi-slave-nodes-support.patch
> 0005-configs-enable-espi-device-module-in-T2080QDS.patch
> 
> The first patch is to solve the problem that spl can't work when spiboot, and
> this is required for SPI boot.
> 
> The other four patches are supported by the driver model. This patchset
> already supports the full dm mode, and fsl_espi driver support both
> OF_CONTROL and PLATDATA.
> 
> Chuanhua Han (5):
>   spl: dm: disable SPI DM flash for non-DM SPL
>   dm: spi: Convert Freescale ESPI driver to driver model
>   powerpc: dts: t2080: add espi controller node support
>   powerpc: dts: t2080qds: add espi slave nodes support
>   configs: enable espi device module in T2080QDS
> 

If there is no review comments, can you please pick this series via your tree
I am delegating this patch-set to you. 

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


Re: [U-Boot] [PATCH 1/2] i.MX6: nand: extend nandbcb command for imx6UL(L)

2019-08-13 Thread Shyam Saini
> Hi Shyam,
>
> On 8/13/19 3:40 PM, Shyam Saini wrote:
> > Hi Parthiban,
> >
> > Thanks a lot for working on this.
>
> Still enabling SECURE_BOOT fails to boot. Am yet to figure out this.
> Do you have secure boot working from NAND?

I haven't tried secure boot with nand and our imx6ul board has some other nand
boot issues so couldn't test it soon.

>
> >
> > Please see comments below.
> >
> >> Firmware Configuration Block(FCB) for imx6ul(l) needs to be
> >> BCH encoded. This patch depends on [1].
> >>
> >> [1]: https://patchwork.ozlabs.org/project/uboot/list/?series=113810
> >>
> >> Signed-off-by: Parthiban Nallathambi 
> >> ---
> >>   arch/arm/mach-imx/Kconfig   |  1 +
> >>   arch/arm/mach-imx/cmd_nandbcb.c | 72 -
> >>   2 files changed, 71 insertions(+), 2 deletions(-)
> >>
> >> diff --git a/arch/arm/mach-imx/Kconfig b/arch/arm/mach-imx/Kconfig
> >> index aeb5493488..175bed601e 100644
> >> --- a/arch/arm/mach-imx/Kconfig
> >> +++ b/arch/arm/mach-imx/Kconfig
> >> @@ -74,6 +74,7 @@ config CMD_HDMIDETECT
> >>   config CMD_NANDBCB
> >>  bool "i.MX6 NAND Boot Control Block(BCB) command"
> >>  depends on NAND && CMD_MTDPARTS
> >> +   select BCH if MX6UL || MX6ULL
> >>  default y if ARCH_MX6 && NAND_MXS
> >>  help
> >>Unlike normal 'nand write/erase' commands, this command update
> >> diff --git a/arch/arm/mach-imx/cmd_nandbcb.c 
> >> b/arch/arm/mach-imx/cmd_nandbcb.c
> >> index 065b814b2e..34176ee6e4 100644
> >> --- a/arch/arm/mach-imx/cmd_nandbcb.c
> >> +++ b/arch/arm/mach-imx/cmd_nandbcb.c
> >> @@ -14,8 +14,10 @@
> >>
> >>   #include 
> >>   #include 
> >> +#include 
> >>   #include 
> >>
> >> +#include 
> >>   #include 
> >>   #include 
> >>   #include 
> >> @@ -25,6 +27,66 @@
> >>   #define BF_VAL(v, bf)  (((v) & bf##_MASK) >> bf##_OFFSET)
> >>   #define GETBIT(v, n)   (((v) >> (n)) & 0x1)
> >>
> >> +static uint8_t reverse_bit(uint8_t b)
> >> +{
> >> +   b = (b & 0xf0) >> 4 | (b & 0x0f) << 4;
> >> +   b = (b & 0xcc) >> 2 | (b & 0x33) << 2;
> >> +   b = (b & 0xaa) >> 1 | (b & 0x55) << 1;
> >> +
> >> +   return b;
> >> +}
> >> +
> >> +static void encode_bch_ecc(void *buf, struct fcb_block *fcb, int eccbits)
> >> +{
> >> +   int i, j, m = 13;
> >> +   int blocksize = 128;
> >> +   int numblocks = 8;
> >> +   int ecc_buf_size = (m * eccbits + 7) / 8;
> >> +   struct bch_control *bch = init_bch(m, eccbits, 0);
> >> +   u8 *ecc_buf = kzalloc(ecc_buf_size, GFP_KERNEL);
> >> +   u8 *tmp_buf = kzalloc(blocksize * numblocks, GFP_KERNEL);
> >> +   u8 *psrc, *pdst;
> >> +
> >> +   /*
> >> +* The blocks here are bit aligned. If eccbits is a multiple of 8,
> >> +* we just can copy bytes. Otherwiese we must move the blocks to
> >> +* the next free bit position.
> >> +*/
> >> +   WARN_ON(eccbits % 8);
> >> +
> >> +   memcpy(tmp_buf, fcb, sizeof(*fcb));
> >> +
> >> +   for (i = 0; i < numblocks; i++) {
> >> +   memset(ecc_buf, 0, ecc_buf_size);
> >> +   psrc = tmp_buf + i * blocksize;
> >> +   pdst = buf + i * (blocksize + ecc_buf_size);
> >> +
> >> +   /* copy data byte aligned to destination buf */
> >> +   memcpy(pdst, psrc, blocksize);
> >> +
> >> +   /*
> >> +* imx-kobs use a modified encode_bch which reverse the
> >> +* bit order of the data before calculating bch.
> >> +* Do this in the buffer and use the bch lib here.
> >> +*/
> >> +   for (j = 0; j < blocksize; j++)
> >> +   psrc[j] = reverse_bit(psrc[j]);
> >> +
> >> +   encode_bch(bch, psrc, blocksize, ecc_buf);
> >> +
> >> +   /* reverse ecc bit */
> >> +   for (j = 0; j < ecc_buf_size; j++)
> >> +   ecc_buf[j] = reverse_bit(ecc_buf[j]);
> >> +
> >> +   /* Here eccbuf is byte aligned and we can just copy it */
> >> +   memcpy(pdst + blocksize, ecc_buf, ecc_buf_size);
> >> +   }
> >> +
> >> +   free(ecc_buf);
> >> +   free(tmp_buf);
> >> +   free_bch(bch);
> >
> > I have used kfree() instead of free() in entire nand bcb code
> > So, I think for consistency reason it should be kfree here.
> >
> > Could you please resend this patch with above mentioned changes.
> > Other than this,
>
> Thanks, will change it to kfree in v2.
>
> >
> >>
> >>   static u8 calculate_parity_13_8(u8 d)
> >>   {
> >>  u8 p = 0;
> >> @@ -231,8 +293,14 @@ static int nandbcb_update(struct mtd_info *mtd, 
> >> loff_t off, size_t size,
> >>  goto dbbt_data_page_err;
> >>  }
> >>
> >> -   memcpy(fcb_raw_page + 12, fcb, sizeof(struct fcb_block));
> >> -   encode_hamming_13_8(fcb_raw_page + 12, fcb_raw_page + 12 + 512, 
> >> 512);
> >> +   if (is_mx6ul() || is_mx6ull()) {
> >> +   /* 40 

Re: [U-Boot] [PATCH v2] armv8: ls1028a: Add environment variables to facilitate the boot

2019-08-13 Thread Prabhakar Kushwaha
Dear Andy,


> -Original Message-
> From: Yuantian Tang 
> Sent: Wednesday, June 19, 2019 12:48 PM
> To: Prabhakar Kushwaha 
> Cc: u-boot@lists.denx.de; Andy Tang 
> Subject: [PATCH v2] armv8: ls1028a: Add environment variables to facilitate
> the boot
> 
> Add some environment variables to facilitate the auto boot.
> 
> Signed-off-by: Yuantian Tang 
> ---
> v2:
>   - merge with its dependent patch
>  include/configs/ls1028a_common.h | 28 +---
>  1 file changed, 25 insertions(+), 3 deletions(-)
> 
> diff --git a/include/configs/ls1028a_common.h
> b/include/configs/ls1028a_common.h
> index 0db86396e9..022981bfa3 100644
> --- a/include/configs/ls1028a_common.h
> +++ b/include/configs/ls1028a_common.h
> @@ -67,6 +67,7 @@
> 
>  #define BOOT_TARGET_DEVICES(func) \
>   func(MMC, mmc, 0) \
> + func(MMC, mmc, 1) \
>   func(USB, usb, 0)
>  #include 
> 
> @@ -127,25 +128,46 @@
>   "${scripthdraddr} ${prefix}${boot_script_hdr} " \
>   "&& esbc_validate ${scripthdraddr};"\
>   "source ${scriptaddr}\0"  \
> - "sd_bootcmd=echo Trying load from SD ..;"   \
> + "xspi_bootcmd=echo Trying load from FlexSPI flash ...;" \
> + "sf probe 0:0 && sf read $load_addr " \
> + "$kernel_start $kernel_size ; env exists secureboot &&" \
> + "sf read $kernelheader_addr_r $kernelheader_start " \
> + "$kernelheader_size && esbc_validate
> ${kernelheader_addr_r}; "\
> + " bootm $load_addr#$board\0" \
> + "xspi_hdploadcmd=echo Trying load HDP firmware from FlexSPI...;" \
> + "sf probe 0:0 && sf read $load_addr 0x94 0x3 " \
> + "&& hdp load $load_addr 0x2000\0"   \
> + "sd_bootcmd=echo Trying load from SD ...;" \
>   "mmcinfo; mmc read $load_addr " \
>   "$kernel_addr_sd $kernel_size_sd && "   \
>   "env exists secureboot && mmc read $kernelheader_addr_r
> " \
>   "$kernelhdr_addr_sd $kernelhdr_size_sd "\
>   " && esbc_validate ${kernelheader_addr_r};" \
>   "bootm $load_addr#$board\0" \
> + "sd_hdploadcmd=echo Trying load HDP firmware from SD..;"\
> + "mmcinfo;mmc read $load_addr 0x4a00 0x200 " \
> + "&& hdp load $load_addr 0x2000\0"   \
>   "emmc_bootcmd=echo Trying load from EMMC ..;"   \
>   "mmcinfo; mmc dev 1; mmc read $load_addr "  \
>   "$kernel_addr_sd $kernel_size_sd && "   \
>   "env exists secureboot && mmc read $kernelheader_addr_r
> " \
>   "$kernelhdr_addr_sd $kernelhdr_size_sd "\
>   " && esbc_validate ${kernelheader_addr_r};" \
> - "bootm $load_addr#$board\0"
> + "bootm $load_addr#$board\0" \
> + "emmc_hdploadcmd=echo Trying load HDP firmware from EMMC..;"
> \
> + "mmc dev 1;mmcinfo;mmc read $load_addr 0x4a00 0x200 "
>   \
> + "&& hdp load $load_addr 0x2000\0"
> 
>  #undef CONFIG_BOOTCOMMAND
> 
> +#define XSPI_NOR_BOOTCOMMAND \
> + "run xspi_hdploadcmd; run distro_bootcmd; run xspi_bootcmd; " \
> + "env exists secureboot && esbc_halt;;"
>  #define SD_BOOTCOMMAND   \
> - "run distro_bootcmd;run sd_bootcmd; " \
> + "run sd_hdploadcmd; run distro_bootcmd;run sd_bootcmd; " \
> + "env exists secureboot && esbc_halt;"
> +#define SD2_BOOTCOMMAND  \
> + "run emmc_hdploadcmd; run distro_bootcmd;run emmc_bootcmd;
> " \
>   "env exists secureboot && esbc_halt;"
> 
>  /* Monitor Command Prompt */
> --
> 2.17.1

As there is no flexspi and hdp driver.  I will suggest to avoid these words in 
patch

--pk



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


[U-Boot] [PATCH 1/1] efi_loader: do not call efi_runtime_detach twice

2019-08-13 Thread Heinrich Schuchardt
Commit 7f95104d91cc ("efi_loader: detach runtime in ExitBootServices()")
added a call to efi_runtime_detach() to ExitBootServices() but did not
remove the call in SetVirtualAddressMap().

Remove the superfluous function call.

Correct a comment referring to efi_runtime_detach().

Fixes: 7f95104d91cc ("efi_loader: detach runtime in ExitBootServices()")
Signed-off-by: Heinrich Schuchardt 
---
 lib/efi_loader/efi_runtime.c | 13 -
 1 file changed, 4 insertions(+), 9 deletions(-)

diff --git a/lib/efi_loader/efi_runtime.c b/lib/efi_loader/efi_runtime.c
index 54e5a98bfc..ced00516f7 100644
--- a/lib/efi_loader/efi_runtime.c
+++ b/lib/efi_loader/efi_runtime.c
@@ -565,7 +565,10 @@ void efi_runtime_relocate(ulong offset, struct 
efi_mem_desc *map)

p = (void*)((ulong)rel->offset - base) + gd->relocaddr;

-   /* The runtime services are updated in efi_runtime_detach() */
+   /*
+* The runtime services table is updated in
+* efi_relocate_runtime_table()
+*/
if (map && efi_is_runtime_service_pointer(p))
continue;

@@ -724,14 +727,6 @@ static efi_status_t EFIAPI efi_set_virtual_address_map(
}
}

-   /*
-* Some runtime services are implemented in a way that we can only offer
-* them at boottime. Replace those function pointers.
-*
-* TODO: move this call to ExitBootServices().
-*/
-   efi_runtime_detach();
-
/* Relocate the runtime. See TODO above */
for (i = 0; i < n; i++) {
struct efi_mem_desc *map;
--
2.20.1

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


[U-Boot] [PATCH 1/1] efi_loader: parameter check in SetVirtualAddressMap

2019-08-13 Thread Heinrich Schuchardt
Check the parameters DescriptorSize and DescriptiorVersion of
SetVirtualAddressMap() as prescribed by the UEFI specification.

Signed-off-by: Heinrich Schuchardt 
---
 lib/efi_loader/efi_runtime.c | 13 ++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/lib/efi_loader/efi_runtime.c b/lib/efi_loader/efi_runtime.c
index fb24131462..54e5a98bfc 100644
--- a/lib/efi_loader/efi_runtime.c
+++ b/lib/efi_loader/efi_runtime.c
@@ -641,12 +641,17 @@ static efi_status_t EFIAPI efi_set_virtual_address_map(
 {
efi_uintn_t n = memory_map_size / descriptor_size;
efi_uintn_t i;
+   efi_status_t ret = EFI_INVALID_PARAMETER;
int rt_code_sections = 0;
struct efi_event *event;

EFI_ENTRY("%zx %zx %x %p", memory_map_size, descriptor_size,
  descriptor_version, virtmap);

+   if (descriptor_version != EFI_MEMORY_DESCRIPTOR_VERSION ||
+   descriptor_size < sizeof(struct efi_mem_desc))
+   goto out;
+
efi_virtmap = virtmap;
efi_descriptor_size = descriptor_size;
efi_descriptor_count = n;
@@ -677,7 +682,7 @@ static efi_status_t EFIAPI efi_set_virtual_address_map(
 * We expose exactly one single runtime code section, so
 * something is definitely going wrong.
 */
-   return EFI_EXIT(EFI_INVALID_PARAMETER);
+   goto out;
}

/* Notify EVT_SIGNAL_VIRTUAL_ADDRESS_CHANGE */
@@ -738,11 +743,13 @@ static efi_status_t EFIAPI efi_set_virtual_address_map(

efi_relocate_runtime_table(new_offset);
efi_runtime_relocate(new_offset, map);
-   return EFI_EXIT(EFI_SUCCESS);
+   ret = EFI_SUCCESS;
+   goto out;
}
}

-   return EFI_EXIT(EFI_INVALID_PARAMETER);
+out:
+   return EFI_EXIT(ret);
 }

 /**
--
2.20.1

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


Re: [U-Boot] [PATCH v3] qemu-x86: Use config_distro_bootcmd

2019-08-13 Thread Heinrich Schuchardt

On 7/19/19 11:46 AM, Bin Meng wrote:

On Wed, Jul 17, 2019 at 1:43 PM Bin Meng  wrote:


On Thu, Jul 4, 2019 at 1:46 AM Joshua Watt  wrote:


Converts qemu x86 machines to boot using distro_config. The intent is to
allow u-boot in qemu to be maximally compatible with many boot methods
without having to change the config. Previously, u-boot would only boot
in a very limited set of circumstances where there was a /boot/vmlinuz
on scsi 0:3 with no ramdisk.

Signed-off-by: Joshua Watt 
---
  configs/qemu-x86_64_defconfig |  1 +
  configs/qemu-x86_defconfig|  1 +
  doc/README.x86| 17 +
  include/configs/qemu-x86.h| 25 +
  4 files changed, 44 insertions(+)



Reviewed-by: Bin Meng 


applied to u-boot-x86, thanks!
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot



This patch leads to a build error when building with
CONFIG_DISTRO_DEFAULTS=n.

In file included from include/configs/qemu-x86.h:23,
 from include/config.h:5,
 from include/common.h:23,
 from lib/asm-offsets.c:14:
include/configs/x86-common.h:109: error: "BOOTENV" redefined [-Werror]
 #define BOOTENV

In file included from include/configs/qemu-x86.h:22,
 from include/config.h:5,
 from include/common.h:23,
 from lib/asm-offsets.c:14:
include/config_distro_bootcmd.h:407: note: this is the location of the
previous definition
 #define BOOTENV \

I am glad that qemu-x86 now can use distro defaults. But I would not
expect a build error due to a legal configuration choice.

If you do not want to retain backwards compatibility you could 'select
DISTRO_DEFAULTS' in board/emulation/Kconfig. This way distro defaults
would no longer be deselectable for qemu-x86.

Best regards

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


[U-Boot] [PATCH 6/6] cbfs: Rename camel-case variables

2019-08-13 Thread Simon Glass
Rename some camel-case variables to match U-Boot style.

Camel case is not generally allowed in U-Boot. Rename this variable to fit
in with the style.

Signed-off-by: Simon Glass 
---

 fs/cbfs/cbfs.c | 44 ++--
 1 file changed, 22 insertions(+), 22 deletions(-)

diff --git a/fs/cbfs/cbfs.c b/fs/cbfs/cbfs.c
index bb795e7288..aaf9ce941b 100644
--- a/fs/cbfs/cbfs.c
+++ b/fs/cbfs/cbfs.c
@@ -73,14 +73,14 @@ static void swap_file_header(struct cbfs_fileheader *dest,
  * @param startThe location in memory to start from.
  * @param size The size of the memory region to search.
  * @param alignThe alignment boundaries to check on.
- * @param newNode  A pointer to the file structure to load.
+ * @param new_node A pointer to the file structure to load.
  * @param used A pointer to the count of of bytes scanned through,
  * including the file if one is found.
  *
  * @return 1 if a file is found, 0 if one isn't.
  */
 static int file_cbfs_next_file(struct cbfs_priv *priv, u8 *start, u32 size,
-  u32 align, struct cbfs_cachenode *newNode,
+  u32 align, struct cbfs_cachenode *new_node,
   u32 *used)
 {
struct cbfs_fileheader header;
@@ -88,34 +88,34 @@ static int file_cbfs_next_file(struct cbfs_priv *priv, u8 
*start, u32 size,
*used = 0;
 
while (size >= align) {
-   const struct cbfs_fileheader *fileHeader =
+   const struct cbfs_fileheader *file_header =
(const struct cbfs_fileheader *)start;
u32 name_len;
u32 step;
 
/* Check if there's a file here. */
-   if (memcmp(good_file_magic, &(fileHeader->magic),
-   sizeof(fileHeader->magic))) {
+   if (memcmp(good_file_magic, _header->magic,
+  sizeof(file_header->magic))) {
*used += align;
size -= align;
start += align;
continue;
}
 
-   swap_file_header(, fileHeader);
+   swap_file_header(, file_header);
if (header.offset < sizeof(struct cbfs_fileheader)) {
priv->result = CBFS_BAD_FILE;
return -1;
}
-   newNode->next = NULL;
-   newNode->type = header.type;
-   newNode->data = start + header.offset;
-   newNode->data_length = header.len;
+   new_node->next = NULL;
+   new_node->type = header.type;
+   new_node->data = start + header.offset;
+   new_node->data_length = header.len;
name_len = header.offset - sizeof(struct cbfs_fileheader);
-   newNode->name = (char *)fileHeader +
+   new_node->name = (char *)file_header +
sizeof(struct cbfs_fileheader);
-   newNode->name_length = name_len;
-   newNode->attributes_offset = header.attributes_offset;
+   new_node->name_length = name_len;
+   new_node->attributes_offset = header.attributes_offset;
 
step = header.len;
if (step % align)
@@ -132,15 +132,15 @@ static void file_cbfs_fill_cache(struct cbfs_priv *priv, 
u8 *start, u32 size,
 u32 align)
 {
struct cbfs_cachenode *cache_node;
-   struct cbfs_cachenode *newNode;
+   struct cbfs_cachenode *new_node;
struct cbfs_cachenode **cache_tail = >file_cache;
 
/* Clear out old information. */
cache_node = priv->file_cache;
while (cache_node) {
-   struct cbfs_cachenode *oldNode = cache_node;
+   struct cbfs_cachenode *old_node = cache_node;
cache_node = cache_node->next;
-   free(oldNode);
+   free(old_node);
}
priv->file_cache = NULL;
 
@@ -148,20 +148,20 @@ static void file_cbfs_fill_cache(struct cbfs_priv *priv, 
u8 *start, u32 size,
int result;
u32 used;
 
-   newNode = (struct cbfs_cachenode *)
+   new_node = (struct cbfs_cachenode *)
malloc(sizeof(struct cbfs_cachenode));
-   result = file_cbfs_next_file(priv, start, size, align, newNode,
+   result = file_cbfs_next_file(priv, start, size, align, new_node,
 );
 
if (result < 0) {
-   free(newNode);
+   free(new_node);
return;
} else if (result == 0) {
-   free(newNode);
+   free(new_node);
break;

[U-Boot] [PATCH 4/6] cbfs: Move result variable into the struct

2019-08-13 Thread Simon Glass
Move the result variable into the struct also, so that it can be used when
BSS is not available. Add a function to read it.

Note that all functions sill use the BSS version of the data.

Signed-off-by: Simon Glass 
---

 cmd/cbfs.c |  4 ++--
 fs/cbfs/cbfs.c | 45 +
 include/cbfs.h |  7 +++
 3 files changed, 34 insertions(+), 22 deletions(-)

diff --git a/cmd/cbfs.c b/cmd/cbfs.c
index 3d1fc95972..98e652a4e7 100644
--- a/cmd/cbfs.c
+++ b/cmd/cbfs.c
@@ -29,7 +29,7 @@ static int do_cbfs_init(cmd_tbl_t *cmdtp, int flag, int argc,
}
}
file_cbfs_init(end_of_rom);
-   if (file_cbfs_result != CBFS_SUCCESS) {
+   if (cbfs_get_result() != CBFS_SUCCESS) {
printf("%s.\n", file_cbfs_error());
return 1;
}
@@ -67,7 +67,7 @@ static int do_cbfs_fsload(cmd_tbl_t *cmdtp, int flag, int 
argc,
 
file = file_cbfs_find(argv[2]);
if (!file) {
-   if (file_cbfs_result == CBFS_FILE_NOT_FOUND)
+   if (cbfs_get_result() == CBFS_FILE_NOT_FOUND)
printf("%s: %s\n", file_cbfs_error(), argv[2]);
else
printf("%s.\n", file_cbfs_error());
diff --git a/fs/cbfs/cbfs.c b/fs/cbfs/cbfs.c
index f4298d7320..dafdfb1a07 100644
--- a/fs/cbfs/cbfs.c
+++ b/fs/cbfs/cbfs.c
@@ -8,7 +8,6 @@
 #include 
 #include 
 
-enum cbfs_result file_cbfs_result;
 static const u32 good_magic = 0x4f524243;
 static const u8 good_file_magic[] = "LARCHIVE";
 
@@ -16,13 +15,14 @@ struct cbfs_priv {
int initialized;
struct cbfs_header header;
struct cbfs_cachenode *file_cache;
+   enum cbfs_result result;
 };
 
 static struct cbfs_priv cbfs_s;
 
 const char *file_cbfs_error(void)
 {
-   switch (file_cbfs_result) {
+   switch (cbfs_s.result) {
case CBFS_SUCCESS:
return "Success";
case CBFS_NOT_INITIALIZED:
@@ -38,6 +38,11 @@ const char *file_cbfs_error(void)
}
 }
 
+enum cbfs_result cbfs_get_result(void)
+{
+   return cbfs_s.result;
+}
+
 /* Do endian conversion on the CBFS header structure. */
 static void swap_header(struct cbfs_header *dest, struct cbfs_header *src)
 {
@@ -99,7 +104,7 @@ static int file_cbfs_next_file(struct cbfs_priv *priv, u8 
*start, u32 size,
 
swap_file_header(, fileHeader);
if (header.offset < sizeof(struct cbfs_fileheader)) {
-   file_cbfs_result = CBFS_BAD_FILE;
+   priv->result = CBFS_BAD_FILE;
return -1;
}
newNode->next = NULL;
@@ -161,7 +166,7 @@ static void file_cbfs_fill_cache(struct cbfs_priv *priv, u8 
*start, u32 size,
size -= used;
start += used;
}
-   file_cbfs_result = CBFS_SUCCESS;
+   priv->result = CBFS_SUCCESS;
 }
 
 /* Get the CBFS header out of the ROM and do endian conversion. */
@@ -176,7 +181,7 @@ static int file_cbfs_load_header(uintptr_t end_of_rom,
 
if (header->magic != good_magic || header->offset >
header->rom_size - header->boot_block_size) {
-   file_cbfs_result = CBFS_BAD_HEADER;
+   cbfs_s.result = CBFS_BAD_HEADER;
return 1;
}
return 0;
@@ -195,7 +200,7 @@ void cbfs_init(struct cbfs_priv *priv, uintptr_t end_of_rom)
 
file_cbfs_fill_cache(priv, start_of_rom, priv->header.rom_size,
 priv->header.align);
-   if (file_cbfs_result == CBFS_SUCCESS)
+   if (priv->result == CBFS_SUCCESS)
priv->initialized = 1;
 }
 
@@ -209,10 +214,10 @@ const struct cbfs_header *file_cbfs_get_header(void)
struct cbfs_priv *priv = _s;
 
if (priv->initialized) {
-   file_cbfs_result = CBFS_SUCCESS;
+   priv->result = CBFS_SUCCESS;
return >header;
} else {
-   file_cbfs_result = CBFS_NOT_INITIALIZED;
+   priv->result = CBFS_NOT_INITIALIZED;
return NULL;
}
 }
@@ -222,10 +227,10 @@ const struct cbfs_cachenode *file_cbfs_get_first(void)
struct cbfs_priv *priv = _s;
 
if (!priv->initialized) {
-   file_cbfs_result = CBFS_NOT_INITIALIZED;
+   priv->result = CBFS_NOT_INITIALIZED;
return NULL;
} else {
-   file_cbfs_result = CBFS_SUCCESS;
+   priv->result = CBFS_SUCCESS;
return priv->file_cache;
}
 }
@@ -235,14 +240,14 @@ void file_cbfs_get_next(const struct cbfs_cachenode 
**file)
struct cbfs_priv *priv = _s;
 
if (!priv->initialized) {
-   file_cbfs_result = CBFS_NOT_INITIALIZED;
+   priv->result = CBFS_NOT_INITIALIZED;
*file = NULL;
return;
}
 
if (*file)
*file = (*file)->next;
-   file_cbfs_result 

[U-Boot] [PATCH 3/6] cbfs: Move static variables into a struct

2019-08-13 Thread Simon Glass
At present there are a number of static variables in BSS. This cannot work
with SPL, at least until BSS is available in board_init_r().

Move the variables into a struct, so it is possible to malloc() it and use
it before BSS is available.

Signed-off-by: Simon Glass 
---

 fs/cbfs/cbfs.c | 96 +-
 1 file changed, 63 insertions(+), 33 deletions(-)

diff --git a/fs/cbfs/cbfs.c b/fs/cbfs/cbfs.c
index 2a9edcc9a0..f4298d7320 100644
--- a/fs/cbfs/cbfs.c
+++ b/fs/cbfs/cbfs.c
@@ -11,9 +11,14 @@
 enum cbfs_result file_cbfs_result;
 static const u32 good_magic = 0x4f524243;
 static const u8 good_file_magic[] = "LARCHIVE";
-static int initialized;
-static struct cbfs_header cbfs_header;
-static struct cbfs_cachenode *file_cache;
+
+struct cbfs_priv {
+   int initialized;
+   struct cbfs_header header;
+   struct cbfs_cachenode *file_cache;
+};
+
+static struct cbfs_priv cbfs_s;
 
 const char *file_cbfs_error(void)
 {
@@ -69,8 +74,9 @@ static void swap_file_header(struct cbfs_fileheader *dest,
  *
  * @return 1 if a file is found, 0 if one isn't.
  */
-static int file_cbfs_next_file(u8 *start, u32 size, u32 align,
-  struct cbfs_cachenode *newNode, u32 *used)
+static int file_cbfs_next_file(struct cbfs_priv *priv, u8 *start, u32 size,
+  u32 align, struct cbfs_cachenode *newNode,
+  u32 *used)
 {
struct cbfs_fileheader header;
 
@@ -117,20 +123,21 @@ static int file_cbfs_next_file(u8 *start, u32 size, u32 
align,
 }
 
 /* Look through a CBFS instance and copy file metadata into regular memory. */
-static void file_cbfs_fill_cache(u8 *start, u32 size, u32 align)
+static void file_cbfs_fill_cache(struct cbfs_priv *priv, u8 *start, u32 size,
+u32 align)
 {
struct cbfs_cachenode *cache_node;
struct cbfs_cachenode *newNode;
-   struct cbfs_cachenode **cache_tail = _cache;
+   struct cbfs_cachenode **cache_tail = >file_cache;
 
/* Clear out old information. */
-   cache_node = file_cache;
+   cache_node = priv->file_cache;
while (cache_node) {
struct cbfs_cachenode *oldNode = cache_node;
cache_node = cache_node->next;
free(oldNode);
}
-   file_cache = NULL;
+   priv->file_cache = NULL;
 
while (size >= align) {
int result;
@@ -138,8 +145,8 @@ static void file_cbfs_fill_cache(u8 *start, u32 size, u32 
align)
 
newNode = (struct cbfs_cachenode *)
malloc(sizeof(struct cbfs_cachenode));
-   result = file_cbfs_next_file(start, size, align,
-   newNode, );
+   result = file_cbfs_next_file(priv, start, size, align, newNode,
+);
 
if (result < 0) {
free(newNode);
@@ -175,27 +182,35 @@ static int file_cbfs_load_header(uintptr_t end_of_rom,
return 0;
 }
 
-void file_cbfs_init(uintptr_t end_of_rom)
+void cbfs_init(struct cbfs_priv *priv, uintptr_t end_of_rom)
 {
u8 *start_of_rom;
-   initialized = 0;
 
-   if (file_cbfs_load_header(end_of_rom, _header))
+   priv->initialized = 0;
+
+   if (file_cbfs_load_header(end_of_rom, >header))
return;
 
-   start_of_rom = (u8 *)(end_of_rom + 1 - cbfs_header.rom_size);
+   start_of_rom = (u8 *)(end_of_rom + 1 - priv->header.rom_size);
 
-   file_cbfs_fill_cache(start_of_rom, cbfs_header.rom_size,
-cbfs_header.align);
+   file_cbfs_fill_cache(priv, start_of_rom, priv->header.rom_size,
+priv->header.align);
if (file_cbfs_result == CBFS_SUCCESS)
-   initialized = 1;
+   priv->initialized = 1;
+}
+
+void file_cbfs_init(uintptr_t end_of_rom)
+{
+   cbfs_init(_s, end_of_rom);
 }
 
 const struct cbfs_header *file_cbfs_get_header(void)
 {
-   if (initialized) {
+   struct cbfs_priv *priv = _s;
+
+   if (priv->initialized) {
file_cbfs_result = CBFS_SUCCESS;
-   return _header;
+   return >header;
} else {
file_cbfs_result = CBFS_NOT_INITIALIZED;
return NULL;
@@ -204,20 +219,24 @@ const struct cbfs_header *file_cbfs_get_header(void)
 
 const struct cbfs_cachenode *file_cbfs_get_first(void)
 {
-   if (!initialized) {
+   struct cbfs_priv *priv = _s;
+
+   if (!priv->initialized) {
file_cbfs_result = CBFS_NOT_INITIALIZED;
return NULL;
} else {
file_cbfs_result = CBFS_SUCCESS;
-   return file_cache;
+   return priv->file_cache;
}
 }
 
 void file_cbfs_get_next(const struct cbfs_cachenode **file)
 {
-   if (!initialized) {
+   struct cbfs_priv *priv = _s;
+
+   if 

[U-Boot] [PATCH 1/6] cbfs: Allow CBFS to be used in SPL

2019-08-13 Thread Simon Glass
Add a new Kconfig option to enable CBFS in SPL. This can be useful when
the memory-init code is in CBFS.

Signed-off-by: Simon Glass 
---

 fs/Makefile |  1 +
 fs/cbfs/Kconfig | 12 
 2 files changed, 13 insertions(+)

diff --git a/fs/Makefile b/fs/Makefile
index 2ed4aeac0e..42e669c40c 100644
--- a/fs/Makefile
+++ b/fs/Makefile
@@ -8,6 +8,7 @@ ifdef CONFIG_SPL_BUILD
 obj-$(CONFIG_FS_LOADER) += fs.o
 obj-$(CONFIG_SPL_FS_FAT) += fat/
 obj-$(CONFIG_SPL_FS_EXT4) += ext4/
+obj-$(CONFIG_SPL_FS_CBFS) += cbfs/
 else
 obj-y  += fs.o
 
diff --git a/fs/cbfs/Kconfig b/fs/cbfs/Kconfig
index 16089547a5..49eb6aca33 100644
--- a/fs/cbfs/Kconfig
+++ b/fs/cbfs/Kconfig
@@ -6,3 +6,15 @@ config FS_CBFS
  on systems that use coreboot as the first boot-loader and then load
  U-Boot to actually boot the Operating System. You can also enable
  CMD_CBFS to get command-line access.
+
+config SPL_FS_CBFS
+   bool "Enable CBFS (Coreboot Filesystem) in SPL"
+   help
+ Define this to enable support for reading from a Coreboot
+ filesystem. This is a ROM-based filesystem used for accessing files
+ on systems that use coreboot as the first boot-loader and then load
+ U-Boot to actually boot the Operating System.
+
+ Note that most functions in the CBFS API do not work with SPL. Only
+ those which accept a cbfs_priv * can be used, since BSS it not
+ available.
-- 
2.23.0.rc1.153.gdeed80330f-goog

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


[U-Boot] [PATCH 2/6] cbfs: Move declarations above functions

2019-08-13 Thread Simon Glass
At present this file has a function at the top, above declarations. This
is normally avoided, so fix it.

Signed-off-by: Simon Glass 
---

 fs/cbfs/cbfs.c | 14 +-
 1 file changed, 5 insertions(+), 9 deletions(-)

diff --git a/fs/cbfs/cbfs.c b/fs/cbfs/cbfs.c
index af4d3c5e56..2a9edcc9a0 100644
--- a/fs/cbfs/cbfs.c
+++ b/fs/cbfs/cbfs.c
@@ -9,6 +9,11 @@
 #include 
 
 enum cbfs_result file_cbfs_result;
+static const u32 good_magic = 0x4f524243;
+static const u8 good_file_magic[] = "LARCHIVE";
+static int initialized;
+static struct cbfs_header cbfs_header;
+static struct cbfs_cachenode *file_cache;
 
 const char *file_cbfs_error(void)
 {
@@ -28,15 +33,6 @@ const char *file_cbfs_error(void)
}
 }
 
-
-static const u32 good_magic = 0x4f524243;
-static const u8 good_file_magic[] = "LARCHIVE";
-
-
-static int initialized;
-static struct cbfs_header cbfs_header;
-static struct cbfs_cachenode *file_cache;
-
 /* Do endian conversion on the CBFS header structure. */
 static void swap_header(struct cbfs_header *dest, struct cbfs_header *src)
 {
-- 
2.23.0.rc1.153.gdeed80330f-goog

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


[U-Boot] [PATCH 5/6] cbfs: Add functions to support multiple CBFSs

2019-08-13 Thread Simon Glass
Sometimes an image has multiple CBFS. The current CBFS API is limited to
handling only one at time. Also it keeps track of the CBFS internally in
BSS, which does not work before relocation, for example.

Add a few new functions to overcome these limitations.

Signed-off-by: Simon Glass 
---

 fs/cbfs/cbfs.c | 46 ++
 include/cbfs.h | 22 ++
 2 files changed, 68 insertions(+)

diff --git a/fs/cbfs/cbfs.c b/fs/cbfs/cbfs.c
index dafdfb1a07..bb795e7288 100644
--- a/fs/cbfs/cbfs.c
+++ b/fs/cbfs/cbfs.c
@@ -187,6 +187,23 @@ static int file_cbfs_load_header(uintptr_t end_of_rom,
return 0;
 }
 
+static int cbfs_load_header_ptr(struct cbfs_priv *priv, ulong base,
+   struct cbfs_header *header)
+{
+   struct cbfs_header *header_in_rom;
+
+   header_in_rom = (struct cbfs_header *)base;
+   swap_header(header, header_in_rom);
+
+   if (header->magic != good_magic || header->offset >
+   header->rom_size - header->boot_block_size) {
+   priv->result = CBFS_BAD_HEADER;
+   return -EFAULT;
+   }
+
+   return 0;
+}
+
 void cbfs_init(struct cbfs_priv *priv, uintptr_t end_of_rom)
 {
u8 *start_of_rom;
@@ -209,6 +226,35 @@ void file_cbfs_init(uintptr_t end_of_rom)
cbfs_init(_s, end_of_rom);
 }
 
+int cbfs_init_mem(ulong base, ulong size, struct cbfs_priv **privp)
+{
+   struct cbfs_priv priv_s, *priv = _s;
+   int ret;
+
+   /*
+* Use a local variable to start with until we know that the CBFS is
+* valid. Assume that a master header appears at the start, at offset
+* 0x38.
+*/
+   ret = cbfs_load_header_ptr(priv, base + 0x38, >header);
+   if (ret)
+   return ret;
+
+   file_cbfs_fill_cache(priv, (u8 *)base, priv->header.rom_size,
+priv->header.align);
+   if (priv->result != CBFS_SUCCESS)
+   return -EINVAL;
+
+   priv->initialized = 1;
+   priv = malloc(sizeof(priv_s));
+   if (!priv)
+   return -ENOMEM;
+   memcpy(priv, _s, sizeof(priv_s));
+   *privp = priv;
+
+   return 0;
+}
+
 const struct cbfs_header *file_cbfs_get_header(void)
 {
struct cbfs_priv *priv = _s;
diff --git a/include/cbfs.h b/include/cbfs.h
index 742e34e24f..6d4c4d4b06 100644
--- a/include/cbfs.h
+++ b/include/cbfs.h
@@ -135,6 +135,28 @@ void file_cbfs_get_next(const struct cbfs_cachenode 
**file);
  */
 const struct cbfs_cachenode *file_cbfs_find(const char *name);
 
+struct cbfs_priv *priv;
+
+/**
+ * cbfs_find_file() - Find a file in a given CBFS
+ *
+ * @cbfs: CBFS to look in (use cbfs_init_mem() to set it up)
+ * @name: Filename to look for
+ * @return pointer to CBFS node if found, else NULL
+ */
+const struct cbfs_cachenode *cbfs_find_file(struct cbfs_priv *cbfs,
+   const char *name);
+
+/**
+ * cbfs_init_mem() - Set up a new CBFS
+ *
+ * @base: Base address of CBFS
+ * @size: Size of CBFS in bytes
+ * @cbfsp: Returns a pointer to CBFS on success
+ * @return 0 if OK, -ve on error
+ */
+int cbfs_init_mem(ulong base, ulong size, struct cbfs_priv **privp);
+
 
 /***/
 /* All of the functions below can be used without first initializing CBFS. */
-- 
2.23.0.rc1.153.gdeed80330f-goog

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


[U-Boot] [PATCH 0/6] cbfs: Allow use before relocation / BSS

2019-08-13 Thread Simon Glass
At present CBFS cannot be used in SPL before BSS is available. This is
inconvenient if CBFS holds the FSP code needed to init SDRAM.

The problem is fairly easy to fix, by putting all static variables into
a struct that can be allocated.

This series updates CBFS towards this goal, but does not convert all
functions. It also tidies up the style a little.


Simon Glass (6):
  cbfs: Allow CBFS to be used in SPL
  cbfs: Move declarations above functions
  cbfs: Move static variables into a struct
  cbfs: Move result variable into the struct
  cbfs: Add functions to support multiple CBFSs
  cbfs: Rename camel-case variables

 cmd/cbfs.c  |   4 +-
 fs/Makefile |   1 +
 fs/cbfs/Kconfig |  12 +++
 fs/cbfs/cbfs.c  | 231 
 include/cbfs.h  |  29 ++
 5 files changed, 198 insertions(+), 79 deletions(-)

-- 
2.23.0.rc1.153.gdeed80330f-goog

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


Re: [U-Boot] [PATCH v2 3/3] rk8xx: add a sysreset driver for poweroff

2019-08-13 Thread Kever Yang
Hi Urja, Simon,

This patch is not able to pass the sandbox_spl test, it reports:
[1]26463 segmentation fault (core dumped)  ./u-boot

The driver looks good to me, no idea what cause the issue.

Thanks,
- Kever

Urja Rannikko  于2019年5月17日周五 上午5:49写道:

> Based on snooping around the linux kernel rk8xx driver.
> Tested on an ASUS C201.
>
> Signed-off-by: Urja Rannikko 
> ---
>  drivers/power/pmic/Kconfig |  1 +
>  drivers/power/pmic/rk8xx.c | 62 +++---
>  include/power/rk8xx_pmic.h |  4 +++
>  3 files changed, 63 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/power/pmic/Kconfig b/drivers/power/pmic/Kconfig
> index 52edb29b48..3f6e30d503 100644
> --- a/drivers/power/pmic/Kconfig
> +++ b/drivers/power/pmic/Kconfig
> @@ -124,6 +124,7 @@ config PMIC_PM8916
>  config PMIC_RK8XX
> bool "Enable support for Rockchip PMIC RK8XX"
> depends on DM_PMIC
> +   select SYSRESET_CMD_POWEROFF if CMD_POWEROFF
> ---help---
> The Rockchip RK808 PMIC provides four buck DC-DC convertors, 8
> LDOs,
> an RTC and two low Rds (resistance (drain to source)) switches. It
> is
> diff --git a/drivers/power/pmic/rk8xx.c b/drivers/power/pmic/rk8xx.c
> index 25c339ab12..52e41051ae 100644
> --- a/drivers/power/pmic/rk8xx.c
> +++ b/drivers/power/pmic/rk8xx.c
> @@ -6,6 +6,9 @@
>
>  #include 
>  #include 
> +#include 
> +#include 
> +#include 
>  #include 
>  #include 
>  #include 
> @@ -49,9 +52,9 @@ static int rk8xx_read(struct udevice *dev, uint reg,
> uint8_t *buff, int len)
> return 0;
>  }
>
> -#if CONFIG_IS_ENABLED(PMIC_CHILDREN)
>  static int rk8xx_bind(struct udevice *dev)
>  {
> +#if CONFIG_IS_ENABLED(PMIC_CHILDREN)
> ofnode regulators_node;
> int children;
>
> @@ -68,10 +71,15 @@ static int rk8xx_bind(struct udevice *dev)
> if (!children)
> debug("%s: %s - no child found\n", __func__, dev->name);
>
> +#endif
> +
> +   if (CONFIG_IS_ENABLED(SYSRESET))
> +   return device_bind_driver(dev, "rk8xx-sysreset",
> + "rk8xx-sysreset", NULL);
> +
> /* Always return success for this device */
> return 0;
>  }
> -#endif
>
>  static int rk8xx_probe(struct udevice *dev)
>  {
> @@ -103,10 +111,56 @@ U_BOOT_DRIVER(pmic_rk8xx) = {
> .name = "rk8xx pmic",
> .id = UCLASS_PMIC,
> .of_match = rk8xx_ids,
> -#if CONFIG_IS_ENABLED(PMIC_CHILDREN)
> .bind = rk8xx_bind,
> -#endif
> .priv_auto_alloc_size   = sizeof(struct rk8xx_priv),
> .probe = rk8xx_probe,
> .ops = _ops,
>  };
> +
> +#if IS_ENABLED(CONFIG_SYSRESET)
> +/* NOTE: Should only enable this function if the
> rockchip,system-power-manager
> + * property is in the device tree node, but it is there in every board
> that has
> + * an rk8xx in u-boot currently, so this is left as an excercise for
> later.
> + */
> +static int rk8xx_sysreset_request(struct udevice *dev, enum sysreset_t
> type)
> +{
> +   struct udevice *pmic_dev;
> +   struct rk8xx_priv *priv;
> +   int ret;
> +   u8 bits;
> +
> +   if (type != SYSRESET_POWER_OFF)
> +   return -EPROTONOSUPPORT;
> +
> +   ret = uclass_get_device_by_driver(UCLASS_PMIC,
> + DM_GET_DRIVER(pmic_rk8xx),
> + _dev);
> +
> +   if (ret)
> +   return -EOPNOTSUPP;
> +
> +   priv = dev_get_priv(pmic_dev);
> +
> +   if (priv->variant == RK818_ID)
> +   bits = DEV_OFF;
> +   else
> +   bits = DEV_OFF_RST;
> +
> +   ret = pmic_clrsetbits(pmic_dev, REG_DEVCTRL, 0, bits);
> +
> +   if (ret < 0)
> +   return ret;
> +
> +   return -EINPROGRESS;
> +}
> +
> +static struct sysreset_ops rk8xx_sysreset_ops = {
> +   .request = rk8xx_sysreset_request,
> +};
> +
> +U_BOOT_DRIVER(rk8xx_sysreset) = {
> +   .name = "rk8xx-sysreset",
> +   .id = UCLASS_SYSRESET,
> +   .ops = _sysreset_ops,
> +};
> +#endif
> diff --git a/include/power/rk8xx_pmic.h b/include/power/rk8xx_pmic.h
> index c06248f751..565b35985e 100644
> --- a/include/power/rk8xx_pmic.h
> +++ b/include/power/rk8xx_pmic.h
> @@ -177,6 +177,10 @@ enum {
>
>  #define RK8XX_ID_MSK   0xfff0
>
> +/* DEVCTRL bits for poweroff */
> +#define DEV_OFF_RSTBIT(3)
> +#define DEV_OFFBIT(0)
> +
>  struct rk8xx_reg_table {
> char *name;
> u8 reg_ctl;
> --
> 2.21.0
>
> ___
> U-Boot mailing list
> U-Boot@lists.denx.de
> https://lists.denx.de/listinfo/u-boot
>
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] Pull request: u-boot-riscv/master

2019-08-13 Thread Rick Chen
Hi Lukas

> > From: Tom Rini [mailto:tr...@konsulko.com]
> > Sent: Wednesday, August 14, 2019 12:50 AM
> > To: Open Source Project uboot
> > Cc: u-boot@lists.denx.de; Rick Jian-Zhi Chen(陳建志)
> > Subject: Re: [U-Boot] Pull request: u-boot-riscv/master
> >
> > On Mon, Aug 12, 2019 at 06:23:02PM +0800, ub...@andestech.com wrote:
> >
> > > Hi Tom,
> > >
> > > Please pull some riscv updates:
> > >
> > > - Fix sifive serial y-modem transfer.
> > > - Access CSRs using CSR numbers.
> > > - Update doc sifive-fu540
> > > - Support big endian hosts and target.
> > > - Support SPL and OpenSBI (FW_DYNAMIC firmware) boot.
> > >
> > > https://travis-ci.org/rickchen36/u-boot-riscv/builds/570682542
> > >
> > > Thanks
> > > Rick
> > >
> > >
> > > The following changes since commit
> > feb5a02f869d5678190dfc915ef6c2781b4f7a6c:
> > >
> > >   Merge branch 'master' of git://git.denx.de/u-boot-sh (2019-08-10
> > > 17:57:58 -0400)
> > >
> > > are available in the Git repository at:
> > >
> > >   g...@gitlab.denx.de:u-boot/custodians/u-boot-riscv.git
> > >
> > > for you to fetch changes up to
> > 30c150bae4e3a61f87a159579cd3784f4d64e79e:
> > >
> > >   riscv: qemu: Fix kconfig build warning (2019-08-12 13:30:53 +0800)
> > >
> >
> > There is some change in here that is reliably causing this job to fail, 
> > please
> > investigate:
> > https://gitlab.denx.de/u-boot/u-boot/-/jobs/5493

Can you please check about this failure.
I wonder it may cause from SPL relative patchs.

Thanks
Rick

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


Re: [U-Boot] Travis test/py sandbox_spl test fail

2019-08-13 Thread Kever Yang

Hi Stephen,

On 2019/8/14 上午4:54, Stephen Warren wrote:

On 8/13/19 3:39 AM, Simon Glass wrote:

+Stephen

Hi Kever,

On Tue, 13 Aug 2019 at 03:35, Kever Yang  
wrote:


Hi Simon,

 I got fail in test/py sandbox_spl, and the log says:

E OSError: [Errno 5] Input/output error

I have no idea about what's wrong in source code, could you help

to take a look?

Travis job:

https://travis-ci.org/keveryang/u-boot/jobs/571125119


When I've seen this (ugly) error it is normally because U-Boot
crashed, e.g. with a segfault.


Yes, that's the typical reason. If you run test.py locally you'll be 
able to access the log file (which Travis doesn't save), which will 
likely give you more details about the crash, and/or you could attach 
gdb to the sandbox process to trap the problem too.


I got:

$ ./u-boot
bloblist_init() Existing bloblist not found: creating new bloblist
[1]    958 segmentation fault (core dumped)  ./u-boot

And no more logs, is there any other log file I can check?


Thanks,

- Kever



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


Re: [U-Boot] [PATCH] kconfig: Convert CONFIG_MXS_GPIO to Kconfig

2019-08-13 Thread Peng Fan
> Subject: [PATCH] kconfig: Convert CONFIG_MXS_GPIO to Kconfig
> 
> This converts the following to Kconfig:
>CONFIG_MXS_GPIO
> 
> Travis-CI:
> https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Ftravis-
> ci.org%2Flmajewski%2Fu-boot-dfu%2Fbuilds%2F571260789data=02%
> 7C01%7Cpeng.fan%40nxp.com%7C15b3b41cb65c47b3937b08d72008d525%
> 7C686ea1d3bc2b4c6fa92cd99c5c301635%7C0%7C0%7C6370130946196773
> 21sdata=U5TPcVyZv3ryzEbVCGfy8gM6Zb2cZpyLNtj5Gt9R6hk%3D
> p;reserved=0
> 
> Signed-off-by: Lukasz Majewski 

Acked-by: Peng Fan 

> 
> ---
> 
>  configs/apx4devkit_defconfig| 1 +
>  configs/bg0900_defconfig| 1 +
>  configs/mx23_olinuxino_defconfig| 1 +
>  configs/mx23evk_defconfig   | 1 +
>  configs/mx28evk_auart_console_defconfig | 1 +
>  configs/mx28evk_defconfig   | 1 +
>  configs/mx28evk_nand_defconfig  | 1 +
>  configs/mx28evk_spi_defconfig   | 1 +
>  configs/sansa_fuze_plus_defconfig   | 1 +
>  configs/sc_sps_1_defconfig  | 1 +
>  configs/ts4600_defconfig| 1 +
>  configs/xfi3_defconfig  | 1 +
>  drivers/gpio/Kconfig| 5 +
>  include/configs/mxs.h   | 6 --
>  scripts/config_whitelist.txt| 1 -
>  15 files changed, 17 insertions(+), 7 deletions(-)
> 
> diff --git a/configs/apx4devkit_defconfig b/configs/apx4devkit_defconfig index
> c5eb53ebef14..138cfa648cdb 100644
> --- a/configs/apx4devkit_defconfig
> +++ b/configs/apx4devkit_defconfig
> @@ -31,6 +31,7 @@ CONFIG_MTDIDS_DEFAULT="nand0=gpmi-nand"
> 
> CONFIG_MTDPARTS_DEFAULT="mtdparts=gpmi-nand:128k(bootstrap),1024k(
> boot),768k(env),-(root)"
>  CONFIG_CMD_UBI=y
>  CONFIG_ENV_IS_IN_NAND=y
> +CONFIG_MXS_GPIO=y
>  CONFIG_MMC_MXS=y
>  CONFIG_NAND=y
>  CONFIG_NAND_MXS=y
> diff --git a/configs/bg0900_defconfig b/configs/bg0900_defconfig index
> 353790f44640..d0d527c8f080 100644
> --- a/configs/bg0900_defconfig
> +++ b/configs/bg0900_defconfig
> @@ -27,6 +27,7 @@ CONFIG_CMD_MII=y
>  CONFIG_CMD_PING=y
>  CONFIG_CMD_CACHE=y
>  CONFIG_DOS_PARTITION=y
> +CONFIG_MXS_GPIO=y
>  # CONFIG_MMC is not set
>  CONFIG_NAND=y
>  CONFIG_NAND_MXS=y
> diff --git a/configs/mx23_olinuxino_defconfig
> b/configs/mx23_olinuxino_defconfig
> index 3e4b7ab1c365..fd045ad16268 100644
> --- a/configs/mx23_olinuxino_defconfig
> +++ b/configs/mx23_olinuxino_defconfig
> @@ -26,6 +26,7 @@ CONFIG_CMD_CACHE=y
>  CONFIG_CMD_EXT2=y
>  CONFIG_CMD_FAT=y
>  CONFIG_ENV_IS_IN_MMC=y
> +CONFIG_MXS_GPIO=y
>  CONFIG_LED_STATUS=y
>  CONFIG_LED_STATUS_GPIO=y
>  CONFIG_LED_STATUS0=y
> diff --git a/configs/mx23evk_defconfig b/configs/mx23evk_defconfig index
> 773aff4bdc40..bb04623a8f5d 100644
> --- a/configs/mx23evk_defconfig
> +++ b/configs/mx23evk_defconfig
> @@ -28,6 +28,7 @@ CONFIG_CMD_EXT2=y
>  CONFIG_CMD_FAT=y
>  CONFIG_ENV_IS_IN_MMC=y
>  # CONFIG_NET is not set
> +CONFIG_MXS_GPIO=y
>  CONFIG_MMC_MXS=y
>  CONFIG_CONS_INDEX=0
>  CONFIG_USB=y
> diff --git a/configs/mx28evk_auart_console_defconfig
> b/configs/mx28evk_auart_console_defconfig
> index 27c152571a2f..d7909e2fa918 100644
> --- a/configs/mx28evk_auart_console_defconfig
> +++ b/configs/mx28evk_auart_console_defconfig
> @@ -38,6 +38,7 @@ CONFIG_MTDIDS_DEFAULT="nand0=gpmi-nand"
> 
> CONFIG_MTDPARTS_DEFAULT="mtdparts=gpmi-nand:3m(bootloader)ro,512k
> (environment),512k(redundant-environment),4m(kernel),512k(fdt),8m(ramdis
> k),-(filesystem)"
>  CONFIG_CMD_UBI=y
>  CONFIG_ENV_IS_IN_MMC=y
> +CONFIG_MXS_GPIO=y
>  CONFIG_MMC_MXS=y
>  CONFIG_NAND=y
>  CONFIG_NAND_MXS=y
> diff --git a/configs/mx28evk_defconfig b/configs/mx28evk_defconfig index
> 4cee901d8321..7f000c8c380f 100644
> --- a/configs/mx28evk_defconfig
> +++ b/configs/mx28evk_defconfig
> @@ -38,6 +38,7 @@ CONFIG_MTDIDS_DEFAULT="nand0=gpmi-nand"
> 
> CONFIG_MTDPARTS_DEFAULT="mtdparts=gpmi-nand:3m(bootloader)ro,512k
> (environment),512k(redundant-environment),4m(kernel),512k(fdt),8m(ramdis
> k),-(filesystem)"
>  CONFIG_CMD_UBI=y
>  CONFIG_ENV_IS_IN_MMC=y
> +CONFIG_MXS_GPIO=y
>  CONFIG_MMC_MXS=y
>  CONFIG_NAND=y
>  CONFIG_NAND_MXS=y
> diff --git a/configs/mx28evk_nand_defconfig
> b/configs/mx28evk_nand_defconfig index 3875da733adb..248d8b1fc9cf
> 100644
> --- a/configs/mx28evk_nand_defconfig
> +++ b/configs/mx28evk_nand_defconfig
> @@ -37,6 +37,7 @@ CONFIG_MTDIDS_DEFAULT="nand0=gpmi-nand"
> 
> CONFIG_MTDPARTS_DEFAULT="mtdparts=gpmi-nand:3m(bootloader)ro,512k
> (environment),512k(redundant-environment),4m(kernel),512k(fdt),8m(ramdis
> k),-(filesystem)"
>  CONFIG_CMD_UBI=y
>  CONFIG_ENV_IS_IN_NAND=y
> +CONFIG_MXS_GPIO=y
>  CONFIG_MMC_MXS=y
>  CONFIG_NAND=y
>  CONFIG_NAND_MXS=y
> diff --git a/configs/mx28evk_spi_defconfig b/configs/mx28evk_spi_defconfig
> index 37477b35f1cb..3097e090a0a5 100644
> --- a/configs/mx28evk_spi_defconfig
> +++ b/configs/mx28evk_spi_defconfig
> @@ -36,6 +36,7 @@ CONFIG_CMD_MTDPARTS=y
>  CONFIG_MTDIDS_DEFAULT="nand0=gpmi-nand"
> 
> 

Re: [U-Boot] [PATCH v3 1/2] disk: update to use SPL_PARTITIONS for SPL【请注意,邮件由s...@google.com代发】

2019-08-13 Thread Kever Yang


On 2019/8/13 下午5:33, Simon Glass wrote:

Hi Kever,

On Thu, 8 Aug 2019 at 02:15, Kever Yang  wrote:

The SPL disk driver can not depends on SPL_FRAMEWORK,

Spaces around &


which will enable the disk driver when we actually not need it.
Use a separate Kconfig to control the partition driver in SPL
will fix this issue caused by:
91ff686562 blk: Rework guard around part_init call

Can you please format to 75 columrns? These lines look a little short.



I can update the commit message with format update.




Signed-off-by: Kever Yang 
---

Changes in v3:
- update code in blk-uclass.c

Changes in v2:
- add this patch

  common/spl/Kconfig |  2 +-
  disk/Kconfig   | 20 
  disk/Makefile  |  2 +-
  drivers/block/blk-uclass.c |  2 +-
  scripts/Makefile.spl   |  2 +-
  5 files changed, 16 insertions(+), 12 deletions(-)

So should this have a Fixes: tab?

Reviewed-by: Simon Glass 


diff --git a/common/spl/Kconfig b/common/spl/Kconfig
index 5978fb2934..094680e54d 100644
--- a/common/spl/Kconfig
+++ b/common/spl/Kconfig
@@ -544,7 +544,7 @@ config SPL_LIBCOMMON_SUPPORT

  config SPL_LIBDISK_SUPPORT
 bool "Support disk partitions"
-   select PARTITIONS
+   select SPL_PARTITIONS
 help
   Enable support for disk partitions within SPL. 'Disk' is something
   of a misnomer as it includes non-spinning media such as flash (as
diff --git a/disk/Kconfig b/disk/Kconfig
index 28fb81c2ee..43e76cb49d 100644
--- a/disk/Kconfig
+++ b/disk/Kconfig
@@ -4,9 +4,7 @@ menu "Partition Types"
  config PARTITIONS
 bool "Enable Partition Labels (disklabels) support"
 default y
-   select SPL_SPRINTF if SPL

Why are you removing this? I don't see it mentioned in the commit message.



This is not removed, but MOVE to the new option SPL_PARTITIONS where it 
belongs to.



Thanks,

- Kever




 select TPL_SPRINTF if TPL
-   select SPL_STRTO if SPL

Same here.


 select TPL_STRTO if TPL
 help
   Partition Labels (disklabels) Supported:
@@ -23,6 +21,12 @@ config PARTITIONS
   you must configure support for at least one non-MTD partition type
   as well.

Regards,
Simon




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


Re: [U-Boot] Linux Piter conference 2019 October 4-5 St.Petersrurg, Russia

2019-08-13 Thread Simon Glass
Hi Irina,

I am going to two conferences in the next few months so don't have
capacity for another. Thank you for the invite.

Regards,
SImon

On Tue, 13 Aug 2019 at 05:53, Irina Saribekova, it-events
 wrote:
>
> Hello Simon,
>
>
>
> My name is Irina, I am one of the organizers of the biggest Linux-conference 
> in Russia “Linux Piter”.
>
> https://linuxpiter.com/en
>
>
>
> This year conference will take place on October 4-5 in St. Petersburg. It is 
> not only cultural, but also IT capital of Russia. Previous years at Linux 
> Piter we had such speakers as Lennart Poettering, Monty Widenius, Christoph 
> Hellwig, Stephen Hemminger, Christian Brauner etc., who you might want to ask 
> for their experience.
>
> On October 6 we plan to have cultural program for speakers.
>
>
>
> Do you think you have any interesting topic in mind to give a talk about?
>
> We would be happy to get your proposal:
>
> https://linuxpiter.com/en/speaker
>
>
>
> Looking forward to your reply.
>
> Have a nice day.
>
>
>
> P.S. Videos from the last Linux Piter conferences:
>
> https://www.youtube.com/linuxpiter
>
>
>
> Best wishes,
>
> Irina Saribekova
>
> +7 921 903-45-17
>
> +7 812 334-99-90
>
> ir...@it-events.com
>
> IT-Events.com
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [ANN] U-Boot v2019.10-rc2 released

2019-08-13 Thread Tom Rini
Hey all,

It's the day after the scheduled release day, and here is v2019.10-rc2.
It took me a while to confirm that the riscv PR was causing the issue I
saw, and I got extra paranoid about testing all of the other PRs to be
sure it really was that and not some other race condition.   At this
point, it's time to aim to stabilize everything.  That said, I think
there's at least one or two trees that haven't sent their big PR yet and
I'd like to see that come in as soon as possible.

In terms of a changelog, 
git log --merges v2019.10-rc1..v2019.10-rc2
continues to look pretty good but the content there varies based on what
was given to me in the PR.  So please, the more details in the request
the better!

I'm still planning on doing -rc3 on the 26th of August with -rc4 on
September 9th and -rc5 on September 23rd with the release scheduled on
October 7th.  Thanks all!

-- 
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] test/py: Fix MMC/SD block write test dependency

2019-08-13 Thread Stephen Warren

On 8/1/19 10:48 PM, Michal Simek wrote:

Test is using random command which has own Kconfig symbol CMD_RANDOM which
already depends on CMD_MEMORY. That's why replace cmd_memory by cmd_random.


This might not always be true; I think it'd be better to keep the 
existing dependency list entries and just add CMD_RANDOM:



-@pytest.mark.buildconfigspec('cmd_mmc','cmd_memory')
+@pytest.mark.buildconfigspec('cmd_mmc','cmd_random')

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


Re: [U-Boot] [PATCH v2 05/12] armV7R: K3: am654: Allow using SPL BSS pre-relocation

2019-08-13 Thread Andreas Dannenberg
Hi Simon,

On Tue, Aug 13, 2019 at 10:38:22PM +0200, Simon Goldschmidt wrote:
> Am 07.08.2019 um 23:23 schrieb Andreas Dannenberg:
> > Hi Simon,
> > thanks for your patience waiting for a response. Please see comments 
> > inlined...
> > 
> > On Thu, Jul 25, 2019 at 11:52:55AM +0200, Simon Goldschmidt wrote:
> > > On Thu, Jul 25, 2019 at 10:23 AM Lokesh Vutla  wrote:
> > > > 
> > > > Hi Simon,
> > > > 
> > > > On 25/07/19 12:31 PM, Simon Goldschmidt wrote:
> > > > > Hi Lokesh,
> > > > > 
> > > > > thanks for following up on this.
> > > > > 
> > > > > On Thu, Jul 25, 2019 at 6:36 AM Lokesh Vutla  
> > > > > wrote:
> > > > > > 
> > > > > > Hi Tom,
> > > > > > 
> > > > > > On 20/07/19 9:21 PM, Tom Rini wrote:
> > > > > > > On Fri, Jul 19, 2019 at 07:29:37AM +0200, Simon Goldschmidt wrote:
> > > > > > > > On Fri, Jul 19, 2019 at 2:29 AM Tom Rini  
> > > > > > > > wrote:
> > > > > > > > > 
> > > > > > > > > On Tue, Jun 04, 2019 at 05:55:48PM -0500, Andreas Dannenberg 
> > > > > > > > > wrote:
> > > > > > > > > 
> > > > > > > > > > In order to be able to use more advanced driver 
> > > > > > > > > > functionality which often
> > > > > > > > > > relies on having BSS initialized during early boot prior to 
> > > > > > > > > > relocation
> > > > > > > > > > several things need to be in place:
> > > > > > > > > > 
> > > > > > > > > > 1) Memory needs to be available for BSS to use. For this, 
> > > > > > > > > > we locate BSS
> > > > > > > > > > at the top of the MCU SRAM area, with the stack 
> > > > > > > > > > starting right below
> > > > > > > > > > it,
> > > > > > > > > > 2) We need to move the initialization of BSS prior to 
> > > > > > > > > > entering
> > > > > > > > > > board_init_f(). We will do this with a separate commit 
> > > > > > > > > > by turning on
> > > > > > > > > > the respective CONFIG option.
> > > > > > > > > > 
> > > > > > > > > > In this commit we also clean up the assignment of the 
> > > > > > > > > > initial SP address
> > > > > > > > > > as part of the refactoring, taking into account the 
> > > > > > > > > > pre-decrement post-
> > > > > > > > > > increment nature in which the SP is used on ARM.
> > > > > > > > > > 
> > > > > > > > > > Signed-off-by: Andreas Dannenberg 
> > > > > > > > > 
> > > > > > > > > Applied to u-boot/master, thanks!
> > > > > > > > 
> > > > > > > > Wait, why has this been merged? Unfortunately, I haven't 
> > > > > > > > followed this series,
> > > > > > > > but in a discussion about a similar patch I sent [1], using BSS 
> > > > > > > > from
> > > > > > > > board_init_f
> > > > > > > > was turned down. And Simon Glass rather convinced me that this 
> > > > > > > > is the current
> > > > > > > > API U-Boot has (and is documented in README).
> > > > > > > > 
> > > > > > > > So either we must change this API and its documentation (and I 
> > > > > > > > would expect the
> > > > > > > > author of this patch to combine the README change with the code 
> > > > > > > > change), or this
> > > > > > > > patch would have to be rejected.
> > > > > > > > 
> > > > > > > > Again, I'm sorry I only see this now. In thought to remember a
> > > > > > > > discussion in this
> > > > > > > > thread, but I clearly remember that wrong...
> > > > > > > > 
> > > > > > > > [1] https://patchwork.ozlabs.org/patch/1057237/
> > > > > > > 
> > > > > > > And I had missed that other thread.  Lokesh, since I think 
> > > > > > > Andreas is
> > > > > > > out currently can you expand a little on what we can/can't do on 
> > > > > > > this
> > > > > > > platform?  Thanks!
> > > > > > 
> > > > > > The reason why BSS is needed very early in this platform is for the 
> > > > > > following
> > > > > > reasons:
> > > > > > - System co-processor is the central resource manager in SoC and 
> > > > > > should be
> > > > > > loaded and started very early in the boot process. Without that no 
> > > > > > peripheral or
> > > > > > memory can be initialized. So for loading system co-processor 
> > > > > > image, we only
> > > > > > have limited SRAM and a peripheral initialized by ROM.
> > > > > > - System co-processor(DMSC) is being represented as remote-core in
> > > > > > Device-tree(We are strictly following DM and DT model for the 
> > > > > > entire SoC).
> > > > > > - Since DM is also followed by each peripheral device and remote 
> > > > > > core, DM should
> > > > > > be enabled very early and many peripheral drivers are dependent on 
> > > > > > BSS usage.
> > > > > > So, BSS has been made available very early.
> > > > > > 
> > > > > > Hope this is clear. Let me know if more details are required, I 
> > > > > > will be happy to
> > > > > > explain.
> > > > > 
> > > > > Don't get me wrong: I'm not against using BSS early. I just want to 
> > > > > ensure this
> > > > > stays consistent throught U-Boot.
> > > > 
> > > > I understand and agree that it should be consistent. Just discussed 
> > > > this with
> > > > Andreas, who is courteous enough to update the details in his vacation.

Re: [U-Boot] [PATCH PATCH v4 01/15] spl: fit: don't load the firmware twice

2019-08-13 Thread Andreas Dannenberg
On Mon, Aug 05, 2019 at 11:43:56AM +0200, Jean-Jacques Hiblot wrote:
> When u-boot.img is a FIT image generated automatically by mkimage, the
> configuration node has the following structure:
> conf-1 {
>description = "k3-am654-base-board";
>firmware = "firmware-1";
>loadables = "firmware-1";
>fdt = "fdt-1";
> };
> 
> The firmware is referenced twice. Once by the 'firmware' property and
> once by the 'loadables' property. Currently this result in the firmware
> being loaded twice. This is not a big problem but has an impact on the
> boot time.
> Fixing it by not loading a loadable image if it is also the firmware image.
> 
> Signed-off-by: Jean-Jacques Hiblot 
> ---


Tested-by: Andreas Dannenberg 


I was working on getting UART boot to work on TI's AM654x devices and
just ran into this very issue (took a while to root cause). Unlike when
booting from MMC it's not just redundant to load the same image (U-Boot
proper in my case) twice -- it simply won't work.

--
Andreas Dannenberg
Texas Instruments Inc



> 
> Changes in v4: New
> 
>  common/spl/spl_fit.c | 10 ++
>  1 file changed, 10 insertions(+)
> 
> diff --git a/common/spl/spl_fit.c b/common/spl/spl_fit.c
> index 969f7775c1..0de18e3975 100644
> --- a/common/spl/spl_fit.c
> +++ b/common/spl/spl_fit.c
> @@ -361,6 +361,7 @@ int spl_load_simple_fit(struct spl_image_info *spl_image,
>   int images, ret;
>   int base_offset, hsize, align_len = ARCH_DMA_MINALIGN - 1;
>   int index = 0;
> + int firmware_node;
>  
>   /*
>* For FIT with external data, figure out where the external images
> @@ -490,6 +491,7 @@ int spl_load_simple_fit(struct spl_image_info *spl_image,
>   spl_fit_append_fdt(spl_image, info, sector, fit,
>  images, base_offset);
>  
> + firmware_node = node;
>   /* Now check if there are more images for us to load */
>   for (; ; index++) {
>   uint8_t os_type = IH_OS_INVALID;
> @@ -498,6 +500,14 @@ int spl_load_simple_fit(struct spl_image_info *spl_image,
>   if (node < 0)
>   break;
>  
> + /*
> +  * if the firmware is also a loadable, skip it because
> +  * it already has been loaded. This is typically the case with
> +  * u-boot.img generated by mkimage.
> +  */
> + if (firmware_node == node)
> + continue;
> +
>   ret = spl_load_fit_image(info, sector, fit, base_offset, node,
>_info);
>   if (ret < 0)
> -- 
> 2.17.1
> 
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] Travis test/py sandbox_spl test fail

2019-08-13 Thread Stephen Warren

On 8/13/19 3:39 AM, Simon Glass wrote:

+Stephen

Hi Kever,

On Tue, 13 Aug 2019 at 03:35, Kever Yang  wrote:


Hi Simon,

 I got fail in test/py sandbox_spl, and the log says:

E OSError: [Errno 5] Input/output error

I have no idea about what's wrong in source code, could you help

to take a look?

Travis job:

https://travis-ci.org/keveryang/u-boot/jobs/571125119


When I've seen this (ugly) error it is normally because U-Boot
crashed, e.g. with a segfault.


Yes, that's the typical reason. If you run test.py locally you'll be 
able to access the log file (which Travis doesn't save), which will 
likely give you more details about the crash, and/or you could attach 
gdb to the sandbox process to trap the problem too.

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


Re: [U-Boot] [PATCH v2 05/12] armV7R: K3: am654: Allow using SPL BSS pre-relocation

2019-08-13 Thread Simon Goldschmidt

Am 07.08.2019 um 23:23 schrieb Andreas Dannenberg:

Hi Simon,
thanks for your patience waiting for a response. Please see comments inlined...

On Thu, Jul 25, 2019 at 11:52:55AM +0200, Simon Goldschmidt wrote:

On Thu, Jul 25, 2019 at 10:23 AM Lokesh Vutla  wrote:


Hi Simon,

On 25/07/19 12:31 PM, Simon Goldschmidt wrote:

Hi Lokesh,

thanks for following up on this.

On Thu, Jul 25, 2019 at 6:36 AM Lokesh Vutla  wrote:


Hi Tom,

On 20/07/19 9:21 PM, Tom Rini wrote:

On Fri, Jul 19, 2019 at 07:29:37AM +0200, Simon Goldschmidt wrote:

On Fri, Jul 19, 2019 at 2:29 AM Tom Rini  wrote:


On Tue, Jun 04, 2019 at 05:55:48PM -0500, Andreas Dannenberg wrote:


In order to be able to use more advanced driver functionality which often
relies on having BSS initialized during early boot prior to relocation
several things need to be in place:

1) Memory needs to be available for BSS to use. For this, we locate BSS
at the top of the MCU SRAM area, with the stack starting right below
it,
2) We need to move the initialization of BSS prior to entering
board_init_f(). We will do this with a separate commit by turning on
the respective CONFIG option.

In this commit we also clean up the assignment of the initial SP address
as part of the refactoring, taking into account the pre-decrement post-
increment nature in which the SP is used on ARM.

Signed-off-by: Andreas Dannenberg 


Applied to u-boot/master, thanks!


Wait, why has this been merged? Unfortunately, I haven't followed this series,
but in a discussion about a similar patch I sent [1], using BSS from
board_init_f
was turned down. And Simon Glass rather convinced me that this is the current
API U-Boot has (and is documented in README).

So either we must change this API and its documentation (and I would expect the
author of this patch to combine the README change with the code change), or this
patch would have to be rejected.

Again, I'm sorry I only see this now. In thought to remember a
discussion in this
thread, but I clearly remember that wrong...

[1] https://patchwork.ozlabs.org/patch/1057237/


And I had missed that other thread.  Lokesh, since I think Andreas is
out currently can you expand a little on what we can/can't do on this
platform?  Thanks!


The reason why BSS is needed very early in this platform is for the following
reasons:
- System co-processor is the central resource manager in SoC and should be
loaded and started very early in the boot process. Without that no peripheral or
memory can be initialized. So for loading system co-processor image, we only
have limited SRAM and a peripheral initialized by ROM.
- System co-processor(DMSC) is being represented as remote-core in
Device-tree(We are strictly following DM and DT model for the entire SoC).
- Since DM is also followed by each peripheral device and remote core, DM should
be enabled very early and many peripheral drivers are dependent on BSS usage.
So, BSS has been made available very early.

Hope this is clear. Let me know if more details are required, I will be happy to
explain.


Don't get me wrong: I'm not against using BSS early. I just want to ensure this
stays consistent throught U-Boot.


I understand and agree that it should be consistent. Just discussed this with
Andreas, who is courteous enough to update the details in his vacation.


We don't have to rush here, I don't have a problem waiting for Andreas to
answer when he's back.





The reasons you stated still don't make it clear to me *why* bss is needed
early. There are other boards using DM early that don't need this. In my
opinion, DM drivers normally don't rely on BSS but keep all their state in


This statement doesn't hold true for all the drviers. At least the mmc driver
uses "initialized" variable stored in BSS to avoid initializing mmc multiple
times[0]. In the past we en counted other drivers using it. I guess the idea
here is to enable the BSS support generically instead of fixing each of every
driver.


So this driver is generally not usable in pre-relocation phase? The README
document is pretty clear about BSS not being available in board_init_f. I know
this text is old, but it seems still valid.

And if this is really a workaround because it's easier to use this workaround
instead of fixing drivers that invalidly use BSS, is this what we want?




heap memory. If you only need BSS early because drivers rely on BSS, you might
have to fix those drivers?


So, correct me here, why should driver be restricted to not use BSS?


Post-relocation drivers might be free to use BSS (although you lose the
per-instance storage when using BSS instead of the driver's priv data),
but pre-relocation drivers are not.
That's the current definition in U-Boot. This patch changes it by
adding the option
to use BSS early. This bears the danger of code being changed in a way that
it requires BSS to be available early and might not work on other boards that
actually cannot provide BSS early (e.g. before SDRAM is up or 

Re: [U-Boot] [PATCH 1/4 v5] watchdog: Implement generic watchdog_reset() version

2019-08-13 Thread Simon Goldschmidt

Hi Stefan,

Am 25.04.2019 um 09:17 schrieb Stefan Roese:

This patch tries to implement a generic watchdog_reset() function that
can be used by all boards that want to service the watchdog device in
U-Boot. This watchdog servicing is enabled via CONFIG_WATCHDOG.

Without this approach, new boards or platforms needed to implement a
board specific version of this functionality, mostly copy'ing the same
code over and over again into their board or platforms code base.

With this new generic function, the scattered other functions are now
removed to be replaced by the generic one. The new version also enables
the configuration of the watchdog timeout via the DT "timeout-sec"
property (if enabled via CONFIG_OF_CONTROL).

This patch also adds a new flag to the GD flags, to flag that the
watchdog is ready to use and adds the pointer to the watchdog device
to the GD. This enables us to remove the global "watchdog_dev"
variable, which was prone to cause problems because of its potentially
very early use in watchdog_reset(), even before the BSS is cleared.

Signed-off-by: Stefan Roese 





--- a/include/asm-generic/global_data.h
+++ b/include/asm-generic/global_data.h
@@ -133,6 +133,9 @@ typedef struct global_data {
struct spl_handoff *spl_handoff;
  # endif
  #endif
+#if defined(CONFIG_WDT)
+   struct udevice *watchdog_dev;
+#endif
  } gd_t;
  #endif
  
@@ -161,5 +164,6 @@ typedef struct global_data {

  #define GD_FLG_ENV_DEFAULT0x02000 /* Default variable flag   */
  #define GD_FLG_SPL_EARLY_INIT 0x04000 /* Early SPL init is done  */
  #define GD_FLG_LOG_READY  0x08000 /* Log system is ready for use */
+#define GD_FLG_WDT_READY   0x1 /* Watchdog is ready for use   */


Sorry to warm up a thread that is more than 4 months old, but I just 
stumbled accross this line when searching for space in 'gd':


The comment some lines above in global_data.h clearly states that the 
top 16 bits of flags are reserved for arch-specific flags, and your 
patch here uses the lowest of these 16 arch-specific flags for generic code.


Is this a problem? Does any arch code use the upper 16 bits? I would 
have thought you'd at least need to adjust the comment to reflect your 
new usage...


The reason I ask is that I'd need a place to put some (~5?) 
'is_initialized' bits for some code running in SPL in the 'board_init_f' 
code where BSS shouldn't be used. gd->flags would be ideal for that, but 
I'm hesistant to dive in further into the 'arch-specific' upper 16 bits...


Regards,
Simon

  
  #endif /* __ASM_GENERIC_GBL_DATA_H */

diff --git a/include/configs/turris_omnia.h b/include/configs/turris_omnia.h
index c7805cf36b..0e65a12345 100644
--- a/include/configs/turris_omnia.h
+++ b/include/configs/turris_omnia.h
@@ -29,11 +29,6 @@
  #define CONFIG_SPL_I2C_MUX
  #define CONFIG_SYS_I2C_MVTWSI
  
-/* Watchdog support */

-#if !defined(CONFIG_SPL_BUILD) && defined(CONFIG_WDT_ORION)
-# define CONFIG_WATCHDOG
-#endif
-
  /*
   * SDIO/MMC Card Configuration
   */
diff --git a/include/wdt.h b/include/wdt.h
index e9a7c5355a..aa77d3e9b4 100644
--- a/include/wdt.h
+++ b/include/wdt.h
@@ -6,6 +6,9 @@
  #ifndef _WDT_H_
  #define _WDT_H_
  
+#include 

+#include 
+
  /*
   * Implement a simple watchdog uclass. Watchdog is basically a timer that
   * is used to detect or recover from malfunction. During normal operation
@@ -103,4 +106,42 @@ struct wdt_ops {
int (*expire_now)(struct udevice *dev, ulong flags);
  };
  
+#if defined(CONFIG_WDT)

+#ifndef CONFIG_WATCHDOG_TIMEOUT_MSECS
+#define CONFIG_WATCHDOG_TIMEOUT_MSECS  (60 * 1000)
+#endif
+#define WATCHDOG_TIMEOUT_SECS  (CONFIG_WATCHDOG_TIMEOUT_MSECS / 1000)
+
+static inline int initr_watchdog(void)
+{
+   u32 timeout = WATCHDOG_TIMEOUT_SECS;
+
+   /*
+* Init watchdog: This will call the probe function of the
+* watchdog driver, enabling the use of the device
+*/
+   if (uclass_get_device_by_seq(UCLASS_WDT, 0,
+(struct udevice **)>watchdog_dev)) {
+   debug("WDT:   Not found by seq!\n");
+   if (uclass_get_device(UCLASS_WDT, 0,
+ (struct udevice **)>watchdog_dev)) {
+   printf("WDT:   Not found!\n");
+   return 0;
+   }
+   }
+
+   if (CONFIG_IS_ENABLED(OF_CONTROL)) {
+   timeout = dev_read_u32_default(gd->watchdog_dev, "timeout-sec",
+  WATCHDOG_TIMEOUT_SECS);
+   }
+
+   wdt_start(gd->watchdog_dev, timeout * 1000, 0);
+   gd->flags |= GD_FLG_WDT_READY;
+   printf("WDT:   Started with%s servicing (%ds timeout)\n",
+  IS_ENABLED(CONFIG_WATCHDOG) ? "" : "out", timeout);
+
+   return 0;
+}
+#endif
+
  #endif  /* _WDT_H_ */



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


Re: [U-Boot] verified boot against a chain of public keys

2019-08-13 Thread Patrick Doyle
On Mon, Aug 12, 2019 at 8:01 AM Patrick Doyle  wrote:
>
> I am about to embark on the task of adding support for importing and
> using multiple keys in the verified boot process. Does u-boot already
> support this?  Has anybody (else) thought about it?

I now see that lib/rsa/rsa-verify.c actually checks against multiple
public keys compiled into the device tree.  I guess I could use fit
commands to add more nodes with keys to the device tree, but that
seems a bit cumbersome.  Plus, they wouldn't be verified against the
existing key(s).

Still plugging away...

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


[U-Boot] [PATCH] ARM: davinci: Remove duplicated references

2019-08-13 Thread Adam Ford
The Kconfig file calls to ti/common/Kconfig twice which makes
several of the menu items repeat themselves.  In an effort to
clean this up, this patch removes the second call which eliminates
the duplicate menu items.

Signed-off-by: Adam Ford 

diff --git a/board/davinci/da8xxevm/Kconfig b/board/davinci/da8xxevm/Kconfig
index e0df97ca0e..bb1188b4ea 100644
--- a/board/davinci/da8xxevm/Kconfig
+++ b/board/davinci/da8xxevm/Kconfig
@@ -33,8 +33,6 @@ config MAC_ADDR_IN_EEPROM
 
 endif
 
-source "board/ti/common/Kconfig"
-
 endif
 
 if TARGET_OMAPL138_LCDK
-- 
2.17.1

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


[U-Boot] [PATCH] Kconfigs: Various: Fix some SPL, TPL and ARM64 dependencies

2019-08-13 Thread Adam Ford
Several options are presenting themselves on a various boards
where the options are clearly not used.  (ie, arm64 options on
arm9, or SPL/TPL options when SPL or TPL are not defined)

This patch is not attempting to be a complete list of items, but
more like low hanging fruit.

This patch attempts to reduce some of the menuconfig noise
by defining dependencies so they don't appear when not used.

Signed-off-by: Adam Ford 

diff --git a/Kconfig b/Kconfig
index d2eb744e70..643bb8cc01 100644
--- a/Kconfig
+++ b/Kconfig
@@ -163,7 +163,7 @@ config SYS_MALLOC_LEN
 
 config SPL_SYS_MALLOC_F_LEN
hex "Size of malloc() pool in SPL before relocation"
-   depends on SYS_MALLOC_F
+   depends on SYS_MALLOC_F && SPL
default 0x2800 if RCAR_GEN3
default SYS_MALLOC_F_LEN
help
@@ -174,7 +174,7 @@ config SPL_SYS_MALLOC_F_LEN
 
 config TPL_SYS_MALLOC_F_LEN
hex "Size of malloc() pool in TPL before relocation"
-   depends on SYS_MALLOC_F
+   depends on SYS_MALLOC_F && TPL
default SYS_MALLOC_F_LEN
help
  Before relocation, memory is very limited on many platforms. Still,
@@ -238,6 +238,7 @@ config SPL_IMAGE
string "SPL image used in the combined SPL+U-Boot image"
default "spl/boot.bin" if ARCH_AT91 && SPL_NAND_SUPPORT
default "spl/u-boot-spl.bin"
+   depends on SPL
help
  Select the SPL build target that shall be generated by the SPL
  build process (default spl/u-boot-spl.bin). This image will be
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index be2c96a93d..2d8a32feef 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -367,7 +367,7 @@ config SYS_THUMB_BUILD
 config SPL_SYS_THUMB_BUILD
bool "Build SPL using the Thumb instruction set"
default y if SYS_THUMB_BUILD
-   depends on !ARM64
+   depends on !ARM64 && SPL
help
   Use this flag to build SPL using the Thumb instruction set for
   ARM architectures. Thumb instruction set provides better code
@@ -414,7 +414,7 @@ config USE_ARCH_MEMCPY
 config SPL_USE_ARCH_MEMCPY
bool "Use an assembly optimized implementation of memcpy for SPL"
default y if USE_ARCH_MEMCPY
-   depends on !ARM64
+   depends on !ARM64 && SPL
help
  Enable the generation of an optimized version of memcpy.
  Such implementation may be faster under some conditions
@@ -423,7 +423,7 @@ config SPL_USE_ARCH_MEMCPY
 config TPL_USE_ARCH_MEMCPY
bool "Use an assembly optimized implementation of memcpy for TPL"
default y if USE_ARCH_MEMCPY
-   depends on !ARM64
+   depends on !ARM64 && TPL
help
  Enable the generation of an optimized version of memcpy.
  Such implementation may be faster under some conditions
@@ -441,7 +441,7 @@ config USE_ARCH_MEMSET
 config SPL_USE_ARCH_MEMSET
bool "Use an assembly optimized implementation of memset for SPL"
default y if USE_ARCH_MEMSET
-   depends on !ARM64
+   depends on !ARM64 && SPL
help
  Enable the generation of an optimized version of memset.
  Such implementation may be faster under some conditions
@@ -450,7 +450,7 @@ config SPL_USE_ARCH_MEMSET
 config TPL_USE_ARCH_MEMSET
bool "Use an assembly optimized implementation of memset for TPL"
default y if USE_ARCH_MEMSET
-   depends on !ARM64
+   depends on !ARM64 && TPL
help
  Enable the generation of an optimized version of memset.
  Such implementation may be faster under some conditions
@@ -458,7 +458,8 @@ config TPL_USE_ARCH_MEMSET
 
 config ARM64_SUPPORT_AARCH32
bool "ARM64 system support AArch32 execution state"
-   default y if ARM64 && !TARGET_THUNDERX_88XX
+   depends on ARM64
+   default y if !TARGET_THUNDERX_88XX
help
  This ARM64 system supports AArch32 execution state.
 
diff --git a/common/spl/Kconfig b/common/spl/Kconfig
index 630491699c..660aa66d84 100644
--- a/common/spl/Kconfig
+++ b/common/spl/Kconfig
@@ -208,6 +208,7 @@ config SPL_SYS_MALLOC_SIMPLE
 config TPL_SYS_MALLOC_SIMPLE
bool
prompt "Only use malloc_simple functions in the TPL"
+   depends on TPL
help
  Say Y here to only use the *_simple malloc functions from
  malloc_simple.c, rather then using the versions from dlmalloc.c;
@@ -261,6 +262,7 @@ config SPL_BANNER_PRINT
 
 config TPL_BANNER_PRINT
bool "Enable output of the TPL banner 'U-Boot TPL ...'"
+   depends on TPL
default y
help
  If this option is enabled, SPL will not print the banner with version
-- 
2.17.1

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


[U-Boot] [PATCH v2 4/4] ARM: dts: ast2500: Add SDHCI nodes

2019-08-13 Thread Eddie James
Add nodes for the Aspeed SD controllers with their necessary properties.

Signed-off-by: Eddie James 
---
 arch/arm/dts/ast2500-evb.dts | 14 ++
 arch/arm/dts/ast2500-u-boot.dtsi | 16 
 2 files changed, 30 insertions(+)

diff --git a/arch/arm/dts/ast2500-evb.dts b/arch/arm/dts/ast2500-evb.dts
index ebf44fd..4796ed4 100644
--- a/arch/arm/dts/ast2500-evb.dts
+++ b/arch/arm/dts/ast2500-evb.dts
@@ -59,3 +59,17 @@
pinctrl-names = "default";
pinctrl-0 = <_mac2link_default _mdio2_default>;
 };
+
+ {
+   status = "okay";
+
+   pinctrl-names = "default";
+   pinctrl-0 = <_sd1_default>;
+};
+
+ {
+   status = "okay";
+
+   pinctrl-names = "default";
+   pinctrl-0 = <_sd2_default>;
+};
diff --git a/arch/arm/dts/ast2500-u-boot.dtsi b/arch/arm/dts/ast2500-u-boot.dtsi
index 7f80bad..8ac4215 100644
--- a/arch/arm/dts/ast2500-u-boot.dtsi
+++ b/arch/arm/dts/ast2500-u-boot.dtsi
@@ -34,6 +34,22 @@
 
apb {
u-boot,dm-pre-reloc;
+
+   sdhci0: sdhci@1e740100 {
+   compatible = "aspeed,ast2500-sdhci";
+   reg = <0x1e740100>;
+   #reset-cells = <1>;
+   clocks = < BCLK_SDCLK>;
+   resets = < AST_RESET_SDIO>;
+   };
+
+   sdhci1: sdhci@1e740200 {
+   compatible = "aspeed,ast2500-sdhci";
+   reg = <0x1e740200>;
+   #reset-cells = <1>;
+   clocks = < BCLK_SDCLK>;
+   resets = < AST_RESET_SDIO>;
+   };
};
 
};
-- 
1.8.3.1

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


[U-Boot] [PATCH v2 3/4] aspeed: Support SD controller on the ast2500 board

2019-08-13 Thread Eddie James
Initialize the MMC subsystem on the ast2500 board. Compile MMC and the
Aspeed SD controller on the ast2500 EVB.

Signed-off-by: Eddie James 
---
 arch/arm/include/asm/gpio.h  | 3 ++-
 arch/arm/mach-aspeed/ast2500-board.c | 3 +++
 configs/evb-ast2500_defconfig| 6 ++
 3 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/arch/arm/include/asm/gpio.h b/arch/arm/include/asm/gpio.h
index 370031f..38a5922 100644
--- a/arch/arm/include/asm/gpio.h
+++ b/arch/arm/include/asm/gpio.h
@@ -1,6 +1,7 @@
 #if !defined(CONFIG_ARCH_UNIPHIER) && !defined(CONFIG_ARCH_STI) && \
!defined(CONFIG_ARCH_K3) && !defined(CONFIG_ARCH_BCM6858) && \
-   !defined(CONFIG_ARCH_BCM63158) && !defined(CONFIG_ARCH_ROCKCHIP)
+   !defined(CONFIG_ARCH_BCM63158) && !defined(CONFIG_ARCH_ROCKCHIP) && \
+   !defined(CONFIG_ARCH_ASPEED)
 #include 
 #endif
 #include 
diff --git a/arch/arm/mach-aspeed/ast2500-board.c 
b/arch/arm/mach-aspeed/ast2500-board.c
index e7edd54..52a4e05 100644
--- a/arch/arm/mach-aspeed/ast2500-board.c
+++ b/arch/arm/mach-aspeed/ast2500-board.c
@@ -4,6 +4,7 @@
  */
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -55,6 +56,8 @@ int board_init(void)
 {
gd->bd->bi_boot_params = CONFIG_SYS_SDRAM_BASE + 0x100;
 
+   mmc_initialize(gd->bd);
+
return 0;
 }
 
diff --git a/configs/evb-ast2500_defconfig b/configs/evb-ast2500_defconfig
index 59d41cb..bfa6b32 100644
--- a/configs/evb-ast2500_defconfig
+++ b/configs/evb-ast2500_defconfig
@@ -16,6 +16,7 @@ CONFIG_HUSH_PARSER=y
 CONFIG_CMD_I2C=y
 CONFIG_CMD_DHCP=y
 CONFIG_CMD_MII=y
+CONFIG_CMD_MMC=y
 CONFIG_CMD_PING=y
 CONFIG_DEFAULT_DEVICE_TREE="ast2500-evb"
 CONFIG_NET_RANDOM_ETHADDR=y
@@ -36,3 +37,8 @@ CONFIG_SYS_NS16550=y
 CONFIG_SYSRESET=y
 CONFIG_TIMER=y
 CONFIG_WDT=y
+CONFIG_MMC=y
+CONFIG_DM_MMC=y
+CONFIG_MMC_SDHCI=y
+CONFIG_MMC_SDHCI_ASPEED=y
+CONFIG_MMC_VERBOSE=y
-- 
1.8.3.1

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


[U-Boot] [PATCH v2 2/4] mmc: Add Aspeed SD controller driver

2019-08-13 Thread Eddie James
Add support for the Aspeed SD host controller engine.

Signed-off-by: Eddie James 
---
 drivers/mmc/Kconfig| 11 +++
 drivers/mmc/Makefile   |  1 +
 drivers/mmc/aspeed_sdhci.c | 78 ++
 3 files changed, 90 insertions(+)
 create mode 100644 drivers/mmc/aspeed_sdhci.c

diff --git a/drivers/mmc/Kconfig b/drivers/mmc/Kconfig
index c6812f6..536f66a 100644
--- a/drivers/mmc/Kconfig
+++ b/drivers/mmc/Kconfig
@@ -421,6 +421,17 @@ config SPL_MMC_SDHCI_ADMA
  This enables support for the ADMA (Advanced DMA) defined
  in the SD Host Controller Standard Specification Version 3.00 in SPL.
 
+config MMC_SDHCI_ASPEED
+   bool "Aspeed SDHCI controller"
+   depends on ARCH_ASPEED
+   depends on DM_MMC
+   depends on MMC_SDHCI
+   help
+ Enables support for the Aspeed SDHCI 2.0 controller present on Aspeed
+ SoCs. This device is compatible with SD 3.0 and/or MMC 4.3
+ specifications. On the AST2600, the device is also compatible with
+ MMC 5.1 and eMMC 3.0.
+
 config MMC_SDHCI_ATMEL
bool "Atmel SDHCI controller support"
depends on ARCH_AT91
diff --git a/drivers/mmc/Makefile b/drivers/mmc/Makefile
index 6cc018b..5594195 100644
--- a/drivers/mmc/Makefile
+++ b/drivers/mmc/Makefile
@@ -46,6 +46,7 @@ obj-$(CONFIG_JZ47XX_MMC) += jz_mmc.o
 
 # SDHCI
 obj-$(CONFIG_MMC_SDHCI)+= sdhci.o
+obj-$(CONFIG_MMC_SDHCI_ASPEED) += aspeed_sdhci.o
 obj-$(CONFIG_MMC_SDHCI_ATMEL)  += atmel_sdhci.o
 obj-$(CONFIG_MMC_SDHCI_BCM2835)+= bcm2835_sdhci.o
 obj-$(CONFIG_MMC_SDHCI_BCMSTB) += bcmstb_sdhci.o
diff --git a/drivers/mmc/aspeed_sdhci.c b/drivers/mmc/aspeed_sdhci.c
new file mode 100644
index 000..c292c42
--- /dev/null
+++ b/drivers/mmc/aspeed_sdhci.c
@@ -0,0 +1,78 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright 2019 IBM Corp.
+ * Eddie James 
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+
+struct aspeed_sdhci_plat {
+   struct mmc_config cfg;
+   struct mmc mmc;
+};
+
+static int aspeed_sdhci_probe(struct udevice *dev)
+{
+   struct mmc_uclass_priv *upriv = dev_get_uclass_priv(dev);
+   struct aspeed_sdhci_plat *plat = dev_get_platdata(dev);
+   struct sdhci_host *host = dev_get_priv(dev);
+   u32 max_clk;
+   struct clk clk;
+   int ret;
+
+   ret = clk_get_by_index(dev, 0, );
+   if (ret)
+   return ret;
+
+   ret = clk_enable();
+   if (ret)
+   return ret;
+
+   host->name = dev->name;
+   host->ioaddr = (void *)devfdt_get_addr(dev);
+
+   max_clk = clk_get_rate();
+   if (!max_clk)
+   return -EINVAL;
+
+   host->max_clk = max_clk;
+   host->mmc = >mmc;
+   host->mmc->dev = dev;
+   host->mmc->priv = host;
+   upriv->mmc = host->mmc;
+
+   ret = sdhci_setup_cfg(>cfg, host, 0, 0);
+   if (ret)
+   return ret;
+
+   return sdhci_probe(dev);
+}
+
+static int aspeed_sdhci_bind(struct udevice *dev)
+{
+   struct aspeed_sdhci_plat *plat = dev_get_platdata(dev);
+
+   return sdhci_bind(dev, >mmc, >cfg);
+}
+
+static const struct udevice_id aspeed_sdhci_ids[] = {
+   { .compatible = "aspeed,ast2400-sdhci" },
+   { .compatible = "aspeed,ast2500-sdhci" },
+   { .compatible = "aspeed,ast2600-sdhci" },
+   { }
+};
+
+U_BOOT_DRIVER(aspeed_sdhci_drv) = {
+   .name   = "aspeed_sdhci",
+   .id = UCLASS_MMC,
+   .of_match   = aspeed_sdhci_ids,
+   .ops= _ops,
+   .bind   = aspeed_sdhci_bind,
+   .probe  = aspeed_sdhci_probe,
+   .priv_auto_alloc_size = sizeof(struct sdhci_host),
+   .platdata_auto_alloc_size = sizeof(struct aspeed_sdhci_plat),
+};
-- 
1.8.3.1

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


[U-Boot] [PATCH v2 0/4] ARM: aspeed: Add SD host controller driver

2019-08-13 Thread Eddie James
This series adds support for the SD host controller on Aspeed ast2XXX SocS.
It also enables MMC and the SD controller on the ast2500 EVB.

Changes since v1:
 - split the patch up
 - Add defconfig and dts changes

Eddie James (4):
  clk: aspeed: Add support for SD clock
  mmc: Add Aspeed SD controller driver
  aspeed: Support SD controller on the ast2500 board
  ARM: dts: ast2500: Add SDHCI nodes

 arch/arm/dts/ast2500-evb.dts   | 14 +
 arch/arm/dts/ast2500-u-boot.dtsi   | 16 ++
 arch/arm/include/asm/arch-aspeed/scu_ast2500.h |  3 +
 arch/arm/include/asm/gpio.h|  3 +-
 arch/arm/mach-aspeed/ast2500-board.c   |  3 +
 configs/evb-ast2500_defconfig  |  6 ++
 drivers/clk/aspeed/clk_ast2500.c   | 27 +
 drivers/mmc/Kconfig| 11 
 drivers/mmc/Makefile   |  1 +
 drivers/mmc/aspeed_sdhci.c | 78 ++
 drivers/pinctrl/aspeed/pinctrl_ast2500.c   |  2 +
 11 files changed, 163 insertions(+), 1 deletion(-)
 create mode 100644 drivers/mmc/aspeed_sdhci.c

-- 
1.8.3.1

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


[U-Boot] [PATCH v2 1/4] clk: aspeed: Add support for SD clock

2019-08-13 Thread Eddie James
Add code to enable the SD clock on the ast2500 SoC.

Signed-off-by: Eddie James 
---
 arch/arm/include/asm/arch-aspeed/scu_ast2500.h |  3 +++
 drivers/clk/aspeed/clk_ast2500.c   | 27 ++
 drivers/pinctrl/aspeed/pinctrl_ast2500.c   |  2 ++
 3 files changed, 32 insertions(+)

diff --git a/arch/arm/include/asm/arch-aspeed/scu_ast2500.h 
b/arch/arm/include/asm/arch-aspeed/scu_ast2500.h
index 4988ced..8db4901 100644
--- a/arch/arm/include/asm/arch-aspeed/scu_ast2500.h
+++ b/arch/arm/include/asm/arch-aspeed/scu_ast2500.h
@@ -22,6 +22,8 @@
 #define SCU_MPLL_POST_MASK (0x3f << SCU_MPLL_POST_SHIFT)
 #define SCU_PCLK_DIV_SHIFT 23
 #define SCU_PCLK_DIV_MASK  (7 << SCU_PCLK_DIV_SHIFT)
+#define SCU_SDCLK_DIV_SHIFT12
+#define SCU_SDCLK_DIV_MASK (7 << SCU_SDCLK_DIV_SHIFT)
 #define SCU_HPLL_DENUM_SHIFT   0
 #define SCU_HPLL_DENUM_MASK0x1f
 #define SCU_HPLL_NUM_SHIFT 5
@@ -107,6 +109,7 @@
 
 #define SCU_CLKSTOP_MAC1   (1 << 20)
 #define SCU_CLKSTOP_MAC2   (1 << 21)
+#define SCU_CLKSTOP_SDCLK  (1 << 27)
 
 #define SCU_D2PLL_EXT1_OFF (1 << 0)
 #define SCU_D2PLL_EXT1_BYPASS  (1 << 1)
diff --git a/drivers/clk/aspeed/clk_ast2500.c b/drivers/clk/aspeed/clk_ast2500.c
index dbee13a..9249cf9 100644
--- a/drivers/clk/aspeed/clk_ast2500.c
+++ b/drivers/clk/aspeed/clk_ast2500.c
@@ -143,6 +143,17 @@ static ulong ast2500_clk_get_rate(struct clk *clk)
rate = rate / apb_div;
}
break;
+   case BCLK_SDCLK:
+   {
+   ulong apb_div = 4 + 4 * ((readl(>scu->clk_sel1)
+ & SCU_SDCLK_DIV_MASK)
+>> SCU_SDCLK_DIV_SHIFT);
+   rate = ast2500_get_hpll_rate(clkin,
+readl(>
+  scu->h_pll_param));
+   rate = rate / apb_div;
+   }
+   break;
case PCLK_UART1:
rate = ast2500_get_uart_clk_rate(priv->scu, 1);
break;
@@ -436,6 +447,22 @@ static int ast2500_clk_enable(struct clk *clk)
struct ast2500_clk_priv *priv = dev_get_priv(clk->dev);
 
switch (clk->id) {
+   case BCLK_SDCLK:
+   if (readl(>scu->clk_stop_ctrl1) & SCU_CLKSTOP_SDCLK) {
+   ast_scu_unlock(priv->scu);
+
+   setbits_le32(>scu->sysreset_ctrl1,
+SCU_SYSRESET_SDIO);
+   udelay(100);
+   clrbits_le32(>scu->clk_stop_ctrl1,
+SCU_CLKSTOP_SDCLK);
+   mdelay(10);
+   clrbits_le32(>scu->sysreset_ctrl1,
+SCU_SYSRESET_SDIO);
+
+   ast_scu_lock(priv->scu);
+   }
+   break;
/*
 * For MAC clocks the clock rate is
 * configured based on whether RGMII or RMII mode has been selected
diff --git a/drivers/pinctrl/aspeed/pinctrl_ast2500.c 
b/drivers/pinctrl/aspeed/pinctrl_ast2500.c
index ed333b9..a6e9c0d 100644
--- a/drivers/pinctrl/aspeed/pinctrl_ast2500.c
+++ b/drivers/pinctrl/aspeed/pinctrl_ast2500.c
@@ -58,6 +58,8 @@ static const struct ast2500_group_config ast2500_groups[] = {
{ "MDIO1", 3, (1 << 31) | (1 << 30) },
{ "MAC2LINK", 1, (1 << 1) },
{ "MDIO2", 5, (1 << 2) },
+   { "SD1", 5, (1 << 0) },
+   { "SD2", 5, (1 << 1) },
 };
 
 static int ast2500_pinctrl_get_groups_count(struct udevice *dev)
-- 
1.8.3.1

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


[U-Boot] [PATCH 5/6] bmips: bcm63268: add support for brcmnand

2019-08-13 Thread Álvaro Fernández Rojas
BCM63268 uses 4.0 HW nand controller, which is currently supported by
brcmnand driver.

Signed-off-by: Álvaro Fernández Rojas 
---
 arch/mips/dts/brcm,bcm63268.dtsi | 18 ++
 1 file changed, 18 insertions(+)

diff --git a/arch/mips/dts/brcm,bcm63268.dtsi b/arch/mips/dts/brcm,bcm63268.dtsi
index f8a72ef535..5294242529 100644
--- a/arch/mips/dts/brcm,bcm63268.dtsi
+++ b/arch/mips/dts/brcm,bcm63268.dtsi
@@ -141,6 +141,24 @@
status = "disabled";
};
 
+   nand: nand-controller@1200 {
+   #address-cells = <1>;
+   #size-cells = <0>;
+   compatible = "brcm,nand-bcm6368",
+"brcm,brcmnand-v4.0",
+"brcm,brcmnand";
+   reg-names = "nand",
+   "nand-cache",
+   "nand-int-base";
+   reg = <0x1200 0x180>,
+ <0x1600 0x200>,
+ <0x10b0 0x10>;
+   clocks = <_clk BCM63268_CLK_NAND>;
+   clock-names = "nand";
+
+   status = "disabled";
+   };
+
periph_pwr: power-controller@1000184c {
compatible = "brcm,bcm6328-power-domain";
reg = <0x1000184c 0x4>;
-- 
2.20.1

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


[U-Boot] [PATCH 4/6] bmips: bcm6362: add support for brcmnand

2019-08-13 Thread Álvaro Fernández Rojas
BCM6362 uses old 2.2 HW nand controller, which isn't currently supported by
brcmnand driver.

Signed-off-by: Álvaro Fernández Rojas 
---
 arch/mips/dts/brcm,bcm6362.dtsi | 18 ++
 1 file changed, 18 insertions(+)

diff --git a/arch/mips/dts/brcm,bcm6362.dtsi b/arch/mips/dts/brcm,bcm6362.dtsi
index c77b80a4cc..23c47963c3 100644
--- a/arch/mips/dts/brcm,bcm6362.dtsi
+++ b/arch/mips/dts/brcm,bcm6362.dtsi
@@ -135,6 +135,24 @@
status = "disabled";
};
 
+   nand: nand-controller@1200 {
+   #address-cells = <1>;
+   #size-cells = <0>;
+   compatible = "brcm,nand-bcm6368",
+"brcm,brcmnand-v2.2",
+"brcm,brcmnand";
+   reg-names = "nand",
+   "nand-cache",
+   "nand-int-base";
+   reg = <0x1200 0x180>,
+ <0x1600 0x200>,
+ <0x10b0 0x10>;
+   clocks = <_clk BCM6362_CLK_NAND>;
+   clock-names = "nand";
+
+   status = "disabled";
+   };
+
lsspi: spi@1800 {
compatible = "brcm,bcm6358-spi";
reg = <0x1800 0x70c>;
-- 
2.20.1

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


[U-Boot] [PATCH 6/6] bmips: enable vr-3032u nand support

2019-08-13 Thread Álvaro Fernández Rojas
Signed-off-by: Álvaro Fernández Rojas 
---
 arch/mips/dts/comtrend,vr-3032u.dts| 13 +
 configs/comtrend_vr3032u_ram_defconfig |  5 +
 include/configs/comtrend_vr3032u.h |  6 ++
 3 files changed, 24 insertions(+)

diff --git a/arch/mips/dts/comtrend,vr-3032u.dts 
b/arch/mips/dts/comtrend,vr-3032u.dts
index 512cb52de3..110119b507 100644
--- a/arch/mips/dts/comtrend,vr-3032u.dts
+++ b/arch/mips/dts/comtrend,vr-3032u.dts
@@ -99,6 +99,19 @@
};
 };
 
+ {
+   status = "okay";
+
+   nandcs@0 {
+   compatible = "brcm,nandcs";
+   reg = <0>;
+   nand-ecc-strength = <15>;
+   nand-ecc-step-size = <512>;
+   nand-on-flash-bbt;
+   brcm,nand-oob-sector-size = <64>;
+   };
+};
+
  {
status = "okay";
 };
diff --git a/configs/comtrend_vr3032u_ram_defconfig 
b/configs/comtrend_vr3032u_ram_defconfig
index 013c9ee1f6..33be24c45b 100644
--- a/configs/comtrend_vr3032u_ram_defconfig
+++ b/configs/comtrend_vr3032u_ram_defconfig
@@ -25,6 +25,7 @@ CONFIG_CMD_LICENSE=y
 CONFIG_CMD_MEMINFO=y
 # CONFIG_CMD_FLASH is not set
 # CONFIG_CMD_LOADS is not set
+CONFIG_CMD_NAND=y
 CONFIG_CMD_USB=y
 CONFIG_CMD_MII=y
 CONFIG_CMD_PING=y
@@ -37,6 +38,10 @@ CONFIG_DM_GPIO=y
 CONFIG_LED=y
 CONFIG_LED_BCM6328=y
 CONFIG_LED_BLINK=y
+CONFIG_MTD=y
+CONFIG_NAND=y
+CONFIG_NAND_BRCMNAND=y
+CONFIG_NAND_BRCMNAND_6368=y
 CONFIG_DM_ETH=y
 CONFIG_BCM6368_ETH=y
 CONFIG_PHY=y
diff --git a/include/configs/comtrend_vr3032u.h 
b/include/configs/comtrend_vr3032u.h
index e183288c5d..b004d77f52 100644
--- a/include/configs/comtrend_vr3032u.h
+++ b/include/configs/comtrend_vr3032u.h
@@ -10,3 +10,9 @@
 
 #define CONFIG_ENV_SIZE(8 * 1024)
 
+#ifdef CONFIG_NAND
+#define CONFIG_SYS_MAX_NAND_DEVICE 1
+#define CONFIG_SYS_NAND_SELF_INIT
+#define CONFIG_SYS_NAND_ONFI_DETECTION
+#define CONFIG_SYS_NAND_DRIVER_ECC_LAYOUT
+#endif /* CONFIG_NAND */
-- 
2.20.1

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


[U-Boot] [PATCH 2/6] bmips: bcm6368: add support for brcmnand

2019-08-13 Thread Álvaro Fernández Rojas
BCM6368 uses old 2.1 HW nand controller, which isn't currently supported by
brcmnand driver.

Signed-off-by: Álvaro Fernández Rojas 
---
 arch/mips/dts/brcm,bcm6368.dtsi | 18 ++
 1 file changed, 18 insertions(+)

diff --git a/arch/mips/dts/brcm,bcm6368.dtsi b/arch/mips/dts/brcm,bcm6368.dtsi
index 89590d6ff9..69be65056e 100644
--- a/arch/mips/dts/brcm,bcm6368.dtsi
+++ b/arch/mips/dts/brcm,bcm6368.dtsi
@@ -146,6 +146,24 @@
status = "disabled";
};
 
+   nand: nand-controller@1200 {
+   #address-cells = <1>;
+   #size-cells = <0>;
+   compatible = "brcm,nand-bcm6368",
+"brcm,brcmnand-v2.1",
+"brcm,brcmnand";
+   reg-names = "nand",
+   "nand-cache",
+   "nand-int-base";
+   reg = <0x1200 0x180>,
+ <0x1600 0x200>,
+ <0x10b0 0x10>;
+   clocks = <_clk BCM6368_CLK_NAND>;
+   clock-names = "nand";
+
+   status = "disabled";
+   };
+
spi: spi@1800 {
compatible = "brcm,bcm6358-spi";
reg = <0x1800 0x70c>;
-- 
2.20.1

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


[U-Boot] [PATCH 0/6] bmips: add brcmnand support

2019-08-13 Thread Álvaro Fernández Rojas
These patches add support for brcmnand on bmips.
The current brcmnand driver only supports controller >= 4.0,
which means that only BCM63268 works right now.

Álvaro Fernández Rojas (6):
  nand: brcm: add BCM6368 support
  bmips: bcm6368: add support for brcmnand
  bmips: bcm6328: add support for brcmnand
  bmips: bcm6362: add support for brcmnand
  bmips: bcm63268: add support for brcmnand
  bmips: enable vr-3032u nand support

 arch/mips/dts/brcm,bcm63268.dtsi |  18 +++
 arch/mips/dts/brcm,bcm6328.dtsi  |  16 +++
 arch/mips/dts/brcm,bcm6362.dtsi  |  18 +++
 arch/mips/dts/brcm,bcm6368.dtsi  |  18 +++
 arch/mips/dts/comtrend,vr-3032u.dts  |  13 ++
 configs/comtrend_vr3032u_ram_defconfig   |   5 +
 drivers/mtd/nand/raw/Kconfig |   6 +
 drivers/mtd/nand/raw/brcmnand/Makefile   |   1 +
 drivers/mtd/nand/raw/brcmnand/bcm6368_nand.c | 122 +++
 include/configs/comtrend_vr3032u.h   |   6 +
 10 files changed, 223 insertions(+)
 create mode 100644 drivers/mtd/nand/raw/brcmnand/bcm6368_nand.c

-- 
2.20.1

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


[U-Boot] [PATCH 3/6] bmips: bcm6328: add support for brcmnand

2019-08-13 Thread Álvaro Fernández Rojas
BCM6328 uses old 2.2 HW nand controller, which isn't currently supported by
brcmnand driver.

Signed-off-by: Álvaro Fernández Rojas 
---
 arch/mips/dts/brcm,bcm6328.dtsi | 16 
 1 file changed, 16 insertions(+)

diff --git a/arch/mips/dts/brcm,bcm6328.dtsi b/arch/mips/dts/brcm,bcm6328.dtsi
index 50beed4171..350c0e903b 100644
--- a/arch/mips/dts/brcm,bcm6328.dtsi
+++ b/arch/mips/dts/brcm,bcm6328.dtsi
@@ -124,6 +124,22 @@
status = "disabled";
};
 
+   nand: nand-controller@1200 {
+   #address-cells = <1>;
+   #size-cells = <0>;
+   compatible = "brcm,nand-bcm6368",
+"brcm,brcmnand-v2.2",
+"brcm,brcmnand";
+   reg-names = "nand",
+   "nand-cache",
+   "nand-int-base";
+   reg = <0x1200 0x180>,
+ <0x1400 0x200>,
+ <0x10b0 0x10>;
+
+   status = "disabled";
+   };
+
leds: led-controller@1800 {
compatible = "brcm,bcm6328-leds";
reg = <0x1800 0x24>;
-- 
2.20.1

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


[U-Boot] [PATCH 1/6] nand: brcm: add BCM6368 support

2019-08-13 Thread Álvaro Fernández Rojas
This adds support for BCM6368, BCM6328, BCM6362 and BCM63268 SoCs.

Signed-off-by: Álvaro Fernández Rojas 
---
 drivers/mtd/nand/raw/Kconfig |   6 +
 drivers/mtd/nand/raw/brcmnand/Makefile   |   1 +
 drivers/mtd/nand/raw/brcmnand/bcm6368_nand.c | 122 +++
 3 files changed, 129 insertions(+)
 create mode 100644 drivers/mtd/nand/raw/brcmnand/bcm6368_nand.c

diff --git a/drivers/mtd/nand/raw/Kconfig b/drivers/mtd/nand/raw/Kconfig
index f86035bcce..d2bfad28d5 100644
--- a/drivers/mtd/nand/raw/Kconfig
+++ b/drivers/mtd/nand/raw/Kconfig
@@ -67,6 +67,12 @@ config NAND_BRCMNAND
  Enable the driver for NAND flash on platforms using a Broadcom NAND
  controller.
 
+config NAND_BRCMNAND_6368
+   bool "Support Broadcom NAND controller on bcm6368"
+   depends on NAND_BRCMNAND && ARCH_BMIPS
+   help
+ Enable support for broadcom nand driver on bcm6368.
+
 config NAND_BRCMNAND_6838
bool "Support Broadcom NAND controller on bcm6838"
depends on NAND_BRCMNAND && ARCH_BMIPS && SOC_BMIPS_BCM6838
diff --git a/drivers/mtd/nand/raw/brcmnand/Makefile 
b/drivers/mtd/nand/raw/brcmnand/Makefile
index a2363cc80e..7e70b859dc 100644
--- a/drivers/mtd/nand/raw/brcmnand/Makefile
+++ b/drivers/mtd/nand/raw/brcmnand/Makefile
@@ -1,5 +1,6 @@
 # SPDX-License-Identifier: GPL-2.0+
 
+obj-$(CONFIG_NAND_BRCMNAND_6368) += bcm6368_nand.o
 obj-$(CONFIG_NAND_BRCMNAND_63158) += bcm63158_nand.o
 obj-$(CONFIG_NAND_BRCMNAND_6838) += bcm6838_nand.o
 obj-$(CONFIG_NAND_BRCMNAND_6858) += bcm6858_nand.o
diff --git a/drivers/mtd/nand/raw/brcmnand/bcm6368_nand.c 
b/drivers/mtd/nand/raw/brcmnand/bcm6368_nand.c
new file mode 100644
index 00..1768d3945f
--- /dev/null
+++ b/drivers/mtd/nand/raw/brcmnand/bcm6368_nand.c
@@ -0,0 +1,122 @@
+// SPDX-License-Identifier: GPL-2.0+
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include "brcmnand.h"
+
+struct bcm6368_nand_soc {
+   struct brcmnand_soc soc;
+   void __iomem *base;
+};
+
+#define BCM6368_NAND_INT   0x00
+#define  BCM6368_NAND_STATUS_SHIFT 0
+#define  BCM6368_NAND_STATUS_MASK  (0xfff << BCM6368_NAND_STATUS_SHIFT)
+#define  BCM6368_NAND_ENABLE_SHIFT 16
+#define  BCM6368_NAND_ENABLE_MASK  (0x << BCM6368_NAND_ENABLE_SHIFT)
+
+enum {
+   BCM6368_NP_READ = BIT(0),
+   BCM6368_BLOCK_ERASE = BIT(1),
+   BCM6368_COPY_BACK   = BIT(2),
+   BCM6368_PAGE_PGM= BIT(3),
+   BCM6368_CTRL_READY  = BIT(4),
+   BCM6368_DEV_RBPIN   = BIT(5),
+   BCM6368_ECC_ERR_UNC = BIT(6),
+   BCM6368_ECC_ERR_CORR= BIT(7),
+};
+
+static bool bcm6368_nand_intc_ack(struct brcmnand_soc *soc)
+{
+   struct bcm6368_nand_soc *priv =
+   container_of(soc, struct bcm6368_nand_soc, soc);
+   void __iomem *mmio = priv->base + BCM6368_NAND_INT;
+   u32 val = brcmnand_readl(mmio);
+
+   if (val & (BCM6368_CTRL_READY << BCM6368_NAND_STATUS_SHIFT)) {
+   /* Ack interrupt */
+   val &= ~BCM6368_NAND_STATUS_MASK;
+   val |= BCM6368_CTRL_READY << BCM6368_NAND_STATUS_SHIFT;
+   brcmnand_writel(val, mmio);
+   return true;
+   }
+
+   return false;
+}
+
+static void bcm6368_nand_intc_set(struct brcmnand_soc *soc, bool en)
+{
+   struct bcm6368_nand_soc *priv =
+   container_of(soc, struct bcm6368_nand_soc, soc);
+   void __iomem *mmio = priv->base + BCM6368_NAND_INT;
+   u32 val = brcmnand_readl(mmio);
+
+   /* Don't ack any interrupts */
+   val &= ~BCM6368_NAND_STATUS_MASK;
+
+   if (en)
+   val |= BCM6368_CTRL_READY << BCM6368_NAND_ENABLE_SHIFT;
+   else
+   val &= ~(BCM6368_CTRL_READY << BCM6368_NAND_ENABLE_SHIFT);
+
+   brcmnand_writel(val, mmio);
+}
+
+static int bcm6368_nand_probe(struct udevice *dev)
+{
+   struct udevice *pdev = dev;
+   struct bcm6368_nand_soc *priv = dev_get_priv(dev);
+   struct brcmnand_soc *soc;
+   struct resource res;
+
+   soc = >soc;
+
+   dev_read_resource_byname(pdev, "nand-int-base", );
+   priv->base = ioremap(res.start, resource_size());
+   if (IS_ERR(priv->base))
+   return PTR_ERR(priv->base);
+
+   soc->ctlrdy_ack = bcm6368_nand_intc_ack;
+   soc->ctlrdy_set_enabled = bcm6368_nand_intc_set;
+
+   /* Disable and ack all interrupts  */
+   brcmnand_writel(0, priv->base + BCM6368_NAND_INT);
+   brcmnand_writel(BCM6368_NAND_STATUS_MASK,
+   priv->base + BCM6368_NAND_INT);
+
+   return brcmnand_probe(pdev, soc);
+}
+
+static const struct udevice_id bcm6368_nand_dt_ids[] = {
+   {
+   .compatible = "brcm,nand-bcm6368",
+   },
+   { /* sentinel */ }
+};
+
+U_BOOT_DRIVER(bcm6368_nand) = {
+   .name = "bcm6368-nand",
+   .id = UCLASS_MTD,
+   .of_match = bcm6368_nand_dt_ids,
+ 

[U-Boot] [PATCH] Revert "ARM: da850-evm: Enable SPI Flash and NAND Flash when booting NOR"

2019-08-13 Thread Adam Ford
Sorry for the noise, but there appears to be a regression with older
hardware.  Since it broke the direct_nor boot option, it should be
reverted until a better solution is available.

This reverts commit 51cd1e2373274dc3167dabba628dcfc25828d36d.

diff --git a/board/davinci/da8xxevm/da850evm.c 
b/board/davinci/da8xxevm/da850evm.c
index b2b2fa272a..d9019de6e0 100644
--- a/board/davinci/da8xxevm/da850evm.c
+++ b/board/davinci/da8xxevm/da850evm.c
@@ -234,8 +234,7 @@ const struct pinmux_resource pinmuxes[] = {
PINMUX_ITEM(emifa_pins_cs3),
PINMUX_ITEM(emifa_pins_cs4),
PINMUX_ITEM(emifa_pins_nand),
-#endif
-#ifdef CONFIG_USE_NOR
+#elif defined(CONFIG_USE_NOR)
PINMUX_ITEM(emifa_pins_cs2),
PINMUX_ITEM(emifa_pins_nor),
 #endif
diff --git a/configs/da850evm_direct_nor_defconfig 
b/configs/da850evm_direct_nor_defconfig
index e889751b8c..407a30fbbf 100644
--- a/configs/da850evm_direct_nor_defconfig
+++ b/configs/da850evm_direct_nor_defconfig
@@ -24,15 +24,14 @@ CONFIG_CMD_DM=y
 # CONFIG_CMD_GPT is not set
 # CONFIG_CMD_MMC is not set
 CONFIG_CMD_MTD=y
-CONFIG_CMD_NAND=y
 # CONFIG_CMD_PART is not set
 # CONFIG_CMD_SF is not set
 # CONFIG_CMD_SPI is not set
 # CONFIG_CMD_SETEXPR is not set
 # CONFIG_CMD_TIME is not set
 CONFIG_CMD_MTDPARTS=y
-CONFIG_MTDIDS_DEFAULT="nor0=physmap-flash.2,nor1=spi1.0,nand0=nand512"
-CONFIG_MTDPARTS_DEFAULT="mtdparts=physmap-flash.2:1m(u-boot),128k(u-boot-env),-(spare);spi1.0:32k(SPL),480k(u-boot),64k(u-boot-env),7552k(kernel-spare),64k(MAC-Address);nand512:128k(u-boot
 env),512k(u-boot),128k(spl-os),8m(kernel),-(rootfs)"
+CONFIG_MTDIDS_DEFAULT="nor0=physmap-flash.2"
+CONFIG_MTDPARTS_DEFAULT="mtdparts=physmap-flash.2:1m(u-boot),128k(u-boot-env),-(spare)"
 CONFIG_CMD_DIAG=y
 CONFIG_OF_CONTROL=y
 CONFIG_DEFAULT_DEVICE_TREE="da850-evm"
@@ -50,13 +49,10 @@ CONFIG_SYS_FLASH_USE_BUFFER_WRITE=y
 CONFIG_FLASH_CFI_MTD=y
 CONFIG_SYS_FLASH_PROTECTION=y
 CONFIG_SYS_FLASH_CFI=y
-CONFIG_NAND=y
-CONFIG_NAND_DAVINCI=y
 CONFIG_DM_SPI_FLASH=y
 CONFIG_SPI_FLASH=y
 CONFIG_SPI_FLASH_STMICRO=y
 CONFIG_SPI_FLASH_WINBOND=y
-CONFIG_SPI_FLASH_MTD=y
 CONFIG_DM_ETH=y
 CONFIG_MII=y
 CONFIG_DRIVER_TI_EMAC=y
-- 
2.17.1

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


Re: [U-Boot] [PATCH] ARM: aspeed: Add SD host controller driver

2019-08-13 Thread Eddie James


On 8/13/19 11:55 AM, Cédric Le Goater wrote:

On 13/08/2019 08:41, Peng Fan wrote:

Subject: [U-Boot][PATCH] ARM: aspeed: Add SD host controller driver

Add support for the Aspeed SD host controller engine. This involves adding an
MMC SDHCI driver and various additions to the clock and reset drivers for
Aspeed chips.

Signed-off-by: Eddie James 
---
  arch/arm/include/asm/arch-aspeed/scu_ast2500.h |  3 +
  arch/arm/include/asm/gpio.h|  3 +-
  arch/arm/mach-aspeed/ast2500-board.c   |  3 +
  drivers/clk/aspeed/clk_ast2500.c   | 27 +
  drivers/mmc/Kconfig| 11 
  drivers/mmc/Makefile   |  1 +
  drivers/mmc/aspeed_sdhci.c | 78

Please split the patch.

yes. a clock patch, a driver patch, a board integration patch at least,
with some DT addons for the EVB.

Don't we want to sync up the DT from Linux also ?



The Linux one uses a parent node for the whole Aspeed SD controller and 
child nodes for the all the SD card slots. We don't need that parent 
driver in U-Boot and also it seems complicated (i.e. I couldn't figure 
out how) to probe up child nodes with the U-Boot driver model.



Thanks,

Eddie



Thanks,


C.


Thanks,
Peng.


++
  drivers/pinctrl/aspeed/pinctrl_ast2500.c   |  2 +
  8 files changed, 127 insertions(+), 1 deletion(-)  create mode 100644
drivers/mmc/aspeed_sdhci.c

diff --git a/arch/arm/include/asm/arch-aspeed/scu_ast2500.h
b/arch/arm/include/asm/arch-aspeed/scu_ast2500.h
index 4988ced..8db4901 100644
--- a/arch/arm/include/asm/arch-aspeed/scu_ast2500.h
+++ b/arch/arm/include/asm/arch-aspeed/scu_ast2500.h
@@ -22,6 +22,8 @@
  #define SCU_MPLL_POST_MASK(0x3f << SCU_MPLL_POST_SHIFT)
  #define SCU_PCLK_DIV_SHIFT23
  #define SCU_PCLK_DIV_MASK (7 << SCU_PCLK_DIV_SHIFT)
+#define SCU_SDCLK_DIV_SHIFT12
+#define SCU_SDCLK_DIV_MASK (7 << SCU_SDCLK_DIV_SHIFT)
  #define SCU_HPLL_DENUM_SHIFT  0
  #define SCU_HPLL_DENUM_MASK   0x1f
  #define SCU_HPLL_NUM_SHIFT5
@@ -107,6 +109,7 @@

  #define SCU_CLKSTOP_MAC1  (1 << 20)
  #define SCU_CLKSTOP_MAC2  (1 << 21)
+#define SCU_CLKSTOP_SDCLK  (1 << 27)

  #define SCU_D2PLL_EXT1_OFF(1 << 0)
  #define SCU_D2PLL_EXT1_BYPASS (1 << 1)
diff --git a/arch/arm/include/asm/gpio.h b/arch/arm/include/asm/gpio.h
index 370031f..38a5922 100644
--- a/arch/arm/include/asm/gpio.h
+++ b/arch/arm/include/asm/gpio.h
@@ -1,6 +1,7 @@
  #if !defined(CONFIG_ARCH_UNIPHIER) && !defined(CONFIG_ARCH_STI) &&
\
!defined(CONFIG_ARCH_K3) && !defined(CONFIG_ARCH_BCM6858) &&
\
-   !defined(CONFIG_ARCH_BCM63158)
&& !defined(CONFIG_ARCH_ROCKCHIP)
+   !defined(CONFIG_ARCH_BCM63158)
&& !defined(CONFIG_ARCH_ROCKCHIP) && \
+   !defined(CONFIG_ARCH_ASPEED)
  #include 
  #endif
  #include 
diff --git a/arch/arm/mach-aspeed/ast2500-board.c
b/arch/arm/mach-aspeed/ast2500-board.c
index e7edd54..52a4e05 100644
--- a/arch/arm/mach-aspeed/ast2500-board.c
+++ b/arch/arm/mach-aspeed/ast2500-board.c
@@ -4,6 +4,7 @@
   */
  #include 
  #include 
+#include 
  #include 
  #include 
  #include 
@@ -55,6 +56,8 @@ int board_init(void)
  {
gd->bd->bi_boot_params = CONFIG_SYS_SDRAM_BASE + 0x100;

+   mmc_initialize(gd->bd);
+
return 0;
  }

diff --git a/drivers/clk/aspeed/clk_ast2500.c
b/drivers/clk/aspeed/clk_ast2500.c
index dbee13a..9249cf9 100644
--- a/drivers/clk/aspeed/clk_ast2500.c
+++ b/drivers/clk/aspeed/clk_ast2500.c
@@ -143,6 +143,17 @@ static ulong ast2500_clk_get_rate(struct clk *clk)
rate = rate / apb_div;
}
break;
+   case BCLK_SDCLK:
+   {
+   ulong apb_div = 4 + 4 * ((readl(>scu->clk_sel1)
+ & SCU_SDCLK_DIV_MASK)
+>> SCU_SDCLK_DIV_SHIFT);
+   rate = ast2500_get_hpll_rate(clkin,
+readl(>
+  scu->h_pll_param));
+   rate = rate / apb_div;
+   }
+   break;
case PCLK_UART1:
rate = ast2500_get_uart_clk_rate(priv->scu, 1);
break;
@@ -436,6 +447,22 @@ static int ast2500_clk_enable(struct clk *clk)
struct ast2500_clk_priv *priv = dev_get_priv(clk->dev);

switch (clk->id) {
+   case BCLK_SDCLK:
+   if (readl(>scu->clk_stop_ctrl1) & SCU_CLKSTOP_SDCLK) {
+   ast_scu_unlock(priv->scu);
+
+   setbits_le32(>scu->sysreset_ctrl1,
+SCU_SYSRESET_SDIO);
+   udelay(100);
+   clrbits_le32(>scu->clk_stop_ctrl1,
+

[U-Boot] [U-BOOT PATCH 3/3] spi: riscv: use single bit mode for spi transfers

2019-08-13 Thread Sagar Shrikant Kadam
Use the SPI controller in FU540-C000 soc in one bit mode, rather than using
spi-tx-bus-width and spi-rx-bus-width passed from the device tree.

This patch handles a case where controller mode in format register (0x40)
is configured as per the width specified in the dt-node of the slave
device. For instance if spi-tx-bus-width and spi-rx-bus-width in the flash
device node in dt is set to 4 bit mode, the controller gets configured in
QUAD mode, whereas the spi nor scan tries to read the JEDEC ID with the
reg_proto set to SNOR_PROTO_1_1_1 and fails.

Signed-off-by: Sagar Shrikant Kadam 
---
 drivers/spi/spi-sifive.c | 7 +--
 1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/drivers/spi/spi-sifive.c b/drivers/spi/spi-sifive.c
index 969bd4b..7cf3ea4 100644
--- a/drivers/spi/spi-sifive.c
+++ b/drivers/spi/spi-sifive.c
@@ -146,12 +146,7 @@ static void sifive_spi_prep_transfer(struct sifive_spi 
*spi,
 
/* Number of wires ? */
cr &= ~SIFIVE_SPI_FMT_PROTO_MASK;
-   if ((slave->mode & SPI_TX_QUAD) || (slave->mode & SPI_RX_QUAD))
-   cr |= SIFIVE_SPI_FMT_PROTO_QUAD;
-   else if ((slave->mode & SPI_TX_DUAL) || (slave->mode & SPI_RX_DUAL))
-   cr |= SIFIVE_SPI_FMT_PROTO_DUAL;
-   else
-   cr |= SIFIVE_SPI_FMT_PROTO_SINGLE;
+   cr |= SIFIVE_SPI_FMT_PROTO_SINGLE;
 
/* SPI direction in/out ? */
cr &= ~SIFIVE_SPI_FMT_DIR;
-- 
2.7.4

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


[U-Boot] [U-BOOT PATCH 1/3] spi: nor: add spi-nor-fixup handlers for nor devices

2019-08-13 Thread Sagar Shrikant Kadam
Add support for spi_nor_fixups similar to that done in linux.
Flash vendor specific fixups can be registered in spi_nor_ids.
and will be called after BFPT parsing to fix any wrong parameter
read from SFDP.

Signed-off-by: Sagar Shrikant Kadam 
---
 drivers/mtd/spi/sf_internal.h  |  5 +
 drivers/mtd/spi/spi-nor-core.c | 33 +++--
 2 files changed, 36 insertions(+), 2 deletions(-)

diff --git a/drivers/mtd/spi/sf_internal.h b/drivers/mtd/spi/sf_internal.h
index a6bf734..c5e68d8 100644
--- a/drivers/mtd/spi/sf_internal.h
+++ b/drivers/mtd/spi/sf_internal.h
@@ -65,6 +65,11 @@ struct flash_info {
 #define NO_CHIP_ERASE  BIT(12) /* Chip does not support chip erase */
 #define SPI_NOR_SKIP_SFDP  BIT(13) /* Skip parsing of SFDP tables */
 #define USE_CLSR   BIT(14) /* use CLSR command */
+
+#ifdef CONFIG_SPI_FLASH_SFDP_SUPPORT
+   /* Part specific fixup hooks */
+   const struct spi_nor_fixups *fixups;
+#endif
 };
 
 extern const struct flash_info spi_nor_ids[];
diff --git a/drivers/mtd/spi/spi-nor-core.c b/drivers/mtd/spi/spi-nor-core.c
index 1acff74..4306d19 100644
--- a/drivers/mtd/spi/spi-nor-core.c
+++ b/drivers/mtd/spi/spi-nor-core.c
@@ -1623,6 +1623,33 @@ static const struct sfdp_bfpt_erase sfdp_bfpt_erases[] = 
{
 static int spi_nor_hwcaps_read2cmd(u32 hwcaps);
 
 /**
+ * struct spi_nor_fixups - SPI NOR fixup hooks
+ * @post_bfpt: called after the BFPT table has been parsed
+ *
+ * Those hooks can be used to tweak the SPI NOR configuration when the SFDP
+ * table is broken or not available.
+ */
+struct spi_nor_fixups {
+   int (*post_bfpt)(struct spi_nor *nor,
+const struct sfdp_parameter_header *bfpt_header,
+const struct sfdp_bfpt *bfpt,
+struct spi_nor_flash_parameter *params);
+};
+
+static int
+spi_nor_post_bfpt_fixups(struct spi_nor *nor,
+const struct sfdp_parameter_header *bfpt_header,
+const struct sfdp_bfpt *bfpt,
+struct spi_nor_flash_parameter *params)
+{
+   if (nor->info->fixups && nor->info->fixups->post_bfpt)
+   return nor->info->fixups->post_bfpt(nor, bfpt_header, bfpt,
+   params);
+
+   return 0;
+}
+
+/**
  * spi_nor_parse_bfpt() - read and parse the Basic Flash Parameter Table.
  * @nor:   pointer to a 'struct spi_nor'
  * @bfpt_header:   pointer to the 'struct sfdp_parameter_header' describing
@@ -1760,7 +1787,8 @@ static int spi_nor_parse_bfpt(struct spi_nor *nor,
 
/* Stop here if not JESD216 rev A or later. */
if (bfpt_header->length < BFPT_DWORD_MAX)
-   return 0;
+   return spi_nor_post_bfpt_fixups(nor, bfpt_header, ,
+   params);
 
/* Page size: this field specifies 'N' so the page size = 2^N bytes. */
params->page_size = bfpt.dwords[BFPT_DWORD(11)];
@@ -1793,7 +1821,8 @@ static int spi_nor_parse_bfpt(struct spi_nor *nor,
return -EINVAL;
}
 
-   return 0;
+   return spi_nor_post_bfpt_fixups(nor, bfpt_header, ,
+   params);
 }
 
 /**
-- 
2.7.4

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


Re: [U-Boot] [PATCH] ARM: aspeed: Add SD host controller driver

2019-08-13 Thread Cédric Le Goater
On 13/08/2019 08:41, Peng Fan wrote:
>> Subject: [U-Boot][PATCH] ARM: aspeed: Add SD host controller driver
>>
>> Add support for the Aspeed SD host controller engine. This involves adding an
>> MMC SDHCI driver and various additions to the clock and reset drivers for
>> Aspeed chips.
>>
>> Signed-off-by: Eddie James 
>> ---
>>  arch/arm/include/asm/arch-aspeed/scu_ast2500.h |  3 +
>>  arch/arm/include/asm/gpio.h|  3 +-
>>  arch/arm/mach-aspeed/ast2500-board.c   |  3 +
>>  drivers/clk/aspeed/clk_ast2500.c   | 27 +
>>  drivers/mmc/Kconfig| 11 
>>  drivers/mmc/Makefile   |  1 +
>>  drivers/mmc/aspeed_sdhci.c | 78
> 
> Please split the patch.

yes. a clock patch, a driver patch, a board integration patch at least,
with some DT addons for the EVB. 

Don't we want to sync up the DT from Linux also ?  
   
Thanks,

C. 

> 
> Thanks,
> Peng.
> 
>> ++
>>  drivers/pinctrl/aspeed/pinctrl_ast2500.c   |  2 +
>>  8 files changed, 127 insertions(+), 1 deletion(-)  create mode 100644
>> drivers/mmc/aspeed_sdhci.c
>>
>> diff --git a/arch/arm/include/asm/arch-aspeed/scu_ast2500.h
>> b/arch/arm/include/asm/arch-aspeed/scu_ast2500.h
>> index 4988ced..8db4901 100644
>> --- a/arch/arm/include/asm/arch-aspeed/scu_ast2500.h
>> +++ b/arch/arm/include/asm/arch-aspeed/scu_ast2500.h
>> @@ -22,6 +22,8 @@
>>  #define SCU_MPLL_POST_MASK  (0x3f << SCU_MPLL_POST_SHIFT)
>>  #define SCU_PCLK_DIV_SHIFT  23
>>  #define SCU_PCLK_DIV_MASK   (7 << SCU_PCLK_DIV_SHIFT)
>> +#define SCU_SDCLK_DIV_SHIFT 12
>> +#define SCU_SDCLK_DIV_MASK  (7 << SCU_SDCLK_DIV_SHIFT)
>>  #define SCU_HPLL_DENUM_SHIFT0
>>  #define SCU_HPLL_DENUM_MASK 0x1f
>>  #define SCU_HPLL_NUM_SHIFT  5
>> @@ -107,6 +109,7 @@
>>
>>  #define SCU_CLKSTOP_MAC1(1 << 20)
>>  #define SCU_CLKSTOP_MAC2(1 << 21)
>> +#define SCU_CLKSTOP_SDCLK   (1 << 27)
>>
>>  #define SCU_D2PLL_EXT1_OFF  (1 << 0)
>>  #define SCU_D2PLL_EXT1_BYPASS   (1 << 1)
>> diff --git a/arch/arm/include/asm/gpio.h b/arch/arm/include/asm/gpio.h
>> index 370031f..38a5922 100644
>> --- a/arch/arm/include/asm/gpio.h
>> +++ b/arch/arm/include/asm/gpio.h
>> @@ -1,6 +1,7 @@
>>  #if !defined(CONFIG_ARCH_UNIPHIER) && !defined(CONFIG_ARCH_STI) &&
>> \
>>  !defined(CONFIG_ARCH_K3) && !defined(CONFIG_ARCH_BCM6858) &&
>> \
>> -!defined(CONFIG_ARCH_BCM63158)
>> && !defined(CONFIG_ARCH_ROCKCHIP)
>> +!defined(CONFIG_ARCH_BCM63158)
>> && !defined(CONFIG_ARCH_ROCKCHIP) && \
>> +!defined(CONFIG_ARCH_ASPEED)
>>  #include 
>>  #endif
>>  #include 
>> diff --git a/arch/arm/mach-aspeed/ast2500-board.c
>> b/arch/arm/mach-aspeed/ast2500-board.c
>> index e7edd54..52a4e05 100644
>> --- a/arch/arm/mach-aspeed/ast2500-board.c
>> +++ b/arch/arm/mach-aspeed/ast2500-board.c
>> @@ -4,6 +4,7 @@
>>   */
>>  #include 
>>  #include 
>> +#include 
>>  #include 
>>  #include 
>>  #include 
>> @@ -55,6 +56,8 @@ int board_init(void)
>>  {
>>  gd->bd->bi_boot_params = CONFIG_SYS_SDRAM_BASE + 0x100;
>>
>> +mmc_initialize(gd->bd);
>> +
>>  return 0;
>>  }
>>
>> diff --git a/drivers/clk/aspeed/clk_ast2500.c
>> b/drivers/clk/aspeed/clk_ast2500.c
>> index dbee13a..9249cf9 100644
>> --- a/drivers/clk/aspeed/clk_ast2500.c
>> +++ b/drivers/clk/aspeed/clk_ast2500.c
>> @@ -143,6 +143,17 @@ static ulong ast2500_clk_get_rate(struct clk *clk)
>>  rate = rate / apb_div;
>>  }
>>  break;
>> +case BCLK_SDCLK:
>> +{
>> +ulong apb_div = 4 + 4 * ((readl(>scu->clk_sel1)
>> +  & SCU_SDCLK_DIV_MASK)
>> + >> SCU_SDCLK_DIV_SHIFT);
>> +rate = ast2500_get_hpll_rate(clkin,
>> + readl(>
>> +   scu->h_pll_param));
>> +rate = rate / apb_div;
>> +}
>> +break;
>>  case PCLK_UART1:
>>  rate = ast2500_get_uart_clk_rate(priv->scu, 1);
>>  break;
>> @@ -436,6 +447,22 @@ static int ast2500_clk_enable(struct clk *clk)
>>  struct ast2500_clk_priv *priv = dev_get_priv(clk->dev);
>>
>>  switch (clk->id) {
>> +case BCLK_SDCLK:
>> +if (readl(>scu->clk_stop_ctrl1) & SCU_CLKSTOP_SDCLK) {
>> +ast_scu_unlock(priv->scu);
>> +
>> +setbits_le32(>scu->sysreset_ctrl1,
>> + SCU_SYSRESET_SDIO);
>> +udelay(100);
>> +clrbits_le32(>scu->clk_stop_ctrl1,
>> + SCU_CLKSTOP_SDCLK);
>> +mdelay(10);
>> +clrbits_le32(>scu->sysreset_ctrl1,
>> +

Re: [U-Boot] [PATCH v2 12/40] env: Move env_set_ulong() to env.h

2019-08-13 Thread Tom Rini
On Thu, Aug 01, 2019 at 09:46:47AM -0600, Simon Glass wrote:

> Move env_set_ulong() over to the new header file.
> 
> Signed-off-by: Simon Glass 
> Acked-by: Joe Hershberger 

Applied to u-boot/master, thanks!

-- 
Tom


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


Re: [U-Boot] [PATCH v2 37/40] env: Drop environment.h header file where not needed

2019-08-13 Thread Tom Rini
On Thu, Aug 01, 2019 at 09:47:12AM -0600, Simon Glass wrote:

> This header file is now only used by files that access internal
> environment features. Drop it from various places where it is not needed.
> 
> Acked-by: Joe Hershberger 
> Signed-off-by: Simon Glass 

Applied to u-boot/master, thanks!

-- 
Tom


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


Re: [U-Boot] [PATCH 1/5] arm: dts: Import HI3660 devicetree from Linux

2019-08-13 Thread Tom Rini
On Fri, Aug 02, 2019 at 08:40:07PM +0530, Manivannan Sadhasivam wrote:

> This commit imports HI3660 SoC devicetree from Linux
> 
> Signed-off-by: Manivannan Sadhasivam 

Applied to u-boot/master, thanks!

-- 
Tom


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


Re: [U-Boot] [PATCH v2 3/5] usb: kbd: fix typo

2019-08-13 Thread Simon Glass
On Sat, 10 Aug 2019 at 03:24, Heinrich Schuchardt  wrote:
>
> %s/a interrupt/an interrupt/
>
> Signed-off-by: Heinrich Schuchardt 
> ---
> v2
> new patch
> ---
>  common/usb_kbd.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

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


Re: [U-Boot] [PATCH v3 32/40] env: Drop _ENTRY

2019-08-13 Thread Tom Rini
On Fri, Aug 02, 2019 at 09:44:19AM -0600, Simon Glass wrote:

> This typedef does not need to be defined in the search.h header since it
> is only used in one file (hashtable.c). Remove it from the header and
> change it to a struct.
> 
> Signed-off-by: Simon Glass 

Applied to u-boot/master, thanks!

-- 
Tom


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


Re: [U-Boot] [PATCH v2 29/40] env: Move env_valid to env.h

2019-08-13 Thread Tom Rini
On Thu, Aug 01, 2019 at 09:47:04AM -0600, Simon Glass wrote:

> This enum is somewhat widely used to determine if the environment is valid
> or not. Move it to the common environment header file.
> 
> Signed-off-by: Simon Glass 
> Acked-by: Joe Hershberger 

Applied to u-boot/master, thanks!

-- 
Tom


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


[U-Boot] [U-BOOT PATCH 2/3] spi: nor: add support for is25wp256

2019-08-13 Thread Sagar Shrikant Kadam
Enable support for spi nor device(is25wp256) mounted on
HiFive Unleashed Rev A00 board.

Thanks to Bhargav Shah for porting this patch which is based on
linux patches https://lkml.org/lkml/2019/7/2/859.

Additionally, set the proper number of sectors in the device id table,
so that the sf probe shows the correct size of the flash device.
Added SPI_NOR_HAS_BP3 bit to indicate that this nor device has BP3 bit
present for the lock/unlock mechanism.
Registered a post bfpt fixup handler for this device as the address width
advertised by the flash during nor scan is not correct.

This flash is tested for plain SPI mode although it also supports QUAD
I/O mode.

Signed-off-by: Bhargav Shah 
Signed-off-by: Sagar Shrikant Kadam 
---
 board/sifive/fu540/Kconfig |   5 +
 drivers/mtd/spi/sf_internal.h  |  18 +++
 drivers/mtd/spi/spi-nor-core.c | 340 +++--
 drivers/mtd/spi/spi-nor-ids.c  |   5 +
 include/linux/mtd/spi-nor.h|   8 +
 5 files changed, 326 insertions(+), 50 deletions(-)

diff --git a/board/sifive/fu540/Kconfig b/board/sifive/fu540/Kconfig
index 5d65080..f9d5ec1 100644
--- a/board/sifive/fu540/Kconfig
+++ b/board/sifive/fu540/Kconfig
@@ -40,6 +40,11 @@ config BOARD_SPECIFIC_OPTIONS # dummy
imply SIFIVE_SERIAL
imply SPI
imply SPI_SIFIVE
+   imply SPI_FLASH
+   imply SPI_FLASH_ISSI
+   imply SPI_FLASH_SFDP_SUPPORT
+   imply CMD_MTD
+   imply CMD_SF
imply MMC
imply MMC_SPI
imply MMC_BROKEN_CD
diff --git a/drivers/mtd/spi/sf_internal.h b/drivers/mtd/spi/sf_internal.h
index c5e68d8..6523107 100644
--- a/drivers/mtd/spi/sf_internal.h
+++ b/drivers/mtd/spi/sf_internal.h
@@ -65,6 +65,13 @@ struct flash_info {
 #define NO_CHIP_ERASE  BIT(12) /* Chip does not support chip erase */
 #define SPI_NOR_SKIP_SFDP  BIT(13) /* Skip parsing of SFDP tables */
 #define USE_CLSR   BIT(14) /* use CLSR command */
+#define SPI_NOR_HAS_BP3BIT(15) /*
+* Flash SR has block protect bits
+* for lock/unlock purpose, few support
+* BP0-BP2 while few support BP0-BP3.
+* This flag identifies devices that
+* support BP3 bit.
+*/
 
 #ifdef CONFIG_SPI_FLASH_SFDP_SUPPORT
/* Part specific fixup hooks */
@@ -72,6 +79,17 @@ struct flash_info {
 #endif
 };
 
+#ifdef CONFIG_SPI_FLASH_SFDP_SUPPORT
+/*
+ * Declare manufacturer specific fixup handlers that
+ * can be registered as fixup's in flash info table
+ * so as to update any wrong/broken SFDP parameter.
+ */
+#ifdef CONFIG_SPI_FLASH_ISSI
+extern struct spi_nor_fixups is25wp256_fixups;
+#endif
+#endif
+
 extern const struct flash_info spi_nor_ids[];
 
 #define JEDEC_MFR(info)((info)->id[0])
diff --git a/drivers/mtd/spi/spi-nor-core.c b/drivers/mtd/spi/spi-nor-core.c
index 4306d19..46d278d 100644
--- a/drivers/mtd/spi/spi-nor-core.c
+++ b/drivers/mtd/spi/spi-nor-core.c
@@ -582,7 +582,8 @@ erase_err:
return ret;
 }
 
-#if defined(CONFIG_SPI_FLASH_STMICRO) || defined(CONFIG_SPI_FLASH_SST)
+#if defined(CONFIG_SPI_FLASH_STMICRO) || defined(CONFIG_SPI_FLASH_SST) || \
+   defined(CONFIG_SPI_FLASH_ISSI)
 /* Write status register and ensure bits in mask match written values */
 static int write_sr_and_check(struct spi_nor *nor, u8 status_new, u8 mask)
 {
@@ -604,14 +605,45 @@ static int write_sr_and_check(struct spi_nor *nor, u8 
status_new, u8 mask)
return ((ret & mask) != (status_new & mask)) ? -EIO : 0;
 }
 
+/**
+ * spi_nor_read_fr() -read function register
+ * @nor: pointer to a 'struct spi_nor'.
+ *
+ * ISSI devices have top/bottom area protection bits selection into function
+ * reg. The bits in FR are OTP. So once it's written, it cannot be changed.
+ *
+ * Return: Value in function register or negative if error.
+ */
+static int spi_nor_read_fr(struct spi_nor *nor)
+{
+   int ret;
+   u8 val;
+
+   ret = nor->read_reg(nor, SPINOR_OP_RDFR, , 1);
+   if (ret < 0) {
+   pr_err("error %d reading FR\n", ret);
+   return ret;
+   }
+
+   return val;
+}
+
 static void stm_get_locked_range(struct spi_nor *nor, u8 sr, loff_t *ofs,
 uint64_t *len)
 {
struct mtd_info *mtd = >mtd;
-   u8 mask = SR_BP2 | SR_BP1 | SR_BP0;
-   int shift = ffs(mask) - 1;
+   u8 mask = 0;
+   u8 fr = 0;
+   int shift = 0;
int pow;
 
+   if (nor->flags & SNOR_F_HAS_BP3)
+   mask = SR_BP3 | SR_BP2 | SR_BP1 | SR_BP0;
+   else
+   mask = SR_BP2 | SR_BP1 | SR_BP0;
+
+   shift = ffs(mask) - 1;
+
if (!(sr & mask)) {
/* No protection */
*ofs = 0;
@@ -619,10 +651,20 @@ static void stm_get_locked_range(struct spi_nor *nor, u8 
sr, 

Re: [U-Boot] [PATCH v2 18/40] env: Move eth_env_get/set_enetaddr() to env.h

2019-08-13 Thread Tom Rini
On Thu, Aug 01, 2019 at 09:46:53AM -0600, Simon Glass wrote:

> Move these two functions over to the new header file.
> 
> Acked-by: Joe Hershberger 
> Signed-off-by: Simon Glass 

Applied to u-boot/master, thanks!

-- 
Tom


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


Re: [U-Boot] [PATCH v2 06/40] env: Move get_env_id() to env.h

2019-08-13 Thread Tom Rini
On Thu, Aug 01, 2019 at 09:46:41AM -0600, Simon Glass wrote:

> Move this function over to the new header file. Also rename it to have an
> env_ prefix like the other functions.
> 
> Signed-off-by: Simon Glass 
> Acked-by: Joe Hershberger 

Applied to u-boot/master, thanks!

-- 
Tom


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


Re: [U-Boot] [PATCH v2 28/40] env: Rename environment to embedded_environment

2019-08-13 Thread Tom Rini
On Thu, Aug 01, 2019 at 09:47:03AM -0600, Simon Glass wrote:

> The name 'environment' is widely used in U-Boot so is not a very useful
> name of a variable. Rename it to better indicate its purpose.
> 
> Signed-off-by: Simon Glass 
> Acked-by: Joe Hershberger 
> Reviewed-by: Simon Goldschmidt 

Applied to u-boot/master, thanks!

-- 
Tom


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


Re: [U-Boot] [PATCH] cmd: avb: Fix requested partitions list

2019-08-13 Thread Eugeniu Rosca
Hi Sam,

On Fri, Aug 09, 2019 at 07:16:03PM +0300, Sam Protsenko wrote:
> The requested_partitions[] array should contain only boot partitions.
> Usually it's only 'boot' partition, as can be seen in [1]. Also, seems
> like the requested_partitions[] are only used when there is no 'vbmeta'
> partition [2], which is not a regular use-case.
> 
> Make requested_partitions[] contain only 'boot' partition as it was
> supposed to be, and also make that array to be a local in
> do_avb_verify_part() function, as nobody else needs that.
> 
> [1] 
> https://android.googlesource.com/platform/external/avb/+/master/test/avb_slot_verify_unittest.cc#108
> [2] 
> https://android.googlesource.com/platform/external/avb/+/master/libavb/avb_slot_verify.c#1461

The patches are much appreciated. Could we agree to avoid volatile
references in the links, since those will point out to wrong lines after
a couple of weeks? I think it's safer to either use the latest available
commit id or tag, e.g.:

[1] 
https://android.googlesource.com/platform/external/avb/+/5fbb42a189aa/test/avb_slot_verify_unittest.cc#108
[2] 
https://android.googlesource.com/platform/external/avb/+/5fbb42a189aa/libavb/avb_slot_verify.c#1461

Thank you.

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


Re: [U-Boot] [PATCH v2 36/40] env: Move TOTAL_MALLOC_LEN to environment.h

2019-08-13 Thread Tom Rini
On Thu, Aug 01, 2019 at 09:47:11AM -0600, Simon Glass wrote:

> This declaration is only used in three files. Although it relates to
> malloc() it is actually only used during malloc() init. It uses CONFIG
> options including CONFIG_ENV_ADDR which are defined only in environment.h
> so this header must be included anyway, for TOTAL_MALLOC_LEN to be
> correct.
> 
> Nove it to environment.h to simplify the common file.
> 
> Signed-off-by: Simon Glass 
> Acked-by: Joe Hershberger 
> Reviewed-by: Simon Goldschmidt 

Applied to u-boot/master, thanks!

-- 
Tom


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


Re: [U-Boot] [PATCH v3 38/40] env: Rename environment.h to env_internal.h

2019-08-13 Thread Tom Rini
On Fri, Aug 02, 2019 at 09:44:25AM -0600, Simon Glass wrote:

> This file contains lots of internal details about the environment. Most
> code can include env.h instead, calling the functions there as needed.
> 
> Rename this file and add a comment at the top to indicate its internal
> nature.
> 
> Signed-off-by: Simon Glass 
> Acked-by: Joe Hershberger 
> Reviewed-by: Simon Goldschmidt 

Applied to u-boot/master, thanks!

-- 
Tom


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


Re: [U-Boot] [PATCH v2 34/40] env: Drop the ACTION typedef

2019-08-13 Thread Tom Rini
On Thu, Aug 01, 2019 at 09:47:09AM -0600, Simon Glass wrote:

> Avoid using a typedef here which is unnecessary. Add an 'env_' prefix to
> both the enum and its members to make it clear that these are related to
> the environment.
> 
> Add an ENV prefix to these two flags so that it is clear what they relate
> to. Also move them to env.h since they are part of the public API. Use an
> enum rather than a #define to tie them together.
> 
> Signed-off-by: Simon Glass 

Applied to u-boot/master, thanks!

-- 
Tom


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


Re: [U-Boot] [PATCH 2/5] arm: dts: Add devicetree for Hikey960 board

2019-08-13 Thread Tom Rini
On Fri, Aug 02, 2019 at 08:40:08PM +0530, Manivannan Sadhasivam wrote:

> This commit adds devicetree for Hikey960 board. Most of the contents are
> copied from Linux kernel with some modifications for u-boot. To be
> more precise, SD card's speed related properties are removed due to a
> bug in u-boot clock implementation. Hence forcing the SD controller to
> work in standard speed.
> 
> Signed-off-by: Manivannan Sadhasivam 

Applied to u-boot/master, thanks!

-- 
Tom


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


Re: [U-Boot] [PATCH v2 24/40] env: Drop env_crc_update()

2019-08-13 Thread Tom Rini
On Thu, Aug 01, 2019 at 09:46:59AM -0600, Simon Glass wrote:

> This function is not defined or used in U-Boot. Drop it.
> 
> Signed-off-by: Simon Glass 
> Acked-by: Joe Hershberger 

Applied to u-boot/master, thanks!

-- 
Tom


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


Re: [U-Boot] [PATCH v2 13/40] env: Move env_get_ulong() to env.h

2019-08-13 Thread Tom Rini
On Thu, Aug 01, 2019 at 09:46:48AM -0600, Simon Glass wrote:

> Move env_get_ulong() over to the new header file.
> 
> Signed-off-by: Simon Glass 
> Acked-by: Joe Hershberger 

Applied to u-boot/master, thanks!

-- 
Tom


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


Re: [U-Boot] [PATCH v2 26/40] env: Move env_get_char() to env.h

2019-08-13 Thread Tom Rini
On Thu, Aug 01, 2019 at 09:47:01AM -0600, Simon Glass wrote:

> Move env_get_char() over to the new header file.
> 
> Acked-by: Joe Hershberger 
> Signed-off-by: Simon Glass 

Applied to u-boot/master, thanks!

-- 
Tom


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


Re: [U-Boot] [PATCH v1] MAINTAINERS: Add entries for Android A/B and AVB

2019-08-13 Thread Tom Rini
On Thu, Aug 08, 2019 at 03:33:09PM +0300, Igor Opaniuk wrote:

> 1. Add myself as Android A/B and AVB maintainer
> 2. Add Sam Protsenko as Designated reviewer for A/B
> 
> Signed-off-by: Igor Opaniuk 

Applied to u-boot/master, thanks!

-- 
Tom


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


Re: [U-Boot] [PATCH 3/5] board: hisilicon: Add support for Hikey960 board

2019-08-13 Thread Tom Rini
On Fri, Aug 02, 2019 at 08:40:09PM +0530, Manivannan Sadhasivam wrote:

> This commit adds board support for Hikey960 board from Hisilicon. This
> board is one of the Consumer Edition boards of the 96Boards family
> powered by Kirin960 SoC.
> 
> More information about this board can be found in 96Boards website:
> https://www.96boards.org/product/hikey960/
> 
> The initial supported/tested devices include:
>  - Debug serial
>  - SD
> 
> With these support, it's good enough for loading Linux Kernel from SD.
> 
> Signed-off-by: Manivannan Sadhasivam 

Applied to u-boot/master, thanks!

-- 
Tom


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


Re: [U-Boot] [PATCH] serial_lpuart: Fix config check issue when using clk driver in SPL

2019-08-13 Thread Tom Rini
On Thu, Jul 11, 2019 at 03:33:34AM +, Ye Li wrote:

> Should use CONFIG_IS_ENABLED not IS_ENABLED for CLK driver, so it will
> check the CONFIG_SPL_CLK when building SPL
> 
> Signed-off-by: Ye Li 
> Reviewed-by: Bin Meng 

Applied to u-boot/master, thanks!

-- 
Tom


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


Re: [U-Boot] [PATCH v2 10/40] env: Move envmatch() to env.h

2019-08-13 Thread Tom Rini
On Thu, Aug 01, 2019 at 09:46:45AM -0600, Simon Glass wrote:

> Move envmatch() over to the new header file. Also rename it to env_match()
> to better line up with other functions.
> 
> Signed-off-by: Simon Glass 
> Acked-by: Joe Hershberger 

Applied to u-boot/master, thanks!

-- 
Tom


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


Re: [U-Boot] [PATCH v2 16/40] env: Move env_set() to env.h

2019-08-13 Thread Tom Rini
On Thu, Aug 01, 2019 at 09:46:51AM -0600, Simon Glass wrote:

> Move env_set() over to the new header file.
> 
> Acked-by: Joe Hershberger 
> Signed-off-by: Simon Glass 

Applied to u-boot/master, thanks!

-- 
Tom


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


Re: [U-Boot] [PATCH v3 40/40] common: Add a note about the effort to reduce common.h

2019-08-13 Thread Tom Rini
On Fri, Aug 02, 2019 at 09:44:27AM -0600, Simon Glass wrote:

> This file has quite a lot of general definitions and include files. Add a
> note about our intent to remove more of this.
> 
> The file should ultimately include the configuration and perhaps a very
> other very common things used by most U-Boot files.
> 
> Signed-off-by: Simon Glass 

Applied to u-boot/master, thanks!

-- 
Tom


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


Re: [U-Boot] [PATCH v2 39/40] Drop PCMCIA

2019-08-13 Thread Tom Rini
On Thu, Aug 01, 2019 at 09:47:14AM -0600, Simon Glass wrote:

> This is no-longer used in U-Boot and has not been converted to driver
> model. Drop it.
> 
> Signed-off-by: Simon Glass 

Applied to u-boot/master, thanks!

-- 
Tom


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


Re: [U-Boot] [PATCH v3 4/7] phy: add support for AM654x SERDES

2019-08-13 Thread Tom Rini
On Thu, Aug 01, 2019 at 07:12:58PM +0530, Sekhar Nori wrote:

> Add a new SERDES driver for TI's AM654x SoC which configures
> the SERDES only for PCIe. Support fo USB3 can be added later.
> 
> SERDES in am654x has three input clocks (left input, external
> reference clock and right input) and two output clocks (left
> output and right output) in addition to a PLL mux clock which
> the SERDES uses for Clock Multiplier Unit (CMU refclock).
> 
> The PLL mux clock can select from one of the three input
> clocks. The right output can select between left input and
> external reference clock while the left output can select
> between the right input and external reference clock.
> 
> The driver has support to select PLL mux and left/right output
> mux as specified in device tree.
> 
> Signed-off-by: Sekhar Nori 

Applied to u-boot/master, thanks!

-- 
Tom


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


Re: [U-Boot] [PATCH] ARM: da850-evm: Increase environment NOR partition offset

2019-08-13 Thread Tom Rini
On Fri, Aug 02, 2019 at 07:03:39AM -0500, Adam Ford wrote:

> The current size allocated to U-Boot is 384k, but U-Boot has grown
> to 436K which means that saving the environmental variables wipes
> out part of the U-Boot source and the board ceases to function.
> Due to the sector and erase size for the NOR part and a desire to
> not have to change partition sizes often, this patch moves the
> U-Boot environmental variables to an offset of 1M so saveenv
> does not brick the board.  This patch also sets up MTDIDS and
> MTDPARTS to clearly show where U-Boot and U-Boot's environmental
> variables are located.
> 
> Signed-off-by: Adam Ford 
> 
> diff --git a/configs/da850evm_direct_nor_defconfig 
> b/configs/da850evm_direct_nor_defconfig
> index e3c2d13986..1c0e237571 100644

Applied to u-boot/master, thanks!

-- 
Tom


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


Re: [U-Boot] [PATCH v2 08/40] env: Move env_init() to env.h

2019-08-13 Thread Tom Rini
On Thu, Aug 01, 2019 at 09:46:43AM -0600, Simon Glass wrote:

> Move env_init() over to the new header file.
> 
> Signed-off-by: Simon Glass 
> Acked-by: Joe Hershberger 

Applied to u-boot/master, thanks!

-- 
Tom


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


Re: [U-Boot] [PATCH] firmware: ti_sci: Parse all resource ranges even if some is not available

2019-08-13 Thread Tom Rini
On Mon, Aug 05, 2019 at 12:26:44PM -0500, Andreas Dannenberg wrote:

> From: Vignesh Raghavendra 
> 
> Do not fail if any of the requested subtypes are not available, but set the
> number of resources to 0 and continue parsing the resource ranges.
> 
> Based on Linux kernel patch by Peter Ujfalusi 
> 
> Signed-off-by: Vignesh Raghavendra 
> Reviewed-by: Lokesh Vutla 

Applied to u-boot/master, thanks!

-- 
Tom


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


Re: [U-Boot] [PATCH v2 21/40] env: Move set_default_vars to env.h

2019-08-13 Thread Tom Rini
On Thu, Aug 01, 2019 at 09:46:56AM -0600, Simon Glass wrote:

> Move this function to the new header file and rename it so it has an env_
> prefix.
> 
> Acked-by: Joe Hershberger 
> Signed-off-by: Simon Glass 

Applied to u-boot/master, thanks!

-- 
Tom


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


Re: [U-Boot] [PATCH v2 19/40] env: net: Move eth_parse_enetaddr() to net.c/h

2019-08-13 Thread Tom Rini
On Thu, Aug 01, 2019 at 09:46:54AM -0600, Simon Glass wrote:

> This function fits better with the network subsystem, so move it.
> 
> Signed-off-by: Simon Glass 
> Suggested-by: Joe Hershberger 

Applied to u-boot/master, thanks!

-- 
Tom


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


Re: [U-Boot] [PATCH v2 25/40] env: Move get/set_default_env() to env.h

2019-08-13 Thread Tom Rini
On Thu, Aug 01, 2019 at 09:47:00AM -0600, Simon Glass wrote:

> Move these functions to the new header file and rename set_default_env()
> to env_set_default() so that it has a consistent env_ prefix.
> 
> Acked-by: Joe Hershberger 
> Signed-off-by: Simon Glass 

Applied to u-boot/master, thanks!

-- 
Tom


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


Re: [U-Boot] [PATCH v2 17/40] env: Move env_get() to env.h

2019-08-13 Thread Tom Rini
On Thu, Aug 01, 2019 at 09:46:52AM -0600, Simon Glass wrote:

> Move env_get() over to the new header file.
> 
> Acked-by: Joe Hershberger 
> Signed-off-by: Simon Glass 

Applied to u-boot/master, thanks!

-- 
Tom


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


Re: [U-Boot] [PATCH 5/5] MAINTAINERS: Add entry for HI3660 SoC

2019-08-13 Thread Tom Rini
On Fri, Aug 02, 2019 at 08:40:11PM +0530, Manivannan Sadhasivam wrote:

> Add MAINTAINERS entry for HI3660 SoC by adding the arch includes.
> While doing so, adding myself as the co-maintainer for HISILICON
> SoCs since I'm planning to maintain HI3660 SoC separately and considering
> doing improvements to the existing HiSilicon SoC architecture.
> 
> Signed-off-by: Manivannan Sadhasivam 

Applied to u-boot/master, thanks!

-- 
Tom


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


Re: [U-Boot] [PATCH 3/3] pci: intel: Fix configuration type based on secondary number

2019-08-13 Thread Tom Rini
On Fri, May 24, 2019 at 10:30:00AM +0800, Ley Foon Tan wrote:

> This fix issue when access config from PCIe switch.
> 
> The PCIe controller need to send Type 0 config TLP if the targeting bus
> matches with the secondary bus number, which is when the TLP is targeting
> the immediate device on the link.
> 
> The PCIe controller send Type 1 config TLP if the targeting bus is
> larger than the secondary bus, which is when the TLP is targeting the
> device not immediate on the link.
> 
> Signed-off-by: Ley Foon Tan 

Applied to u-boot/master, thanks!

-- 
Tom


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


Re: [U-Boot] [PATCH v2 02/40] common: Drop the dpram_... functions

2019-08-13 Thread Tom Rini
On Thu, Aug 01, 2019 at 09:46:37AM -0600, Simon Glass wrote:

> These declarations are not used anymore, so drop them.
> 
> Signed-off-by: Simon Glass 
> Reviewed-by: Simon Goldschmidt 

Applied to u-boot/master, thanks!

-- 
Tom


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


Re: [U-Boot] [PATCH] arm: K3: sysfw-loader: Do not require full printf() for version info

2019-08-13 Thread Tom Rini
On Mon, Aug 05, 2019 at 01:46:23PM -0500, Andreas Dannenberg wrote:

> A previous commit...
> 
> commit 2a51e16bd57a ("configs: Make USE_TINY_PRINTF depend on SPL||TPL and be 
> default")
> 
> ...causes the System Firmware version string during SPL boot to no longer
> getting printed to the console as expected. To fix this issue rework the
> handling of that string to only use basic printf() syntax rather than
> for example disabling CONFIG_USE_TINY_PRINTF on affected devices, this
> way maintaining most of the memory size benefit the initial patch brings
> when it comes to SPL.
> 
> Signed-off-by: Andreas Dannenberg 
> Reviewed-by: Tom Rini 

Applied to u-boot/master, thanks!

-- 
Tom


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


Re: [U-Boot] [PATCH v2 35/40] env: Drop the double underscores in search.h

2019-08-13 Thread Tom Rini
On Thu, Aug 01, 2019 at 09:47:10AM -0600, Simon Glass wrote:

> There doesn't seem to be any good reason for using __ in the arguments in
> this header file. A double underscore is usually reserved for compiler
> features.
> 
> Drop these and remove the unnecessary 'extern' as well.
> 
> Signed-off-by: Simon Glass 
> Acked-by: Joe Hershberger 

Applied to u-boot/master, thanks!

-- 
Tom


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


Re: [U-Boot] [PATCH v2 03/40] common: Move lcd_setmem() to lcd.h

2019-08-13 Thread Tom Rini
On Thu, Aug 01, 2019 at 09:46:38AM -0600, Simon Glass wrote:

> This function relates to lcd.h and is about to become obsolete with the
> driver-model conversion. Move it out of common.h
> 
> Signed-off-by: Simon Glass 

Applied to u-boot/master, thanks!

-- 
Tom


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


Re: [U-Boot] [PATCH v2 30/40] env: Move callback definitions to env.h

2019-08-13 Thread Tom Rini
On Thu, Aug 01, 2019 at 09:47:05AM -0600, Simon Glass wrote:

> These definitions are effectively part of the 'public' API of the
> environment implementation since they do not require access to any
> internal variables. Move them to the env.h header.
> 
> Signed-off-by: Simon Glass 
> Acked-by: Joe Hershberger 

Applied to u-boot/master, thanks!

-- 
Tom


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


Re: [U-Boot] [PATCH v2 09/40] env: Move env_relocate() to env.h

2019-08-13 Thread Tom Rini
On Thu, Aug 01, 2019 at 09:46:44AM -0600, Simon Glass wrote:

> Move env_relocate() over to the new header file.
> 
> Signed-off-by: Simon Glass 
> Acked-by: Joe Hershberger 

Applied to u-boot/master, thanks!

-- 
Tom


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


Re: [U-Boot] [PATCH v2 14/40] env: Move env_get_yesno() to env.h

2019-08-13 Thread Tom Rini
On Thu, Aug 01, 2019 at 09:46:49AM -0600, Simon Glass wrote:

> Move env_get_yesno() over to the new header file.
> 
> Signed-off-by: Simon Glass 
> Acked-by: Joe Hershberger 

Applied to u-boot/master, thanks!

-- 
Tom


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


Re: [U-Boot] [PATCH v2 27/40] env: Move env_reloc() to env.h

2019-08-13 Thread Tom Rini
On Thu, Aug 01, 2019 at 09:47:02AM -0600, Simon Glass wrote:

> Move env_reloc() over to the new header file.
> 
> Acked-by: Joe Hershberger 
> Signed-off-by: Simon Glass 

Applied to u-boot/master, thanks!

-- 
Tom


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


Re: [U-Boot] [PATCH 4/5] mmc: Add support for HI3660 SoC reusing hi6220_dw_mmc driver

2019-08-13 Thread Tom Rini
On Fri, Aug 02, 2019 at 08:40:10PM +0530, Manivannan Sadhasivam wrote:

> This commit adds MMC driver support for HI3660 SoC reusing hi6220_dw_mmc
> driver. Since HI3660 operates at different clock rate and uses fifo
> mode now, let's introduce the platform data and utilize it for different
> SoCs supported by this driver.
> 
> Signed-off-by: Manivannan Sadhasivam 

Applied to u-boot/master, thanks!

-- 
Tom


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


Re: [U-Boot] [PATCH] ARM: da850-evm: Enable SPI Flash and NAND Flash when booting NOR

2019-08-13 Thread Tom Rini
On Sat, Aug 03, 2019 at 07:56:10AM -0500, Adam Ford wrote:

> Historically there have been various boot options, SPI flash,
> NAND or NOR. The NOR flash is mutually exclusive with MMC, but
> it isn't mutually exclusive with NAND or SPI Flash, so this patch
> enables both NAND flash and SPI Flash when booting from NOR.
> 
> Signed-off-by: Adam Ford 
> 
> diff --git a/board/davinci/da8xxevm/da850evm.c 
> b/board/davinci/da8xxevm/da850evm.c
> index 2d5710076d..c9c34a0c29 100644

Applied to u-boot/master, thanks!

-- 
Tom


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


Re: [U-Boot] [PATCH v2 07/40] env: Move env_get_f() to env.h

2019-08-13 Thread Tom Rini
On Thu, Aug 01, 2019 at 09:46:42AM -0600, Simon Glass wrote:

> Move this function over to the new header file.
> 
> Signed-off-by: Simon Glass 
> Acked-by: Joe Hershberger 

Applied to u-boot/master, thanks!

-- 
Tom


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


Re: [U-Boot] [PATCH v3 31/40] env: Drop the ENTRY typedef

2019-08-13 Thread Tom Rini
On Fri, Aug 02, 2019 at 09:44:18AM -0600, Simon Glass wrote:

> U-Boot is not supposed to use typedef for structs anymore. Also this name
> is the same as the ENTRY() macro used in assembler files, and 'entry'
> itself is widely used in U-Boot (>8k matches).
> 
> Drop the typedef and rename the struct to env_entry to reduce confusion.
> 
> Signed-off-by: Simon Glass 
> Acked-by: Joe Hershberger 

Applied to u-boot/master, thanks!

-- 
Tom


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


Re: [U-Boot] [PATCH v2 33/40] env: Rename the redundancy flags

2019-08-13 Thread Tom Rini
On Thu, Aug 01, 2019 at 09:47:08AM -0600, Simon Glass wrote:

> Add an ENV prefix to these two flags so that it is clear what they relate
> to. Also move them to env.h since they are part of the public API. Use an
> enum rather than a #define to tie them together.
> 
> Signed-off-by: Simon Glass 

Applied to u-boot/master, thanks!

-- 
Tom


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


Re: [U-Boot] [PATCH v3 6/7] arm: dts: k3-am65: add support for PCIe and SERDES

2019-08-13 Thread Tom Rini
On Thu, Aug 01, 2019 at 07:13:00PM +0530, Sekhar Nori wrote:

> Add needed device-tree nodes to support PCIe 0
> and SERDES on AM65x SoC. The nodes are kept
> disabled by default.
> 
> Signed-off-by: Sekhar Nori 

Applied to u-boot/master, thanks!

-- 
Tom


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


Re: [U-Boot] [PATCH v2 23/40] env: Move env import/export functions to env.h

2019-08-13 Thread Tom Rini
On Thu, Aug 01, 2019 at 09:46:58AM -0600, Simon Glass wrote:

> Move these functions to the new header file.
> 
> Acked-by: Joe Hershberger 
> Signed-off-by: Simon Glass 

Applied to u-boot/master, thanks!

-- 
Tom


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


Re: [U-Boot] [PATCH 1/3] pci: intel: Increase TLP polling counter

2019-08-13 Thread Tom Rini
On Fri, May 24, 2019 at 10:29:58AM +0800, Ley Foon Tan wrote:

> Some PCIe devices require longer time to response.
> Increase polling counter to 2 (~100ms).
> 
> Signed-off-by: Ley Foon Tan 

Applied to u-boot/master, thanks!

-- 
Tom


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


  1   2   3   >