Re: [PATCH] imx8mq_evk: enlarge SYS_MALLOC_F_LEN

2022-09-13 Thread Heiko Thiery
Hi,

Am Mi., 14. Sept. 2022 um 03:38 Uhr schrieb Peng Fan (OSS)
:
>
> From: Peng Fan 
>
> There is "alloc space exhausted" with DEBUG_UART enabled with the
> options enabled.
>
> CONFIG_DEBUG_UART_BASE=0x3086  # for uart1
> CONFIG_DEBUG_UART_CLOCK=2400
>
> It is because CONFIG_SYS_MALLOC_F_LEN is too small, enlarge it. And set
> CONFIG_SPL_STACK to 0x188000 to not waste the top 16bytes.

When changing these values on the kontron_pitx_imx8m_defconfig this
board also works again.
Maybe it could be a good idea to change these values for all imx8mq boards.

>
> Reported-by: Heiko Thiery 
> Signed-off-by: Peng Fan 

Tested-by: Heiko Thiery 

> ---
>  configs/imx8mq_evk_defconfig | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/configs/imx8mq_evk_defconfig b/configs/imx8mq_evk_defconfig
> index cf207295e54..d877a1290f9 100644
> --- a/configs/imx8mq_evk_defconfig
> +++ b/configs/imx8mq_evk_defconfig
> @@ -2,6 +2,8 @@ CONFIG_ARM=y
>  CONFIG_ARCH_IMX8M=y
>  CONFIG_SYS_TEXT_BASE=0x4020
>  CONFIG_SYS_MALLOC_LEN=0x60
> +CONFIG_SYS_MALLOC_F_LEN=0x1
> +CONFIG_SPL_SYS_MALLOC_F_LEN=0x2000
>  CONFIG_SPL_GPIO=y
>  CONFIG_SPL_LIBCOMMON_SUPPORT=y
>  CONFIG_SPL_LIBGENERIC_SUPPORT=y
> @@ -36,7 +38,7 @@ CONFIG_SPL_BSS_START_ADDR=0x18
>  CONFIG_SPL_BSS_MAX_SIZE=0x2000
>  CONFIG_SPL_BOARD_INIT=y
>  # CONFIG_SPL_SHARES_INIT_SP_ADDR is not set
> -CONFIG_SPL_STACK=0x187ff0
> +CONFIG_SPL_STACK=0x188000
>  CONFIG_SYS_SPL_MALLOC=y
>  CONFIG_HAS_CUSTOM_SPL_MALLOC_START=y
>  CONFIG_CUSTOM_SYS_SPL_MALLOC_ADDR=0x4220
> --
> 2.36.0
>

Thank you
-- 
Heiko


Re: [PATCH v2 22/24] blk: Drop if_type

2022-09-13 Thread AKASHI Takahiro
On Tue, Sep 13, 2022 at 06:27:37PM +0200, Heinrich Schuchardt wrote:
> On 8/12/22 03:35, Simon Glass wrote:
> > Use the uclass ID instead.
> > 
> > Signed-off-by: Simon Glass 
> > ---
> > 
> > (no changes since v1)
> > 
> >   cmd/blk_common.c   |  2 +-
> >   drivers/block/blk-uclass.c | 34 +++
> >   drivers/block/blk_legacy.c | 20 +--
> >   include/blk.h  | 41 ++
> >   include/efi_loader.h   |  2 +-
> >   5 files changed, 48 insertions(+), 51 deletions(-)
> > 
> > diff --git a/cmd/blk_common.c b/cmd/blk_common.c
> > index 4e442f2918b..369c5ae4bbe 100644
> > --- a/cmd/blk_common.c
> > +++ b/cmd/blk_common.c
> > @@ -12,7 +12,7 @@
> >   #include 
> >   #include 
> > 
> > -int blk_common_cmd(int argc, char *const argv[], enum if_type if_type,
> > +int blk_common_cmd(int argc, char *const argv[], enum uclass_id if_type,
> >int *cur_devnump)
> >   {
> > const char *if_name = blk_get_if_type_name(if_type);
> > diff --git a/drivers/block/blk-uclass.c b/drivers/block/blk-uclass.c
> > index 436af764f91..a9a85aa37f3 100644
> > --- a/drivers/block/blk-uclass.c
> > +++ b/drivers/block/blk-uclass.c
> > @@ -34,7 +34,7 @@ static struct {
> > { UCLASS_PVBLOCK, "pvblock" },
> >   };
> > 
> > -static enum if_type if_typename_to_iftype(const char *if_typename)
> > +static enum uclass_id if_typename_to_iftype(const char *if_typename)
> >   {
> > int i;
> > 
> > @@ -46,7 +46,7 @@ static enum if_type if_typename_to_iftype(const char 
> > *if_typename)
> > return UCLASS_INVALID;
> >   }
> > 
> > -static enum uclass_id if_type_to_uclass_id(enum if_type if_type)
> > +static enum uclass_id if_type_to_uclass_id(enum uclass_id if_type)
> >   {
> > /*
> >  * This strange adjustment is used because we use UCLASS_MASS_STORAGE
> > @@ -71,7 +71,7 @@ static enum uclass_id if_type_to_uclass_id(enum if_type 
> > if_type)
> > return if_type;
> >   }
> > 
> > -const char *blk_get_if_type_name(enum if_type if_type)
> > +const char *blk_get_if_type_name(enum uclass_id if_type)
> >   {
> > int i;
> > 
> > @@ -83,7 +83,7 @@ const char *blk_get_if_type_name(enum if_type if_type)
> > return "(none)";
> >   }
> > 
> > -struct blk_desc *blk_get_devnum_by_type(enum if_type if_type, int devnum)
> > +struct blk_desc *blk_get_devnum_by_type(enum uclass_id if_type, int devnum)
> >   {
> > struct blk_desc *desc;
> > struct udevice *dev;
> > @@ -105,7 +105,7 @@ struct blk_desc *blk_get_devnum_by_type(enum if_type 
> > if_type, int devnum)
> >   struct blk_desc *blk_get_devnum_by_typename(const char *if_typename, int 
> > devnum)
> >   {
> > enum uclass_id uclass_id;
> > -   enum if_type type;
> > +   enum uclass_id type;
> > struct udevice *dev;
> > struct uclass *uc;
> > int ret;
> > @@ -185,7 +185,7 @@ struct blk_desc *blk_get_by_device(struct udevice *dev)
> >* with a higher device number, -ENOENT if there is no such device but 
> > there
> >* is one with a higher number, or other -ve on other error.
> >*/
> > -static int get_desc(enum if_type if_type, int devnum, struct blk_desc 
> > **descp)
> > +static int get_desc(enum uclass_id if_type, int devnum, struct blk_desc 
> > **descp)
> >   {
> > bool found_more = false;
> > struct udevice *dev;
> > @@ -218,7 +218,7 @@ static int get_desc(enum if_type if_type, int devnum, 
> > struct blk_desc **descp)
> > return found_more ? -ENOENT : -ENODEV;
> >   }
> > 
> > -int blk_select_hwpart_devnum(enum if_type if_type, int devnum, int hwpart)
> > +int blk_select_hwpart_devnum(enum uclass_id if_type, int devnum, int 
> > hwpart)
> >   {
> > struct udevice *dev;
> > int ret;
> > @@ -230,7 +230,7 @@ int blk_select_hwpart_devnum(enum if_type if_type, int 
> > devnum, int hwpart)
> > return blk_select_hwpart(dev, hwpart);
> >   }
> > 
> > -int blk_list_part(enum if_type if_type)
> > +int blk_list_part(enum uclass_id if_type)
> >   {
> > struct blk_desc *desc;
> > int devnum, ok;
> > @@ -255,7 +255,7 @@ int blk_list_part(enum if_type if_type)
> > return 0;
> >   }
> > 
> > -int blk_print_part_devnum(enum if_type if_type, int devnum)
> > +int blk_print_part_devnum(enum uclass_id if_type, int devnum)
> >   {
> > struct blk_desc *desc;
> > int ret;
> > @@ -270,7 +270,7 @@ int blk_print_part_devnum(enum if_type if_type, int 
> > devnum)
> > return 0;
> >   }
> > 
> > -void blk_list_devices(enum if_type if_type)
> > +void blk_list_devices(enum uclass_id if_type)
> >   {
> > struct blk_desc *desc;
> > int ret;
> > @@ -289,7 +289,7 @@ void blk_list_devices(enum if_type if_type)
> > }
> >   }
> > 
> > -int blk_print_device_num(enum if_type if_type, int devnum)
> > +int blk_print_device_num(enum uclass_id if_type, int devnum)
> >   {
> > struct blk_desc *desc;
> > int ret;
> > @@ -303,7 +303,7 @@ int blk_print_device_num(enum if_type if_type, int 
> > devnum)
> > return 

Re: [PATCH v2 09/24] blk: Rename HAVE_BLOCK_DEVICE

2022-09-13 Thread AKASHI Takahiro
On Thu, Aug 11, 2022 at 07:34:48PM -0600, Simon Glass wrote:
> This option is fact really related to SPL. For U-Boot proper we always use
> driver model for block devices, so CONFIG_BLK is enabled if block devices
> are in use.
> 
> It is only for SPL that we have two cases:
> 
> - SPL_BLK is enabled, in which case we use driver model and blk-uclass.c
> - SPL_BLK is not enabled, in which case (if we need block devices) we must
>   use blk_legacy.c
> 
> Rename the symbol to SPL_LEGACY_BLOCK to make this clear. This is
> different enough from BLK and SPL_BLK that there should be no confusion.
> 
> Signed-off-by: Simon Glass 
> ---
> 
> (no changes since v1)
> 
>  common/spl/Kconfig | 4 ++--
>  configs/axm_defconfig  | 2 +-
>  configs/bcm968380gerg_ram_defconfig| 2 +-
>  configs/gardena-smart-gateway-mt7688_defconfig | 2 +-
>  configs/nsim_hs38_defconfig| 2 +-
>  configs/qemu-ppce500_defconfig | 2 +-
>  disk/Makefile  | 4 ++--
>  disk/disk-uclass.c | 3 +--
>  doc/develop/driver-model/migration.rst | 2 +-
>  drivers/Makefile   | 2 +-
>  drivers/ata/Kconfig| 2 +-
>  drivers/block/Kconfig  | 8 
>  drivers/block/Makefile | 2 +-
>  drivers/mmc/Kconfig| 2 +-
>  drivers/nvme/Kconfig   | 2 +-
>  drivers/scsi/Kconfig   | 2 +-
>  drivers/xen/Kconfig| 2 +-
>  include/blk.h  | 2 +-
>  lib/efi_loader/Kconfig | 2 +-
>  19 files changed, 24 insertions(+), 25 deletions(-)
> 
> diff --git a/common/spl/Kconfig b/common/spl/Kconfig
> index ee98810e9e9..4c3e74ae5eb 100644
> --- a/common/spl/Kconfig
> +++ b/common/spl/Kconfig
> @@ -792,7 +792,7 @@ config SPL_DM_MAILBOX
>  config SPL_MMC
>   bool "Support MMC"
>   depends on MMC
> - select HAVE_BLOCK_DEVICE
> + select SPL_LEGACY_BLOCK
>   help
> Enable support for MMC (Multimedia Card) within SPL. This enables
> the MMC protocol implementation and allows any enabled drivers to
> @@ -1318,7 +1318,7 @@ config SPL_THERMAL
>  
>  config SPL_USB_HOST
>   bool "Support USB host drivers"
> - select HAVE_BLOCK_DEVICE
> + select SPL_LEGACY_BLOCK
>   help
> Enable access to USB (Universal Serial Bus) host devices so that
> SPL can load U-Boot from a connected USB peripheral, such as a USB
> diff --git a/configs/axm_defconfig b/configs/axm_defconfig
> index a5f60bd8d0c..c42fb37d6c9 100644
> --- a/configs/axm_defconfig
> +++ b/configs/axm_defconfig
> @@ -80,7 +80,7 @@ CONFIG_SYS_REDUNDAND_ENVIRONMENT=y
>  CONFIG_SYS_RELOC_GD_ENV_ADDR=y
>  CONFIG_SPL_DM=y
>  CONFIG_BLK=y
> -CONFIG_HAVE_BLOCK_DEVICE=y
> +CONFIG_SPL_LEGACY_BLOCK=y
>  CONFIG_CLK=y
>  CONFIG_CLK_AT91=y
>  CONFIG_AT91_GPIO=y
> diff --git a/configs/bcm968380gerg_ram_defconfig 
> b/configs/bcm968380gerg_ram_defconfig
> index 0475535e991..246add6029c 100644
> --- a/configs/bcm968380gerg_ram_defconfig
> +++ b/configs/bcm968380gerg_ram_defconfig
> @@ -42,7 +42,7 @@ CONFIG_CMD_NAND=y
>  CONFIG_SYS_RELOC_GD_ENV_ADDR=y
>  # CONFIG_NET is not set
>  # CONFIG_DM_DEVICE_REMOVE is not set
> -CONFIG_HAVE_BLOCK_DEVICE=y
> +CONFIG_SPL_LEGACY_BLOCK=y
>  CONFIG_BCM6345_GPIO=y
>  CONFIG_LED=y
>  CONFIG_LED_BCM6328=y
> diff --git a/configs/gardena-smart-gateway-mt7688_defconfig 
> b/configs/gardena-smart-gateway-mt7688_defconfig
> index b9ee281be9f..fdfab14d53e 100644
> --- a/configs/gardena-smart-gateway-mt7688_defconfig
> +++ b/configs/gardena-smart-gateway-mt7688_defconfig
> @@ -78,7 +78,7 @@ CONFIG_VERSION_VARIABLE=y
>  CONFIG_NET_RANDOM_ETHADDR=y
>  CONFIG_SPL_DM=y
>  # CONFIG_DM_DEVICE_REMOVE is not set
> -CONFIG_HAVE_BLOCK_DEVICE=y
> +CONFIG_SPL_LEGACY_BLOCK=y
>  CONFIG_BOOTCOUNT_LIMIT=y
>  CONFIG_LED=y
>  CONFIG_LED_BLINK=y
> diff --git a/configs/nsim_hs38_defconfig b/configs/nsim_hs38_defconfig
> index 3c3d1812a79..3f23fc4189f 100644
> --- a/configs/nsim_hs38_defconfig
> +++ b/configs/nsim_hs38_defconfig
> @@ -30,7 +30,7 @@ CONFIG_SYS_RELOC_GD_ENV_ADDR=y
>  CONFIG_USE_BOOTFILE=y
>  CONFIG_BOOTFILE="uImage"
>  CONFIG_BLK=y
> -CONFIG_HAVE_BLOCK_DEVICE=y
> +CONFIG_SPL_LEGACY_BLOCK=y
>  CONFIG_DM_ETH=y
>  CONFIG_DM_SERIAL=y
>  CONFIG_DEBUG_UART_SHIFT=2
> diff --git a/configs/qemu-ppce500_defconfig b/configs/qemu-ppce500_defconfig
> index 034f7e6935b..3241f5520eb 100644
> --- a/configs/qemu-ppce500_defconfig
> +++ b/configs/qemu-ppce500_defconfig
> @@ -40,7 +40,7 @@ CONFIG_NET_RANDOM_ETHADDR=y
>  CONFIG_DM=y
>  CONFIG_SIMPLE_BUS_CORRECT_RANGE=y
>  CONFIG_BLK=y
> -CONFIG_HAVE_BLOCK_DEVICE=y
> +CONFIG_SPL_LEGACY_BLOCK=y
>  CONFIG_LBA48=y
>  CONFIG_CHIP_SELECTS_PER_CTRL=0
>  CONFIG_MPC8XXX_GPIO=y
> diff --git a/disk/Makefile b/disk/Makefile
> index 

Re: imx8mq allocation issue

2022-09-13 Thread Peng Fan




On 9/13/2022 3:25 PM, Heiko Thiery wrote:

Hi Peng,

Am Di., 13. Sept. 2022 um 09:00 Uhr schrieb Peng Fan :




On 9/12/2022 3:48 PM, Heiko Thiery wrote:

Hi Peng,

Am Mo., 12. Sept. 2022 um 09:26 Uhr schrieb Peng Fan :




On 9/9/2022 5:12 PM, Heiko Thiery wrote:

HI,

I think on the imx8mq platform we have a problem with the introduction
of the clock driver. I tried to debug the problem that the pitx-imx8m
board was not able to start for some time. I was wondering why the
pitx-im8m doesn't work anymore although the imx8mq_evk is running.

So I switched to the imx8mq_evk for counter testing. As I already
figured out in [1] also the imx8mq_evk is not able to start properly.

On the EVK I enabled the DEBUG_UART and see the outputs below. I
suspect all imx8mq boards have this problem.

CONFIG_DEBUG_UART_BASE=0x3086  # for uart1
CONFIG_DEBUG_UART_CLOCK=2400

--- 8< 
U-Boot SPL 2022.10-rc4-00038-ge3fce5e560-dirty (Sep 09 2022 - 10:51:29 +0200)
PMIC:  PFUZE100 ID=0x10
SEC0:  RNG instantiated
Normal Boot
Trying to boot from MMC2
clk_register: failed to get  device (parent of ckil)
clk_register: failed to get  device (parent of clock-osc-27m)
alloc space exhausted
alloc space exhausted
alloc space exhausted
alloc space exhausted


Seems SPL_DM_CLK consumes the malloc space, so you meet such error.



I dont think the SPL is the problem. Because the output appears after
"Trying to boot from MMC2".

Do you have time to give a try?

diff --git a/configs/imx8mq_evk_defconfig b/configs/imx8mq_evk_defconfig
index cf207295e54..14b49ab5906 100644
--- a/configs/imx8mq_evk_defconfig
+++ b/configs/imx8mq_evk_defconfig
@@ -2,6 +2,7 @@ CONFIG_ARM=y
   CONFIG_ARCH_IMX8M=y
   CONFIG_SYS_TEXT_BASE=0x4020
   CONFIG_SYS_MALLOC_LEN=0x60
+CONFIG_SYS_MALLOC_F_LEN=0x2800
   CONFIG_SPL_GPIO=y
   CONFIG_SPL_LIBCOMMON_SUPPORT=y
   CONFIG_SPL_LIBGENERIC_SUPPORT=y
@@ -36,7 +37,7 @@ CONFIG_SPL_BSS_START_ADDR=0x18
   CONFIG_SPL_BSS_MAX_SIZE=0x2000
   CONFIG_SPL_BOARD_INIT=y
   # CONFIG_SPL_SHARES_INIT_SP_ADDR is not set
-CONFIG_SPL_STACK=0x187ff0
+CONFIG_SPL_STACK=0x188000
   CONFIG_SYS_SPL_MALLOC=y
   CONFIG_HAS_CUSTOM_SPL_MALLOC_START=y
   CONFIG_CUSTOM_SYS_SPL_MALLOC_ADDR=0x4220
diff --git a/include/configs/imx8mq_evk.h b/include/configs/imx8mq_evk.h
index ea4305667f2..728b4f7e665 100644
--- a/include/configs/imx8mq_evk.h
+++ b/include/configs/imx8mq_evk.h
@@ -16,8 +16,6 @@
   /*#define CONFIG_ENABLE_DDR_TRAINING_DEBUG*/
   #define CONFIG_SYS_SPL_PTE_RAM_BASE0x4158

-/* malloc f used before GD_FLG_FULL_MALLOC_INIT set */
-#define CONFIG_MALLOC_F_ADDR   0x182000
   /* For RAW image gives a error info not panic */

   #define CONFIG_POWER_PFUZE100



This has no positive effect.


Just posted a fix: "imx8mq_evk: enlarge SYS_MALLOC_F_LEN"

Thanks,
Peng.




By the way: I have to remove the hdmi_phy node. Otherwise the board is
no longer able to start:

--- 8< ---
U-Boot SPL 2022.10-rc4-00038-ge3fce5e560-dirty (Sep 13 2022 - 09:20:21 +0200)
pmic_alloc: No available memory for allocation!
power_pfuze100_init: POWER allocation error!
SEC0:  RNG instantiated
Normal Boot
Trying to boot from MMC2
þ
U-Boot SPL 2022.10-rc4-00038-ge3fce5e560-dirty (Sep 13 2022 - 09:20:21 +0200)
pmic_alloc: No available memory for allocation!
power_pfuze100_init: POWER allocation error!
SEC0:  RNG instantiated
Normal Boot
Trying to boot from MMC2
:
--- 8< ---

diff --git a/arch/arm/dts/imx8mq.dtsi b/arch/arm/dts/imx8mq.dtsi
index 49eadb081b..e0d1fd2b02 100644
--- a/arch/arm/dts/imx8mq.dtsi
+++ b/arch/arm/dts/imx8mq.dtsi
@@ -63,12 +63,12 @@
 clock-output-names = "osc_27m";
 };

-   hdmi_phy_27m: clock-hdmi-phy-27m {
-   compatible = "fixed-clock";
-   #clock-cells = <0>;
-   clock-frequency = <2700>;
-   clock-output-names = "hdmi_phy_27m";
-   };
+// hdmi_phy_27m: clock-hdmi-phy-27m {
+// compatible = "fixed-clock";
+// #clock-cells = <0>;
+// clock-frequency = <2700>;
+// clock-output-names = "hdmi_phy_27m";
+// };

 clk_ext1: clock-ext1 {
 compatible = "fixed-clock";



[PATCH] imx8mq_evk: enlarge SYS_MALLOC_F_LEN

2022-09-13 Thread Peng Fan (OSS)
From: Peng Fan 

There is "alloc space exhausted" with DEBUG_UART enabled with the
options enabled.

CONFIG_DEBUG_UART_BASE=0x3086  # for uart1
CONFIG_DEBUG_UART_CLOCK=2400

It is because CONFIG_SYS_MALLOC_F_LEN is too small, enlarge it. And set
CONFIG_SPL_STACK to 0x188000 to not waste the top 16bytes.

Reported-by: Heiko Thiery 
Signed-off-by: Peng Fan 
---
 configs/imx8mq_evk_defconfig | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/configs/imx8mq_evk_defconfig b/configs/imx8mq_evk_defconfig
index cf207295e54..d877a1290f9 100644
--- a/configs/imx8mq_evk_defconfig
+++ b/configs/imx8mq_evk_defconfig
@@ -2,6 +2,8 @@ CONFIG_ARM=y
 CONFIG_ARCH_IMX8M=y
 CONFIG_SYS_TEXT_BASE=0x4020
 CONFIG_SYS_MALLOC_LEN=0x60
+CONFIG_SYS_MALLOC_F_LEN=0x1
+CONFIG_SPL_SYS_MALLOC_F_LEN=0x2000
 CONFIG_SPL_GPIO=y
 CONFIG_SPL_LIBCOMMON_SUPPORT=y
 CONFIG_SPL_LIBGENERIC_SUPPORT=y
@@ -36,7 +38,7 @@ CONFIG_SPL_BSS_START_ADDR=0x18
 CONFIG_SPL_BSS_MAX_SIZE=0x2000
 CONFIG_SPL_BOARD_INIT=y
 # CONFIG_SPL_SHARES_INIT_SP_ADDR is not set
-CONFIG_SPL_STACK=0x187ff0
+CONFIG_SPL_STACK=0x188000
 CONFIG_SYS_SPL_MALLOC=y
 CONFIG_HAS_CUSTOM_SPL_MALLOC_START=y
 CONFIG_CUSTOM_SYS_SPL_MALLOC_ADDR=0x4220
-- 
2.36.0



Re: [PATCH v2 24/24] blk: Rename if_type to uclass_id

2022-09-13 Thread AKASHI Takahiro
Hi Simon,

On Thu, Aug 11, 2022 at 07:35:03PM -0600, Simon Glass wrote:
> Use the word 'uclass' instead of 'if_type' to complete the conversion.
> 
> Signed-off-by: Simon Glass 
> ---
> 
> Changes in v2:
> - Use conv_uclass_id() instead of the confusing uclass_id_to_uclass_id()
> 
>  board/st/common/stm32mp_dfu.c|   2 +-
>  cmd/blk_common.c |  18 +--
>  cmd/lsblk.c  |   2 +-
>  cmd/mmc.c|   2 +-
>  common/usb_storage.c |   6 +-
>  disk/disk-uclass.c   |   8 +-
>  disk/part.c  |  12 +-
>  doc/usage/partitions.rst |   2 +-
>  drivers/ata/sata.c   |   2 +-
>  drivers/block/blk-uclass.c   | 145 +++
>  drivers/block/blk_legacy.c   |  58 -
>  drivers/block/ide.c  |   8 +-
>  drivers/block/sandbox.c  |   6 +-
>  drivers/mmc/mmc-uclass.c |   2 +-
>  drivers/mmc/mmc_legacy.c |   8 +-
>  drivers/net/fsl_enetc.c  |  12 +-
>  drivers/net/fsl_enetc.h  |   2 +-
>  drivers/scsi/scsi.c  |   6 +-
>  drivers/virtio/virtio_blk.c  |   2 +-
>  drivers/xen/pvblock.c|   2 +-
>  fs/fat/fat.c |   2 +-
>  include/blk.h| 116 +-
>  include/efi_api.h|   4 +-
>  include/efi_loader.h |   4 +-
>  lib/efi_loader/efi_device_path.c |   2 +-
>  lib/efi_loader/efi_device_path_to_text.c |   4 +-
>  lib/efi_loader/efi_disk.c|  26 ++--
>  lib/efi_loader/efi_net.c |   2 +-
>  lib/efi_loader/efi_var_file.c|   4 +-
>  29 files changed, 234 insertions(+), 235 deletions(-)
> 
> diff --git a/board/st/common/stm32mp_dfu.c b/board/st/common/stm32mp_dfu.c
> index fa48b2a35ee..0096f71dfc1 100644
> --- a/board/st/common/stm32mp_dfu.c
> +++ b/board/st/common/stm32mp_dfu.c
> @@ -37,7 +37,7 @@ static void board_get_alt_info_mmc(struct udevice *dev, 
> char *buf)
>   if (!desc)
>   return;
>  
> - name = blk_get_if_type_name(desc->if_type);
> + name = blk_get_uclass_name(desc->uclass_id);
>   devnum = desc->devnum;
>   len = strlen(buf);
>  
> diff --git a/cmd/blk_common.c b/cmd/blk_common.c
> index 369c5ae4bbe..75a072caf51 100644
> --- a/cmd/blk_common.c
> +++ b/cmd/blk_common.c
> @@ -12,10 +12,10 @@
>  #include 
>  #include 
>  
> -int blk_common_cmd(int argc, char *const argv[], enum uclass_id if_type,
> +int blk_common_cmd(int argc, char *const argv[], enum uclass_id uclass_id,
>  int *cur_devnump)
>  {
> - const char *if_name = blk_get_if_type_name(if_type);
> + const char *if_name = blk_get_uclass_name(uclass_id);
>  
>   switch (argc) {
>   case 0:
> @@ -23,16 +23,16 @@ int blk_common_cmd(int argc, char *const argv[], enum 
> uclass_id if_type,
>   return CMD_RET_USAGE;
>   case 2:
>   if (strncmp(argv[1], "inf", 3) == 0) {
> - blk_list_devices(if_type);
> + blk_list_devices(uclass_id);
>   return 0;
>   } else if (strncmp(argv[1], "dev", 3) == 0) {
> - if (blk_print_device_num(if_type, *cur_devnump)) {
> + if (blk_print_device_num(uclass_id, *cur_devnump)) {
>   printf("\nno %s devices available\n", if_name);
>   return CMD_RET_FAILURE;
>   }
>   return 0;
>   } else if (strncmp(argv[1], "part", 4) == 0) {
> - if (blk_list_part(if_type))
> + if (blk_list_part(uclass_id))
>   printf("\nno %s partition table available\n",
>  if_name);
>   return 0;
> @@ -42,7 +42,7 @@ int blk_common_cmd(int argc, char *const argv[], enum 
> uclass_id if_type,
>   if (strncmp(argv[1], "dev", 3) == 0) {
>   int dev = (int)dectoul(argv[2], NULL);
>  
> - if (!blk_show_device(if_type, dev)) {
> + if (!blk_show_device(uclass_id, dev)) {
>   *cur_devnump = dev;
>   printf("... is now current device\n");
>   } else {
> @@ -52,7 +52,7 @@ int blk_common_cmd(int argc, char *const argv[], enum 
> uclass_id if_type,
>   } else if (strncmp(argv[1], "part", 4) == 0) {
>   int dev = (int)dectoul(argv[2], NULL);
>  
> - if (blk_print_part_devnum(if_type, dev)) {
> + if (blk_print_part_devnum(uclass_id, dev)) {
>   printf("\n%s device %d not available\n",

[PATCH 2/2] sunxi: defconfig: drop redundant definitions

2022-09-13 Thread Andre Przywara
When some configuration symbols were converted from header files to
Kconfig, their values were placed into *every* defconfig file.
Since we now have sensible per-SoC defaults defined in Kconfig, those
values are now redundant, and can just be removed.
This affects CONFIG_SPL_STACK, CONFIG_SYS_PBSIZE, CONFIG_SPL_MAX_SIZE,
and CONFIG_SYS_BOOTM_LEN.

Signed-off-by: Andre Przywara 
---
 configs/A10-OLinuXino-Lime_defconfig   | 2 --
 configs/A10s-OLinuXino-M_defconfig | 2 --
 configs/A13-OLinuXinoM_defconfig   | 2 --
 configs/A13-OLinuXino_defconfig| 2 --
 configs/A20-OLinuXino-Lime2-eMMC_defconfig | 2 --
 configs/A20-OLinuXino-Lime2_defconfig  | 2 --
 configs/A20-OLinuXino-Lime_defconfig   | 2 --
 configs/A20-OLinuXino_MICRO-eMMC_defconfig | 2 --
 configs/A20-OLinuXino_MICRO_defconfig  | 2 --
 configs/A20-Olimex-SOM-EVB_defconfig   | 2 --
 configs/A20-Olimex-SOM204-EVB-eMMC_defconfig   | 2 --
 configs/A20-Olimex-SOM204-EVB_defconfig| 2 --
 configs/A33-OLinuXino_defconfig| 2 --
 configs/Ainol_AW1_defconfig| 2 --
 configs/Ampe_A76_defconfig | 2 --
 configs/Auxtek-T003_defconfig  | 2 --
 configs/Auxtek-T004_defconfig  | 2 --
 configs/Bananapi_M2_Ultra_defconfig| 2 --
 configs/Bananapi_defconfig | 2 --
 configs/Bananapi_m2m_defconfig | 2 --
 configs/Bananapro_defconfig| 2 --
 configs/CHIP_defconfig | 2 --
 configs/CHIP_pro_defconfig | 2 --
 configs/CSQ_CS908_defconfig| 2 --
 configs/Chuwi_V7_CW0825_defconfig  | 2 --
 configs/Colombus_defconfig | 2 --
 configs/Cubieboard2_defconfig  | 2 --
 configs/Cubieboard4_defconfig  | 2 --
 configs/Cubieboard_defconfig   | 2 --
 configs/Cubietruck_defconfig   | 2 --
 configs/Cubietruck_plus_defconfig  | 2 --
 configs/Empire_electronix_d709_defconfig   | 2 --
 configs/Empire_electronix_m712_defconfig   | 2 --
 configs/Hummingbird_A31_defconfig  | 2 --
 configs/Hyundai_A7HD_defconfig | 2 --
 configs/Itead_Ibox_A20_defconfig   | 2 --
 configs/Lamobo_R1_defconfig| 2 --
 configs/LicheePi_Zero_defconfig| 2 --
 configs/Linksprite_pcDuino3_Nano_defconfig | 2 --
 configs/Linksprite_pcDuino3_defconfig  | 2 --
 configs/Linksprite_pcDuino_defconfig   | 2 --
 configs/MK808C_defconfig   | 2 --
 configs/MSI_Primo73_defconfig  | 2 --
 configs/MSI_Primo81_defconfig  | 2 --
 configs/Marsboard_A10_defconfig| 2 --
 configs/Mele_A1000G_quad_defconfig | 2 --
 configs/Mele_A1000_defconfig   | 2 --
 configs/Mele_I7_defconfig  | 2 --
 configs/Mele_M3_defconfig  | 2 --
 configs/Mele_M5_defconfig  | 2 --
 configs/Mele_M9_defconfig  | 2 --
 configs/Merrii_A80_Optimus_defconfig   | 2 --
 configs/Mini-X_defconfig   | 2 --
 configs/Nintendo_NES_Classic_Edition_defconfig | 2 --
 configs/Orangepi_defconfig | 2 --
 configs/Orangepi_mini_defconfig| 2 --
 configs/Sinlinx_SinA31s_defconfig  | 2 --
 configs/Sinlinx_SinA33_defconfig   | 2 --
 configs/Sinovoip_BPI_M2_defconfig  | 2 --
 configs/Sinovoip_BPI_M3_defconfig  | 2 --
 configs/Sunchip_CX-A99_defconfig   | 2 --
 configs/UTOO_P66_defconfig | 2 --
 configs/Wexler_TAB7200_defconfig   | 2 --
 configs/Wits_Pro_A20_DKT_defconfig | 2 --
 configs/Wobo_i5_defconfig  | 2 --
 configs/Yones_Toptech_BD1078_defconfig | 2 --
 configs/Yones_Toptech_BS1078_V2_defconfig  | 2 --
 configs/a64-olinuxino-emmc_defconfig   | 3 ---
 configs/a64-olinuxino_defconfig| 3 ---
 configs/amarula_a64_relic_defconfig| 3 ---
 configs/ba10_tv_box_defconfig  | 2 --
 configs/bananapi_m1_plus_defconfig | 2 --
 configs/bananapi_m2_berry_defconfig| 2 --
 configs/bananapi_m2_plus_h3_defconfig  | 2 --
 configs/bananapi_m2_plus_h5_defconfig  | 3 ---
 configs/bananapi_m2_zero_defconfig | 2 --
 configs/bananapi_m64_defconfig | 3 ---
 configs/beelink_gs1_defconfig  | 3 ---
 configs/beelink_x2_defconfig   | 2 --
 configs/colorfly_e708_q1_defconfig | 2 --
 configs/difrnce_dit4350_defconfig  | 2 --
 configs/dserve_dsrv9703c_defconfig | 2 --
 configs/emlid_neutis_n5_devboard_defconfig | 3 ---
 configs/ga10h_v1_1_defconfig 

[PATCH 0/2] sunxi: defconfig: use Kconfig defaults

2022-09-13 Thread Andre Przywara
[Resending just to the mailing list forgotten on the first post]

Some recent patches from Tom (thanks for that!) were converting some
configuration options from header files to Kconfig symbols.
For sunxi, this moved their value definition into every *board*
defconfig, although they are actual per-SoC choices.

Make this obvious by defining per-SoC default values in the Kconfig
stanza, and removing the now redundant explicit defconfig definitions.

Apart from using the opportunity to upgrading the uncompressed arm64
kernel size to 64MB, this does not change configs otherwise.

Patch 1 adds the default definitions, patch 2 removes the defconfig
definitions.

Thanks,
Andre

Andre Przywara (2):
  sunxi: Kconfig: use SoC-wide values for some symbols
  sunxi: defconfig: drop redundant definitions

 cmd/Kconfig| 1 +
 common/spl/Kconfig | 6 ++
 configs/A10-OLinuXino-Lime_defconfig   | 2 --
 configs/A10s-OLinuXino-M_defconfig | 2 --
 configs/A13-OLinuXinoM_defconfig   | 2 --
 configs/A13-OLinuXino_defconfig| 2 --
 configs/A20-OLinuXino-Lime2-eMMC_defconfig | 2 --
 configs/A20-OLinuXino-Lime2_defconfig  | 2 --
 configs/A20-OLinuXino-Lime_defconfig   | 2 --
 configs/A20-OLinuXino_MICRO-eMMC_defconfig | 2 --
 configs/A20-OLinuXino_MICRO_defconfig  | 2 --
 configs/A20-Olimex-SOM-EVB_defconfig   | 2 --
 configs/A20-Olimex-SOM204-EVB-eMMC_defconfig   | 2 --
 configs/A20-Olimex-SOM204-EVB_defconfig| 2 --
 configs/A33-OLinuXino_defconfig| 2 --
 configs/Ainol_AW1_defconfig| 2 --
 configs/Ampe_A76_defconfig | 2 --
 configs/Auxtek-T003_defconfig  | 2 --
 configs/Auxtek-T004_defconfig  | 2 --
 configs/Bananapi_M2_Ultra_defconfig| 2 --
 configs/Bananapi_defconfig | 2 --
 configs/Bananapi_m2m_defconfig | 2 --
 configs/Bananapro_defconfig| 2 --
 configs/CHIP_defconfig | 2 --
 configs/CHIP_pro_defconfig | 2 --
 configs/CSQ_CS908_defconfig| 2 --
 configs/Chuwi_V7_CW0825_defconfig  | 2 --
 configs/Colombus_defconfig | 2 --
 configs/Cubieboard2_defconfig  | 2 --
 configs/Cubieboard4_defconfig  | 2 --
 configs/Cubieboard_defconfig   | 2 --
 configs/Cubietruck_defconfig   | 2 --
 configs/Cubietruck_plus_defconfig  | 2 --
 configs/Empire_electronix_d709_defconfig   | 2 --
 configs/Empire_electronix_m712_defconfig   | 2 --
 configs/Hummingbird_A31_defconfig  | 2 --
 configs/Hyundai_A7HD_defconfig | 2 --
 configs/Itead_Ibox_A20_defconfig   | 2 --
 configs/Lamobo_R1_defconfig| 2 --
 configs/LicheePi_Zero_defconfig| 2 --
 configs/Linksprite_pcDuino3_Nano_defconfig | 2 --
 configs/Linksprite_pcDuino3_defconfig  | 2 --
 configs/Linksprite_pcDuino_defconfig   | 2 --
 configs/MK808C_defconfig   | 2 --
 configs/MSI_Primo73_defconfig  | 2 --
 configs/MSI_Primo81_defconfig  | 2 --
 configs/Marsboard_A10_defconfig| 2 --
 configs/Mele_A1000G_quad_defconfig | 2 --
 configs/Mele_A1000_defconfig   | 2 --
 configs/Mele_I7_defconfig  | 2 --
 configs/Mele_M3_defconfig  | 2 --
 configs/Mele_M5_defconfig  | 2 --
 configs/Mele_M9_defconfig  | 2 --
 configs/Merrii_A80_Optimus_defconfig   | 2 --
 configs/Mini-X_defconfig   | 2 --
 configs/Nintendo_NES_Classic_Edition_defconfig | 2 --
 configs/Orangepi_defconfig | 2 --
 configs/Orangepi_mini_defconfig| 2 --
 configs/Sinlinx_SinA31s_defconfig  | 2 --
 configs/Sinlinx_SinA33_defconfig   | 2 --
 configs/Sinovoip_BPI_M2_defconfig  | 2 --
 configs/Sinovoip_BPI_M3_defconfig  | 2 --
 configs/Sunchip_CX-A99_defconfig   | 2 --
 configs/UTOO_P66_defconfig | 2 --
 configs/Wexler_TAB7200_defconfig   | 2 --
 configs/Wits_Pro_A20_DKT_defconfig | 2 --
 configs/Wobo_i5_defconfig  | 2 --
 configs/Yones_Toptech_BD1078_defconfig | 2 --
 configs/Yones_Toptech_BS1078_V2_defconfig  | 2 --
 configs/a64-olinuxino-emmc_defconfig   | 3 ---
 configs/a64-olinuxino_defconfig| 3 ---
 configs/amarula_a64_relic_defconfig| 3 ---
 configs/ba10_tv_box_defconfig  | 2 --
 configs/bananapi_m1_plus_defconfig | 2 --
 configs/bananapi_m2_berry_defconfig| 2 --
 configs/bananapi_m2_plus_h3_defconfig  | 2 --
 

[PATCH 1/2] sunxi: Kconfig: use SoC-wide values for some symbols

2022-09-13 Thread Andre Przywara
Some configuration symbols formerly defined in header files were
recently converted to Kconfig symbols. This moved their value definition
into *every* defconfig file, even though those values are hardly board
choices.
Use the new Kconfig option to define per-SoC default values, in just one
place, which makes the definition in each defconfig file redundant.

We refrain from setting a sunxi specific value for CONFIG_SYS_BOOTM_LEN,
so this defaults to a much better 64MB for uncompressed arm64 kernels.

Signed-off-by: Andre Przywara 
---
 cmd/Kconfig| 1 +
 common/spl/Kconfig | 6 ++
 2 files changed, 7 insertions(+)

diff --git a/cmd/Kconfig b/cmd/Kconfig
index 0e0be94f41f..2c5f91f8446 100644
--- a/cmd/Kconfig
+++ b/cmd/Kconfig
@@ -86,6 +86,7 @@ config SYS_CBSIZE
 
 config SYS_PBSIZE
int "Buffer size for console output"
+   default 1024 if ARCH_SUNXI
default 1044
 
 config SYS_XTRACE
diff --git a/common/spl/Kconfig b/common/spl/Kconfig
index 70d97815f0a..ccf00fc7950 100644
--- a/common/spl/Kconfig
+++ b/common/spl/Kconfig
@@ -80,6 +80,7 @@ config SPL_MAX_SIZE
default 0x1 if ARCH_MX6 && !MX6_OCRAM_256KB
default 0x7fa0 if SUNXI_SRAM_ADDRESS = 0x1
default 0x7fa0 if SUNXI_SRAM_ADDRESS = 0x2 && !MACH_SUN50I_H616
+   default 0xbfa0 if MACH_SUN50I_H616
default 0x7000 if RCAR_GEN3
default 0x5fa0 if SUNXI_SRAM_ADDRESS = 0x0
default 0x1 if ASPEED_AST2600
@@ -352,6 +353,11 @@ config SPL_STACK
default 0x946bb8 if ARCH_MX7
default 0x93ffb8 if ARCH_MX6 && MX6_OCRAM_256KB
default 0x91ffb8 if ARCH_MX6 && !MX6_OCRAM_256KB
+   default 0x118000 if MACH_SUN50I_H6
+   default 0x58000 if MACH_SUN50I_H616
+   default 0x54000 if MACH_SUN50I || MACH_SUN50I_H5
+   default 0x18000 if MACH_SUN9I
+   default 0x8000 if ARCH_SUNXI
help
  Address of the start of the stack SPL will use before SDRAM is
  initialized.
-- 
2.35.3



[PATCH 2/2] sunxi: dts: arm: update devicetree files

2022-09-13 Thread Andre Przywara
Update the devicetree files from the Linux kernel, version v6.0-rc4.
This is covering the 32-bit SoCs, from arch/arm/boot/dts/.

This avoids the not backwards-compatible r_intc binding change, to allow
older kernels to boot, but the other nodes are updated.

Not much change here, the vast majority is actually cosmetic: node names
and using symbolic names for the the RTC clocks.
The R40 boards gain DVFS support.
Some A23/A33 tablet DTs are unified into a single file.

Signed-off-by: Andre Przywara 
---
 arch/arm/dts/sun4i-a10-inet9f-rev03.dts   | 40 +-
 arch/arm/dts/sun4i-a10-pcduino.dts|  6 +-
 arch/arm/dts/sun5i-a13-licheepi-one.dts   |  6 +-
 arch/arm/dts/sun6i-a31.dtsi   | 13 ++--
 arch/arm/dts/sun7i-a20-pcduino3.dts   |  6 +-
 arch/arm/dts/sun8i-a23-a33.dtsi   |  9 ++-
 arch/arm/dts/sun8i-a23-ippo-q8h-v1.2.dts  | 74 +--
 arch/arm/dts/sun8i-a23-ippo-q8h-v5.dts| 74 +--
 arch/arm/dts/sun8i-a33-et-q8-v1.6.dts | 58 +--
 arch/arm/dts/sun8i-a33-ippo-q8h-v1.2.dts  | 58 +--
 .../dts/sun8i-h2-plus-bananapi-m2-zero.dts|  8 +-
 arch/arm/dts/sun8i-h2-plus-orangepi-zero.dts  |  2 +-
 arch/arm/dts/sun8i-h3-beelink-x2.dts  |  6 +-
 arch/arm/dts/sun8i-h3-mapleboard-mp130.dts|  6 +-
 arch/arm/dts/sun8i-h3-nanopi-duo2.dts |  8 +-
 arch/arm/dts/sun8i-h3-nanopi-neo-air.dts  |  2 +-
 arch/arm/dts/sun8i-h3-nanopi-r1.dts   |  4 +-
 arch/arm/dts/sun8i-h3-nanopi.dtsi |  5 +-
 arch/arm/dts/sun8i-h3-orangepi-2.dts  |  6 +-
 arch/arm/dts/sun8i-h3-orangepi-lite.dts   |  4 +-
 arch/arm/dts/sun8i-h3-orangepi-one.dts|  4 +-
 arch/arm/dts/sun8i-h3-orangepi-pc.dts |  4 +-
 arch/arm/dts/sun8i-r16-bananapi-m2m.dts   |  4 +-
 arch/arm/dts/sun8i-r40-bananapi-m2-ultra.dts  |  5 ++
 arch/arm/dts/sun8i-r40-cpu-opp.dtsi   | 52 +
 arch/arm/dts/sun8i-r40-feta40i.dtsi   |  5 ++
 arch/arm/dts/sun8i-r40.dtsi   | 44 ++-
 arch/arm/dts/sun8i-t3-cqa3t-bv3.dts   |  5 ++
 arch/arm/dts/sun8i-v3s.dtsi   |  6 +-
 arch/arm/dts/sun8i-v40-bananapi-m2-berry.dts  |  5 ++
 arch/arm/dts/sun9i-a80.dtsi   |  1 -
 arch/arm/dts/sunxi-bananapi-m2-plus.dtsi  |  8 +-
 arch/arm/dts/sunxi-h3-h5-emlid-neutis.dtsi|  4 +-
 arch/arm/dts/sunxi-h3-h5.dtsi | 13 ++--
 arch/arm/dts/sunxi-libretech-all-h3-cc.dtsi   |  4 +-
 35 files changed, 209 insertions(+), 350 deletions(-)
 mode change 100644 => 12 arch/arm/dts/sun8i-a23-ippo-q8h-v1.2.dts
 mode change 100644 => 12 arch/arm/dts/sun8i-a23-ippo-q8h-v5.dts
 mode change 100644 => 12 arch/arm/dts/sun8i-a33-et-q8-v1.6.dts
 mode change 100644 => 12 arch/arm/dts/sun8i-a33-ippo-q8h-v1.2.dts
 create mode 100644 arch/arm/dts/sun8i-r40-cpu-opp.dtsi

diff --git a/arch/arm/dts/sun4i-a10-inet9f-rev03.dts 
b/arch/arm/dts/sun4i-a10-inet9f-rev03.dts
index 0a562b2cc5b..62e7aa587f8 100644
--- a/arch/arm/dts/sun4i-a10-inet9f-rev03.dts
+++ b/arch/arm/dts/sun4i-a10-inet9f-rev03.dts
@@ -63,7 +63,7 @@
compatible = "gpio-keys-polled";
poll-interval = <20>;
 
-   left-joystick-left {
+   event-left-joystick-left {
label = "Left Joystick Left";
linux,code = ;
linux,input-type = ;
@@ -71,7 +71,7 @@
gpios = < 0 6 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>; /* 
PA6 */
};
 
-   left-joystick-right {
+   event-left-joystick-right {
label = "Left Joystick Right";
linux,code = ;
linux,input-type = ;
@@ -79,7 +79,7 @@
gpios = < 0 5 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>; /* 
PA5 */
};
 
-   left-joystick-up {
+   event-left-joystick-up {
label = "Left Joystick Up";
linux,code = ;
linux,input-type = ;
@@ -87,7 +87,7 @@
gpios = < 0 8 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>; /* 
PA8 */
};
 
-   left-joystick-down {
+   event-left-joystick-down {
label = "Left Joystick Down";
linux,code = ;
linux,input-type = ;
@@ -95,7 +95,7 @@
gpios = < 0 9 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>; /* 
PA9 */
};
 
-   right-joystick-left {
+   event-right-joystick-left {
label = "Right Joystick Left";
linux,code = ;
linux,input-type = ;
@@ -103,7 +103,7 @@
gpios = < 0 1 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>; /* 
PA1 */
};
 
-   right-joystick-right {
+

[PATCH 1/2] sunxi: dts: arm64: update devicetree files

2022-09-13 Thread Andre Przywara
Update the devicetree files from the Linux kernel, version v6.0-rc4.
This is covering the 64-bit SoCs, from arch/arm64/boot/dts/allwinner.

This avoids the not backwards-compatible r_intc binding change, to allow
older kernels to boot, but the other nodes are updated.

Not much change here, the vast majority is actually cosmetic: node names
and using symbolic names for the the RTC clocks.
Some A64 boards gain some audio nodes.
The H616 DTs are now switched to the version finally merged into the
kernel, which brings some changes, but none affecting U-Boot.

Signed-off-by: Andre Przywara 
---
 arch/arm/dts/Makefile   |   3 +-
 arch/arm/dts/sun50i-a64-amarula-relic.dts   |   2 +-
 arch/arm/dts/sun50i-a64-bananapi-m64.dts|   4 +-
 arch/arm/dts/sun50i-a64-nanopi-a64.dts  |   2 +-
 arch/arm/dts/sun50i-a64-olinuxino.dts   |  30 ++
 arch/arm/dts/sun50i-a64-orangepi-win.dts|   6 +-
 arch/arm/dts/sun50i-a64-pinebook.dts|   4 +-
 arch/arm/dts/sun50i-a64-pinephone-1.0.dts   |   4 +
 arch/arm/dts/sun50i-a64-pinephone-1.1.dts   |   4 +
 arch/arm/dts/sun50i-a64-teres-i.dts |   8 +
 arch/arm/dts/sun50i-a64.dtsi|  10 +-
 arch/arm/dts/sun50i-h5-nanopi-r1s-h5.dts|   4 +-
 arch/arm/dts/sun50i-h5-orangepi-pc2.dts |   4 +-
 arch/arm/dts/sun50i-h5-orangepi-prime.dts   |   4 +-
 arch/arm/dts/sun50i-h6-orangepi-3.dts   |   4 +-
 arch/arm/dts/sun50i-h6-orangepi-lite2.dts   |   4 +-
 arch/arm/dts/sun50i-h6-tanix.dtsi   |   2 +-
 arch/arm/dts/sun50i-h6.dtsi |  12 +-
 arch/arm/dts/sun50i-h616-orangepi-zero2.dts |  55 +---
 arch/arm/dts/sun50i-h616-x96-mate.dts   | 177 
 arch/arm/dts/sun50i-h616.dtsi   | 286 +---
 include/dt-bindings/clock/sun50i-h6-r-ccu.h |   1 +
 include/dt-bindings/clock/sun50i-h616-ccu.h |   1 +
 include/dt-bindings/clock/sun6i-rtc.h   |  10 +
 24 files changed, 353 insertions(+), 288 deletions(-)
 create mode 100644 arch/arm/dts/sun50i-h616-x96-mate.dts
 create mode 100644 include/dt-bindings/clock/sun6i-rtc.h

diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile
index 7330121dbab..a56bbd682a1 100644
--- a/arch/arm/dts/Makefile
+++ b/arch/arm/dts/Makefile
@@ -709,7 +709,8 @@ dtb-$(CONFIG_MACH_SUN50I_H6) += \
sun50i-h6-tanix-tx6.dtb \
sun50i-h6-tanix-tx6-mini.dtb
 dtb-$(CONFIG_MACH_SUN50I_H616) += \
-   sun50i-h616-orangepi-zero2.dtb
+   sun50i-h616-orangepi-zero2.dtb \
+   sun50i-h616-x96-mate.dtb
 dtb-$(CONFIG_MACH_SUN50I) += \
sun50i-a64-amarula-relic.dtb \
sun50i-a64-bananapi-m64.dtb \
diff --git a/arch/arm/dts/sun50i-a64-amarula-relic.dts 
b/arch/arm/dts/sun50i-a64-amarula-relic.dts
index c7bd73f35ed..ce8f6aa164e 100644
--- a/arch/arm/dts/sun50i-a64-amarula-relic.dts
+++ b/arch/arm/dts/sun50i-a64-amarula-relic.dts
@@ -58,7 +58,7 @@
 
wifi_pwrseq: wifi-pwrseq {
compatible = "mmc-pwrseq-simple";
-   clocks = < 1>;
+   clocks = < CLK_OSC32K_FANOUT>;
clock-names = "ext_clock";
reset-gpios = <_pio 0 2 GPIO_ACTIVE_LOW>; /* WL-PMU-EN: PL2 */
};
diff --git a/arch/arm/dts/sun50i-a64-bananapi-m64.dts 
b/arch/arm/dts/sun50i-a64-bananapi-m64.dts
index f7fe9fa50cb..bf66b640816 100644
--- a/arch/arm/dts/sun50i-a64-bananapi-m64.dts
+++ b/arch/arm/dts/sun50i-a64-bananapi-m64.dts
@@ -56,7 +56,7 @@
wifi_pwrseq: wifi_pwrseq {
compatible = "mmc-pwrseq-simple";
reset-gpios = <_pio 0 2 GPIO_ACTIVE_LOW>; /* PL2 */
-   clocks = < 1>;
+   clocks = < CLK_OSC32K_FANOUT>;
clock-names = "ext_clock";
};
 };
@@ -355,7 +355,7 @@
 
bluetooth {
compatible = "brcm,bcm43438-bt";
-   clocks = < 1>;
+   clocks = < CLK_OSC32K_FANOUT>;
clock-names = "lpo";
vbat-supply = <_dldo2>;
vddio-supply = <_dldo4>;
diff --git a/arch/arm/dts/sun50i-a64-nanopi-a64.dts 
b/arch/arm/dts/sun50i-a64-nanopi-a64.dts
index 09b3c7fb82c..ffc3b4c7068 100644
--- a/arch/arm/dts/sun50i-a64-nanopi-a64.dts
+++ b/arch/arm/dts/sun50i-a64-nanopi-a64.dts
@@ -43,7 +43,7 @@
 
wifi_pwrseq: wifi_pwrseq {
compatible = "mmc-pwrseq-simple";
-   clocks = < 1>;
+   clocks = < CLK_OSC32K_FANOUT>;
clock-names = "ext_clock";
reset-gpios = <_pio 0 2 GPIO_ACTIVE_LOW>; /* PL2 */
};
diff --git a/arch/arm/dts/sun50i-a64-olinuxino.dts 
b/arch/arm/dts/sun50i-a64-olinuxino.dts
index f3f8e177ab6..22d350249c1 100644
--- a/arch/arm/dts/sun50i-a64-olinuxino.dts
+++ b/arch/arm/dts/sun50i-a64-olinuxino.dts
@@ -58,6 +58,15 @@
};
 };
 
+ {
+   status = "okay";
+};
+
+_analog {
+   cpvdd-supply = <_eldo1>;
+   status = "okay";
+};
+
  {
cpu-supply = <_dcdc2>;
 };
@@ -74,6 +83,10 @@
cpu-supply = <_dcdc2>;
 };
 
+ {
+   

[PATCH 0/2] sunxi: update devicetree files from the kernel

2022-09-13 Thread Andre Przywara
This syncs the .dts and .dtsi files from the Linux kernel repository
as of v6.0-rc4 into U-Boot. As before, we skip the r_intc change, as
this breaks older kernels.
The first patch handles the 64-bit parts, the second one the 32-bit
SoCs.

Thanks,
Andre

Andre Przywara (2):
  sunxi: dts: arm64: update devicetree files
  sunxi: dts: arm: update devicetree files

 arch/arm/dts/Makefile |   3 +-
 arch/arm/dts/sun4i-a10-inet9f-rev03.dts   |  40 +--
 arch/arm/dts/sun4i-a10-pcduino.dts|   6 +-
 arch/arm/dts/sun50i-a64-amarula-relic.dts |   2 +-
 arch/arm/dts/sun50i-a64-bananapi-m64.dts  |   4 +-
 arch/arm/dts/sun50i-a64-nanopi-a64.dts|   2 +-
 arch/arm/dts/sun50i-a64-olinuxino.dts |  30 ++
 arch/arm/dts/sun50i-a64-orangepi-win.dts  |   6 +-
 arch/arm/dts/sun50i-a64-pinebook.dts  |   4 +-
 arch/arm/dts/sun50i-a64-pinephone-1.0.dts |   4 +
 arch/arm/dts/sun50i-a64-pinephone-1.1.dts |   4 +
 arch/arm/dts/sun50i-a64-teres-i.dts   |   8 +
 arch/arm/dts/sun50i-a64.dtsi  |  10 +-
 arch/arm/dts/sun50i-h5-nanopi-r1s-h5.dts  |   4 +-
 arch/arm/dts/sun50i-h5-orangepi-pc2.dts   |   4 +-
 arch/arm/dts/sun50i-h5-orangepi-prime.dts |   4 +-
 arch/arm/dts/sun50i-h6-orangepi-3.dts |   4 +-
 arch/arm/dts/sun50i-h6-orangepi-lite2.dts |   4 +-
 arch/arm/dts/sun50i-h6-tanix.dtsi |   2 +-
 arch/arm/dts/sun50i-h6.dtsi   |  12 +-
 arch/arm/dts/sun50i-h616-orangepi-zero2.dts   |  55 +---
 arch/arm/dts/sun50i-h616-x96-mate.dts | 177 +++
 arch/arm/dts/sun50i-h616.dtsi | 286 +-
 arch/arm/dts/sun5i-a13-licheepi-one.dts   |   6 +-
 arch/arm/dts/sun6i-a31.dtsi   |  13 +-
 arch/arm/dts/sun7i-a20-pcduino3.dts   |   6 +-
 arch/arm/dts/sun8i-a23-a33.dtsi   |   9 +-
 arch/arm/dts/sun8i-a23-ippo-q8h-v1.2.dts  |  74 +
 arch/arm/dts/sun8i-a23-ippo-q8h-v5.dts|  74 +
 arch/arm/dts/sun8i-a33-et-q8-v1.6.dts |  58 +---
 arch/arm/dts/sun8i-a33-ippo-q8h-v1.2.dts  |  58 +---
 .../dts/sun8i-h2-plus-bananapi-m2-zero.dts|   8 +-
 arch/arm/dts/sun8i-h2-plus-orangepi-zero.dts  |   2 +-
 arch/arm/dts/sun8i-h3-beelink-x2.dts  |   6 +-
 arch/arm/dts/sun8i-h3-mapleboard-mp130.dts|   6 +-
 arch/arm/dts/sun8i-h3-nanopi-duo2.dts |   8 +-
 arch/arm/dts/sun8i-h3-nanopi-neo-air.dts  |   2 +-
 arch/arm/dts/sun8i-h3-nanopi-r1.dts   |   4 +-
 arch/arm/dts/sun8i-h3-nanopi.dtsi |   5 +-
 arch/arm/dts/sun8i-h3-orangepi-2.dts  |   6 +-
 arch/arm/dts/sun8i-h3-orangepi-lite.dts   |   4 +-
 arch/arm/dts/sun8i-h3-orangepi-one.dts|   4 +-
 arch/arm/dts/sun8i-h3-orangepi-pc.dts |   4 +-
 arch/arm/dts/sun8i-r16-bananapi-m2m.dts   |   4 +-
 arch/arm/dts/sun8i-r40-bananapi-m2-ultra.dts  |   5 +
 arch/arm/dts/sun8i-r40-cpu-opp.dtsi   |  52 
 arch/arm/dts/sun8i-r40-feta40i.dtsi   |   5 +
 arch/arm/dts/sun8i-r40.dtsi   |  44 ++-
 arch/arm/dts/sun8i-t3-cqa3t-bv3.dts   |   5 +
 arch/arm/dts/sun8i-v3s.dtsi   |   6 +-
 arch/arm/dts/sun8i-v40-bananapi-m2-berry.dts  |   5 +
 arch/arm/dts/sun9i-a80.dtsi   |   1 -
 arch/arm/dts/sunxi-bananapi-m2-plus.dtsi  |   8 +-
 arch/arm/dts/sunxi-h3-h5-emlid-neutis.dtsi|   4 +-
 arch/arm/dts/sunxi-h3-h5.dtsi |  13 +-
 arch/arm/dts/sunxi-libretech-all-h3-cc.dtsi   |   4 +-
 include/dt-bindings/clock/sun50i-h6-r-ccu.h   |   1 +
 include/dt-bindings/clock/sun50i-h616-ccu.h   |   1 +
 include/dt-bindings/clock/sun6i-rtc.h |  10 +
 59 files changed, 562 insertions(+), 638 deletions(-)
 create mode 100644 arch/arm/dts/sun50i-h616-x96-mate.dts
 mode change 100644 => 12 arch/arm/dts/sun8i-a23-ippo-q8h-v1.2.dts
 mode change 100644 => 12 arch/arm/dts/sun8i-a23-ippo-q8h-v5.dts
 mode change 100644 => 12 arch/arm/dts/sun8i-a33-et-q8-v1.6.dts
 mode change 100644 => 12 arch/arm/dts/sun8i-a33-ippo-q8h-v1.2.dts
 create mode 100644 arch/arm/dts/sun8i-r40-cpu-opp.dtsi
 create mode 100644 include/dt-bindings/clock/sun6i-rtc.h

-- 
2.35.3



Re: [v5 00/14] Add ASPEED SPI controller driver

2022-09-13 Thread Tom Rini
On Fri, 19 Aug 2022 17:01:01 +0800, Chin-Ting Kuo wrote:

> This patch series aims to porting ASPEED FMC/SPI memory controller
> driver with spi-mem interface. spi-mem dirmap framework is also
> synchronized from Linux. These patches have been verified on
> AST2600, AST2500 and AST2400 EVBs.
> 
> Changes in v2:
>   - Separate defconfig files from the SPI driver patch.
>   - Use "if (CONFIG_IS_ENABLED(SPI_DIRMAP))" to wrap
> spi_dirmap related functions.
>   - Add Winbond w25q512jv flash ID.
> 
> [...]

For the series, applied to u-boot/next, thanks!

-- 
Tom



Ftdoverlays documentation

2022-09-13 Thread Edoardo Tomelleri
Hello,
I can not find u-boot documentation for the fdtoverlays option in
extlinux.conf files, here:
https://u-boot.readthedocs.io/en/latest/develop/distro.html?highlight=extlinux#enabling-the-distro-options
(is it supported? I've found that in January 2021 a related patch was accepted)
The docs refer to the boot loader spec
(https://systemd.io/BOOT_LOADER_SPECIFICATION/), where keys devicetree
and devicetree-overlay are supported.
Right now, I understand that u-boot supports keywords both 'fdt' and
'devicetree' with the same meaning, and 'fdtoverlays', but not
'devicetree-overlay', is this correct?
Thanks,
Edoardo


[PATCH] arm: dts: socfpga: Add dts support for NAND Arria 10 SoCDK

2022-09-13 Thread teik . heng . chong
From: Tien Fong Chee 

Enable dtb build for NAND Arria 10 SoCDK.

Signed-off-by: Tien Fong Chee 
Signed-off-by: Teik Heng Chong 
---
 arch/arm/dts/Makefile |   1 +
 arch/arm/dts/socfpga_arria10_socdk_nand.dts   |  56 ++
 .../socfpga_arria10_socdk_nand_handoff.dtsi   | 522 ++
 3 files changed, 579 insertions(+)
 create mode 100644 arch/arm/dts/socfpga_arria10_socdk_nand.dts
 create mode 100644 arch/arm/dts/socfpga_arria10_socdk_nand_handoff.dtsi

diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile
index 2534b1c9ad..6bd7732796 100644
--- a/arch/arm/dts/Makefile
+++ b/arch/arm/dts/Makefile
@@ -427,6 +427,7 @@ dtb-$(CONFIG_ARCH_SOCFPGA) +=   
\
socfpga_arria5_socdk.dtb\
socfpga_arria10_chameleonv3_270_3.dtb   \
socfpga_arria10_chameleonv3_480_2.dtb   \
+   socfpga_arria10_socdk_nand.dtb  \
socfpga_arria10_socdk_qspi.dtb  \
socfpga_arria10_socdk_sdmmc.dtb \
socfpga_cyclone5_mcvevk.dtb \
diff --git a/arch/arm/dts/socfpga_arria10_socdk_nand.dts 
b/arch/arm/dts/socfpga_arria10_socdk_nand.dts
new file mode 100644
index 00..0e855648da
--- /dev/null
+++ b/arch/arm/dts/socfpga_arria10_socdk_nand.dts
@@ -0,0 +1,56 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright (C) 2019 Intel Corporation
+ *
+ * These codes were based on handoffs
+ * generated from both Qsys and Quartus.
+ */
+
+/dts-v1/;
+#include "socfpga_arria10_socdk.dtsi"
+#include "socfpga_arria10_socdk-u-boot.dtsi"
+#include "socfpga_arria10_handoff_u-boot.dtsi"
+#include "socfpga_arria10_socdk_nand_handoff.dtsi"
+
+/ {
+   fs_loader0: fs-loader {
+   u-boot,dm-pre-reloc;
+   compatible = "u-boot,fs-loader";
+   };
+};
+
+_mgr {
+   u-boot,dm-pre-reloc;
+   firmware-loader = <_loader0>;
+   altr,bitstream = "30";
+};
+
+_mp_clk {
+   u-boot,dm-pre-reloc;
+};
+
+_x_clk {
+   u-boot,dm-pre-reloc;
+};
+
+_ecc_clk {
+   u-boot,dm-pre-reloc;
+};
+
+_clk {
+   u-boot,dm-pre-reloc;
+};
+
+ {
+   u-boot,dm-pre-reloc;
+   status = "okay";
+
+   partition@nand-boot {
+   label = "Boot and fpga data";
+   reg = <0x0 0x1EA>;
+   };
+   partition@nand-rootfs {
+   label = "Root Filesystem - JFFS2";
+   reg = <0x1EA 0x616>;
+   };
+};
diff --git a/arch/arm/dts/socfpga_arria10_socdk_nand_handoff.dtsi 
b/arch/arm/dts/socfpga_arria10_socdk_nand_handoff.dtsi
new file mode 100644
index 00..34a57a2b95
--- /dev/null
+++ b/arch/arm/dts/socfpga_arria10_socdk_nand_handoff.dtsi
@@ -0,0 +1,522 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright (C) 2019 Intel Corporation
+ *
+ * These codes were based on handoffs
+ * generated from both Qsys and Quartus.
+ */
+
+/ {
+   #address-cells = <1>;
+   #size-cells = <1>;
+   model = "SOCFPGA Arria10 Dev Kit"; /* Bootloader setting: uboot.model */
+
+   /* Clock sources */
+   clocks {
+   u-boot,dm-pre-reloc;
+   #address-cells = <1>;
+   #size-cells = <1>;
+
+   /* Clock source: altera_arria10_hps_eosc1 */
+   altera_arria10_hps_eosc1: altera_arria10_hps_eosc1 {
+   compatible = "fixed-clock";
+   #clock-cells = <0>;
+   clock-frequency = <2500>;
+   clock-output-names = "altera_arria10_hps_eosc1-clk";
+   };
+
+   /* Clock source: altera_arria10_hps_cb_intosc_ls */
+   altera_arria10_hps_cb_intosc_ls:
+   altera_arria10_hps_cb_intosc_ls {
+   compatible = "fixed-clock";
+   #clock-cells = <0>;
+   clock-frequency = <6000>;
+   clock-output-names =
+   "altera_arria10_hps_cb_intosc_ls-clk";
+   };
+
+   /* Clock source: altera_arria10_hps_f2h_free */
+   altera_arria10_hps_f2h_free: altera_arria10_hps_f2h_free {
+   compatible = "fixed-clock";
+   #clock-cells = <0>;
+   clock-frequency = <2>;
+   clock-output-names = "altera_arria10_hps_f2h_free-clk";
+   };
+   };
+
+   /*
+* Driver: altera_arria10_soc_clock_manager_arria10_uboot_driver
+* Version: 1.0
+* Binding: device
+*/
+   i_clk_mgr: clock_manager@0xffd04000 {
+   compatible = "altr,socfpga-a10-clk-init";
+   reg = <0xffd04000 0x0200>;
+   reg-names = "soc_clock_manager_OCP_SLV";
+
+   /*
+* Address Block: 

[PATCH v2 4/4] common/board_f: drop ifdefs around header includes

2022-09-13 Thread Ovidiu Panait
Drop the remaining ifdef around spl.h include.

Reviewed-by: Simon Glass 
Signed-off-by: Ovidiu Panait 
---

Changes in v2:
- add "Reviewed-by" tag from Simon

 common/board_f.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/common/board_f.c b/common/board_f.c
index 96458c5151..4db1626c29 100644
--- a/common/board_f.c
+++ b/common/board_f.c
@@ -35,9 +35,7 @@
 #include 
 #include 
 #include 
-#ifdef CONFIG_SPL
 #include 
-#endif
 #include 
 #include 
 #include 
-- 
2.25.1



[PATCH v2 3/4] common/board_f: introduce arch_setup_dest_addr()

2022-09-13 Thread Ovidiu Panait
In order to move ppc-specific code out of setup_dest_addr(), provide an
arch-specific variant arch_setup_dest_addr(), that can be used by
architecture code to fix up the initial reloc address.

It is called at the end of setup_dest_addr() initcall and the default
implementation is a nop stub.

Reviewed-by: Simon Glass 
Signed-off-by: Ovidiu Panait 
---

Changes in v2:
- add "Reviewed-by" tag from Simon

 arch/powerpc/lib/stack.c | 17 +
 common/board_f.c | 21 +++--
 include/init.h   | 13 +
 3 files changed, 37 insertions(+), 14 deletions(-)

diff --git a/arch/powerpc/lib/stack.c b/arch/powerpc/lib/stack.c
index f2a4652e08..2e731aa870 100644
--- a/arch/powerpc/lib/stack.c
+++ b/arch/powerpc/lib/stack.c
@@ -13,6 +13,7 @@
 #include 
 #include 
 #include 
+#include 
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -30,3 +31,19 @@ int arch_reserve_stacks(void)
 
return 0;
 }
+
+int arch_setup_dest_addr(void)
+{
+#if defined(CONFIG_MP) && (defined(CONFIG_MPC86xx) || defined(CONFIG_E500))
+   /*
+* We need to make sure the location we intend to put secondary core
+* boot code is reserved and not used by any part of u-boot
+*/
+   if (gd->relocaddr > determine_mp_bootpg(NULL)) {
+   gd->relocaddr = determine_mp_bootpg(NULL);
+   debug("Reserving MP boot page to %08lx\n", gd->relocaddr);
+   }
+#endif
+
+   return 0;
+}
diff --git a/common/board_f.c b/common/board_f.c
index 3789708a30..96458c5151 100644
--- a/common/board_f.c
+++ b/common/board_f.c
@@ -45,9 +45,6 @@
 #include 
 #include 
 #include 
-#if defined(CONFIG_MP) && defined(CONFIG_PPC)
-#include 
-#endif
 #include 
 #include 
 #include 
@@ -307,6 +304,11 @@ __weak ulong board_get_usable_ram_top(ulong total_size)
return gd->ram_top;
 }
 
+__weak int arch_setup_dest_addr(void)
+{
+   return 0;
+}
+
 static int setup_dest_addr(void)
 {
debug("Monitor len: %08lX\n", gd->mon_len);
@@ -334,17 +336,8 @@ static int setup_dest_addr(void)
gd->ram_top = board_get_usable_ram_top(gd->mon_len);
gd->relocaddr = gd->ram_top;
debug("Ram top: %08lX\n", (ulong)gd->ram_top);
-#if defined(CONFIG_MP) && (defined(CONFIG_MPC86xx) || defined(CONFIG_E500))
-   /*
-* We need to make sure the location we intend to put secondary core
-* boot code is reserved and not used by any part of u-boot
-*/
-   if (gd->relocaddr > determine_mp_bootpg(NULL)) {
-   gd->relocaddr = determine_mp_bootpg(NULL);
-   debug("Reserving MP boot page to %08lx\n", gd->relocaddr);
-   }
-#endif
-   return 0;
+
+   return arch_setup_dest_addr();
 }
 
 #ifdef CONFIG_PRAM
diff --git a/include/init.h b/include/init.h
index 7b8f62c121..448da34b46 100644
--- a/include/init.h
+++ b/include/init.h
@@ -103,6 +103,19 @@ phys_size_t get_effective_memsize(void);
 
 int testdram(void);
 
+/**
+ * arch_setup_dest_addr() - Fix up initial reloc address
+ *
+ * This is called in generic board init sequence in common/board_f.c at the end
+ * of the setup_dest_addr() initcall. Each architecture could provide this
+ * function to make adjustments to the initial reloc address.
+ *
+ * If an implementation is not provided, it will just be a nop stub.
+ *
+ * Return: 0 if OK
+ */
+int arch_setup_dest_addr(void);
+
 /**
  * arch_reserve_stacks() - Reserve all necessary stacks
  *
-- 
2.25.1



[PATCH v2 2/4] common/board_f: move CONFIG_MACH_TYPE logic to arch/arm/lib/bdinfo.c

2022-09-13 Thread Ovidiu Panait
asm/mach_type.h header and CONFIG_MACH_TYPE macro are arm-specific, so move
related bdinfo logic to arch_setup_bdinfo() in arch/arm/lib/bdinfo.c.

Reviewed-by: Simon Glass 
Signed-off-by: Ovidiu Panait 
---

Changes in v2:
- add "Reviewed-by" tag from Simon

 arch/arm/lib/bdinfo.c | 12 
 common/board_f.c  |  7 ---
 2 files changed, 12 insertions(+), 7 deletions(-)

diff --git a/arch/arm/lib/bdinfo.c b/arch/arm/lib/bdinfo.c
index b22ee07b85..826e09e72c 100644
--- a/arch/arm/lib/bdinfo.c
+++ b/arch/arm/lib/bdinfo.c
@@ -9,9 +9,21 @@
 #include 
 #include 
 #include 
+#include 
 
 DECLARE_GLOBAL_DATA_PTR;
 
+int arch_setup_bdinfo(void)
+{
+#ifdef CONFIG_MACH_TYPE
+   struct bd_info *bd = gd->bd;
+
+   bd->bi_arch_number = CONFIG_MACH_TYPE; /* board id for Linux */
+#endif
+
+   return 0;
+}
+
 void arch_print_bdinfo(void)
 {
struct bd_info *bd = gd->bd;
diff --git a/common/board_f.c b/common/board_f.c
index f4238d4c90..3789708a30 100644
--- a/common/board_f.c
+++ b/common/board_f.c
@@ -45,9 +45,6 @@
 #include 
 #include 
 #include 
-#ifdef CONFIG_MACH_TYPE
-#include 
-#endif
 #if defined(CONFIG_MP) && defined(CONFIG_PPC)
 #include 
 #endif
@@ -588,10 +585,6 @@ int setup_bdinfo(void)
bd->bi_sramsize = CONFIG_SYS_SRAM_SIZE;  /* size  of SRAM */
}
 
-#ifdef CONFIG_MACH_TYPE
-   bd->bi_arch_number = CONFIG_MACH_TYPE; /* board id for Linux */
-#endif
-
return arch_setup_bdinfo();
 }
 
-- 
2.25.1



[PATCH v2 1/4] common/board_f: remove XTRN_DECLARE_GLOBAL_DATA_PTR dead code

2022-09-13 Thread Ovidiu Panait
The XTRN_DECLARE_GLOBAL_DATA_PTR declarations in ppc code are permanently
commented out, so there are no users for this macro:
 #if 1
   #define DECLARE_GLOBAL_DATA_PTR   register volatile gd_t *gd asm ("r2")
 #else /* We could use plain global data, but the resulting code is bigger */
   #define XTRN_DECLARE_GLOBAL_DATA_PTR   extern
   #define DECLARE_GLOBAL_DATA_PTR XTRN_DECLARE_GLOBAL_DATA_PTR \
   gd_t *gd
 #endif

Remove all references to this macro, but add a documentation note regarding
the possibility of using plain global data for the GD pointer.

Signed-off-by: Ovidiu Panait 
---

Changes in v2:
- update global data documentation with the info provided by Wolfgang

 arch/powerpc/include/asm/global_data.h |  6 --
 common/board_f.c   | 11 ---
 doc/develop/global_data.rst|  5 +
 3 files changed, 5 insertions(+), 17 deletions(-)

diff --git a/arch/powerpc/include/asm/global_data.h 
b/arch/powerpc/include/asm/global_data.h
index 6709e692e6..6ed21c781f 100644
--- a/arch/powerpc/include/asm/global_data.h
+++ b/arch/powerpc/include/asm/global_data.h
@@ -92,12 +92,6 @@ struct arch_global_data {
 
 #include 
 
-#if 1
 #define DECLARE_GLOBAL_DATA_PTR register volatile gd_t *gd asm ("r2")
-#else /* We could use plain global data, but the resulting code is bigger */
-#define XTRN_DECLARE_GLOBAL_DATA_PTR   extern
-#define DECLARE_GLOBAL_DATA_PTR XTRN_DECLARE_GLOBAL_DATA_PTR \
-   gd_t *gd
-#endif
 
 #endif /* __ASM_GBL_DATA_H */
diff --git a/common/board_f.c b/common/board_f.c
index 18e2246733..f4238d4c90 100644
--- a/common/board_f.c
+++ b/common/board_f.c
@@ -57,18 +57,7 @@
 #include 
 #include 
 
-/*
- * Pointer to initial global data area
- *
- * Here we initialize it if needed.
- */
-#ifdef XTRN_DECLARE_GLOBAL_DATA_PTR
-#undef XTRN_DECLARE_GLOBAL_DATA_PTR
-#define XTRN_DECLARE_GLOBAL_DATA_PTR   /* empty = allocate here */
-DECLARE_GLOBAL_DATA_PTR = (gd_t *)(CONFIG_SYS_INIT_GD_ADDR);
-#else
 DECLARE_GLOBAL_DATA_PTR;
-#endif
 
 /*
  * TODO(s...@chromium.org): IMO this code should be
diff --git a/doc/develop/global_data.rst b/doc/develop/global_data.rst
index 2ac893de49..d143f27eed 100644
--- a/doc/develop/global_data.rst
+++ b/doc/develop/global_data.rst
@@ -36,6 +36,11 @@ On most architectures the global data pointer is stored in a 
register.
 
 The sandbox, x86_64, and Xtensa are notable exceptions.
 
+Current implementation uses a register for the GD pointer because this results
+in smaller code. However, using plain global data for the GD pointer would be
+possible too (and simpler, as it does not require the reservation of a specific
+register for it), but the resulting code is bigger.
+
 Clang for ARM does not support assigning a global register. When using Clang
 gd is defined as an inline function using assembly code. This adds a few bytes
 to the code size.
-- 
2.25.1



Re: [PATCH] dt-bindings: nvmem: u-boot,env: add basic NVMEM cells

2022-09-13 Thread Rob Herring
On Sun, 03 Jul 2022 10:48:43 +0200, Rafał Miłecki wrote:
> From: Rafał Miłecki 
> 
> U-Boot doesn't have cells at hardcoded addresses. They are stored in
> internal format. It's still important to define relevant cells in DT so
> NVMEM consumers can reference them.
> 
> Update binding to allow including basic cells as NVMEM device subnodes.
> 
> Signed-off-by: Rafał Miłecki 
> ---
>  .../devicetree/bindings/nvmem/u-boot,env.yaml   | 13 +
>  1 file changed, 13 insertions(+)
> 

Sorry, I guess I was thinking this depended on or interacted with one of 
the other nvmem series.

Applied, thanks!

Rob


Re: [PATCH] imx8m*_venice_defconfig: fix default bootcmd

2022-09-13 Thread Tim Harvey
On Thu, Sep 8, 2022 at 9:11 AM Tim Harvey  wrote:
>
> commit 970bf8603b87 ("Convert CONFIG_USE_BOOTCOMMAND et al to Kconfig")
> had an unintended side effect of resulting in a bootcmd env var change
> for boards like venice that did not have CONFIG_USE_BOOTCOMMAND defined
> and relied on it being defaulted in include/config_distro_bootcmd.h.
> Following that patch it instead got defaulted in tools/env/fw_env_private.h
>
> Fix this by enabling CONFIG_USE_BOOTCOMMAND for venice.
>
> Fixes: commit 970bf8603b87 ("Convert CONFIG_USE_BOOTCOMMAND et al to Kconfig")
> Signed-off-by: Tim Harvey 
> ---
>  configs/imx8mm_venice_defconfig | 1 -
>  configs/imx8mn_venice_defconfig | 1 -
>  configs/imx8mp_venice_defconfig | 1 -
>  3 files changed, 3 deletions(-)
>
> diff --git a/configs/imx8mm_venice_defconfig b/configs/imx8mm_venice_defconfig
> index a2bd27ab5729..a72b9033d8a9 100644
> --- a/configs/imx8mm_venice_defconfig
> +++ b/configs/imx8mm_venice_defconfig
> @@ -28,7 +28,6 @@ CONFIG_SPL_LOAD_FIT=y
>  # CONFIG_USE_SPL_FIT_GENERATOR is not set
>  CONFIG_OF_BOARD_SETUP=y
>  CONFIG_OF_SYSTEM_SETUP=y
> -# CONFIG_USE_BOOTCOMMAND is not set
>  CONFIG_USE_PREBOOT=y
>  CONFIG_PREBOOT="gsc wd-disable"
>  CONFIG_BOARD_LATE_INIT=y
> diff --git a/configs/imx8mn_venice_defconfig b/configs/imx8mn_venice_defconfig
> index a4e54ff50cf1..821252ad600c 100644
> --- a/configs/imx8mn_venice_defconfig
> +++ b/configs/imx8mn_venice_defconfig
> @@ -29,7 +29,6 @@ CONFIG_SPL_LOAD_FIT=y
>  # CONFIG_USE_SPL_FIT_GENERATOR is not set
>  CONFIG_OF_BOARD_SETUP=y
>  CONFIG_OF_SYSTEM_SETUP=y
> -# CONFIG_USE_BOOTCOMMAND is not set
>  CONFIG_USE_PREBOOT=y
>  CONFIG_PREBOOT="gsc wd-disable"
>  CONFIG_BOARD_LATE_INIT=y
> diff --git a/configs/imx8mp_venice_defconfig b/configs/imx8mp_venice_defconfig
> index d1a1bfa82acf..339e740349d4 100644
> --- a/configs/imx8mp_venice_defconfig
> +++ b/configs/imx8mp_venice_defconfig
> @@ -29,7 +29,6 @@ CONFIG_SPL_LOAD_FIT=y
>  # CONFIG_USE_SPL_FIT_GENERATOR is not set
>  CONFIG_OF_BOARD_SETUP=y
>  CONFIG_OF_SYSTEM_SETUP=y
> -# CONFIG_USE_BOOTCOMMAND is not set
>  CONFIG_USE_PREBOOT=y
>  CONFIG_PREBOOT="gsc wd-disable"
>  CONFIG_BOARD_LATE_INIT=y
> --
> 2.25.1
>

Stefano,

I probably needed to send this one to you as it is for imx8m board
defconfigs and has a Fixes tag that fixes a regression. With a pending
release in a few weeks, it would be nice to get fixes merged. I'm not
sure if this must go through your tree or could instead go through
Tom's tree.

Best Regards,

Tim


Re: [PATCH v2 22/24] blk: Drop if_type

2022-09-13 Thread Heinrich Schuchardt

On 8/12/22 03:35, Simon Glass wrote:

Use the uclass ID instead.

Signed-off-by: Simon Glass 
---

(no changes since v1)

  cmd/blk_common.c   |  2 +-
  drivers/block/blk-uclass.c | 34 +++
  drivers/block/blk_legacy.c | 20 +--
  include/blk.h  | 41 ++
  include/efi_loader.h   |  2 +-
  5 files changed, 48 insertions(+), 51 deletions(-)

diff --git a/cmd/blk_common.c b/cmd/blk_common.c
index 4e442f2918b..369c5ae4bbe 100644
--- a/cmd/blk_common.c
+++ b/cmd/blk_common.c
@@ -12,7 +12,7 @@
  #include 
  #include 

-int blk_common_cmd(int argc, char *const argv[], enum if_type if_type,
+int blk_common_cmd(int argc, char *const argv[], enum uclass_id if_type,
   int *cur_devnump)
  {
const char *if_name = blk_get_if_type_name(if_type);
diff --git a/drivers/block/blk-uclass.c b/drivers/block/blk-uclass.c
index 436af764f91..a9a85aa37f3 100644
--- a/drivers/block/blk-uclass.c
+++ b/drivers/block/blk-uclass.c
@@ -34,7 +34,7 @@ static struct {
{ UCLASS_PVBLOCK, "pvblock" },
  };

-static enum if_type if_typename_to_iftype(const char *if_typename)
+static enum uclass_id if_typename_to_iftype(const char *if_typename)
  {
int i;

@@ -46,7 +46,7 @@ static enum if_type if_typename_to_iftype(const char 
*if_typename)
return UCLASS_INVALID;
  }

-static enum uclass_id if_type_to_uclass_id(enum if_type if_type)
+static enum uclass_id if_type_to_uclass_id(enum uclass_id if_type)
  {
/*
 * This strange adjustment is used because we use UCLASS_MASS_STORAGE
@@ -71,7 +71,7 @@ static enum uclass_id if_type_to_uclass_id(enum if_type 
if_type)
return if_type;
  }

-const char *blk_get_if_type_name(enum if_type if_type)
+const char *blk_get_if_type_name(enum uclass_id if_type)
  {
int i;

@@ -83,7 +83,7 @@ const char *blk_get_if_type_name(enum if_type if_type)
return "(none)";
  }

-struct blk_desc *blk_get_devnum_by_type(enum if_type if_type, int devnum)
+struct blk_desc *blk_get_devnum_by_type(enum uclass_id if_type, int devnum)
  {
struct blk_desc *desc;
struct udevice *dev;
@@ -105,7 +105,7 @@ struct blk_desc *blk_get_devnum_by_type(enum if_type 
if_type, int devnum)
  struct blk_desc *blk_get_devnum_by_typename(const char *if_typename, int 
devnum)
  {
enum uclass_id uclass_id;
-   enum if_type type;
+   enum uclass_id type;
struct udevice *dev;
struct uclass *uc;
int ret;
@@ -185,7 +185,7 @@ struct blk_desc *blk_get_by_device(struct udevice *dev)
   * with a higher device number, -ENOENT if there is no such device but there
   * is one with a higher number, or other -ve on other error.
   */
-static int get_desc(enum if_type if_type, int devnum, struct blk_desc **descp)
+static int get_desc(enum uclass_id if_type, int devnum, struct blk_desc 
**descp)
  {
bool found_more = false;
struct udevice *dev;
@@ -218,7 +218,7 @@ static int get_desc(enum if_type if_type, int devnum, 
struct blk_desc **descp)
return found_more ? -ENOENT : -ENODEV;
  }

-int blk_select_hwpart_devnum(enum if_type if_type, int devnum, int hwpart)
+int blk_select_hwpart_devnum(enum uclass_id if_type, int devnum, int hwpart)
  {
struct udevice *dev;
int ret;
@@ -230,7 +230,7 @@ int blk_select_hwpart_devnum(enum if_type if_type, int 
devnum, int hwpart)
return blk_select_hwpart(dev, hwpart);
  }

-int blk_list_part(enum if_type if_type)
+int blk_list_part(enum uclass_id if_type)
  {
struct blk_desc *desc;
int devnum, ok;
@@ -255,7 +255,7 @@ int blk_list_part(enum if_type if_type)
return 0;
  }

-int blk_print_part_devnum(enum if_type if_type, int devnum)
+int blk_print_part_devnum(enum uclass_id if_type, int devnum)
  {
struct blk_desc *desc;
int ret;
@@ -270,7 +270,7 @@ int blk_print_part_devnum(enum if_type if_type, int devnum)
return 0;
  }

-void blk_list_devices(enum if_type if_type)
+void blk_list_devices(enum uclass_id if_type)
  {
struct blk_desc *desc;
int ret;
@@ -289,7 +289,7 @@ void blk_list_devices(enum if_type if_type)
}
  }

-int blk_print_device_num(enum if_type if_type, int devnum)
+int blk_print_device_num(enum uclass_id if_type, int devnum)
  {
struct blk_desc *desc;
int ret;
@@ -303,7 +303,7 @@ int blk_print_device_num(enum if_type if_type, int devnum)
return 0;
  }

-int blk_show_device(enum if_type if_type, int devnum)
+int blk_show_device(enum uclass_id if_type, int devnum)
  {
struct blk_desc *desc;
int ret;
@@ -324,7 +324,7 @@ int blk_show_device(enum if_type if_type, int devnum)
return 0;
  }

-ulong blk_read_devnum(enum if_type if_type, int devnum, lbaint_t start,
+ulong blk_read_devnum(enum uclass_id if_type, int devnum, lbaint_t start,
  lbaint_t blkcnt, void *buffer)
  {
struct blk_desc *desc;

Re: [PATCH] doc: dm: Fix typo

2022-09-13 Thread Tom Rini
On Tue, Sep 13, 2022 at 06:09:17PM +0200, Heinrich Schuchardt wrote:
> On 9/13/22 17:50, Tom Rini wrote:
> > On Tue, Sep 13, 2022 at 09:03:42AM -0400, Tom Rini wrote:
> > > On Tue, Sep 13, 2022 at 01:14:46PM +0200, Heinrich Schuchardt wrote:
> > > > On 9/13/22 12:51, Alexander Dahl wrote:
> > > > > That's most probably a typo, because driver model design documents 
> > > > > seem
> > > > > to be from 2012 and there is no 2010.01 release.
> > > > > 
> > > > > Fixes: 282ed24fb3ca ("dm: MIGRATION: Add migration plan for 
> > > > > CONFIG_DM")
> > > > > Signed-off-by: Alexander Dahl 
> > > > > ---
> > > > >doc/develop/driver-model/migration.rst | 2 +-
> > > > >1 file changed, 1 insertion(+), 1 deletion(-)
> > > > > 
> > > > > diff --git a/doc/develop/driver-model/migration.rst 
> > > > > b/doc/develop/driver-model/migration.rst
> > > > > index 5a60436925..cee38a56d0 100644
> > > > > --- a/doc/develop/driver-model/migration.rst
> > > > > +++ b/doc/develop/driver-model/migration.rst
> > > > > @@ -13,7 +13,7 @@ CONFIG_DM
> > > > >* Status: In progress
> > > > >* Deadline: 2020.01
> > > > > 
> > > > > -Starting with the 2010.01 release CONFIG_DM will be enabled for all 
> > > > > boards.
> > > > > +Starting with the 2020.01 release CONFIG_DM will be enabled for all 
> > > > > boards.
> > > > 
> > > > Thanks for pointing at the typo.
> > > > 
> > > > This migration is completed. Should we remove the entry from the list?
> > > 
> > > Should do a world build where the Makefile check is fatal first, and go
> > > from there.
> > 
> > OK, so I set up that kind of build on current master and it passes:
> > https://source.denx.de/u-boot/u-boot/-/pipelines/13433
> > 
> > Please do a patch to remove this section from
> > doc/develop/driver-model/migration.rst and drop the test in the Makefile
> > for CONFIG_DM being set as well. Thanks!
> > 
> 
> Should we change CONFIG_DM to be non-editable:
> 
>  config DM
> -   bool "Enable Driver Model"
> -   help
> - This config option enables Driver Model. This brings in the core
> - support, including scanning of platform data on start-up. If
> - CONFIG_OF_CONTROL is enabled, the device tree will be scanned also
> - when available.
> +   bool
> +   default y
> 
> And in the next step remove the symbol completely?

I wouldn't delete the help, but yes, it should also be def_bool y.

-- 
Tom


signature.asc
Description: PGP signature


Re: [PATCH v2 23/24] efi: Drop ifname field from struct efi_disk_obj

2022-09-13 Thread Heinrich Schuchardt

On 8/12/22 03:35, Simon Glass wrote:

This is not used, so drop it.

Suggested-by: AKASHI Takahiro 
Signed-off-by: Simon Glass 
---

Changes in v2:
- Add new patch to drop ifname field from struct efi_disk_obj

  lib/efi_loader/efi_disk.c | 2 --
  1 file changed, 2 deletions(-)

diff --git a/lib/efi_loader/efi_disk.c b/lib/efi_loader/efi_disk.c
index 2e905f61840..ad543bc117e 100644
--- a/lib/efi_loader/efi_disk.c
+++ b/lib/efi_loader/efi_disk.c
@@ -40,7 +40,6 @@ const efi_guid_t efi_system_partition_guid = 
PARTITION_SYSTEM_GUID;
  struct efi_disk_obj {
struct efi_object header;
struct efi_block_io ops;
-   const char *ifname;


This patch is obsolete since commit ab31c8a15871 (" efi_loader: disk:
remove unused field").

Best regards

Heinrich


int dev_index;
struct efi_block_io_media media;
struct efi_device_path *dp;
@@ -476,7 +475,6 @@ static efi_status_t efi_disk_add_dev(
return ret;
}
diskobj->ops = block_io_disk_template;
-   diskobj->ifname = if_typename;
diskobj->dev_index = dev_index;

/* Fill in EFI IO Media info (for read/write callbacks) */




Re: [PATCH u-boot-marvell] arm: mvebu: turris_omnia: Fix setting switch CONFIG pins on new board design

2022-09-13 Thread Marek Behún
On Tue, 13 Sep 2022 18:10:28 +0200
Marek Behún  wrote:

> It seems that waiting only 10 ms after releasing LAN switch from reset
> is not enough for the strapping pins to latch the requested values.
> P6_MODE[0] is latched to 0 instead of 1.
> 
> Increasing the delay to 50 ms fixes this issue.
> 
> Signed-off-by: Marek Behún 
> ---
>  board/CZ.NIC/turris_omnia/turris_omnia.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/board/CZ.NIC/turris_omnia/turris_omnia.c 
> b/board/CZ.NIC/turris_omnia/turris_omnia.c
> index a7f96e5b77..19c5043fcb 100644
> --- a/board/CZ.NIC/turris_omnia/turris_omnia.c
> +++ b/board/CZ.NIC/turris_omnia/turris_omnia.c
> @@ -654,7 +654,7 @@ static void initialize_switch(void)
>   ctrl[1] = EXT_CTL_nRES_LAN;
>   err = omnia_mcu_write(CMD_EXT_CONTROL, ctrl, sizeof(ctrl));
>  
> - mdelay(10);
> + mdelay(50);
>  
>   /* Change RGMII pins back to RGMII mode */
>  

I forgot to add

Fixes: 1da53ae26afc ("arm: mvebu: turris_omnia: Add support for design with SW 
reset signals")


[PATCH u-boot-marvell] arm: mvebu: turris_omnia: Fix setting switch CONFIG pins on new board design

2022-09-13 Thread Marek Behún
It seems that waiting only 10 ms after releasing LAN switch from reset
is not enough for the strapping pins to latch the requested values.
P6_MODE[0] is latched to 0 instead of 1.

Increasing the delay to 50 ms fixes this issue.

Signed-off-by: Marek Behún 
---
 board/CZ.NIC/turris_omnia/turris_omnia.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/board/CZ.NIC/turris_omnia/turris_omnia.c 
b/board/CZ.NIC/turris_omnia/turris_omnia.c
index a7f96e5b77..19c5043fcb 100644
--- a/board/CZ.NIC/turris_omnia/turris_omnia.c
+++ b/board/CZ.NIC/turris_omnia/turris_omnia.c
@@ -654,7 +654,7 @@ static void initialize_switch(void)
ctrl[1] = EXT_CTL_nRES_LAN;
err = omnia_mcu_write(CMD_EXT_CONTROL, ctrl, sizeof(ctrl));
 
-   mdelay(10);
+   mdelay(50);
 
/* Change RGMII pins back to RGMII mode */
 
-- 
2.35.1



Re: [PATCH] doc: dm: Fix typo

2022-09-13 Thread Heinrich Schuchardt

On 9/13/22 17:50, Tom Rini wrote:

On Tue, Sep 13, 2022 at 09:03:42AM -0400, Tom Rini wrote:

On Tue, Sep 13, 2022 at 01:14:46PM +0200, Heinrich Schuchardt wrote:

On 9/13/22 12:51, Alexander Dahl wrote:

That's most probably a typo, because driver model design documents seem
to be from 2012 and there is no 2010.01 release.

Fixes: 282ed24fb3ca ("dm: MIGRATION: Add migration plan for CONFIG_DM")
Signed-off-by: Alexander Dahl 
---
   doc/develop/driver-model/migration.rst | 2 +-
   1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/doc/develop/driver-model/migration.rst 
b/doc/develop/driver-model/migration.rst
index 5a60436925..cee38a56d0 100644
--- a/doc/develop/driver-model/migration.rst
+++ b/doc/develop/driver-model/migration.rst
@@ -13,7 +13,7 @@ CONFIG_DM
   * Status: In progress
   * Deadline: 2020.01

-Starting with the 2010.01 release CONFIG_DM will be enabled for all boards.
+Starting with the 2020.01 release CONFIG_DM will be enabled for all boards.


Thanks for pointing at the typo.

This migration is completed. Should we remove the entry from the list?


Should do a world build where the Makefile check is fatal first, and go
from there.


OK, so I set up that kind of build on current master and it passes:
https://source.denx.de/u-boot/u-boot/-/pipelines/13433

Please do a patch to remove this section from
doc/develop/driver-model/migration.rst and drop the test in the Makefile
for CONFIG_DM being set as well. Thanks!



Should we change CONFIG_DM to be non-editable:

 config DM
-   bool "Enable Driver Model"
-   help
- This config option enables Driver Model. This brings in the core
- support, including scanning of platform data on start-up. If
- CONFIG_OF_CONTROL is enabled, the device tree will be scanned also
- when available.
+   bool
+   default y

And in the next step remove the symbol completely?

Best regards

Heinrich


Re: [PATCH v2 24/24] blk: Rename if_type to uclass_id

2022-09-13 Thread Tom Rini
On Thu, Aug 11, 2022 at 07:35:03PM -0600, Simon Glass wrote:

> Use the word 'uclass' instead of 'if_type' to complete the conversion.
> 
> Signed-off-by: Simon Glass 
> ---
> 
> Changes in v2:
> - Use conv_uclass_id() instead of the confusing uclass_id_to_uclass_id()

So, for this series, 1 through 22 apply cleanly (one easy fixup
required), and 23/24 appears to be applied already. But large chunks of
this patch do not apply to lib/efi_loader/efi_disk.c and it's unclear
what I should do here. Should I just apply 1-22 of this series? Or do
you expect to v3 this? Thanks!

-- 
Tom


signature.asc
Description: PGP signature


Re: [GIT PULL] xilinx patches for v2023.01-rc1

2022-09-13 Thread Tom Rini
On Tue, Sep 13, 2022 at 01:59:42PM +0200, Michal Simek wrote:

> Hi Tom,
> 
> please pull the following patches to your tree. Buildman and CI loop doesn't
> show any issue.
> 
> Thanks,
> Michal
> 
> The following changes since commit 98b3a998b31a83d8167f888b11ddd5cce8194f35:
> 
>   Merge branch '2022-09-02-assorted-improvements' into next (2022-09-02
> 21:53:36 -0400)
> 
> are available in the Git repository at:
> 
>   g...@source.denx.de:u-boot/custodians/u-boot-microblaze.git
> tags/xilinx-for-v2023.01-rc1
> 
> for you to fetch changes up to 39d3c3cfaa4f5099a2d687de4530c9ca4bee256d:
> 
>   xilinx: common: Add support for SOC detection (2022-09-13 11:32:48 +0200)
> 

Applied to u-boot/next, thanks!

-- 
Tom


signature.asc
Description: PGP signature


Re: [PATCH] doc: dm: Fix typo

2022-09-13 Thread Tom Rini
On Tue, Sep 13, 2022 at 09:03:42AM -0400, Tom Rini wrote:
> On Tue, Sep 13, 2022 at 01:14:46PM +0200, Heinrich Schuchardt wrote:
> > On 9/13/22 12:51, Alexander Dahl wrote:
> > > That's most probably a typo, because driver model design documents seem
> > > to be from 2012 and there is no 2010.01 release.
> > > 
> > > Fixes: 282ed24fb3ca ("dm: MIGRATION: Add migration plan for CONFIG_DM")
> > > Signed-off-by: Alexander Dahl 
> > > ---
> > >   doc/develop/driver-model/migration.rst | 2 +-
> > >   1 file changed, 1 insertion(+), 1 deletion(-)
> > > 
> > > diff --git a/doc/develop/driver-model/migration.rst 
> > > b/doc/develop/driver-model/migration.rst
> > > index 5a60436925..cee38a56d0 100644
> > > --- a/doc/develop/driver-model/migration.rst
> > > +++ b/doc/develop/driver-model/migration.rst
> > > @@ -13,7 +13,7 @@ CONFIG_DM
> > >   * Status: In progress
> > >   * Deadline: 2020.01
> > > 
> > > -Starting with the 2010.01 release CONFIG_DM will be enabled for all 
> > > boards.
> > > +Starting with the 2020.01 release CONFIG_DM will be enabled for all 
> > > boards.
> > 
> > Thanks for pointing at the typo.
> > 
> > This migration is completed. Should we remove the entry from the list?
> 
> Should do a world build where the Makefile check is fatal first, and go
> from there.

OK, so I set up that kind of build on current master and it passes:
https://source.denx.de/u-boot/u-boot/-/pipelines/13433

Please do a patch to remove this section from
doc/develop/driver-model/migration.rst and drop the test in the Makefile
for CONFIG_DM being set as well. Thanks!

-- 
Tom


signature.asc
Description: PGP signature


RE: [TF-A] Re: [RFC] Proposed location to host the firmware handoff specification.

2022-09-13 Thread Dan Handley
Hi all

Just picking up this old thread again...

There seemed to be general agreement to host the firmware hand-off spec in a 
separate repo with separate maintainers at TrustedFirmware.org, at least 
initially. Arm intends to progress with the initial population of this repo. We 
intend to use the CC-BY-SA-4.0 (https://spdx.org/licenses/CC-BY-SA-4.0.html) 
license, the same as used for EBBR (https://github.com/ARM-software/ebbr). 
Please say if you have any objections to this. We will also seek approval from 
the TrustedFirmware.org board.

Regards

Dan.



Re: Please pull u-boot-marvell/master

2022-09-13 Thread Tom Rini
On Tue, Sep 13, 2022 at 12:26:22PM +0200, Stefan Roese wrote:

> Hi Tom,
> 
> please pull this next batch of Armada cache related fixes and
> some board specific enhancements:
> 

Applied to u-boot/master, thanks!

-- 
Tom


signature.asc
Description: PGP signature


Re: [PATCH] HSD #1507500974: configs: arria10: Add bridge enable to CONFIG_BOOTCOMMAND

2022-09-13 Thread Tom Rini
On Tue, Sep 13, 2022 at 10:56:33AM +0800, teik.heng.ch...@intel.com wrote:

> From: Ley Foon Tan 
> 
> Add "bridge enable" command to CONFIG_BOOTCOMMAND.
> 
> CONFIG_BOOTCOMMAND="bridge enable;run distro_bootcmd"
> 
> defconfig is generated from "make savedefconfig".
> 
> Signed-off-by: Ley Foon Tan 
> Signed-off-by: Teik Heng Chong 

As a general remark, please make sure to remove internal markings such
as "HSD #1507500974" from your patches when you post them for upstream.
You don't need to resend everything you've already done with this
included but please make sure to check for it moving forward, thanks!

-- 
Tom


signature.asc
Description: PGP signature


[PATCH v2] configs:rockchip: roc-rk3399-pc: Enable the preboot configuration , USB 1.1 support , crypto RNG support and increase the spi flash default speed

2022-09-13 Thread Manoj Sai
This Patch enables the following details of configs to rockchip based 
roc-rk3399-pc board :

1) Enable preboot configuration to enable  usb devices .

2) Fix up USB config options so keyboards and other USB devices work and
   update the number of ports of the Usb root hub to configuration of
   CONFIG_SYS_USB_OHCI_MAX_ROOT_PORTS .

   - with this addition the updated USB device Tree :
 USB device tree:

1  Hub (12 Mb/s, 0mA)
U-Boot Root Hub
1  Hub (12 Mb/s, 0mA)
|   U-Boot Root Hub
|
+-2  Hub (12 Mb/s, 100mA)
USB 2.0 Hub [MTT]

1  Hub (5 Gb/s, 0mA)
U-Boot XHCI Host Controller

3) enable crypto RNG ( random number generator ) support

4) Set the maximum slave SPI speed to 30MHz :
- This patch increases the maximum SPI slave device speed and
  SPI flash max frequency for environment from 10Mhz to 30MHz .

- difference in time of erase and update a region of SPI flash from memory
  with 10Mhz and 30Mhz frequencey range updation  follows :-

with 10 Mhz frequency updation :-
=> sf update 0x30 0x80 0x40
4194304 bytes written, 0 bytes skipped in 36.819s, speed 119837 B/s

with 30Mhz frequency updation  :-
=> sf update 0x30 0x80 0x40
4194304 bytes written, 0 bytes skipped in 20.319s, speed 220752 B/s

Signed-off-by: Manoj Sai 
Signed-off-by: Da Xue 
Signed-off-by: dsx724 
---
Changes for v2 :-
- fixed prefix in commit message .
- squash the all four patches into single patch .
---
 configs/roc-pc-rk3399_defconfig | 8 
 1 file changed, 8 insertions(+)

diff --git a/configs/roc-pc-rk3399_defconfig b/configs/roc-pc-rk3399_defconfig
index 4625e47537..7754cb8388 100644
--- a/configs/roc-pc-rk3399_defconfig
+++ b/configs/roc-pc-rk3399_defconfig
@@ -20,6 +20,7 @@ CONFIG_DEBUG_UART=y
 CONFIG_HAS_CUSTOM_SYS_INIT_SP_ADDR=y
 CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0x30
 # CONFIG_ANDROID_BOOT_IMAGE is not set
+CONFIG_USE_PREBOOT=y
 CONFIG_DEFAULT_FDT_FILE="rockchip/rk3399-roc-pc.dtb"
 CONFIG_DISPLAY_BOARDINFO_LATE=y
 CONFIG_SPL_MAX_SIZE=0x2e000
@@ -44,6 +45,7 @@ CONFIG_CMD_TIME=y
 CONFIG_SPL_OF_CONTROL=y
 CONFIG_OF_SPL_REMOVE_PROPS="pinctrl-0 pinctrl-names clock-names 
interrupt-parent assigned-clocks assigned-clock-rates assigned-clock-parents"
 CONFIG_ENV_IS_IN_SPI_FLASH=y
+CONFIG_ENV_SPI_MAX_HZ=3000
 CONFIG_SYS_RELOC_GD_ENV_ADDR=y
 CONFIG_SPL_DM_SEQ_ALIAS=y
 CONFIG_ROCKCHIP_GPIO=y
@@ -54,6 +56,7 @@ CONFIG_MMC_DW_ROCKCHIP=y
 CONFIG_MMC_SDHCI=y
 CONFIG_MMC_SDHCI_ROCKCHIP=y
 CONFIG_SF_DEFAULT_BUS=1
+CONFIG_SF_DEFAULT_SPEED=3000
 CONFIG_SPI_FLASH_WINBOND=y
 CONFIG_ETH_DESIGNWARE=y
 CONFIG_GMAC_ROCKCHIP=y
@@ -66,6 +69,8 @@ CONFIG_PWM_ROCKCHIP=y
 # CONFIG_RAM_ROCKCHIP_DEBUG is not set
 CONFIG_RAM_RK3399_LPDDR4=y
 CONFIG_DM_RESET=y
+CONFIG_DM_RNG=y
+CONFIG_RNG_ROCKCHIP=y
 CONFIG_BAUDRATE=150
 CONFIG_DEBUG_UART_SHIFT=2
 CONFIG_ROCKCHIP_SPI=y
@@ -75,6 +80,9 @@ CONFIG_USB_XHCI_HCD=y
 CONFIG_USB_XHCI_DWC3=y
 CONFIG_USB_EHCI_HCD=y
 CONFIG_USB_EHCI_GENERIC=y
+CONFIG_USB_OHCI_HCD=y
+CONFIG_USB_OHCI_GENERIC=y
+CONFIG_SYS_USB_OHCI_MAX_ROOT_PORTS=2
 CONFIG_USB_DWC3=y
 CONFIG_USB_DWC3_GENERIC=y
 CONFIG_USB_KEYBOARD=y
-- 
2.25.1



Re: [PATCH] doc: dm: Fix typo

2022-09-13 Thread Tom Rini
On Tue, Sep 13, 2022 at 01:14:46PM +0200, Heinrich Schuchardt wrote:
> On 9/13/22 12:51, Alexander Dahl wrote:
> > That's most probably a typo, because driver model design documents seem
> > to be from 2012 and there is no 2010.01 release.
> > 
> > Fixes: 282ed24fb3ca ("dm: MIGRATION: Add migration plan for CONFIG_DM")
> > Signed-off-by: Alexander Dahl 
> > ---
> >   doc/develop/driver-model/migration.rst | 2 +-
> >   1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/doc/develop/driver-model/migration.rst 
> > b/doc/develop/driver-model/migration.rst
> > index 5a60436925..cee38a56d0 100644
> > --- a/doc/develop/driver-model/migration.rst
> > +++ b/doc/develop/driver-model/migration.rst
> > @@ -13,7 +13,7 @@ CONFIG_DM
> >   * Status: In progress
> >   * Deadline: 2020.01
> > 
> > -Starting with the 2010.01 release CONFIG_DM will be enabled for all boards.
> > +Starting with the 2020.01 release CONFIG_DM will be enabled for all boards.
> 
> Thanks for pointing at the typo.
> 
> This migration is completed. Should we remove the entry from the list?

Should do a world build where the Makefile check is fatal first, and go
from there.

-- 
Tom


signature.asc
Description: PGP signature


Re: [PATCH 00/15] test: More work on parallel tests

2022-09-13 Thread Tom Rini
On Sat, 6 Aug 2022 17:51:44 -0600, Simon Glass wrote:

> This series makes a further attempt to get closer to having all tests
> run in parallel. It introduces a new 'make pcheck' option which runs
> tests in parallel, skipping those that are not compatible.
> 
> A number of fixes are included for existing tests. The vboot test is
> updated to only run a single scenario in 'quick' mode.
> 
> [...]

Series applied to u-boot/next, thanks!

-- 
Tom



[GIT PULL] xilinx patches for v2023.01-rc1

2022-09-13 Thread Michal Simek

Hi Tom,

please pull the following patches to your tree. Buildman and CI loop doesn't 
show any issue.


Thanks,
Michal

The following changes since commit 98b3a998b31a83d8167f888b11ddd5cce8194f35:

  Merge branch '2022-09-02-assorted-improvements' into next (2022-09-02 
21:53:36 -0400)


are available in the Git repository at:

  g...@source.denx.de:u-boot/custodians/u-boot-microblaze.git 
tags/xilinx-for-v2023.01-rc1


for you to fetch changes up to 39d3c3cfaa4f5099a2d687de4530c9ca4bee256d:

  xilinx: common: Add support for SOC detection (2022-09-13 11:32:48 +0200)


Xilinx changes for v2023.01-rc1

cmd:
- bdinfo - guard LMB code to run only when LMB is enabled

timer:
- convert arm twd timer to DM

power-domain:
- Skip loading config object for Versal

xilinx:
- Fix logic when dfu_alt_info is generated
- Define only mmc devnum not partition
- Add xlnx prefix to GEM compatible string
- Add missing tca6416 to zynqmp SC - vck190
- Add env redund offset
- Enable CMD_GREPENV/SETEXPR by default
- Move board_get_usable_ram_top() to common location
- Add support for SOC detection

net/gem:
- Check rate before setting it up

microblaze:
- drop CONFIG_SYS_INIT_RAM_ADDR and CONFIG_SYS_INIT_RAM_SIZE
- Show cache size in bdinfo

spi:
- cadence_qspi: driver updates
- zynqmp_gqspi: driver updates
- zynqmp_gqspi: Add tap delays for Versal

zynq:
- Enable mkeficapsule compilation
- Use CONFIG_SPL_FS_LOAD_PAYLOAD_NAME for dfu_alt_info
- Align bss and end of u-boot image to 64bits
- Align qspi node name with Linux kernel
- DT: List OCM memory

zynqmp:
- Fix AES cache handling with a user provided key
- SOM: Add mtd partition for secure OS storage area
- Add ref_clk property for REFCLKPER calculation
- Fix mdio bus description for vck190-sc

xilinx-mini:
- Remove unneeded configs
- Disable LMB

versal:
- Enable i2c mux pca954x by default
- Define CONFIG_CQSPI_REF_CLK
- Enable power domain driver
- Enable zynqmp_gqspi driver


Amit Kumar Mahapatra (1):
  arm64: zynqmp: Add mtd partition for secure OS storage area

Ashok Reddy Soma (13):
  xilinx: zynqmp: Disable various configs for mini U-Boot
  xilinx: zynqmp: Disable LMB for mini u-boot
  firmware: zynqmp: Skip loading config object for Versal
  xilinx: versal: Enable power domain driver
  xilinx: versal: Define CONFIG_CQSPI_REF_CLK
  spi: cadence-qspi: Correct flash reset function name
  spi: cadence_qspi: Call read_setup for STIG_READ
  spi: cadence-qspi: Use priv instead of plat across the driver
  spi: zynqmp_gqspi: Add tap delays for Versal
  spi: zynqmp_gqspi: Add support for IO mode
  spi: zynqmp_gqspi: Fix issue of reading more than 32bits length
  spi: zynqmp_qspi: Code alignment
  arm64: versal: Enable zynqmp_gqspi driver

Harini Katakam (1):
  arm: dts: Add xlnx prefix to GEM compatible string

Janne Ylalehto (1):
  xilinx: zynqmp: Fix AES with a user provided key

Michal Simek (18):
  xilinx: versal: Enable i2c mux uclass with pca954x driver
  cmd: bdinfo: Enable dumping lmb data when LMB is enabled
  xilinx: zynq: Disable LMB for mini configurations
  xilinx: zynq: Enable mkeficapsule tools compilation
  xilinx: Fix logic when dfu_alt_info is generated
  xilinx: zynq: Use CONFIG_SPL_FS_LOAD_PAYLOAD_NAME for dfu_alt_info
  xilinx: Define only mmc devnum not partition
  arm64: zynqmp: Add missing tca6416 to zynqmp SC
  xilinx: Enable CMD_GREPENV/SETEXPR by default
  ARM: zynq: Align bss and end of u-boot image to 64bits
  arm64: xilinx: Move board_get_usable_ram_top() to common location
  xilinx: versal: Disable LMB for mini configurations
  net: gem: Check rate before setting it up
  arm64: versal: Define zynqmp_mmio_write() for versal
  ARM: zynq: Align qspi node name with Linux kernel
  ARM: zynq: DT: List OCM memory
  xilinx: Fix mdio bus description for vck190-sc
  xilinx: common: Add support for SOC detection

Ovidiu Panait (4):
  microblaze: drop CONFIG_SYS_INIT_RAM_ADDR and CONFIG_SYS_INIT_RAM_SIZE
  cpu: microblaze: add error handling in microblaze_cpu_get_desc()
  cmd: bdinfo: introduce bdinfo_print_size() helper
  microblaze: add arch_print_bdinfo() implementation

Piyush Mehta (1):
  arm64: zynqmp: add ref_clk property for REFCLKPER calculation

Stefan Herbrechtsmeier (2):
  zynq: Convert arm twd timer to DM driver
  fpga: zynq: Remove post config info message for SPL

T Karthik Reddy (1):
  xilinx: Add env redund offset

 arch/arm/Kconfig |   3 +
 arch/arm/dts/zynq-7000.dtsi  |  26 ++-
 arch/arm/dts/zynq-zc702.dts  |  13 --
 arch/arm/dts/zynqmp-clk-ccf.dtsi |   8 +
 arch/arm/dts/zynqmp-e-a2197-00-revA.dts  |  20 +-
 

[PATCH] HSD #1507500974: configs: arria10: Add bridge enable to CONFIG_BOOTCOMMAND

2022-09-13 Thread teik . heng . chong
From: Ley Foon Tan 

Add "bridge enable" command to CONFIG_BOOTCOMMAND.

CONFIG_BOOTCOMMAND="bridge enable;run distro_bootcmd"

defconfig is generated from "make savedefconfig".

Signed-off-by: Ley Foon Tan 
Signed-off-by: Teik Heng Chong 
---
 configs/socfpga_arria10_defconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/configs/socfpga_arria10_defconfig 
b/configs/socfpga_arria10_defconfig
index 3eac3dfa5d..f79a0393d8 100644
--- a/configs/socfpga_arria10_defconfig
+++ b/configs/socfpga_arria10_defconfig
@@ -19,7 +19,7 @@ CONFIG_SPL_FIT=y
 # CONFIG_USE_SPL_FIT_GENERATOR is not set
 CONFIG_USE_BOOTARGS=y
 CONFIG_BOOTARGS="console=ttyS0,115200"
-# CONFIG_USE_BOOTCOMMAND is not set
+CONFIG_BOOTCOMMAND="bridge enable;run distro_bootcmd"
 CONFIG_DEFAULT_FDT_FILE="socfpga_arria10_socdk_sdmmc.dtb"
 CONFIG_SYS_CONSOLE_IS_IN_ENV=y
 CONFIG_SYS_CONSOLE_OVERWRITE_ROUTINE=y
-- 
2.25.1



[PATCH 3/3] mmc: stm32_sdmmc2: manage vqmmc

2022-09-13 Thread Yann Gautier
The SDMMC IOs can be in an IO domain, that has to be enabled.
This is done by enabling vqmmc in the driver.
This has no impact on configurations not using an IO domain, the check
can then be executed on all platforms managing regulator, and the vqmmc
regulator enabled on all platforms having it in their DT.

Signed-off-by: Yann Gautier 

---
There are 2 checkpatch warnings:
drivers/mmc/stm32_sdmmc2.c:40: warning: Use 'if (IS_ENABLED(CONFIG...))'
 instead of '#if or #ifdef' where possible
drivers/mmc/stm32_sdmmc2.c:580: warning: Use 'if (IS_ENABLED(CONFIG...))'
 instead of '#if or #ifdef' where possible
But this cannot be changed as the vqmmc_supply field in struct mmc is
under flag: #if CONFIG_IS_ENABLED(DM_REGULATOR). For platforms not
enabling this flag there would be a compilation error.

 drivers/mmc/stm32_sdmmc2.c | 13 +
 1 file changed, 13 insertions(+)

diff --git a/drivers/mmc/stm32_sdmmc2.c b/drivers/mmc/stm32_sdmmc2.c
index e1240b0cf3..1195134844 100644
--- a/drivers/mmc/stm32_sdmmc2.c
+++ b/drivers/mmc/stm32_sdmmc2.c
@@ -25,6 +25,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 
 struct stm32_sdmmc2_plat {
@@ -36,6 +37,9 @@ struct stm32_sdmmc2_plat {
struct gpio_desc cd_gpio;
u32 clk_reg_msk;
u32 pwr_reg_msk;
+#if CONFIG_IS_ENABLED(DM_REGULATOR)
+   bool vqmmc_enabled;
+#endif
 };
 
 struct stm32_sdmmc2_ctx {
@@ -572,6 +576,15 @@ static void stm32_sdmmc2_pwron(struct stm32_sdmmc2_plat 
*plat)
   plat->base + SDMMC_POWER);
 
/* during the first 74 SDMMC_CK cycles the SDMMC is still disabled. */
+
+#if CONFIG_IS_ENABLED(DM_REGULATOR)
+   if (plat->mmc.vqmmc_supply && !plat->vqmmc_enabled) {
+   if (regulator_set_enable_if_allowed(plat->mmc.vqmmc_supply, 
true))
+   dev_dbg(plat->mmc.dev, "failed to enable 
vqmmc-supply\n");
+   else
+   plat->vqmmc_enabled = true;
+   }
+#endif
 }
 
 #define IS_RISING_EDGE(reg) (reg & SDMMC_CLKCR_NEGEDGE ? 0 : 1)
-- 
2.25.1



[PATCH 2/3] mmc: stm32_sdmmc2: protect against unsupported modes

2022-09-13 Thread Yann Gautier
The UHS modes for SD, HS200 and HS400 modes for eMMC are not supported
by the stm32_sdmmc2 driver.
Make it clear by removing the corresponding caps after parsing the DT.

Signed-off-by: Yann Gautier 
---

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

diff --git a/drivers/mmc/stm32_sdmmc2.c b/drivers/mmc/stm32_sdmmc2.c
index 3cfa5a66f1..e1240b0cf3 100644
--- a/drivers/mmc/stm32_sdmmc2.c
+++ b/drivers/mmc/stm32_sdmmc2.c
@@ -675,6 +675,8 @@ static int stm32_sdmmc2_of_to_plat(struct udevice *dev)
if (ret)
return ret;
 
+   cfg->host_caps &= ~(UHS_CAPS | MMC_MODE_HS200 | MMC_MODE_HS400 | 
MMC_MODE_HS400_ES);
+
ret = clk_get_by_index(dev, 0, >clk);
if (ret)
return ret;
-- 
2.25.1



[PATCH 1/3] mmc: stm32_sdmmc2: add dual data rate support

2022-09-13 Thread Yann Gautier
To support dual data rate with STM32 sdmmc2 driver, the dedicated bit
(DDR - BIT(18)) needs to be set in the CLKRC register. Clock bypass
(no divider) is not allowed in this case. This is required for the
eMMC DDR modes.

Signed-off-by: Yann Gautier 
---

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

diff --git a/drivers/mmc/stm32_sdmmc2.c b/drivers/mmc/stm32_sdmmc2.c
index bfce8a2e4a..3cfa5a66f1 100644
--- a/drivers/mmc/stm32_sdmmc2.c
+++ b/drivers/mmc/stm32_sdmmc2.c
@@ -598,13 +598,16 @@ static int stm32_sdmmc2_set_ios(struct udevice *dev)
 * clk_div > 0 and NEGEDGE = 1 => command and data generated on
 * SDMMCCLK falling edge
 */
-   if (desired && ((sys_clock > desired) ||
+   if (desired && (sys_clock > desired || mmc->ddr_mode ||
IS_RISING_EDGE(plat->clk_reg_msk))) {
clk = DIV_ROUND_UP(sys_clock, 2 * desired);
if (clk > SDMMC_CLKCR_CLKDIV_MAX)
clk = SDMMC_CLKCR_CLKDIV_MAX;
}
 
+   if (mmc->ddr_mode)
+   clk |= SDMMC_CLKCR_DDR;
+
if (mmc->bus_width == 4)
clk |= SDMMC_CLKCR_WIDBUS_4;
if (mmc->bus_width == 8)
-- 
2.25.1



Re: [PATCH] doc: dm: Fix typo

2022-09-13 Thread Heinrich Schuchardt

On 9/13/22 12:51, Alexander Dahl wrote:

That's most probably a typo, because driver model design documents seem
to be from 2012 and there is no 2010.01 release.

Fixes: 282ed24fb3ca ("dm: MIGRATION: Add migration plan for CONFIG_DM")
Signed-off-by: Alexander Dahl 
---
  doc/develop/driver-model/migration.rst | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/doc/develop/driver-model/migration.rst 
b/doc/develop/driver-model/migration.rst
index 5a60436925..cee38a56d0 100644
--- a/doc/develop/driver-model/migration.rst
+++ b/doc/develop/driver-model/migration.rst
@@ -13,7 +13,7 @@ CONFIG_DM
  * Status: In progress
  * Deadline: 2020.01

-Starting with the 2010.01 release CONFIG_DM will be enabled for all boards.
+Starting with the 2020.01 release CONFIG_DM will be enabled for all boards.


Thanks for pointing at the typo.

This migration is completed. Should we remove the entry from the list?

Best regards

Heinrich


  This does not concern CONFIG_DM_SPL and CONFIG_DM_TPL. The conversion date for
  these configuration items still needs to be defined.


base-commit: 0ba282e0eeaf29fd78f021fd2f95f7bc3109868d




[PATCH] doc: dm: Fix typo

2022-09-13 Thread Alexander Dahl
That's most probably a typo, because driver model design documents seem
to be from 2012 and there is no 2010.01 release.

Fixes: 282ed24fb3ca ("dm: MIGRATION: Add migration plan for CONFIG_DM")
Signed-off-by: Alexander Dahl 
---
 doc/develop/driver-model/migration.rst | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/doc/develop/driver-model/migration.rst 
b/doc/develop/driver-model/migration.rst
index 5a60436925..cee38a56d0 100644
--- a/doc/develop/driver-model/migration.rst
+++ b/doc/develop/driver-model/migration.rst
@@ -13,7 +13,7 @@ CONFIG_DM
 * Status: In progress
 * Deadline: 2020.01
 
-Starting with the 2010.01 release CONFIG_DM will be enabled for all boards.
+Starting with the 2020.01 release CONFIG_DM will be enabled for all boards.
 This does not concern CONFIG_DM_SPL and CONFIG_DM_TPL. The conversion date for
 these configuration items still needs to be defined.
 

base-commit: 0ba282e0eeaf29fd78f021fd2f95f7bc3109868d
-- 
2.30.2



Please pull u-boot-marvell/master

2022-09-13 Thread Stefan Roese

Hi Tom,

please pull this next batch of Armada cache related fixes and
some board specific enhancements:


- mvebu: Armada 32bit: Cache setup fixes (Pali)
- cmd: mvebu/bubt: Misc enhancements (Pali)
- kirkwood: Add CONFIG_SUPPORT_PASSING_ATAGS (Tony)
- board: turris: Misc improvements (Pali)
- tools: kwboot: Change KWBOOT_MSG_RSP_TIMEO_AXP to 10ms (Stefan)
- tools: termios_linux.h: Fix compilation on non-glibc systems (Pali)


Here the Azure build, without any issues:

https://dev.azure.com/sr0718/u-boot/_build/results?buildId=259=results

Thanks,
Stefan

The following changes since commit 0ba282e0eeaf29fd78f021fd2f95f7bc3109868d:

  Merge tag 'dm-pull-12sep22' of 
https://source.denx.de/u-boot/custodians/u-boot-dm (2022-09-12 09:47:16 
-0400)


are available in the Git repository at:

  g...@source.denx.de:u-boot/custodians/u-boot-marvell.git

for you to fetch changes up to 5818198e6a184963c6afc82178b23a64435ace6a:

  arm: mvebu: Fix moving internal registers (2022-09-13 09:04:22 +0200)


Pali Rohár (14):
  cmd: mvebu/bubt: Check for A38x image data checksum
  cmd: mvebu/bubt: Check for A38x/A37xx OTP secure bits and secure boot
  arm: mvebu: Espressobin: When emmc is not present disable it also 
in OF_LIVE

  board: turris: Initialize serial# env
  arm: mvebu: turris_{omnia, mox}: Reset bootdelay env for rescue
  arm: mvebu: turris_mox: Add support for distroboot $fdt_addr
  tools: termios_linux.h: Fix compilation on non-glibc systems
  arm: mvebu: turris_omnia: Allow to use second serial port
  arm: mvebu: Mark constant data with const keyword
  arm: mvebu: Fix function enable_caches
  arm: mvebu: Guard non-AXP code by checking for AXP
  arm: mvebu: lowlevel.S: Use CR_M from asm/system.h
  arm: mvebu: Enable L2 cache also on Armada 38x
  arm: mvebu: Fix moving internal registers

Stefan Roese (1):
  tools: kwboot: Change KWBOOT_MSG_RSP_TIMEO_AXP to 10ms

Tony Dinh (1):
  arm: kirkwood: Add CONFIG_SUPPORT_PASSING_ATAGS

 arch/arm/include/asm/pl310.h   |   9 +-
 arch/arm/mach-kirkwood/cpu.c   |   2 +-
 arch/arm/mach-kirkwood/include/mach/cpu.h  |   2 +-
 arch/arm/mach-mvebu/cpu.c  |  39 ++---
 arch/arm/mach-mvebu/include/mach/cpu.h |   2 +-
 arch/arm/mach-mvebu/lowlevel.S |  30 +++-
 arch/arm/mach-mvebu/mbus.c |   2 +-
 .../mach-mvebu/serdes/a38x/high_speed_env_spec.c   |   2 +-
 arch/arm/mach-mvebu/system-controller.c|   2 +-
 board/CZ.NIC/turris_atsha_otp.c|  33 +++-
 board/CZ.NIC/turris_atsha_otp.h|   3 +-
 board/CZ.NIC/turris_mox/turris_mox.c   |  53 ++-
 board/CZ.NIC/turris_omnia/turris_omnia.c   |  16 +-
 board/Marvell/mvebu_armada-37xx/board.c|   2 +
 cmd/mvebu/Kconfig  |   1 +
 cmd/mvebu/bubt.c   | 174 
+++--

 configs/dockstar_defconfig |   3 +
 configs/dreamplug_defconfig|   3 +
 configs/goflexhome_defconfig   |   3 +
 configs/iconnect_defconfig |   3 +
 configs/pogo_e02_defconfig |   3 +
 configs/sheevaplug_defconfig   |   3 +
 configs/turris_omnia_defconfig |   2 +
 include/configs/turris_mox.h   |   1 +
 tools/kwboot.c |   2 +-
 tools/termios_linux.h  |   1 +
 26 files changed, 340 insertions(+), 56 deletions(-)


Re: [PATCH v2 1/3] rockpi4: capsule: Add functions needed for supporting capsule updates

2022-09-13 Thread Sughosh Ganu
hi Peter,

On Fri, 9 Sept 2022 at 18:07, Peter Robinson  wrote:
>
> Hi Sughosh,
>
> Small nit of the subject, it should substitute rockpi for rockchip: if
> the functions are generic.

I will change it to rockchip.

>
> > Add functions needed to support the UEFI capsule update feature on
> > rockchip boards. Currently, the feature is being enabled on the
> > RockPi4 boards with firmware images residing on GPT partitioned
> > storage media.
> >
> > Signed-off-by: Sughosh Ganu 
> > ---
> > Changes since V1:
> > * Move the capsule update related functions to a more common place
> >   under mach-rockchip to facilitate further reuse.
> >
> >  arch/arm/mach-rockchip/Kconfig  |   1 +
> >  arch/arm/mach-rockchip/board.c  | 185 
> >  include/configs/rk3399_common.h |  16 +++
> >  3 files changed, 202 insertions(+)
> >
> > diff --git a/arch/arm/mach-rockchip/Kconfig b/arch/arm/mach-rockchip/Kconfig
> > index c561a77e6a..7fac13c8ee 100644
> > --- a/arch/arm/mach-rockchip/Kconfig
> > +++ b/arch/arm/mach-rockchip/Kconfig
> > @@ -246,6 +246,7 @@ config ROCKCHIP_RK3399
> > select DM_PMIC
> > select DM_REGULATOR_FIXED
> > select BOARD_LATE_INIT
> > +   imply PARTITION_TYPE_GUID
> > imply PRE_CONSOLE_BUFFER
> > imply ROCKCHIP_COMMON_BOARD
> > imply ROCKCHIP_SDRAM_COMMON
> > diff --git a/arch/arm/mach-rockchip/board.c b/arch/arm/mach-rockchip/board.c
> > index cbe00d646c..d35d6a5965 100644
> > --- a/arch/arm/mach-rockchip/board.c
> > +++ b/arch/arm/mach-rockchip/board.c
> > @@ -6,11 +6,15 @@
> >  #include 
> >  #include 
> >  #include 
> > +#include 
> >  #include 
> >  #include 
> >  #include 
> > +#include 
> > +#include 
> >  #include 
> >  #include 
> > +#include 
> >  #include 
> >  #include 
> >  #include 
> > @@ -22,8 +26,189 @@
> >
> >  DECLARE_GLOBAL_DATA_PTR;
> >
> > +#if defined(CONFIG_EFI_HAVE_CAPSULE_SUPPORT) && 
> > defined(CONFIG_EFI_PARTITION)
> > +
> > +#define DFU_ALT_BUF_LENSZ_1K
> > +#define ROCKPI4_UPDATABLE_IMAGES   2
>
> The naming should be either made generic so it's suitable for all
> rockchip devices, or be in the device specific fills.

The above macro is not needed in this file. We can use
num_image_type_guids instead of the macro. I will change this in the
next version.

>
> > +extern struct efi_fw_image fw_images[];
> > +
> > +static bool board_is_rockpi_4b(void)
>
> Same. Ultimately it looks like you've just moved the code from one
> location to another. The way I see it:
> * Generic functions with generic rockchip naming that are reusable
> across any rockchip device that wishes to use capsule updates
> * Board specific functions/variables etc in the board specific files.

Okay. Based on your comments on V1, I was under the impression that
you wanted me to move the code to a more generic location where it can
be used by other rockchip boards. I have now moved the board specific
bits to evb_rk3399.c keeping the computation of the image index and
population of the dfu_alt_info in the board.c file. I will send the V3
shortly.

-sughosh

>
> > +{
> > +   return CONFIG_IS_ENABLED(TARGET_EVB_RK3399) &&
> > +   of_machine_is_compatible("radxa,rockpi4b");
> > +}
> > +
> > +static bool board_is_rockpi_4c(void)
> > +{
> > +   return CONFIG_IS_ENABLED(TARGET_EVB_RK3399) &&
> > +   of_machine_is_compatible("radxa,rockpi4c");
> > +}
> > +
> > +static bool updatable_image(struct disk_partition *info)
> > +{
> > +   int i;
> > +   bool ret = false;
> > +   efi_guid_t image_type_guid;
> > +
> > +   uuid_str_to_bin(info->type_guid, image_type_guid.b,
> > +   UUID_STR_FORMAT_GUID);
> > +
> > +   for (i = 0; i < ROCKPI4_UPDATABLE_IMAGES; i++) {
> > +   if (!guidcmp(_images[i].image_type_id, 
> > _type_guid)) {
> > +   ret = true;
> > +   break;
> > +   }
> > +   }
> > +
> > +   return ret;
> > +}
> > +
> > +static void set_image_index(struct disk_partition *info, int index)
> > +{
> > +   int i;
> > +   efi_guid_t image_type_guid;
> > +
> > +   uuid_str_to_bin(info->type_guid, image_type_guid.b,
> > +   UUID_STR_FORMAT_GUID);
> > +
> > +   for (i = 0; i < ROCKPI4_UPDATABLE_IMAGES; i++) {
> > +   if (!guidcmp(_images[i].image_type_id, 
> > _type_guid)) {
> > +   fw_images[i].image_index = index;
> > +   break;
> > +   }
> > +   }
> > +}
> > +
> > +static int get_mmc_desc(struct blk_desc **desc)
> > +{
> > +   int ret;
> > +   struct mmc *mmc;
> > +   struct udevice *dev;
> > +
> > +   /*
> > +* For now the firmware images are assumed to
> > +* be on the SD card
> > +*/
> > +   ret = uclass_get_device(UCLASS_MMC, 1, );
> > +   if (ret)
> > +   return -1;
> > +
> > +   mmc = mmc_get_mmc_dev(dev);

[PATCH v3] video: simplefb: add rotation support

2022-09-13 Thread Takumi Sueda
It introduces the way to rotate the screen for boards with rotated screen.

Signed-off-by: Takumi Sueda 
---
 drivers/video/simplefb.c | 6 +-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/video/simplefb.c b/drivers/video/simplefb.c
index 2b0d8835e3..235ec761f7 100644
--- a/drivers/video/simplefb.c
+++ b/drivers/video/simplefb.c
@@ -43,7 +43,11 @@ static int simple_video_probe(struct udevice *dev)
 
uc_priv->xsize = fdtdec_get_uint(blob, node, "width", 0);
uc_priv->ysize = fdtdec_get_uint(blob, node, "height", 0);
-   uc_priv->rot = 0;
+   uc_priv->rot = fdtdec_get_uint(blob, node, "rot", 0);
+   if (uc_priv->rot > 3) {
+   log_debug("%s: invalid rot\n", __func__);
+   return log_msg_ret("rot", -EINVAL);
+   }
 
format = fdt_getprop(blob, node, "format", NULL);
debug("%s: %dx%d@%s\n", __func__, uc_priv->xsize, uc_priv->ysize, 
format);
-- 
2.20.1



Re: [PATCH v2 2/3] rockpi4: board: Add firmware image information needed for capsule updates

2022-09-13 Thread Sughosh Ganu
hi Peter,

On Fri, 9 Sept 2022 at 18:12, Peter Robinson  wrote:
>
> On Tue, Sep 6, 2022 at 7:59 AM Sughosh Ganu  wrote:
> >
> > Add information that will be needed for enabling the UEFI capsule
> > update feature on the RockPi4 boards. With the feature enabled, it
> > would be possible to update the idbloader and u-boot.itb images on the
> > RockPi4B and RockPi4C variants.
> >
> > Signed-off-by: Sughosh Ganu 
> > ---
> > Changes since V1:
> > * Split the board related declarations into a separate patch.
> >
> >  board/rockchip/evb_rk3399/evb-rk3399.c | 14 ++
> >  1 file changed, 14 insertions(+)
> >
> > diff --git a/board/rockchip/evb_rk3399/evb-rk3399.c 
> > b/board/rockchip/evb_rk3399/evb-rk3399.c
> > index abb76585cf..abb0580a8e 100644
> > --- a/board/rockchip/evb_rk3399/evb-rk3399.c
> > +++ b/board/rockchip/evb_rk3399/evb-rk3399.c
> > @@ -5,11 +5,25 @@
> >
> >  #include 
> >  #include 
> > +#include 
> >  #include 
> >  #include 
> >  #include 
> > +#include 
> >  #include 
> >
> > +#define ROCKPI4_UPDATABLE_IMAGES   2
>
> Any reason the above isn't defineable in the config file?

Do you mean through a Kconfig symbol? Currently, RockPi4 is the only
board for which such a macro is needed. The rest of the boards which
enable capsule updates define the fw_images array statically and the
number of images can be computed without a need for a config symbol.
So I did not want to add a Kconfig symbol when it won't be needed for
a majority of the boards.

-sughosh

>
> > +#if CONFIG_IS_ENABLED(EFI_HAVE_CAPSULE_SUPPORT)
> > +struct efi_fw_image fw_images[ROCKPI4_UPDATABLE_IMAGES] = {0};
> > +
> > +struct efi_capsule_update_info update_info = {
> > +   .images = fw_images,
> > +};
> > +
> > +u8 num_image_type_guids = ARRAY_SIZE(fw_images);
> > +#endif
> > +
> >  #ifndef CONFIG_SPL_BUILD
> >  int board_early_init_f(void)
> >  {
> > --
> > 2.34.1
> >


Re: [PATCH v2 1/1] video: simplefb: Add rotation support

2022-09-13 Thread Takumi Sueda
On Tue, Sep 13, 2022 at 06:21:10PM +0900, Takumi Sueda wrote:
> Signed-off-by: Takumi Sueda 
> ---
>  drivers/video/simplefb.c | 6 +-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/video/simplefb.c b/drivers/video/simplefb.c
> index 2b0d8835e3..235ec761f7 100644
> --- a/drivers/video/simplefb.c
> +++ b/drivers/video/simplefb.c
> @@ -43,7 +43,11 @@ static int simple_video_probe(struct udevice *dev)
>  
>   uc_priv->xsize = fdtdec_get_uint(blob, node, "width", 0);
>   uc_priv->ysize = fdtdec_get_uint(blob, node, "height", 0);
> - uc_priv->rot = 0;
> + uc_priv->rot = fdtdec_get_uint(blob, node, "rot", 0);
> + if (uc_priv->rot > 3) {
> + log_debug("%s: invalid rot\n", __func__);
> + return log_msg_ret("rot", -EINVAL);
> + }
>  
>   format = fdt_getprop(blob, node, "format", NULL);
>   debug("%s: %dx%d@%s\n", __func__, uc_priv->xsize, uc_priv->ysize, 
> format);
> -- 
> 2.20.1
> 

Uh oh, I forgot to add the description. I'll send the v3.
Sorry for sending an incomplete patch.

Takumi


[PATCH v2 1/1] video: simplefb: Add rotation support

2022-09-13 Thread Takumi Sueda
Signed-off-by: Takumi Sueda 
---
 drivers/video/simplefb.c | 6 +-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/video/simplefb.c b/drivers/video/simplefb.c
index 2b0d8835e3..235ec761f7 100644
--- a/drivers/video/simplefb.c
+++ b/drivers/video/simplefb.c
@@ -43,7 +43,11 @@ static int simple_video_probe(struct udevice *dev)
 
uc_priv->xsize = fdtdec_get_uint(blob, node, "width", 0);
uc_priv->ysize = fdtdec_get_uint(blob, node, "height", 0);
-   uc_priv->rot = 0;
+   uc_priv->rot = fdtdec_get_uint(blob, node, "rot", 0);
+   if (uc_priv->rot > 3) {
+   log_debug("%s: invalid rot\n", __func__);
+   return log_msg_ret("rot", -EINVAL);
+   }
 
format = fdt_getprop(blob, node, "format", NULL);
debug("%s: %dx%d@%s\n", __func__, uc_priv->xsize, uc_priv->ysize, 
format);
-- 
2.20.1



Re: [PATCH v2] binman: Get futility by building it

2022-09-13 Thread Quentin Schulz

Hi Simon,

On 9/12/22 15:35, Simon Glass wrote:

A binary download is not great, since it depends on libraries being
present in the system. Build futility from source instead.

Note that this requires two patches to the source repo which are in
progress:


https://urldefense.proofpoint.com/v2/url?u=https-3A__issuetracker.google.com_issues_245993083-3Fpli-3D1=DwIDAg=_sEr5x9kUWhuk4_nFwjJtA=LYjLexDn7rXIzVmkNPvw5ymA1XTSqHGq8yBP6m6qZZ4njZguQhZhkI_-172IIy1t=aZRnLGuudyF3wf57Yf7GAac-g9Rgf3zQuq1O9GJPIdIhZ_w2XDHpPsZGFQAIMFT9=j0aTJGKOhRncvmyFptYpT_Y9Qb3U3CDUiqG2jO_7hAQ=

Signed-off-by: Simon Glass 
---

Changes in v2:
- Pull from github instead, to avoid needing to login / gitcookies

  tools/binman/bintool.py| 17 +
  tools/binman/btool/futility.py | 12 
  2 files changed, 21 insertions(+), 8 deletions(-)

diff --git a/tools/binman/bintool.py b/tools/binman/bintool.py
index 032179a99de..52ec0030590 100644
--- a/tools/binman/bintool.py
+++ b/tools/binman/bintool.py
@@ -319,7 +319,8 @@ class Bintool:
  return result.stdout
  
  @classmethod

-def build_from_git(cls, git_repo, make_target, bintool_path):
+def build_from_git(cls, git_repo, make_target, bintool_path, flags=None,
+   branch=None):
  """Build a bintool from a git repo
  
  This clones the repo in a temporary directory, builds it with 'make',

@@ -330,6 +331,8 @@ class Bintool:
  make_target (str): Target to pass to 'make' to build the tool
  bintool_path (str): Relative path of the tool in the repo, after
  build is complete
+flags (list of str): Flags or variables to pass to make, or None
+branch (str): Branch to build, None for the default
  
  Returns:

  tuple:
@@ -339,10 +342,16 @@ class Bintool:
  """
  tmpdir = tempfile.mkdtemp(prefix='binmanf.')
  print(f"- clone git repo '{git_repo}' to '{tmpdir}'")
-tools.run('git', 'clone', '--depth', '1', git_repo, tmpdir)
+args = ['git', 'clone', '--depth', '1']
+if branch:
+args += ['-b', branch]


I don't like branches too much, a commit hash would probably be better 
for reproducibility, we would need a git checkout command though since 
git clone command does not allow for commit hashes AFAIR. Up to you I guess.



+tools.run(*args, git_repo, tmpdir)
  print(f"- build target '{make_target}'")
-tools.run('make', '-C', tmpdir, '-j', f'{multiprocessing.cpu_count()}',
-  make_target)
+cmd = ['make', '-C', tmpdir, '-j', f'{multiprocessing.cpu_count()}',
+   make_target]
+if flags:
+cmd += flags > +tools.run(*cmd)
  fname = os.path.join(tmpdir, bintool_path)
  if not os.path.exists(fname):
  print(f"- File '{fname}' was not produced")
diff --git a/tools/binman/btool/futility.py b/tools/binman/btool/futility.py
index 75a05c2ac66..121a366830b 100644
--- a/tools/binman/btool/futility.py
+++ b/tools/binman/btool/futility.py
@@ -160,8 +160,12 @@ class Bintoolfutility(bintool.Bintool):
  Raises:
  Valuerror: Fetching could not be completed
  """
-if method != bintool.FETCH_BIN:
+if method != bintool.FETCH_BUILD:
  return None
-fname, tmpdir = self.fetch_from_drive(
-'1hdsInzsE4aJbmBeJ663kYgjOQyW1I-E0')
-return fname, tmpdir
+result = self.build_from_git(
+
'https://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_sjg20_vboot-5Freference.git=DwIDAg=_sEr5x9kUWhuk4_nFwjJtA=LYjLexDn7rXIzVmkNPvw5ymA1XTSqHGq8yBP6m6qZZ4njZguQhZhkI_-172IIy1t=aZRnLGuudyF3wf57Yf7GAac-g9Rgf3zQuq1O9GJPIdIhZ_w2XDHpPsZGFQAIMFT9=4I4vh_QaOw3S9ET9XnKHOHUkf7Qu3SGMGfUKNe5Uxe4=
  ',
+'all',
+'build/futility/futility',
+flags=['USE_FLASHROM=0'],
+branch='fut')
+return result


Seems to be doing the job, it fetches and builds the futility binary. 
Having some hard time figuring out how to test it produces a valid 
binary it seems most of the calls to futility in ftest.py are faked/mocked?


Also, would be great to have the DOWNLOAD_DESTDIR part of toolpath as I 
found it quite surprising to run binman tool -f missing and still have 
the binary not appear when running binman tool --list. But that's not 
related to this commit :)


Cheers,
Quentin


Re: [PATCH] video: simplefb: Add rotation support

2022-09-13 Thread Takumi Sueda
On Mon, Sep 12, 2022 at 07:34:38AM -0600, Simon Glass wrote:
> On Mon, 12 Sept 2022 at 06:15, Takumi Sueda  wrote:
> >
> > It introduces the way to rotate the screen for boards with rotated screen.
> >
> > Signed-off-by: Takumi Sueda 
> > ---
> >  drivers/video/simplefb.c | 6 +-
> >  1 file changed, 5 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/video/simplefb.c b/drivers/video/simplefb.c
> > index 2b0d8835e3..dbf55ba64d 100644
> > --- a/drivers/video/simplefb.c
> > +++ b/drivers/video/simplefb.c
> > @@ -43,7 +43,11 @@ static int simple_video_probe(struct udevice *dev)
> >
> > uc_priv->xsize = fdtdec_get_uint(blob, node, "width", 0);
> > uc_priv->ysize = fdtdec_get_uint(blob, node, "height", 0);
> > -   uc_priv->rot = 0;
> > +   uc_priv->rot = fdtdec_get_uint(blob, node, "rot", 0);
> > +   if (uc_priv->rot > 3) {
> > +   printf("%s: invalid rot\n", __func__);
> 
> log_debug()
> 
> This is a driver so should not print messages
> 
> > +   return -EINVAL;
> 
> You can use
> 
>return log_msg_ret("rot", -EINVAL)
> 
> if you like, since then it could be logged when
> CONFIG_LOG_ERROR_RETURN is enabled.
> 
> > +   }
> >
> > format = fdt_getprop(blob, node, "format", NULL);
> > debug("%s: %dx%d@%s\n", __func__, uc_priv->xsize, uc_priv->ysize, 
> > format);
> > --
> > 2.20.1
> >
> 
> Regards,
> Simon

Hi Simon, thanks for the review.

The printf() was copied from the next error return, but the method you
proposed me sounds better for debugging since printf() is uncontrollable.

I'll send a v2 patch later.

Thanks again,
Takumi


Re: [PATCH v17 09/10] doc:eficonfig: add documentation for eficonfig command

2022-09-13 Thread Masahisa Kojima
On Tue, 13 Sept 2022 at 16:02, Heinrich Schuchardt  wrote:
>
> On 9/12/22 10:33, Masahisa Kojima wrote:
> > Add documentation for eficonfig command.
> >
> > Signed-off-by: Masahisa Kojima 
> > Reviewed-by: Ilias Apalodimas 
> > ---
> > No update since v15
> >
> > Changes in v14:
> > - fix typos
> >
> > Changes in v13:
> > - describe how to auto boot according to the UEFI Boot option
> >
> > Changes in v12:
> > - CONFIG_BOOTMENU_DISABLE_UBOOT_CONSOLE condition is added
> >to show newly added boot option
> >
> > No update since v10
> >
> > Changes in v10:
> > - describe how to boot system after editting by eficonfig
> >
> > Changes in v8:
> > - command name is changed from "efimenu" to "eficonfig"
> >
> > Newly created in v7
> >
> >   doc/usage/cmd/eficonfig.rst | 71 +
> >   doc/usage/index.rst |  1 +
> >   2 files changed, 72 insertions(+)
> >   create mode 100644 doc/usage/cmd/eficonfig.rst
> >
> > diff --git a/doc/usage/cmd/eficonfig.rst b/doc/usage/cmd/eficonfig.rst
> > new file mode 100644
> > index 00..340ebc80db
> > --- /dev/null
> > +++ b/doc/usage/cmd/eficonfig.rst
> > @@ -0,0 +1,71 @@
> > +.. SPDX-License-Identifier: GPL-2.0+
> > +.. (C) Copyright 2022, Masahisa Kojima 
> > +
> > +eficonfig command
> > +=
> > +
> > +Synopsis
> > +
> > +::
> > +
> > +eficonfig
> > +
> > +Description
> > +---
> > +
> > +The "eficonfig" command uses U-Boot menu interface and provides
> > +a menu-driven UEFI variable maintenance feature.
> > +The "eficonfig" has the following menu entries.
> > +
> > +Add Boot Option
> > +Add new UEFI Boot Option.
> > +User can edit description, file path, and optional_data.
> > +
> > +Edit Boot Option
> > +Edit the existing UEFI Boot Option
> > +User can edit description, file path, and optional_data.
> > +
> > +Change Boot Order
> > +Change the order of UEFI BootOrder variable.
> > +
> > +Delete Boot Option
> > +Delete the UEFI Boot Option
> > +
> > +Configuration
> > +-
> > +
> > +The "eficonfig" command is enabled by::
> > +
> > +CONFIG_CMD_EFICONFIG=y
> > +
> > +If CONFIG_BOOTMENU_DISABLE_UBOOT_CONSOLE is enabled, user can not enter
> > +U-Boot console. In this case, bootmenu can be used to invoke "eficonfig"::
> > +
> > +CONFIG_USE_PREBOOT=y
> > +CONFIG_PREBOOT="setenv bootmenu_0 UEFI Maintenance Menu=eficonfig"
>
> The following question is about the bootmenu command itself and beyond
> the scope of this series:
>
> It seems that bootmenu can only handle bootmenu_## variables correctly
> if they are consecutively numbered from 0. Wouldn't it be preferable to
> be able to define a variable bootmenu_98 that is placed at the end?

I don't fully understand this question.
What is the purpose of defining the variable bootmenu_98 at the end?

I guess you think the "UEFI Maintenance Menu" should appear at the end
in bootmenu.
But the bootmenu order with this series is that UEFI BOOT entry
follows bootmenu_xx.

Thanks,
Masahisa Kojima

>
> Best regards
>
> Heinrich
>
> > +
> > +How to boot the system with newly added UEFI Boot Option
> > +
> > +
> > +"eficonfig" command is responsible for configuring the UEFI variables,
> > +not directly handle the system boot.
> > +The new Boot Option added by "eficonfig" is appended at the last entry
> > +of UEFI BootOrder variable, user may want to change the boot order
> > +through "Change Boot Order".
> > +If the bootmenu is enabled, CONFIG_BOOTMENU_DISABLE_UBOOT_CONSOLE is 
> > enabled,
> > +and "eficonfig" is configured as preboot command, the newly added Boot 
> > Options
> > +are enumerated in the bootmenu when user exits from the eficonfig menu.
> > +User may select the entry in the bootmenu to boot the system, or follow
> > +the U-Boot configuration the system already has.
> > +
> > +Auto boot with the UEFI Boot Option
> > +'''
> > +
> > +To do auto boot according to the UEFI BootOrder variable,
> > +add "bootefi bootmgr" entry as a default or first bootmenu entry::
> > +
> > +CONFIG_PREBOOT="setenv bootmenu_0 UEFI Boot Manager=bootefi bootmgr; 
> > setenv bootmenu_1 UEFI Maintenance Menu=eficonfig"
> > +
> > +See also
> > +
> > +* :doc:`bootmenu` provides a simple mechanism for creating menus 
> > with different boot items
> > diff --git a/doc/usage/index.rst b/doc/usage/index.rst
> > index 28f9683a3e..09f2928970 100644
> > --- a/doc/usage/index.rst
> > +++ b/doc/usage/index.rst
> > @@ -35,6 +35,7 @@ Shell commands
> >  cmd/conitrace
> >  cmd/dm
> >  cmd/echo
> > +   cmd/eficonfig
> >  cmd/env
> >  cmd/event
> >  cmd/exception
>


Re: imx8mq allocation issue

2022-09-13 Thread Heiko Thiery
Hi Peng,

Am Di., 13. Sept. 2022 um 09:00 Uhr schrieb Peng Fan :
>
>
>
> On 9/12/2022 3:48 PM, Heiko Thiery wrote:
> > Hi Peng,
> >
> > Am Mo., 12. Sept. 2022 um 09:26 Uhr schrieb Peng Fan :
> >>
> >>
> >>
> >> On 9/9/2022 5:12 PM, Heiko Thiery wrote:
> >>> HI,
> >>>
> >>> I think on the imx8mq platform we have a problem with the introduction
> >>> of the clock driver. I tried to debug the problem that the pitx-imx8m
> >>> board was not able to start for some time. I was wondering why the
> >>> pitx-im8m doesn't work anymore although the imx8mq_evk is running.
> >>>
> >>> So I switched to the imx8mq_evk for counter testing. As I already
> >>> figured out in [1] also the imx8mq_evk is not able to start properly.
> >>>
> >>> On the EVK I enabled the DEBUG_UART and see the outputs below. I
> >>> suspect all imx8mq boards have this problem.
> >>>
> >>> CONFIG_DEBUG_UART_BASE=0x3086  # for uart1
> >>> CONFIG_DEBUG_UART_CLOCK=2400
> >>>
> >>> --- 8< 
> >>> U-Boot SPL 2022.10-rc4-00038-ge3fce5e560-dirty (Sep 09 2022 - 10:51:29 
> >>> +0200)
> >>> PMIC:  PFUZE100 ID=0x10
> >>> SEC0:  RNG instantiated
> >>> Normal Boot
> >>> Trying to boot from MMC2
> >>> clk_register: failed to get  device (parent of ckil)
> >>> clk_register: failed to get  device (parent of clock-osc-27m)
> >>> alloc space exhausted
> >>> alloc space exhausted
> >>> alloc space exhausted
> >>> alloc space exhausted
> >>
> >> Seems SPL_DM_CLK consumes the malloc space, so you meet such error.
> >>
> >
> > I dont think the SPL is the problem. Because the output appears after
> > "Trying to boot from MMC2".
> Do you have time to give a try?
>
> diff --git a/configs/imx8mq_evk_defconfig b/configs/imx8mq_evk_defconfig
> index cf207295e54..14b49ab5906 100644
> --- a/configs/imx8mq_evk_defconfig
> +++ b/configs/imx8mq_evk_defconfig
> @@ -2,6 +2,7 @@ CONFIG_ARM=y
>   CONFIG_ARCH_IMX8M=y
>   CONFIG_SYS_TEXT_BASE=0x4020
>   CONFIG_SYS_MALLOC_LEN=0x60
> +CONFIG_SYS_MALLOC_F_LEN=0x2800
>   CONFIG_SPL_GPIO=y
>   CONFIG_SPL_LIBCOMMON_SUPPORT=y
>   CONFIG_SPL_LIBGENERIC_SUPPORT=y
> @@ -36,7 +37,7 @@ CONFIG_SPL_BSS_START_ADDR=0x18
>   CONFIG_SPL_BSS_MAX_SIZE=0x2000
>   CONFIG_SPL_BOARD_INIT=y
>   # CONFIG_SPL_SHARES_INIT_SP_ADDR is not set
> -CONFIG_SPL_STACK=0x187ff0
> +CONFIG_SPL_STACK=0x188000
>   CONFIG_SYS_SPL_MALLOC=y
>   CONFIG_HAS_CUSTOM_SPL_MALLOC_START=y
>   CONFIG_CUSTOM_SYS_SPL_MALLOC_ADDR=0x4220
> diff --git a/include/configs/imx8mq_evk.h b/include/configs/imx8mq_evk.h
> index ea4305667f2..728b4f7e665 100644
> --- a/include/configs/imx8mq_evk.h
> +++ b/include/configs/imx8mq_evk.h
> @@ -16,8 +16,6 @@
>   /*#define CONFIG_ENABLE_DDR_TRAINING_DEBUG*/
>   #define CONFIG_SYS_SPL_PTE_RAM_BASE0x4158
>
> -/* malloc f used before GD_FLG_FULL_MALLOC_INIT set */
> -#define CONFIG_MALLOC_F_ADDR   0x182000
>   /* For RAW image gives a error info not panic */
>
>   #define CONFIG_POWER_PFUZE100
>

This has no positive effect.


By the way: I have to remove the hdmi_phy node. Otherwise the board is
no longer able to start:

--- 8< ---
U-Boot SPL 2022.10-rc4-00038-ge3fce5e560-dirty (Sep 13 2022 - 09:20:21 +0200)
pmic_alloc: No available memory for allocation!
power_pfuze100_init: POWER allocation error!
SEC0:  RNG instantiated
Normal Boot
Trying to boot from MMC2
þ
U-Boot SPL 2022.10-rc4-00038-ge3fce5e560-dirty (Sep 13 2022 - 09:20:21 +0200)
pmic_alloc: No available memory for allocation!
power_pfuze100_init: POWER allocation error!
SEC0:  RNG instantiated
Normal Boot
Trying to boot from MMC2
:
--- 8< ---

diff --git a/arch/arm/dts/imx8mq.dtsi b/arch/arm/dts/imx8mq.dtsi
index 49eadb081b..e0d1fd2b02 100644
--- a/arch/arm/dts/imx8mq.dtsi
+++ b/arch/arm/dts/imx8mq.dtsi
@@ -63,12 +63,12 @@
clock-output-names = "osc_27m";
};

-   hdmi_phy_27m: clock-hdmi-phy-27m {
-   compatible = "fixed-clock";
-   #clock-cells = <0>;
-   clock-frequency = <2700>;
-   clock-output-names = "hdmi_phy_27m";
-   };
+// hdmi_phy_27m: clock-hdmi-phy-27m {
+// compatible = "fixed-clock";
+// #clock-cells = <0>;
+// clock-frequency = <2700>;
+// clock-output-names = "hdmi_phy_27m";
+// };

clk_ext1: clock-ext1 {
compatible = "fixed-clock";

-- 
Heiko

> Thanks,
> Peng.
> >


Re: [PATCH] arm: mvebu: Mark constant data with const keyword

2022-09-13 Thread Stefan Roese

On 09.09.22 14:41, Pali Rohár wrote:

Signed-off-by: Pali Rohár 


Applied to u-boot-marvell/master

Thanks,
Stefan


---
  arch/arm/mach-kirkwood/cpu.c  | 2 +-
  arch/arm/mach-kirkwood/include/mach/cpu.h | 2 +-
  arch/arm/mach-mvebu/cpu.c | 2 +-
  arch/arm/mach-mvebu/include/mach/cpu.h| 2 +-
  arch/arm/mach-mvebu/mbus.c| 2 +-
  arch/arm/mach-mvebu/serdes/a38x/high_speed_env_spec.c | 2 +-
  arch/arm/mach-mvebu/system-controller.c   | 2 +-
  7 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/arch/arm/mach-kirkwood/cpu.c b/arch/arm/mach-kirkwood/cpu.c
index 80f893ab369a..df3e8f11782a 100644
--- a/arch/arm/mach-kirkwood/cpu.c
+++ b/arch/arm/mach-kirkwood/cpu.c
@@ -52,7 +52,7 @@ unsigned int kw_winctrl_calcsize(unsigned int sizeval)
return (0x & j);
  }
  
-static struct mbus_win windows[] = {

+static const struct mbus_win windows[] = {
/* Window 0: PCIE MEM address space */
{ KW_DEFADR_PCI_MEM, KW_DEFADR_PCI_MEM_SIZE,
  KWCPU_TARGET_PCIE, KWCPU_ATTR_PCIE_MEM },
diff --git a/arch/arm/mach-kirkwood/include/mach/cpu.h 
b/arch/arm/mach-kirkwood/include/mach/cpu.h
index d8639c60352b..9eec786fe8fc 100644
--- a/arch/arm/mach-kirkwood/include/mach/cpu.h
+++ b/arch/arm/mach-kirkwood/include/mach/cpu.h
@@ -150,7 +150,7 @@ struct kwgpio_registers {
  unsigned int mvebu_sdram_bar(enum memory_bank bank);
  unsigned int mvebu_sdram_bs(enum memory_bank bank);
  void mvebu_sdram_size_adjust(enum memory_bank bank);
-int mvebu_mbus_probe(struct mbus_win windows[], int count);
+int mvebu_mbus_probe(const struct mbus_win windows[], int count);
  void mvebu_config_gpio(unsigned int gpp0_oe_val, unsigned int gpp1_oe_val,
unsigned int gpp0_oe, unsigned int gpp1_oe);
  int kw_config_mpp(unsigned int mpp0_7, unsigned int mpp8_15,
diff --git a/arch/arm/mach-mvebu/cpu.c b/arch/arm/mach-mvebu/cpu.c
index 9a80440d1a9e..1f8cdf8744e6 100644
--- a/arch/arm/mach-mvebu/cpu.c
+++ b/arch/arm/mach-mvebu/cpu.c
@@ -20,7 +20,7 @@
  #define DDR_BASE_CS_OFF(n)(0x + ((n) << 3))
  #define DDR_SIZE_CS_OFF(n)(0x0004 + ((n) << 3))
  
-static struct mbus_win windows[] = {

+static const struct mbus_win windows[] = {
/* SPI */
{ MBUS_SPI_BASE, MBUS_SPI_SIZE,
  CPU_TARGET_DEVICEBUS_BOOTROM_SPI, CPU_ATTR_SPIFLASH },
diff --git a/arch/arm/mach-mvebu/include/mach/cpu.h 
b/arch/arm/mach-mvebu/include/mach/cpu.h
index 3de10de745ef..574a9264172c 100644
--- a/arch/arm/mach-mvebu/include/mach/cpu.h
+++ b/arch/arm/mach-mvebu/include/mach/cpu.h
@@ -139,7 +139,7 @@ extern u8 serdes_pex_pulse_width[];
  unsigned int mvebu_sdram_bar(enum memory_bank bank);
  unsigned int mvebu_sdram_bs(enum memory_bank bank);
  void mvebu_sdram_size_adjust(enum memory_bank bank);
-int mvebu_mbus_probe(struct mbus_win windows[], int count);
+int mvebu_mbus_probe(const struct mbus_win windows[], int count);
  u32 mvebu_get_nand_clock(void);
  
  void __noreturn return_to_bootrom(void);

diff --git a/arch/arm/mach-mvebu/mbus.c b/arch/arm/mach-mvebu/mbus.c
index 7092f6cc10c2..959ca8e92602 100644
--- a/arch/arm/mach-mvebu/mbus.c
+++ b/arch/arm/mach-mvebu/mbus.c
@@ -469,7 +469,7 @@ int mbus_dt_setup_win(u32 base, u32 size, u8 target, u8 
attr)
return 0;
  }
  
-int mvebu_mbus_probe(struct mbus_win windows[], int count)

+int mvebu_mbus_probe(const struct mbus_win windows[], int count)
  {
int win;
int ret;
diff --git a/arch/arm/mach-mvebu/serdes/a38x/high_speed_env_spec.c 
b/arch/arm/mach-mvebu/serdes/a38x/high_speed_env_spec.c
index 4a4f93ccf93f..ac98dee2993d 100644
--- a/arch/arm/mach-mvebu/serdes/a38x/high_speed_env_spec.c
+++ b/arch/arm/mach-mvebu/serdes/a38x/high_speed_env_spec.c
@@ -108,7 +108,7 @@ struct serdes_unit_data {
u8 serdes_unit_num;
  };
  
-static struct serdes_unit_data serdes_type_to_unit_info[] = {

+static const struct serdes_unit_data serdes_type_to_unit_info[] = {
{PEX_UNIT_ID, 0,},
{PEX_UNIT_ID, 1,},
{PEX_UNIT_ID, 2,},
diff --git a/arch/arm/mach-mvebu/system-controller.c 
b/arch/arm/mach-mvebu/system-controller.c
index ea858b269e82..e90aff0c3379 100644
--- a/arch/arm/mach-mvebu/system-controller.c
+++ b/arch/arm/mach-mvebu/system-controller.c
@@ -86,7 +86,7 @@ static const struct udevice_id mvebu_reset_of_match[] = {
{ },
  };
  
-static struct reset_ops mvebu_reset_ops = {

+static const struct reset_ops mvebu_reset_ops = {
.of_xlate = mvebu_reset_of_xlate,
.request = mvebu_reset_request,
.rfree = mvebu_reset_free,


Viele Grüße,
Stefan Roese

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


Re: [PATCH] arm: mvebu: turris_omnia: Allow to use second serial port

2022-09-13 Thread Stefan Roese

On 09.09.22 14:18, Pali Rohár wrote:

Turris Omnia has two serial ports. Both are already specified in device
tree file. But U-Boot by default does not allow to use more than one serial
port unless CONFIG_SERIAL_PROBE_ALL is not enabled.

After enabling CONFIG_SERIAL_PROBE_ALL, U-Boot see also second serial port
(but is inactive by default):

 => coninfo
 List of available devices:
 serial@12000 0007 IO stdin stdout stderr
 serial@12100 0007 IO

To allow simultaneously to use more input / output devices it is needed to
enable CONFIG_CONSOLE_MUX option.

With CONFIG_CONSOLE_MUX it is possible to call:

 => setenv stdout 'serial@12000,serial@12100'

And U-Boot output is then visible on both serial ports.

Signed-off-by: Pali Rohár 


Applied to u-boot-marvell/master

Thanks,
Stefan


---
  configs/turris_omnia_defconfig | 2 ++
  1 file changed, 2 insertions(+)

diff --git a/configs/turris_omnia_defconfig b/configs/turris_omnia_defconfig
index 4c9ec744e1b5..01dee5472200 100644
--- a/configs/turris_omnia_defconfig
+++ b/configs/turris_omnia_defconfig
@@ -35,6 +35,7 @@ CONFIG_FIT_VERBOSE=y
  CONFIG_OF_BOARD_SETUP=y
  CONFIG_BOOTDELAY=3
  CONFIG_USE_PREBOOT=y
+CONFIG_CONSOLE_MUX=y
  CONFIG_SYS_CONSOLE_INFO_QUIET=y
  # CONFIG_DISPLAY_BOARDINFO is not set
  CONFIG_DISPLAY_BOARDINFO_LATE=y
@@ -105,6 +106,7 @@ CONFIG_PINCTRL_ARMADA_38X=y
  CONFIG_DM_RTC=y
  CONFIG_RTC_ARMADA38X=y
  CONFIG_SCSI=y
+CONFIG_SERIAL_PROBE_ALL=y
  CONFIG_SPL_DEBUG_UART_BASE=0xd0012000
  CONFIG_DEBUG_UART_SHIFT=2
  CONFIG_SYS_NS16550=y


Viele Grüße,
Stefan Roese

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


[PATCH 1/1] doc: improve description of autostart

2022-09-13 Thread Heinrich Schuchardt
Complete the list of commands influenced by the autostart environment
variable.

Make it clearer what values qualifies at 'yes'.

Eventually the list of environment variables to be alphabetically sorted.
Move autostart up.

Signed-off-by: Heinrich Schuchardt 
---
 doc/usage/environment.rst | 34 +-
 1 file changed, 21 insertions(+), 13 deletions(-)

diff --git a/doc/usage/environment.rst b/doc/usage/environment.rst
index 561076bac9..7906ace2af 100644
--- a/doc/usage/environment.rst
+++ b/doc/usage/environment.rst
@@ -106,6 +106,27 @@ many cases the value in the default environment comes from 
a CONFIG option - see
 
 This is most-likely not complete:
 
+autostart
+If set to "yes" (actually any string starting with 1, y, Y, t, or T) an
+image loaded with one of the commands listed below will be automatically
+started by internally invoking the bootm command.
+
+* bootelf - Boot from an ELF image in memory
+* bootp - boot image via network using BOOTP/TFTP protocol
+* dhcp - boot image via network using DHCP/TFTP protocol
+* diskboot - boot from ide device
+* nboot - boot from NAND device
+* nfs - boot image via network using NFS protocol
+* rarpboot - boot image via network using RARP/TFTP protocol
+* scsiboot - boot from SCSI device
+* tftpboot - boot image via network using TFTP protocol
+* usbboot - boot from USB device
+
+If the environment variable autostart is not set to a value starting with
+1, y, Y, t, or T, an image passed to the "bootm" command will be copied to
+the load address (and eventually uncompressed), but NOT be started.
+This can be used to load and uncompress arbitrary data.
+
 baudrate
 Used to set the baudrate of the UART - it defaults to CONFIG_BAUDRATE 
(which
 defaults to 115200).
@@ -174,19 +195,6 @@ autoload
 configuration from the BOOTP server, but not try to
 load any image.
 
-autostart
-if set to "yes", an image loaded using the "bootp", "dhcp",
-"rarpboot", "tftpboot" or "diskboot" commands will
-be automatically started (by internally calling
-"bootm")
-
-If unset, or set to "1"/"yes"/"true" (case insensitive, just the first
-character is enough), a standalone image
-passed to the "bootm" command will be copied to the load address
-(and eventually uncompressed), but NOT be started.
-This can be used to load and uncompress arbitrary
-data.
-
 fdt_high
 if set this restricts the maximum address that the
 flattened device tree will be copied into upon boot.
-- 
2.37.2



Re: [PATCH] arm: mvebu: turris_mox: Add support for distroboot $fdt_addr

2022-09-13 Thread Stefan Roese

On 29.08.22 15:44, Pali Rohár wrote:

$fdt_addr is mandatory for systems which provides DTB in HW (e.g. ROM) and
wishes to pass that DTB to Linux.

Turris Mox contains DTB binary in SPI NOR memory at "dtb" partition which
starts at offset 0x7f and is 0x1 bytes long.

Armada 3700 CPU does not allow mapping SPI NOR memory into physical address
space like on other architectures and therefore set $fdt_addr variable to
memory range in RAM and loads this DTB binary from SPI NOR in misc_init_r()
function.

Signed-off-by: Pali Rohár 


Applied to u-boot-marvell/master

Thanks,
Stefan


---
  board/CZ.NIC/turris_mox/turris_mox.c | 48 
  include/configs/turris_mox.h |  1 +
  2 files changed, 49 insertions(+)

diff --git a/board/CZ.NIC/turris_mox/turris_mox.c 
b/board/CZ.NIC/turris_mox/turris_mox.c
index 3dbd68e52366..3402515bbae2 100644
--- a/board/CZ.NIC/turris_mox/turris_mox.c
+++ b/board/CZ.NIC/turris_mox/turris_mox.c
@@ -23,6 +23,7 @@
  #include 
  #include 
  #include 
+#include 
  
  #include "mox_sp.h"
  
@@ -339,6 +340,51 @@ static int get_reset_gpio(struct gpio_desc *reset_gpio)

return 0;
  }
  
+/* Load default system DTB binary to $fdr_addr */

+static void load_spi_dtb(void)
+{
+   const char *const env_name[1] = { "fdt_addr" };
+   unsigned long size, offset;
+   struct udevice *spi_dev;
+   struct spi_flash *flash;
+   const char *addr_str;
+   unsigned long addr;
+   void *buf;
+
+   addr_str = env_get(env_name[0]);
+   if (!addr_str) {
+   env_set_default_vars(1, (char * const *)env_name, 0);
+   addr_str = env_get(env_name[0]);
+   }
+
+   if (!addr_str)
+   return;
+
+   addr = hextoul(addr_str, NULL);
+   if (!addr)
+   return;
+
+   spi_flash_probe_bus_cs(CONFIG_SF_DEFAULT_BUS, CONFIG_SF_DEFAULT_CS, 
_dev);
+   flash = dev_get_uclass_priv(spi_dev);
+   if (!flash)
+   return;
+
+   /*
+* SPI NOR "dtb" partition offset & size hardcoded for now because the
+* mtd subsystem does not offer finding the partition yet and we do not
+* want to reimplement OF partition parser here.
+*/
+   offset = 0x7f;
+   size = 0x1;
+
+   buf = map_physmem(addr, size, MAP_WRBACK);
+   if (!buf)
+   return;
+
+   spi_flash_read(flash, offset, size, buf);
+   unmap_physmem(buf, size);
+}
+
  int misc_init_r(void)
  {
u8 mac[2][6];
@@ -358,6 +404,8 @@ int misc_init_r(void)
eth_env_set_enetaddr_by_index("eth", i, mac[i]);
}
  
+	load_spi_dtb();

+
return 0;
  }
  
diff --git a/include/configs/turris_mox.h b/include/configs/turris_mox.h

index b8ff705ac923..f549f9f7ad06 100644
--- a/include/configs/turris_mox.h
+++ b/include/configs/turris_mox.h
@@ -36,6 +36,7 @@
"bootm 0x580"
  
  #define CONFIG_EXTRA_ENV_SETTINGS\

+   "fdt_addr=0x4c0\0"\
"scriptaddr=0x4d0\0"  \
"pxefile_addr_r=0x4e0\0"  \
"fdt_addr_r=0x4f0\0"  \


Viele Grüße,
Stefan Roese

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


Re: imx8mq allocation issue

2022-09-13 Thread Peng Fan




On 9/12/2022 3:48 PM, Heiko Thiery wrote:

Hi Peng,

Am Mo., 12. Sept. 2022 um 09:26 Uhr schrieb Peng Fan :




On 9/9/2022 5:12 PM, Heiko Thiery wrote:

HI,

I think on the imx8mq platform we have a problem with the introduction
of the clock driver. I tried to debug the problem that the pitx-imx8m
board was not able to start for some time. I was wondering why the
pitx-im8m doesn't work anymore although the imx8mq_evk is running.

So I switched to the imx8mq_evk for counter testing. As I already
figured out in [1] also the imx8mq_evk is not able to start properly.

On the EVK I enabled the DEBUG_UART and see the outputs below. I
suspect all imx8mq boards have this problem.

CONFIG_DEBUG_UART_BASE=0x3086  # for uart1
CONFIG_DEBUG_UART_CLOCK=2400

--- 8< 
U-Boot SPL 2022.10-rc4-00038-ge3fce5e560-dirty (Sep 09 2022 - 10:51:29 +0200)
PMIC:  PFUZE100 ID=0x10
SEC0:  RNG instantiated
Normal Boot
Trying to boot from MMC2
clk_register: failed to get  device (parent of ckil)
clk_register: failed to get  device (parent of clock-osc-27m)
alloc space exhausted
alloc space exhausted
alloc space exhausted
alloc space exhausted


Seems SPL_DM_CLK consumes the malloc space, so you meet such error.



I dont think the SPL is the problem. Because the output appears after
"Trying to boot from MMC2".

Do you have time to give a try?

diff --git a/configs/imx8mq_evk_defconfig b/configs/imx8mq_evk_defconfig
index cf207295e54..14b49ab5906 100644
--- a/configs/imx8mq_evk_defconfig
+++ b/configs/imx8mq_evk_defconfig
@@ -2,6 +2,7 @@ CONFIG_ARM=y
 CONFIG_ARCH_IMX8M=y
 CONFIG_SYS_TEXT_BASE=0x4020
 CONFIG_SYS_MALLOC_LEN=0x60
+CONFIG_SYS_MALLOC_F_LEN=0x2800
 CONFIG_SPL_GPIO=y
 CONFIG_SPL_LIBCOMMON_SUPPORT=y
 CONFIG_SPL_LIBGENERIC_SUPPORT=y
@@ -36,7 +37,7 @@ CONFIG_SPL_BSS_START_ADDR=0x18
 CONFIG_SPL_BSS_MAX_SIZE=0x2000
 CONFIG_SPL_BOARD_INIT=y
 # CONFIG_SPL_SHARES_INIT_SP_ADDR is not set
-CONFIG_SPL_STACK=0x187ff0
+CONFIG_SPL_STACK=0x188000
 CONFIG_SYS_SPL_MALLOC=y
 CONFIG_HAS_CUSTOM_SPL_MALLOC_START=y
 CONFIG_CUSTOM_SYS_SPL_MALLOC_ADDR=0x4220
diff --git a/include/configs/imx8mq_evk.h b/include/configs/imx8mq_evk.h
index ea4305667f2..728b4f7e665 100644
--- a/include/configs/imx8mq_evk.h
+++ b/include/configs/imx8mq_evk.h
@@ -16,8 +16,6 @@
 /*#define CONFIG_ENABLE_DDR_TRAINING_DEBUG*/
 #define CONFIG_SYS_SPL_PTE_RAM_BASE0x4158

-/* malloc f used before GD_FLG_FULL_MALLOC_INIT set */
-#define CONFIG_MALLOC_F_ADDR   0x182000
 /* For RAW image gives a error info not panic */

 #define CONFIG_POWER_PFUZE100

Thanks,
Peng.




Re: [PATCH] arm: mvebu: turris_{omnia, mox}: Reset bootdelay env for rescue

2022-09-13 Thread Stefan Roese

On 27.08.22 20:49, Pali Rohár wrote:

When rescue mode was activated reset also bootdelay env variable to its
default value. This will ensure that reset button works and starts rescue
mode also in the case when user changed bootdelay env variable to -1 (which
has meaning to not start autoboot).

Signed-off-by: Pali Rohár 


Applied to u-boot-marvell/master

Thanks,
Stefan


---
  board/CZ.NIC/turris_mox/turris_mox.c | 5 +++--
  board/CZ.NIC/turris_omnia/turris_omnia.c | 5 +++--
  2 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/board/CZ.NIC/turris_mox/turris_mox.c 
b/board/CZ.NIC/turris_mox/turris_mox.c
index 3dbd68e52366..5e1cf328ecc1 100644
--- a/board/CZ.NIC/turris_mox/turris_mox.c
+++ b/board/CZ.NIC/turris_mox/turris_mox.c
@@ -440,8 +440,9 @@ static void handle_reset_button(void)
env_set_default_vars(1, (char * const *)vars, 0);
  
  	if (read_reset_button()) {

-   const char * const vars[2] = {
+   const char * const vars[3] = {
"bootcmd",
+   "bootdelay",
"distro_bootcmd",
};
  
@@ -449,7 +450,7 @@ static void handle_reset_button(void)

 * Set the above envs to their default values, in case the user
 * managed to break them.
 */
-   env_set_default_vars(2, (char * const *)vars, 0);
+   env_set_default_vars(3, (char * const *)vars, 0);
  
  		/* Ensure bootcmd_rescue is used by distroboot */

env_set("boot_targets", "rescue");
diff --git a/board/CZ.NIC/turris_omnia/turris_omnia.c 
b/board/CZ.NIC/turris_omnia/turris_omnia.c
index cf8a6026702b..a7f96e5b7739 100644
--- a/board/CZ.NIC/turris_omnia/turris_omnia.c
+++ b/board/CZ.NIC/turris_omnia/turris_omnia.c
@@ -549,8 +549,9 @@ static void handle_reset_button(void)
env_set_ulong("omnia_reset", reset_status);
  
  	if (reset_status) {

-   const char * const vars[2] = {
+   const char * const vars[3] = {
"bootcmd",
+   "bootdelay",
"distro_bootcmd",
};
  
@@ -558,7 +559,7 @@ static void handle_reset_button(void)

 * Set the above envs to their default values, in case the user
 * managed to break them.
 */
-   env_set_default_vars(2, (char * const *)vars, 0);
+   env_set_default_vars(3, (char * const *)vars, 0);
  
  		/* Ensure bootcmd_rescue is used by distroboot */

env_set("boot_targets", "rescue");


Viele Grüße,
Stefan Roese

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


Re: [PATCH] board: turris: Initialize serial# env

2022-09-13 Thread Stefan Roese

On 27.08.22 20:06, Pali Rohár wrote:

Store serial number from atsha cryptochip into the serial# env variable.
U-Boot automatically puts content of this variable into the root device
tree property serial-number when booting Linux kernel. Refactor turris
atsha code and from turris_atsha_otp_get_serial_number() function returns
directly string suitable for printing or storing into device tree. Because
during different boot stages is env storage read-only, it is not possible
to always store serial number into env storage. So introduce a new function
turris_atsha_otp_init_serial_number() which is called at later stage and
which ensures that serial number is correctly stored into env.

Signed-off-by: Pali Rohár 


Applied to u-boot-marvell/master

Thanks,
Stefan


---
  board/CZ.NIC/turris_atsha_otp.c  | 33 +---
  board/CZ.NIC/turris_atsha_otp.h  |  3 ++-
  board/CZ.NIC/turris_omnia/turris_omnia.c | 11 +++-
  3 files changed, 36 insertions(+), 11 deletions(-)

diff --git a/board/CZ.NIC/turris_atsha_otp.c b/board/CZ.NIC/turris_atsha_otp.c
index aa4e29b1560e..a29fe3623174 100644
--- a/board/CZ.NIC/turris_atsha_otp.c
+++ b/board/CZ.NIC/turris_atsha_otp.c
@@ -93,30 +93,57 @@ int turris_atsha_otp_init_mac_addresses(int first_idx)
return 0;
  }
  
-int turris_atsha_otp_get_serial_number(u32 *version_num, u32 *serial_num)

+int turris_atsha_otp_init_serial_number(void)
+{
+   char serial[17];
+   int ret;
+
+   ret = turris_atsha_otp_get_serial_number(serial);
+   if (ret)
+   return ret;
+
+   if (!env_get("serial#"))
+   return -1;
+
+   return 0;
+}
+
+int turris_atsha_otp_get_serial_number(char serial[17])
  {
struct udevice *dev = get_atsha204a_dev();
+   u32 version_num, serial_num;
+   const char *serial_env;
int ret;
  
  	if (!dev)

return -1;
  
+	serial_env = env_get("serial#");

+   if (serial_env && strlen(serial_env) == 16) {
+   memcpy(serial, serial_env, 17);
+   return 0;
+   }
+
ret = atsha204a_wakeup(dev);
if (ret)
return ret;
  
  	ret = atsha204a_read(dev, ATSHA204A_ZONE_OTP, false,

 TURRIS_ATSHA_OTP_VERSION,
-(u8 *)version_num);
+(u8 *)_num);
if (ret)
return ret;
  
  	ret = atsha204a_read(dev, ATSHA204A_ZONE_OTP, false,

 TURRIS_ATSHA_OTP_SERIAL,
-(u8 *)serial_num);
+(u8 *)_num);
if (ret)
return ret;
  
  	atsha204a_sleep(dev);

+
+   sprintf(serial, "%08X%08X", be32_to_cpu(version_num), 
be32_to_cpu(serial_num));
+   env_set("serial#", serial);
+
return 0;
  }
diff --git a/board/CZ.NIC/turris_atsha_otp.h b/board/CZ.NIC/turris_atsha_otp.h
index bd4308fdc3ef..2cfe20bbc3a7 100644
--- a/board/CZ.NIC/turris_atsha_otp.h
+++ b/board/CZ.NIC/turris_atsha_otp.h
@@ -4,6 +4,7 @@
  #define TURRIS_ATSHA_OTP_H
  
  int turris_atsha_otp_init_mac_addresses(int first_idx);

-int turris_atsha_otp_get_serial_number(u32 *version_num, u32 *serial_num);
+int turris_atsha_otp_init_serial_number(void);
+int turris_atsha_otp_get_serial_number(char serial[17]);
  
  #endif

diff --git a/board/CZ.NIC/turris_omnia/turris_omnia.c 
b/board/CZ.NIC/turris_omnia/turris_omnia.c
index ab5061ef582b..cf8a6026702b 100644
--- a/board/CZ.NIC/turris_omnia/turris_omnia.c
+++ b/board/CZ.NIC/turris_omnia/turris_omnia.c
@@ -963,19 +963,15 @@ int board_late_init(void)
  
  int show_board_info(void)

  {
-   u32 version_num, serial_num;
+   char serial[17];
int err;
  
-	err = turris_atsha_otp_get_serial_number(_num, _num);

+   err = turris_atsha_otp_get_serial_number(serial);
printf("Model: Turris Omnia\n");
printf("  MCU type: %s\n", omnia_get_mcu_type());
printf("  MCU version: %s\n", omnia_get_mcu_version());
printf("  RAM size: %i MiB\n", omnia_get_ram_size_gb() * 1024);
-   if (err)
-   printf("  Serial Number: unknown\n");
-   else
-   printf("  Serial Number: %08X%08X\n", be32_to_cpu(version_num),
-  be32_to_cpu(serial_num));
+   printf("  Serial Number: %s\n", !err ? serial : "unknown");
  
  	return 0;

  }
@@ -983,6 +979,7 @@ int show_board_info(void)
  int misc_init_r(void)
  {
turris_atsha_otp_init_mac_addresses(1);
+   turris_atsha_otp_init_serial_number();
return 0;
  }
  


Viele Grüße,
Stefan Roese

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


Re: [PATCH] arm: mvebu: Espressobin: When emmc is not present disable it also in OF_LIVE

2022-09-13 Thread Stefan Roese

On 27.08.22 14:00, Pali Rohár wrote:

Signed-off-by: Pali Rohár 


Applied to u-boot-marvell/master

Thanks,
Stefan


---
  board/Marvell/mvebu_armada-37xx/board.c | 2 ++
  1 file changed, 2 insertions(+)

diff --git a/board/Marvell/mvebu_armada-37xx/board.c 
b/board/Marvell/mvebu_armada-37xx/board.c
index 5ae133879f32..45779198b678 100644
--- a/board/Marvell/mvebu_armada-37xx/board.c
+++ b/board/Marvell/mvebu_armada-37xx/board.c
@@ -132,6 +132,8 @@ int board_late_init(void)
dev = mmc_dev->dev;
device_remove(dev, DM_REMOVE_NORMAL);
device_unbind(dev);
+   if (of_live_active())
+   ofnode_set_enabled(dev_ofnode(dev), false);
}
  
  	/* Ensure that 'env default -a' set correct value to $fdtfile */


Viele Grüße,
Stefan Roese

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


Re: [PATCH v3 2/2] cmd: mvebu/bubt: Check for A38x/A37xx OTP secure bits and secure boot

2022-09-13 Thread Stefan Roese

On 23.08.22 14:52, Pali Rohár wrote:

For obvious reasons BootROMS rejects unsigned images when secure boot is
enabled in OTP secure bits. So check for OPT secure bits and do not allow
flashing unsigned images when secure boot is enabled. Access to OTP via
U-Boot fuse API is currently implemented only for A38x and A37xx SoCs.

Additionally Armada 3700 BootROM rejects signed trusted image when secure
boot is not enabled in OTP. So add also check for this case. On the other
hand Armada 38x BootROM acceps images with secure boot header when secure
boot is not enabled in OTP.

OTP secure bits may have burned also boot device source. Check it also and
reject flashing images to target storage which does not match OTP.

Signed-off-by: Pali Rohár 
Reviewed-by: Stefan Roese 


Applied to u-boot-marvell/master

Thanks,
Stefan



---
Changes in v3:
* Guard fuse_read_u64() function

Changes in v2:
* Add missing dependency on MVEBU_EFUSE
* Use only for A38x and A37xx
---
  cmd/mvebu/Kconfig |   1 +
  cmd/mvebu/bubt.c  | 128 +++---
  2 files changed, 121 insertions(+), 8 deletions(-)

diff --git a/cmd/mvebu/Kconfig b/cmd/mvebu/Kconfig
index 120397d6d4d0..9ec3aa983a51 100644
--- a/cmd/mvebu/Kconfig
+++ b/cmd/mvebu/Kconfig
@@ -5,6 +5,7 @@ config CMD_MVEBU_BUBT
bool "bubt"
select SHA256 if ARMADA_3700
select SHA512 if ARMADA_3700
+   select MVEBU_EFUSE if ARMADA_38X || ARMADA_3700
help
  bubt - Burn a u-boot image to flash
  For details about bubt command please see the documentation
diff --git a/cmd/mvebu/bubt.c b/cmd/mvebu/bubt.c
index a97e5ce38a5e..7e6e47f40d6e 100644
--- a/cmd/mvebu/bubt.c
+++ b/cmd/mvebu/bubt.c
@@ -13,6 +13,8 @@
  #include 
  #include 
  #include 
+#include 
+#include 
  
  #include 

  #include 
@@ -121,6 +123,17 @@ struct a38x_main_hdr_v1 {
u8  checksum;  /* 0x1F  */
  };
  
+/*

+ * Header for the optional headers, version 1 (Armada 370/XP/375/38x/39x)
+ */
+struct a38x_opt_hdr_v1 {
+   u8  headertype;
+   u8  headersz_msb;
+   u16 headersz_lsb;
+   u8  data[0];
+};
+#define A38X_OPT_HDR_V1_SECURE_TYPE0x1
+
  struct a38x_boot_mode {
unsigned int id;
const char *name;
@@ -753,6 +766,38 @@ static int check_image_header(void)
printf("Image checksum...OK!\n");
return 0;
  }
+
+#if defined(CONFIG_ARMADA_38X)
+static int a38x_image_is_secure(const struct a38x_main_hdr_v1 *hdr)
+{
+   u32 image_size = a38x_header_size(hdr);
+   struct a38x_opt_hdr_v1 *ohdr;
+   u32 ohdr_size;
+
+   if (hdr->version != 1)
+   return 0;
+
+   if (!hdr->ext)
+   return 0;
+
+   ohdr = (struct a38x_opt_hdr_v1 *)(hdr + 1);
+   do {
+   if (ohdr->headertype == A38X_OPT_HDR_V1_SECURE_TYPE)
+   return 1;
+
+   ohdr_size = (ohdr->headersz_msb << 16) | 
le16_to_cpu(ohdr->headersz_lsb);
+
+   if (!*((u8 *)ohdr + ohdr_size - 4))
+   break;
+
+   ohdr = (struct a38x_opt_hdr_v1 *)((u8 *)ohdr + ohdr_size);
+   if ((u8 *)ohdr >= (u8 *)hdr + image_size)
+   break;
+   } while (1);
+
+   return 0;
+}
+#endif
  #else /* Not ARMADA? */
  static int check_image_header(void)
  {
@@ -761,20 +806,60 @@ static int check_image_header(void)
  }
  #endif
  
+#if defined(CONFIG_ARMADA_3700) || defined(CONFIG_ARMADA_32BIT)

+static u64 fuse_read_u64(u32 bank)
+{
+   u32 val[2];
+   int ret;
+
+   ret = fuse_read(bank, 0, [0]);
+   if (ret < 0)
+   return -1;
+
+   ret = fuse_read(bank, 1, [1]);
+   if (ret < 0)
+   return -1;
+
+   return ((u64)val[1] << 32) | val[0];
+}
+#endif
+
+#if defined(CONFIG_ARMADA_3700)
+static inline u8 maj3(u8 val)
+{
+   /* return majority vote of 3 bits */
+   return ((val & 0x7) == 3 || (val & 0x7) > 4) ? 1 : 0;
+}
+#endif
+
  static int bubt_check_boot_mode(const struct bubt_dev *dst)
  {
  #if defined(CONFIG_ARMADA_3700) || defined(CONFIG_ARMADA_32BIT)
-   int mode;
+   int mode, secure_mode;
  #if defined(CONFIG_ARMADA_3700)
const struct tim_boot_flash_sign *boot_modes = tim_boot_flash_signs;
const struct common_tim_data *hdr =
(struct common_tim_data *)get_load_addr();
u32 id = hdr->boot_flash_sign;
+   int is_secure = hdr->trusted != 0;
+   u64 otp_secure_bits = fuse_read_u64(1);
+   int otp_secure_boot = ((maj3(otp_secure_bits >> 0) << 0) |
+  (maj3(otp_secure_bits >> 4) << 1)) == 2;
+   unsigned int otp_boot_device = (maj3(otp_secure_bits >> 48) << 0) |
+  (maj3(otp_secure_bits >> 52) << 1) |
+  (maj3(otp_secure_bits >> 56) << 2) |
+  (maj3(otp_secure_bits >> 60) << 3);
  #elif 

Re: [PATCH v3 1/2] cmd: mvebu/bubt: Check for A38x image data checksum

2022-09-13 Thread Stefan Roese

On 23.08.22 14:52, Pali Rohár wrote:

Currently for A38x image is checked only header checksum.
So check also for image data checksum to prevent flashing broken image.

Signed-off-by: Pali Rohár 
Reviewed-by: Stefan Roese 


Applied to u-boot-marvell/master

Thanks,
Stefan



---
Changes in v3:
* Compile fix (move another code chunk from patch 2/2 to 1/2)

Changes in v2:
* Compile fix (move code chunk from patch 2/2 to 1/2)
---
  cmd/mvebu/bubt.c | 46 +-
  1 file changed, 45 insertions(+), 1 deletion(-)

diff --git a/cmd/mvebu/bubt.c b/cmd/mvebu/bubt.c
index 2136af64163c..a97e5ce38a5e 100644
--- a/cmd/mvebu/bubt.c
+++ b/cmd/mvebu/bubt.c
@@ -688,9 +688,25 @@ static uint8_t image_checksum8(const void *start, size_t 
len)
return csum;
  }
  
+static uint32_t image_checksum32(const void *start, size_t len)

+{
+   u32 csum = 0;
+   const u32 *p = start;
+
+   while (len) {
+   csum += *p;
+   ++p;
+   len -= sizeof(u32);
+   }
+
+   return csum;
+}
+
  static int check_image_header(void)
  {
u8 checksum;
+   u32 checksum32, exp_checksum32;
+   u32 offset, size;
const struct a38x_main_hdr_v1 *hdr =
(struct a38x_main_hdr_v1 *)get_load_addr();
const size_t image_size = a38x_header_size(hdr);
@@ -701,11 +717,39 @@ static int check_image_header(void)
checksum = image_checksum8(hdr, image_size);
checksum -= hdr->checksum;
if (checksum != hdr->checksum) {
-   printf("Error: Bad A38x image checksum. 0x%x != 0x%x\n",
+   printf("Error: Bad A38x image header checksum. 0x%x != 0x%x\n",
   checksum, hdr->checksum);
return -ENOEXEC;
}
  
+	offset = le32_to_cpu(hdr->srcaddr);

+   size = le32_to_cpu(hdr->blocksize);
+
+   if (hdr->blockid == 0x78) { /* SATA id */
+   if (offset < 1) {
+   printf("Error: Bad A38x image srcaddr.\n");
+   return -ENOEXEC;
+   }
+   offset -= 1;
+   offset *= 512;
+   }
+
+   if (hdr->blockid == 0xAE) /* SDIO id */
+   offset *= 512;
+
+   if (offset % 4 != 0 || size < 4 || size % 4 != 0) {
+   printf("Error: Bad A38x image blocksize.\n");
+   return -ENOEXEC;
+   }
+
+   checksum32 = image_checksum32((u8 *)hdr + offset, size - 4);
+   exp_checksum32 = *(u32 *)((u8 *)hdr + offset + size - 4);
+   if (checksum32 != exp_checksum32) {
+   printf("Error: Bad A38x image data checksum. 0x%08x != 
0x%08x\n",
+  checksum32, exp_checksum32);
+   return -ENOEXEC;
+   }
+
printf("Image checksum...OK!\n");
return 0;
  }


Viele Grüße,
Stefan Roese

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


Re: [PATCH v17 09/10] doc:eficonfig: add documentation for eficonfig command

2022-09-13 Thread Heinrich Schuchardt

On 9/12/22 10:33, Masahisa Kojima wrote:

Add documentation for eficonfig command.

Signed-off-by: Masahisa Kojima 
Reviewed-by: Ilias Apalodimas 
---
No update since v15

Changes in v14:
- fix typos

Changes in v13:
- describe how to auto boot according to the UEFI Boot option

Changes in v12:
- CONFIG_BOOTMENU_DISABLE_UBOOT_CONSOLE condition is added
   to show newly added boot option

No update since v10

Changes in v10:
- describe how to boot system after editting by eficonfig

Changes in v8:
- command name is changed from "efimenu" to "eficonfig"

Newly created in v7

  doc/usage/cmd/eficonfig.rst | 71 +
  doc/usage/index.rst |  1 +
  2 files changed, 72 insertions(+)
  create mode 100644 doc/usage/cmd/eficonfig.rst

diff --git a/doc/usage/cmd/eficonfig.rst b/doc/usage/cmd/eficonfig.rst
new file mode 100644
index 00..340ebc80db
--- /dev/null
+++ b/doc/usage/cmd/eficonfig.rst
@@ -0,0 +1,71 @@
+.. SPDX-License-Identifier: GPL-2.0+
+.. (C) Copyright 2022, Masahisa Kojima 
+
+eficonfig command
+=
+
+Synopsis
+
+::
+
+eficonfig
+
+Description
+---
+
+The "eficonfig" command uses U-Boot menu interface and provides
+a menu-driven UEFI variable maintenance feature.
+The "eficonfig" has the following menu entries.
+
+Add Boot Option
+Add new UEFI Boot Option.
+User can edit description, file path, and optional_data.
+
+Edit Boot Option
+Edit the existing UEFI Boot Option
+User can edit description, file path, and optional_data.
+
+Change Boot Order
+Change the order of UEFI BootOrder variable.
+
+Delete Boot Option
+Delete the UEFI Boot Option
+
+Configuration
+-
+
+The "eficonfig" command is enabled by::
+
+CONFIG_CMD_EFICONFIG=y
+
+If CONFIG_BOOTMENU_DISABLE_UBOOT_CONSOLE is enabled, user can not enter
+U-Boot console. In this case, bootmenu can be used to invoke "eficonfig"::
+
+CONFIG_USE_PREBOOT=y
+CONFIG_PREBOOT="setenv bootmenu_0 UEFI Maintenance Menu=eficonfig"


The following question is about the bootmenu command itself and beyond
the scope of this series:

It seems that bootmenu can only handle bootmenu_## variables correctly
if they are consecutively numbered from 0. Wouldn't it be preferable to
be able to define a variable bootmenu_98 that is placed at the end?

Best regards

Heinrich


+
+How to boot the system with newly added UEFI Boot Option
+
+
+"eficonfig" command is responsible for configuring the UEFI variables,
+not directly handle the system boot.
+The new Boot Option added by "eficonfig" is appended at the last entry
+of UEFI BootOrder variable, user may want to change the boot order
+through "Change Boot Order".
+If the bootmenu is enabled, CONFIG_BOOTMENU_DISABLE_UBOOT_CONSOLE is enabled,
+and "eficonfig" is configured as preboot command, the newly added Boot Options
+are enumerated in the bootmenu when user exits from the eficonfig menu.
+User may select the entry in the bootmenu to boot the system, or follow
+the U-Boot configuration the system already has.
+
+Auto boot with the UEFI Boot Option
+'''
+
+To do auto boot according to the UEFI BootOrder variable,
+add "bootefi bootmgr" entry as a default or first bootmenu entry::
+
+CONFIG_PREBOOT="setenv bootmenu_0 UEFI Boot Manager=bootefi bootmgr; setenv 
bootmenu_1 UEFI Maintenance Menu=eficonfig"
+
+See also
+
+* :doc:`bootmenu` provides a simple mechanism for creating menus 
with different boot items
diff --git a/doc/usage/index.rst b/doc/usage/index.rst
index 28f9683a3e..09f2928970 100644
--- a/doc/usage/index.rst
+++ b/doc/usage/index.rst
@@ -35,6 +35,7 @@ Shell commands
 cmd/conitrace
 cmd/dm
 cmd/echo
+   cmd/eficonfig
 cmd/env
 cmd/event
 cmd/exception




Re: [PATCH] tools: kwboot: Change KWBOOT_MSG_RSP_TIMEO_AXP to 10ms

2022-09-13 Thread Stefan Roese

On 19.08.22 09:43, Stefan Roese wrote:

Testing on the theadorable Armada XP platform has shown, thaz using the
current value of 1000ms as response timeout does not result in reliable
booting via kwboot. Using 10ms seems to be much better. So let's change
this value to this 10ms instead.

Signed-off-by: Stefan Roese 


Applied to u-boot-marvell/master

Thanks,
Stefan


---
  tools/kwboot.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/kwboot.c b/tools/kwboot.c
index 16bcd4d9a778..da4fe32da226 100644
--- a/tools/kwboot.c
+++ b/tools/kwboot.c
@@ -84,7 +84,7 @@ static unsigned char kwboot_msg_debug[] = {
  #define KWBOOT_MSG_RSP_TIMEO  50 /* ms */
  
  /* Defines known to work on Armada XP */

-#define KWBOOT_MSG_RSP_TIMEO_AXP   1000 /* ms */
+#define KWBOOT_MSG_RSP_TIMEO_AXP   10 /* ms */
  
  /*

   * Xmodem Transfers


Viele Grüße,
Stefan Roese

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


Re: [PATCH] arm: kirkwood: Add CONFIG_SUPPORT_PASSING_ATAGS

2022-09-13 Thread Stefan Roese

On 17.08.22 23:59, Tony Dinh wrote:

Add CONFIG_SUPPORT_PASSING_ATAGS and friends to support legacy
image method of booting. Debian and OpenWrt installer use uImage
with appended DTB for these Kirkwood boards.

Signed-off-by: Tony Dinh 


Applied to u-boot-marvell/master

Thanks,
Stefan


---

  configs/dockstar_defconfig   | 3 +++
  configs/dreamplug_defconfig  | 3 +++
  configs/goflexhome_defconfig | 3 +++
  configs/iconnect_defconfig   | 3 +++
  configs/pogo_e02_defconfig   | 3 +++
  configs/sheevaplug_defconfig | 3 +++
  6 files changed, 18 insertions(+)

diff --git a/configs/dockstar_defconfig b/configs/dockstar_defconfig
index 6f99cdd44b..82eb81e4de 100644
--- a/configs/dockstar_defconfig
+++ b/configs/dockstar_defconfig
@@ -4,6 +4,9 @@ CONFIG_SYS_DCACHE_OFF=y
  CONFIG_ARCH_CPU_INIT=y
  CONFIG_SYS_THUMB_BUILD=y
  CONFIG_ARCH_KIRKWOOD=y
+CONFIG_SUPPORT_PASSING_ATAGS=y
+CONFIG_CMDLINE_TAG=y
+CONFIG_INITRD_TAG=y
  CONFIG_SYS_KWD_CONFIG="board/Seagate/dockstar/kwbimage.cfg"
  CONFIG_SYS_TEXT_BASE=0x60
  CONFIG_NR_DRAM_BANKS=2
diff --git a/configs/dreamplug_defconfig b/configs/dreamplug_defconfig
index d6b55636ba..ccc9ee38de 100644
--- a/configs/dreamplug_defconfig
+++ b/configs/dreamplug_defconfig
@@ -3,6 +3,9 @@ CONFIG_SKIP_LOWLEVEL_INIT=y
  CONFIG_SYS_DCACHE_OFF=y
  CONFIG_ARCH_CPU_INIT=y
  CONFIG_ARCH_KIRKWOOD=y
+CONFIG_SUPPORT_PASSING_ATAGS=y
+CONFIG_CMDLINE_TAG=y
+CONFIG_INITRD_TAG=y
  CONFIG_SYS_KWD_CONFIG="board/Marvell/dreamplug/kwbimage.cfg"
  CONFIG_SYS_TEXT_BASE=0x60
  CONFIG_NR_DRAM_BANKS=2
diff --git a/configs/goflexhome_defconfig b/configs/goflexhome_defconfig
index 1ef4d6c881..3cfbe7d558 100644
--- a/configs/goflexhome_defconfig
+++ b/configs/goflexhome_defconfig
@@ -4,6 +4,9 @@ CONFIG_SYS_DCACHE_OFF=y
  CONFIG_ARCH_CPU_INIT=y
  CONFIG_SYS_THUMB_BUILD=y
  CONFIG_ARCH_KIRKWOOD=y
+CONFIG_SUPPORT_PASSING_ATAGS=y
+CONFIG_CMDLINE_TAG=y
+CONFIG_INITRD_TAG=y
  CONFIG_SYS_KWD_CONFIG="board/Seagate/goflexhome/kwbimage.cfg"
  CONFIG_SYS_TEXT_BASE=0x60
  CONFIG_NR_DRAM_BANKS=2
diff --git a/configs/iconnect_defconfig b/configs/iconnect_defconfig
index 7adf76d777..fc5928b9df 100644
--- a/configs/iconnect_defconfig
+++ b/configs/iconnect_defconfig
@@ -4,6 +4,9 @@ CONFIG_SYS_DCACHE_OFF=y
  CONFIG_ARCH_CPU_INIT=y
  CONFIG_SYS_THUMB_BUILD=y
  CONFIG_ARCH_KIRKWOOD=y
+CONFIG_SUPPORT_PASSING_ATAGS=y
+CONFIG_CMDLINE_TAG=y
+CONFIG_INITRD_TAG=y
  CONFIG_SYS_KWD_CONFIG="board/iomega/iconnect/kwbimage.cfg"
  CONFIG_SYS_TEXT_BASE=0x60
  CONFIG_NR_DRAM_BANKS=2
diff --git a/configs/pogo_e02_defconfig b/configs/pogo_e02_defconfig
index e1a2517eb6..0b647e8af9 100644
--- a/configs/pogo_e02_defconfig
+++ b/configs/pogo_e02_defconfig
@@ -4,6 +4,9 @@ CONFIG_SYS_DCACHE_OFF=y
  CONFIG_ARCH_CPU_INIT=y
  CONFIG_SYS_THUMB_BUILD=y
  CONFIG_ARCH_KIRKWOOD=y
+CONFIG_SUPPORT_PASSING_ATAGS=y
+CONFIG_CMDLINE_TAG=y
+CONFIG_INITRD_TAG=y
  CONFIG_SYS_KWD_CONFIG="board/cloudengines/pogo_e02/kwbimage.cfg"
  CONFIG_SYS_TEXT_BASE=0x60
  CONFIG_NR_DRAM_BANKS=2
diff --git a/configs/sheevaplug_defconfig b/configs/sheevaplug_defconfig
index fa1e7bd2c0..cc9cd7d9c9 100644
--- a/configs/sheevaplug_defconfig
+++ b/configs/sheevaplug_defconfig
@@ -4,6 +4,9 @@ CONFIG_SYS_DCACHE_OFF=y
  CONFIG_ARCH_CPU_INIT=y
  CONFIG_SYS_THUMB_BUILD=y
  CONFIG_ARCH_KIRKWOOD=y
+CONFIG_SUPPORT_PASSING_ATAGS=y
+CONFIG_CMDLINE_TAG=y
+CONFIG_INITRD_TAG=y
  CONFIG_SYS_KWD_CONFIG="board/Marvell/sheevaplug/kwbimage.cfg"
  CONFIG_SYS_TEXT_BASE=0x60
  CONFIG_NR_DRAM_BANKS=2


Viele Grüße,
Stefan Roese

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


Re: [PATCH v3 1/2] cmd: mvebu/bubt: Check for A38x image data checksum

2022-09-13 Thread Stefan Roese

On 11.09.22 13:26, Pali Rohár wrote:

On Tuesday 23 August 2022 14:52:23 Pali Rohár wrote:

Currently for A38x image is checked only header checksum.
So check also for image data checksum to prevent flashing broken image.

Signed-off-by: Pali Rohár 
Reviewed-by: Stefan Roese 

---
Changes in v3:
* Compile fix (move another code chunk from patch 2/2 to 1/2)

Changes in v2:
* Compile fix (move code chunk from patch 2/2 to 1/2)
---


Hello Stefan! Is V3 version OK now?


Looks good.

Thanks,
Stefan


  cmd/mvebu/bubt.c | 46 +-
  1 file changed, 45 insertions(+), 1 deletion(-)

diff --git a/cmd/mvebu/bubt.c b/cmd/mvebu/bubt.c
index 2136af64163c..a97e5ce38a5e 100644
--- a/cmd/mvebu/bubt.c
+++ b/cmd/mvebu/bubt.c
@@ -688,9 +688,25 @@ static uint8_t image_checksum8(const void *start, size_t 
len)
return csum;
  }
  
+static uint32_t image_checksum32(const void *start, size_t len)

+{
+   u32 csum = 0;
+   const u32 *p = start;
+
+   while (len) {
+   csum += *p;
+   ++p;
+   len -= sizeof(u32);
+   }
+
+   return csum;
+}
+
  static int check_image_header(void)
  {
u8 checksum;
+   u32 checksum32, exp_checksum32;
+   u32 offset, size;
const struct a38x_main_hdr_v1 *hdr =
(struct a38x_main_hdr_v1 *)get_load_addr();
const size_t image_size = a38x_header_size(hdr);
@@ -701,11 +717,39 @@ static int check_image_header(void)
checksum = image_checksum8(hdr, image_size);
checksum -= hdr->checksum;
if (checksum != hdr->checksum) {
-   printf("Error: Bad A38x image checksum. 0x%x != 0x%x\n",
+   printf("Error: Bad A38x image header checksum. 0x%x != 0x%x\n",
   checksum, hdr->checksum);
return -ENOEXEC;
}
  
+	offset = le32_to_cpu(hdr->srcaddr);

+   size = le32_to_cpu(hdr->blocksize);
+
+   if (hdr->blockid == 0x78) { /* SATA id */
+   if (offset < 1) {
+   printf("Error: Bad A38x image srcaddr.\n");
+   return -ENOEXEC;
+   }
+   offset -= 1;
+   offset *= 512;
+   }
+
+   if (hdr->blockid == 0xAE) /* SDIO id */
+   offset *= 512;
+
+   if (offset % 4 != 0 || size < 4 || size % 4 != 0) {
+   printf("Error: Bad A38x image blocksize.\n");
+   return -ENOEXEC;
+   }
+
+   checksum32 = image_checksum32((u8 *)hdr + offset, size - 4);
+   exp_checksum32 = *(u32 *)((u8 *)hdr + offset + size - 4);
+   if (checksum32 != exp_checksum32) {
+   printf("Error: Bad A38x image data checksum. 0x%08x != 
0x%08x\n",
+  checksum32, exp_checksum32);
+   return -ENOEXEC;
+   }
+
printf("Image checksum...OK!\n");
return 0;
  }
--
2.20.1



Viele Grüße,
Stefan Roese

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


Re: imx8mq allocation issue

2022-09-13 Thread Peng Fan




On 9/13/2022 2:43 PM, Peng Fan (OSS) wrote:



On 9/12/2022 3:48 PM, Heiko Thiery wrote:

Hi Peng,

Am Mo., 12. Sept. 2022 um 09:26 Uhr schrieb Peng Fan :




On 9/9/2022 5:12 PM, Heiko Thiery wrote:

HI,

I think on the imx8mq platform we have a problem with the introduction
of the clock driver. I tried to debug the problem that the pitx-imx8m
board was not able to start for some time. I was wondering why the
pitx-im8m doesn't work anymore although the imx8mq_evk is running.

So I switched to the imx8mq_evk for counter testing. As I already
figured out in [1] also the imx8mq_evk is not able to start properly.

On the EVK I enabled the DEBUG_UART and see the outputs below. I
suspect all imx8mq boards have this problem.

CONFIG_DEBUG_UART_BASE=0x3086  # for uart1
CONFIG_DEBUG_UART_CLOCK=2400

--- 8< 
U-Boot SPL 2022.10-rc4-00038-ge3fce5e560-dirty (Sep 09 2022 - 10:51:29 +0200)
PMIC:  PFUZE100 ID=0x10
SEC0:  RNG instantiated
Normal Boot
Trying to boot from MMC2
clk_register: failed to get  device (parent of ckil)
clk_register: failed to get  device (parent of clock-osc-27m)
alloc space exhausted
alloc space exhausted
alloc space exhausted
alloc space exhausted


Seems SPL_DM_CLK consumes the malloc space, so you meet such error.



I dont think the SPL is the problem. Because the output appears after
"Trying to boot from MMC2".


oh, it maybe CONFIG_MALLOC_F_ADDR and CONFIG_VAL(SYS_MALLOC_F_LEN) not
large enough for DM CLK with DM_FLAG_PRE_RELOC?


Ignore this comment.

Regards
Peng



Regards,
Peng.





Re: imx8mq allocation issue

2022-09-13 Thread Peng Fan




On 9/12/2022 3:48 PM, Heiko Thiery wrote:

Hi Peng,

Am Mo., 12. Sept. 2022 um 09:26 Uhr schrieb Peng Fan :




On 9/9/2022 5:12 PM, Heiko Thiery wrote:

HI,

I think on the imx8mq platform we have a problem with the introduction
of the clock driver. I tried to debug the problem that the pitx-imx8m
board was not able to start for some time. I was wondering why the
pitx-im8m doesn't work anymore although the imx8mq_evk is running.

So I switched to the imx8mq_evk for counter testing. As I already
figured out in [1] also the imx8mq_evk is not able to start properly.

On the EVK I enabled the DEBUG_UART and see the outputs below. I
suspect all imx8mq boards have this problem.

CONFIG_DEBUG_UART_BASE=0x3086  # for uart1
CONFIG_DEBUG_UART_CLOCK=2400

--- 8< 
U-Boot SPL 2022.10-rc4-00038-ge3fce5e560-dirty (Sep 09 2022 - 10:51:29 +0200)
PMIC:  PFUZE100 ID=0x10
SEC0:  RNG instantiated
Normal Boot
Trying to boot from MMC2
clk_register: failed to get  device (parent of ckil)
clk_register: failed to get  device (parent of clock-osc-27m)
alloc space exhausted
alloc space exhausted
alloc space exhausted
alloc space exhausted


Seems SPL_DM_CLK consumes the malloc space, so you meet such error.



I dont think the SPL is the problem. Because the output appears after
"Trying to boot from MMC2".


oh, it maybe CONFIG_MALLOC_F_ADDR and CONFIG_VAL(SYS_MALLOC_F_LEN) not
large enough for DM CLK with DM_FLAG_PRE_RELOC?

Regards,
Peng.





[PATCH v1] net: nuvoton: fix build broken for use phy_get_interface_by_name

2022-09-13 Thread Jim Liu
The original patch is use phy_get_interface_by_name to set interface.
The new patch is use dev_read_phy_mode to replace it.

Signed-off-by: Jim Liu 
---
 drivers/net/npcm750_eth.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/net/npcm750_eth.c b/drivers/net/npcm750_eth.c
index 409d5cce4a..bd29a10def 100644
--- a/drivers/net/npcm750_eth.c
+++ b/drivers/net/npcm750_eth.c
@@ -710,12 +710,12 @@ static int npcm750_eth_ofdata_to_platdata(struct udevice 
*dev)
 
pdata->phy_interface = -1;
phy_mode = fdt_getprop(gd->fdt_blob, dev_of_offset(dev), "phy-mode", 
NULL);
+
if (phy_mode)
-   pdata->phy_interface = phy_get_interface_by_name(phy_mode);
-   if (pdata->phy_interface == -1) {
-   printf("%s: Invalid PHY interface '%s'\n", __func__, phy_mode);
+   pdata->phy_interface = dev_read_phy_mode(dev);
+
+   if (pdata->phy_interface == PHY_INTERFACE_MODE_NA)
return -EINVAL;
-   }
 
pdata->max_speed = 0;
cell = fdt_getprop(gd->fdt_blob, dev_of_offset(dev), "max-speed", NULL);
-- 
2.17.1



[PATCH v1] pinctrl: nuvoton: fix set persist error

2022-09-13 Thread Jim Liu
CA9C is cortex A9 watchdog reset control bit.
if device set persist mode, it shouldn't set this bit.

Signed-off-by: Jim Liu 
---
 drivers/pinctrl/nuvoton/pinctrl-npcm7xx.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/pinctrl/nuvoton/pinctrl-npcm7xx.c 
b/drivers/pinctrl/nuvoton/pinctrl-npcm7xx.c
index f6e20415e2..31678f5537 100644
--- a/drivers/pinctrl/nuvoton/pinctrl-npcm7xx.c
+++ b/drivers/pinctrl/nuvoton/pinctrl-npcm7xx.c
@@ -1388,10 +1388,10 @@ static int npcm7xx_gpio_reset_persist(struct udevice 
*dev, unsigned int banknum,
dev_dbg(dev, "set gpio persist, bank %d, enable %d\n", banknum, enable);
 
if (enable) {
-   regmap_update_bits(priv->rst_regmap, NPCM7XX_RST_WD0RCR, 
BIT(num) | CA9C_RESET, 0);
-   regmap_update_bits(priv->rst_regmap, NPCM7XX_RST_WD1RCR, 
BIT(num) | CA9C_RESET, 0);
-   regmap_update_bits(priv->rst_regmap, NPCM7XX_RST_WD2RCR, 
BIT(num) | CA9C_RESET, 0);
-   regmap_update_bits(priv->rst_regmap, NPCM7XX_RST_CORSTC, 
BIT(num) | CA9C_RESET, 0);
+   regmap_update_bits(priv->rst_regmap, NPCM7XX_RST_WD0RCR, 
BIT(num), 0);
+   regmap_update_bits(priv->rst_regmap, NPCM7XX_RST_WD1RCR, 
BIT(num), 0);
+   regmap_update_bits(priv->rst_regmap, NPCM7XX_RST_WD2RCR, 
BIT(num), 0);
+   regmap_update_bits(priv->rst_regmap, NPCM7XX_RST_CORSTC, 
BIT(num), 0);
} else {
regmap_update_bits(priv->rst_regmap, NPCM7XX_RST_WD0RCR, 
BIT(num) | CA9C_RESET, BIT(num) | CA9C_RESET);
regmap_update_bits(priv->rst_regmap, NPCM7XX_RST_WD1RCR, 
BIT(num) | CA9C_RESET, BIT(num) | CA9C_RESET);
-- 
2.17.1



[PATCH v1] wdt: nuvoton: add expire function for generic reset

2022-09-13 Thread Jim Liu
Add expire_now function for generic sysreset request

Signed-off-by: Jim Liu 
---
 drivers/watchdog/npcm_wdt.c | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/drivers/watchdog/npcm_wdt.c b/drivers/watchdog/npcm_wdt.c
index 256020f5d3..e56aa0ebe1 100644
--- a/drivers/watchdog/npcm_wdt.c
+++ b/drivers/watchdog/npcm_wdt.c
@@ -75,6 +75,11 @@ static int npcm_wdt_reset(struct udevice *dev)
return 0;
 }
 
+static int npcm_wdt_expire_now(struct udevice *dev, ulong flags)
+{
+   return npcm_wdt_reset(dev);
+}
+
 static int npcm_wdt_of_to_plat(struct udevice *dev)
 {
struct npcm_wdt_priv *priv = dev_get_priv(dev);
@@ -87,6 +92,7 @@ static int npcm_wdt_of_to_plat(struct udevice *dev)
 }
 
 static const struct wdt_ops npcm_wdt_ops = {
+   .expire_now = npcm_wdt_expire_now,
.start = npcm_wdt_start,
.reset = npcm_wdt_reset,
.stop = npcm_wdt_stop,
-- 
2.17.1