Re: [PATCH v14 10/15] FWU: Add support for the FWU Multi Bank Update feature

2022-10-19 Thread Ilias Apalodimas
Hi Sughosh

[...]

> + struct efi_capsule_header *capsule)
> +{
> + int status;
> + u32 active_idx;
> + efi_status_t ret;
> + efi_guid_t *image_guid;
> +
> + if (!guidcmp(&capsule->capsule_guid,
> +  &fwu_guid_os_request_fw_revert)) {
> + /*
> +  * One of the previously updated image has
> +  * failed the OS acceptance test. OS has
> +  * requested to revert back to the earlier
> +  * boot index
> +  */
> + status = fwu_revert_boot_index();
> + ret = fwu_to_efi_error(status);
> + if (ret == EFI_SUCCESS)
> + log_info("Reverted the FWU active_index. Recommend 
> rebooting the system\n");
> + else
> + log_err("Failed to revert the FWU boot index\n");
> + } else if (!guidcmp(&capsule->capsule_guid,
> + &fwu_guid_os_request_fw_accept)) {
> + /*
> +  * Image accepted by the OS. Set the acceptance
> +  * status for the image.
> +  */
> + image_guid = (void *)(char *)capsule +
> + capsule->header_size;
> +
> + status = fwu_get_active_index(&active_idx);
> + ret = fwu_to_efi_error(status);
> + if (ret != EFI_SUCCESS) {
> + log_err("Unable to get the active_index from the FWU 
> metadata\n");
> + return ret;
> + }
> +
> + status = fwu_accept_image(image_guid, active_idx);
> + ret = fwu_to_efi_error(status);
> + if (ret != EFI_SUCCESS)
> + log_err("Unable to set the Accept bit for the image 
> %pUs\n",
> + image_guid);
> + } else {
> + ret = EFI_NOT_FOUND;

Just initialize this on the declaration with EFI_INVALID_PARAMETER (instead
of EFI_NOT_FOUND) and get rid of this else

> + }
> +
> + return ret;
> +}
> +
> +static __maybe_unused void fwu_post_update_checks(
> + struct efi_capsule_header *capsule,
> + bool *fw_accept_os, bool *capsule_update)
> +{
> + if (fwu_empty_capsule(capsule))
> + *capsule_update = false;
> + else
> + if (!*fw_accept_os)
> + *fw_accept_os =
> + capsule->flags & FW_ACCEPT_OS ? true : false;
> +}
> +
> +static __maybe_unused efi_status_t fwu_post_update_process(bool fw_accept_os)
> +{
> + int status;
> + uint update_index;
> + efi_status_t ret;
> +
> + status = fwu_plat_get_update_index(&update_index);
> + if (status < 0) {
> + log_err("Failed to get the FWU update_index value\n");
> + return EFI_DEVICE_ERROR;
> + }
> +
> + /*
> +  * All the capsules have been updated successfully,
> +  * update the FWU metadata.
> +  */
> + log_debug("Update Complete. Now updating active_index to %u\n",
> +   update_index);
> + status = fwu_set_active_index(update_index);
> + ret = fwu_to_efi_error(status);
> + if (ret != EFI_SUCCESS) {
> + log_err("Failed to update FWU metadata index values\n");
> + } else {
> + log_debug("Successfully updated the active_index\n");
> + ret = EFI_SUCCESS;

Isn't this already set to EFI_SUCCESS?  Otherwise the initial if statement
is bogus? fwu_to_efi_error() does include 0 -> EFI_SUCCESS


> + if (fw_accept_os) {
> + status = fwu_trial_state_ctr_start();
> + if (status < 0)
> + ret = EFI_DEVICE_ERROR;

[...]

Thanks
/Ilias


Re: imx patches pending

2022-10-19 Thread Stefano Babic

Hi Tim,

On 14.10.22 18:38, Tim Harvey wrote:

Stefano,

With the merge window for v2023.01 closing in about a week (10/24),
can you please look at the pending patches for imx? I'm afraid you may
have some merge conflicts due to dt updates and we likely need time to
respond to any issues you may have.



I will try to sum them in next days and then post the PR to Tom.

Stefano


Best Regards,

Tim


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



Re: [u-boot][PATCH v2 2/4] scripts: Makefile.spl: Enable memory drivers to be built for SPL

2022-10-19 Thread Roger Quadros



On 18/10/2022 20:40, Tom Rini wrote:
> On Thu, Oct 06, 2022 at 04:23:58PM +0300, Roger Quadros wrote:
>> We will need ti-gpmc driver for SPL. Allow memory drivers
>> do be built for SPL.
>>
>> Signed-off-by: Roger Quadros 
>> ---
>>  scripts/Makefile.spl | 1 +
>>  1 file changed, 1 insertion(+)
>>
>> diff --git a/scripts/Makefile.spl b/scripts/Makefile.spl
>> index 3bafeb4fe9..110076b22f 100644
>> --- a/scripts/Makefile.spl
>> +++ b/scripts/Makefile.spl
>> @@ -114,6 +114,7 @@ libs-$(CONFIG_PARTITIONS) += disk/
>>  endif
>>  
>>  libs-y += drivers/
>> +libs-y += drivers/memory/
>>  libs-$(CONFIG_SPL_USB_GADGET) += drivers/usb/dwc3/
>>  libs-$(CONFIG_SPL_USB_GADGET) += drivers/usb/cdns3/
>>  libs-y += dts/
> 
> This ends up being the wrong approach as it then pulls in
> drivers/memory/stm32-fmc2-ebi.o on all of those platforms, in SPL, which
> is not what's intended. We need an SPL_MEMORY symbol and then gate the
> directory on that.
> 

That's right. I'll fix it up. Will wait for your comments on the rest
of the series before re-spin.

cheers,
-roger


Re: [PATCH v1] rockchip: phycore_rk3288: remove phycore_init() function

2022-10-19 Thread Kever Yang



On 2022/10/18 19:25, Johan Jonker wrote:

The phycore_rk3288 board has a SPL size problem,
so remove phycore_init() function to stay within the limits.


This patch can reduce enough size to make the build pass.



Reviewed-by: Kever Yang 

Thanks,
- Kever



Signed-off-by: Johan Jonker 
---
  arch/arm/mach-rockchip/rk3288/Kconfig|  1 -
  board/phytec/phycore_rk3288/phycore-rk3288.c | 46 
  2 files changed, 47 deletions(-)

diff --git a/arch/arm/mach-rockchip/rk3288/Kconfig 
b/arch/arm/mach-rockchip/rk3288/Kconfig
index e8c57843..1be2b585 100644
--- a/arch/arm/mach-rockchip/rk3288/Kconfig
+++ b/arch/arm/mach-rockchip/rk3288/Kconfig
@@ -89,7 +89,6 @@ config TARGET_MIQI_RK3288
  config TARGET_PHYCORE_RK3288
bool "phyCORE-RK3288"
  select BOARD_LATE_INIT
-   select SPL_BOARD_INIT if SPL
help
  Add basic support for the PCM-947 carrier board, a RK3288 based
  development board made by PHYTEC. This board works in a combination
diff --git a/board/phytec/phycore_rk3288/phycore-rk3288.c 
b/board/phytec/phycore_rk3288/phycore-rk3288.c
index 17b987f6..3f49f39e 100644
--- a/board/phytec/phycore_rk3288/phycore-rk3288.c
+++ b/board/phytec/phycore_rk3288/phycore-rk3288.c
@@ -19,8 +19,6 @@
  #include 
  #include 
  #include "som.h"
-#include 
-#include 
  
  static int valid_rk3288_som(struct rk3288_som *som)

  {
@@ -77,47 +75,3 @@ int rk3288_board_late_init(void)
  
  	return 0;

  }
-
-#ifdef CONFIG_SPL_BUILD
-#if !defined(CONFIG_SPL_OF_PLATDATA)
-static int phycore_init(void)
-{
-   struct udevice *pmic;
-   int ret;
-
-   ret = uclass_first_device_err(UCLASS_PMIC, &pmic);
-   if (ret)
-   return ret;
-
-#if defined(CONFIG_SPL_POWER)
-   /* Increase USB input current to 2A */
-   ret = rk818_spl_configure_usb_input_current(pmic, 2000);
-   if (ret)
-   return ret;
-
-   /* Close charger when USB lower then 3.26V */
-   ret = rk818_spl_configure_usb_chrg_shutdown(pmic, 326);
-   if (ret)
-   return ret;
-#endif
-
-   return 0;
-}
-#endif
-
-void spl_board_init(void)
-{
-#if !defined(CONFIG_SPL_OF_PLATDATA)
-   int ret;
-
-   if (of_machine_is_compatible("phytec,rk3288-phycore-som")) {
-   ret = phycore_init();
-   if (ret) {
-   debug("Failed to set up phycore power settings: %d\n",
- ret);
-   return;
-   }
-   }
-#endif
-}
-#endif


Re: [PATCH v1] rockchip: phycore_rk3288: remove phycore_init() function

2022-10-19 Thread Wadim Egorov
Am 19.10.22 um 00:35 schrieb Johan Jonker:
>
> On 10/18/22 13:43, Wadim Egorov wrote:
>> Hi Johan,
>>
>> thanks for this Patch. You were faster with the patch.
>>
>> I hope the size reduction is enough to make it buildable with Kevers patch.
> This patch only reduces the SPL size a few hundred bytes.
> U-boot tend to grow over time.

Yes, I noticed. This discussion is coming up often.

> To be future proof your SPL > TPL size must be significantly reduced (>kB) 
> below this limit.

In other words this sounds like you are forcing RK3288 towards TPL. Is that the 
case?

But if I take a look at other RK3288 based boards, I can see that most boards 
do 
not select TPL.

As the "special" phyCORE-RK3288 SPL setup code is gone with this patch, our 
board now looks very similar to others from an SPL perspective.
With this fact, other non TPL RK3288 boards should have exactly the same size 
issue. How is this handled for them?

> Only someone with hardware can check that.
> People with a recent DT are unable to sync from Linux, because of inactive 
> board maintainers.
> Could you indicate if Phytec is interested to take up that task?

At the moment the RK3288 board is not in my focus a lot. I am not able to run 
u-boot/master tests regularly.
But I would like to keep the phyCORE-RK3288 in u-boot.

So it would be very helpful if you could clarify the future plan for SPLs on 
RK3288 SoCs.
After that I can take action to make the board more future proof (Switch to TPL 
or other things to reduce size).

Regards,
Wadim

>
> Johan
>
>
>>
>> Am 18.10.22 um 13:25 schrieb Johan Jonker:
>>> The phycore_rk3288 board has a SPL size problem,
>>> so remove phycore_init() function to stay within the limits.
>>>
>>> Signed-off-by: Johan Jonker 
>> Reviewed-by: Wadim Egorov 
>>
>>
>>> ---
>>>arch/arm/mach-rockchip/rk3288/Kconfig|  1 -
>>>board/phytec/phycore_rk3288/phycore-rk3288.c | 46 
>>>2 files changed, 47 deletions(-)
>>>
>>> diff --git a/arch/arm/mach-rockchip/rk3288/Kconfig 
>>> b/arch/arm/mach-rockchip/rk3288/Kconfig
>>> index e8c57843..1be2b585 100644
>>> --- a/arch/arm/mach-rockchip/rk3288/Kconfig
>>> +++ b/arch/arm/mach-rockchip/rk3288/Kconfig
>>> @@ -89,7 +89,6 @@ config TARGET_MIQI_RK3288
>>>config TARGET_PHYCORE_RK3288
>>> bool "phyCORE-RK3288"
>>>select BOARD_LATE_INIT
>>> -   select SPL_BOARD_INIT if SPL
>>> help
>>>   Add basic support for the PCM-947 carrier board, a RK3288 based
>>>   development board made by PHYTEC. This board works in a combination
>>> diff --git a/board/phytec/phycore_rk3288/phycore-rk3288.c 
>>> b/board/phytec/phycore_rk3288/phycore-rk3288.c
>>> index 17b987f6..3f49f39e 100644
>>> --- a/board/phytec/phycore_rk3288/phycore-rk3288.c
>>> +++ b/board/phytec/phycore_rk3288/phycore-rk3288.c
>>> @@ -19,8 +19,6 @@
>>>#include 
>>>#include 
>>>#include "som.h"
>>> -#include 
>>> -#include 
>>>
>>>static int valid_rk3288_som(struct rk3288_som *som)
>>>{
>>> @@ -77,47 +75,3 @@ int rk3288_board_late_init(void)
>>>
>>> return 0;
>>>}
>>> -
>>> -#ifdef CONFIG_SPL_BUILD
>>> -#if !defined(CONFIG_SPL_OF_PLATDATA)
>>> -static int phycore_init(void)
>>> -{
>>> -   struct udevice *pmic;
>>> -   int ret;
>>> -
>>> -   ret = uclass_first_device_err(UCLASS_PMIC, &pmic);
>>> -   if (ret)
>>> -   return ret;
>>> -
>>> -#if defined(CONFIG_SPL_POWER)
>>> -   /* Increase USB input current to 2A */
>>> -   ret = rk818_spl_configure_usb_input_current(pmic, 2000);
>>> -   if (ret)
>>> -   return ret;
>>> -
>>> -   /* Close charger when USB lower then 3.26V */
>>> -   ret = rk818_spl_configure_usb_chrg_shutdown(pmic, 326);
>>> -   if (ret)
>>> -   return ret;
>>> -#endif
>>> -
>>> -   return 0;
>>> -}
>>> -#endif
>>> -
>>> -void spl_board_init(void)
>>> -{
>>> -#if !defined(CONFIG_SPL_OF_PLATDATA)
>>> -   int ret;
>>> -
>>> -   if (of_machine_is_compatible("phytec,rk3288-phycore-som")) {
>>> -   ret = phycore_init();
>>> -   if (ret) {
>>> -   debug("Failed to set up phycore power settings: %d\n",
>>> - ret);
>>> -   return;
>>> -   }
>>> -   }
>>> -#endif
>>> -}
>>> -#endif
>>



[PATCH 01/39] video: Split SPLASH_SCREEN_ALIGN from bmp command

2022-10-19 Thread Simon Glass
The bmp command already has a way to centre the image. Using this CONFIG
option to also centre it makes it impossible to control where images are
placed on the screen. Drop the extra check.

Simplify the Kconfig file we are here.

Signed-off-by: Simon Glass 
---

 cmd/bmp.c | 4 +---
 drivers/video/Kconfig | 7 ---
 2 files changed, 5 insertions(+), 6 deletions(-)

diff --git a/cmd/bmp.c b/cmd/bmp.c
index 45f4c1296de..d72a826ae74 100644
--- a/cmd/bmp.c
+++ b/cmd/bmp.c
@@ -259,9 +259,7 @@ int bmp_display(ulong addr, int x, int y)
if (!ret) {
bool align = false;
 
-   if (CONFIG_IS_ENABLED(SPLASH_SCREEN_ALIGN) ||
-   x == BMP_ALIGN_CENTER ||
-   y == BMP_ALIGN_CENTER)
+   if (x == BMP_ALIGN_CENTER || y == BMP_ALIGN_CENTER)
align = true;
 
ret = video_bmp_display(dev, addr, x, y, align);
diff --git a/drivers/video/Kconfig b/drivers/video/Kconfig
index 4ecc158c460..0af94e90706 100644
--- a/drivers/video/Kconfig
+++ b/drivers/video/Kconfig
@@ -831,9 +831,10 @@ config SPLASH_SCREEN
  image data before it is processed and sent to the frame buffer by
  U-Boot. Define your own version to use this feature.
 
+if SPLASH_SCREEN
+
 config SPLASHIMAGE_GUARD
bool "Support unaligned BMP images"
-   depends on SPLASH_SCREEN
help
  If this option is set, then U-Boot will prevent the environment
  variable "splashimage" from being set to a problematic address
@@ -847,7 +848,6 @@ config SPLASHIMAGE_GUARD
 
 config SPLASH_SCREEN_ALIGN
bool "Allow positioning the splash image anywhere on the display"
-   depends on SPLASH_SCREEN || CMD_BMP
help
  If this option is set the splash image can be freely positioned
  on the screen. Environment variable "splashpos" specifies the
@@ -869,7 +869,6 @@ config SPLASH_SCREEN_ALIGN
 
 config SPLASH_SOURCE
bool "Control the source of the splash image"
-   depends on SPLASH_SCREEN
help
  Use the splash_source.c library. This library provides facilities to
  declare board specific splash image locations, routines for loading
@@ -900,6 +899,8 @@ config SPLASH_SOURCE
  In case the environment variable "splashfile" is not defined the
  default name 'splash.bmp' will be used.
 
+endif # SPLASH_SCREEN
+
 config VIDEO_BMP_GZIP
bool "Gzip compressed BMP image support"
depends on CMD_BMP || SPLASH_SCREEN
-- 
2.38.0.413.g74048e4d9e-goog



[PATCH 02/39] Convert CONFIG_HIDE_LOGO_VERSION to Kconfig

2022-10-19 Thread Simon Glass
This converts the following to Kconfig:
   CONFIG_HIDE_LOGO_VERSION

Signed-off-by: Simon Glass 
---

 configs/gwventana_emmc_defconfig   | 1 +
 configs/gwventana_gw5904_defconfig | 1 +
 configs/gwventana_nand_defconfig   | 1 +
 drivers/video/Kconfig  | 9 +
 include/configs/ge_b1x5v2.h| 1 -
 include/configs/ge_bx50v3.h| 1 -
 include/configs/gw_ventana.h   | 1 -
 scripts/config_whitelist.txt   | 1 -
 8 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/configs/gwventana_emmc_defconfig b/configs/gwventana_emmc_defconfig
index 01a4d28caf6..7a5cea597dc 100644
--- a/configs/gwventana_emmc_defconfig
+++ b/configs/gwventana_emmc_defconfig
@@ -162,6 +162,7 @@ CONFIG_I2C_EDID=y
 CONFIG_VIDEO_IPUV3=y
 CONFIG_SPLASH_SCREEN=y
 CONFIG_SPLASH_SCREEN_ALIGN=y
+CONFIG_HIDE_LOGO_VERSION=y
 CONFIG_WATCHDOG_TIMEOUT_MSECS=6
 CONFIG_IMX_WATCHDOG=y
 CONFIG_FDT_FIXUP_PARTITIONS=y
diff --git a/configs/gwventana_gw5904_defconfig 
b/configs/gwventana_gw5904_defconfig
index fb5870fa580..a7fa6670dd1 100644
--- a/configs/gwventana_gw5904_defconfig
+++ b/configs/gwventana_gw5904_defconfig
@@ -166,6 +166,7 @@ CONFIG_I2C_EDID=y
 CONFIG_VIDEO_IPUV3=y
 CONFIG_SPLASH_SCREEN=y
 CONFIG_SPLASH_SCREEN_ALIGN=y
+CONFIG_HIDE_LOGO_VERSION=y
 CONFIG_WATCHDOG_TIMEOUT_MSECS=6
 CONFIG_IMX_WATCHDOG=y
 CONFIG_FDT_FIXUP_PARTITIONS=y
diff --git a/configs/gwventana_nand_defconfig b/configs/gwventana_nand_defconfig
index 9f38dfabb67..0c49a27f82c 100644
--- a/configs/gwventana_nand_defconfig
+++ b/configs/gwventana_nand_defconfig
@@ -172,6 +172,7 @@ CONFIG_I2C_EDID=y
 CONFIG_VIDEO_IPUV3=y
 CONFIG_SPLASH_SCREEN=y
 CONFIG_SPLASH_SCREEN_ALIGN=y
+CONFIG_HIDE_LOGO_VERSION=y
 CONFIG_WATCHDOG_TIMEOUT_MSECS=6
 CONFIG_IMX_WATCHDOG=y
 CONFIG_FDT_FIXUP_PARTITIONS=y
diff --git a/drivers/video/Kconfig b/drivers/video/Kconfig
index 0af94e90706..8c110639dbc 100644
--- a/drivers/video/Kconfig
+++ b/drivers/video/Kconfig
@@ -867,6 +867,15 @@ config SPLASH_SCREEN_ALIGN
=> vertically centered image
   at x = dspWidth - bmpWidth - 9
 
+config HIDE_LOGO_VERSION
+   bool "Hide the version information on the splash screen"
+   help
+ Normally the U-Boot version string is shown on the display when the
+ splash screen is enabled. This information is not otherwise visible
+ since video starts up after U-Boot has displayed the initial banner.
+
+ Enable this option to hide this information.
+
 config SPLASH_SOURCE
bool "Control the source of the splash image"
help
diff --git a/include/configs/ge_b1x5v2.h b/include/configs/ge_b1x5v2.h
index 95ba20c686b..176f80bb09b 100644
--- a/include/configs/ge_b1x5v2.h
+++ b/include/configs/ge_b1x5v2.h
@@ -34,7 +34,6 @@
 #define CONFIG_USBD_HS
 
 /* Video */
-#define CONFIG_HIDE_LOGO_VERSION
 #define CONFIG_IMX_VIDEO_SKIP
 
 /* Memory */
diff --git a/include/configs/ge_bx50v3.h b/include/configs/ge_bx50v3.h
index ad00769bdee..ab8c66f263d 100644
--- a/include/configs/ge_bx50v3.h
+++ b/include/configs/ge_bx50v3.h
@@ -103,7 +103,6 @@
 #define CONFIG_SYS_FSL_USDHC_NUM   3
 
 /* Framebuffer */
-#define CONFIG_HIDE_LOGO_VERSION
 #define CONFIG_IMX_HDMI
 #define CONFIG_IMX_VIDEO_SKIP
 
diff --git a/include/configs/gw_ventana.h b/include/configs/gw_ventana.h
index 82076ff74ff..bba64af2c91 100644
--- a/include/configs/gw_ventana.h
+++ b/include/configs/gw_ventana.h
@@ -47,7 +47,6 @@
 /* Framebuffer and LCD */
 #define CONFIG_IMX_HDMI
 #define CONFIG_IMX_VIDEO_SKIP
-#define CONFIG_HIDE_LOGO_VERSION  /* Custom config to hide U-boot version */
 
 /* Miscellaneous configurable options */
 #define CONFIG_HWCONFIG
diff --git a/scripts/config_whitelist.txt b/scripts/config_whitelist.txt
index 137b7f61ac1..3cace62682c 100644
--- a/scripts/config_whitelist.txt
+++ b/scripts/config_whitelist.txt
@@ -64,7 +64,6 @@ CONFIG_G_DNL_THOR_VENDOR_NUM
 CONFIG_G_DNL_UMS_PRODUCT_NUM
 CONFIG_G_DNL_UMS_VENDOR_NUM
 CONFIG_HDMI_ENCODER_I2C_ADDR
-CONFIG_HIDE_LOGO_VERSION
 CONFIG_HIKEY_GPIO
 CONFIG_HOSTNAME
 CONFIG_HPS_ALTERAGRP_DBGATCLK
-- 
2.38.0.413.g74048e4d9e-goog



[PATCH 03/39] video: Rename CONFIG_SYS_VIDEO_LOGO_MAX_SIZE

2022-10-19 Thread Simon Glass
This option should not have the SYS_ in it. Drop it so it fits in with the
other video options.

Also simplify the alignment code in gunzip_bmp(), since malloc() always
returns a 32-bit-aligned pointer.

Signed-off-by: Simon Glass 
---

 board/menlo/m53menlo/m53menlo.c |  6 +++---
 cmd/bmp.c   | 19 ---
 drivers/video/Kconfig   |  3 +++
 include/configs/m53menlo.h  |  2 +-
 include/configs/mx23evk.h   |  2 +-
 include/configs/mx28evk.h   |  2 +-
 include/configs/nitrogen6x.h|  2 +-
 include/configs/s5pc210_universal.h |  2 +-
 include/configs/trats.h |  2 +-
 include/configs/trats2.h|  2 +-
 scripts/config_whitelist.txt|  2 +-
 11 files changed, 22 insertions(+), 22 deletions(-)

diff --git a/board/menlo/m53menlo/m53menlo.c b/board/menlo/m53menlo/m53menlo.c
index 4afc5aaa436..14324c7087d 100644
--- a/board/menlo/m53menlo/m53menlo.c
+++ b/board/menlo/m53menlo/m53menlo.c
@@ -358,7 +358,7 @@ int board_late_init(void)
return 0;
 
addr = hextoul(s, NULL);
-   dst = malloc(CONFIG_SYS_VIDEO_LOGO_MAX_SIZE);
+   dst = malloc(CONFIG_VIDEO_LOGO_MAX_SIZE);
if (!dst)
return -ENOMEM;
 
@@ -366,8 +366,8 @@ int board_late_init(void)
if (ret < 0)
goto splasherr;
 
-   len = CONFIG_SYS_VIDEO_LOGO_MAX_SIZE;
-   ret = gunzip(dst + 2, CONFIG_SYS_VIDEO_LOGO_MAX_SIZE - 2,
+   len = CONFIG_VIDEO_LOGO_MAX_SIZE;
+   ret = gunzip(dst + 2, CONFIG_VIDEO_LOGO_MAX_SIZE - 2,
 (uchar *)addr, &len);
if (ret) {
printf("Error: no valid bmp or bmp.gz image at %lx\n", addr);
diff --git a/cmd/bmp.c b/cmd/bmp.c
index d72a826ae74..5a3c8ddf8c8 100644
--- a/cmd/bmp.c
+++ b/cmd/bmp.c
@@ -48,27 +48,24 @@ struct bmp_image *gunzip_bmp(unsigned long addr, unsigned 
long *lenp,
/*
 * Decompress bmp image
 */
-   len = CONFIG_SYS_VIDEO_LOGO_MAX_SIZE;
+   len = CONFIG_VIDEO_LOGO_MAX_SIZE;
/* allocate extra 3 bytes for 32-bit-aligned-address + 2 alignment */
-   dst = malloc(CONFIG_SYS_VIDEO_LOGO_MAX_SIZE + 3);
-   if (dst == NULL) {
+   dst = malloc(CONFIG_VIDEO_LOGO_MAX_SIZE + 3);
+   if (!dst) {
puts("Error: malloc in gunzip failed!\n");
return NULL;
}
 
-   bmp = dst;
-
/* align to 32-bit-aligned-address + 2 */
-   bmp = (struct bmp_image *)uintptr_t)dst + 1) & ~3) + 2);
+   bmp = dst + 2;
 
-   if (gunzip(bmp, CONFIG_SYS_VIDEO_LOGO_MAX_SIZE, map_sysmem(addr, 0),
-  &len) != 0) {
+   if (gunzip(bmp, CONFIG_VIDEO_LOGO_MAX_SIZE, map_sysmem(addr, 0),
+  &len)) {
free(dst);
return NULL;
}
-   if (len == CONFIG_SYS_VIDEO_LOGO_MAX_SIZE)
-   puts("Image could be truncated"
-   " (increase 
CONFIG_SYS_VIDEO_LOGO_MAX_SIZE)!\n");
+   if (len == CONFIG_VIDEO_LOGO_MAX_SIZE)
+   puts("Image could be truncated (increase 
CONFIG_VIDEO_LOGO_MAX_SIZE)!\n");
 
/*
 * Check for bmp mark 'BM'
diff --git a/drivers/video/Kconfig b/drivers/video/Kconfig
index 8c110639dbc..a4c9bc62daa 100644
--- a/drivers/video/Kconfig
+++ b/drivers/video/Kconfig
@@ -918,6 +918,9 @@ config VIDEO_BMP_GZIP
  images, gzipped BMP images can be displayed via the
  splashscreen support or the bmp command.
 
+config VIDEO_LOGO_MAX_SIZE
+   bool "Maximum size of the bitmap logo in bytes"
+
 config VIDEO_BMP_RLE8
bool "Run length encoded BMP image (RLE8) support"
depends on DM_VIDEO
diff --git a/include/configs/m53menlo.h b/include/configs/m53menlo.h
index 0499e633512..139919f391e 100644
--- a/include/configs/m53menlo.h
+++ b/include/configs/m53menlo.h
@@ -81,7 +81,7 @@
 /*
  * LCD
  */
-#define CONFIG_SYS_VIDEO_LOGO_MAX_SIZE (2 << 20)
+#define CONFIG_VIDEO_LOGO_MAX_SIZE (2 << 20)
 
 /* LVDS display */
 #define CONFIG_SYS_LDB_CLOCK   3326
diff --git a/include/configs/mx23evk.h b/include/configs/mx23evk.h
index 3507e83fb38..69d4552546f 100644
--- a/include/configs/mx23evk.h
+++ b/include/configs/mx23evk.h
@@ -23,7 +23,7 @@
 
 /* Framebuffer support */
 #ifdef CONFIG_DM_VIDEO
-#define CONFIG_SYS_VIDEO_LOGO_MAX_SIZE (512 << 10)
+#define CONFIG_VIDEO_LOGO_MAX_SIZE (512 << 10)
 #endif
 
 /* Extra Environments */
diff --git a/include/configs/mx28evk.h b/include/configs/mx28evk.h
index 9f3ac48b70a..6c2fcbf7645 100644
--- a/include/configs/mx28evk.h
+++ b/include/configs/mx28evk.h
@@ -26,7 +26,7 @@
 
 /* Framebuffer support */
 #ifdef CONFIG_DM_VIDEO
-#define CONFIG_SYS_VIDEO_LOGO_MAX_SIZE (512 << 10)
+#define CONFIG_VIDEO_LOGO_MAX_SIZE (512 << 10)
 #endif
 
 /* Extra Environment */
diff --git a/include/configs/nitrogen6x.h b/include/configs/nitrogen6x.h
index 2007b48868f..92c8198cc4b 100644
--- a/include/configs/nitrog

[PATCH 04/39] Convert CONFIG_VIDEO_LOGO_MAX_SIZE to Kconfig

2022-10-19 Thread Simon Glass
This converts the following to Kconfig:
   CONFIG_VIDEO_LOGO_MAX_SIZE

Signed-off-by: Simon Glass 
---

 configs/m53menlo_defconfig  |  1 +
 configs/mx6qsabrelite_defconfig |  1 +
 configs/nitrogen6dl2g_defconfig |  1 +
 configs/nitrogen6dl_defconfig   |  1 +
 configs/nitrogen6q2g_defconfig  |  1 +
 configs/nitrogen6q_defconfig|  1 +
 configs/nitrogen6s1g_defconfig  |  1 +
 configs/nitrogen6s_defconfig|  1 +
 configs/s5pc210_universal_defconfig |  1 +
 configs/trats2_defconfig|  1 +
 configs/trats_defconfig |  1 +
 drivers/video/Kconfig   |  7 ++-
 include/configs/m53menlo.h  |  5 -
 include/configs/mx23evk.h   | 11 ---
 include/configs/mx28evk.h   |  7 ---
 include/configs/nitrogen6x.h|  1 -
 include/configs/s5pc210_universal.h |  1 -
 include/configs/trats.h |  3 ---
 include/configs/trats2.h|  3 ---
 scripts/config_whitelist.txt|  1 -
 20 files changed, 17 insertions(+), 33 deletions(-)

diff --git a/configs/m53menlo_defconfig b/configs/m53menlo_defconfig
index 5db591a2120..0e9982e7b1a 100644
--- a/configs/m53menlo_defconfig
+++ b/configs/m53menlo_defconfig
@@ -127,6 +127,7 @@ CONFIG_SPLASHIMAGE_GUARD=y
 CONFIG_SPLASH_SCREEN_ALIGN=y
 CONFIG_SPLASH_SOURCE=y
 CONFIG_VIDEO_BMP_GZIP=y
+CONFIG_VIDEO_LOGO_MAX_SIZE=0x20
 CONFIG_BMP_16BPP=y
 CONFIG_WATCHDOG_TIMEOUT_MSECS=8000
 CONFIG_IMX_WATCHDOG=y
diff --git a/configs/mx6qsabrelite_defconfig b/configs/mx6qsabrelite_defconfig
index 8ccf6b76a5f..33e1a520876 100644
--- a/configs/mx6qsabrelite_defconfig
+++ b/configs/mx6qsabrelite_defconfig
@@ -93,5 +93,6 @@ CONFIG_VIDEO_IPUV3=y
 CONFIG_SPLASH_SCREEN=y
 CONFIG_SPLASH_SCREEN_ALIGN=y
 CONFIG_VIDEO_BMP_GZIP=y
+CONFIG_VIDEO_LOGO_MAX_SIZE=0x60
 CONFIG_VIDEO_BMP_RLE8=y
 CONFIG_BMP_16BPP=y
diff --git a/configs/nitrogen6dl2g_defconfig b/configs/nitrogen6dl2g_defconfig
index ad3ad70a9d5..badb17d9480 100644
--- a/configs/nitrogen6dl2g_defconfig
+++ b/configs/nitrogen6dl2g_defconfig
@@ -98,5 +98,6 @@ CONFIG_VIDEO_IPUV3=y
 CONFIG_SPLASH_SCREEN=y
 CONFIG_SPLASH_SCREEN_ALIGN=y
 CONFIG_VIDEO_BMP_GZIP=y
+CONFIG_VIDEO_LOGO_MAX_SIZE=0x60
 CONFIG_VIDEO_BMP_RLE8=y
 CONFIG_BMP_16BPP=y
diff --git a/configs/nitrogen6dl_defconfig b/configs/nitrogen6dl_defconfig
index 4c92f6fd529..0d95ae39608 100644
--- a/configs/nitrogen6dl_defconfig
+++ b/configs/nitrogen6dl_defconfig
@@ -98,5 +98,6 @@ CONFIG_VIDEO_IPUV3=y
 CONFIG_SPLASH_SCREEN=y
 CONFIG_SPLASH_SCREEN_ALIGN=y
 CONFIG_VIDEO_BMP_GZIP=y
+CONFIG_VIDEO_LOGO_MAX_SIZE=0x60
 CONFIG_VIDEO_BMP_RLE8=y
 CONFIG_BMP_16BPP=y
diff --git a/configs/nitrogen6q2g_defconfig b/configs/nitrogen6q2g_defconfig
index 14b80c0f2d3..3ec65d42f52 100644
--- a/configs/nitrogen6q2g_defconfig
+++ b/configs/nitrogen6q2g_defconfig
@@ -101,5 +101,6 @@ CONFIG_VIDEO_IPUV3=y
 CONFIG_SPLASH_SCREEN=y
 CONFIG_SPLASH_SCREEN_ALIGN=y
 CONFIG_VIDEO_BMP_GZIP=y
+CONFIG_VIDEO_LOGO_MAX_SIZE=0x60
 CONFIG_VIDEO_BMP_RLE8=y
 CONFIG_BMP_16BPP=y
diff --git a/configs/nitrogen6q_defconfig b/configs/nitrogen6q_defconfig
index 90566f11926..ecb38fa8045 100644
--- a/configs/nitrogen6q_defconfig
+++ b/configs/nitrogen6q_defconfig
@@ -101,5 +101,6 @@ CONFIG_VIDEO_IPUV3=y
 CONFIG_SPLASH_SCREEN=y
 CONFIG_SPLASH_SCREEN_ALIGN=y
 CONFIG_VIDEO_BMP_GZIP=y
+CONFIG_VIDEO_LOGO_MAX_SIZE=0x60
 CONFIG_VIDEO_BMP_RLE8=y
 CONFIG_BMP_16BPP=y
diff --git a/configs/nitrogen6s1g_defconfig b/configs/nitrogen6s1g_defconfig
index 59753b68f23..d211cdfc0af 100644
--- a/configs/nitrogen6s1g_defconfig
+++ b/configs/nitrogen6s1g_defconfig
@@ -98,5 +98,6 @@ CONFIG_VIDEO_IPUV3=y
 CONFIG_SPLASH_SCREEN=y
 CONFIG_SPLASH_SCREEN_ALIGN=y
 CONFIG_VIDEO_BMP_GZIP=y
+CONFIG_VIDEO_LOGO_MAX_SIZE=0x60
 CONFIG_VIDEO_BMP_RLE8=y
 CONFIG_BMP_16BPP=y
diff --git a/configs/nitrogen6s_defconfig b/configs/nitrogen6s_defconfig
index 2a21a207129..f155a6770e2 100644
--- a/configs/nitrogen6s_defconfig
+++ b/configs/nitrogen6s_defconfig
@@ -98,5 +98,6 @@ CONFIG_VIDEO_IPUV3=y
 CONFIG_SPLASH_SCREEN=y
 CONFIG_SPLASH_SCREEN_ALIGN=y
 CONFIG_VIDEO_BMP_GZIP=y
+CONFIG_VIDEO_LOGO_MAX_SIZE=0x60
 CONFIG_VIDEO_BMP_RLE8=y
 CONFIG_BMP_16BPP=y
diff --git a/configs/s5pc210_universal_defconfig 
b/configs/s5pc210_universal_defconfig
index c2e1b67ce6f..9443be7dfa9 100644
--- a/configs/s5pc210_universal_defconfig
+++ b/configs/s5pc210_universal_defconfig
@@ -62,3 +62,4 @@ CONFIG_USB_GADGET_DWC2_OTG=y
 CONFIG_USB_GADGET_DWC2_OTG_PHY=y
 CONFIG_USB_GADGET_DOWNLOAD=y
 CONFIG_USB_FUNCTION_THOR=y
+CONFIG_VIDEO_LOGO_MAX_SIZE=0x4e236
diff --git a/configs/trats2_defconfig b/configs/trats2_defconfig
index c86c3975ff4..a4417560b1c 100644
--- a/configs/trats2_defconfig
+++ b/configs/trats2_defconfig
@@ -65,4 +65,5 @@ CONFIG_USB_GADGET_DWC2_OTG=y
 CONFIG_USB_GADGET_DWC2_OTG_PHY=y
 CONFIG_USB_GADGET_DOWNLOAD=y
 CONFIG_USB_FUNCTION_THOR=y
+CONFIG_VIDEO_LOGO_MAX_SIZE=0x4e236
 CONFIG_LIB_HW_RAND=y
diff --git a/configs/trats_defconfig b/configs/trats_d

[PATCH 05/39] video: lcd: Drop console rotation

2022-10-19 Thread Simon Glass
This option is not used in U-Boot anymore. Drop it option and the
associated implementation.

Signed-off-by: Simon Glass 
---

 README|  21 
 common/Makefile   |   1 -
 common/lcd_console_rotation.c | 194 --
 3 files changed, 216 deletions(-)
 delete mode 100644 common/lcd_console_rotation.c

diff --git a/README b/README
index 186f1f9a5ff..ec492f9926c 100644
--- a/README
+++ b/README
@@ -823,27 +823,6 @@ The following options need to be configured:
here, since it is cheaper to change data cache settings on
a per-section basis.
 
-
-   CONFIG_LCD_ROTATION
-
-   Sometimes, for example if the display is mounted in portrait
-   mode or even if it's mounted landscape but rotated by 180degree,
-   we need to rotate our content of the display relative to the
-   framebuffer, so that user can read the messages which are
-   printed out.
-   Once CONFIG_LCD_ROTATION is defined, the lcd_console will be
-   initialized with a given rotation from "vl_rot" out of
-   "vidinfo_t" which is provided by the board specific code.
-   The value for vl_rot is coded as following (matching to
-   fbcon=rotate: linux-kernel commandline):
-   0 = no rotation respectively 0 degree
-   1 = 90 degree rotation
-   2 = 180 degree rotation
-   3 = 270 degree rotation
-
-   If CONFIG_LCD_ROTATION is not defined, the console will be
-   initialized with 0degree rotation.
-
 - MII/PHY support:
CONFIG_PHY_CLOCK_FREQ (ppc4xx)
 
diff --git a/common/Makefile b/common/Makefile
index 1d56c9f2895..d3175b7a854 100644
--- a/common/Makefile
+++ b/common/Makefile
@@ -38,7 +38,6 @@ obj-$(CONFIG_SPLASH_SOURCE) += splash_source.o
 ifndef CONFIG_DM_VIDEO
 obj-$(CONFIG_LCD) += lcd.o lcd_console.o
 endif
-obj-$(CONFIG_LCD_ROTATION) += lcd_console_rotation.o
 obj-$(CONFIG_MENU) += menu.o
 obj-$(CONFIG_UPDATE_COMMON) += update.o
 obj-$(CONFIG_USB_KEYBOARD) += usb_kbd.o
diff --git a/common/lcd_console_rotation.c b/common/lcd_console_rotation.c
deleted file mode 100644
index a5f5c6da7be..000
--- a/common/lcd_console_rotation.c
+++ /dev/null
@@ -1,194 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0+
-/*
- * (C) Copyright 2015
- * Bernecker & Rainer Industrieelektronik GmbH - http://www.br-automation.com
- */
-
-#include 
-#include 
-#include /* Get font data, width and height */
-
-static void lcd_putc_xy90(struct console_t *pcons, ushort x, ushort y, char c)
-{
-   int fg_color = lcd_getfgcolor();
-   int bg_color = lcd_getbgcolor();
-   int col, i;
-
-   fbptr_t *dst = (fbptr_t *)pcons->fbbase +
- (x+1) * pcons->lcdsizex -
- y;
-
-   uchar msk = 0x80;
-   uchar *pfont = video_fontdata + c * VIDEO_FONT_HEIGHT;
-   for (col = 0; col < VIDEO_FONT_WIDTH; ++col) {
-   for (i = 0; i < VIDEO_FONT_HEIGHT; ++i)
-   *dst-- = (*(pfont + i) & msk) ? fg_color : bg_color;
-   msk >>= 1;
-   dst += (pcons->lcdsizex + VIDEO_FONT_HEIGHT);
-   }
-}
-
-static inline void console_setrow90(struct console_t *pcons, u32 row, int clr)
-{
-   int i, j;
-   fbptr_t *dst = (fbptr_t *)pcons->fbbase +
- pcons->lcdsizex -
- row*VIDEO_FONT_HEIGHT+1;
-
-   for (j = 0; j < pcons->lcdsizey; j++) {
-   for (i = 0; i < VIDEO_FONT_HEIGHT; i++)
-   *dst-- = clr;
-   dst += (pcons->lcdsizex + VIDEO_FONT_HEIGHT);
-   }
-}
-
-static inline void console_moverow90(struct console_t *pcons,
- u32 rowdst, u32 rowsrc)
-{
-   int i, j;
-   fbptr_t *dst = (fbptr_t *)pcons->fbbase +
- pcons->lcdsizex -
- (rowdst*VIDEO_FONT_HEIGHT+1);
-
-   fbptr_t *src = (fbptr_t *)pcons->fbbase +
- pcons->lcdsizex -
- (rowsrc*VIDEO_FONT_HEIGHT+1);
-
-   for (j = 0; j < pcons->lcdsizey; j++) {
-   for (i = 0; i < VIDEO_FONT_HEIGHT; i++)
-   *dst-- = *src--;
-   src += (pcons->lcdsizex + VIDEO_FONT_HEIGHT);
-   dst += (pcons->lcdsizex + VIDEO_FONT_HEIGHT);
-   }
-}
-static void lcd_putc_xy180(struct console_t *pcons, ushort x, ushort y, char c)
-{
-   int fg_color = lcd_getfgcolor();
-   int bg_color = lcd_getbgcolor();
-   int i, row;
-   fbptr_t *dst = (fbptr_t *)pcons->fbbase +
- pcons->lcdsizex +
- pcons->lcdsizey * pcons->lcdsizex -
- y * pcons->lcdsizex -
- 

[PATCH 06/39] video: Drop CONFIG_LCD_ALIGNMENT

2022-10-19 Thread Simon Glass
This option is not needed now that the LCD implementation is being
removed. Drop it.

Signed-off-by: Simon Glass 
---

 README   | 8 
 common/lcd.c | 8 
 include/configs/nyan-big.h   | 5 -
 include/configs/tegra20-common.h | 5 -
 scripts/config_whitelist.txt | 1 -
 5 files changed, 27 deletions(-)

diff --git a/README b/README
index ec492f9926c..d1d4a62947a 100644
--- a/README
+++ b/README
@@ -815,14 +815,6 @@ The following options need to be configured:
 
320x240. Black & white.
 
-   CONFIG_LCD_ALIGNMENT
-
-   Normally the LCD is page-aligned (typically 4KB). If this is
-   defined then the LCD will be aligned to this value instead.
-   For ARM it is sometimes useful to use MMU_SECTION_SIZE
-   here, since it is cheaper to change data cache settings on
-   a per-section basis.
-
 - MII/PHY support:
CONFIG_PHY_CLOCK_FREQ (ppc4xx)
 
diff --git a/common/lcd.c b/common/lcd.c
index a462b22a477..2134e603243 100644
--- a/common/lcd.c
+++ b/common/lcd.c
@@ -35,10 +35,6 @@
 #endif
 #endif
 
-#ifndef CONFIG_LCD_ALIGNMENT
-#define CONFIG_LCD_ALIGNMENT PAGE_SIZE
-#endif
-
 #if (LCD_BPP != LCD_COLOR8) && (LCD_BPP != LCD_COLOR16) && \
(LCD_BPP != LCD_COLOR32)
 #error Unsupported LCD BPP.
@@ -239,10 +235,6 @@ ulong lcd_setmem(ulong addr)
 
size = lcd_get_size(&line_length);
 
-   /* Round up to nearest full page, or MMU section if defined */
-   size = ALIGN(size, CONFIG_LCD_ALIGNMENT);
-   addr = ALIGN(addr - CONFIG_LCD_ALIGNMENT + 1, CONFIG_LCD_ALIGNMENT);
-
/* Allocate pages for the frame buffer. */
addr -= size;
 
diff --git a/include/configs/nyan-big.h b/include/configs/nyan-big.h
index bc5754566bd..c59e1032439 100644
--- a/include/configs/nyan-big.h
+++ b/include/configs/nyan-big.h
@@ -18,11 +18,6 @@
 #define CONFIG_TEGRA_ENABLE_UARTA
 #define CONFIG_SYS_NS16550_COM1NV_PA_APB_UARTA_BASE
 
-/* Environment in eMMC, at the end of 2nd "boot sector" */
-
-/* Align LCD to 1MB boundary */
-#define CONFIG_LCD_ALIGNMENT   MMU_SECTION_SIZE
-
 /* SPI */
 #define CONFIG_SPI_FLASH_SIZE  (4 << 20)
 
diff --git a/include/configs/tegra20-common.h b/include/configs/tegra20-common.h
index 71867bb6baa..617bfb2197c 100644
--- a/include/configs/tegra20-common.h
+++ b/include/configs/tegra20-common.h
@@ -54,11 +54,6 @@
"fdt_addr_r=0x0300\0" \
"ramdisk_addr_r=0x0310\0"
 
-/* Defines for SPL */
-
-/* Align LCD to 1MB boundary */
-#define CONFIG_LCD_ALIGNMENT   MMU_SECTION_SIZE
-
 #ifdef CONFIG_TEGRA_LP0
 #define TEGRA_LP0_ADDR 0x1C406000
 #define TEGRA_LP0_SIZE 0x2000
diff --git a/scripts/config_whitelist.txt b/scripts/config_whitelist.txt
index 4ef98b9c75d..1284b76f61b 100644
--- a/scripts/config_whitelist.txt
+++ b/scripts/config_whitelist.txt
@@ -263,7 +263,6 @@ CONFIG_KSNET_SERDES_SGMII2_BASE
 CONFIG_KSNET_SERDES_SGMII_BASE
 CONFIG_L1_INIT_RAM
 CONFIG_L2_CACHE
-CONFIG_LCD_ALIGNMENT
 CONFIG_LCD_MENU
 CONFIG_LD9040
 CONFIG_LEGACY_BOOTCMD_ENV
-- 
2.38.0.413.g74048e4d9e-goog



[PATCH 08/39] video: Drop CONFIG_LCD_INFO_BELOW_LOGO

2022-10-19 Thread Simon Glass
This option is not used anymore since the LCD implementation is being
removed. Drop it.

Signed-off-by: Simon Glass 
---

 api/api_display.c | 2 +-
 common/lcd.c  | 6 +-
 common/lcd_console.c  | 2 +-
 drivers/video/Kconfig | 4 
 include/lcd.h | 5 +
 5 files changed, 4 insertions(+), 15 deletions(-)

diff --git a/api/api_display.c b/api/api_display.c
index 4f2cdd7330e..84debac48af 100644
--- a/api/api_display.c
+++ b/api/api_display.c
@@ -10,7 +10,7 @@
 #include  /* Get font width and height */
 
 /* lcd.h needs BMP_LOGO_HEIGHT to calculate CONSOLE_ROWS */
-#if defined(CONFIG_LCD_LOGO) && !defined(CONFIG_LCD_INFO_BELOW_LOGO)
+#if defined(CONFIG_LCD_LOGO)
 #include 
 #endif
 
diff --git a/common/lcd.c b/common/lcd.c
index 2134e603243..53ff8dd7444 100644
--- a/common/lcd.c
+++ b/common/lcd.c
@@ -178,7 +178,7 @@ void lcd_clear(void)
}
 
lcd_logo();
-#if defined(CONFIG_LCD_LOGO) && !defined(CONFIG_LCD_INFO_BELOW_LOGO)
+#if defined(CONFIG_LCD_LOGO)
addr = (ulong)lcd_base + BMP_LOGO_HEIGHT * lcd_line_length;
lcd_init_console((void *)addr, panel_info.vl_col,
 panel_info.vl_row, panel_info.vl_rot);
@@ -209,11 +209,7 @@ static int lcd_init(void *lcdbase)
 
/* Initialize the console */
lcd_set_col(0);
-#ifdef CONFIG_LCD_INFO_BELOW_LOGO
-   lcd_set_row(7 + BMP_LOGO_HEIGHT / VIDEO_FONT_HEIGHT);
-#else
lcd_set_row(1); /* leave 1 blank line below logo */
-#endif
 
return 0;
 }
diff --git a/common/lcd_console.c b/common/lcd_console.c
index ed36c78440c..cde96deb3c2 100644
--- a/common/lcd_console.c
+++ b/common/lcd_console.c
@@ -125,7 +125,7 @@ static inline void console_newline(void)
 void console_calc_rowcol(struct console_t *pcons, u32 sizex, u32 sizey)
 {
pcons->cols = sizex / VIDEO_FONT_WIDTH;
-#if defined(CONFIG_LCD_LOGO) && !defined(CONFIG_LCD_INFO_BELOW_LOGO)
+#if defined(CONFIG_LCD_LOGO)
pcons->rows = (pcons->lcdsizey - BMP_LOGO_HEIGHT);
pcons->rows /= VIDEO_FONT_HEIGHT;
 #else
diff --git a/drivers/video/Kconfig b/drivers/video/Kconfig
index 02220399cb4..749fea3ffdb 100644
--- a/drivers/video/Kconfig
+++ b/drivers/video/Kconfig
@@ -729,10 +729,6 @@ config LCD_LOGO
bool "Show a logo on screen"
depends on LCD
 
-config LCD_INFO_BELOW_LOGO
-   bool "Show LCD info below the on-screen logo"
-   depends on LCD_INFO && LCD_LOGO
-
 config VIDEO_DW_HDMI
bool
help
diff --git a/include/lcd.h b/include/lcd.h
index 4f180692781..751b0032efc 100644
--- a/include/lcd.h
+++ b/include/lcd.h
@@ -144,10 +144,7 @@ void lcd_sync(void);
 #define LCD_COLOR164
 #define LCD_COLOR325
 
-#if defined(CONFIG_LCD_INFO_BELOW_LOGO)
-#define LCD_INFO_X 0
-#define LCD_INFO_Y (BMP_LOGO_HEIGHT + VIDEO_FONT_HEIGHT)
-#elif defined(CONFIG_LCD_LOGO)
+#if defined(CONFIG_LCD_LOGO)
 #define LCD_INFO_X (BMP_LOGO_WIDTH + 4 * VIDEO_FONT_WIDTH)
 #define LCD_INFO_Y VIDEO_FONT_HEIGHT
 #else
-- 
2.38.0.413.g74048e4d9e-goog



[PATCH 13/39] video: Drop VCXK video controller

2022-10-19 Thread Simon Glass
This relies on the old LCD implementation which is to be removed. Drop it.

Signed-off-by: Simon Glass 
---

 board/BuS/eb_cpu5282/eb_cpu5282.c |  82 -
 common/stdio.c|   2 -
 configs/eb_cpu5282_defconfig  |   1 -
 configs/eb_cpu5282_internal_defconfig |   1 -
 doc/README.bus_vcxk   |  67 
 drivers/video/Kconfig |   6 -
 drivers/video/Makefile|   1 -
 drivers/video/bus_vcxk.c  | 426 --
 8 files changed, 586 deletions(-)
 delete mode 100644 doc/README.bus_vcxk
 delete mode 100644 drivers/video/bus_vcxk.c

diff --git a/board/BuS/eb_cpu5282/eb_cpu5282.c 
b/board/BuS/eb_cpu5282/eb_cpu5282.c
index b739bc3ca6a..173350b7061 100644
--- a/board/BuS/eb_cpu5282/eb_cpu5282.c
+++ b/board/BuS/eb_cpu5282/eb_cpu5282.c
@@ -21,11 +21,6 @@
 
 DECLARE_GLOBAL_DATA_PTR;
 
-#if IS_ENABLED(CONFIG_VIDEO_VCXK)
-extern unsigned long display_width;
-extern unsigned long display_height;
-#endif
-
 /*---*/
 
 int checkboard (void)
@@ -184,84 +179,7 @@ void __led_set(led_id_t mask, int state)
MCFGPTA_GPTPORT &= ~(1 << 3);
 }
 
-#if IS_ENABLED(CONFIG_VIDEO_VCXK)
-int drv_video_init(void)
-{
-   char *s;
-#ifdef CONFIG_SPLASH_SCREEN
-   unsigned long splash;
-#endif
-   printf("Init Video as ");
-   s = env_get("displaywidth");
-   if (s != NULL)
-   display_width = dectoul(s, NULL);
-   else
-   display_width = 256;
-
-   s = env_get("displayheight");
-   if (s != NULL)
-   display_height = dectoul(s, NULL);
-   else
-   display_height = 256;
-
-   printf("%lu x %lu pixel matrix\n", display_width, display_height);
-
-   MCFCCM_CCR &= ~MCFCCM_CCR_SZEN;
-   MCFGPIO_PEPAR &= ~MCFGPIO_PEPAR_PEPA2;
-
-   vcxk_init(display_width, display_height);
-
-#ifdef CONFIG_SPLASH_SCREEN
-   s = env_get("splashimage");
-   if (s != NULL) {
-   splash = hextoul(s, NULL);
-   vcxk_acknowledge_wait();
-   video_display_bitmap(splash, 0, 0);
-   }
-#endif
-   return 0;
-}
-#endif
-
-/*---*/
-
-#if IS_ENABLED(CONFIG_VIDEO_VCXK)
-int do_brightness(struct cmd_tbl *cmdtp, int flag, int argc, char *const 
argv[])
-{
-   int rcode = 0;
-   ulong side;
-   ulong bright;
-
-   switch (argc) {
-   case 3:
-   side = dectoul(argv[1], NULL);
-   bright = dectoul(argv[2], NULL);
-   if ((side >= 0) && (side <= 3) &&
-   (bright >= 0) && (bright <= 1000)) {
-   vcxk_setbrightness(side, bright);
-   rcode = 0;
-   } else {
-   printf("parameters out of range\n");
-   printf("Usage:\n%s\n", cmdtp->usage);
-   rcode = 1;
-   }
-   break;
-   default:
-   printf("Usage:\n%s\n", cmdtp->usage);
-   rcode = 1;
-   break;
-   }
-   return rcode;
-}
-
 /*---*/
 
-U_BOOT_CMD(
-   bright, 3,  0,  do_brightness,
-   "sets the display brightness\n",
-   "  <0..1000>\nside: 0/3=both; 1=first; 2=second\n"
-);
-
-#endif
 
 /* EOF EB+MCF-EV123.c */
diff --git a/common/stdio.c b/common/stdio.c
index e316a355fae..a6d8a4b674f 100644
--- a/common/stdio.c
+++ b/common/stdio.c
@@ -369,8 +369,6 @@ int stdio_add_devices(void)
} else {
if (IS_ENABLED(CONFIG_LCD))
drv_lcd_init();
-   if (IS_ENABLED(CONFIG_VIDEO_VCXK))
-   drv_video_init();
}
 
 #if defined(CONFIG_KEYBOARD) && !defined(CONFIG_DM_KEYBOARD)
diff --git a/configs/eb_cpu5282_defconfig b/configs/eb_cpu5282_defconfig
index b46d1637716..f74139de332 100644
--- a/configs/eb_cpu5282_defconfig
+++ b/configs/eb_cpu5282_defconfig
@@ -53,4 +53,3 @@ CONFIG_MCFFEC=y
 CONFIG_MII=y
 CONFIG_MCFUART=y
 CONFIG_SPLASH_SCREEN=y
-CONFIG_VIDEO_VCXK=y
diff --git a/configs/eb_cpu5282_internal_defconfig 
b/configs/eb_cpu5282_internal_defconfig
index cd0fe911108..6cae31cfa95 100644
--- a/configs/eb_cpu5282_internal_defconfig
+++ b/configs/eb_cpu5282_internal_defconfig
@@ -51,4 +51,3 @@ CONFIG_MCFFEC=y
 CONFIG_MII=y
 CONFIG_MCFUART=y
 CONFIG_SPLASH_SCREEN=y
-CONFIG_VIDEO_VCXK=y
diff --git a/doc/README.bus_vcxk b/doc/README.bus_vcxk
deleted file mode 100644
index aaa1565ddec..000
--- a/doc/README.bus_vcxk
+++ /dev/null
@@ -1,67 +0,0 @@
-SPDX-License-Identifier: GPL-2.0+
-/*
- * (C) Copyright 2008-2009
- * BuS Elektronik GmbH & Co. KG 
- * Jens Scharsig 
- */
-
-U-Boot vcxk video controller driver
-==
-
-By defining CONFIG_VIDEO_VCXK this driver can 

[PATCH 09/39] video: Drop CONFIG_LCD_INFO

2022-10-19 Thread Simon Glass
This option is not used anymore since the LCD implementation is being
removed. Drop it.

Signed-off-by: Simon Glass 
---

 board/atmel/at91sam9261ek/at91sam9261ek.c | 28 
 board/atmel/at91sam9263ek/at91sam9263ek.c | 45 ---
 .../atmel/at91sam9m10g45ek/at91sam9m10g45ek.c | 28 
 board/atmel/at91sam9n12ek/at91sam9n12ek.c | 30 -
 board/atmel/at91sam9rlek/at91sam9rlek.c   | 28 
 common/lcd.c  |  5 ---
 configs/pm9261_defconfig  |  1 -
 configs/pm9263_defconfig  |  1 -
 drivers/video/Kconfig |  4 --
 include/lcd.h |  8 
 10 files changed, 178 deletions(-)

diff --git a/board/atmel/at91sam9261ek/at91sam9261ek.c 
b/board/atmel/at91sam9261ek/at91sam9261ek.c
index 8a7a960c26b..e5fdf383996 100644
--- a/board/atmel/at91sam9261ek/at91sam9261ek.c
+++ b/board/atmel/at91sam9261ek/at91sam9261ek.c
@@ -194,34 +194,6 @@ static void at91sam9261ek_lcd_hw_init(void)
 #endif
 }
 
-#ifdef CONFIG_LCD_INFO
-#include 
-#include 
-
-void lcd_show_board_info(void)
-{
-   ulong dram_size, nand_size;
-   int i;
-   char temp[32];
-
-   lcd_printf ("%s\n", U_BOOT_VERSION);
-   lcd_printf ("(C) 2008 ATMEL Corp\n");
-   lcd_printf ("at91supp...@atmel.com\n");
-   lcd_printf ("%s CPU at %s MHz\n",
-   ATMEL_CPU_NAME,
-   strmhz(temp, get_cpu_clk_rate()));
-
-   dram_size = 0;
-   for (i = 0; i < CONFIG_NR_DRAM_BANKS; i++)
-   dram_size += gd->bd->bi_dram[i].size;
-   nand_size = 0;
-   for (i = 0; i < CONFIG_SYS_MAX_NAND_DEVICE; i++)
-   nand_size += get_nand_dev_by_index(i)->size;
-   lcd_printf ("  %ld MB SDRAM, %ld MB NAND\n",
-   dram_size >> 20,
-   nand_size >> 20 );
-}
-#endif /* CONFIG_LCD_INFO */
 #endif
 
 #ifdef CONFIG_DEBUG_UART_BOARD_INIT
diff --git a/board/atmel/at91sam9263ek/at91sam9263ek.c 
b/board/atmel/at91sam9263ek/at91sam9263ek.c
index 86b4050c4c1..7c15a76587d 100644
--- a/board/atmel/at91sam9263ek/at91sam9263ek.c
+++ b/board/atmel/at91sam9263ek/at91sam9263ek.c
@@ -134,51 +134,6 @@ static void at91sam9263ek_lcd_hw_init(void)
gd->fb_base = ATMEL_BASE_SRAM0;
 }
 
-#ifdef CONFIG_LCD_INFO
-#include 
-#include 
-
-#ifdef CONFIG_MTD_NOR_FLASH
-#include 
-#endif
-
-void lcd_show_board_info(void)
-{
-   ulong dram_size, nand_size;
-#ifdef CONFIG_MTD_NOR_FLASH
-   ulong flash_size;
-#endif
-   int i;
-   char temp[32];
-
-   lcd_printf ("%s\n", U_BOOT_VERSION);
-   lcd_printf ("(C) 2008 ATMEL Corp\n");
-   lcd_printf ("at91supp...@atmel.com\n");
-   lcd_printf ("%s CPU at %s MHz\n",
-   ATMEL_CPU_NAME,
-   strmhz(temp, get_cpu_clk_rate()));
-
-   dram_size = 0;
-   for (i = 0; i < CONFIG_NR_DRAM_BANKS; i++)
-   dram_size += gd->bd->bi_dram[i].size;
-   nand_size = 0;
-   for (i = 0; i < CONFIG_SYS_MAX_NAND_DEVICE; i++)
-   nand_size += get_nand_dev_by_index(i)->size;
-#ifdef CONFIG_MTD_NOR_FLASH
-   flash_size = 0;
-   for (i = 0; i < CONFIG_SYS_MAX_FLASH_BANKS; i++)
-   flash_size += flash_info[i].size;
-#endif
-   lcd_printf ("  %ld MB SDRAM, %ld MB NAND",
-   dram_size >> 20,
-   nand_size >> 20 );
-#ifdef CONFIG_MTD_NOR_FLASH
-   lcd_printf (",\n  %ld MB NOR",
-   flash_size >> 20);
-#endif
-   lcd_puts ("\n");
-}
-#endif /* CONFIG_LCD_INFO */
 #endif
 
 #ifdef CONFIG_DEBUG_UART_BOARD_INIT
diff --git a/board/atmel/at91sam9m10g45ek/at91sam9m10g45ek.c 
b/board/atmel/at91sam9m10g45ek/at91sam9m10g45ek.c
index 347197a6067..3ab9fb321a7 100644
--- a/board/atmel/at91sam9m10g45ek/at91sam9m10g45ek.c
+++ b/board/atmel/at91sam9m10g45ek/at91sam9m10g45ek.c
@@ -218,34 +218,6 @@ static void at91sam9m10g45ek_lcd_hw_init(void)
gd->fb_base = 0x73E0;
 }
 
-#ifdef CONFIG_LCD_INFO
-#include 
-#include 
-
-void lcd_show_board_info(void)
-{
-   ulong dram_size, nand_size;
-   int i;
-   char temp[32];
-
-   lcd_printf ("%s\n", U_BOOT_VERSION);
-   lcd_printf ("(C) 2008 ATMEL Corp\n");
-   lcd_printf ("at91supp...@atmel.com\n");
-   lcd_printf ("%s CPU at %s MHz\n",
-   ATMEL_CPU_NAME,
-   strmhz(temp, get_cpu_clk_rate()));
-
-   dram_size = 0;
-   for (i = 0; i < CONFIG_NR_DRAM_BANKS; i++)
-   dram_size += gd->bd->bi_dram[i].size;
-   nand_size = 0;
-   for (i = 0; i < CONFIG_SYS_MAX_NAND_DEVICE; i++)
-   nand_size += get_nand_dev_by_index(i)->size;
-   lcd_printf ("  %ld MB SDRAM, %ld MB NAND\n",
-   dram_size >> 20,
-   nand_size >> 20 );
-}
-#endif /* CONFIG_LCD_INFO */
 #endif
 
 #ifdef CONFIG_DEBUG_UART_BOARD_INIT
diff --git a/board/atmel/at91sam9n12ek/at91sam9n12ek.c 
b/board/atmel/at91sam9n12ek/at91sam9n12ek.c
index a337

[PATCH 11/39] api: Drop LCD implementation

2022-10-19 Thread Simon Glass
This relies on the old LCD implementation which is to be removed. Drop it.

Signed-off-by: Simon Glass 
---

 api/api_display.c | 22 --
 1 file changed, 22 deletions(-)

diff --git a/api/api_display.c b/api/api_display.c
index 84debac48af..2e877a85d14 100644
--- a/api/api_display.c
+++ b/api/api_display.c
@@ -5,14 +5,7 @@
 
 #include 
 #include 
-#include 
 #include 
-#include  /* Get font width and height */
-
-/* lcd.h needs BMP_LOGO_HEIGHT to calculate CONSOLE_ROWS */
-#if defined(CONFIG_LCD_LOGO)
-#include 
-#endif
 
 /* TODO(clchiou): add support of video device */
 
@@ -26,14 +19,6 @@ int display_get_info(int type, struct display_info *di)
debug("%s: unsupport display device type: %d\n",
__FILE__, type);
return API_ENODEV;
-#ifdef CONFIG_LCD
-   case DISPLAY_TYPE_LCD:
-   di->pixel_width  = panel_info.vl_col;
-   di->pixel_height = panel_info.vl_row;
-   di->screen_rows = lcd_get_screen_rows();
-   di->screen_cols = lcd_get_screen_columns();
-   break;
-#endif
}
 
di->type = type;
@@ -44,16 +29,9 @@ int display_draw_bitmap(ulong bitmap, int x, int y)
 {
if (!bitmap)
return API_EINVAL;
-#ifdef CONFIG_LCD
-   return lcd_display_bitmap(bitmap, x, y);
-#else
return API_ENODEV;
-#endif
 }
 
 void display_clear(void)
 {
-#ifdef CONFIG_LCD
-   lcd_clear();
-#endif
 }
-- 
2.38.0.413.g74048e4d9e-goog



[PATCH 21/39] video: samsung: Drop old LCD code

2022-10-19 Thread Simon Glass
This relies on the old LCD implementation which is to be removed. Drop it.

Signed-off-by: Simon Glass 
---

 arch/arm/mach-exynos/include/mach/mipi_dsim.h |  1 -
 board/samsung/common/board.c  |  1 -
 board/samsung/common/misc.c   |  1 -
 board/samsung/trats/trats.c   |  1 -
 board/samsung/trats2/trats2.c | 22 ---
 board/samsung/universal_c210/universal.c  |  1 -
 drivers/video/exynos/exynos_mipi_dsi_common.c |  1 -
 include/libtizen.h|  4 
 8 files changed, 32 deletions(-)

diff --git a/arch/arm/mach-exynos/include/mach/mipi_dsim.h 
b/arch/arm/mach-exynos/include/mach/mipi_dsim.h
index 20e6ce7f729..5e2b172fefb 100644
--- a/arch/arm/mach-exynos/include/mach/mipi_dsim.h
+++ b/arch/arm/mach-exynos/include/mach/mipi_dsim.h
@@ -11,7 +11,6 @@
 
 #include 
 #include 
-#include 
 
 #define PANEL_NAME_SIZE(32)
 
diff --git a/board/samsung/common/board.c b/board/samsung/common/board.c
index 04cfc5d6358..49d40244644 100644
--- a/board/samsung/common/board.c
+++ b/board/samsung/common/board.c
@@ -26,7 +26,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
diff --git a/board/samsung/common/misc.c b/board/samsung/common/misc.c
index ee6d2d2a0d7..9c0ec29c937 100644
--- a/board/samsung/common/misc.c
+++ b/board/samsung/common/misc.c
@@ -7,7 +7,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
diff --git a/board/samsung/trats/trats.c b/board/samsung/trats/trats.c
index 24bf355ef6e..1608d60dd8d 100644
--- a/board/samsung/trats/trats.c
+++ b/board/samsung/trats/trats.c
@@ -8,7 +8,6 @@
 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
diff --git a/board/samsung/trats2/trats2.c b/board/samsung/trats2/trats2.c
index da7f0dc0229..93c9714d33f 100644
--- a/board/samsung/trats2/trats2.c
+++ b/board/samsung/trats2/trats2.c
@@ -6,7 +6,6 @@
  */
 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -282,24 +281,3 @@ int g_dnl_board_usb_cable_connected(void)
 #endif
 }
 #endif
-
-/*
- * LCD
- */
-
-#ifdef CONFIG_LCD
-int mipi_power(void)
-{
-#if !CONFIG_IS_ENABLED(DM_I2C) /* TODO(maintainer): Convert to driver model */
-   struct pmic *p = pmic_get("MAX77686_PMIC");
-
-   /* LDO8 VMIPI_1.0V_AP */
-   max77686_set_ldo_mode(p, 8, OPMODE_ON);
-   /* LDO10 VMIPI_1.8V_AP */
-   max77686_set_ldo_mode(p, 10, OPMODE_ON);
-#endif
-
-   return 0;
-}
-
-#endif /* LCD */
diff --git a/board/samsung/universal_c210/universal.c 
b/board/samsung/universal_c210/universal.c
index 078db0c0c4e..37c9d7f452f 100644
--- a/board/samsung/universal_c210/universal.c
+++ b/board/samsung/universal_c210/universal.c
@@ -9,7 +9,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
diff --git a/drivers/video/exynos/exynos_mipi_dsi_common.c 
b/drivers/video/exynos/exynos_mipi_dsi_common.c
index ab7d61afc88..be67cebae7f 100644
--- a/drivers/video/exynos/exynos_mipi_dsi_common.c
+++ b/drivers/video/exynos/exynos_mipi_dsi_common.c
@@ -7,7 +7,6 @@
  */
 
 #include 
-#include 
 #include 
 #include 
 #include 
diff --git a/include/libtizen.h b/include/libtizen.h
index 655d4cb28c5..15e01454b93 100644
--- a/include/libtizen.h
+++ b/include/libtizen.h
@@ -9,8 +9,4 @@
 
 #define HD_RESOLUTION  0
 
-#ifdef CONFIG_LCD
-void get_tizen_logo_info(vidinfo_t *vid);
-#endif
-
 #endif /* _LIBTIZEN_H_ */
-- 
2.38.0.413.g74048e4d9e-goog



[PATCH 36/39] video: Drop SPLASHIMAGE_CALLBACK

2022-10-19 Thread Simon Glass
This is not used anymore. Drop it.

Signed-off-by: Simon Glass 
---

 configs/m53menlo_defconfig |  1 -
 drivers/video/Kconfig  | 13 -
 include/env_callback.h |  7 ---
 3 files changed, 21 deletions(-)

diff --git a/configs/m53menlo_defconfig b/configs/m53menlo_defconfig
index 0e9982e7b1a..e444d16ce30 100644
--- a/configs/m53menlo_defconfig
+++ b/configs/m53menlo_defconfig
@@ -123,7 +123,6 @@ CONFIG_VIDEO_LOGO=y
 CONFIG_SYS_WHITE_ON_BLACK=y
 CONFIG_VIDEO_IPUV3=y
 CONFIG_SPLASH_SCREEN=y
-CONFIG_SPLASHIMAGE_GUARD=y
 CONFIG_SPLASH_SCREEN_ALIGN=y
 CONFIG_SPLASH_SOURCE=y
 CONFIG_VIDEO_BMP_GZIP=y
diff --git a/drivers/video/Kconfig b/drivers/video/Kconfig
index 672f2ef9d82..eed9b357e83 100644
--- a/drivers/video/Kconfig
+++ b/drivers/video/Kconfig
@@ -803,19 +803,6 @@ config SPLASH_SCREEN
 
 if SPLASH_SCREEN
 
-config SPLASHIMAGE_GUARD
-   bool "Support unaligned BMP images"
-   help
- If this option is set, then U-Boot will prevent the environment
- variable "splashimage" from being set to a problematic address
- (see doc/README.displaying-bmps).
-
- This option is useful for targets where, due to alignment
- restrictions, an improperly aligned BMP image will cause a data
- abort. If you think you will not have problems with unaligned
- accesses (for example because your toolchain prevents them)
- there is no need to set this option.
-
 config SPLASH_SCREEN_ALIGN
bool "Allow positioning the splash image anywhere on the display"
help
diff --git a/include/env_callback.h b/include/env_callback.h
index d5d2b2fcad6..1eae0efca2e 100644
--- a/include/env_callback.h
+++ b/include/env_callback.h
@@ -24,12 +24,6 @@
 #define SILENT_CALLBACK
 #endif
 
-#ifdef CONFIG_SPLASHIMAGE_GUARD
-#define SPLASHIMAGE_CALLBACK "splashimage:splashimage,"
-#else
-#define SPLASHIMAGE_CALLBACK
-#endif
-
 #ifdef CONFIG_REGEX
 #define ENV_DOT_ESCAPE "\\"
 #else
@@ -74,7 +68,6 @@
BOOTSTD_CALLBACK \
"loadaddr:loadaddr," \
SILENT_CALLBACK \
-   SPLASHIMAGE_CALLBACK \
"stdin:console,stdout:console,stderr:console," \
"serial#:serialno," \
CONFIG_ENV_CALLBACK_LIST_STATIC
-- 
2.38.0.413.g74048e4d9e-goog



[PATCH 23/39] compulab: Drop old LCD code

2022-10-19 Thread Simon Glass
This relies on the old LCD implementation which is to be removed. Drop it.

Signed-off-by: Simon Glass 
---

 board/compulab/common/Makefile|   1 -
 board/compulab/common/omap3_display.c | 452 --
 2 files changed, 453 deletions(-)
 delete mode 100644 board/compulab/common/omap3_display.c

diff --git a/board/compulab/common/Makefile b/board/compulab/common/Makefile
index 25dad498774..7c8226e6e16 100644
--- a/board/compulab/common/Makefile
+++ b/board/compulab/common/Makefile
@@ -6,5 +6,4 @@
 
 obj-y  += common.o
 obj-$(CONFIG_$(SPL_)SYS_I2C_LEGACY)+= eeprom.o
-obj-$(CONFIG_LCD)  += omap3_display.o
 obj-$(CONFIG_SMC911X)  += omap3_smc911x.o
diff --git a/board/compulab/common/omap3_display.c 
b/board/compulab/common/omap3_display.c
deleted file mode 100644
index 4ed3b9c00ac..000
--- a/board/compulab/common/omap3_display.c
+++ /dev/null
@@ -1,452 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0+
-/*
- * (C) Copyright 2012 - 2013 CompuLab, Ltd. 
- *
- * Authors: Nikita Kiryanov 
- *
- * Parsing code based on linux/drivers/video/pxafb.c
- */
-
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-
-enum display_type {
-   NONE,
-   DVI,
-   DVI_CUSTOM,
-   DATA_IMAGE, /* #define CONFIG_SCF0403_LCD to use */
-};
-
-#define CMAP_ADDR  0x8010
-
-/*
- * The frame buffer is allocated before we have the chance to parse user input.
- * To make sure enough memory is allocated for all resolutions, we define
- * vl_{col | row} to the maximal resolution supported by OMAP3.
- */
-vidinfo_t panel_info = {
-   .vl_col  = 1400,
-   .vl_row  = 1050,
-   .vl_bpix = LCD_BPP,
-   .cmap = (ushort *)CMAP_ADDR,
-};
-
-static struct panel_config panel_cfg;
-static enum display_type lcd_def;
-
-/*
- * A note on DVI presets;
- * U-Boot can convert 8 bit BMP data to 16 bit BMP data, and OMAP DSS can
- * convert 16 bit data into 24 bit data. Thus, GFXFORMAT_RGB16 allows us to
- * support two BMP types with one setting.
- */
-static const struct panel_config preset_dvi_640X480 = {
-   .lcd_size   = PANEL_LCD_SIZE(640, 480),
-   .timing_h   = DSS_HBP(48) | DSS_HFP(16) | DSS_HSW(96),
-   .timing_v   = DSS_VBP(33) | DSS_VFP(10) | DSS_VSW(2),
-   .pol_freq   = DSS_IHS | DSS_IVS | DSS_IPC,
-   .divisor= 12 | (1 << 16),
-   .data_lines = LCD_INTERFACE_24_BIT,
-   .panel_type = ACTIVE_DISPLAY,
-   .load_mode  = 2,
-   .gfx_format = GFXFORMAT_RGB16,
-};
-
-static const struct panel_config preset_dvi_800X600 = {
-   .lcd_size   = PANEL_LCD_SIZE(800, 600),
-   .timing_h   = DSS_HBP(88) | DSS_HFP(40) | DSS_HSW(128),
-   .timing_v   = DSS_VBP(23) | DSS_VFP(1) | DSS_VSW(4),
-   .pol_freq   = DSS_IHS | DSS_IVS | DSS_IPC,
-   .divisor= 8 | (1 << 16),
-   .data_lines = LCD_INTERFACE_24_BIT,
-   .panel_type = ACTIVE_DISPLAY,
-   .load_mode  = 2,
-   .gfx_format = GFXFORMAT_RGB16,
-};
-
-static const struct panel_config preset_dvi_1024X768 = {
-   .lcd_size   = PANEL_LCD_SIZE(1024, 768),
-   .timing_h   = DSS_HBP(160) | DSS_HFP(24) | DSS_HSW(136),
-   .timing_v   = DSS_VBP(29) | DSS_VFP(3) | DSS_VSW(6),
-   .pol_freq   = DSS_IHS | DSS_IVS | DSS_IPC,
-   .divisor= 5 | (1 << 16),
-   .data_lines = LCD_INTERFACE_24_BIT,
-   .panel_type = ACTIVE_DISPLAY,
-   .load_mode  = 2,
-   .gfx_format = GFXFORMAT_RGB16,
-};
-
-static const struct panel_config preset_dvi_1152X864 = {
-   .lcd_size   = PANEL_LCD_SIZE(1152, 864),
-   .timing_h   = DSS_HBP(256) | DSS_HFP(64) | DSS_HSW(128),
-   .timing_v   = DSS_VBP(32) | DSS_VFP(1) | DSS_VSW(3),
-   .pol_freq   = DSS_IHS | DSS_IVS | DSS_IPC,
-   .divisor= 4 | (1 << 16),
-   .data_lines = LCD_INTERFACE_24_BIT,
-   .panel_type = ACTIVE_DISPLAY,
-   .load_mode  = 2,
-   .gfx_format = GFXFORMAT_RGB16,
-};
-
-static const struct panel_config preset_dvi_1280X960 = {
-   .lcd_size   = PANEL_LCD_SIZE(1280, 960),
-   .timing_h   = DSS_HBP(312) | DSS_HFP(96) | DSS_HSW(112),
-   .timing_v   = DSS_VBP(36) | DSS_VFP(1) | DSS_VSW(3),
-   .pol_freq   = DSS_IHS | DSS_IVS | DSS_IPC,
-   .divisor= 3 | (1 << 16),
-   .data_lines = LCD_INTERFACE_24_BIT,
-   .panel_type = ACTIVE_DISPLAY,
-   .load_mode  = 2,
-   .gfx_format = GFXFORMAT_RGB16,
-};
-
-static const struct panel_config preset_dvi_1280X1024 = {
-   .lcd_size   = PANEL_LCD_SIZE(1280, 1024),
-   .timing_h   = DSS_HBP(248) | DSS_HFP(48) | DSS_HSW(112),
-   .timing_v   = DSS_VBP(38) | DSS_VFP(1) | DSS_VSW(3),
-   .pol_freq   = DSS_IHS | DSS_IVS | DSS_IPC,
-   .divisor= 3 | (1 << 16),
-   .data_lines  

[PATCH 20/39] video: Drop atmel LCD code

2022-10-19 Thread Simon Glass
This has not been migrated to DM_VIDEO since 2019. Drop it.

Signed-off-by: Simon Glass 
---

 .../mach-at91/arm926ejs/at91sam9n12_devices.c | 39 --
 arch/arm/mach-at91/armv7/sama5d3_devices.c| 33 
 board/atmel/at91sam9261ek/at91sam9261ek.c | 67 -
 board/atmel/at91sam9263ek/at91sam9263ek.c | 63 
 .../atmel/at91sam9m10g45ek/at91sam9m10g45ek.c | 75 ---
 board/atmel/at91sam9n12ek/at91sam9n12ek.c | 34 -
 board/atmel/at91sam9rlek/at91sam9rlek.c   | 60 ---
 board/bluewater/gurnard/gurnard.c |  1 -
 drivers/video/atmel_hlcdfb.c  |  1 -
 drivers/video/atmel_lcdfb.c   |  1 -
 include/configs/sama5d3xek.h  |  3 -
 scripts/config_whitelist.txt  |  1 -
 12 files changed, 378 deletions(-)

diff --git a/arch/arm/mach-at91/arm926ejs/at91sam9n12_devices.c 
b/arch/arm/mach-at91/arm926ejs/at91sam9n12_devices.c
index 736c799e2ad..9f98ce7a45c 100644
--- a/arch/arm/mach-at91/arm926ejs/at91sam9n12_devices.c
+++ b/arch/arm/mach-at91/arm926ejs/at91sam9n12_devices.c
@@ -99,42 +99,3 @@ void at91_mci_hw_init(void)
 
at91_periph_clk_enable(ATMEL_ID_HSMCI0);
 }
-
-#ifdef CONFIG_LCD
-void at91_lcd_hw_init(void)
-{
-   at91_pio3_set_a_periph(AT91_PIO_PORTC, 24, 0);  /* LCDDPWR */
-   at91_pio3_set_a_periph(AT91_PIO_PORTC, 26, 0);  /* LCDVSYNC */
-   at91_pio3_set_a_periph(AT91_PIO_PORTC, 27, 0);  /* LCDHSYNC */
-   at91_pio3_set_a_periph(AT91_PIO_PORTC, 28, 0);  /* LCDDOTCK */
-   at91_pio3_set_a_periph(AT91_PIO_PORTC, 29, 0);  /* LCDDEN */
-   at91_pio3_set_a_periph(AT91_PIO_PORTC, 30, 0);  /* LCDDOTCK */
-
-   at91_pio3_set_a_periph(AT91_PIO_PORTC, 0, 0);   /* LCDD0 */
-   at91_pio3_set_a_periph(AT91_PIO_PORTC, 1, 0);   /* LCDD1 */
-   at91_pio3_set_a_periph(AT91_PIO_PORTC, 2, 0);   /* LCDD2 */
-   at91_pio3_set_a_periph(AT91_PIO_PORTC, 3, 0);   /* LCDD3 */
-   at91_pio3_set_a_periph(AT91_PIO_PORTC, 4, 0);   /* LCDD4 */
-   at91_pio3_set_a_periph(AT91_PIO_PORTC, 5, 0);   /* LCDD5 */
-   at91_pio3_set_a_periph(AT91_PIO_PORTC, 6, 0);   /* LCDD6 */
-   at91_pio3_set_a_periph(AT91_PIO_PORTC, 7, 0);   /* LCDD7 */
-   at91_pio3_set_a_periph(AT91_PIO_PORTC, 8, 0);   /* LCDD8 */
-   at91_pio3_set_a_periph(AT91_PIO_PORTC, 9, 0);   /* LCDD9 */
-   at91_pio3_set_a_periph(AT91_PIO_PORTC, 10, 0);  /* LCDD10 */
-   at91_pio3_set_a_periph(AT91_PIO_PORTC, 11, 0);  /* LCDD11 */
-   at91_pio3_set_a_periph(AT91_PIO_PORTC, 12, 0);  /* LCDD12 */
-   at91_pio3_set_a_periph(AT91_PIO_PORTC, 13, 0);  /* LCDD13 */
-   at91_pio3_set_a_periph(AT91_PIO_PORTC, 14, 0);  /* LCDD14 */
-   at91_pio3_set_a_periph(AT91_PIO_PORTC, 15, 0);  /* LCDD15 */
-   at91_pio3_set_a_periph(AT91_PIO_PORTC, 16, 0);  /* LCDD16 */
-   at91_pio3_set_a_periph(AT91_PIO_PORTC, 17, 0);  /* LCDD17 */
-   at91_pio3_set_a_periph(AT91_PIO_PORTC, 18, 0);  /* LCDD18 */
-   at91_pio3_set_a_periph(AT91_PIO_PORTC, 19, 0);  /* LCDD19 */
-   at91_pio3_set_a_periph(AT91_PIO_PORTC, 20, 0);  /* LCDD20 */
-   at91_pio3_set_a_periph(AT91_PIO_PORTC, 21, 0);  /* LCDD21 */
-   at91_pio3_set_a_periph(AT91_PIO_PORTC, 22, 0);  /* LCDD22 */
-   at91_pio3_set_a_periph(AT91_PIO_PORTC, 23, 0);  /* LCDD23 */
-
-   at91_periph_clk_enable(ATMEL_ID_LCDC);
-}
-#endif
diff --git a/arch/arm/mach-at91/armv7/sama5d3_devices.c 
b/arch/arm/mach-at91/armv7/sama5d3_devices.c
index 091059ea565..04b700a94d7 100644
--- a/arch/arm/mach-at91/armv7/sama5d3_devices.c
+++ b/arch/arm/mach-at91/armv7/sama5d3_devices.c
@@ -170,39 +170,6 @@ void at91_gmac_hw_init(void)
 }
 #endif
 
-#ifdef CONFIG_LCD
-void at91_lcd_hw_init(void)
-{
-   at91_pio3_set_a_periph(AT91_PIO_PORTA, 24, 0);  /* LCDPWM */
-   at91_pio3_set_a_periph(AT91_PIO_PORTA, 25, 0);  /* LCDDISP */
-   at91_pio3_set_a_periph(AT91_PIO_PORTA, 26, 0);  /* LCDVSYNC */
-   at91_pio3_set_a_periph(AT91_PIO_PORTA, 27, 0);  /* LCDHSYNC */
-   at91_pio3_set_a_periph(AT91_PIO_PORTA, 28, 0);  /* LCDDOTCK */
-   at91_pio3_set_a_periph(AT91_PIO_PORTA, 29, 0);  /* LCDDEN */
-
-   /* The lower 16-bit of LCD only available on Port A */
-   at91_pio3_set_a_periph(AT91_PIO_PORTA,  0, 0);  /* LCDD0 */
-   at91_pio3_set_a_periph(AT91_PIO_PORTA,  1, 0);  /* LCDD1 */
-   at91_pio3_set_a_periph(AT91_PIO_PORTA,  2, 0);  /* LCDD2 */
-   at91_pio3_set_a_periph(AT91_PIO_PORTA,  3, 0);  /* LCDD3 */
-   at91_pio3_set_a_periph(AT91_PIO_PORTA,  4, 0);  /* LCDD4 */
-   at91_pio3_set_a_periph(AT91_PIO_PORTA,  5, 0);  /* LCDD5 */
-   at91_pio3_set_a_periph(AT91_PIO_PORTA,  6, 0);  /* LCDD6 */
-   at91_pio3_set_a_periph(AT91_PIO_PORTA,  7, 0);  /* LCDD7 */
-   at91_pio3_set_a_periph(AT91_PIO_PORTA,  8, 0);  /* LCDD8 */
-   at91_pio3_set_a_periph(AT91_PIO_PORTA,  9, 0);  /* LCDD9 */
-   at91_pio3_set_a_periph(AT91_PIO_PORTA, 10, 0);  /* L

[PATCH 19/39] treewide: Stop enabling CONFIG_LCD

2022-10-19 Thread Simon Glass
This option is not used anymore since the LCD implementation is being
removed. Stop enabling it on various boards.

Signed-off-by: Simon Glass 
---

 configs/evb-px30_defconfig| 1 -
 configs/firefly-px30_defconfig| 1 -
 configs/gurnard_defconfig | 1 -
 configs/odroid-go2_defconfig  | 1 -
 configs/peach-pi_defconfig| 1 -
 configs/peach-pit_defconfig   | 1 -
 configs/pm9261_defconfig  | 1 -
 configs/pm9263_defconfig  | 1 -
 configs/px30-core-ctouch2-of10-px30_defconfig | 1 -
 configs/px30-core-ctouch2-px30_defconfig  | 1 -
 configs/px30-core-edimm2.2-px30_defconfig | 1 -
 configs/snow_defconfig| 1 -
 configs/spring_defconfig  | 1 -
 configs/xilinx_zynqmp_virt_defconfig  | 1 -
 14 files changed, 14 deletions(-)

diff --git a/configs/evb-px30_defconfig b/configs/evb-px30_defconfig
index 4f88879e18a..3ed5c3e38ce 100644
--- a/configs/evb-px30_defconfig
+++ b/configs/evb-px30_defconfig
@@ -111,7 +111,6 @@ CONFIG_USB_GADGET=y
 CONFIG_USB_GADGET_DWC2_OTG=y
 CONFIG_DM_VIDEO=y
 CONFIG_DISPLAY=y
-CONFIG_LCD=y
 CONFIG_SPL_TINY_MEMSET=y
 CONFIG_TPL_TINY_MEMSET=y
 CONFIG_LZO=y
diff --git a/configs/firefly-px30_defconfig b/configs/firefly-px30_defconfig
index 1717eb21106..eedcd97c0ea 100644
--- a/configs/firefly-px30_defconfig
+++ b/configs/firefly-px30_defconfig
@@ -110,7 +110,6 @@ CONFIG_USB_GADGET=y
 CONFIG_USB_GADGET_DWC2_OTG=y
 CONFIG_DM_VIDEO=y
 CONFIG_DISPLAY=y
-CONFIG_LCD=y
 CONFIG_SPL_TINY_MEMSET=y
 CONFIG_TPL_TINY_MEMSET=y
 CONFIG_LZO=y
diff --git a/configs/gurnard_defconfig b/configs/gurnard_defconfig
index 01546de8fda..3b98f339496 100644
--- a/configs/gurnard_defconfig
+++ b/configs/gurnard_defconfig
@@ -63,5 +63,4 @@ CONFIG_DM_VIDEO=y
 # CONFIG_VIDEO_LOGO is not set
 # CONFIG_VIDEO_BPP32 is not set
 CONFIG_ATMEL_LCD=y
-CONFIG_LCD=y
 CONFIG_CMD_DHRYSTONE=y
diff --git a/configs/odroid-go2_defconfig b/configs/odroid-go2_defconfig
index c0c0c4daee2..8222933bf80 100644
--- a/configs/odroid-go2_defconfig
+++ b/configs/odroid-go2_defconfig
@@ -114,7 +114,6 @@ CONFIG_USB_GADGET=y
 CONFIG_USB_GADGET_DWC2_OTG=y
 CONFIG_DM_VIDEO=y
 CONFIG_DISPLAY=y
-CONFIG_LCD=y
 CONFIG_SPL_TINY_MEMSET=y
 CONFIG_TPL_TINY_MEMSET=y
 CONFIG_LZO=y
diff --git a/configs/peach-pi_defconfig b/configs/peach-pi_defconfig
index 51210f88a00..aa8f85feffb 100644
--- a/configs/peach-pi_defconfig
+++ b/configs/peach-pi_defconfig
@@ -89,6 +89,5 @@ CONFIG_EXYNOS_DP=y
 CONFIG_EXYNOS_FB=y
 CONFIG_VIDEO_BRIDGE=y
 CONFIG_VIDEO_BRIDGE_PARADE_PS862X=y
-CONFIG_LCD=y
 CONFIG_TPM=y
 CONFIG_ERRNO_STR=y
diff --git a/configs/peach-pit_defconfig b/configs/peach-pit_defconfig
index e2fbb8a0ab9..362cc0ab0ff 100644
--- a/configs/peach-pit_defconfig
+++ b/configs/peach-pit_defconfig
@@ -88,6 +88,5 @@ CONFIG_EXYNOS_DP=y
 CONFIG_EXYNOS_FB=y
 CONFIG_VIDEO_BRIDGE=y
 CONFIG_VIDEO_BRIDGE_PARADE_PS862X=y
-CONFIG_LCD=y
 CONFIG_TPM=y
 CONFIG_ERRNO_STR=y
diff --git a/configs/pm9261_defconfig b/configs/pm9261_defconfig
index 51b048985bf..ead25331b7c 100644
--- a/configs/pm9261_defconfig
+++ b/configs/pm9261_defconfig
@@ -68,5 +68,4 @@ CONFIG_DM_VIDEO=y
 # CONFIG_VIDEO_BPP32 is not set
 CONFIG_ATMEL_LCD=y
 CONFIG_ATMEL_LCD_BGR555=y
-CONFIG_LCD=y
 CONFIG_REGEX=y
diff --git a/configs/pm9263_defconfig b/configs/pm9263_defconfig
index 6ae96469624..02e983cb5e1 100644
--- a/configs/pm9263_defconfig
+++ b/configs/pm9263_defconfig
@@ -71,5 +71,4 @@ CONFIG_DM_VIDEO=y
 # CONFIG_VIDEO_BPP32 is not set
 CONFIG_ATMEL_LCD=y
 CONFIG_ATMEL_LCD_BGR555=y
-CONFIG_LCD=y
 CONFIG_JFFS2_NAND=y
diff --git a/configs/px30-core-ctouch2-of10-px30_defconfig 
b/configs/px30-core-ctouch2-of10-px30_defconfig
index 2fb8bd8a234..33d502b5f6c 100644
--- a/configs/px30-core-ctouch2-of10-px30_defconfig
+++ b/configs/px30-core-ctouch2-of10-px30_defconfig
@@ -110,7 +110,6 @@ CONFIG_USB_GADGET=y
 CONFIG_USB_GADGET_DWC2_OTG=y
 CONFIG_DM_VIDEO=y
 CONFIG_DISPLAY=y
-CONFIG_LCD=y
 CONFIG_SPL_TINY_MEMSET=y
 CONFIG_TPL_TINY_MEMSET=y
 CONFIG_LZO=y
diff --git a/configs/px30-core-ctouch2-px30_defconfig 
b/configs/px30-core-ctouch2-px30_defconfig
index 76f81ae437e..59391647c92 100644
--- a/configs/px30-core-ctouch2-px30_defconfig
+++ b/configs/px30-core-ctouch2-px30_defconfig
@@ -110,7 +110,6 @@ CONFIG_USB_GADGET=y
 CONFIG_USB_GADGET_DWC2_OTG=y
 CONFIG_DM_VIDEO=y
 CONFIG_DISPLAY=y
-CONFIG_LCD=y
 CONFIG_SPL_TINY_MEMSET=y
 CONFIG_TPL_TINY_MEMSET=y
 CONFIG_LZO=y
diff --git a/configs/px30-core-edimm2.2-px30_defconfig 
b/configs/px30-core-edimm2.2-px30_defconfig
index 8493500a064..dd8cc5f6e6f 100644
--- a/configs/px30-core-edimm2.2-px30_defconfig
+++ b/configs/px30-core-edimm2.2-px30_defconfig
@@ -110,7 +110,6 @@ CONFIG_USB_GADGET=y
 CONFIG_USB_GADGET_DWC2_OTG=y
 CONFIG_DM_VIDEO=y
 CONFIG_DISPLAY=y
-CONFIG_LCD=y
 CONFIG_SPL_TINY_MEMSET=y
 CONFIG_TPL_TINY_MEMSET=y
 CONFIG_LZO=y
diff --git a/configs/snow_defconfig b/configs/snow_defconf

[PATCH 24/39] tegra: Drop old LCD code

2022-10-19 Thread Simon Glass
This relies on the old LCD implementation which is to be removed. Drop it.

Signed-off-by: Simon Glass 
---

 drivers/video/tegra124/display.c|  1 -
 include/configs/tegra-common-post.h | 10 ++
 2 files changed, 2 insertions(+), 9 deletions(-)

diff --git a/drivers/video/tegra124/display.c b/drivers/video/tegra124/display.c
index f642b3b10aa..78ab3f99c4d 100644
--- a/drivers/video/tegra124/display.c
+++ b/drivers/video/tegra124/display.c
@@ -12,7 +12,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
diff --git a/include/configs/tegra-common-post.h 
b/include/configs/tegra-common-post.h
index c8f9d7cb175..823b5d63d01 100644
--- a/include/configs/tegra-common-post.h
+++ b/include/configs/tegra-common-post.h
@@ -37,12 +37,6 @@
 #define STDIN_KBD_USB ""
 #endif
 
-#ifdef CONFIG_LCD
-#define STDOUT_LCD ",lcd"
-#else
-#define STDOUT_LCD ""
-#endif
-
 #ifdef CONFIG_DM_VIDEO
 #define STDOUT_VIDEO ",vidconsole"
 #else
@@ -57,8 +51,8 @@
 
 #define TEGRA_DEVICE_SETTINGS \
"stdin=serial" STDIN_KBD_KBC STDIN_KBD_USB STDOUT_CROS_EC "\0" \
-   "stdout=serial" STDOUT_LCD STDOUT_VIDEO "\0" \
-   "stderr=serial" STDOUT_LCD STDOUT_VIDEO "\0" \
+   "stdout=serial" STDOUT_VIDEO "\0" \
+   "stderr=serial" STDOUT_VIDEO "\0" \
""
 
 #ifndef BOARD_EXTRA_ENV_SETTINGS
-- 
2.38.0.413.g74048e4d9e-goog



[PATCH 38/39] pci: Drop test for DM_VIDEO

2022-10-19 Thread Simon Glass
This is not needed anymore, since there is no other option.

Signed-off-by: Simon Glass 
---

 drivers/pci/pci_rom.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/pci/pci_rom.c b/drivers/pci/pci_rom.c
index 27a24daa12a..47b6e6e5bcf 100644
--- a/drivers/pci/pci_rom.c
+++ b/drivers/pci/pci_rom.c
@@ -325,7 +325,6 @@ err:
return ret;
 }
 
-#ifdef CONFIG_DM_VIDEO
 int vesa_setup_video_priv(struct vesa_mode_info *vesa,
  struct video_priv *uc_priv,
  struct video_uc_plat *plat)
@@ -398,4 +397,3 @@ int vesa_setup_video(struct udevice *dev, int 
(*int15_handler)(void))
 
return 0;
 }
-#endif
-- 
2.38.0.413.g74048e4d9e-goog



[PATCH 16/39] video: atmel: Drop pre-DM parts of video driver

2022-10-19 Thread Simon Glass
This relies on the old LCD implementation which is to be removed. Drop it.

Signed-off-by: Simon Glass 
---

 drivers/video/Kconfig|   3 +-
 drivers/video/atmel_hlcdfb.c | 213 ---
 drivers/video/atmel_lcdfb.c  |  75 
 3 files changed, 2 insertions(+), 289 deletions(-)

diff --git a/drivers/video/Kconfig b/drivers/video/Kconfig
index 033e6e94280..5379b75affd 100644
--- a/drivers/video/Kconfig
+++ b/drivers/video/Kconfig
@@ -423,7 +423,7 @@ config VIDEO_LCD_ANX9804
 
 config ATMEL_LCD
bool "Atmel LCD panel support"
-   depends on LCD && ARCH_AT91
+   depends on DM_VIDEO && ARCH_AT91
 
 config ATMEL_LCD_BGR555
bool "Display in BGR555 mode"
@@ -578,6 +578,7 @@ config NXP_TDA19988
 
 config ATMEL_HLCD
bool "Enable ATMEL video support using HLCDC"
+   depends on DM_VIDEO
help
   HLCDC supports video output to an attached LCD panel.
 
diff --git a/drivers/video/atmel_hlcdfb.c b/drivers/video/atmel_hlcdfb.c
index caf65741f2e..6e6704c141e 100644
--- a/drivers/video/atmel_hlcdfb.c
+++ b/drivers/video/atmel_hlcdfb.c
@@ -25,217 +25,6 @@
 
 DECLARE_GLOBAL_DATA_PTR;
 
-#ifndef CONFIG_DM_VIDEO
-
-/* configurable parameters */
-#define ATMEL_LCDC_CVAL_DEFAULT0xc8
-#define ATMEL_LCDC_DMA_BURST_LEN   8
-#ifndef ATMEL_LCDC_GUARD_TIME
-#define ATMEL_LCDC_GUARD_TIME  1
-#endif
-
-#define ATMEL_LCDC_FIFO_SIZE   512
-
-/*
- * the CLUT register map as following
- * RCLUT(24 ~ 16), GCLUT(15 ~ 8), BCLUT(7 ~ 0)
- */
-void lcd_setcolreg(ushort regno, ushort red, ushort green, ushort blue)
-{
-   writel(panel_info.mmio + ATMEL_LCDC_LUT(regno),
-  ((red << LCDC_BASECLUT_RCLUT_Pos) & LCDC_BASECLUT_RCLUT_Msk)
-  | ((green << LCDC_BASECLUT_GCLUT_Pos) & LCDC_BASECLUT_GCLUT_Msk)
-  | ((blue << LCDC_BASECLUT_BCLUT_Pos) & LCDC_BASECLUT_BCLUT_Msk));
-}
-
-void lcd_ctrl_init(void *lcdbase)
-{
-   unsigned long value;
-   struct lcd_dma_desc *desc;
-   struct atmel_hlcd_regs *regs;
-   int ret;
-
-   if (!has_lcdc())
-   return; /* No lcdc */
-
-   regs = (struct atmel_hlcd_regs *)panel_info.mmio;
-
-   /* Disable DISP signal */
-   writel(LCDC_LCDDIS_DISPDIS, ®s->lcdc_lcddis);
-   ret = wait_for_bit_le32(®s->lcdc_lcdsr, LCDC_LCDSR_DISPSTS,
-   false, 1000, false);
-   if (ret)
-   printf("%s: %d: Timeout!\n", __func__, __LINE__);
-   /* Disable synchronization */
-   writel(LCDC_LCDDIS_SYNCDIS, ®s->lcdc_lcddis);
-   ret = wait_for_bit_le32(®s->lcdc_lcdsr, LCDC_LCDSR_LCDSTS,
-   false, 1000, false);
-   if (ret)
-   printf("%s: %d: Timeout!\n", __func__, __LINE__);
-   /* Disable pixel clock */
-   writel(LCDC_LCDDIS_CLKDIS, ®s->lcdc_lcddis);
-   ret = wait_for_bit_le32(®s->lcdc_lcdsr, LCDC_LCDSR_CLKSTS,
-   false, 1000, false);
-   if (ret)
-   printf("%s: %d: Timeout!\n", __func__, __LINE__);
-   /* Disable PWM */
-   writel(LCDC_LCDDIS_PWMDIS, ®s->lcdc_lcddis);
-   ret = wait_for_bit_le32(®s->lcdc_lcdsr, LCDC_LCDSR_PWMSTS,
-   false, 1000, false);
-   if (ret)
-   printf("%s: %d: Timeout!\n", __func__, __LINE__);
-
-   /* Set pixel clock */
-   value = get_lcdc_clk_rate(0) / panel_info.vl_clk;
-   if (get_lcdc_clk_rate(0) % panel_info.vl_clk)
-   value++;
-
-   if (value < 1) {
-   /* Using system clock as pixel clock */
-   writel(LCDC_LCDCFG0_CLKDIV(0)
-   | LCDC_LCDCFG0_CGDISHCR
-   | LCDC_LCDCFG0_CGDISHEO
-   | LCDC_LCDCFG0_CGDISOVR1
-   | LCDC_LCDCFG0_CGDISBASE
-   | panel_info.vl_clk_pol
-   | LCDC_LCDCFG0_CLKSEL,
-   ®s->lcdc_lcdcfg0);
-
-   } else {
-   writel(LCDC_LCDCFG0_CLKDIV(value - 2)
-   | LCDC_LCDCFG0_CGDISHCR
-   | LCDC_LCDCFG0_CGDISHEO
-   | LCDC_LCDCFG0_CGDISOVR1
-   | LCDC_LCDCFG0_CGDISBASE
-   | panel_info.vl_clk_pol,
-   ®s->lcdc_lcdcfg0);
-   }
-
-   /* Initialize control register 5 */
-   value = 0;
-
-   value |= panel_info.vl_sync;
-
-#ifndef LCD_OUTPUT_BPP
-   /* Output is 24bpp */
-   value |= LCDC_LCDCFG5_MODE_OUTPUT_24BPP;
-#else
-   switch (LCD_OUTPUT_BPP) {
-   case 12:
-   value |= LCDC_LCDCFG5_MODE_OUTPUT_12BPP;
-   break;
-   case 16:
-   value |= LCDC_LCDCFG5_MODE_OUTPUT_16BPP;
-   break;
-   case 18:
-   value |= LCDC_LCDCFG5_MODE_OUTPUT_18BPP;
-   break;
-   case 24:
-   value |= LCDC_LCDCFG5_MODE_OUTPUT_24BPP;
-  

[PATCH 29/39] fdt: Drop support for LCD fixup in simplefb

2022-10-19 Thread Simon Glass
This relies on the old LCD implementation which is to be removed. Drop it.

Signed-off-by: Simon Glass 
---

 common/fdt_simplefb.c | 8 
 1 file changed, 8 deletions(-)

diff --git a/common/fdt_simplefb.c b/common/fdt_simplefb.c
index c52846f4bc5..951956430c3 100644
--- a/common/fdt_simplefb.c
+++ b/common/fdt_simplefb.c
@@ -8,7 +8,6 @@
 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -22,7 +21,6 @@ static int fdt_simplefb_configure_node(void *blob, int off)
int bpix; /* log2 of bits per pixel */
const char *name;
ulong fb_base;
-#ifdef CONFIG_DM_VIDEO
struct video_uc_plat *plat;
struct video_priv *uc_priv;
struct udevice *dev;
@@ -37,12 +35,6 @@ static int fdt_simplefb_configure_node(void *blob, int off)
ysize = uc_priv->ysize;
bpix = uc_priv->bpix;
fb_base = plat->base;
-#else
-   xsize = lcd_get_pixel_width();
-   ysize = lcd_get_pixel_height();
-   bpix = LCD_BPP;
-   fb_base = gd->fb_base;
-#endif
switch (bpix) {
case 4: /* VIDEO_BPP16 */
name = "r5g6b5";
-- 
2.38.0.413.g74048e4d9e-goog



[PATCH 28/39] video: Drop remaining references to CONFIG_LCD

2022-10-19 Thread Simon Glass
These rely on the old LCD implementation which is to be removed. Drop it
all.

Signed-off-by: Simon Glass 
---

 README| 45 ---
 cmd/bdinfo.c  |  3 ---
 common/stdio.c|  3 ---
 doc/usage/environment.rst |  4 +--
 include/asm-generic/global_data.h |  2 +-
 5 files changed, 3 insertions(+), 54 deletions(-)

diff --git a/README b/README
index d1d4a62947a..ec1b50c3055 100644
--- a/README
+++ b/README
@@ -770,51 +770,6 @@ The following options need to be configured:
 - Keyboard Support:
See Kconfig help for available keyboard drivers.
 
-- LCD Support: CONFIG_LCD
-
-   Define this to enable LCD support (for output to LCD
-   display); also select one of the supported displays
-   by defining one of these:
-
-   CONFIG_NEC_NL6448AC33:
-
-   NEC NL6448AC33-18. Active, color, single scan.
-
-   CONFIG_NEC_NL6448BC20
-
-   NEC NL6448BC20-08. 6.5", 640x480.
-   Active, color, single scan.
-
-   CONFIG_NEC_NL6448BC33_54
-
-   NEC NL6448BC33-54. 10.4", 640x480.
-   Active, color, single scan.
-
-   CONFIG_SHARP_16x9
-
-   Sharp 320x240. Active, color, single scan.
-   It isn't 16x9, and I am not sure what it is.
-
-   CONFIG_SHARP_LQ64D341
-
-   Sharp LQ64D341 display, 640x480.
-   Active, color, single scan.
-
-   CONFIG_HLD1045
-
-   HLD1045 display, 640x480.
-   Active, color, single scan.
-
-   CONFIG_OPTREX_BW
-
-   Optrex   CBL50840-2 NF-FW 99 22 M5
-   or
-   Hitachi  LMG6912RPFC-00T
-   or
-   Hitachi  SP14Q002
-
-   320x240. Black & white.
-
 - MII/PHY support:
CONFIG_PHY_CLOCK_FREQ (ppc4xx)
 
diff --git a/cmd/bdinfo.c b/cmd/bdinfo.c
index af2e9757db5..c454e6eee18 100644
--- a/cmd/bdinfo.c
+++ b/cmd/bdinfo.c
@@ -124,9 +124,6 @@ int do_bdinfo(struct cmd_tbl *cmdtp, int flag, int argc, 
char *const argv[])
bdinfo_print_num_l("fdt_size", (ulong)gd->fdt_size);
if (IS_ENABLED(CONFIG_DM_VIDEO))
show_video_info();
-#if defined(CONFIG_LCD)
-   bdinfo_print_num_l("FB base  ", gd->fb_base);
-#endif
 #if CONFIG_IS_ENABLED(MULTI_DTB_FIT)
bdinfo_print_num_l("multi_dtb_fit", (ulong)gd->multi_dtb_fit);
 #endif
diff --git a/common/stdio.c b/common/stdio.c
index a6d8a4b674f..481a30486a7 100644
--- a/common/stdio.c
+++ b/common/stdio.c
@@ -366,9 +366,6 @@ int stdio_add_devices(void)
if (IS_ENABLED(CONFIG_SPLASH_SCREEN) &&
IS_ENABLED(CONFIG_CMD_BMP))
splash_display();
-   } else {
-   if (IS_ENABLED(CONFIG_LCD))
-   drv_lcd_init();
}
 
 #if defined(CONFIG_KEYBOARD) && !defined(CONFIG_DM_KEYBOARD)
diff --git a/doc/usage/environment.rst b/doc/usage/environment.rst
index 7906ace2af6..d12bbcd85a2 100644
--- a/doc/usage/environment.rst
+++ b/doc/usage/environment.rst
@@ -63,8 +63,8 @@ For example, for snapper9260 you would create a text file 
called
 Example::
 
 stdout=serial
-#ifdef CONFIG_LCD
-stdout+=,lcd
+#ifdef CONFIG_DM_VIDEO
+stdout+=,vidconsole
 #endif
 bootcmd=
 /* U-Boot script for booting */
diff --git a/include/asm-generic/global_data.h 
b/include/asm-generic/global_data.h
index 2d55fe2ac0f..8ca93ac5269 100644
--- a/include/asm-generic/global_data.h
+++ b/include/asm-generic/global_data.h
@@ -68,7 +68,7 @@ struct global_data {
 * @mem_clk: memory clock rate in Hz
 */
unsigned long mem_clk;
-#if defined(CONFIG_LCD) || defined(CONFIG_DM_VIDEO)
+#if defined(CONFIG_DM_VIDEO)
/**
 * @fb_base: base address of frame buffer memory
 */
-- 
2.38.0.413.g74048e4d9e-goog



[PATCH 34/39] video: Drop use of the lcd header file

2022-10-19 Thread Simon Glass
This file is being removed so drop remaining references to it.

Signed-off-by: Simon Glass 
---

 board/aristainetos/aristainetos.c  | 4 +++-
 board/l+g/vinco/vinco.c| 1 -
 board/nvidia/harmony/harmony.c | 1 -
 board/raspberrypi/rpi/rpi.c| 1 -
 board/st/stm32f746-disco/stm32f746-disco.c | 1 -
 boot/pxe_utils.c   | 1 -
 common/splash.c| 5 ++---
 drivers/serial/sandbox.c   | 1 -
 8 files changed, 5 insertions(+), 10 deletions(-)

diff --git a/board/aristainetos/aristainetos.c 
b/board/aristainetos/aristainetos.c
index 514cb60d5ba..770f3d7d0d5 100644
--- a/board/aristainetos/aristainetos.c
+++ b/board/aristainetos/aristainetos.c
@@ -9,6 +9,8 @@
  * Author: Fabio Estevam 
  */
 
+#include 
+#include 
 #include 
 #include 
 #include 
@@ -33,12 +35,12 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
 #include 
 #include 
+#include 
 
 DECLARE_GLOBAL_DATA_PTR;
 
diff --git a/board/l+g/vinco/vinco.c b/board/l+g/vinco/vinco.c
index db1075a594a..d47c7b5f1eb 100644
--- a/board/l+g/vinco/vinco.c
+++ b/board/l+g/vinco/vinco.c
@@ -24,7 +24,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
diff --git a/board/nvidia/harmony/harmony.c b/board/nvidia/harmony/harmony.c
index dd56a39cafb..52236792e24 100644
--- a/board/nvidia/harmony/harmony.c
+++ b/board/nvidia/harmony/harmony.c
@@ -5,7 +5,6 @@
  */
 
 #include 
-#include 
 #include 
 #include 
 #include 
diff --git a/board/raspberrypi/rpi/rpi.c b/board/raspberrypi/rpi/rpi.c
index 00afb352bd1..8603c93de77 100644
--- a/board/raspberrypi/rpi/rpi.c
+++ b/board/raspberrypi/rpi/rpi.c
@@ -11,7 +11,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
diff --git a/board/st/stm32f746-disco/stm32f746-disco.c 
b/board/st/stm32f746-disco/stm32f746-disco.c
index 2ab23f2f4f7..4cfb29ef428 100644
--- a/board/st/stm32f746-disco/stm32f746-disco.c
+++ b/board/st/stm32f746-disco/stm32f746-disco.c
@@ -7,7 +7,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
diff --git a/boot/pxe_utils.c b/boot/pxe_utils.c
index d5c215ae2c1..3fdd14d1cdb 100644
--- a/boot/pxe_utils.c
+++ b/boot/pxe_utils.c
@@ -12,7 +12,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
diff --git a/common/splash.c b/common/splash.c
index 0e520cc1030..f31ab4fe1d7 100644
--- a/common/splash.c
+++ b/common/splash.c
@@ -24,7 +24,7 @@
 #include 
 #include 
 #include 
-#include 
+#include 
 
 static struct splash_location default_splash_locations[] = {
{
@@ -149,8 +149,7 @@ void splash_display_banner(void)
 
 /*
  * Common function to show a splash image if env("splashimage") is set.
- * Is used for both dm_video and lcd video stacks. For additional
- * details please refer to doc/README.splashprepare.
+ * For additional details please refer to doc/README.splashprepare.
  */
 #if defined(CONFIG_SPLASH_SCREEN) && defined(CONFIG_CMD_BMP)
 int splash_display(void)
diff --git a/drivers/serial/sandbox.c b/drivers/serial/sandbox.c
index 13b54921c41..f122e3f7c36 100644
--- a/drivers/serial/sandbox.c
+++ b/drivers/serial/sandbox.c
@@ -12,7 +12,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
-- 
2.38.0.413.g74048e4d9e-goog



[PATCH 32/39] video: Drop CONFIG_VIDEO

2022-10-19 Thread Simon Glass
This option is not used anymore. Drop it.

Signed-off-by: Simon Glass 
---

 cmd/Kconfig   | 2 +-
 drivers/video/Kconfig | 9 -
 2 files changed, 1 insertion(+), 10 deletions(-)

diff --git a/cmd/Kconfig b/cmd/Kconfig
index 49247a41c00..835e098078c 100644
--- a/cmd/Kconfig
+++ b/cmd/Kconfig
@@ -1868,7 +1868,7 @@ menu "Misc commands"
 
 config CMD_BMP
bool "Enable 'bmp' command"
-   depends on LCD || DM_VIDEO || VIDEO
+   depends on LCD || DM_VIDEO
help
  This provides a way to obtain information about a BMP-format image
  and to display it. BMP (which presumably stands for BitMaP) is a
diff --git a/drivers/video/Kconfig b/drivers/video/Kconfig
index 5379b75affd..39492cfe77d 100644
--- a/drivers/video/Kconfig
+++ b/drivers/video/Kconfig
@@ -693,15 +693,6 @@ config VIDEO_ZYNQMP_DPSUB
 
 source "drivers/video/nexell/Kconfig"
 
-config VIDEO
-   bool "Enable legacy video support"
-   depends on !DM_VIDEO
-   help
- Define this for video support, without using driver model. Some
- drivers use this because they are not yet converted to driver
- model. Video drivers typically provide a colour text console and
- cursor.
-
 config CONSOLE_SCROLL_LINES
int "Number of lines to scroll the console by"
depends on DM_VIDEO || LCD
-- 
2.38.0.413.g74048e4d9e-goog



[PATCH 33/39] video: Drop CONFIG_LCD

2022-10-19 Thread Simon Glass
This option is not used anymore. Drop it.

Signed-off-by: Simon Glass 
---

 cmd/Kconfig   |  2 +-
 drivers/video/Kconfig | 16 
 2 files changed, 5 insertions(+), 13 deletions(-)

diff --git a/cmd/Kconfig b/cmd/Kconfig
index 835e098078c..bdeaeefe67a 100644
--- a/cmd/Kconfig
+++ b/cmd/Kconfig
@@ -1868,7 +1868,7 @@ menu "Misc commands"
 
 config CMD_BMP
bool "Enable 'bmp' command"
-   depends on LCD || DM_VIDEO
+   depends on DM_VIDEO
help
  This provides a way to obtain information about a BMP-format image
  and to display it. BMP (which presumably stands for BitMaP) is a
diff --git a/drivers/video/Kconfig b/drivers/video/Kconfig
index 39492cfe77d..672f2ef9d82 100644
--- a/drivers/video/Kconfig
+++ b/drivers/video/Kconfig
@@ -695,7 +695,7 @@ source "drivers/video/nexell/Kconfig"
 
 config CONSOLE_SCROLL_LINES
int "Number of lines to scroll the console by"
-   depends on DM_VIDEO || LCD
+   depends on DM_VIDEO
default 1
help
  When the console need to be scrolled, this is the number of
@@ -703,14 +703,6 @@ config CONSOLE_SCROLL_LINES
  console jump but can help speed up operation when scrolling
  is slow.
 
-config LCD
-   bool "Enable legacy LCD support"
-   help
- Define this to enable LCD support (for output to LCD display).
- You will also need to select an LCD driver using an additional
- CONFIG option. See the README for details. Drives which have been
- converted to driver model will instead used CONFIG_DM_VIDEO.
-
 config VIDEO_DW_HDMI
bool
help
@@ -913,19 +905,19 @@ config VIDEO_BMP_RLE8
 
 config BMP_16BPP
bool "16-bit-per-pixel BMP image support"
-   depends on DM_VIDEO || LCD
+   depends on DM_VIDEO
help
  Support display of bitmaps file with 16-bit-per-pixel
 
 config BMP_24BPP
bool "24-bit-per-pixel BMP image support"
-   depends on DM_VIDEO || LCD
+   depends on DM_VIDEO
help
  Support display of bitmaps file with 24-bit-per-pixel.
 
 config BMP_32BPP
bool "32-bit-per-pixel BMP image support"
-   depends on DM_VIDEO || LCD
+   depends on DM_VIDEO
help
  Support display of bitmaps file with 32-bit-per-pixel.
 
-- 
2.38.0.413.g74048e4d9e-goog



[PATCH 35/39] video: Drop common LCD implementation

2022-10-19 Thread Simon Glass
This code is no-longer used. Drop it.

Signed-off-by: Simon Glass 
---

 MAINTAINERS  |   2 -
 common/Makefile  |   3 -
 common/lcd.c | 495 ---
 common/lcd_console.c | 252 --
 include/lcd.h| 207 --
 5 files changed, 959 deletions(-)
 delete mode 100644 common/lcd.c
 delete mode 100644 common/lcd_console.c
 delete mode 100644 include/lcd.h

diff --git a/MAINTAINERS b/MAINTAINERS
index cb4d44584d8..048db37cb4d 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -1466,8 +1466,6 @@ M:Anatolij Gustschin 
 S: Maintained
 T: git https://source.denx.de/u-boot/custodians/u-boot-video.git
 F: drivers/video/
-F: common/lcd*.c
-F: include/lcd*.h
 F: include/video*.h
 
 VirtIO
diff --git a/common/Makefile b/common/Makefile
index d3175b7a854..20addfb244c 100644
--- a/common/Makefile
+++ b/common/Makefile
@@ -35,9 +35,6 @@ obj-$(CONFIG_I2C_EDID) += edid.o
 obj-$(CONFIG_KALLSYMS) += kallsyms.o
 obj-y += splash.o
 obj-$(CONFIG_SPLASH_SOURCE) += splash_source.o
-ifndef CONFIG_DM_VIDEO
-obj-$(CONFIG_LCD) += lcd.o lcd_console.o
-endif
 obj-$(CONFIG_MENU) += menu.o
 obj-$(CONFIG_UPDATE_COMMON) += update.o
 obj-$(CONFIG_USB_KEYBOARD) += usb_kbd.o
diff --git a/common/lcd.c b/common/lcd.c
deleted file mode 100644
index b6fba2e010d..000
--- a/common/lcd.c
+++ /dev/null
@@ -1,495 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0+
-/*
- * Common LCD routines
- *
- * (C) Copyright 2001-2002
- * Wolfgang Denk, DENX Software Engineering -- w...@denx.de
- */
-
-/* #define DEBUG */
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-
-#if (LCD_BPP != LCD_COLOR8) && (LCD_BPP != LCD_COLOR16) && \
-   (LCD_BPP != LCD_COLOR32)
-#error Unsupported LCD BPP.
-#endif
-
-DECLARE_GLOBAL_DATA_PTR;
-
-static int lcd_init(void *lcdbase);
-static void lcd_logo(void);
-static void lcd_setfgcolor(int color);
-static void lcd_setbgcolor(int color);
-
-static int lcd_color_fg;
-static int lcd_color_bg;
-int lcd_line_length;
-char lcd_is_enabled = 0;
-static void *lcd_base; /* Start of framebuffer memory  */
-static char lcd_flush_dcache;  /* 1 to flush dcache after each lcd update */
-
-/* Flush LCD activity to the caches */
-void lcd_sync(void)
-{
-   /*
-* flush_dcache_range() is declared in common.h but it seems that some
-* architectures do not actually implement it. Is there a way to find
-* out whether it exists? For now, ARM is safe.
-*/
-#if defined(CONFIG_ARM) && !CONFIG_IS_ENABLED(SYS_DCACHE_OFF)
-   int line_length;
-
-   if (lcd_flush_dcache)
-   flush_dcache_range((ulong)lcd_base,
-   (ulong)(lcd_base + lcd_get_size(&line_length)));
-#endif
-}
-
-void lcd_set_flush_dcache(int flush)
-{
-   lcd_flush_dcache = (flush != 0);
-}
-
-static void lcd_stub_putc(struct stdio_dev *dev, const char c)
-{
-   lcd_putc(c);
-}
-
-static void lcd_stub_puts(struct stdio_dev *dev, const char *s)
-{
-   lcd_puts(s);
-}
-
-/*
- * With most lcd drivers the line length is set up
- * by calculating it from panel_info parameters. Some
- * drivers need to calculate the line length differently,
- * so make the function weak to allow overriding it.
- */
-__weak int lcd_get_size(int *line_length)
-{
-   *line_length = (panel_info.vl_col * NBITS(panel_info.vl_bpix)) / 8;
-   return *line_length * panel_info.vl_row;
-}
-
-int drv_lcd_init(void)
-{
-   struct stdio_dev lcddev;
-   int rc;
-
-   lcd_base = map_sysmem(gd->fb_base, 0);
-
-   lcd_init(lcd_base);
-
-   /* Device initialization */
-   memset(&lcddev, 0, sizeof(lcddev));
-
-   strcpy(lcddev.name, "lcd");
-   lcddev.ext   = 0;   /* No extensions */
-   lcddev.flags = DEV_FLAGS_OUTPUT;/* Output only */
-   lcddev.putc  = lcd_stub_putc;   /* 'putc' function */
-   lcddev.puts  = lcd_stub_puts;   /* 'puts' function */
-
-   rc = stdio_register(&lcddev);
-
-   return (rc == 0) ? 1 : rc;
-}
-
-void lcd_clear(void)
-{
-   int bg_color;
-   __maybe_unused ulong addr;
-   static int do_splash = 1;
-#if LCD_BPP == LCD_COLOR8
-   /* Setting the palette */
-   lcd_setcolreg(CONSOLE_COLOR_BLACK, 0, 0, 0);
-   lcd_setcolreg(CONSOLE_COLOR_RED, 0xFF, 0, 0);
-   lcd_setcolreg(CONSOLE_COLOR_GREEN, 0, 0xFF, 0);
-   lcd_setcolreg(CONSOLE_COLOR_YELLOW, 0xFF, 0xFF, 0);
-   lcd_setcolreg(CONSOLE_COLOR_BLUE, 0, 0, 0xFF);
-   lcd_setcolreg(CONSOLE_COLOR_MAGENTA, 0xFF, 0, 0xFF);
-   lcd_setcolreg(CONSOLE_COLOR_CYAN, 0, 0xFF, 0xFF);
-   lcd_setcolreg(CONSOLE_COLOR_GREY, 0xAA, 0xAA, 0xAA);
-   lcd_setcolreg(CONSOLE_COLOR_WHITE, 0xFF, 0xFF, 0xFF);
-#endif
-
-#ifndef CONFIG_SYS_WHITE_ON_BLACK
-

[PATCH 37/39] video: Make all video options depend on DM_VIDEO

2022-10-19 Thread Simon Glass
Rather than sprinkly this file with 'depends' statements, make all options
depend on DM_VIDEO.

Signed-off-by: Simon Glass 
---

 drivers/video/Kconfig | 42 +-
 1 file changed, 9 insertions(+), 33 deletions(-)

diff --git a/drivers/video/Kconfig b/drivers/video/Kconfig
index eed9b357e83..160f4a008bf 100644
--- a/drivers/video/Kconfig
+++ b/drivers/video/Kconfig
@@ -14,9 +14,10 @@ config DM_VIDEO
  option compiles in the video uclass and routes all LCD/video access
  through this.
 
+if DM_VIDEO
+
 config VIDEO_LOGO
bool "Show the U-Boot logo on the display"
-   depends on DM_VIDEO
default y if !SPLASH_SCREEN
select VIDEO_BMP_RLE8
help
@@ -27,7 +28,6 @@ config VIDEO_LOGO
 
 config BACKLIGHT
bool "Enable panel backlight uclass support"
-   depends on DM_VIDEO
default y
help
  This provides backlight uclass driver that enables basic panel
@@ -35,7 +35,6 @@ config BACKLIGHT
 
 config VIDEO_PCI_DEFAULT_FB_SIZE
hex "Default framebuffer size to use if no drivers request it"
-   depends on DM_VIDEO
default 0x100 if X86 && PCI
default 0 if !(X86 && PCI)
help
@@ -54,7 +53,6 @@ config VIDEO_PCI_DEFAULT_FB_SIZE
 
 config VIDEO_COPY
bool "Enable copying the frame buffer to a hardware copy"
-   depends on DM_VIDEO
help
  On some machines (e.g. x86), reading from the frame buffer is very
  slow because it is uncached. To improve performance, this feature
@@ -87,7 +85,6 @@ config BACKLIGHT_GPIO
 
 config CMD_VIDCONSOLE
bool "Enable vidconsole commands lcdputs and setcurs"
-   depends on DM_VIDEO
default y
help
  Enabling this will provide 'setcurs' and 'lcdputs' commands which
@@ -95,7 +92,6 @@ config CMD_VIDCONSOLE
 
 config VIDEO_BPP8
bool "Support 8-bit-per-pixel displays"
-   depends on DM_VIDEO
default y
help
  Support drawing text and bitmaps onto a 8-bit-per-pixel display.
@@ -105,7 +101,6 @@ config VIDEO_BPP8
 
 config VIDEO_BPP16
bool "Support 16-bit-per-pixel displays"
-   depends on DM_VIDEO
default y
help
  Support drawing text and bitmaps onto a 16-bit-per-pixel display.
@@ -115,7 +110,6 @@ config VIDEO_BPP16
 
 config VIDEO_BPP32
bool "Support 32-bit-per-pixel displays"
-   depends on DM_VIDEO
default y
help
  Support drawing text and bitmaps onto a 32-bit-per-pixel display.
@@ -125,7 +119,6 @@ config VIDEO_BPP32
 
 config VIDEO_ANSI
bool "Support ANSI escape sequences in video console"
-   depends on DM_VIDEO
default y
help
  Enable ANSI escape sequence decoding for a more fully functional
@@ -133,7 +126,6 @@ config VIDEO_ANSI
 
 config VIDEO_MIPI_DSI
bool "Support MIPI DSI interface"
-   depends on DM_VIDEO
help
  Support MIPI DSI interface for driving a MIPI compatible device.
  The MIPI Display Serial Interface (MIPI DSI) defines a high-speed
@@ -141,8 +133,7 @@ config VIDEO_MIPI_DSI
 
 config CONSOLE_NORMAL
bool "Support a simple text console"
-   depends on DM_VIDEO
-   default y if DM_VIDEO
+   default y
help
  Support drawing text on the frame buffer console so that it can be
  used as a console. Rotation is not supported by this driver (see
@@ -151,7 +142,6 @@ config CONSOLE_NORMAL
 
 config CONSOLE_ROTATION
bool "Support rotated displays"
-   depends on DM_VIDEO
help
  Sometimes, for example if the display is mounted in portrait
  mode or even if it's mounted landscape but rotated by 180degree,
@@ -164,7 +154,6 @@ config CONSOLE_ROTATION
 
 config CONSOLE_TRUETYPE
bool "Support a console that uses TrueType fonts"
-   depends on DM_VIDEO
help
  TrueTrype fonts can provide outline-drawing capability rather than
  needing to provide a bitmap for each font and size that is needed.
@@ -173,7 +162,6 @@ config CONSOLE_TRUETYPE
 
 config DM_PANEL_HX8238D
bool "Enable Himax HX-8238D LCD driver"
-   depends on DM_VIDEO
help
  Support for HX-8238D LCD Panel
  The  HX8238-D is a single chip controller and driver LSI that
@@ -213,7 +201,6 @@ config NO_FB_CLEAR
 
 config PANEL
bool "Enable panel uclass support"
-   depends on DM_VIDEO
default y
help
  This provides panel uclass driver that enables basic panel support.
@@ -230,7 +217,6 @@ source "drivers/video/fonts/Kconfig"
 
 config VIDCONSOLE_AS_LCD
bool "Use 'vidconsole' when CONFIG_VIDCONSOLE_AS_NAME string is seen in 
stdout"
-   depends on DM_VIDEO
help
  This is a work-around for boards which have 'lcd' or 'vga' in their
  stdout environment variable, but have moved to use driver model for
@@ -423,7 +409,7 @@ config VIDEO_L

[PATCH 27/39] efi: Drop old LCD code

2022-10-19 Thread Simon Glass
This relies on the old LCD implementation which is to be removed. Drop the
existing #ifdef and convert it to C code.

Signed-off-by: Simon Glass 
---

 lib/efi_loader/efi_gop.c   | 30 --
 lib/efi_loader/efi_setup.c | 10 +-
 2 files changed, 5 insertions(+), 35 deletions(-)

diff --git a/lib/efi_loader/efi_gop.c b/lib/efi_loader/efi_gop.c
index 20bd7fff086..d1dc2f22d0f 100644
--- a/lib/efi_loader/efi_gop.c
+++ b/lib/efi_loader/efi_gop.c
@@ -252,21 +252,13 @@ static efi_uintn_t gop_get_bpp(struct efi_gop *this)
efi_uintn_t vid_bpp = 0;
 
switch (gopobj->bpix) {
-#ifdef CONFIG_DM_VIDEO
case VIDEO_BPP32:
-#else
-   case LCD_COLOR32:
-#endif
if (gopobj->info.pixel_format == EFI_GOT_BGRA8)
vid_bpp = 32;
else
vid_bpp = 30;
break;
-#ifdef CONFIG_DM_VIDEO
case VIDEO_BPP16:
-#else
-   case LCD_COLOR16:
-#endif
vid_bpp = 16;
break;
}
@@ -476,8 +468,6 @@ efi_status_t efi_gop_register(void)
u64 fb_base, fb_size;
void *fb;
efi_status_t ret;
-
-#ifdef CONFIG_DM_VIDEO
struct udevice *vdev;
struct video_priv *priv;
 
@@ -495,26 +485,10 @@ efi_status_t efi_gop_register(void)
fb_base = (uintptr_t)priv->fb;
fb_size = priv->fb_size;
fb = priv->fb;
-#else
-   int line_len;
-
-   bpix = panel_info.vl_bpix;
-   format = VIDEO_UNKNOWN;
-   col = panel_info.vl_col;
-   row = panel_info.vl_row;
-   fb_base = gd->fb_base;
-   fb_size = lcd_get_size(&line_len);
-   fb = (void*)gd->fb_base;
-#endif
 
switch (bpix) {
-#ifdef CONFIG_DM_VIDEO
case VIDEO_BPP16:
case VIDEO_BPP32:
-#else
-   case LCD_COLOR32:
-   case LCD_COLOR16:
-#endif
break;
default:
/* So far, we only work in 16 or 32 bit mode */
@@ -553,11 +527,7 @@ efi_status_t efi_gop_register(void)
gopobj->info.version = 0;
gopobj->info.width = col;
gopobj->info.height = row;
-#ifdef CONFIG_DM_VIDEO
if (bpix == VIDEO_BPP32)
-#else
-   if (bpix == LCD_COLOR32)
-#endif
{
if (format == VIDEO_X2R10G10B10) {
gopobj->info.pixel_format = EFI_GOT_BITMASK;
diff --git a/lib/efi_loader/efi_setup.c b/lib/efi_loader/efi_setup.c
index 9d7189336dc..0b7372e1cad 100644
--- a/lib/efi_loader/efi_setup.c
+++ b/lib/efi_loader/efi_setup.c
@@ -326,11 +326,11 @@ efi_status_t efi_init_obj_list(void)
goto out;
}
 
-#if defined(CONFIG_LCD) || defined(CONFIG_DM_VIDEO)
-   ret = efi_gop_register();
-   if (ret != EFI_SUCCESS)
-   goto out;
-#endif
+   if (IS_ENABLED(CONFIG_DM_VIDEO)) {
+   ret = efi_gop_register();
+   if (ret != EFI_SUCCESS)
+   goto out;
+   }
 #ifdef CONFIG_NET
ret = efi_net_register();
if (ret != EFI_SUCCESS)
-- 
2.38.0.413.g74048e4d9e-goog



[PATCH 26/39] video: cmd: Drop old LCD code

2022-10-19 Thread Simon Glass
This relies on the old LCD implementation which is to be removed. Drop it.

Signed-off-by: Simon Glass 
---

 cmd/bmp.c|  9 -
 common/board_f.c | 27 +++
 common/fdt_support.c | 29 -
 3 files changed, 11 insertions(+), 54 deletions(-)

diff --git a/cmd/bmp.c b/cmd/bmp.c
index 880edad8898..46d0d916e86 100644
--- a/cmd/bmp.c
+++ b/cmd/bmp.c
@@ -14,7 +14,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -223,9 +222,7 @@ static int bmp_info(ulong addr)
 
 int bmp_display(ulong addr, int x, int y)
 {
-#ifdef CONFIG_DM_VIDEO
struct udevice *dev;
-#endif
int ret;
struct bmp_image *bmp = map_sysmem(addr, 0);
void *bmp_alloc_addr = NULL;
@@ -241,7 +238,6 @@ int bmp_display(ulong addr, int x, int y)
}
addr = map_to_sysmem(bmp);
 
-#ifdef CONFIG_DM_VIDEO
ret = uclass_first_device_err(UCLASS_VIDEO, &dev);
if (!ret) {
bool align = false;
@@ -251,11 +247,6 @@ int bmp_display(ulong addr, int x, int y)
 
ret = video_bmp_display(dev, addr, x, y, align);
}
-#elif defined(CONFIG_LCD)
-   ret = lcd_display_bitmap(addr, x, y);
-#else
-# error bmp_display() requires CONFIG_LCD
-#endif
 
if (bmp_alloc_addr)
free(bmp_alloc_addr);
diff --git a/common/board_f.c b/common/board_f.c
index 5f1711181c7..2660ce67d8b 100644
--- a/common/board_f.c
+++ b/common/board_f.c
@@ -28,7 +28,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -402,22 +401,18 @@ __weak int arch_reserve_mmu(void)
 
 static int reserve_video(void)
 {
-#ifdef CONFIG_DM_VIDEO
-   ulong addr;
-   int ret;
+   if (IS_ENABLED(CONFIG_DM_VIDEO)) {
+   ulong addr;
+   int ret;
 
-   addr = gd->relocaddr;
-   ret = video_reserve(&addr);
-   if (ret)
-   return ret;
-   debug("Reserving %luk for video at: %08lx\n",
- ((unsigned long)gd->relocaddr - addr) >> 10, addr);
-   gd->relocaddr = addr;
-#elif defined(CONFIG_LCD)
-   /* reserve memory for LCD display (always full pages) */
-   gd->relocaddr = lcd_setmem(gd->relocaddr);
-   gd->fb_base = gd->relocaddr;
-#endif
+   addr = gd->relocaddr;
+   ret = video_reserve(&addr);
+   if (ret)
+   return ret;
+   debug("Reserving %luk for video at: %08lx\n",
+ ((unsigned long)gd->relocaddr - addr) >> 10, addr);
+   gd->relocaddr = addr;
+   }
 
return 0;
 }
diff --git a/common/fdt_support.c b/common/fdt_support.c
index baf7fb70659..ebebffc7890 100644
--- a/common/fdt_support.c
+++ b/common/fdt_support.c
@@ -1740,35 +1740,6 @@ int fdt_set_status_by_pathf(void *fdt, enum fdt_status 
status, const char *fmt,
return fdt_set_node_status(fdt, offset, status);
 }
 
-#if defined(CONFIG_LCD)
-int fdt_add_edid(void *blob, const char *compat, unsigned char *edid_buf)
-{
-   int noff;
-   int ret;
-
-   noff = fdt_node_offset_by_compatible(blob, -1, compat);
-   if (noff != -FDT_ERR_NOTFOUND) {
-   debug("%s: %s\n", fdt_get_name(blob, noff, 0), compat);
-add_edid:
-   ret = fdt_setprop(blob, noff, "edid", edid_buf, 128);
-   if (ret == -FDT_ERR_NOSPACE) {
-   ret = fdt_increase_size(blob, 512);
-   if (!ret)
-   goto add_edid;
-   else
-   goto err_size;
-   } else if (ret < 0) {
-   printf("Can't add property: %s\n", fdt_strerror(ret));
-   return ret;
-   }
-   }
-   return 0;
-err_size:
-   printf("Can't increase blob size: %s\n", fdt_strerror(ret));
-   return ret;
-}
-#endif
-
 /*
  * Verify the physical address of device tree node for a given alias
  *
-- 
2.38.0.413.g74048e4d9e-goog



Re: [PATCH v2 11/12] rockchip: lion-rk3368: migrate to u-boot-rockchip.bin

2022-10-19 Thread Kever Yang

Hi Quentin,

    I got below error when apply this patch, could you help to check

+Error: arch/arm/dts/rk3368-lion-haikou-u-boot.dtsi:44.16-17 syntax error
+FATAL ERROR: Unable to parse input tree
+make[3]: *** [arch/arm/dts/rk3368-lion-haikou.dtb] Error 1
+make[2]: *** [arch-dtbs] Error 2

Thanks,

- Kever

On 2022/9/15 17:14, Quentin Schulz wrote:

From: Quentin Schulz 

The offset of the SPL payload on Lion is different than for other
Rockchip devices in that it is stored at offset 256K instead of much
further away in the MMC.

Flashing one binary instead of two at different offsets is much more
user friendly so let's migrate to it by modifying the offset in the Lion
specific Device Tree.

Cc: Quentin Schulz 
Signed-off-by: Quentin Schulz 
---
  arch/arm/dts/rk3368-lion-haikou-u-boot.dtsi | 8 
  board/theobroma-systems/lion_rk3368/README  | 9 +++--
  2 files changed, 11 insertions(+), 6 deletions(-)

diff --git a/arch/arm/dts/rk3368-lion-haikou-u-boot.dtsi 
b/arch/arm/dts/rk3368-lion-haikou-u-boot.dtsi
index 7826d1e70b..02cb5ef9d9 100644
--- a/arch/arm/dts/rk3368-lion-haikou-u-boot.dtsi
+++ b/arch/arm/dts/rk3368-lion-haikou-u-boot.dtsi
@@ -38,6 +38,14 @@
};
  };
  
+&binman {

+   simple-bin {
+   blob {
+   offset = <((CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR - 64) 
* 512)>;
+   };
+   };
+};
+
  &gpio2 {
u-boot,dm-pre-reloc;
  };
diff --git a/board/theobroma-systems/lion_rk3368/README 
b/board/theobroma-systems/lion_rk3368/README
index 7488b18326..3c15a7bb36 100644
--- a/board/theobroma-systems/lion_rk3368/README
+++ b/board/theobroma-systems/lion_rk3368/README
@@ -27,14 +27,12 @@ Build the full U-Boot and a FIT image including the ATF
  Flash the image
  ===
  
-Copy the SPL to offset 32k and the FIT image containing the payloads

-(U-Boot proper, ATF, devicetree) to offset 256k card.
+Copy u-boot-rockchip.bin at offset 32k on SD-Card/eMMC.
  
  SD-Card

  ---
  
-  > dd if=idbloader.img of=/dev/sdb seek=64

-  > dd if=u-boot.itb of=/dev/sdb seek=512
+  > dd if=u-boot-rockchip.bin of=/dev/sdb seekp=64
  
  eMMC

  
@@ -47,8 +45,7 @@ help of the Rockchip loader binary.
> autoreconf -i && && ./configure && make
> git clone https://github.com/rockchip-linux/rkbin.git
> ./rkdeveloptool db rkbin/rk33/rk3368_loader_v2.00.256.bin
-  > ./rkdeveloptool wl 64 ../spl.img
-  > ./rkdeveloptool wl 512 ../u-boot.itb
+  > ./rkdeveloptool wl 64 ../u-boot-rockchip.bin
  
  
  If everything went according to plan, you should see the following


[PATCH 07/39] video: Drop CONFIG_LCD_MENU

2022-10-19 Thread Simon Glass
This relies on the old LCD implementation which is to be removed. Drop it.

Signed-off-by: Simon Glass 
---

 board/samsung/common/board.c|   4 -
 board/samsung/common/misc.c | 339 
 include/configs/s5pc210_universal.h |   3 -
 include/configs/trats.h |   3 -
 include/configs/trats2.h|   3 -
 include/samsung/misc.h  |  15 --
 scripts/config_whitelist.txt|   1 -
 7 files changed, 368 deletions(-)

diff --git a/board/samsung/common/board.c b/board/samsung/common/board.c
index ff178b7fe67..04cfc5d6358 100644
--- a/board/samsung/common/board.c
+++ b/board/samsung/common/board.c
@@ -262,10 +262,6 @@ int misc_init_r(void)
 #ifdef CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG
set_board_info();
 #endif
-#ifdef CONFIG_LCD_MENU
-   keys_init();
-   check_boot_mode();
-#endif
 #ifdef CONFIG_CMD_BMP
if (panel_info.logo_on)
draw_logo();
diff --git a/board/samsung/common/misc.c b/board/samsung/common/misc.c
index b3b1bbcc820..ee6d2d2a0d7 100644
--- a/board/samsung/common/misc.c
+++ b/board/samsung/common/misc.c
@@ -114,345 +114,6 @@ void set_board_info(void)
 }
 #endif /* CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG */
 
-#ifdef CONFIG_LCD_MENU
-static int power_key_pressed(u32 reg)
-{
-   struct udevice *dev;
-   int ret;
-   u32 status;
-   u32 mask;
-
-   if (IS_ENABLED(CONFIG_TARGET_TRATS))
-   ret = pmic_get("max8997-pmic", &dev);
-   else if (IS_ENABLED(CONFIG_TARGET_TRATS2))
-   ret = pmic_get("max77686-pmic", &dev);
-   else if (IS_ENABLED(CONFIG_TARGET_S5PC210_UNIVERSAL))
-   ret = pmic_get("max8998-pmic", &dev);
-   else
-   return 0;
-
-   if (ret)
-   return ret;
-
-   if (reg == KEY_PWR_STATUS_REG)
-   mask = KEY_PWR_STATUS_MASK;
-   else
-   mask = KEY_PWR_INTERRUPT_MASK;
-
-   status = pmic_reg_read(dev, reg);
-   if (status < 0)
-   return status;
-
-   return !!(status & mask);
-}
-
-static int key_pressed(int key)
-{
-   int value;
-
-   switch (key) {
-   case KEY_POWER:
-   value = power_key_pressed(KEY_PWR_INTERRUPT_REG);
-   break;
-   case KEY_VOLUMEUP:
-   value = !gpio_get_value(KEY_VOL_UP_GPIO);
-   break;
-   case KEY_VOLUMEDOWN:
-   value = !gpio_get_value(KEY_VOL_DOWN_GPIO);
-   break;
-   default:
-   value = 0;
-   break;
-   }
-
-   return value;
-}
-
-#ifdef CONFIG_LCD
-static int check_keys(void)
-{
-   int keys = 0;
-
-   if (key_pressed(KEY_POWER))
-   keys += KEY_POWER;
-   if (key_pressed(KEY_VOLUMEUP))
-   keys += KEY_VOLUMEUP;
-   if (key_pressed(KEY_VOLUMEDOWN))
-   keys += KEY_VOLUMEDOWN;
-
-   return keys;
-}
-
-/*
- * 0 BOOT_MODE_INFO
- * 1 BOOT_MODE_THOR
- * 2 BOOT_MODE_UMS
- * 3 BOOT_MODE_DFU
- * 4 BOOT_MODE_EXIT
- */
-static char *
-mode_name[BOOT_MODE_EXIT + 1][2] = {
-   {"DEVICE", ""},
-   {"THOR", "thor"},
-   {"UMS", "ums"},
-   {"DFU", "dfu"},
-   {"GPT", "gpt"},
-   {"ENV", "env"},
-   {"EXIT", ""},
-};
-
-static char *
-mode_info[BOOT_MODE_EXIT + 1] = {
-   "info",
-   "downloader",
-   "mass storage",
-   "firmware update",
-   "restore",
-   "default",
-   "and run normal boot"
-};
-
-static char *
-mode_cmd[BOOT_MODE_EXIT + 1] = {
-   "",
-   "thor 0 mmc 0",
-   "ums 0 mmc 0",
-   "dfu 0 mmc 0",
-   "gpt write mmc 0 $partitions",
-   "env default -a; saveenv",
-   "",
-};
-
-static void display_board_info(void)
-{
-#ifdef CONFIG_MMC
-   struct mmc *mmc = find_mmc_device(0);
-#endif
-   vidinfo_t *vid = &panel_info;
-
-   lcd_position_cursor(4, 4);
-
-   lcd_printf("%s\n\t", U_BOOT_VERSION);
-   lcd_puts("\n\t\tBoard Info:\n");
-#ifdef CONFIG_SYS_BOARD
-   lcd_printf("\tBoard name: %s\n", CONFIG_SYS_BOARD);
-#endif
-#ifdef CONFIG_REVISION_TAG
-   lcd_printf("\tBoard rev: %u\n", get_board_rev());
-#endif
-   lcd_printf("\tDRAM banks: %u\n", CONFIG_NR_DRAM_BANKS);
-   lcd_printf("\tDRAM size: %u MB\n", gd->ram_size / SZ_1M);
-
-#ifdef CONFIG_MMC
-   if (mmc) {
-   if (!mmc->capacity)
-   mmc_init(mmc);
-
-   lcd_printf("\teMMC size: %llu MB\n", mmc->capacity / SZ_1M);
-   }
-#endif
-   if (vid)
-   lcd_printf("\tDisplay resolution: %u x % u\n",
-  vid->vl_col, vid->vl_row);
-
-   lcd_printf("\tDisplay BPP: %u\n", 1 << vid->vl_bpix);
-}
-#endif
-
-static int mode_leave_menu(int mode)
-{
-#ifdef CONFIG_LCD
-   char *exit_option;
-   char *exit_reset = "reset";
-   char *exit_back = "back";
-   struct cmd_tbl *cmd;
-   int cmd_result;
-   int leave;
-
-   lcd_clear();
-
-   switch (mode)

[PATCH 30/39] video: Drop LCD_BPP

2022-10-19 Thread Simon Glass
This is used by the old LCD implementation which is to be removed.
Drop it and LCD_OUTPUT_BPP also.

Signed-off-by: Simon Glass 
---

 include/configs/at91sam9261ek.h | 7 ---
 include/configs/at91sam9263ek.h | 7 ---
 include/configs/at91sam9m10g45ek.h  | 5 -
 include/configs/at91sam9n12ek.h | 5 -
 include/configs/at91sam9rlek.h  | 7 ---
 include/configs/brxre1.h| 4 
 include/configs/pm9261.h| 7 ---
 include/configs/pm9263.h| 6 --
 include/configs/s5pc210_universal.h | 3 ---
 include/configs/trats.h | 3 ---
 include/configs/trats2.h| 3 ---
 11 files changed, 57 deletions(-)

diff --git a/include/configs/at91sam9261ek.h b/include/configs/at91sam9261ek.h
index 12726c10bd6..5576a5ffbe4 100644
--- a/include/configs/at91sam9261ek.h
+++ b/include/configs/at91sam9261ek.h
@@ -16,13 +16,6 @@
 
 #include 
 
-/*
- * Hardware drivers
- */
-
-/* LCD */
-#define LCD_BPPLCD_COLOR8
-
 /* SDRAM */
 #define CONFIG_SYS_SDRAM_BASE  0x2000
 #define CONFIG_SYS_SDRAM_SIZE  0x0400
diff --git a/include/configs/at91sam9263ek.h b/include/configs/at91sam9263ek.h
index 8c6d1cd1d9d..02d04d0776b 100644
--- a/include/configs/at91sam9263ek.h
+++ b/include/configs/at91sam9263ek.h
@@ -22,13 +22,6 @@
 #define CONFIG_SYS_AT91_MAIN_CLOCK 16367660 /* 16.367 MHz crystal */
 #define CONFIG_SYS_AT91_SLOW_CLOCK 32768
 
-/*
- * Hardware drivers
- */
-
-/* LCD */
-#define LCD_BPPLCD_COLOR8
-
 /* SDRAM */
 #define CONFIG_SYS_SDRAM_BASE  ATMEL_BASE_CS1
 #define CONFIG_SYS_SDRAM_SIZE  0x0400
diff --git a/include/configs/at91sam9m10g45ek.h 
b/include/configs/at91sam9m10g45ek.h
index b55d2e39255..2d257c49831 100644
--- a/include/configs/at91sam9m10g45ek.h
+++ b/include/configs/at91sam9m10g45ek.h
@@ -14,11 +14,6 @@
 #define CONFIG_SYS_AT91_SLOW_CLOCK  32768
 #define CONFIG_SYS_AT91_MAIN_CLOCK  1200 /* from 12 MHz crystal */
 
-/* general purpose I/O */
-
-/* LCD */
-#define LCD_BPPLCD_COLOR8
-
 /* SDRAM */
 #define CONFIG_SYS_SDRAM_BASE   0x7000
 #define CONFIG_SYS_SDRAM_SIZE  0x0800
diff --git a/include/configs/at91sam9n12ek.h b/include/configs/at91sam9n12ek.h
index 4d492988eba..f2ca4f3d0ba 100644
--- a/include/configs/at91sam9n12ek.h
+++ b/include/configs/at91sam9n12ek.h
@@ -14,11 +14,6 @@
 #define CONFIG_SYS_AT91_MAIN_CLOCK 1600/* main clock xtal */
 
 /* Misc CPU related */
-
-/* LCD */
-#define LCD_BPPLCD_COLOR16
-#define LCD_OUTPUT_BPP 24
-
 #define CONFIG_SYS_SDRAM_BASE  0x2000
 #define CONFIG_SYS_SDRAM_SIZE  0x0800
 
diff --git a/include/configs/at91sam9rlek.h b/include/configs/at91sam9rlek.h
index e418edddfbe..bc687fc44d8 100644
--- a/include/configs/at91sam9rlek.h
+++ b/include/configs/at91sam9rlek.h
@@ -16,13 +16,6 @@
 #define CONFIG_SYS_AT91_SLOW_CLOCK 32768   /* slow clock xtal */
 #define CONFIG_SYS_AT91_MAIN_CLOCK 1200/* main clock xtal */
 
-/*
- * Hardware drivers
- */
-
-/* LCD */
-#define LCD_BPPLCD_COLOR8
-
 /* SDRAM */
 #define CONFIG_SYS_SDRAM_BASE  ATMEL_BASE_CS1
 #define CONFIG_SYS_SDRAM_SIZE  0x0400
diff --git a/include/configs/brxre1.h b/include/configs/brxre1.h
index 4d91a776ba8..410b3e641c5 100644
--- a/include/configs/brxre1.h
+++ b/include/configs/brxre1.h
@@ -14,10 +14,6 @@
 #include 
 #include 
 #include 
-/* - */
-#define LCD_BPPLCD_COLOR32
-
-/* memory */
 
 /* Clock Defines */
 #define V_OSCK 2600  /* Clock output from T2 */
diff --git a/include/configs/pm9261.h b/include/configs/pm9261.h
index 797e44f844d..7f9442acbbd 100644
--- a/include/configs/pm9261.h
+++ b/include/configs/pm9261.h
@@ -124,13 +124,6 @@
 AT91_WDT_MR_WDDIS |\
 AT91_WDT_MR_WDD(0xfff))
 
-/*
- * Hardware drivers
- */
-
-/* LCD */
-#define LCD_BPPLCD_COLOR8
-
 /* SDRAM */
 #define PHYS_SDRAM 0x2000
 #define PHYS_SDRAM_SIZE0x0400  /* 64 
megs */
diff --git a/include/configs/pm9263.h b/include/configs/pm9263.h
index bb5bd8b6064..00d159f03cf 100644
--- a/include/configs/pm9263.h
+++ b/include/configs/pm9263.h
@@ -136,12 +136,6 @@
 AT91_WDT_MR_WDDIS |\
 AT91_WDT_MR_WDD(0xfff))
 
-/*
- * Hardware drivers
- */
-/* LCD */
-#define LCD_BPPLCD_COLOR8
-
 /* SDRAM */
 #define PHYS_SDRAM 0x2000
 #define PHYS_SDRAM_SIZE0x0400  /* 64 megs */
diff --git a/include/configs/s5pc210_universal.h 
b/includ

[PATCH 17/39] video: Drop ld9040 driver

2022-10-19 Thread Simon Glass
This is not used anymore. Drop it.

Signed-off-by: Simon Glass 
---

 board/samsung/universal_c210/universal.c |   1 -
 drivers/video/Makefile   |   1 -
 drivers/video/ld9040.c   | 112 ---
 include/configs/s5pc210_universal.h  |   5 -
 include/ld9040.h |  15 ---
 scripts/config_whitelist.txt |   1 -
 6 files changed, 135 deletions(-)
 delete mode 100644 drivers/video/ld9040.c
 delete mode 100644 include/ld9040.h

diff --git a/board/samsung/universal_c210/universal.c 
b/board/samsung/universal_c210/universal.c
index 1dde2f799b5..078db0c0c4e 100644
--- a/board/samsung/universal_c210/universal.c
+++ b/board/samsung/universal_c210/universal.c
@@ -16,7 +16,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
diff --git a/drivers/video/Makefile b/drivers/video/Makefile
index 749996aba84..d410c508e94 100644
--- a/drivers/video/Makefile
+++ b/drivers/video/Makefile
@@ -30,7 +30,6 @@ obj-${CONFIG_VIDEO_TEGRA124} += tegra124/
 obj-$(CONFIG_ATMEL_HLCD) += atmel_hlcdfb.o
 obj-$(CONFIG_ATMEL_LCD) += atmel_lcdfb.o
 obj-$(CONFIG_IHS_VIDEO_OUT) += ihs_video_out.o
-obj-$(CONFIG_LD9040) += ld9040.o
 obj-$(CONFIG_LG4573) += lg4573.o
 obj-$(CONFIG_LOGICORE_DP_TX) += logicore_dp_tx.o
 obj-$(CONFIG_NXP_TDA19988) += tda19988.o
diff --git a/drivers/video/ld9040.c b/drivers/video/ld9040.c
deleted file mode 100644
index a36bc2f06cb..000
--- a/drivers/video/ld9040.c
+++ /dev/null
@@ -1,112 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0+
-/*
- * ld9040 AMOLED LCD panel driver.
- *
- * Copyright (C) 2012 Samsung Electronics
- * Donghwa Lee 
- */
-
-#include 
-#include 
-#include 
-
-static const unsigned char SEQ_USER_SETTING[] = {
-   0xF0, 0x5A, 0x5A
-};
-
-static const unsigned char SEQ_ELVSS_ON[] = {
-   0xB1, 0x0D, 0x00, 0x16,
-};
-
-static const unsigned char SEQ_GTCON[] = {
-   0xF7, 0x09, 0x00, 0x00,
-};
-
-static const unsigned char SEQ_PANEL_CONDITION[] = {
-   0xF8, 0x05, 0x65, 0x96, 0x71, 0x7D, 0x19, 0x3B,
-   0x0D, 0x19, 0x7E, 0x0D, 0xE2, 0x00, 0x00, 0x7E,
-   0x7D, 0x07, 0x07, 0x20, 0x20, 0x20, 0x02, 0x02,
-};
-
-static const unsigned char SEQ_GAMMA_SET1[] = {
-   0xF9, 0x00, 0xA7, 0xB4, 0xAE, 0xBF, 0x00, 0x91,
-   0x00, 0xB2, 0xB4, 0xAA, 0xBB, 0x00, 0xAC, 0x00,
-   0xB3, 0xB1, 0xAA, 0xBC, 0x00, 0xB3,
-};
-
-static const unsigned char SEQ_GAMMA_CTRL[] = {
-   0xFB, 0x02, 0x5A,
-};
-
-static const unsigned char SEQ_DISPCTL[] = {
-   0xF2, 0x02, 0x08, 0x08, 0x10, 0x10,
-};
-
-static const unsigned char SEQ_MANPWR[] = {
-   0xB0, 0x04,
-};
-
-static const unsigned char SEQ_PWR_CTRL[] = {
-   0xF4, 0x0A, 0x87, 0x25, 0x6A, 0x44, 0x02, 0x88,
-};
-
-static const unsigned char SEQ_SLPOUT[] = {
-   0x11,
-};
-
-static const unsigned char SEQ_DISPON[] = {
-   0x29,
-};
-
-static const unsigned char SEQ_DISPOFF[] = {
-   0x28,
-};
-
-static void ld9040_spi_write(const unsigned char *wbuf, unsigned int size_cmd)
-{
-   int i = 0;
-
-   /*
-* Data are transmitted in 9-bit words:
-* the first bit is command/parameter, the other are the value.
-* The value's LSB is shifted to MSB position, to be sent as 9th bit
-*/
-
-   unsigned int data_out = 0, data_in = 0;
-   for (i = 0; i < size_cmd; i++) {
-   data_out = wbuf[i] >> 1;
-   if (i != 0)
-   data_out += 0x0080;
-   if (wbuf[i] & 0x01)
-   data_out += 0x8000;
-   spi_xfer(NULL, 9, &data_out, &data_in, SPI_XFER_BEGIN);
-   }
-}
-
-void ld9040_cfg_ldo(void)
-{
-   udelay(10);
-
-   ld9040_spi_write(SEQ_USER_SETTING,
-   ARRAY_SIZE(SEQ_USER_SETTING));
-   ld9040_spi_write(SEQ_PANEL_CONDITION,
-   ARRAY_SIZE(SEQ_PANEL_CONDITION));
-   ld9040_spi_write(SEQ_DISPCTL, ARRAY_SIZE(SEQ_DISPCTL));
-   ld9040_spi_write(SEQ_MANPWR, ARRAY_SIZE(SEQ_MANPWR));
-   ld9040_spi_write(SEQ_PWR_CTRL, ARRAY_SIZE(SEQ_PWR_CTRL));
-   ld9040_spi_write(SEQ_ELVSS_ON, ARRAY_SIZE(SEQ_ELVSS_ON));
-   ld9040_spi_write(SEQ_GTCON, ARRAY_SIZE(SEQ_GTCON));
-   ld9040_spi_write(SEQ_GAMMA_SET1, ARRAY_SIZE(SEQ_GAMMA_SET1));
-   ld9040_spi_write(SEQ_GAMMA_CTRL, ARRAY_SIZE(SEQ_GAMMA_CTRL));
-   ld9040_spi_write(SEQ_SLPOUT, ARRAY_SIZE(SEQ_SLPOUT));
-
-   udelay(120);
-}
-
-void ld9040_enable_ldo(unsigned int onoff)
-{
-   if (onoff)
-   ld9040_spi_write(SEQ_DISPON, ARRAY_SIZE(SEQ_DISPON));
-   else
-   ld9040_spi_write(SEQ_DISPOFF, ARRAY_SIZE(SEQ_DISPOFF));
-}
diff --git a/include/configs/s5pc210_universal.h 
b/include/configs/s5pc210_universal.h
index f94135355ab..000dc388ac0 100644
--- a/include/configs/s5pc210_universal.h
+++ b/include/configs/s5pc210_universal.h
@@ -114,9 +114,4 @@ int universal_spi_read(void);
 /* LCD console */
 #define LCD_BPP   

[PATCH 14/39] BuR: Drop old LCD code

2022-10-19 Thread Simon Glass
This relies on the old LCD implementation which is to be removed. Drop it.

Signed-off-by: Simon Glass 
---

 board/BuR/brxre1/board.c  |   9 --
 board/BuR/common/br_resetc.c  |   6 -
 board/BuR/common/bur_common.h |   6 -
 board/BuR/common/common.c | 224 --
 4 files changed, 245 deletions(-)

diff --git a/board/BuR/brxre1/board.c b/board/BuR/brxre1/board.c
index 544e09f447c..a909104df4a 100644
--- a/board/BuR/brxre1/board.c
+++ b/board/BuR/brxre1/board.c
@@ -164,21 +164,12 @@ int board_late_init(void)
br_resetc_bmode();
 
/* setup othbootargs for bootvx-command (vxWorks bootline) */
-#ifdef CONFIG_LCD
-   snprintf(othbootargs, sizeof(othbootargs),
-"u=vxWorksFTP pw=vxWorks o=0x%08x;0x%08x;0x%08x;0x%08x",
-(u32)gd->fb_base - 0x20,
-(u32)env_get_ulong("vx_memtop", 16, gd->fb_base - 0x20),
-(u32)env_get_ulong("vx_romfsbase", 16, 0),
-(u32)env_get_ulong("vx_romfssize", 16, 0));
-#else
snprintf(othbootargs, sizeof(othbootargs),
 "u=vxWorksFTP pw=vxWorks o=0x%08x;0x%08x;0x%08x;0x%08x",
 (u32)gd->relocaddr,
 (u32)env_get_ulong("vx_memtop", 16, gd->relocaddr),
 (u32)env_get_ulong("vx_romfsbase", 16, 0),
 (u32)env_get_ulong("vx_romfssize", 16, 0));
-#endif
env_set("othbootargs", othbootargs);
/*
 * reset VBAR registers to its reset location, VxWorks 6.9.3.2 does
diff --git a/board/BuR/common/br_resetc.c b/board/BuR/common/br_resetc.c
index 5006687fbf0..32f32b65e9d 100644
--- a/board/BuR/common/br_resetc.c
+++ b/board/BuR/common/br_resetc.c
@@ -23,14 +23,8 @@
 #define BMODE_PME  12
 #define BMODE_DIAG 15
 
-#if CONFIG_IS_ENABLED(LCD) && !CONFIG_IS_ENABLED(DM_VIDEO)
-#include 
-#define LCD_SETCURSOR(x, y)lcd_position_cursor(x, y)
-#define LCD_PUTS(x)lcd_puts(x)
-#else
 #define LCD_SETCURSOR(x, y)
 #define LCD_PUTS(x)
-#endif /* CONFIG_LCD */
 
 static const char *bootmodeascii[16] = {
"BOOT", "reserved", "reserved", "reserved",
diff --git a/board/BuR/common/bur_common.h b/board/BuR/common/bur_common.h
index 79c9af1466b..55d14c2a6b0 100644
--- a/board/BuR/common/bur_common.h
+++ b/board/BuR/common/bur_common.h
@@ -11,12 +11,6 @@
 #ifndef _BUR_COMMON_H_
 #define _BUR_COMMON_H_
 
-#if !CONFIG_IS_ENABLED(DM_VIDEO)
-#include <../../../drivers/video/ti/am335x-fb.h>
-
-int load_lcdtiming(struct am335x_lcdpanel *panel);
-#endif
-
 void br_summaryscreen(void);
 void pmicsetup(u32 mpupll, unsigned int bus);
 void enable_uart0_pin_mux(void);
diff --git a/board/BuR/common/common.c b/board/BuR/common/common.c
index 78bf7d62288..c6126e251ec 100644
--- a/board/BuR/common/common.c
+++ b/board/BuR/common/common.c
@@ -22,230 +22,6 @@
 DECLARE_GLOBAL_DATA_PTR;
 
 /* --*/
-#if defined(CONFIG_LCD) && defined(CONFIG_AM335X_LCD) && \
-   !defined(CONFIG_DM_VIDEO) && !defined(CONFIG_SPL_BUILD)
-#include 
-#include 
-#include 
-#include 
-#include "../../../drivers/video/ti/am335x-fb.h"
-
-void lcdbacklight(int on)
-{
-   unsigned int driver = env_get_ulong("ds1_bright_drv", 16, 0UL);
-   unsigned int bright = env_get_ulong("ds1_bright_def", 10, 50);
-   unsigned int pwmfrq = env_get_ulong("ds1_pwmfreq", 10, ~0UL);
-   unsigned int tmp;
-   struct gptimer *timerhw;
-
-   if (on)
-   bright = bright != ~0UL ? bright : 50;
-   else
-   bright = 0;
-
-   switch (driver) {
-   case 2:
-   timerhw = (struct gptimer *)DM_TIMER5_BASE;
-   break;
-   default:
-   timerhw = (struct gptimer *)DM_TIMER6_BASE;
-   }
-
-   switch (driver) {
-   case 0: /* PMIC LED-Driver */
-   /* brightness level */
-   tps65217_reg_write(TPS65217_PROT_LEVEL_NONE,
-  TPS65217_WLEDCTRL2, bright, 0xFF);
-   /* current sink */
-   tps65217_reg_write(TPS65217_PROT_LEVEL_NONE,
-  TPS65217_WLEDCTRL1,
-  bright != 0 ? 0x0A : 0x02,
-  0xFF);
-   break;
-   case 1:
-   case 2: /* PWM using timer */
-   if (pwmfrq != ~0UL) {
-   timerhw->tiocp_cfg = TCFG_RESET;
-   udelay(10);
-   while (timerhw->tiocp_cfg & TCFG_RESET)
-   ;
-   tmp = ~0UL-(V_OSCK/pwmfrq); /* bottom value */
-   timerhw->tldr = tmp;
-   timerhw->tcrr = tmp;
-   tmp = tmp + ((V_OSCK/pwmfrq)/100) * bright;
-   timerhw->tmar = tmp;
-   timerhw->tclr = (TCLR_PT | (2 << TCLR_TRG_SHIFT) |
- 

[PATCH 10/39] video: Move bmp_display() prototype to video.h

2022-10-19 Thread Simon Glass
The lcd.h header is about to be deleted, so move this prototype.

Signed-off-by: Simon Glass 
---

 cmd/bmp.c   | 10 --
 include/video.h |  9 +
 2 files changed, 9 insertions(+), 10 deletions(-)

diff --git a/cmd/bmp.c b/cmd/bmp.c
index 5a3c8ddf8c8..880edad8898 100644
--- a/cmd/bmp.c
+++ b/cmd/bmp.c
@@ -221,16 +221,6 @@ static int bmp_info(ulong addr)
return(0);
 }
 
-/*
- * Subroutine:  bmp_display
- *
- * Description: Display bmp file located in memory
- *
- * Inputs: addraddress of the bmp file
- *
- * Return:  None
- *
- */
 int bmp_display(ulong addr, int x, int y)
 {
 #ifdef CONFIG_DM_VIDEO
diff --git a/include/video.h b/include/video.h
index 43e2c899778..f062f4a63b0 100644
--- a/include/video.h
+++ b/include/video.h
@@ -275,4 +275,13 @@ static inline int video_sync_copy_all(struct udevice *dev)
  */
 bool video_is_active(void);
 
+/*
+ * bmp_display() - Display BMP (bitmap) data located in memory
+ *
+ * @addr: address of the bmp data
+ * @x: Position of bitmap from the left side, in pixels
+ * @y: Position of bitmap from the top, in pixels
+ */
+int bmp_display(ulong addr, int x, int y);
+
 #endif
-- 
2.38.0.413.g74048e4d9e-goog



[PATCH 31/39] video: Drop CONFIG_VIDEO

2022-10-19 Thread Simon Glass
This option is not used anymore. Drop it.

Signed-off-by: Simon Glass 
---

 board/technexion/pico-imx7d/README   | 1 -
 configs/ls1028aqds_tfa_SECURE_BOOT_defconfig | 1 -
 configs/ls1028aqds_tfa_defconfig | 1 -
 configs/ls1028ardb_tfa_SECURE_BOOT_defconfig | 1 -
 configs/ls1028ardb_tfa_defconfig | 1 -
 5 files changed, 5 deletions(-)

diff --git a/board/technexion/pico-imx7d/README 
b/board/technexion/pico-imx7d/README
index 4d57cdbfa89..e8f50827213 100644
--- a/board/technexion/pico-imx7d/README
+++ b/board/technexion/pico-imx7d/README
@@ -130,7 +130,6 @@ option in the defconfig
 @@ -67,3 +67,4 @@ CONFIG_USB_GADGET_VENDOR_NUM=0x0525
  CONFIG_USB_GADGET_PRODUCT_NUM=0xa4a5
  CONFIG_CI_UDC=y
- CONFIG_VIDEO=y
 +CONFIG_SPL_OS_BOOT=y
 
 Then rebuild U-Boot:
diff --git a/configs/ls1028aqds_tfa_SECURE_BOOT_defconfig 
b/configs/ls1028aqds_tfa_SECURE_BOOT_defconfig
index b9728d6ffd9..cead1b37630 100644
--- a/configs/ls1028aqds_tfa_SECURE_BOOT_defconfig
+++ b/configs/ls1028aqds_tfa_SECURE_BOOT_defconfig
@@ -95,7 +95,6 @@ CONFIG_NXP_FSPI=y
 CONFIG_USB=y
 CONFIG_USB_XHCI_HCD=y
 CONFIG_USB_XHCI_DWC3=y
-CONFIG_VIDEO=y
 CONFIG_WDT=y
 CONFIG_WDT_SP805=y
 CONFIG_RSA=y
diff --git a/configs/ls1028aqds_tfa_defconfig b/configs/ls1028aqds_tfa_defconfig
index 6b305708bfa..307fe66eedb 100644
--- a/configs/ls1028aqds_tfa_defconfig
+++ b/configs/ls1028aqds_tfa_defconfig
@@ -101,7 +101,6 @@ CONFIG_NXP_FSPI=y
 CONFIG_USB=y
 CONFIG_USB_XHCI_HCD=y
 CONFIG_USB_XHCI_DWC3=y
-CONFIG_VIDEO=y
 CONFIG_WDT=y
 CONFIG_WDT_SP805=y
 CONFIG_OF_LIBFDT_OVERLAY=y
diff --git a/configs/ls1028ardb_tfa_SECURE_BOOT_defconfig 
b/configs/ls1028ardb_tfa_SECURE_BOOT_defconfig
index e40c59d0c66..e70b7ee4b76 100644
--- a/configs/ls1028ardb_tfa_SECURE_BOOT_defconfig
+++ b/configs/ls1028ardb_tfa_SECURE_BOOT_defconfig
@@ -89,7 +89,6 @@ CONFIG_NXP_FSPI=y
 CONFIG_USB=y
 CONFIG_USB_XHCI_HCD=y
 CONFIG_USB_XHCI_DWC3=y
-CONFIG_VIDEO=y
 CONFIG_WDT=y
 CONFIG_WDT_SP805=y
 CONFIG_RSA=y
diff --git a/configs/ls1028ardb_tfa_defconfig b/configs/ls1028ardb_tfa_defconfig
index dd64b71f9b2..44f7da01807 100644
--- a/configs/ls1028ardb_tfa_defconfig
+++ b/configs/ls1028ardb_tfa_defconfig
@@ -99,7 +99,6 @@ CONFIG_USB_HOST_ETHER=y
 CONFIG_USB_ETHER_ASIX=y
 CONFIG_USB_ETHER_ASIX88179=y
 CONFIG_USB_ETHER_RTL8152=y
-CONFIG_VIDEO=y
 CONFIG_WDT=y
 CONFIG_WDT_SP805=y
 CONFIG_OF_LIBFDT_OVERLAY=y
-- 
2.38.0.413.g74048e4d9e-goog



[PATCH 25/39] BuR: ronetix: siemens: Drop old LCD code

2022-10-19 Thread Simon Glass
This relies on the old LCD implementation which is to be removed. Drop it.

Signed-off-by: Simon Glass 
---

 board/BuR/common/common.c |  1 -
 board/ronetix/pm9263/pm9263.c | 17 -
 include/configs/pxm2.h|  5 -
 3 files changed, 23 deletions(-)

diff --git a/board/BuR/common/common.c b/board/BuR/common/common.c
index c6126e251ec..3c78020bf93 100644
--- a/board/BuR/common/common.c
+++ b/board/BuR/common/common.c
@@ -14,7 +14,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include "bur_common.h"
diff --git a/board/ronetix/pm9263/pm9263.c b/board/ronetix/pm9263/pm9263.c
index 8684e5229d8..84926cdc689 100644
--- a/board/ronetix/pm9263/pm9263.c
+++ b/board/ronetix/pm9263/pm9263.c
@@ -69,20 +69,6 @@ static void pm9263_nand_hw_init(void)
 }
 #endif
 
-#ifdef CONFIG_LCD
-
-static void pm9263_lcd_hw_init(void)
-{
-   /* Power Control */
-   at91_set_pio_output(AT91_PIO_PORTA, 22, 1);
-   at91_set_pio_value(AT91_PIO_PORTA, 22, 0);  /* power down */
-
-   gd->fb_base = ATMEL_BASE_SRAM0;
-
-}
-
-#endif /* CONFIG_LCD */
-
 int board_early_init_f(void)
 {
return 0;
@@ -101,9 +87,6 @@ int board_init(void)
 #endif
 #ifdef CONFIG_USB_OHCI_NEW
at91_uhp_hw_init();
-#endif
-#ifdef CONFIG_LCD
-   pm9263_lcd_hw_init();
 #endif
return 0;
 }
diff --git a/include/configs/pxm2.h b/include/configs/pxm2.h
index 4f24b13f500..586a7edcbb5 100644
--- a/include/configs/pxm2.h
+++ b/include/configs/pxm2.h
@@ -18,11 +18,6 @@
 #define DDR_IOCTRL_VAL 0x18b
 #define DDR_PLL_FREQ   266
 
-#define BOARD_DFU_BUTTON_GPIO  59
-#define BOARD_LCD_POWER111
-#define BOARD_BACK_LIGHT   112
-#define BOARD_TOUCH_POWER  57
-
 #define CONFIG_ENV_SETTINGS_BUTTONS_AND_LEDS \
"button_dfu0=59\0" \
"led0=117,0,1\0" \
-- 
2.38.0.413.g74048e4d9e-goog



[PATCH] arm: dts: rockchip: enable ums/rockusb command for ROCK Pi 4

2022-10-19 Thread FUKAUMI Naoki
this patch add USB mass storage function and Rockusb function for
Radxa ROCK Pi 4 series.

Signed-off-by: FUKAUMI Naoki 
---
 configs/rock-pi-4-rk3399_defconfig  | 3 +++
 configs/rock-pi-4c-rk3399_defconfig | 3 +++
 2 files changed, 6 insertions(+)

diff --git a/configs/rock-pi-4-rk3399_defconfig 
b/configs/rock-pi-4-rk3399_defconfig
index a13ac12d8c..c4f5a71f89 100644
--- a/configs/rock-pi-4-rk3399_defconfig
+++ b/configs/rock-pi-4-rk3399_defconfig
@@ -34,6 +34,8 @@ CONFIG_CMD_GPT=y
 CONFIG_CMD_MMC=y
 CONFIG_CMD_PCI=y
 CONFIG_CMD_USB=y
+CONFIG_CMD_ROCKUSB=y
+CONFIG_CMD_USB_MASS_STORAGE=y
 # CONFIG_CMD_SETEXPR is not set
 CONFIG_CMD_TIME=y
 CONFIG_SPL_OF_CONTROL=y
@@ -78,6 +80,7 @@ CONFIG_USB_ETHER_MCS7830=y
 CONFIG_USB_ETHER_RTL8152=y
 CONFIG_USB_ETHER_SMSC95XX=y
 CONFIG_USB_GADGET=y
+CONFIG_USB_FUNCTION_ROCKUSB=y
 CONFIG_DM_VIDEO=y
 CONFIG_DISPLAY=y
 CONFIG_VIDEO_ROCKCHIP=y
diff --git a/configs/rock-pi-4c-rk3399_defconfig 
b/configs/rock-pi-4c-rk3399_defconfig
index be9ac7aab9..04bff81022 100644
--- a/configs/rock-pi-4c-rk3399_defconfig
+++ b/configs/rock-pi-4c-rk3399_defconfig
@@ -34,6 +34,8 @@ CONFIG_CMD_GPT=y
 CONFIG_CMD_MMC=y
 CONFIG_CMD_PCI=y
 CONFIG_CMD_USB=y
+CONFIG_CMD_ROCKUSB=y
+CONFIG_CMD_USB_MASS_STORAGE=y
 # CONFIG_CMD_SETEXPR is not set
 CONFIG_CMD_TIME=y
 CONFIG_SPL_OF_CONTROL=y
@@ -78,6 +80,7 @@ CONFIG_USB_ETHER_MCS7830=y
 CONFIG_USB_ETHER_RTL8152=y
 CONFIG_USB_ETHER_SMSC95XX=y
 CONFIG_USB_GADGET=y
+CONFIG_USB_FUNCTION_ROCKUSB=y
 CONFIG_DM_VIDEO=y
 CONFIG_DISPLAY=y
 CONFIG_VIDEO_ROCKCHIP=y
-- 
2.35.1



[PATCH] arm: dts: rockchip: add support for ROCK 4C+

2022-10-19 Thread FUKAUMI Naoki
this patch add support for Radxa ROCK 4C Plus.

Signed-off-by: FUKAUMI Naoki 
---
 arch/arm/dts/Makefile|   1 +
 arch/arm/dts/rk3399-rock-4c-plus-u-boot.dtsi |   6 +
 arch/arm/dts/rk3399-rock-4c-plus.dts | 703 +++
 arch/arm/dts/rk3399-t-opp.dtsi   | 114 +++
 configs/rock-4c-plus-rk3399_defconfig|  90 +++
 5 files changed, 914 insertions(+)
 create mode 100644 arch/arm/dts/rk3399-rock-4c-plus-u-boot.dtsi
 create mode 100644 arch/arm/dts/rk3399-rock-4c-plus.dts
 create mode 100644 arch/arm/dts/rk3399-t-opp.dtsi
 create mode 100644 configs/rock-4c-plus-rk3399_defconfig

diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile
index 965895bc2a..74904599d7 100644
--- a/arch/arm/dts/Makefile
+++ b/arch/arm/dts/Makefile
@@ -156,6 +156,7 @@ dtb-$(CONFIG_ROCKCHIP_RK3399) += \
rk3399-puma-haikou.dtb \
rk3399-roc-pc.dtb \
rk3399-roc-pc-mezzanine.dtb \
+   rk3399-rock-4c-plus.dtb \
rk3399-rock-pi-4a.dtb \
rk3399-rock-pi-4b.dtb \
rk3399-rock-pi-4c.dtb \
diff --git a/arch/arm/dts/rk3399-rock-4c-plus-u-boot.dtsi 
b/arch/arm/dts/rk3399-rock-4c-plus-u-boot.dtsi
new file mode 100644
index 00..b7dcd2e05d
--- /dev/null
+++ b/arch/arm/dts/rk3399-rock-4c-plus-u-boot.dtsi
@@ -0,0 +1,6 @@
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+/*
+ * Copyright (c) 2022 Radxa Limited
+ */
+
+#include "rk3399-rock-pi-4-u-boot.dtsi"
diff --git a/arch/arm/dts/rk3399-rock-4c-plus.dts 
b/arch/arm/dts/rk3399-rock-4c-plus.dts
new file mode 100644
index 00..f9884902f8
--- /dev/null
+++ b/arch/arm/dts/rk3399-rock-4c-plus.dts
@@ -0,0 +1,703 @@
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+/*
+ * Copyright (c) 2019 Fuzhou Rockchip Electronics Co., Ltd
+ * Copyright (c) 2019 Radxa Limited
+ * Copyright (c) 2022 Amarula Solutions(India)
+ */
+
+/dts-v1/;
+#include 
+#include "rk3399.dtsi"
+#include "rk3399-t-opp.dtsi"
+
+/ {
+   model = "Radxa ROCK 4C+";
+   compatible = "radxa,rock-4c-plus", "rockchip,rk3399";
+
+   aliases {
+   mmc0 = &sdmmc;
+   mmc1 = &sdhci;
+   };
+
+   chosen {
+   stdout-path = "serial2:150n8";
+   };
+
+   clkin_gmac: external-gmac-clock {
+   compatible = "fixed-clock";
+   clock-frequency = <12500>;
+   clock-output-names = "clkin_gmac";
+   #clock-cells = <0>;
+   };
+
+   leds {
+   compatible = "gpio-leds";
+   pinctrl-names = "default";
+   pinctrl-0 = <&user_led1 &user_led2>;
+
+   /* USER_LED1 */
+   led-0 {
+   function = LED_FUNCTION_POWER;
+   color = ;
+   gpios = <&gpio3 RK_PD4 GPIO_ACTIVE_LOW>;
+   linux,default-trigger = "default-on";
+   };
+
+   /* USER_LED2 */
+   led-1 {
+   function = LED_FUNCTION_STATUS;
+   color = ;
+   gpios = <&gpio3 RK_PD5 GPIO_ACTIVE_HIGH>;
+   linux,default-trigger = "heartbeat";
+   };
+   };
+
+   sdio_pwrseq: sdio-pwrseq {
+   compatible = "mmc-pwrseq-simple";
+   clocks = <&rk809 1>;
+   clock-names = "ext_clock";
+   pinctrl-names = "default";
+   pinctrl-0 = <&wifi_enable_h>;
+   reset-gpios = <&gpio0 RK_PB2 GPIO_ACTIVE_LOW>;
+   };
+
+   vcc_3v3: vcc-3v3-regulator {
+   compatible = "regulator-fixed";
+   regulator-name = "vcc_3v3";
+   regulator-always-on;
+   regulator-boot-on;
+   regulator-min-microvolt = <330>;
+   regulator-max-microvolt = <330>;
+   vin-supply = <&vcc3v3_sys>;
+   };
+
+   vcc3v3_phy1: vcc3v3-phy1-regulator {
+   compatible = "regulator-fixed";
+   regulator-name = "vcc3v3_phy1";
+   regulator-always-on;
+   regulator-boot-on;
+   regulator-min-microvolt = <330>;
+   regulator-max-microvolt = <330>;
+   vin-supply = <&vcc_3v3>;
+   };
+
+   vcc5v0_host1: vcc5v0-host-regulator {
+   compatible = "regulator-fixed";
+   enable-active-high;
+   gpio = <&gpio3 RK_PD6 GPIO_ACTIVE_HIGH>;
+   pinctrl-names = "default";
+   pinctrl-0 = <&vcc5v0_host_en>;
+   regulator-name = "vcc5v0_host1";
+   regulator-always-on;
+   regulator-boot-on;
+   vin-supply = <&vcc5v0_host0_s0>;
+   };
+
+   vcc5v0_sys: vcc5v0-sys-regulator {
+   compatible = "regulator-fixed";
+   regulator-name = "vcc5v0_sys";
+   regulator-always-on;
+   regulator-boot-on;
+   regulator-min-microvolt = <500>;

[PATCH 00/39] lcd: Drop old LCD support

2022-10-19 Thread Simon Glass
The conversion to DM_VIDEO was completed some years ago. The old video
code has been removed but the LCD code remains. This series removes it,
to complete the driver model migration.


Simon Glass (39):
  video: Split SPLASH_SCREEN_ALIGN from bmp command
  Convert CONFIG_HIDE_LOGO_VERSION to Kconfig
  video: Rename CONFIG_SYS_VIDEO_LOGO_MAX_SIZE
  Convert CONFIG_VIDEO_LOGO_MAX_SIZE to Kconfig
  video: lcd: Drop console rotation
  video: Drop CONFIG_LCD_ALIGNMENT
  video: Drop CONFIG_LCD_MENU
  video: Drop CONFIG_LCD_INFO_BELOW_LOGO
  video: Drop CONFIG_LCD_INFO
  video: Move bmp_display() prototype to video.h
  api: Drop LCD implementation
  Drop CONFIG_LCD_LOGO
  video: Drop VCXK video controller
  BuR: Drop old LCD code
  video: Drop CONFIG_AM335X_LCD
  video: atmel: Drop pre-DM parts of video driver
  video: Drop ld9040 driver
  video: atmel: Drop CONFIG_LCD_IN_PSRAM
  treewide: Stop enabling CONFIG_LCD
  video: Drop atmel LCD code
  video: samsung: Drop old LCD code
  nexell: Drop old LCD code
  compulab: Drop old LCD code
  tegra: Drop old LCD code
  BuR: ronetix: siemens: Drop old LCD code
  video: cmd: Drop old LCD code
  efi: Drop old LCD code
  video: Drop remaining references to CONFIG_LCD
  fdt: Drop support for LCD fixup in simplefb
  video: Drop LCD_BPP
  video: Drop CONFIG_VIDEO
  video: Drop CONFIG_VIDEO
  video: Drop CONFIG_LCD
  video: Drop use of the lcd header file
  video: Drop common LCD implementation
  video: Drop SPLASHIMAGE_CALLBACK
  video: Make all video options depend on DM_VIDEO
  pci: Drop test for DM_VIDEO
  video: Rename CONFIG_DM_VIDEO to CONFIG_VIDEO

 MAINTAINERS   |   2 -
 README|  74 ---
 api/api_display.c |  22 -
 arch/Kconfig  |   2 +-
 arch/arm/Kconfig  |   2 +-
 .../mach-at91/arm926ejs/at91sam9n12_devices.c |  39 --
 arch/arm/mach-at91/armv7/sama5d3_devices.c|  33 -
 arch/arm/mach-exynos/include/mach/mipi_dsim.h |   1 -
 arch/arm/mach-imx/cpu.c   |   2 +-
 arch/arm/mach-imx/mx6/Kconfig |   2 +-
 arch/arm/mach-imx/mx6/soc.c   |   2 +-
 arch/arm/mach-imx/mx7/soc.c   |   2 +-
 .../mach-nexell/include/mach/display_dev.h|   7 -
 arch/arm/mach-omap2/am33xx/Kconfig|   2 +-
 arch/arm/mach-omap2/am33xx/clock_am33xx.c |   4 -
 .../cmd_stm32prog/cmd_stm32prog.c |   2 +-
 arch/arm/mach-sunxi/Kconfig   |   6 +-
 arch/arm/mach-tegra/board2.c  |   4 +-
 arch/x86/Kconfig  |   2 +-
 board/BuR/brxre1/board.c  |   9 -
 board/BuR/common/br_resetc.c  |   6 -
 board/BuR/common/bur_common.h |   6 -
 board/BuR/common/common.c | 225 ---
 board/BuS/eb_cpu5282/eb_cpu5282.c |  82 ---
 board/aristainetos/aristainetos.c |   4 +-
 board/atmel/at91sam9261ek/at91sam9261ek.c |  95 ---
 board/atmel/at91sam9263ek/at91sam9263ek.c | 108 
 .../atmel/at91sam9m10g45ek/at91sam9m10g45ek.c | 103 
 board/atmel/at91sam9n12ek/at91sam9n12ek.c |  64 --
 board/atmel/at91sam9rlek/at91sam9rlek.c   |  88 ---
 board/atmel/at91sam9x5ek/at91sam9x5ek.c   |   2 +-
 board/atmel/common/Makefile   |   2 +-
 .../atmel/sama5d27_som1_ek/sama5d27_som1_ek.c |   2 +-
 .../sama5d27_wlsom1_ek/sama5d27_wlsom1_ek.c   |   2 +-
 .../atmel/sama5d2_xplained/sama5d2_xplained.c |   2 +-
 board/atmel/sama5d3xek/sama5d3xek.c   |   2 +-
 .../atmel/sama5d4_xplained/sama5d4_xplained.c |   2 +-
 board/atmel/sama5d4ek/sama5d4ek.c |   2 +-
 board/beckhoff/mx53cx9020/Makefile|   2 +-
 board/bluewater/gurnard/gurnard.c |   5 +-
 board/bosch/guardian/board.c  |  70 ---
 board/compal/paz00/paz00.c|   2 +-
 board/compulab/common/Makefile|   1 -
 board/compulab/common/omap3_display.c | 452 --
 board/freescale/imx8ulp_evk/imx8ulp_evk.c |   2 +-
 .../mx6ul_14x14_evk/mx6ul_14x14_evk.c |   2 +-
 board/ge/mx53ppd/Makefile |   2 +-
 board/l+g/vinco/vinco.c   |   1 -
 board/menlo/m53menlo/m53menlo.c   |   6 +-
 board/nvidia/harmony/harmony.c|   1 -
 board/raspberrypi/rpi/rpi.c   |   1 -
 board/ronetix/pm9263/pm9263.c | 112 
 board/samsung/common/board.c  |   5 -
 board/samsung/common/misc.c   | 340 ---
 board/samsung/trats/trats.c   |   1 -
 board/samsung/trats2/trats2.c |  22 -
 board/samsung/universal_c210/universal.c  |   2 -
 board/st/stm32f746-disco/stm32f746-disco.c|   1 -
 board/technexion/pico-imx7d/README|   1 -
 board/technexion/pico-imx7d/pico-imx7d.c  |   4 +-
 .../tora

[PATCH 39/39] video: Rename CONFIG_DM_VIDEO to CONFIG_VIDEO

2022-10-19 Thread Simon Glass
Now that all the old code is gone, rename this option. Driver model
migration is now complete.

Signed-off-by: Simon Glass 
---

 arch/Kconfig| 2 +-
 arch/arm/Kconfig| 2 +-
 arch/arm/mach-imx/cpu.c | 2 +-
 arch/arm/mach-imx/mx6/Kconfig   | 2 +-
 arch/arm/mach-imx/mx6/soc.c | 2 +-
 arch/arm/mach-imx/mx7/soc.c | 2 +-
 arch/arm/mach-omap2/am33xx/Kconfig  | 2 +-
 arch/arm/mach-stm32mp/cmd_stm32prog/cmd_stm32prog.c | 2 +-
 arch/arm/mach-sunxi/Kconfig | 6 +++---
 arch/arm/mach-tegra/board2.c| 4 ++--
 arch/x86/Kconfig| 2 +-
 board/atmel/at91sam9x5ek/at91sam9x5ek.c | 2 +-
 board/atmel/common/Makefile | 2 +-
 board/atmel/sama5d27_som1_ek/sama5d27_som1_ek.c | 2 +-
 board/atmel/sama5d27_wlsom1_ek/sama5d27_wlsom1_ek.c | 2 +-
 board/atmel/sama5d2_xplained/sama5d2_xplained.c | 2 +-
 board/atmel/sama5d3xek/sama5d3xek.c | 2 +-
 board/atmel/sama5d4_xplained/sama5d4_xplained.c | 2 +-
 board/atmel/sama5d4ek/sama5d4ek.c   | 2 +-
 board/beckhoff/mx53cx9020/Makefile  | 2 +-
 board/bluewater/gurnard/gurnard.c   | 4 ++--
 board/compal/paz00/paz00.c  | 2 +-
 board/freescale/imx8ulp_evk/imx8ulp_evk.c   | 2 +-
 board/freescale/mx6ul_14x14_evk/mx6ul_14x14_evk.c   | 2 +-
 board/ge/mx53ppd/Makefile   | 2 +-
 board/technexion/pico-imx7d/pico-imx7d.c| 4 ++--
 board/toradex/colibri-imx6ull/colibri-imx6ull.c | 4 ++--
 board/toradex/colibri_imx7/colibri_imx7.c   | 6 +++---
 board/toradex/common/tdx-common.c   | 2 +-
 boot/pxe_utils.c| 2 +-
 cmd/Kconfig | 2 +-
 cmd/bdinfo.c| 2 +-
 cmd/cls.c   | 2 +-
 common/Kconfig  | 2 +-
 common/board_f.c| 2 +-
 common/fdt_simplefb.c   | 2 +-
 common/splash.c | 6 +++---
 common/stdio.c  | 4 ++--
 configs/aristainetos2c_defconfig| 2 +-
 configs/aristainetos2ccslb_defconfig| 2 +-
 configs/at91sam9x5ek_dataflash_defconfig| 2 +-
 configs/at91sam9x5ek_mmc_defconfig  | 2 +-
 configs/at91sam9x5ek_nandflash_defconfig| 2 +-
 configs/at91sam9x5ek_spiflash_defconfig | 2 +-
 configs/bananapi-m5_defconfig   | 2 +-
 configs/beelink-gsking-x_defconfig  | 2 +-
 configs/beelink-gtking_defconfig| 2 +-
 configs/beelink-gtkingpro_defconfig | 2 +-
 configs/chromebit_mickey_defconfig  | 2 +-
 configs/chromebook_bob_defconfig| 2 +-
 configs/chromebook_jerry_defconfig  | 2 +-
 configs/chromebook_kevin_defconfig  | 2 +-
 configs/chromebook_minnie_defconfig | 2 +-
 configs/chromebook_speedy_defconfig | 2 +-
 configs/cm_fx6_defconfig| 2 +-
 configs/evb-px30_defconfig  | 2 +-
 configs/evb-rk3288_defconfig| 2 +-
 configs/evb-rk3399_defconfig| 2 +-
 configs/firefly-px30_defconfig  | 2 +-
 configs/firefly-rk3288_defconfig| 2 +-
 configs/gazerbeam_defconfig | 2 +-
 configs/ge_b1x5v2_defconfig | 2 +-
 configs/ge_bx50v3_defconfig | 2 +-
 configs/gurnard_defconfig   | 2 +-
 configs/gwventana_emmc_defconfig| 2 +-
 configs/gwventana_gw5904_defconfig  | 2 +-
 configs/gwventana_nand_defconfig| 2 +-
 configs/harmony_defconfig   | 2 +-
 configs/imx6dl_icore_nand_defconfig | 2 +-
 configs/imx6q_icore_nand_defconfig  | 2 +-
 configs/imx6qdl_icore_mmc_defconfig | 2 +-
 configs/imx6qdl_icore_nand_defconfig| 2 +-
 configs/imx7_cm_defconfig   | 2 +-
 configs/imx8mp_rsb3720a1_4G_defconfig   | 2 +-
 configs/imx8mp_rsb3720a1_6G_defconfig   | 2 +-
 configs/imxrt1050-evk_defconfig | 2 +-
 configs/khadas-vim3_android_ab_defconfig| 2 +-
 configs/khadas-vim3_android_defconfig   | 2 +-
 configs/khadas-vim3_defconfig   | 2 +-
 configs/khadas-vim3l_android_ab_defconfig   | 2 +-
 configs/khadas-vim3l_android_defconfig 

Re: [PATCH v2 11/12] rockchip: lion-rk3368: migrate to u-boot-rockchip.bin

2022-10-19 Thread Quentin Schulz

Hi Kever,

On 10/19/22 13:28, Kever Yang wrote:

Hi Quentin,

     I got below error when apply this patch, could you help to check

+Error: arch/arm/dts/rk3368-lion-haikou-u-boot.dtsi:44.16-17 syntax error
+FATAL ERROR: Unable to parse input tree
+make[3]: *** [arch/arm/dts/rk3368-lion-haikou.dtb] Error 1
+make[2]: *** [arch-dtbs] Error 2



Did you run make lion-rk3368_defconfig before trying to compile the DTS?

I ran:
```
git checkout 3724ddf157
b4 shazam --add-link --add-my-sob 
https://lore.kernel.org/u-boot/20220915091432.789294-1-foss+ub...@0leil.net/

make CROSS_COMPILE="ccache aarch64-linux-gnu-" lion-rk3368_defconfig
make CROSS_COMPILE="ccache aarch64-linux-gnu-" j`nproc`
```
and it compiled without any problem.

Cheers,
Quentin


Re: [EXTERNAL] Re: [PATCH 1/2] arm: dts: k3-am625-sk: Add OSPI support

2022-10-19 Thread Tom Rini
On Wed, Oct 19, 2022 at 12:17:43PM +0530, Dhruva Gole wrote:
> Hi Tom,
> 
> On 06/10/22 21:08, Tom Rini wrote:
> > On Tue, Sep 27, 2022 at 10:59:17AM +0530, Dhruva Gole wrote:
> > 
> > > Add DT nodes to enable S28HS512T OSPI flash on the SK board.
> > > 
> > > Signed-off-by: Dhruva Gole 
> > > ---
> > >   arch/arm/dts/k3-am625-sk-u-boot.dtsi | 24 +
> > >   arch/arm/dts/k3-am625-sk.dts | 77 
> > 
> > What is the status of the non u-boot.dtsi portion of this patch with
> > upstream Linux? Thanks.
> In upstream, please refer to 
> https://elixir.bootlin.com/linux/latest/source/arch/arm64/boot/dts/ti/k3-am625-sk.dts#L24
> 
> 
> spi0 = &ospi0;
> 
> and pinmux is all done in a similar fashion as I have done in these patches.

The preferred way to do this then is to post a patch syncing the whole
of the DTS files with a given upstream tag then, so that it's clear and
also so the trees stay up to date. This also applies to the patches you
posted today.

-- 
Tom


signature.asc
Description: PGP signature


Re: [PATCH v2 11/12] rockchip: lion-rk3368: migrate to u-boot-rockchip.bin

2022-10-19 Thread Kever Yang

Hi Quentin,

    This is report by the  denx ci system:

https://source.denx.de/u-boot/custodians/u-boot-rockchip/-/jobs/515913

    And I can reproduce it with buildman sheep-rk3568


Thanks,

- Kever

On 2022/10/19 20:11, Quentin Schulz wrote:

Hi Kever,

On 10/19/22 13:28, Kever Yang wrote:

Hi Quentin,

 I got below error when apply this patch, could you help to check

+Error: arch/arm/dts/rk3368-lion-haikou-u-boot.dtsi:44.16-17 syntax 
error

+FATAL ERROR: Unable to parse input tree
+make[3]: *** [arch/arm/dts/rk3368-lion-haikou.dtb] Error 1
+make[2]: *** [arch-dtbs] Error 2



Did you run make lion-rk3368_defconfig before trying to compile the DTS?

I ran:
```
git checkout 3724ddf157
b4 shazam --add-link --add-my-sob 
https://lore.kernel.org/u-boot/20220915091432.789294-1-foss+ub...@0leil.net/

make CROSS_COMPILE="ccache aarch64-linux-gnu-" lion-rk3368_defconfig
make CROSS_COMPILE="ccache aarch64-linux-gnu-" j`nproc`
```
and it compiled without any problem.

Cheers,
Quentin


Re: [u-boot][PATCH v2 2/4] scripts: Makefile.spl: Enable memory drivers to be built for SPL

2022-10-19 Thread Tom Rini
On Wed, Oct 19, 2022 at 11:17:35AM +0300, Roger Quadros wrote:
> 
> 
> On 18/10/2022 20:40, Tom Rini wrote:
> > On Thu, Oct 06, 2022 at 04:23:58PM +0300, Roger Quadros wrote:
> >> We will need ti-gpmc driver for SPL. Allow memory drivers
> >> do be built for SPL.
> >>
> >> Signed-off-by: Roger Quadros 
> >> ---
> >>  scripts/Makefile.spl | 1 +
> >>  1 file changed, 1 insertion(+)
> >>
> >> diff --git a/scripts/Makefile.spl b/scripts/Makefile.spl
> >> index 3bafeb4fe9..110076b22f 100644
> >> --- a/scripts/Makefile.spl
> >> +++ b/scripts/Makefile.spl
> >> @@ -114,6 +114,7 @@ libs-$(CONFIG_PARTITIONS) += disk/
> >>  endif
> >>  
> >>  libs-y += drivers/
> >> +libs-y += drivers/memory/
> >>  libs-$(CONFIG_SPL_USB_GADGET) += drivers/usb/dwc3/
> >>  libs-$(CONFIG_SPL_USB_GADGET) += drivers/usb/cdns3/
> >>  libs-y += dts/
> > 
> > This ends up being the wrong approach as it then pulls in
> > drivers/memory/stm32-fmc2-ebi.o on all of those platforms, in SPL, which
> > is not what's intended. We need an SPL_MEMORY symbol and then gate the
> > directory on that.
> > 
> 
> That's right. I'll fix it up. Will wait for your comments on the rest
> of the series before re-spin.

Everything else is fine, I was about to merge it (with a
%s/DM_MEMORY/MEMORY) when I saw the stm32 platforms increasing in size
and dug in.

-- 
Tom


signature.asc
Description: PGP signature


Re: [PATCH] Makefile: fix u-boot-initial-env target if lto is enabled

2022-10-19 Thread Max Krummenacher
Hi all

Thanks for the feedback

On Tue, Oct 18, 2022 at 8:23 PM Tom Rini  wrote:
>
> On Tue, Oct 18, 2022 at 08:19:23PM +0200, Pali Rohár wrote:
> > On Tuesday 18 October 2022 14:17:23 Tom Rini wrote:
> > > On Tue, Oct 18, 2022 at 08:06:27PM +0200, Pali Rohár wrote:
> > > > On Tuesday 18 October 2022 14:04:46 Tom Rini wrote:
> > > > > On Tue, Oct 18, 2022 at 08:03:31PM +0200, Pali Rohár wrote:
> > > > > > On Tuesday 18 October 2022 19:48:27 Max Krummenacher wrote:
> > > > > > > From: Max Krummenacher 
> > > > > > >
> > > > > > > With LTO enabled the U-Boot initial environment is no longer 
> > > > > > > stored
> > > > > > > in an easy accessible section in env/common.o. I.e. the section 
> > > > > > > name
> > > > > > > changes from build to build, its content maybe compressed and it 
> > > > > > > is
> > > > > > > annotated with additional data.
> > > > > > >
> > > > > > > For GCC adding the option '-ffat-lto-objects' when compiling 
> > > > > > > common.o
> > > > > > > adds additionally the traditional sections in the object file and
> > > > > > > 'make u-boot-initial-env' would work also for the LTO enabled 
> > > > > > > case.
> > > > > > > However clang doesn't have that option.
> > > > > > >
> > > > > > > Fix this by recompiling common.o into a object file only used for
> > > > > > > the creation of u-boot-initial-env if LTO is enabled.
> > > > > > >
> > > > > > > See also:
> > > > > > > https://lore.kernel.org/all/927b122e-1f62-e790-f5ca-30bae4332...@foss.st.com/
> > > > > > >
> > > > > > > Signed-off-by: Max Krummenacher 
> > > > > > >
> > > > > > > ---
> > > > > > >
> > > > > > >  Makefile | 8 
> > > > > > >  1 file changed, 8 insertions(+)
> > > > > > >
> > > > > > > diff --git a/Makefile b/Makefile
> > > > > > > index 3866cc62f9a..cd45c720d23 100644
> > > > > > > --- a/Makefile
> > > > > > > +++ b/Makefile
> > > > > > > @@ -2451,9 +2451,17 @@ endif
> > > > > > > $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modpost
> > > > > > >
> > > > > > >  quiet_cmd_genenv = GENENV  $@
> > > > > > > +ifeq ($(LTO_ENABLE),y)
> > > > > > > +cmd_genenv = $(CC) $(filter-out $(LTO_CFLAGS),$(c_flags)) -c -o 
> > > > > > > env/initial_env.o env/common.c; \
> > > > > > > +   $(OBJCOPY) --dump-section .rodata.default_environment=$@ 
> > > > > > > env/initial_env.o; \
> > > > > > > +   sed --in-place -e 's/\x00/\x0A/g' $@; sed --in-place -e 
> > > > > > > '/^\s*$$/d' $@; \
> > > > > > > +   sort --field-separator== -k1,1 --stable $@ -o $@; \
> > > > > > > +   rm -f env/initial_env.o env/initial_env.su
> > > > > > > +else
> > > > > > >  cmd_genenv = $(OBJCOPY) --dump-section 
> > > > > > > .rodata.default_environment=$@ env/common.o; \
> > > > > >
> > > > > > This code is still broken because in some cases section name is not 
> > > > > > RO.
> > > > >
> > > > > Wait, when does that happen?
> > > >
> > > > E.g. for mvebu_espressobin-88f3720_defconfig
> > >
> > > Erm, ugh. I see 44be835d25ba ("arm: mvebu: Espressobin: Set default
> > > value for $ethNaddr env variable") and c4df0f6f315c ("arm: mvebu:
> > > Espressobin: Set default value for $fdtfile env variable") I guess we
> > > couldn't solve this any other way? The platforms aren't unique in
> > > needing / wanting to set MAC or fdtfile variables.
> >
> > Yes, we can solve it. Marek was working on solution for setting default
> > variables at runtime but seems it is not finished yet.
>
> OK, then lets not assume DEFAULT_ENV_IS_RW is something we need to worry
> about long term.

The patch was intended to fix u-boot-initial-env make target for cases
where it worked
without 'CONFIG_LTO' to also work if that config gets enabled.

Any use case where it already fails without 'CONFIG_LTO' set will not benefit.

I agree that a variant of tools/env/fw_printenv compiled for the build host may
solve additional issues present. However I will not be able to work on such a
solution in the near future.

Max

>
> --
> Tom


Re: [PATCH] Makefile: fix u-boot-initial-env target if lto is enabled

2022-10-19 Thread Max Krummenacher
Hi Tom

On Tue, Oct 18, 2022 at 7:57 PM Tom Rini  wrote:
>
> On Tue, Oct 18, 2022 at 07:48:27PM +0200, Max Krummenacher wrote:
> > From: Max Krummenacher 
> >
> > With LTO enabled the U-Boot initial environment is no longer stored
> > in an easy accessible section in env/common.o. I.e. the section name
> > changes from build to build, its content maybe compressed and it is
> > annotated with additional data.
> >
> > For GCC adding the option '-ffat-lto-objects' when compiling common.o
> > adds additionally the traditional sections in the object file and
> > 'make u-boot-initial-env' would work also for the LTO enabled case.
> > However clang doesn't have that option.
> >
> > Fix this by recompiling common.o into a object file only used for
> > the creation of u-boot-initial-env if LTO is enabled.
> >
> > See also:
> > https://lore.kernel.org/all/927b122e-1f62-e790-f5ca-30bae4332...@foss.st.com/
> >
> > Signed-off-by: Max Krummenacher 
> >
> > ---
> >
> >  Makefile | 8 
> >  1 file changed, 8 insertions(+)
> >
> > diff --git a/Makefile b/Makefile
> > index 3866cc62f9a..cd45c720d23 100644
> > --- a/Makefile
> > +++ b/Makefile
> > @@ -2451,9 +2451,17 @@ endif
> >   $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modpost
> >
> >  quiet_cmd_genenv = GENENV  $@
> > +ifeq ($(LTO_ENABLE),y)
> > +cmd_genenv = $(CC) $(filter-out $(LTO_CFLAGS),$(c_flags)) -c -o 
> > env/initial_env.o env/common.c; \
> > + $(OBJCOPY) --dump-section .rodata.default_environment=$@ 
> > env/initial_env.o; \
> > + sed --in-place -e 's/\x00/\x0A/g' $@; sed --in-place -e '/^\s*$$/d' 
> > $@; \
> > + sort --field-separator== -k1,1 --stable $@ -o $@; \
> > + rm -f env/initial_env.o env/initial_env.su
> > +else
> >  cmd_genenv = $(OBJCOPY) --dump-section .rodata.default_environment=$@ 
> > env/common.o; \
> >   sed --in-place -e 's/\x00/\x0A/g' $@; sed --in-place -e '/^\s*$$/d' 
> > $@; \
> >   sort --field-separator== -k1,1 --stable $@ -o $@
> > +endif
> >
> >  u-boot-initial-env: u-boot.bin
> >   $(call if_changed,genenv)
>
> Can we pipe the output instead of making a new object file? Maybe not,
> in a portable way it seems. But, I'm not sure the above respects using
> O= as well so that does need to be checked and fixed if so.

While I didn't test it seems that objcopy doesn't allow to pipe data in and out
of it.

Max
>
> --
> Tom


Re: [PATCH v2] binman: Add support for symlinking images

2022-10-19 Thread Simon Glass
On Mon, 17 Oct 2022 at 05:06, Neha Malcom Francis  wrote:
>
> Adding support to symlink an image packaged using binman.
>
> Signed-off-by: Neha Malcom Francis 
> ---
>
> Changes in v2:
> - added testing for symlink support
> - moved from tools.Run('ln',...) to os.symlink()
>
>  tools/binman/binman.rst   |  3 +++
>  tools/binman/ftest.py |  9 +
>  tools/binman/image.py |  6 ++
>  tools/binman/test/259_symlink.dts | 16 
>  4 files changed, 34 insertions(+)
>  create mode 100644 tools/binman/test/259_symlink.dts

Reviewed-by: Simon Glass 


Re: [PATCH 03/24] bootmenu: Add a few comments

2022-10-19 Thread Simon Glass
Hi Heinrich,

On Mon, 17 Oct 2022 at 15:46, Heinrich Schuchardt  wrote:
>
> On 10/17/22 22:29, Simon Glass wrote:
> > The behaviour of these two functions is completely undocumented. Add some
> > notes so the poor, suffering dev can figure out what is going on.
> >
> > Signed-off-by: Simon Glass 
> > ---
> >
> >   include/menu.h | 42 ++
> >   1 file changed, 42 insertions(+)
> >
> > diff --git a/include/menu.h b/include/menu.h
> > index 702aacb170c..0b4d9734149 100644
> > --- a/include/menu.h
> > +++ b/include/menu.h
> > @@ -42,6 +42,7 @@ struct bootmenu_data {
> >   struct bootmenu_entry *first;   /* first menu entry */
> >   };
> >
> > +/** enum bootmenu_key - keys that can be returned by the bootmenu */
> >   enum bootmenu_key {
> >   KEY_NONE = 0,
> >   KEY_UP,
> > @@ -53,8 +54,49 @@ enum bootmenu_key {
> >   KEY_SPACE,
> >   };
> >
> > +/**
> > + * bootmenu_autoboot_loop() - handle autobooting if no key is pressed
> > + *
> > + * This shows a prompt to allow the user to press a key to interrupt auto 
> > boot
> > + * of the first menu option.
> > + *
> > + * It then waits for the required time (menu->delay in seconds) for a key 
> > to be
> > + * pressed. If nothing is pressed in that time, @key returns KEY_SELECT
> > + * indicating that the current option should be chosen.
> > + *
> > + * @menu: Menu being processed
> > + * @key: Returns the code for the key the user pressed:
> > + *   enter: KEY_SELECT
> > + *   Ctrl-C: KEY_QUIT
> > + *   anything else: KEY_NONE
> > + * @esc: Set to 1 if the escape key is pressed, otherwise not updated
> > + */
> >   void bootmenu_autoboot_loop(struct bootmenu_data *menu,
> >   enum bootmenu_key *key, int *esc);
> > +
> > +/**
> > + * bootmenu_loop() - handle waiting for a keypress when autoboot is 
> > disabled
> > + *
> > + * This is used when the menu delay is negative, indicating that the delay 
> > has
> > + * elapsed, or there was no delay to begin with.
>
> Unfortunately the description does not match the code.
>
> This function is entered if some key was pressed, so autoboot was
> stopped. When the delay elapses the default action is taken by the caller.

This one doesn't do default action, right? That functionality is in
bootmenu_autoboot_loop() above.

>
> > + *
> > + * It reads a character and processes it, returning a menu-key code if a
> > + * character is recognised
> > + *
> > + * @menu: Menu being processed
> > + * @key: Returns the code for the key the user pressed:
> > + *   enter: KEY_SELECT
> > + *   Ctrl-C: KEY_QUIT
> > + *   Up arrow: KEY_UP
> > + *   Down arrow: KEY_DOWN
> > + *   Escape (by itself): KEY_QUIT
> > + *   Plus: KEY_PLUS
> > + *   Minus: KEY_MINUS
> > + *   Space: KEY_SPACE
>
> We already discussed that this list is to change. We should support
> accelerator keys in menus.

OK, but not related to my change here.

>
> > + * @esc: On input, a non-zero value indicates that an escape sequence has
>
> 1 indicates that the ESC key has been pressed.
> All other values indicate that the ESC key has not been pressed.
>
> --
>
> The whole design is broken in that the concept of a menu is not properly
> encapsulated.
>
> A function like bootmenu_autoboot_loop() should not be exported.
>
> The view side of a menu should be in a function that takes the following
> arguments:
>
> - the location (x,y) on the screen
> - the size (dx, dy) of the displayed menu
>(further items should be viewed by vertical scrolling,
>more characters by horizontal scrolling)
> - a list of menu items to display
> - a event function called whenever the selected menu item changes (or NULL)
>
> Such an event function will allow to display extra information for a
> menu item.
>
> The model would be an array of utf-8 strings.
>
> The controller will invoke the view function and receive the index of
> the selected item as the return value (or -1 if ESC is pressed).

I think the existing menu system is not useful as a basis for what we
want, which I why I designed expo. We should focus on getting that
right. Just to be clear, I will not be taking on any effort involved
in making things work with EFI. But you may wish to.

>
> Best regards
>
> Heinrich
>
> > + *   resulted in that many characters so far. On exit this is updated to 
> > the
> > + *   new number of characters
> > + */
> >   void bootmenu_loop(struct bootmenu_data *menu,
> >  enum bootmenu_key *key, int *esc);
> >
>

Regards,
Simon


Re: [PATCH 04/24] menu: Rename KEY_... to BKEY_...

2022-10-19 Thread Simon Glass
Hi Heinrich,

On Mon, 17 Oct 2022 at 15:55, Heinrich Schuchardt  wrote:
>
> On 10/17/22 22:29, Simon Glass wrote:
> > This enum values conflict with linux/input.h so rename them.
> >
> > Signed-off-by: Simon Glass 
> > ---
> >
> >   cmd/bootmenu.c  | 10 +-
> >   cmd/eficonfig.c | 26 +-
> >   common/menu.c   | 34 +-
> >   include/menu.h  | 32 
> >   4 files changed, 51 insertions(+), 51 deletions(-)
> >
> > diff --git a/cmd/bootmenu.c b/cmd/bootmenu.c
> > index 3340be16325..c80004c54dc 100644
> > --- a/cmd/bootmenu.c
> > +++ b/cmd/bootmenu.c
> > @@ -86,7 +86,7 @@ static char *bootmenu_choice_entry(void *data)
> >   {
>
> The argument should be of type struct bootmenu_data* and not void.
>
> This function and the enum should be move to common/menu.c and not exported.

That would be a separate patch.

>
> common/menu.c does not import linux/input.h so there will be no conflict
> but that sould not stop you from renaming the constants.

Yes, it's not the conflict, just the confusion.

Regards,
Simon


Re: [PATCH 09/24] image: Add a function to find a script in an image

2022-10-19 Thread Simon Glass
Hi Heinrich,

On Mon, 17 Oct 2022 at 16:10, Heinrich Schuchardt  wrote:
>
> On 10/17/22 22:29, Simon Glass wrote:
> > Split this functionality out of the 'source' command so it can be used
> > from another place.
>
> It is not obvious how this relates to changing the series.
>
> Please, provide a description of the future use of the extracted library
> function.
>
> >
> > Signed-off-by: Simon Glass 
> > ---
> >
> >   cmd/source.c| 173 ++--
> >   include/image.h |  13 
>
> If you extract a library function, it should not live in cmd/source.c.
>

I can put it in boot/image*.c perhaps.

Regards,
Simon


Re: [PATCH 10/24] video: Enable VIDEO_ANSI by default only with EFI

2022-10-19 Thread Simon Glass
Hi Heinrich,

On Mon, 17 Oct 2022 at 16:08, Heinrich Schuchardt  wrote:
>
> On 10/17/22 22:29, Simon Glass wrote:
> > This is not generally needed unless EFI_LOADER is used. Adjust the default
> > setting to reduce the size of the U-Boot build.
> >
> > Signed-off-by: Simon Glass 
> > ---
> >
> >   drivers/video/Kconfig | 7 +--
> >   1 file changed, 5 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/video/Kconfig b/drivers/video/Kconfig
> > index 32938376655..ed77815504b 100644
> > --- a/drivers/video/Kconfig
> > +++ b/drivers/video/Kconfig
> > @@ -118,10 +118,13 @@ config VIDEO_BPP32
> >   config VIDEO_ANSI
> >   bool "Support ANSI escape sequences in video console"
> >   depends on DM_VIDEO
> > - default y
> > + default y if EFI_LOADER
>
> This will cripple the CLS command.

I can add that as a dependency.

I actually don't like using cls as it makes debugging hard. You can't
see the previous output on the terminal!

Regards,
Simon


Re: [PATCH 14/24] bootstd: Read the Operating System name for distro/scripts

2022-10-19 Thread Simon Glass
Hi Heinrich,

On Mon, 17 Oct 2022 at 16:14, Heinrich Schuchardt  wrote:
>
> On 10/17/22 22:29, Simon Glass wrote:
> > Add the concept of an OS name to the bootflow. This typically includes the
> > OS name, version and kernel version.
> >
> > Implement this for the distro and script bootmeths so that it works with
> > Armbian and older version of Fedora.
>
> How do you plan to detect the distro?

Just by reading the information it provides. For Armbian you can tell
from the script. For Fedora there is a name in the boot file.

I hope we can standardise this at some point.

Regards,
Simon


Re: [PATCH 16/24] menu: Factor out menu-keypress decoding

2022-10-19 Thread Simon Glass
Hi Heinrich,

On Mon, 17 Oct 2022 at 16:23, Heinrich Schuchardt  wrote:
>
> On 10/17/22 22:29, Simon Glass wrote:
> > Move this code into a separate function so that it can be used in the new
> > VBE menu.
> >
> > Signed-off-by: Simon Glass 
> > ---
> >
> >   common/menu.c  | 48 ++--
> >   include/menu.h | 10 ++
> >   2 files changed, 40 insertions(+), 18 deletions(-)
> >
> > diff --git a/common/menu.c b/common/menu.c
> > index c2e3ec592e3..4606cb7d1b1 100644
> > --- a/common/menu.c
> > +++ b/common/menu.c
> > @@ -483,26 +483,11 @@ enum bootmenu_key bootmenu_autoboot_loop(struct 
> > bootmenu_data *menu,
> >   return key;
> >   }
> >
> > -enum bootmenu_key bootmenu_loop(struct bootmenu_data *menu,
> > - struct cli_ch_state *cch)
> > +enum bootmenu_key bootmenu_conv_key(int ichar)
> >   {
>
> Please, extract a common library function from
> efi_cin_read_key_stroke_ex(). We should avoid code duplication.

No, that is EFI code. It also seems to use unicode somehow. We should
have EFI code using normal U-Boot functions, not duplicating
functionality elsewhere.

As you can see, my approach here is to refactor the common code to do
what is needed. Please update the EFI code to do the same.

Re unicode, we need to be very careful...what is the use case for
unicode keyboard input?

Regards,
SImon


Re: [PATCH 1/1] sandbox: make sandbox system reset configurable

2022-10-19 Thread Simon Glass
Hi Heinrich,

On Sun, 16 Oct 2022 at 01:27, Heinrich Schuchardt
 wrote:
>
> On 10/15/22 14:04, Michal Suchánek wrote:
> > Hello,
> >
> > On Sat, Oct 15, 2022 at 10:39:19AM +0200, Heinrich Schuchardt wrote:
> >> To test the watchdog system reset we need to disable the default sandbox
> >> system reset.
> >>
> >> The following settings provide the reset command via watchdog on the
> >> sandbox:
> >>
> >>  CONFIG_WDT_GPIO=n
> >>  CONFIG_WDT_SANDBOX=y
> >>  CONFIG_SYSRESET_SANDBOX=n
> >>  CONFIG_SYSRESET_WATCHDOG=y
> >>  CONFIG_SYSRESET_WATCHDOG_AUTO=y
> >
> > Woudn't it be better to make this runtime configurable?
>
> Devices can already be removed using the unbind command and added with
> the bind command again.
>
> You could get into the same state by
>
> * unbinding all sysreset devices and the GPIO watchdog device
> * binding the watchdog sysreset driver
>
> if CONFIG_SYSRESET_WATCHDOG_AUTO=y.
>
> As the watchdog sysreset driver does not support the poweroff command
> enabling CONFIG_SYSRESET_WATCHDOG=y by default is not a good choice.
>
> Actually testing the watchdog sysreset driver is beyond the scope of
> this patch.

Hmmm we don't want to disable it at build time...as Michal says it is
better to disable it at runtime, e.g. with a test flag. We do that in
quite a few cases at the start of tests, to get the behaviour needed
for the test.

Regards,
SImon


Re: [PATCH 07/24] menu: Use a switch statement

2022-10-19 Thread Simon Glass
Hi Heinrich,

On Mon, 17 Oct 2022 at 16:07, Heinrich Schuchardt  wrote:
>
> On 10/17/22 22:29, Simon Glass wrote:
> > Convert the long line of if() statements to a switch() since this makes
> > better use of the C language.
> >
> > Signed-off-by: Simon Glass 
> > ---
> >
> >   common/menu.c | 31 ---
> >   1 file changed, 20 insertions(+), 11 deletions(-)
> >
> > diff --git a/common/menu.c b/common/menu.c
> > index 22947f5d693..1aa78b762a4 100644
> > --- a/common/menu.c
> > +++ b/common/menu.c
> > @@ -543,22 +543,31 @@ enum bootmenu_key bootmenu_loop(struct bootmenu_data 
> > *menu, int *esc)
> >   break;
> >   }
> >
> > - /* enter key was pressed */
> > - if (c == '\r')
> > + switch (c) {
> > + case '\r':
> > + /* enter key was pressed */
> >   key = BKEY_SELECT;
> > -
> > - /* ^C was pressed */
> > - if (c == 0x3)
> > + break;
> > + case CTL_CH('c'):
> > + /* ^C was pressed */
> >   key = BKEY_QUIT;
> > -
> > - if (c == '+')
> > + break;
> > + case CTL_CH('p'):
> > + key = BKEY_UP;
> > + break;
> > + case CTL_CH('n'):
> > + key = BKEY_DOWN;
> > + break;
> > + case '+':
> >   key = BKEY_PLUS;
> > -
> > - if (c == '-')
> > + break;
> > + case '-':
> >   key = BKEY_MINUS;
> > -
> > - if (c == ' ')
> > + break;
> > + case ' ':
> >   key = BKEY_SPACE;
> > + break;
> > + }
>
> The whole code is not well suited to parse all of the many different
> escape sequences that can be sent to convey modifier keys or
> non-character keys (think of  or ).
>
> We should move the of logic of efi_cin_read_key_stroke_ex() to a library
> function which is used both by bootmenu and UEFI and remove duplicate code.

Sorry I am not about to put effort into the EFI code :-)

Also I did create a library to handle keystrokes. See cli_getch.c

Regards,
Simon


Re: [PATCH v2] spl: fit: Report fdt error for loading u-boot

2022-10-19 Thread Simon Glass
Hi,

On Mon, 17 Oct 2022 at 05:53, Su, Bao Cheng  wrote:
>
> Hi Simon,
>

+Tom Rini for guidance

> On Sat, 2022-07-30 at 19:27 -0600, Simon Glass wrote:
> > Hi Bao Cheng,
> >
> > On Sat, 30 Jul 2022 at 03:05, Su, Bao Cheng  wrote:
> > >
> > > Commit 71551055cbdb ("spl: fit: Load devicetree when a Linux payload is
> > > found") made a change to not report the spl_fit_append_fdt error at all
> > > if next-stage image is u-boot.
> > >
> > > However for u-boot image without CONFIG_OF_EMBED, the error should be
> > > reported to uplevel caller. Otherwise, uplevel caller would think the
> > > fdt is already loaded which is obviously not true.
> > >
> > > Signed-off-by: Baocheng Su 
> > > ---
> > >
> > > Changes in v2:
> > > - Fix the wrong wrapping
> > >
> > >  common/spl/spl_fit.c | 8 ++--
> > >  1 file changed, 6 insertions(+), 2 deletions(-)
> > >
> > > diff --git a/common/spl/spl_fit.c b/common/spl/spl_fit.c
> > > index a35be52965..00404935cb 100644
> > > --- a/common/spl/spl_fit.c
> > > +++ b/common/spl/spl_fit.c
> > > @@ -770,8 +770,12 @@ int spl_load_simple_fit(struct spl_image_info 
> > > *spl_image,
> > >  */
> > > if (os_takes_devicetree(spl_image->os)) {
> > > ret = spl_fit_append_fdt(spl_image, info, sector, &ctx);
> > > -   if (ret < 0 && spl_image->os != IH_OS_U_BOOT)
> > > -   return ret;
> > > +   if (ret < 0) {
> > > +   if (spl_image->os != IH_OS_U_BOOT)
> > > +   return ret;
> > > +   else if (!IS_ENABLED(CONFIG_OF_EMBED))
> > > +   return ret;
> >
> > This is a pretty unpleasant condition. I think we would be better to
> > report the error and let the caller figure it out.
> >
> > There are no tests associated with this, so it is hard to know what is
> > actually going on.
> >
> > If we must have this workaround, I suggest adding a Kconfig so boards
> > that need it can turn it on, and other boards can use normal
> > operation, which is to report errors.
> >
>
> Since there is no particular error code stands for such kind of
> scenario, it would be hard for the caller to determine which step has
> the problem.
>
> Or below code is more clear?
>
> if (os_takes_devicetree(spl_image->os)) {
> ret = spl_fit_append_fdt(spl_image, info, sector, &ctx);
> -   if (ret < 0 && spl_image->os != IH_OS_U_BOOT)
> -   return ret;
> +   if (ret < 0
> +&& (spl_image->os != IH_OS_U_BOOT
> +  || !IS_ENABLED(CONFIG_OF_EMBED)))
> +   return ret;
> }
>
> Actually there is already the `CONFIG_OF_EMBED` to tell them apart, see
> the previous logic before commit 71551055cbdb:
>
>  * Booting a next-stage U-Boot may require us to append the FDT.
>  * We allow this to fail, as the U-Boot image might embed its
> FDT.
>  */
> -   if (spl_image->os == IH_OS_U_BOOT) {
> +   if (os_takes_devicetree(spl_image->os)) {
> ret = spl_fit_append_fdt(spl_image, info, sector, &ctx);
> -   if (!IS_ENABLED(CONFIG_OF_EMBED) && ret < 0)
> +   if (ret < 0 && spl_image->os != IH_OS_U_BOOT)
> return ret;
> }
>
> So before the commit 71551055cbdb, the normal case would be to report
> the error, but the commit in question changed this to not report the
> error for normal spl to boot u-boot, only reports error for SPL to boot
> kernel, i.e. falcon mode.

We don't (or shouldn't) have boards which use OF_EMBED in mainline, so
that condition doesn't seem to make sense to me.

Perhaps Tom can decode all of this?

Regards,
Simon


Re: [PATCH 05/24] menu: Update bootmenu_autoboot_loop() to return the code

2022-10-19 Thread Simon Glass
Hi Heinrich,

On Mon, 17 Oct 2022 at 15:53, Heinrich Schuchardt  wrote:
>
> On 10/17/22 22:29, Simon Glass wrote:
> > Use the return value to save having to pass around a pointer. This also
> > resolves any ambiguity about what *key contains when the function is
> > called.
> >
> > Signed-off-by: Simon Glass 
> > ---
> >
> >   cmd/bootmenu.c |  2 +-
> >   common/menu.c  | 16 +---
> >   include/menu.h |  7 +++
> >   3 files changed, 13 insertions(+), 12 deletions(-)
> >
> > diff --git a/cmd/bootmenu.c b/cmd/bootmenu.c
> > index c80004c54dc..0e22f504fe4 100644
> > --- a/cmd/bootmenu.c
> > +++ b/cmd/bootmenu.c
> > @@ -93,7 +93,7 @@ static char *bootmenu_choice_entry(void *data)
>
> First of all this function should be moved to common/menu.c.
>
> >   while (1) {
> >   if (menu->delay >= 0) {
> >   /* Autoboot was not stopped */
> > - bootmenu_autoboot_loop(menu, &key, &esc);
> > + key = bootmenu_autoboot_loop(menu, &esc);
> >   } else {
> >   /* Some key was pressed, so autoboot was stopped */
> >   bootmenu_loop(menu, &key, &esc);
> > diff --git a/common/menu.c b/common/menu.c
> > index 087e4c246e2..bccc104a39b 100644
> > --- a/common/menu.c
> > +++ b/common/menu.c
> > @@ -425,9 +425,9 @@ int menu_destroy(struct menu *m)
> >   return 1;
> >   }
> >
> > -void bootmenu_autoboot_loop(struct bootmenu_data *menu,
> > - enum bootmenu_key *key, int *esc)
> > +enum bootmenu_key bootmenu_autoboot_loop(struct bootmenu_data *menu, int 
> > *esc)
> >   {
> > + enum bootmenu_key key = BKEY_NONE;
> >   int i, c;
> >
> >   while (menu->delay > 0) {
> > @@ -446,16 +446,16 @@ void bootmenu_autoboot_loop(struct bootmenu_data 
> > *menu,
> >   switch (c) {
> >   case '\e':
> >   *esc = 1;
> > - *key = BKEY_NONE;
> > + key = BKEY_NONE;
> >   break;
> >   case '\r':
> > - *key = BKEY_SELECT;
> > + key = BKEY_SELECT;
> >   break;
> >   case 0x3: /* ^C */
> > - *key = BKEY_QUIT;
> > + key = BKEY_QUIT;
> >   break;
> >   default:
> > - *key = BKEY_NONE;
> > + key = BKEY_NONE;
> >   break;
> >   }
> >
> > @@ -471,7 +471,9 @@ void bootmenu_autoboot_loop(struct bootmenu_data *menu,
> >   printf(ANSI_CURSOR_POSITION ANSI_CLEAR_LINE, menu->count + 5, 1);
> >
> >   if (menu->delay == 0)
> > - *key = BKEY_SELECT;
> > + key = BKEY_SELECT;
> > +
> > + return key;
> >   }
> >
> >   void bootmenu_loop(struct bootmenu_data *menu,
> > diff --git a/include/menu.h b/include/menu.h
> > index 29b457921e9..9f30a3c1acd 100644
> > --- a/include/menu.h
> > +++ b/include/menu.h
> > @@ -65,14 +65,13 @@ enum bootmenu_key {
> >* indicating that the current option should be chosen.
> >*
> >* @menu: Menu being processed
> > - * @key: Returns the code for the key the user pressed:
> > + * @esc: Set to 1 if the escape key is pressed, otherwise not updated
> > + * Returns: code for the key the user pressed:
> >*  enter: KEY_SELECT
> >*  Ctrl-C: KEY_QUIT
> >*  anything else: KEY_NONE
> > - * @esc: Set to 1 if the escape key is pressed, otherwise not updated
> >*/
> > -void bootmenu_autoboot_loop(struct bootmenu_data *menu,
> > - enum bootmenu_key *key, int *esc);
> > +enum bootmenu_key bootmenu_autoboot_loop(struct bootmenu_data *menu, int 
> > *esc);
>
> This function should not be exported.

Out of scope for this patch.

>
> enum bootmenu cannot accomomdate accelerator keys. The return type
> should be int.

What accelerator keys? I don't see how they work at present.

Regards,
Simon


Re: [PATCH v2] tests: Build correct sandbox configuration on 32bit

2022-10-19 Thread Simon Glass
Hi,

On Mon, 17 Oct 2022 at 01:28, Michal Suchánek  wrote:
>
> On Sat, Oct 15, 2022 at 10:27:43PM +0200, Heinrich Schuchardt wrote:
> > On 10/15/22 21:46, Simon Glass wrote:
> > > Hi Heinrich,
> > >
> > > On Sat, 15 Oct 2022 at 13:29, Heinrich Schuchardt  
> > > wrote:
> > > >
> > > >
> > > >
> > > > Am 15. Oktober 2022 21:24:36 MESZ schrieb Simon Glass 
> > > > :
> > > > > Hi Heinrich,
> > > > >
> > > > > On Sat, 15 Oct 2022 at 13:05, Heinrich Schuchardt 
> > > > >  wrote:
> > > > > >
> > > > > > On 10/15/22 20:39, Simon Glass wrote:
> > > > > > > Hi Heinrich,
> > > > > > >
> > > > > > > On Sat, 15 Oct 2022 at 12:31, Heinrich Schuchardt 
> > > > > > >  wrote:
> > > > > > > >
> > > > > > > > On 10/15/22 19:53, Simon Glass wrote:
> > > > > > > > > Hi Michal,
> > > > > > > > >
> > > > > > > > > On Fri, 14 Oct 2022 at 14:53, Michal Suchanek 
> > > > > > > > >  wrote:
> > > > > > > > > >
> > > > > > > > > > Currently sandbox configuration defautls to 64bit and there 
> > > > > > > > > > is no
> > > > > > > > > > automation for building 32bit sandbox on 32bit hosts.
> > > > > > > > > >
> > > > > > > > > > Use _LP64 macro as heuristic for detecting 64bit targets.
> > > > > > > > > >
> > > > > > > > > > Signed-off-by: Michal Suchanek 
> > > > > > > > > > ---
> > > > > > > > > >
> > > > > > > > > > Changes in v2:
> > > > > > > > > > simplify and move detection to kconfig
> > > > > > > > > >
> > > > > > > > > > ---
> > > > > > > > > > arch/sandbox/Kconfig| 18 +++---
> > > > > > > > > > scripts/Kconfig.include |  4 
> > > > > > > > > > 2 files changed, 7 insertions(+), 15 deletions(-)
> > > > > > > > >
> > > > > > > > > Reviewed-by: Simon Glass 
> > > > > > > > >
> > > > > > > > > My only question is whether we can allow building the 32-bit 
> > > > > > > > > version
> > > > > > > > > on a 64-bit machine? That would need a separate option I 
> > > > > > > > > think, to
> > > > > > > > > say:
> > > > > > > > >
> > > > > > > > > I don't want you to automatically determine HOST_32/64BIT. 
> > > > > > > > > Instead,
> > > > > > > > > use 32 (or 64).
> > > > > > > > >
> > > > > > > > > This is along the lines of what Heinrich is saying, except 
> > > > > > > > > that I
> > > > > > > > > strongly feel that we must do the right thing by default, as 
> > > > > > > > > your
> > > > > > > > > patch does.
> > > > > > > >
> > > > > > > > The whole point of phys_addr_t and phys_size_t is that it can 
> > > > > > > > be 64bit
> > > > > > > > or 32bit on ilp32.
> > > > > > > >
> > > > > > > > With this patch we cannot build with CONFIG_PHYS_64BIT=y on 
> > > > > > > > ilp32 and
> > > > > > > > that is bad.
> > > > > > > >
> > > > > > > > 32 bit phys_addr_t on lp64 is irrelevant for actual hardware 
> > > > > > > > but this is
> > > > > > > > what we currently test with sandbox_defconfig on Gitlab CI.
> > > > > > > >
> > > > > > > > My patch is ending up in the same behavior as Michal's patch 
> > > > > > > > except that
> > > > > > > > it allows to have 64bit phys_addr_t on ilp32.
> > > > > > >
> > > > > > > It needs to automatically default to 32 or 64 bit depending on the
> > > > > > > host. If the user wants to fiddle with Kconfig to force it to the
> > > > > > > other one, that should be possible to.
> > > > > > >
> > > > > > > It looks like your patch requires manual configuration, but 
> > > > > > > perhaps I
> > > > > > > just misunderstood it?
> > > > > >
> > > > > > __LP64__ is a symbol defined by the compiler when compiling for 
> > > > > > 64bit
> > > > > > and not defined when compiling for 32bit systems. There is nothing
> > > > > > manual about it.
> > > > > >
> > > > > > My patch uses this symbol to replace HOST_32BIT and HOST_64BIT.
> > > > > >
> > > > > > Michal's patch compiles a program tools/bits-per-long.c that ends up
> > > > > > returning 64 on 64 bit systems (where __LP64__ is defined) and 32 
> > > > > > on 32
> > > > > > bit systems (where __LP64__ is not defined) and then chooses 
> > > > > > HOST_32BIT
> > > > > > and HOST_64BIT accordingly. This part of Michal's patch is not 
> > > > > > wrong.
> > > > > > The solution is only overly complicated.
> > > > > >
> > > > > > What has to be chosen manually with both patches is PHYS_64BIT e.g. 
> > > > > > by
> > > > > > selecting sandbox64_defconfig instead of sandbox_defconfig.
> > > > > >
> > > > > > Unfortunately Michal did not understand that PHYS_64BIT=y, 
> > > > > > HOST_32BIT=y
> > > > > > is a necessary test scenario and introduced an invalid dependency.
> > > > > >
> > > > > > With my patch sandbox64_defconfig on a 32bit system uses 64bit 
> > > > > > phys_addr_t.
> > > > > >
> > > > > > With Michal's patch sandbox64_defconfig on a 32bit system uses 32bit
> > > > > > phys_addr_t.
> > > > >
> > > > > That's all great, thank you, but please can you address my actual 
> > > > > question?
> > > >
> > > > Your question in this thread was if my patch requires extra manual 
> > > > configuration compared to Michal's patch a

Re: [PATCH v3 6/6] test: add test for eficonfig secure boot key management

2022-10-19 Thread Simon Glass
iHi Heinrich,

On Fri, 14 Oct 2022 at 22:43, Heinrich Schuchardt  wrote:
>
> On 10/15/22 03:10, Simon Glass wrote:
> > Hi Ilias,
> >
> > On Fri, 14 Oct 2022 at 09:59, Ilias Apalodimas
> >  wrote:
> >>
> >> Hi Simon,
> >>
> >> On Fri, 14 Oct 2022 at 18:56, Simon Glass  wrote:
> >>>
> >>> Hi,
> >>>
> >>> On Fri, 14 Oct 2022 at 00:58, Masahisa Kojima
> >>>  wrote:
> 
>  Provide a unit test for the eficonfig secure boot key
>  management menu.
> 
>  Signed-off-by: Masahisa Kojima 
>  ---
>  No change since v2
> 
>  newly created in v2
> 
>    test/py/tests/test_eficonfig/conftest.py  |  84 +++-
>    test/py/tests/test_eficonfig/defs.py  |  14 +
>    .../test_eficonfig/test_eficonfig_sbkey.py| 472 ++
>    3 files changed, 568 insertions(+), 2 deletions(-)
>    create mode 100644 test/py/tests/test_eficonfig/defs.py
>    create mode 100644 test/py/tests/test_eficonfig/test_eficonfig_sbkey.py
> >>>
> >>> Please can this test be in C? Also, using down-arrow to select menus
> >>> is brittle. Add a function to select the one you want, e.g. by name.
> >>>
> >>
> >> Is there a very specific reason why we should do stuff like that in C?
> >
> > Yes, see here.
> >
> >>   Python is way easier to extend and test in our case.
> >
> > In what way? It seems a lot more complicated, plus the brittle nature
> > of this test suggests it will be a hassle to maintain.
> >
> > https://u-boot.readthedocs.io/en/latest/develop/tests_writing.html#python-or-c
> >
> > There is a pending update here too:
> >
> > https://patchwork.ozlabs.org/project/uboot/patch/20221013122927.636867-15-...@chromium.org/
>
> The discussion touches different aspects:
>
> ** What does it take to make a GUI easily testable? **
>
> Relying on cursor movement for testing is fragile. This is why GUIs
> often assign to each executable element the following:
>
> * Access key, e.g  
>A key combination that when entered will have the the same
>effect as selecting the GUI item
> * Access string, '@SAVE'
>A string that when typed into the command field will have
>the same effect as selecting the GUI item
>
> Let's look at U-Boot's menu entry definition:
>
> struct bootmenu_entry {
>  unsigned short int num;  // unique number 0 .. MAX_COUNT
>  char key[3]; // key identifier of number
>  char *title; // title of entry
>  char *command;   // hush command of entry
>  enum boot_type type; // boot type of entry
>  u16 bootorder;   // order for each boot type
>  struct bootmenu_data *menu;  // this bootmenu
>  struct bootmenu_entry *next; // next menu entry (num+1)
> }
>
> Our structure lacks an accessor element that can be used to select a
> menu item without using cursor actions.
>
> Compound keystrokes like  are send as multiple bytes on the
> console, e.g. 1b 5b 31 37 3b 35 7e.
>
> We may define a field shortcut of type char *. If the string is received
> by the menu loop, let it activate the matching menu entry. Let cursor
> actions (up, down, enter, space '+', '-') interrupt matching the
> shortcut string.
>
> Instead we could also use a convention for the title:
>
> If a letter in the title is preceded by '&', this is the shortcut key.
> This letter will be shown highlighted in the menu and the ampersand will
> not be shown.
>
> This is probably easier to implement.
>
> Adding the shortcut facility will allow both for easier testing and
> faster navigation.
>
> ** Choice of programming language **
>
> Several aspects control the choice of the programming language for tests:
>
> - Testing single library functions is only possible in C.
> - Checking contents of internal structures is only possible in C.
> - Testing the U-Boot's CLI is easily accessible in our Python framework.
> - Preparation of complex test data is easier to do in Python.
> - Mixed language tests should be avoided if not strictly necessary.
>It is much easier to maintain a single code source for a test.
>
> ** What to do for secure boot key management? **
>
> Secure boot key management requires complex preparation which fits well
> into out Python testing framework.
>
> Once we provide shortcut keys to U-Boot menus the entries will be easily
> accessible from Python.
>
> As we want to avoid complexity due to mixed language tests we should
> stick to Python for testing key management at the user level.

The test setup should be in Python (and needs to be) but the actual
test should be in C, in general.

>From what I can tell these tests should be split up, one for each test case.

Using keyboard shortcuts for menus would certainly help, but you still
have the dependency between the menu code in C and the Python code
that uses it. The complexity of this dependency is quite significant.

Can we not design this all for easier testing? The functionality
should be broken down a little more so we c

Re: imx patches pending

2022-10-19 Thread Frieder Schrempf
Hi Stefano,

On 19.10.22 09:56, Stefano Babic wrote:
> Hi Tim,
> 
> On 14.10.22 18:38, Tim Harvey wrote:
>> Stefano,
>>
>> With the merge window for v2023.01 closing in about a week (10/24),
>> can you please look at the pending patches for imx? I'm afraid you may
>> have some merge conflicts due to dt updates and we likely need time to
>> respond to any issues you may have.

I just want to emphasize what Tim already said. It looks like lots of
i.MX patches have accumulated over the last months and a lot of them fix
things that are currently broken in v2022.10 and master.

As no i.MX patches have been pulled for weeks it's now getting very
tight for those patches to hit v2023.01 which is not really a good
situation.

I know fixes can also be applied after the merge window has closed, but
in my case there are fixes for our board support that are part of larger
reworks and are difficult to separate from the non-fix-patches.

> I will try to sum them in next days and then post the PR to Tom.

It's really late and if any problems occur I likely won't be able to
respond before the merge window closes.

Anyway, I hope we can still sort this out somehow and thanks for your
efforts.

Frieder


Re: [PATCH v2] spl: fit: Report fdt error for loading u-boot

2022-10-19 Thread Mark Kettenis
> From: Simon Glass 
> Date: Wed, 19 Oct 2022 07:18:10 -0600
> 
> Hi,
> 
> On Mon, 17 Oct 2022 at 05:53, Su, Bao Cheng  wrote:
> >
> > Hi Simon,
> >
> 
> +Tom Rini for guidance
> 
> > On Sat, 2022-07-30 at 19:27 -0600, Simon Glass wrote:
> > > Hi Bao Cheng,
> > >
> > > On Sat, 30 Jul 2022 at 03:05, Su, Bao Cheng  
> > > wrote:
> > > >
> > > > Commit 71551055cbdb ("spl: fit: Load devicetree when a Linux payload is
> > > > found") made a change to not report the spl_fit_append_fdt error at all
> > > > if next-stage image is u-boot.
> > > >
> > > > However for u-boot image without CONFIG_OF_EMBED, the error should be
> > > > reported to uplevel caller. Otherwise, uplevel caller would think the
> > > > fdt is already loaded which is obviously not true.
> > > >
> > > > Signed-off-by: Baocheng Su 
> > > > ---
> > > >
> > > > Changes in v2:
> > > > - Fix the wrong wrapping
> > > >
> > > >  common/spl/spl_fit.c | 8 ++--
> > > >  1 file changed, 6 insertions(+), 2 deletions(-)
> > > >
> > > > diff --git a/common/spl/spl_fit.c b/common/spl/spl_fit.c
> > > > index a35be52965..00404935cb 100644
> > > > --- a/common/spl/spl_fit.c
> > > > +++ b/common/spl/spl_fit.c
> > > > @@ -770,8 +770,12 @@ int spl_load_simple_fit(struct spl_image_info 
> > > > *spl_image,
> > > >  */
> > > > if (os_takes_devicetree(spl_image->os)) {
> > > > ret = spl_fit_append_fdt(spl_image, info, sector, &ctx);
> > > > -   if (ret < 0 && spl_image->os != IH_OS_U_BOOT)
> > > > -   return ret;
> > > > +   if (ret < 0) {
> > > > +   if (spl_image->os != IH_OS_U_BOOT)
> > > > +   return ret;
> > > > +   else if (!IS_ENABLED(CONFIG_OF_EMBED))
> > > > +   return ret;
> > >
> > > This is a pretty unpleasant condition. I think we would be better to
> > > report the error and let the caller figure it out.
> > >
> > > There are no tests associated with this, so it is hard to know what is
> > > actually going on.
> > >
> > > If we must have this workaround, I suggest adding a Kconfig so boards
> > > that need it can turn it on, and other boards can use normal
> > > operation, which is to report errors.
> > >
> >
> > Since there is no particular error code stands for such kind of
> > scenario, it would be hard for the caller to determine which step has
> > the problem.
> >
> > Or below code is more clear?
> >
> > if (os_takes_devicetree(spl_image->os)) {
> > ret = spl_fit_append_fdt(spl_image, info, sector, &ctx);
> > -   if (ret < 0 && spl_image->os != IH_OS_U_BOOT)
> > -   return ret;
> > +   if (ret < 0
> > +&& (spl_image->os != IH_OS_U_BOOT
> > +  || !IS_ENABLED(CONFIG_OF_EMBED)))
> > +   return ret;
> > }
> >
> > Actually there is already the `CONFIG_OF_EMBED` to tell them apart, see
> > the previous logic before commit 71551055cbdb:
> >
> >  * Booting a next-stage U-Boot may require us to append the FDT.
> >  * We allow this to fail, as the U-Boot image might embed its
> > FDT.
> >  */
> > -   if (spl_image->os == IH_OS_U_BOOT) {
> > +   if (os_takes_devicetree(spl_image->os)) {
> > ret = spl_fit_append_fdt(spl_image, info, sector, &ctx);
> > -   if (!IS_ENABLED(CONFIG_OF_EMBED) && ret < 0)
> > +   if (ret < 0 && spl_image->os != IH_OS_U_BOOT)
> > return ret;
> > }
> >
> > So before the commit 71551055cbdb, the normal case would be to report
> > the error, but the commit in question changed this to not report the
> > error for normal spl to boot u-boot, only reports error for SPL to boot
> > kernel, i.e. falcon mode.
> 
> We don't (or shouldn't) have boards which use OF_EMBED in mainline, so
> that condition doesn't seem to make sense to me.

We have plenty of boards that set OF_EMBED, and as some of us have
pointed out to you more than once before, there are several valid use
cases for it.


Re: [PATCH v2 11/12] rockchip: lion-rk3368: migrate to u-boot-rockchip.bin

2022-10-19 Thread quentin . schulz

Hi Kever,

On 10/19/22 2:47 PM, Kever Yang  wrote:

Hi Quentin,

     This is report by the  denx ci system:

https://urldefense.proofpoint.com/v2/url?u=https-3A__source.denx.de_u-2Dboot_custodians_u-2Dboot-2Drockchip_-2D_jobs_515913&d=DwIDaQ&c=_sEr5x9kUWhuk4_nFwjJtA&r=LYjLexDn7rXIzVmkNPvw5ymA1XTSqHGq8yBP6m6qZZ4njZguQhZhkI_-172IIy1t&m=jlsoDVbl-1nmumJr2buEbP1CHgfZWWOLR9Xh-ycxj-II1AQbLWozSLgCKBSYz-3o&s=dMfyQSyv3NY0elXedC3GxMELp8oSMp8hCy5WZniPV2U&e=


I cannot see this page, probably a custodian account on that gitlab instance is 
required?


     And I can reproduce it with buildman sheep-rk3568



I can reproduce by building for sheep-3368_defconfig indeed.

CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR is not defined for this board and it is 
used in the lion dts.

Since the Lion dts is built for any RK3368-based board, it needs to be defined 
for all boards based on RK3368 which is not the case for the Sheep board.

Was it a deliberate choice to build all DTS from a specific SoC, whatever the 
board you're building for?

I would have imagined that using CONFIG_TARGET_LION_RK3368 instead of 
CONFIG_ROCKCHIP_RK3368 in arch/arm/dts/Makefile for deciding whether to build a 
device tree would make more sense?

For the time being, please just drop this patch, we don't really need it at the 
moment so I'll have a look on how to do this properly when I have time.

Thanks!
Quentin



Thanks,

- Kever

On 2022/10/19 20:11, Quentin Schulz wrote:
> Hi Kever,
>
> On 10/19/22 13:28, Kever Yang wrote:
>> Hi Quentin,
>>
>>  I got below error when apply this patch, could you help to check
>>
>> +Error: arch/arm/dts/rk3368-lion-haikou-u-boot.dtsi:44.16-17 syntax 
>> error

>> +FATAL ERROR: Unable to parse input tree
>> +make[3]: *** [arch/arm/dts/rk3368-lion-haikou.dtb] Error 1
>> +make[2]: *** [arch-dtbs] Error 2
>>
>
> Did you run make lion-rk3368_defconfig before trying to compile the DTS?
>
> I ran:
> ```
> git checkout 3724ddf157
> b4 shazam --add-link --add-my-sob 
> https://urldefense.proofpoint.com/v2/url?u=https-3A__lore.kernel.org_u-2Dboot_20220915091432.789294-2D1-2Dfoss-2Buboot-400leil.net_&d=DwIDaQ&c=_sEr5x9kUWhuk4_nFwjJtA&r=LYjLexDn7rXIzVmkNPvw5ymA1XTSqHGq8yBP6m6qZZ4njZguQhZhkI_-172IIy1t&m=jlsoDVbl-1nmumJr2buEbP1CHgfZWWOLR9Xh-ycxj-II1AQbLWozSLgCKBSYz-3o&s=lpPi8rny7_X2xST4eJ40go_Uv41ZYqpuCeU46CpJCz4&e= make CROSS_COMPILE="ccache aarch64-linux-gnu-" lion-rk3368_defconfig

> make CROSS_COMPILE="ccache aarch64-linux-gnu-" j`nproc`
> ```
> and it compiled without any problem.
>
> Cheers,
> Quentin



Re: [PATCH v2] spl: fit: Report fdt error for loading u-boot

2022-10-19 Thread Simon Glass
Hi Mark,

On Wed, 19 Oct 2022 at 08:08, Mark Kettenis  wrote:
>
> > From: Simon Glass 
> > Date: Wed, 19 Oct 2022 07:18:10 -0600
> >
> > Hi,
> >
> > On Mon, 17 Oct 2022 at 05:53, Su, Bao Cheng  wrote:
> > >
> > > Hi Simon,
> > >
> >
> > +Tom Rini for guidance
> >
> > > On Sat, 2022-07-30 at 19:27 -0600, Simon Glass wrote:
> > > > Hi Bao Cheng,
> > > >
> > > > On Sat, 30 Jul 2022 at 03:05, Su, Bao Cheng  
> > > > wrote:
> > > > >
> > > > > Commit 71551055cbdb ("spl: fit: Load devicetree when a Linux payload 
> > > > > is
> > > > > found") made a change to not report the spl_fit_append_fdt error at 
> > > > > all
> > > > > if next-stage image is u-boot.
> > > > >
> > > > > However for u-boot image without CONFIG_OF_EMBED, the error should be
> > > > > reported to uplevel caller. Otherwise, uplevel caller would think the
> > > > > fdt is already loaded which is obviously not true.
> > > > >
> > > > > Signed-off-by: Baocheng Su 
> > > > > ---
> > > > >
> > > > > Changes in v2:
> > > > > - Fix the wrong wrapping
> > > > >
> > > > >  common/spl/spl_fit.c | 8 ++--
> > > > >  1 file changed, 6 insertions(+), 2 deletions(-)
> > > > >
> > > > > diff --git a/common/spl/spl_fit.c b/common/spl/spl_fit.c
> > > > > index a35be52965..00404935cb 100644
> > > > > --- a/common/spl/spl_fit.c
> > > > > +++ b/common/spl/spl_fit.c
> > > > > @@ -770,8 +770,12 @@ int spl_load_simple_fit(struct spl_image_info 
> > > > > *spl_image,
> > > > >  */
> > > > > if (os_takes_devicetree(spl_image->os)) {
> > > > > ret = spl_fit_append_fdt(spl_image, info, sector, 
> > > > > &ctx);
> > > > > -   if (ret < 0 && spl_image->os != IH_OS_U_BOOT)
> > > > > -   return ret;
> > > > > +   if (ret < 0) {
> > > > > +   if (spl_image->os != IH_OS_U_BOOT)
> > > > > +   return ret;
> > > > > +   else if (!IS_ENABLED(CONFIG_OF_EMBED))
> > > > > +   return ret;
> > > >
> > > > This is a pretty unpleasant condition. I think we would be better to
> > > > report the error and let the caller figure it out.
> > > >
> > > > There are no tests associated with this, so it is hard to know what is
> > > > actually going on.
> > > >
> > > > If we must have this workaround, I suggest adding a Kconfig so boards
> > > > that need it can turn it on, and other boards can use normal
> > > > operation, which is to report errors.
> > > >
> > >
> > > Since there is no particular error code stands for such kind of
> > > scenario, it would be hard for the caller to determine which step has
> > > the problem.
> > >
> > > Or below code is more clear?
> > >
> > > if (os_takes_devicetree(spl_image->os)) {
> > > ret = spl_fit_append_fdt(spl_image, info, sector, &ctx);
> > > -   if (ret < 0 && spl_image->os != IH_OS_U_BOOT)
> > > -   return ret;
> > > +   if (ret < 0
> > > +&& (spl_image->os != IH_OS_U_BOOT
> > > +  || !IS_ENABLED(CONFIG_OF_EMBED)))
> > > +   return ret;
> > > }
> > >
> > > Actually there is already the `CONFIG_OF_EMBED` to tell them apart, see
> > > the previous logic before commit 71551055cbdb:
> > >
> > >  * Booting a next-stage U-Boot may require us to append the FDT.
> > >  * We allow this to fail, as the U-Boot image might embed its
> > > FDT.
> > >  */
> > > -   if (spl_image->os == IH_OS_U_BOOT) {
> > > +   if (os_takes_devicetree(spl_image->os)) {
> > > ret = spl_fit_append_fdt(spl_image, info, sector, &ctx);
> > > -   if (!IS_ENABLED(CONFIG_OF_EMBED) && ret < 0)
> > > +   if (ret < 0 && spl_image->os != IH_OS_U_BOOT)
> > > return ret;
> > > }
> > >
> > > So before the commit 71551055cbdb, the normal case would be to report
> > > the error, but the commit in question changed this to not report the
> > > error for normal spl to boot u-boot, only reports error for SPL to boot
> > > kernel, i.e. falcon mode.
> >
> > We don't (or shouldn't) have boards which use OF_EMBED in mainline, so
> > that condition doesn't seem to make sense to me.
>
> We have plenty of boards that set OF_EMBED, and as some of us have
> pointed out to you more than once before, there are several valid use
> cases for it.

Can you point me to the discussion about the valid use cases?

Regards,
Simon


[PATCH 0/4] Update Microchip PolarFire SoC

2022-10-19 Thread Padmarao Begari
This patch set updates Microchip PolarFire SoC Icicle Kit support
of RISC-V U-Boot.

The patches are based upon latest U-Boot tree
(https://source.denx.de/u-boot/u-boot) at commit id
3724ddf157aab3bd009c1da234b9a1af1621b544

The memory device node is updated in the device tree based on
the latest FPGA reference design and a small 4MB reservation is
made at the end of 32-bit DDR to provide some memory for the HSS
to use, add Microchip QSPI driver.

Padmarao Begari (4):
  riscv: dts: update memory configuration
  riscv: dts: Add QSPI NAND device node
  riscv: Update Microchip MPFS Icicle Kit support
  spi: Add Microchip PolarFire SoC QSPI driver

 arch/riscv/dts/microchip-mpfs-icicle-kit.dts |  85 ++--
 board/microchip/mpfs_icicle/Kconfig  |   7 +
 configs/microchip_mpfs_icicle_defconfig  |   1 +
 drivers/spi/Kconfig  |   6 +
 drivers/spi/Makefile |   1 +
 drivers/spi/microchip_qspi.c | 504 +++
 6 files changed, 548 insertions(+), 56 deletions(-)
 create mode 100644 drivers/spi/microchip_qspi.c

-- 
2.25.1



[PATCH 1/4] riscv: dts: update memory configuration

2022-10-19 Thread Padmarao Begari
In the v2022.10 Icicle reference design, the seg registers are going to be
changed, resulting in a required change to the memory map.
A small 4MB reservation is made at the end of 32-bit DDR to provide some
memory for the HSS to use, so that it can cache its payload between
reboots of a specific context.

Signed-off-by: Padmarao Begari 
Signed-off-by: Conor Dooley 
---
 arch/riscv/dts/microchip-mpfs-icicle-kit.dts | 70 
 1 file changed, 14 insertions(+), 56 deletions(-)

diff --git a/arch/riscv/dts/microchip-mpfs-icicle-kit.dts 
b/arch/riscv/dts/microchip-mpfs-icicle-kit.dts
index 287ef3d23b..876c475069 100644
--- a/arch/riscv/dts/microchip-mpfs-icicle-kit.dts
+++ b/arch/riscv/dts/microchip-mpfs-icicle-kit.dts
@@ -1,6 +1,6 @@
 // SPDX-License-Identifier: (GPL-2.0+ OR MIT)
 /*
- * Copyright (C) 2021 Microchip Technology Inc.
+ * Copyright (C) 2021-2022 Microchip Technology Inc.
  * Padmarao Begari 
  */
 
@@ -28,70 +28,28 @@
timebase-frequency = ;
};
 
-   reserved-memory {
-   ranges;
-   #size-cells = <2>;
-   #address-cells = <2>;
-
-   fabricbuf0: fabricbuf@0 {
-   compatible = "shared-dma-pool";
-   reg = <0x0 0xae00 0x0 0x200>;
-   label = "fabricbuf0-ddr-c";
-   };
-
-   fabricbuf1: fabricbuf@1 {
-   compatible = "shared-dma-pool";
-   reg = <0x0 0xc000 0x0 0x800>;
-   label = "fabricbuf1-ddr-nc";
-   };
-
-   fabricbuf2: fabricbuf@2 {
-   compatible = "shared-dma-pool";
-   reg = <0x0 0xd800 0x0 0x800>;
-   label = "fabricbuf2-ddr-nc-wcb";
-   };
-   };
-
-   udmabuf0 {
-   compatible = "ikwzm,u-dma-buf";
-   device-name = "udmabuf-ddr-c0";
-   minor-number = <0>;
-   size = <0x0 0x200>;
-   memory-region = <&fabricbuf0>;
-   sync-mode = <3>;
-   };
-
-   udmabuf1 {
-   compatible = "ikwzm,u-dma-buf";
-   device-name = "udmabuf-ddr-nc0";
-   minor-number = <1>;
-   size = <0x0 0x800>;
-   memory-region = <&fabricbuf1>;
-   sync-mode = <3>;
-   };
-
-   udmabuf2 {
-   compatible = "ikwzm,u-dma-buf";
-   device-name = "udmabuf-ddr-nc-wcb0";
-   minor-number = <2>;
-   size = <0x0 0x800>;
-   memory-region = <&fabricbuf2>;
-   sync-mode = <3>;
-   };
-
ddrc_cache_lo: memory@8000 {
device_type = "memory";
-   reg = <0x0 0x8000 0x0 0x2e00>;
-   clocks = <&clkcfg CLK_DDRC>;
+   reg = <0x0 0x8000 0x0 0x4000>;
status = "okay";
};
 
ddrc_cache_hi: memory@10 {
device_type = "memory";
-   reg = <0x10 0x0 0x0 0x4000>;
-   clocks = <&clkcfg CLK_DDRC>;
+   reg = <0x10 0x4000 0x0 0x4000>;
status = "okay";
};
+
+   reserved-memory {
+   #address-cells = <2>;
+   #size-cells = <2>;
+   ranges;
+
+   hss_payload: region@BFC0 {
+   reg = <0x0 0xBFC0 0x0 0x40>;
+   no-map;
+   };
+   };
 };
 
 &uart1 {
-- 
2.25.1



[PATCH 2/4] riscv: dts: Add QSPI NAND device node

2022-10-19 Thread Padmarao Begari
Add QSPI NAND device node to the Microchip PolarFire SoC
Icicle kit device tree

Signed-off-by: Padmarao Begari 
---
 arch/riscv/dts/microchip-mpfs-icicle-kit.dts | 15 +++
 1 file changed, 15 insertions(+)

diff --git a/arch/riscv/dts/microchip-mpfs-icicle-kit.dts 
b/arch/riscv/dts/microchip-mpfs-icicle-kit.dts
index 876c475069..679221e13f 100644
--- a/arch/riscv/dts/microchip-mpfs-icicle-kit.dts
+++ b/arch/riscv/dts/microchip-mpfs-icicle-kit.dts
@@ -18,6 +18,7 @@
aliases {
serial1 = &uart1;
ethernet0 = &mac1;
+   spi0 = &qspi;
};
 
chosen {
@@ -113,3 +114,17 @@
ti,fifo-depth = <0x1>;
};
 };
+
+&qspi {
+   status = "okay";
+   num-cs = <1>;
+   flash0: spi-nand@0 {
+   compatible = "spi-nand";
+   reg = <0x0>;
+   spi-tx-bus-width = <4>;
+   spi-rx-bus-width = <4>;
+   spi-max-frequency = <2000>;
+   spi-cpol;
+   spi-cpha;
+   };
+};
-- 
2.25.1



[PATCH 3/4] riscv: Update Microchip MPFS Icicle Kit support

2022-10-19 Thread Padmarao Begari
This patch updates Microchip MPFS Icicle Kit support. For now,
add Microchip QSPI driver and a small 4MB reservation is
made at the end of 32-bit DDR to provide some memory for
the HSS to use.

Signed-off-by: Padmarao Begari 
---
 board/microchip/mpfs_icicle/Kconfig | 7 +++
 configs/microchip_mpfs_icicle_defconfig | 1 +
 2 files changed, 8 insertions(+)

diff --git a/board/microchip/mpfs_icicle/Kconfig 
b/board/microchip/mpfs_icicle/Kconfig
index 092e411215..230f96b033 100644
--- a/board/microchip/mpfs_icicle/Kconfig
+++ b/board/microchip/mpfs_icicle/Kconfig
@@ -50,5 +50,12 @@ config BOARD_SPECIFIC_OPTIONS # dummy
imply CMD_I2C
imply DM_I2C
imply SYS_I2C_MICROCHIP
+   imply SPI
+   imply DM_SPI
+   imply MICROCHIP_QSPI
+   imply MTD_SPI_NAND
+   imply CMD_MTD
+   imply MTD_PARTITIONS
+   imply CMD_MTDPARTS
 
 endif
diff --git a/configs/microchip_mpfs_icicle_defconfig 
b/configs/microchip_mpfs_icicle_defconfig
index 6113c5be80..c295b9bad3 100644
--- a/configs/microchip_mpfs_icicle_defconfig
+++ b/configs/microchip_mpfs_icicle_defconfig
@@ -17,6 +17,7 @@ CONFIG_DISPLAY_BOARDINFO=y
 CONFIG_SYS_CBSIZE=256
 CONFIG_SYS_PBSIZE=282
 CONFIG_SYS_BOOTM_LEN=0x400
+CONFIG_SYS_MEM_TOP_HIDE=0x40
 CONFIG_SYS_RELOC_GD_ENV_ADDR=y
 CONFIG_BOOTP_SEND_HOSTNAME=y
 CONFIG_DM_MTD=y
-- 
2.25.1



[PATCH 4/4] spi: Add Microchip PolarFire SoC QSPI driver

2022-10-19 Thread Padmarao Begari
Add QSPI driver code for the Microchip PolarFire SoC.
This driver supports the qspi standard, dual and quad
mode interfaces.

Signed-off-by: Padmarao Begari 
Signed-off-by: Naga Sureshkumar Relli 
---
 drivers/spi/Kconfig  |   6 +
 drivers/spi/Makefile |   1 +
 drivers/spi/microchip_qspi.c | 504 +++
 3 files changed, 511 insertions(+)
 create mode 100644 drivers/spi/microchip_qspi.c

diff --git a/drivers/spi/Kconfig b/drivers/spi/Kconfig
index 2f12081f88..690306309a 100644
--- a/drivers/spi/Kconfig
+++ b/drivers/spi/Kconfig
@@ -237,6 +237,12 @@ config MESON_SPIFC
  This driver can be used to access the SPI NOR flash chips on
  Amlogic Meson SoCs.
 
+config MICROCHIP_QSPI
+   bool "Microchip Quad SPI driver"
+   help
+ Enable the Microchip Quad SPI controller driver. This driver can be
+ used on Polarfire SoCs.
+
 config MPC8XX_SPI
bool "MPC8XX SPI Driver"
depends on MPC8xx
diff --git a/drivers/spi/Makefile b/drivers/spi/Makefile
index 50ba43550b..010855ae1d 100644
--- a/drivers/spi/Makefile
+++ b/drivers/spi/Makefile
@@ -40,6 +40,7 @@ obj-$(CONFIG_ICH_SPI) +=  ich.o
 obj-$(CONFIG_IPROC_QSPI) += iproc_qspi.o
 obj-$(CONFIG_KIRKWOOD_SPI) += kirkwood_spi.o
 obj-$(CONFIG_MESON_SPIFC) += meson_spifc.o
+obj-$(CONFIG_MICROCHIP_QSPI) += microchip_qspi.o
 obj-$(CONFIG_MPC8XX_SPI) += mpc8xx_spi.o
 obj-$(CONFIG_MPC8XXX_SPI) += mpc8xxx_spi.o
 obj-$(CONFIG_MTK_SNFI_SPI) += mtk_snfi_spi.o
diff --git a/drivers/spi/microchip_qspi.c b/drivers/spi/microchip_qspi.c
new file mode 100644
index 00..2c803f6d2f
--- /dev/null
+++ b/drivers/spi/microchip_qspi.c
@@ -0,0 +1,504 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright (C) 2022 Microchip Technology Inc.
+ * Padmarao Begari 
+ * Naga Sureshkumar Relli 
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+DECLARE_GLOBAL_DATA_PTR;
+
+/*
+ * QSPI Control register mask defines
+ */
+#define CONTROL_ENABLE BIT(0)
+#define CONTROL_MASTER BIT(1)
+#define CONTROL_XIPBIT(2)
+#define CONTROL_XIPADDRBIT(3)
+#define CONTROL_CLKIDLEBIT(10)
+#define CONTROL_SAMPLE_MASKGENMASK(12, 11)
+#define CONTROL_MODE0  BIT(13)
+#define CONTROL_MODE12_MASKGENMASK(15, 14)
+#define CONTROL_MODE12_EX_RO   BIT(14)
+#define CONTROL_MODE12_EX_RW   BIT(15)
+#define CONTROL_MODE12_FULLGENMASK(15, 14)
+#define CONTROL_FLAGSX4BIT(16)
+#define CONTROL_CLKRATE_MASK   GENMASK(27, 24)
+#define CONTROL_CLKRATE_SHIFT  24
+
+/*
+ * QSPI Frames register mask defines
+ */
+#define FRAMES_TOTALBYTES_MASK GENMASK(15, 0)
+#define FRAMES_CMDBYTES_MASK   GENMASK(24, 16)
+#define FRAMES_CMDBYTES_SHIFT  16
+#define FRAMES_SHIFT   25
+#define FRAMES_IDLE_MASK   GENMASK(29, 26)
+#define FRAMES_IDLE_SHIFT  26
+#define FRAMES_FLAGBYTEBIT(30)
+#define FRAMES_FLAGWORDBIT(31)
+
+/*
+ * QSPI Interrupt Enable register mask defines
+ */
+#define IEN_TXDONE BIT(0)
+#define IEN_RXDONE BIT(1)
+#define IEN_RXAVAILABLEBIT(2)
+#define IEN_TXAVAILABLEBIT(3)
+#define IEN_RXFIFOEMPTYBIT(4)
+#define IEN_TXFIFOFULL BIT(5)
+
+/*
+ * QSPI Status register mask defines
+ */
+#define STATUS_TXDONE  BIT(0)
+#define STATUS_RXDONE  BIT(1)
+#define STATUS_RXAVAILABLE BIT(2)
+#define STATUS_TXAVAILABLE BIT(3)
+#define STATUS_RXFIFOEMPTY BIT(4)
+#define STATUS_TXFIFOFULL  BIT(5)
+#define STATUS_READY   BIT(7)
+#define STATUS_FLAGSX4 BIT(8)
+#define STATUS_MASKGENMASK(8, 0)
+
+#define BYTESUPPER_MASKGENMASK(31, 16)
+#define BYTESLOWER_MASKGENMASK(15, 0)
+
+#define MAX_DIVIDER16
+#define MIN_DIVIDER0
+#define MAX_DATA_CMD_LEN   256
+
+/* QSPI ready time out value */
+#define TIMEOUT_MS (1000 * 60)
+
+/*
+ * QSPI Register offsets.
+ */
+#define REG_CONTROL(0x00)
+#define REG_FRAMES (0x04)
+#define REG_IEN(0x0c)
+#define REG_STATUS (0x10)
+#define REG_DIRECT_ACCESS  (0x14)
+#define REG_UPPER_ACCESS   (0x18)
+#define REG_RX_DATA(0x40)
+#define REG_TX_DATA(0x44)
+#define REG_X4_RX_DATA (0x48)
+#define REG_X4_TX_DATA (0x4c)
+#define REG_FRAMESUP   (0x50)
+
+/**
+ * struct mchp_coreqspi - Defines qspi driver instance
+ * @regs:  Address of the QSPI controller registers
+ * @freq:  QSPI Input frequency
+ * @txbuf: TX buffer
+ * @rxbuf: RX buffer
+ * @tx_len:Number of bytes left to transfer
+ * @rx_len:Number of bytes left to receive
+ */
+struct mchp_coreqspi {
+   void __iomem *regs;
+   u32 freq;
+   u8 *txbuf;
+   u8 *rxbuf;
+   int tx_len;
+   int rx_len;
+};
+
+static void mchp_coreqspi_i

Re: [PATCH 4/4] spi: Add Microchip PolarFire SoC QSPI driver

2022-10-19 Thread Tudor.Ambarus
Hi!

On 10/19/22 17:53, Padmarao Begari wrote:
>  drivers/spi/microchip_qspi.c | 504 +++

The name is too generic, there are multiple QSPI IPs inside mchp.
I would suggest to create an mchp directory and rename your c file to
maybe something like mpfs-qspi?


-- 
Cheers,
ta



Re: [PATCH 2/4] riscv: dts: Add QSPI NAND device node

2022-10-19 Thread Tudor.Ambarus
On 10/19/22 17:53, Padmarao Begari wrote:
> +   flash0: spi-nand@0 {

the node should have generic name according to the dt specification,
so please s/spi-nand/flash.

-- 
Cheers,
ta



Re: [PATCH 4/4] spi: Add Microchip PolarFire SoC QSPI driver

2022-10-19 Thread Conor Dooley
On Wed, Oct 19, 2022 at 03:16:01PM +, tudor.amba...@microchip.com wrote:
> Hi!
> 
> On 10/19/22 17:53, Padmarao Begari wrote:
> >  drivers/spi/microchip_qspi.c | 504 +++
> 
> The name is too generic, there are multiple QSPI IPs inside mchp.
> I would suggest to create an mchp directory and rename your c file to
> maybe something like mpfs-qspi?

The (linux) driver works for both the "hard" peripheral on mpfs & for
the core in FPGA fabric. I would wouldn't mind copying the linux naming
and using "microchip-corespi" & "microchip-coreqspi" as the underlying
IPs are called CoreSPI and CoreQSPI respectively.



Re: [PATCH 1/4] riscv: dts: update memory configuration

2022-10-19 Thread Conor Dooley
On Wed, Oct 19, 2022 at 08:23:19PM +0530, Padmarao Begari wrote:
> In the v2022.10 Icicle reference design, the seg registers are going to be
> changed, resulting in a required change to the memory map.
> A small 4MB reservation is made at the end of 32-bit DDR to provide some
> memory for the HSS to use, so that it can cache its payload between
> reboots of a specific context.
> 
> Signed-off-by: Padmarao Begari 
> Signed-off-by: Conor Dooley 

Hmm, not sure that my SoB here is correct. If you took my patch
directly, then you should change the patch so that I am the author or
otherwise I think it should be:
Co-developed-by: Conor Dooley 
Signed-off-by: Conor Dooley 
Signed-off-by: Padmarao Begari 

I assume that it is the same for the QSPI driver?
Otherwise, LGTM:
Reviewed-by: Conor Dooley 

Thanks,
Conor.
> ---
>  arch/riscv/dts/microchip-mpfs-icicle-kit.dts | 70 
>  1 file changed, 14 insertions(+), 56 deletions(-)
> 
> diff --git a/arch/riscv/dts/microchip-mpfs-icicle-kit.dts 
> b/arch/riscv/dts/microchip-mpfs-icicle-kit.dts
> index 287ef3d23b..876c475069 100644
> --- a/arch/riscv/dts/microchip-mpfs-icicle-kit.dts
> +++ b/arch/riscv/dts/microchip-mpfs-icicle-kit.dts
> @@ -1,6 +1,6 @@
>  // SPDX-License-Identifier: (GPL-2.0+ OR MIT)
>  /*
> - * Copyright (C) 2021 Microchip Technology Inc.
> + * Copyright (C) 2021-2022 Microchip Technology Inc.
>   * Padmarao Begari 
>   */
>  
> @@ -28,70 +28,28 @@
>   timebase-frequency = ;
>   };
>  
> - reserved-memory {
> - ranges;
> - #size-cells = <2>;
> - #address-cells = <2>;
> -
> - fabricbuf0: fabricbuf@0 {
> - compatible = "shared-dma-pool";
> - reg = <0x0 0xae00 0x0 0x200>;
> - label = "fabricbuf0-ddr-c";
> - };
> -
> - fabricbuf1: fabricbuf@1 {
> - compatible = "shared-dma-pool";
> - reg = <0x0 0xc000 0x0 0x800>;
> - label = "fabricbuf1-ddr-nc";
> - };
> -
> - fabricbuf2: fabricbuf@2 {
> - compatible = "shared-dma-pool";
> - reg = <0x0 0xd800 0x0 0x800>;
> - label = "fabricbuf2-ddr-nc-wcb";
> - };
> - };
> -
> - udmabuf0 {
> - compatible = "ikwzm,u-dma-buf";
> - device-name = "udmabuf-ddr-c0";
> - minor-number = <0>;
> - size = <0x0 0x200>;
> - memory-region = <&fabricbuf0>;
> - sync-mode = <3>;
> - };
> -
> - udmabuf1 {
> - compatible = "ikwzm,u-dma-buf";
> - device-name = "udmabuf-ddr-nc0";
> - minor-number = <1>;
> - size = <0x0 0x800>;
> - memory-region = <&fabricbuf1>;
> - sync-mode = <3>;
> - };
> -
> - udmabuf2 {
> - compatible = "ikwzm,u-dma-buf";
> - device-name = "udmabuf-ddr-nc-wcb0";
> - minor-number = <2>;
> - size = <0x0 0x800>;
> - memory-region = <&fabricbuf2>;
> - sync-mode = <3>;
> - };
> -
>   ddrc_cache_lo: memory@8000 {
>   device_type = "memory";
> - reg = <0x0 0x8000 0x0 0x2e00>;
> - clocks = <&clkcfg CLK_DDRC>;
> + reg = <0x0 0x8000 0x0 0x4000>;
>   status = "okay";
>   };
>  
>   ddrc_cache_hi: memory@10 {
>   device_type = "memory";
> - reg = <0x10 0x0 0x0 0x4000>;
> - clocks = <&clkcfg CLK_DDRC>;
> + reg = <0x10 0x4000 0x0 0x4000>;
>   status = "okay";
>   };
> +
> + reserved-memory {
> + #address-cells = <2>;
> + #size-cells = <2>;
> + ranges;
> +
> + hss_payload: region@BFC0 {
> + reg = <0x0 0xBFC0 0x0 0x40>;
> + no-map;
> + };
> + };
>  };
>  
>  &uart1 {
> -- 
> 2.25.1
> 


Re: [PATCH 2/4] riscv: dts: Add QSPI NAND device node

2022-10-19 Thread Conor Dooley
On Wed, Oct 19, 2022 at 08:23:20PM +0530, Padmarao Begari wrote:

> riscv: dts: Add QSPI NAND device node

I didn't notice this on 1/3, but I think we need to mention which board
that this is being added for in the shortlog.
Thanks,
Conor.

> Add QSPI NAND device node to the Microchip PolarFire SoC
> Icicle kit device tree
> 
> Signed-off-by: Padmarao Begari 
> ---
>  arch/riscv/dts/microchip-mpfs-icicle-kit.dts | 15 +++
>  1 file changed, 15 insertions(+)
> 
> diff --git a/arch/riscv/dts/microchip-mpfs-icicle-kit.dts 
> b/arch/riscv/dts/microchip-mpfs-icicle-kit.dts
> index 876c475069..679221e13f 100644
> --- a/arch/riscv/dts/microchip-mpfs-icicle-kit.dts
> +++ b/arch/riscv/dts/microchip-mpfs-icicle-kit.dts
> @@ -18,6 +18,7 @@
>   aliases {
>   serial1 = &uart1;
>   ethernet0 = &mac1;
> + spi0 = &qspi;
>   };
>  
>   chosen {
> @@ -113,3 +114,17 @@
>   ti,fifo-depth = <0x1>;
>   };
>  };
> +
> +&qspi {
> + status = "okay";
> + num-cs = <1>;
> + flash0: spi-nand@0 {
> + compatible = "spi-nand";
> + reg = <0x0>;
> + spi-tx-bus-width = <4>;
> + spi-rx-bus-width = <4>;
> + spi-max-frequency = <2000>;
> + spi-cpol;
> + spi-cpha;
> + };
> +};
> -- 
> 2.25.1
> 


Re: [PATCH 3/4] riscv: Update Microchip MPFS Icicle Kit support

2022-10-19 Thread Conor Dooley
On Wed, Oct 19, 2022 at 08:23:21PM +0530, Padmarao Begari wrote:
> This patch updates Microchip MPFS Icicle Kit support. For now,
> add Microchip QSPI driver and a small 4MB reservation is
> made at the end of 32-bit DDR to provide some memory for
> the HSS to use.
> 
> Signed-off-by: Padmarao Begari 
> ---
>  board/microchip/mpfs_icicle/Kconfig | 7 +++
>  configs/microchip_mpfs_icicle_defconfig | 1 +
>  2 files changed, 8 insertions(+)
> 
> diff --git a/board/microchip/mpfs_icicle/Kconfig 
> b/board/microchip/mpfs_icicle/Kconfig
> index 092e411215..230f96b033 100644
> --- a/board/microchip/mpfs_icicle/Kconfig
> +++ b/board/microchip/mpfs_icicle/Kconfig
> @@ -50,5 +50,12 @@ config BOARD_SPECIFIC_OPTIONS # dummy
>   imply CMD_I2C
>   imply DM_I2C
>   imply SYS_I2C_MICROCHIP
> + imply SPI
> + imply DM_SPI
> + imply MICROCHIP_QSPI
> + imply MTD_SPI_NAND
> + imply CMD_MTD
> + imply MTD_PARTITIONS
> + imply CMD_MTDPARTS
>  
>  endif
> diff --git a/configs/microchip_mpfs_icicle_defconfig 
> b/configs/microchip_mpfs_icicle_defconfig
> index 6113c5be80..c295b9bad3 100644
> --- a/configs/microchip_mpfs_icicle_defconfig
> +++ b/configs/microchip_mpfs_icicle_defconfig
> @@ -17,6 +17,7 @@ CONFIG_DISPLAY_BOARDINFO=y
>  CONFIG_SYS_CBSIZE=256
>  CONFIG_SYS_PBSIZE=282
>  CONFIG_SYS_BOOTM_LEN=0x400
> +CONFIG_SYS_MEM_TOP_HIDE=0x40

Ah cool, I'd done my patch for our stuff against v2022.01 and this IIRC
was not a "real" config option then. Nice to see that it got "promoted"
to a kconfig option :)
Stuff here LGTM so:
Reviewed-by: Conor Dooley 
Thanks,
Conor.

>  CONFIG_SYS_RELOC_GD_ENV_ADDR=y
>  CONFIG_BOOTP_SEND_HOSTNAME=y
>  CONFIG_DM_MTD=y
> -- 
> 2.25.1
> 


Re: [PATCH 4/4] spi: Add Microchip PolarFire SoC QSPI driver

2022-10-19 Thread Conor Dooley
On Wed, Oct 19, 2022 at 08:23:22PM +0530, Padmarao Begari wrote:
> Add QSPI driver code for the Microchip PolarFire SoC.
> This driver supports the qspi standard, dual and quad
> mode interfaces.
> 
> Signed-off-by: Padmarao Begari 
> Signed-off-by: Naga Sureshkumar Relli 
> ---
>  drivers/spi/Kconfig  |   6 +
>  drivers/spi/Makefile |   1 +
>  drivers/spi/microchip_qspi.c | 504 +++
>  3 files changed, 511 insertions(+)
>  create mode 100644 drivers/spi/microchip_qspi.c
> 
> diff --git a/drivers/spi/Kconfig b/drivers/spi/Kconfig
> index 2f12081f88..690306309a 100644
> --- a/drivers/spi/Kconfig
> +++ b/drivers/spi/Kconfig
> @@ -237,6 +237,12 @@ config MESON_SPIFC
> This driver can be used to access the SPI NOR flash chips on
> Amlogic Meson SoCs.
>  
> +config MICROCHIP_QSPI

Can this be MICROCHIP_COREQSPI to match my proposed name of the driver
and the function/structure names in the driver?

> diff --git a/drivers/spi/Makefile b/drivers/spi/Makefile
> +
> +static const struct udevice_id mchp_coreqspi_ids[] = {
> + { .compatible = "microchip,mpfs-qspi" },

Could we add microchip,coreqspi-rtl-v2 to the compatible list here
please to match the linux driver? The linux driver works perfectly well
with the fabric core and I assume that's the case for the the U-Boot
driver too?

Thanks,
Conor.

> + { }
> +};
> +
> +U_BOOT_DRIVER(mchp_coreqspi) = {
> + .name   = "mchp_coreqspi",
> + .id = UCLASS_SPI,
> + .of_match = mchp_coreqspi_ids,
> + .ops= &mchp_coreqspi_ops,
> + .priv_auto = sizeof(struct mchp_coreqspi),
> + .probe  = mchp_coreqspi_probe,
> +};
> -- 
> 2.25.1
> 


Re: [PATCH] Makefile: fix u-boot-initial-env target if lto is enabled

2022-10-19 Thread Pali Rohár
On Wednesday 19 October 2022 14:59:49 Max Krummenacher wrote:
> Hi Tom
> 
> On Tue, Oct 18, 2022 at 7:57 PM Tom Rini  wrote:
> >
> > On Tue, Oct 18, 2022 at 07:48:27PM +0200, Max Krummenacher wrote:
> > > From: Max Krummenacher 
> > >
> > > With LTO enabled the U-Boot initial environment is no longer stored
> > > in an easy accessible section in env/common.o. I.e. the section name
> > > changes from build to build, its content maybe compressed and it is
> > > annotated with additional data.
> > >
> > > For GCC adding the option '-ffat-lto-objects' when compiling common.o
> > > adds additionally the traditional sections in the object file and
> > > 'make u-boot-initial-env' would work also for the LTO enabled case.
> > > However clang doesn't have that option.
> > >
> > > Fix this by recompiling common.o into a object file only used for
> > > the creation of u-boot-initial-env if LTO is enabled.
> > >
> > > See also:
> > > https://lore.kernel.org/all/927b122e-1f62-e790-f5ca-30bae4332...@foss.st.com/
> > >
> > > Signed-off-by: Max Krummenacher 
> > >
> > > ---
> > >
> > >  Makefile | 8 
> > >  1 file changed, 8 insertions(+)
> > >
> > > diff --git a/Makefile b/Makefile
> > > index 3866cc62f9a..cd45c720d23 100644
> > > --- a/Makefile
> > > +++ b/Makefile
> > > @@ -2451,9 +2451,17 @@ endif
> > >   $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modpost
> > >
> > >  quiet_cmd_genenv = GENENV  $@
> > > +ifeq ($(LTO_ENABLE),y)
> > > +cmd_genenv = $(CC) $(filter-out $(LTO_CFLAGS),$(c_flags)) -c -o 
> > > env/initial_env.o env/common.c; \
> > > + $(OBJCOPY) --dump-section .rodata.default_environment=$@ 
> > > env/initial_env.o; \
> > > + sed --in-place -e 's/\x00/\x0A/g' $@; sed --in-place -e '/^\s*$$/d' 
> > > $@; \
> > > + sort --field-separator== -k1,1 --stable $@ -o $@; \
> > > + rm -f env/initial_env.o env/initial_env.su
> > > +else
> > >  cmd_genenv = $(OBJCOPY) --dump-section .rodata.default_environment=$@ 
> > > env/common.o; \
> > >   sed --in-place -e 's/\x00/\x0A/g' $@; sed --in-place -e '/^\s*$$/d' 
> > > $@; \
> > >   sort --field-separator== -k1,1 --stable $@ -o $@
> > > +endif
> > >
> > >  u-boot-initial-env: u-boot.bin
> > >   $(call if_changed,genenv)
> >
> > Can we pipe the output instead of making a new object file? Maybe not,
> > in a portable way it seems. But, I'm not sure the above respects using
> > O= as well so that does need to be checked and fixed if so.
> 
> While I didn't test it seems that objcopy doesn't allow to pipe data in and 
> out
> of it.

I think it should be easier to compile a new application which includes
header file with env data and prints it to stdout. There are already
host tools like mkimage which are run during u-boot build process, so
adding a new simple host tool should not be a problem -- instead of
trying to hack objcopy, or try to find a way how to play with its
input/output redirection and symbol names to achieve same thing.

> Max
> >
> > --
> > Tom


[PATCH v19 0/4] add TCP and HTTP for downloading images

2022-10-19 Thread Ying-Chun Liu (PaulLiu)
This patch is a refresh from previous patches made by
Duncan Hare . I've contacted him and
continue to work on this patch.

This patch introduce a TCP stack with SACK. And a simple wget command
to download images from http server.

v1-v12: Made by Duncan, didn't tracked.
v13: Fix some issues which is reviewed by Christian
v14: Add options to enable/disable SACK.
v15: Fix various syntax errors reviewed by Michal.
 Remove magic numbers. Use kernel-doc format.
v16: Add more kernel-doc. Fix more double spaces.
v17: Fix wget with address timeout issue reported by Ramon.
v18: Add documentation for wget command.
v19: Add unit test for wget command.

Ying-Chun Liu (PaulLiu) (4):
  net: Add TCP protocol
  net: Add wget application
  doc: cmd: wget: add documentation
  test: cmd: add test for wget command.

 cmd/Kconfig|   7 +
 cmd/net.c  |  13 +
 doc/usage/cmd/wget.rst |  61 
 doc/usage/index.rst|   1 +
 include/net.h  |  38 ++-
 include/net/tcp.h  | 299 +
 include/net/wget.h |  22 ++
 net/Kconfig|  16 +
 net/Makefile   |   2 +
 net/net.c  |  36 +++
 net/tcp.c  | 720 +
 net/wget.c | 438 +
 test/cmd/Makefile  |   1 +
 test/cmd/wget.c| 206 
 14 files changed, 1850 insertions(+), 10 deletions(-)
 create mode 100644 doc/usage/cmd/wget.rst
 create mode 100644 include/net/tcp.h
 create mode 100644 include/net/wget.h
 create mode 100644 net/tcp.c
 create mode 100644 net/wget.c
 create mode 100644 test/cmd/wget.c

-- 
2.35.1



[PATCH v19 1/4] net: Add TCP protocol

2022-10-19 Thread Ying-Chun Liu (PaulLiu)
Currently file transfers are done using tftp or NFS both
over udp. This requires a request to be sent from client
(u-boot) to the boot server.

The current standard is TCP with selective acknowledgment.

Signed-off-by: Duncan Hare 
Signed-off-by: Duncan Hare 
Signed-off-by: Ying-Chun Liu (PaulLiu) 
Reviewed-by: Simon Glass 
Cc: Christian Gmeiner 
Cc: Joe Hershberger 
Cc: Michal Simek 
Cc: Ramon Fried 
---
v1-v12: Made by Duncan, didn't tracked.
v13: Fix some issues which is reviewed by Christian
v14: Add options to enable/disable SACK.
v15: Fix various syntax errors reviewed by Michal.
 Remove magic numbers. Use kernel-doc format.
v16: Add more kernel-doc. Fix more double spaces.
v19: export tcp_set_pseudo_header() for unit test.
---
 include/net.h |  36 ++-
 include/net/tcp.h | 299 +++
 net/Kconfig   |  16 ++
 net/Makefile  |   1 +
 net/net.c |  30 ++
 net/tcp.c | 720 ++
 6 files changed, 1093 insertions(+), 9 deletions(-)
 create mode 100644 include/net/tcp.h
 create mode 100644 net/tcp.c

diff --git a/include/net.h b/include/net.h
index c06b577808..6d8d3fd971 100644
--- a/include/net.h
+++ b/include/net.h
@@ -365,6 +365,7 @@ struct vlan_ethernet_hdr {
 #define PROT_NCSI  0x88f8  /* NC-SI control packets*/
 
 #define IPPROTO_ICMP1  /* Internet Control Message Protocol*/
+#define IPPROTO_TCP6   /* Transmission Control Protocol*/
 #define IPPROTO_UDP17  /* User Datagram Protocol   */
 
 /*
@@ -690,19 +691,36 @@ static inline void net_send_packet(uchar *pkt, int len)
(void) eth_send(pkt, len);
 }
 
-/*
- * Transmit "net_tx_packet" as UDP packet, performing ARP request if needed
- *  (ether will be populated)
- *
- * @param ether Raw packet buffer
- * @param dest IP address to send the datagram to
- * @param dport Destination UDP port
- * @param sport Source UDP port
- * @param payload_len Length of data after the UDP header
+/**
+ * net_send_ip_packet() - Transmit "net_tx_packet" as UDP or TCP packet,
+ *send ARP request if needed (ether will be populated)
+ * @ether: Raw packet buffer
+ * @dest: IP address to send the datagram to
+ * @dport: Destination UDP port
+ * @sport: Source UDP port
+ * @payload_len: Length of data after the UDP header
+ * @action: TCP action to be performed
+ * @tcp_seq_num: TCP sequence number of this transmission
+ * @tcp_ack_num: TCP stream acknolegement number
+ *
+ * Return: 0 on success, other value on failure
  */
 int net_send_ip_packet(uchar *ether, struct in_addr dest, int dport, int sport,
   int payload_len, int proto, u8 action, u32 tcp_seq_num,
   u32 tcp_ack_num);
+/**
+ * net_send_tcp_packet() - Transmit TCP packet.
+ * @payload_len: length of payload
+ * @dport: Destination TCP port
+ * @sport: Source TCP port
+ * @action: TCP action to be performed
+ * @tcp_seq_num: TCP sequence number of this transmission
+ * @tcp_ack_num: TCP stream acknolegement number
+ *
+ * Return: 0 on success, other value on failure
+ */
+int net_send_tcp_packet(int payload_len, int dport, int sport, u8 action,
+   u32 tcp_seq_num, u32 tcp_ack_num);
 int net_send_udp_packet(uchar *ether, struct in_addr dest, int dport,
int sport, int payload_len);
 
diff --git a/include/net/tcp.h b/include/net/tcp.h
new file mode 100644
index 00..322551694f
--- /dev/null
+++ b/include/net/tcp.h
@@ -0,0 +1,299 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * TCP Support with SACK for file transfer.
+ *
+ * Copyright 2017 Duncan Hare, All rights reserved.
+ */
+
+#define TCP_ACTIVITY 127   /* Number of packets received   */
+   /* before console progress mark */
+/**
+ * struct ip_tcp_hdr - IP and TCP header
+ * @ip_hl_v: header length and version
+ * @ip_tos: type of service
+ * @ip_len: total length
+ * @ip_id: identification
+ * @ip_off: fragment offset field
+ * @ip_ttl: time to live
+ * @ip_p: protocol
+ * @ip_sum: checksum
+ * @ip_src: Source IP address
+ * @ip_dst: Destination IP address
+ * @tcp_src: TCP source port
+ * @tcp_dst: TCP destination port
+ * @tcp_seq: TCP sequence number
+ * @tcp_ack: TCP Acknowledgment number
+ * @tcp_hlen: 4 bits TCP header Length/4, 4 bits reserved, 2 more bits reserved
+ * @tcp_flag: flags of TCP
+ * @tcp_win: TCP windows size
+ * @tcp_xsum: Checksum
+ * @tcp_ugr: Pointer to urgent data
+ */
+struct ip_tcp_hdr {
+   u8  ip_hl_v;
+   u8  ip_tos;
+   u16 ip_len;
+   u16 ip_id;
+   u16 ip_off;
+   u8  ip_ttl;
+   u8  ip_p;
+   u16 ip_sum;
+   struct in_addr  ip_src;
+   struct in_addr  ip_dst;
+   u16 tcp_src;
+   u16 tcp_dst;
+   u32 tcp_seq;
+   u32   

[PATCH v19 4/4] test: cmd: add test for wget command.

2022-10-19 Thread Ying-Chun Liu (PaulLiu)
Simulate a TCP HTTP server's response for testing wget command.

Signed-off-by: Ying-Chun Liu (PaulLiu) 
Cc: Simon Glass 
---
 test/cmd/Makefile |   1 +
 test/cmd/wget.c   | 206 ++
 2 files changed, 207 insertions(+)
 create mode 100644 test/cmd/wget.c

diff --git a/test/cmd/Makefile b/test/cmd/Makefile
index f2a5f4ed80..89bdfae907 100644
--- a/test/cmd/Makefile
+++ b/test/cmd/Makefile
@@ -19,3 +19,4 @@ ifdef CONFIG_SANDBOX
 obj-$(CONFIG_CMD_SETEXPR) += setexpr.o
 endif
 obj-$(CONFIG_CMD_TEMPERATURE) += temperature.o
+obj-$(CONFIG_CMD_WGET) += wget.o
diff --git a/test/cmd/wget.c b/test/cmd/wget.c
new file mode 100644
index 00..ed83fc94a5
--- /dev/null
+++ b/test/cmd/wget.c
@@ -0,0 +1,206 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright (c) 2022 Linaro
+ *
+ * (C) Copyright 2022
+ * Ying-Chun Liu (PaulLiu) 
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#define SHIFT_TO_TCPHDRLEN_FIELD(x) ((x) << 4)
+#define LEN_B_TO_DW(x) ((x) >> 2)
+
+static int sb_arp_handler(struct udevice *dev, void *packet,
+ unsigned int len)
+{
+   struct eth_sandbox_priv *priv = dev_get_priv(dev);
+   struct arp_hdr *arp = packet + ETHER_HDR_SIZE;
+   int ret = 0;
+
+   if (ntohs(arp->ar_op) == ARPOP_REQUEST) {
+   priv->fake_host_ipaddr = net_read_ip(&arp->ar_spa);
+
+   ret = sandbox_eth_recv_arp_req(dev);
+   if (ret)
+   return ret;
+   ret = sandbox_eth_arp_req_to_reply(dev, packet, len);
+   return ret;
+   }
+
+   return -EPROTONOSUPPORT;
+}
+
+static int sb_syn_handler(struct udevice *dev, void *packet,
+ unsigned int len)
+{
+   struct eth_sandbox_priv *priv = dev_get_priv(dev);
+   struct ethernet_hdr *eth = packet;
+   struct ip_tcp_hdr *tcp = packet + ETHER_HDR_SIZE;
+   struct ethernet_hdr *eth_send;
+   struct ip_tcp_hdr *tcp_send;
+
+   /* Don't allow the buffer to overrun */
+   if (priv->recv_packets >= PKTBUFSRX)
+   return 0;
+
+   eth_send = (void *)priv->recv_packet_buffer[priv->recv_packets];
+   memcpy(eth_send->et_dest, eth->et_src, ARP_HLEN);
+   memcpy(eth_send->et_src, priv->fake_host_hwaddr, ARP_HLEN);
+   eth_send->et_protlen = htons(PROT_IP);
+   tcp_send = (void *)eth_send + ETHER_HDR_SIZE;
+   tcp_send->tcp_src = tcp->tcp_dst;
+   tcp_send->tcp_dst = tcp->tcp_src;
+   tcp_send->tcp_seq = htonl(0);
+   tcp_send->tcp_ack = htonl(ntohl(tcp->tcp_seq) + 1);
+   tcp_send->tcp_hlen = 
SHIFT_TO_TCPHDRLEN_FIELD(LEN_B_TO_DW(TCP_HDR_SIZE));
+   tcp_send->tcp_flags = TCP_SYN | TCP_ACK;
+   tcp_send->tcp_win = htons(PKTBUFSRX * TCP_MSS >> TCP_SCALE);
+   tcp_send->tcp_xsum = 0;
+   tcp_send->tcp_ugr = 0;
+   tcp_send->tcp_xsum = tcp_set_pseudo_header((uchar *)tcp_send,
+  tcp->ip_src,
+  tcp->ip_dst,
+  TCP_HDR_SIZE,
+  IP_TCP_HDR_SIZE);
+   net_set_ip_header((uchar *)tcp_send,
+ tcp->ip_src,
+ tcp->ip_dst,
+ IP_TCP_HDR_SIZE,
+ IPPROTO_TCP);
+
+   priv->recv_packet_length[priv->recv_packets] =
+   ETHER_HDR_SIZE + IP_TCP_HDR_SIZE;
+   ++priv->recv_packets;
+
+   return 0;
+}
+
+static int sb_ack_handler(struct udevice *dev, void *packet,
+ unsigned int len)
+{
+   struct eth_sandbox_priv *priv = dev_get_priv(dev);
+   struct ethernet_hdr *eth = packet;
+   struct ip_tcp_hdr *tcp = packet + ETHER_HDR_SIZE;
+   struct ethernet_hdr *eth_send;
+   struct ip_tcp_hdr *tcp_send;
+   void *data;
+   int pkt_len;
+   int payload_len = 0;
+   const char *payload1 = "HTTP/1.1 200 OK\r\n"
+   "Content-Length: 30\r\n\r\n\r\n"
+   "Hi\r\n";
+
+   /* Don't allow the buffer to overrun */
+   if (priv->recv_packets >= PKTBUFSRX)
+   return 0;
+
+   eth_send = (void *)priv->recv_packet_buffer[priv->recv_packets];
+   memcpy(eth_send->et_dest, eth->et_src, ARP_HLEN);
+   memcpy(eth_send->et_src, priv->fake_host_hwaddr, ARP_HLEN);
+   eth_send->et_protlen = htons(PROT_IP);
+   tcp_send = (void *)eth_send + ETHER_HDR_SIZE;
+   tcp_send->tcp_src = tcp->tcp_dst;
+   tcp_send->tcp_dst = tcp->tcp_src;
+   data = (void *)tcp_send + IP_TCP_HDR_SIZE;
+
+   if (ntohl(tcp->tcp_seq) == 1 && ntohl(tcp->tcp_ack) == 1) {
+   tcp_send->tcp_seq = htonl(ntohl(tcp->tcp_ack));
+   tcp_send->tcp_ack = htonl(ntohl(tcp->tcp_seq) 

[PATCH v19 3/4] doc: cmd: wget: add documentation

2022-10-19 Thread Ying-Chun Liu (PaulLiu)
Add documentation for the wget command.

Signed-off-by: Ying-Chun Liu (PaulLiu) 
Cc: Simon Glass 
---
 doc/usage/cmd/wget.rst | 61 ++
 doc/usage/index.rst|  1 +
 2 files changed, 62 insertions(+)
 create mode 100644 doc/usage/cmd/wget.rst

diff --git a/doc/usage/cmd/wget.rst b/doc/usage/cmd/wget.rst
new file mode 100644
index 00..4fcfa03954
--- /dev/null
+++ b/doc/usage/cmd/wget.rst
@@ -0,0 +1,61 @@
+.. SPDX-License-Identifier: GPL-2.0+:
+
+wget command
+
+
+Synopsis
+
+
+::
+wget address [[hostIPaddr:]path]
+
+Description
+---
+
+The wget command is used to download a file from an HTTP server.
+
+wget command will use HTTP over TCP to download files from an HTTP server.
+Currently it can only download image from an HTTP server hosted on port 80.
+
+address
+memory address for the data downloaded
+
+hostIPaddr
+IP address of the HTTP server, defaults to the value of environment
+variable *serverip*
+
+path
+path of the file to be downloaded.
+
+Example
+---
+
+In the example the following steps are executed:
+
+* setup client network address
+* download a file from the HTTP server
+
+::
+
+=> setenv autoload no
+=> dhcp
+BOOTP broadcast 1
+*** Unhandled DHCP Option in OFFER/ACK: 23
+*** Unhandled DHCP Option in OFFER/ACK: 23
+DHCP client bound to address 192.168.1.105 (210 ms)
+=> wget ${loadaddr} 192.168.1.254:/index.html
+HTTP/1.0 302 Found
+Packets received 4, Transfer Successful
+
+Configuration
+-
+
+The command is only available if CONFIG_CMD_WGET=y.
+
+CONFIG_PROT_TCP_SACK can be turned on for the TCP SACK options. This will
+help increasing the downloading speed.
+
+Return value
+
+
+The return value $? is 0 (true) on success and 1 (false) otherwise.
diff --git a/doc/usage/index.rst b/doc/usage/index.rst
index 90221015ee..11f5fcfaff 100644
--- a/doc/usage/index.rst
+++ b/doc/usage/index.rst
@@ -73,6 +73,7 @@ Shell commands
cmd/true
cmd/ums
cmd/wdt
+   cmd/wget
cmd/xxd
 
 Booting OS
-- 
2.35.1



[PATCH v19 2/4] net: Add wget application

2022-10-19 Thread Ying-Chun Liu (PaulLiu)
This commit adds a simple wget command that can download files
from http server.

The command syntax is
wget ${loadaddr} 

Signed-off-by: Duncan Hare 
Signed-off-by: Ying-Chun Liu (PaulLiu) 
Reviewed-by: Simon Glass 
Cc: Christian Gmeiner 
Cc: Joe Hershberger 
Cc: Michal Simek 
Cc: Ramon Fried 
---
v1-v12: Made by Duncan, didn't tracked.
v13: Fix some issues which is reviewed by Christian
v14: Add options to enable/disable SACK.
v15: Fix various syntax errors reviewed by Michal.
 Remove magic numbers. Use kernel-doc format.
v16: Add more kernel-doc. Fix more double spaces.
v17: Fix wget with address timeout issue reported by Ramon.
---
 cmd/Kconfig|   7 +
 cmd/net.c  |  13 ++
 include/net.h  |   2 +-
 include/net/wget.h |  22 +++
 net/Makefile   |   1 +
 net/net.c  |   6 +
 net/wget.c | 438 +
 7 files changed, 488 insertions(+), 1 deletion(-)
 create mode 100644 include/net/wget.h
 create mode 100644 net/wget.c

diff --git a/cmd/Kconfig b/cmd/Kconfig
index 49247a41c0..c1283d949f 100644
--- a/cmd/Kconfig
+++ b/cmd/Kconfig
@@ -1791,6 +1791,13 @@ config SYS_DISABLE_AUTOLOAD
  is complete.  Enable this option to disable this behavior and instead
  require files to be loaded over the network by subsequent commands.
 
+config CMD_WGET
+   bool "wget"
+   select TCP
+   help
+ wget is a simple command to download kernel, or other files,
+ from a http server over TCP.
+
 config CMD_MII
bool "mii"
imply CMD_MDIO
diff --git a/cmd/net.c b/cmd/net.c
index 46f8c87b69..fb19d18b64 100644
--- a/cmd/net.c
+++ b/cmd/net.c
@@ -124,6 +124,19 @@ U_BOOT_CMD(
 );
 #endif
 
+#if defined(CONFIG_CMD_WGET)
+static int do_wget(struct cmd_tbl *cmdtp, int flag, int argc, char * const 
argv[])
+{
+   return netboot_common(WGET, cmdtp, argc, argv);
+}
+
+U_BOOT_CMD(
+   wget,   3,  1,  do_wget,
+   "boot image via network using HTTP protocol",
+   "[loadAddress] [[hostIPaddr:]path and image name]"
+);
+#endif
+
 static void netboot_update_env(void)
 {
char tmp[22];
diff --git a/include/net.h b/include/net.h
index 6d8d3fd971..5d52264360 100644
--- a/include/net.h
+++ b/include/net.h
@@ -561,7 +561,7 @@ extern int  net_restart_wrap;   /* Tried all 
network devices */
 
 enum proto_t {
BOOTP, RARP, ARP, TFTPGET, DHCP, PING, DNS, NFS, CDP, NETCONS, SNTP,
-   TFTPSRV, TFTPPUT, LINKLOCAL, FASTBOOT, WOL, UDP
+   TFTPSRV, TFTPPUT, LINKLOCAL, FASTBOOT, WOL, UDP, WGET
 };
 
 extern charnet_boot_file_name[1024];/* Boot File name */
diff --git a/include/net/wget.h b/include/net/wget.h
new file mode 100644
index 00..da0920de11
--- /dev/null
+++ b/include/net/wget.h
@@ -0,0 +1,22 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * Duncan Hare Copyright 2017
+ */
+
+/**
+ * wget_start() - begin wget
+ */
+void wget_start(void);
+
+enum wget_state {
+   WGET_CLOSED,
+   WGET_CONNECTING,
+   WGET_CONNECTED,
+   WGET_TRANSFERRING,
+   WGET_TRANSFERRED
+};
+
+#define DEBUG_WGET 0   /* Set to 1 for debug messages */
+#define SERVER_PORT80
+#define WGET_RETRY_COUNT   30
+#define WGET_TIMEOUT   2000UL
diff --git a/net/Makefile b/net/Makefile
index d131d1cb1a..4f757a224c 100644
--- a/net/Makefile
+++ b/net/Makefile
@@ -31,6 +31,7 @@ obj-$(CONFIG_UDP_FUNCTION_FASTBOOT)  += fastboot.o
 obj-$(CONFIG_CMD_WOL)  += wol.o
 obj-$(CONFIG_PROT_UDP) += udp.o
 obj-$(CONFIG_PROT_TCP) += tcp.o
+obj-$(CONFIG_CMD_WGET) += wget.o
 
 # Disable this warning as it is triggered by:
 # sprintf(buf, index ? "foo%d" : "foo", index)
diff --git a/net/net.c b/net/net.c
index 5333cce57e..033ceda6e1 100644
--- a/net/net.c
+++ b/net/net.c
@@ -117,6 +117,7 @@
 #include "wol.h"
 #endif
 #include 
+#include 
 
 /** BOOTP EXTENTIONS **/
 
@@ -505,6 +506,11 @@ restart:
nfs_start();
break;
 #endif
+#if defined(CONFIG_CMD_WGET)
+   case WGET:
+   wget_start();
+   break;
+#endif
 #if defined(CONFIG_CMD_CDP)
case CDP:
cdp_start();
diff --git a/net/wget.c b/net/wget.c
new file mode 100644
index 00..3826c4b364
--- /dev/null
+++ b/net/wget.c
@@ -0,0 +1,438 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * WGET/HTTP support driver based on U-BOOT's nfs.c
+ * Copyright Duncan Hare  2017
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+static const char bootfile1[] = "GET ";
+static const char bootfile3[] = " HTTP/1.0\r\n\r\n";
+static const char http_eom[] = "\r\n\r\n";
+static const char http_ok[] = "200";
+static const char content_len[] = "Content-Length";
+static const char linefeed[] = "\r\n";
+static struct in_addr web_server_ip;
+static int our_port;
+static int wget_timeout_count;
+
+struct pkt_qd {
+   uchar *pkt;
+   un

Re: [PATCH 00/39] lcd: Drop old LCD support

2022-10-19 Thread Tim Harvey
On Wed, Oct 19, 2022 at 4:58 AM Simon Glass  wrote:
>
> The conversion to DM_VIDEO was completed some years ago. The old video
> code has been removed but the LCD code remains. This series removes it,
> to complete the driver model migration.
>
>
> Simon Glass (39):
>   video: Split SPLASH_SCREEN_ALIGN from bmp command
>   Convert CONFIG_HIDE_LOGO_VERSION to Kconfig
>   video: Rename CONFIG_SYS_VIDEO_LOGO_MAX_SIZE
>   Convert CONFIG_VIDEO_LOGO_MAX_SIZE to Kconfig
>   video: lcd: Drop console rotation
>   video: Drop CONFIG_LCD_ALIGNMENT
>   video: Drop CONFIG_LCD_MENU
>   video: Drop CONFIG_LCD_INFO_BELOW_LOGO
>   video: Drop CONFIG_LCD_INFO
>   video: Move bmp_display() prototype to video.h
>   api: Drop LCD implementation
>   Drop CONFIG_LCD_LOGO
>   video: Drop VCXK video controller
>   BuR: Drop old LCD code
>   video: Drop CONFIG_AM335X_LCD
>   video: atmel: Drop pre-DM parts of video driver
>   video: Drop ld9040 driver
>   video: atmel: Drop CONFIG_LCD_IN_PSRAM
>   treewide: Stop enabling CONFIG_LCD
>   video: Drop atmel LCD code
>   video: samsung: Drop old LCD code
>   nexell: Drop old LCD code
>   compulab: Drop old LCD code
>   tegra: Drop old LCD code
>   BuR: ronetix: siemens: Drop old LCD code
>   video: cmd: Drop old LCD code
>   efi: Drop old LCD code
>   video: Drop remaining references to CONFIG_LCD
>   fdt: Drop support for LCD fixup in simplefb
>   video: Drop LCD_BPP
>   video: Drop CONFIG_VIDEO
>   video: Drop CONFIG_VIDEO
>   video: Drop CONFIG_LCD
>   video: Drop use of the lcd header file
>   video: Drop common LCD implementation
>   video: Drop SPLASHIMAGE_CALLBACK
>   video: Make all video options depend on DM_VIDEO
>   pci: Drop test for DM_VIDEO
>   video: Rename CONFIG_DM_VIDEO to CONFIG_VIDEO
>

Simon,

Where can I find a repo with this series for testing? I can't get it
to apply to master/next.

Best Regards,

Tim


Re: [PATCH 00/39] lcd: Drop old LCD support

2022-10-19 Thread Simon Glass
Hi Tim,

On Wed, 19 Oct 2022 at 11:07, Tim Harvey  wrote:
>
> On Wed, Oct 19, 2022 at 4:58 AM Simon Glass  wrote:
> >
> > The conversion to DM_VIDEO was completed some years ago. The old video
> > code has been removed but the LCD code remains. This series removes it,
> > to complete the driver model migration.
> >
> >
> > Simon Glass (39):
> >   video: Split SPLASH_SCREEN_ALIGN from bmp command
> >   Convert CONFIG_HIDE_LOGO_VERSION to Kconfig
> >   video: Rename CONFIG_SYS_VIDEO_LOGO_MAX_SIZE
> >   Convert CONFIG_VIDEO_LOGO_MAX_SIZE to Kconfig
> >   video: lcd: Drop console rotation
> >   video: Drop CONFIG_LCD_ALIGNMENT
> >   video: Drop CONFIG_LCD_MENU
> >   video: Drop CONFIG_LCD_INFO_BELOW_LOGO
> >   video: Drop CONFIG_LCD_INFO
> >   video: Move bmp_display() prototype to video.h
> >   api: Drop LCD implementation
> >   Drop CONFIG_LCD_LOGO
> >   video: Drop VCXK video controller
> >   BuR: Drop old LCD code
> >   video: Drop CONFIG_AM335X_LCD
> >   video: atmel: Drop pre-DM parts of video driver
> >   video: Drop ld9040 driver
> >   video: atmel: Drop CONFIG_LCD_IN_PSRAM
> >   treewide: Stop enabling CONFIG_LCD
> >   video: Drop atmel LCD code
> >   video: samsung: Drop old LCD code
> >   nexell: Drop old LCD code
> >   compulab: Drop old LCD code
> >   tegra: Drop old LCD code
> >   BuR: ronetix: siemens: Drop old LCD code
> >   video: cmd: Drop old LCD code
> >   efi: Drop old LCD code
> >   video: Drop remaining references to CONFIG_LCD
> >   fdt: Drop support for LCD fixup in simplefb
> >   video: Drop LCD_BPP
> >   video: Drop CONFIG_VIDEO
> >   video: Drop CONFIG_VIDEO
> >   video: Drop CONFIG_LCD
> >   video: Drop use of the lcd header file
> >   video: Drop common LCD implementation
> >   video: Drop SPLASHIMAGE_CALLBACK
> >   video: Make all video options depend on DM_VIDEO
> >   pci: Drop test for DM_VIDEO
> >   video: Rename CONFIG_DM_VIDEO to CONFIG_VIDEO
> >
>
> Simon,
>
> Where can I find a repo with this series for testing? I can't get it
> to apply to master/next.

It is u-boot-dm/lcd-working

Regards,
Simon


Re: [PATCH v14 02/15] FWU: Add FWU metadata structure and driver for accessing metadata

2022-10-19 Thread Ilias Apalodimas
Hi Sughosh


[...]

> + *
> + * Read both the metadata copies from the storage media, verify their 
> checksum,
> + * and ascertain that both copies match. If one of the copies has gone bad,
> + * restore it from the good copy.
> + *
> + * Return: 0 if OK, -ve on error
> + *
> + */
> +int fwu_check_mdata_validity(void)
> +{
> + int ret;
> + struct udevice *dev;
> + struct fwu_mdata pri_mdata;
> + struct fwu_mdata secondary_mdata;
> + uint mdata_parts[2];
> + uint valid_partitions, invalid_partitions;
> +
> + ret = fwu_get_dev_mdata(&dev, NULL);
> + if (ret)
> + return ret;
> +
> + /*
> +  * Check if the platform has defined its own
> +  * function to check the metadata partitions'
> +  * validity. If so, that takes precedence.
> +  */
> + ret = fwu_mdata_check(dev);

Isn't this a bit dangerous?  Let's say a device defines it's own check
function but for some reason returns -ENOSYS.  I am wondering if we should
just return 0 if the platform defined functions aren't defined. 

> + if (!ret || ret != -ENOSYS)
> + return ret;
> +
> + /*
> +  * Two FWU metadata partitions are expected.
> +  * If we don't have two, user needs to create
> +  * them first
> +  */
> + valid_partitions = 0;
> + ret = fwu_get_mdata_part_num(dev, mdata_parts);
> + if (ret < 0) {
> + log_debug("Error getting the FWU metadata partitions\n");
> + return -ENOENT;
> + }
> +
> + ret = fwu_read_mdata_partition(dev, &pri_mdata, mdata_parts[0]);
> + if (!ret) {
> + ret = fwu_verify_mdata(&pri_mdata, 1);
> + if (!ret)
> + valid_partitions |= PRIMARY_PART;
> + }
> +
> + ret = fwu_read_mdata_partition(dev, &secondary_mdata, mdata_parts[1]);
> + if (!ret) {
> + ret = fwu_verify_mdata(&secondary_mdata, 0);
> + if (!ret)
> + valid_partitions |= SECONDARY_PART;
> + }
> +
> + if (valid_partitions == (PRIMARY_PART | SECONDARY_PART)) {
> + /*
> +  * Before returning, check that both the
> +  * FWU metadata copies are the same. If not,
> +  * the FWU metadata copies need to be
> +  * re-populated.
> +  */
> + if (!memcmp(&pri_mdata, &secondary_mdata,
> + sizeof(struct fwu_mdata))) {
> + ret = 0;
> + } else {
> + log_info("Both FWU metadata copies are valid but do not 
> match. Please check!\n");

Check what ? Just remove that part please

> + ret = -1;
> + }
> + goto out;
> + }
> +
> + if (!(valid_partitions & BOTH_PARTS)) {
> + ret = -1;

In general we should try to avoid returning -1 etc.  Is there an errno that
would make sense?

> + goto out;
> + }
> +
> + invalid_partitions = valid_partitions ^ BOTH_PARTS;
> + ret = fwu_write_mdata_partition(dev,
> + (invalid_partitions == PRIMARY_PART) ?
> + &secondary_mdata : &pri_mdata,
> + (invalid_partitions == PRIMARY_PART) ?
> + mdata_parts[0] : mdata_parts[1]);
> +
> + if (ret < 0)
> + log_info("Restoring %s FWU metadata partition failed\n",
> +   (invalid_partitions == PRIMARY_PART) ?
> +   "primary" : "secondary");
> +
> +out:
> + return ret;
> +}
> +
> +/**
> + * fwu_get_active_index() - Get active_index from the FWU metadata
> + * @active_idx: active_index value to be read
> + *
> + * Read the active_index field from the FWU metadata and place it in
> + * the variable pointed to be the function argument.
> + *
> + * Return: 0 if OK, -ve on error
> + *
> + */
> +int fwu_get_active_index(uint *active_idx)
> +{
> + int ret;
> + struct udevice *dev;
> + struct fwu_mdata mdata = { 0 };
> +
> + ret = fwu_get_dev_mdata(&dev, &mdata);
> + if (ret)
> + return ret;
> +
> + /*
> +  * Found the FWU metadata partition, now read the active_index
> +  * value
> +  */
> + *active_idx = mdata.active_index;
> + if (*active_idx >= CONFIG_FWU_NUM_BANKS) {
> + log_debug("Active index value read is incorrect\n");
> + ret = -EINVAL;
> + }
> +
> + return ret;
> +}
> +
> +/**
> + * fwu_set_active_index() - Set active_index in the FWU metadata
> + * @active_idx: active_index value to be set
> + *
> + * Update the active_index field in the FWU metadata
> + *
> + * Return: 0 if OK, -ve on error
> + *
> + */
> +int fwu_set_active_index(uint active_idx)
> +{
> + int ret;
> + struct udevice *dev;
> + struct fwu_mdata mdata = { 0 };
> +
> + if (active_idx >= CONFIG_FWU_NUM_BANKS) {
> + log_debug("Invalid active index value\

Re: [PATCH v14 09/15] FWU: Add boot time checks as highlighted by the FWU specification

2022-10-19 Thread Ilias Apalodimas
Hi Sughosh, 

On Tue, Oct 18, 2022 at 05:13:31PM +0530, Sughosh Ganu wrote:
> The FWU Multi Bank Update specification requires the Update Agent to
> carry out certain checks at the time of platform boot. The Update
> Agent is the component which is responsible for updating the firmware
> components and maintaining and keeping the metadata in sync.
> 
> The spec requires that the Update Agent perform the following checks
> at the time of boot
> * Sanity check of both the metadata copies maintained by the platform.
> * Get the boot index passed to U-Boot by the prior stage bootloader
>   and use this value for metadata bookkeeping.
> * Check if the system is booting in Trial State. If the system boots
>   in the Trial State for more than a specified number of boot counts,
>   change the Active Bank to be booting the platform from.
> 
> Call these checks through the main loop event at the time of platform
> boot.
> 
> Signed-off-by: Sughosh Ganu 
> Reviewed-by: Etienne Carriere 
> ---
> Changes since V13:
> * Removed the superfluous setting of var_attributes before calling
>   efi_get_variable_int()
> * Call fwu_get_dev_mdata() in fwu_trial_state_check() instead of
>   fwu_boottime_checks()
> 
>  include/fwu.h |  13 +++
>  lib/fwu_updates/fwu.c | 181 +-
>  2 files changed, 193 insertions(+), 1 deletion(-)
> 
> diff --git a/include/fwu.h b/include/fwu.h
> index 7d38cb5856..c7b932bc0b 100644
> --- a/include/fwu.h
> +++ b/include/fwu.h
> @@ -345,4 +345,17 @@ int fwu_plat_get_update_index(uint *update_idx);
>   *
>   */
>  void fwu_plat_get_bootidx(uint *boot_idx);
> +
> +/**
> + * fwu_update_checks_pass() - Check if FWU update can be done
> + *
> + * Check if the FWU update can be executed. The updates are
> + * allowed only when the platform is not in Trial State and
> + * the boot time checks have passed
> + *
> + * Return: 1 if OK, 0 on error
> + *
> + */
> +u8 fwu_update_checks_pass(void);
> +
>  #endif /* _FWU_H_ */
> diff --git a/lib/fwu_updates/fwu.c b/lib/fwu_updates/fwu.c
> index e782dc0176..2016a6d2c1 100644
> --- a/lib/fwu_updates/fwu.c
> +++ b/lib/fwu_updates/fwu.c
> @@ -4,10 +4,19 @@
>   */
>  
>  #include 
> +#include 
>  #include 
> +#include 
> +#include 
>  #include 
>  #include 
> -#include 
> +#include 
> +
> +#include 
> +#include 
> +
> +static u8 trial_state;
> +static u8 boottime_check;
>  
>  #include 
>  #include 
> @@ -44,6 +53,110 @@ static int fwu_get_dev_mdata(struct udevice **dev, struct 
> fwu_mdata *mdata)
>   return ret;
>  }
>  
> +static int trial_counter_update(u16 *trial_state_ctr)
> +{
> + bool delete;
> + u32 var_attr;
> + efi_status_t status;
> + efi_uintn_t var_size;
> +
> + delete = !trial_state_ctr ? true : false;
> + var_size = !trial_state_ctr ? 0 : (efi_uintn_t)sizeof(*trial_state_ctr);
> + var_attr = !trial_state_ctr ? 0 : EFI_VARIABLE_NON_VOLATILE |
> + EFI_VARIABLE_BOOTSERVICE_ACCESS;
> + status = efi_set_variable_int(u"TrialStateCtr",
> +   &efi_global_variable_guid,
> +   var_attr,
> +   var_size, trial_state_ctr, false);
> +
> + if ((delete && (status != EFI_NOT_FOUND &&
> + status != EFI_SUCCESS)) ||
> + (!delete && status != EFI_SUCCESS))
> + return -1;
> +
> + return 0;
> +}
> +
> +static int in_trial_state(struct fwu_mdata *mdata)
> +{
> + u32 i, active_bank;
> + struct fwu_image_entry *img_entry;
> + struct fwu_image_bank_info *img_bank_info;
> +
> + active_bank = mdata->active_index;
> + img_entry = &mdata->img_entry[0];
> + for (i = 0; i < CONFIG_FWU_NUM_IMAGES_PER_BANK; i++) {
> + img_bank_info = &img_entry[i].img_bank_info[active_bank];
> + if (!img_bank_info->accepted) {
> + return 1;
> + }

Remove {}

> + }
> +
> + return 0;
> +}
> +
> +static int fwu_trial_state_check(void)
> +{
> + int ret;
> + struct udevice *dev;
> + efi_status_t status;
> + efi_uintn_t var_size;
> + u16 trial_state_ctr;
> + struct fwu_mdata mdata = { 0 };
> +
> + ret = fwu_get_dev_mdata(&dev, &mdata);
> + if (ret)
> + return ret;
> +
> + trial_state = in_trial_state(&mdata);
> + if (trial_state) {
> + var_size = (efi_uintn_t)sizeof(trial_state_ctr);
> + log_info("System booting in Trial State\n");
> + status = efi_get_variable_int(u"TrialStateCtr",
> +   &efi_global_variable_guid,
> +   NULL,
> +   &var_size, &trial_state_ctr,
> +   NULL);
> + if (status != EFI_SUCCESS) {
> + log_err("Unable to read TrialStateCtr variable\n");
> + ret = -1;
> +   

Re: [PATCH v14 02/15] FWU: Add FWU metadata structure and driver for accessing metadata

2022-10-19 Thread Etienne Carriere
Hi Sughosh, Ilias,

On Wed, 19 Oct 2022 at 21:56, Ilias Apalodimas
 wrote:
>
> Hi Sughosh
>
>
> [...]
>
> > + *
> > + * Read both the metadata copies from the storage media, verify their 
> > checksum,
> > + * and ascertain that both copies match. If one of the copies has gone bad,
> > + * restore it from the good copy.
> > + *
> > + * Return: 0 if OK, -ve on error
> > + *
> > + */
> > +int fwu_check_mdata_validity(void)
> > +{
> > + int ret;
> > + struct udevice *dev;
> > + struct fwu_mdata pri_mdata;
> > + struct fwu_mdata secondary_mdata;
> > + uint mdata_parts[2];
> > + uint valid_partitions, invalid_partitions;
> > +
> > + ret = fwu_get_dev_mdata(&dev, NULL);
> > + if (ret)
> > + return ret;
> > +
> > + /*
> > +  * Check if the platform has defined its own
> > +  * function to check the metadata partitions'
> > +  * validity. If so, that takes precedence.
> > +  */
> > + ret = fwu_mdata_check(dev);
>
> Isn't this a bit dangerous?  Let's say a device defines it's own check
> function but for some reason returns -ENOSYS.  I am wondering if we should
> just return 0 if the platform defined functions aren't defined.
>
> > + if (!ret || ret != -ENOSYS)
> > + return ret;
> > +
> > + /*
> > +  * Two FWU metadata partitions are expected.
> > +  * If we don't have two, user needs to create
> > +  * them first
> > +  */
> > + valid_partitions = 0;
> > + ret = fwu_get_mdata_part_num(dev, mdata_parts);
> > + if (ret < 0) {
> > + log_debug("Error getting the FWU metadata partitions\n");
> > + return -ENOENT;
> > + }
> > +
> > + ret = fwu_read_mdata_partition(dev, &pri_mdata, mdata_parts[0]);
> > + if (!ret) {
> > + ret = fwu_verify_mdata(&pri_mdata, 1);
> > + if (!ret)
> > + valid_partitions |= PRIMARY_PART;
> > + }
> > +
> > + ret = fwu_read_mdata_partition(dev, &secondary_mdata, mdata_parts[1]);
> > + if (!ret) {
> > + ret = fwu_verify_mdata(&secondary_mdata, 0);
> > + if (!ret)
> > + valid_partitions |= SECONDARY_PART;
> > + }
> > +
> > + if (valid_partitions == (PRIMARY_PART | SECONDARY_PART)) {
> > + /*
> > +  * Before returning, check that both the
> > +  * FWU metadata copies are the same. If not,
> > +  * the FWU metadata copies need to be
> > +  * re-populated.
> > +  */
> > + if (!memcmp(&pri_mdata, &secondary_mdata,
> > + sizeof(struct fwu_mdata))) {
> > + ret = 0;
> > + } else {
> > + log_info("Both FWU metadata copies are valid but do 
> > not match. Please check!\n");
>
> Check what ? Just remove that part please

Discussing with Sughosh, here we could update secondary partition with
primary content.
This would prevent us from bricking an update if a power failure
happens before backup (secondary) mdata image is updated.

The code that updates mdata content (patch fwu_gpt_update_mdata() in
patch 03/15) first updates primary partition, then the secondary. It
should be the mandated policy:
1/ ensure secondary content primary content, 2/ update primary 3/
update secondary.
So here, we can safely use the primary if content looks consistent. If
secondary differs from primary, it means the former was not
successfully updated after primary was loaded with new content.

br,
etienne

>
> > + ret = -1;
> > + }
> > + goto out;
> > + }
> > +
> > + if (!(valid_partitions & BOTH_PARTS)) {
> > + ret = -1;
>
> In general we should try to avoid returning -1 etc.  Is there an errno that
> would make sense?
>
> > + goto out;
> > + }
> > +
> > + invalid_partitions = valid_partitions ^ BOTH_PARTS;
> > + ret = fwu_write_mdata_partition(dev,
> > + (invalid_partitions == PRIMARY_PART) ?
> > + &secondary_mdata : &pri_mdata,
> > + (invalid_partitions == PRIMARY_PART) ?
> > + mdata_parts[0] : mdata_parts[1]);
> > +
> > + if (ret < 0)
> > + log_info("Restoring %s FWU metadata partition failed\n",
> > +   (invalid_partitions == PRIMARY_PART) ?
> > +   "primary" : "secondary");
> > +
> > +out:
> > + return ret;
> > +}
> > +
> > +/**
> > + * fwu_get_active_index() - Get active_index from the FWU metadata
> > + * @active_idx: active_index value to be read
> > + *
> > + * Read the active_index field from the FWU metadata and place it in
> > + * the variable pointed to be the function argument.
> > + *
> > + * Return: 0 if OK, -ve on error
> > + *
> > + */
> > +int fwu_get_active_index(uint *active_idx)
> > +{
> > + int ret;
> > + 

Re: [PATCH v3 6/6] test: add test for eficonfig secure boot key management

2022-10-19 Thread Heinrich Schuchardt

On 10/19/22 15:17, Simon Glass wrote:

iHi Heinrich,

On Fri, 14 Oct 2022 at 22:43, Heinrich Schuchardt  wrote:


On 10/15/22 03:10, Simon Glass wrote:

Hi Ilias,

On Fri, 14 Oct 2022 at 09:59, Ilias Apalodimas
 wrote:


Hi Simon,

On Fri, 14 Oct 2022 at 18:56, Simon Glass  wrote:


Hi,

On Fri, 14 Oct 2022 at 00:58, Masahisa Kojima
 wrote:


Provide a unit test for the eficonfig secure boot key
management menu.

Signed-off-by: Masahisa Kojima 
---
No change since v2

newly created in v2

   test/py/tests/test_eficonfig/conftest.py  |  84 +++-
   test/py/tests/test_eficonfig/defs.py  |  14 +
   .../test_eficonfig/test_eficonfig_sbkey.py| 472 ++
   3 files changed, 568 insertions(+), 2 deletions(-)
   create mode 100644 test/py/tests/test_eficonfig/defs.py
   create mode 100644 test/py/tests/test_eficonfig/test_eficonfig_sbkey.py


Please can this test be in C? Also, using down-arrow to select menus
is brittle. Add a function to select the one you want, e.g. by name.



Is there a very specific reason why we should do stuff like that in C?


Yes, see here.


   Python is way easier to extend and test in our case.


In what way? It seems a lot more complicated, plus the brittle nature
of this test suggests it will be a hassle to maintain.

https://u-boot.readthedocs.io/en/latest/develop/tests_writing.html#python-or-c

There is a pending update here too:

https://patchwork.ozlabs.org/project/uboot/patch/20221013122927.636867-15-...@chromium.org/


The discussion touches different aspects:

** What does it take to make a GUI easily testable? **

Relying on cursor movement for testing is fragile. This is why GUIs
often assign to each executable element the following:

* Access key, e.g  
A key combination that when entered will have the the same
effect as selecting the GUI item
* Access string, '@SAVE'
A string that when typed into the command field will have
the same effect as selecting the GUI item

Let's look at U-Boot's menu entry definition:

struct bootmenu_entry {
  unsigned short int num;  // unique number 0 .. MAX_COUNT
  char key[3]; // key identifier of number
  char *title; // title of entry
  char *command;   // hush command of entry
  enum boot_type type; // boot type of entry
  u16 bootorder;   // order for each boot type
  struct bootmenu_data *menu;  // this bootmenu
  struct bootmenu_entry *next; // next menu entry (num+1)
}

Our structure lacks an accessor element that can be used to select a
menu item without using cursor actions.

Compound keystrokes like  are send as multiple bytes on the
console, e.g. 1b 5b 31 37 3b 35 7e.

We may define a field shortcut of type char *. If the string is received
by the menu loop, let it activate the matching menu entry. Let cursor
actions (up, down, enter, space '+', '-') interrupt matching the
shortcut string.

Instead we could also use a convention for the title:

If a letter in the title is preceded by '&', this is the shortcut key.
This letter will be shown highlighted in the menu and the ampersand will
not be shown.

This is probably easier to implement.

Adding the shortcut facility will allow both for easier testing and
faster navigation.

** Choice of programming language **

Several aspects control the choice of the programming language for tests:

- Testing single library functions is only possible in C.
- Checking contents of internal structures is only possible in C.
- Testing the U-Boot's CLI is easily accessible in our Python framework.
- Preparation of complex test data is easier to do in Python.
- Mixed language tests should be avoided if not strictly necessary.
It is much easier to maintain a single code source for a test.

** What to do for secure boot key management? **

Secure boot key management requires complex preparation which fits well
into out Python testing framework.

Once we provide shortcut keys to U-Boot menus the entries will be easily
accessible from Python.

As we want to avoid complexity due to mixed language tests we should
stick to Python for testing key management at the user level.


The test setup should be in Python (and needs to be) but the actual
test should be in C, in general.


From what I can tell these tests should be split up, one for each test case.


Using keyboard shortcuts for menus would certainly help, but you still
have the dependency between the menu code in C and the Python code
that uses it. The complexity of this dependency is quite significant.

Can we not design this all for easier testing? The functionality
should be broken down a little more so we can change the configs in a
test (e.g. using the eficonfig command), then check that booting does
what we expect.

Overall I feel that this 'black box' testing is not a good approach
and we should try to test the components. It is OK to have a
happy-path test but here we are just writing hundreds of

Re: [PATCH] clk: change return type of clk_get_parent_rate from long long to ulong

2022-10-19 Thread Sean Anderson
On Wed, 28 Sep 2022 12:37:57 +0200, Michal Suchanek wrote:
> All functions getting and setting clock rate use ulong for rate, only
> clk_get_parent_rate is an exception. Change the return value to match
> other clock rate funcrions.
> 
> Most users directly assign the rate to unsigned long anyway, and the few
> users that use u64 (not s64) multiply the rate so they may need the
> extra bits for the result in their use case.
> 
> [...]

Applied, thanks!

[1/1] clk: change return type of clk_get_parent_rate from long long to ulong
  commit: bf3afe148ecbc34f096c5f08c7168c64159299d9

Best regards,
-- 
Sean Anderson 


Re: [PATCH v2] clk: update clk_clean_rate_cache to use private clk struct

2022-10-19 Thread Sean Anderson
On Mon, 20 Jun 2022 15:37:25 +0200, Patrick Delaunay wrote:
> In clk_clean_rate_cache, clk->rate should update the private clock
> struct, in particular when CCF is activated, to save the cached
> rate value.
> 
> When clk_get_parent_rate is called, the cached information
> is read from pclk->rate, with pclk = clk_get_parent(clk).
> 
> [...]

Applied, thanks!

[1/1] clk: update clk_clean_rate_cache to use private clk struct
  commit: 1d2e59101887e9af7ba41bc4b94d4e4e431e2593

Best regards,
-- 
Sean Anderson 


Re: [PATCH] rockchip: clk: pll: Fix constant typo

2022-10-19 Thread Sean Anderson
On Wed, 28 Sep 2022 12:41:29 +0200, Michal Suchanek wrote:
> 


Applied, thanks!

[1/1] rockchip: clk: pll: Fix constant typo
  commit: fe45c6d714a00ff4ce69d73350efe28b6dea87b0

Best regards,
-- 
Sean Anderson 


Pull request: u-boot-sunxi/master for 2023.01

2022-10-19 Thread Andre Przywara
Hi Tom,

please pull the first bunch of the sunxi pull request for this cycle.
Beside some rather unexciting sync of the DTs from the kernel tree, and
some Kconfig cleanup, there are some improvements for the ARMv5 Allwinner
family, to support boards with the F1C200s (64MB DRAM) better. We will
get actual board support as soon as the DTs have passed the Linux review
process.
There is also support for the X96 Mate TV Box, featuring the H616 SoC and
a full 4GB of DRAM.
Also we found the secret to enable SPI booting on the H616 (pin PC5 must
be pulled to GND), so the SPI boot support patch is now good to go.

Passed the gitlab CI, plus briefly tested on Pine64-LTS, LicheePi Nano,
X96 Mate and OrangePi Zero.

Thanks,
Andre


The following changes since commit e2ff1d0fa777b11ad6b26432cb7613ab433b15d6:

  Merge tag 'efi-2023-01-rc1-3' of 
https://source.denx.de/u-boot/custodians/u-boot-efi (2022-10-16 20:23:47 -0400)

are available in the Git repository at:

  https://source.denx.de/u-boot/custodians/u-boot-sunxi.git master

for you to fetch changes up to 843ed983a07ee5d8d4e4ac5baa39fc53f12b5f33:

  suniv: add UART1 support (2022-10-19 14:15:02 +0100)


Andre Przywara (11):
  sunxi: dts: arm64: update devicetree files
  sunxi: dts: arm: update devicetree files
  sunxi: Kconfig: use SoC-wide values for some symbols
  sunxi: defconfig: drop redundant definitions
  sunxi: SPL SPI: Add SPI boot support for the Allwinner H616 SoC
  sunxi: OrangePi Zero 2: Enable SPI booting
  sunxi: defconfig: Add X96 Mate TV box
  sunxi: Kconfig: introduce SUNXI_MINIMUM_DRAM_MB
  sunxi: fix 32MB load address layout
  suniv: move SKIP_LOWLEVEL_INIT_ONLY into Kconfig
  suniv: add UART1 support

Icenowy Zheng (2):
  sunxi: fix SUNIV build when enabling D-Cache
  configs: sunxi: licheepi_nano: enable D-Cache

 Kconfig |   6 +-
 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 +
 arch/arm/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-b

[GIT PULL] clk changes for v2023.01

2022-10-19 Thread Sean Anderson

The following changes since commit d3ccdc0fce206c1d54fbdc607333de6184e19e75:

  Merge tag 'efi-2022-10-rc6' of 
https://source.denx.de/u-boot/custodians/u-boot-efi (2022-09-30 08:30:38 -0400)

are available in the Git repository at:

  https://source.denx.de/u-boot/custodians/u-boot-clk.git tags/clk-2023.01

for you to fetch changes up to 19fb40a5e7ee815a703ffdcc7c0fdb7933762256:

  clk: update clk_clean_rate_cache to use private clk struct (2022-10-19 
12:28:30 -0400)


Clock patches for 2023.01

This contains various fixes (some long overdue) for the next release.


Michal Suchanek (2):
  clk: change return type of clk_get_parent_rate from long long to ulong
  rockchip: clk: pll: Fix constant typo

Patrick Delaunay (1):
  clk: update clk_clean_rate_cache to use private clk struct

 drivers/clk/clk-uclass.c   | 20 ++--
 drivers/clk/rockchip/clk_pll.c |  6 +++---
 include/clk.h  |  4 ++--
 3 files changed, 23 insertions(+), 7 deletions(-)


Re: [PATCH v2 2/5] Makefile: Correct a missing FORCE on the binman rule

2022-10-19 Thread Simon Glass
Hi Pali,

On Sun, 16 Oct 2022 at 04:16, Pali Rohár  wrote:
>
> On Tuesday 11 October 2022 23:35:22 Masahiro Yamada wrote:
> > On Tue, Oct 11, 2022 at 11:16 PM Simon Glass  wrote:
> > >
> > > This is required for if_changed to work correctly. Add it.
> > >
> > > Signed-off-by: Simon Glass 
> > > Reviewed-by: Pali Rohár 
> > > ---
> > >
> > > (no changes since v1)
> > >
> > >  Makefile | 2 +-
> > >  1 file changed, 1 insertion(+), 1 deletion(-)
> > >
> > > diff --git a/Makefile b/Makefile
> > > index 3866cc62f9a..d28e8b4e316 100644
> > > --- a/Makefile
> > > +++ b/Makefile
> > > @@ -,7 +,7 @@ endef
> > >  PHONY += inputs
> > >  inputs: $(INPUTS-y)
> > >
> > > -all: .binman_stamp inputs
> > > +all: .binman_stamp inputs FORCE
> > >  ifeq ($(CONFIG_BINMAN),y)
> > > $(call if_changed,binman)
> >
> >
> >
> > 'all' is usually used as a phony target.
> >
> >
> > I think this went wrong.
> >
> > if_changed should never be used for a phony target.
> > In other words, if_changed should produce a build artifact.
> >
> >
> >
> > FORCE is never used for a phony target because
> > it is added to 'PHONY'.
> >
> > PHONY += all
> >
> >
>
> I agree, this is really written in the wrong way.
>
> Target "all:" should be really phony target and should only depends on
> other target, it should not have any body / commands.

OK, will need to figure out where to put the binman thing then.

>
> And binman call should be moved to different non-phony target with the
> correct output file name.

Binman can generate all sorts of files. I will see if I can use
.binman-stamp since that is always generated.

Regards,
Simon


[PATCH 0/1] imx8m: ddr_init: fix reading of DDR4 MR registers

2022-10-19 Thread Ying-Chun Liu (PaulLiu)
Accorting to commit 290ffe57886271a6 we need to read more significant
bytes to get a non-zero value. However commit 7e9bd84883aeb1e2 removes
it by accident. Thus we add the changes back. This is needed to let
imx8mm-cl-iot-gate to boot correctly.

Ying-Chun Liu (PaulLiu) (1):
  imx8m: ddr_init: fix reading of DDR4 MR registers

 drivers/ddr/imx/imx8m/ddr_init.c | 8 +++-
 1 file changed, 7 insertions(+), 1 deletion(-)

-- 
2.35.1



[PATCH 1/1] imx8m: ddr_init: fix reading of DDR4 MR registers

2022-10-19 Thread Ying-Chun Liu (PaulLiu)
Accorting to commit 290ffe57886271a6 we need to read more significant
bytes to get a non-zero value. However commit 7e9bd84883aeb1e2 removes
it by accident. Thus we add the changes back. This is needed to let
imx8mm-cl-iot-gate to boot correctly.

Signed-off-by: Ying-Chun Liu (PaulLiu) 
Cc: Fabio Estevam 
Cc: Marek Vasut 
Cc: Peng Fan 
Cc: Rasmus Villemoes 
Cc: Stefano Babic 
Cc: NXP i.MX U-Boot Team 
---
 drivers/ddr/imx/imx8m/ddr_init.c | 8 +++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/ddr/imx/imx8m/ddr_init.c b/drivers/ddr/imx/imx8m/ddr_init.c
index d964184ddc..7a683b1d36 100644
--- a/drivers/ddr/imx/imx8m/ddr_init.c
+++ b/drivers/ddr/imx/imx8m/ddr_init.c
@@ -134,8 +134,14 @@ unsigned int lpddr4_mr_read(unsigned int mr_rank, unsigned 
int mr_addr)
tmp = reg32_read(DRC_PERF_MON_MRR0_DAT(0));
} while ((tmp & 0x8) == 0);
tmp = reg32_read(DRC_PERF_MON_MRR1_DAT(0));
-   tmp = tmp & 0xff;
reg32_write(DRC_PERF_MON_MRR0_DAT(0), 0x4);
+   while (tmp) { // try to find a significant byte in the word
+   if (tmp & 0xff) {
+   tmp &= 0xff;
+   break;
+   }
+   tmp >>= 8;
+   }
 
return tmp;
 }
-- 
2.35.1



Re: [PATCH 1/1] imx8m: ddr_init: fix reading of DDR4 MR registers

2022-10-19 Thread Fabio Estevam

Hi Paul,

On 19/10/2022 23:33, Ying-Chun Liu (PaulLiu) wrote:

Accorting to commit 290ffe57886271a6 we need to read more significant
bytes to get a non-zero value. However commit 7e9bd84883aeb1e2 removes
it by accident. Thus we add the changes back. This is needed to let
imx8mm-cl-iot-gate to boot correctly.

Signed-off-by: Ying-Chun Liu (PaulLiu) 


Rasmus has already submitted a fix for this:

https://lore.kernel.org/u-boot/f623aec6ff75744183ce86d0a6e17...@denx.de/T/#t

Thanks


  1   2   >