Re: [PATCH v11 4/9] eficonfig: add "Change Boot Order" menu entry
On 8/18/22 08:17, Heinrich Schuchardt wrote: On 8/17/22 11:36, Masahisa Kojima wrote: This commit adds the menu entry to update UEFI BootOrder variable. User moves the entry with UP/DOWN key, changes the order with PLUS/MINUS key, press SPACE to activate or deactivate the entry, then finalizes the order by ENTER key. If the entry is activated, the boot index is added into the BootOrder variable in the order of the list. The U-Boot menu framework is well designed for static menu, this commit implements the own menu display and key handling for dynamically change the order of menu entry. Signed-off-by: Masahisa Kojima Hello Masahisa, not all boot option will necessarily be in the boot order. It must be possible to add an existing boot option to the boot order. It must be possible to delete a boot option from the boot order without deleting the boot option. I can't see how to do this inside the eficonfig command with the patch series applied Sorry, I got this wrong. The inclusion/exclusion is done via the checkmark. This works fine. Best regards Heinrich --- Changes in v11: - remove BootOrder variable dependency - use ANSI_CURSOR_POSITION and ANSI_CLEAR_LINE instead of printf("\n") since current eficonfig implementation does not handle console size correctly. printf("\n") at the outside of console size breaks the console output. - add KEY_SPACE to toggle the boot option active status No update since v9 Changes in v9: - add function comment Changes in v8: - add "Save" and "Quit" entries Changes in v7: - use UP/DOWN and PLUS/MINUS key to change to order no update in v6: cmd/eficonfig.c | 346 1 file changed, 346 insertions(+) diff --git a/cmd/eficonfig.c b/cmd/eficonfig.c index 938d46374e..f6152495c8 100644 --- a/cmd/eficonfig.c +++ b/cmd/eficonfig.c @@ -91,6 +91,23 @@ struct eficonfig_boot_selection_data { int *selected; }; +/** + * struct eficonfig_boot_order - structure to be used to update BootOrder variable + * + * @num: index in the menu entry + * @description: pointer to the description string + * @boot_index: boot option index + * @active: flag to include the boot option into BootOrder variable + * @list: list structure + */ +struct eficonfig_boot_order { + u32 num; + u16 *description; + u32 boot_index; + bool active; + struct list_head list; +}; + /** * eficonfig_print_msg() - print message * @@ -1665,6 +1682,334 @@ out: return ret; } +/** + * eficonfig_display_change_boot_order() - display the BootOrder list + * + * @efi_menu: pointer to the efimenu structure + * Return: status code + */ +static void eficonfig_display_change_boot_order(struct efimenu *efi_menu) +{ + bool reverse; + struct list_head *pos, *n; + struct eficonfig_boot_order *entry; + + printf(ANSI_CLEAR_CONSOLE ANSI_CURSOR_POSITION + "\n ** Change Boot Order **\n" + ANSI_CURSOR_POSITION + " Press UP/DOWN to move, +/- to change order" + ANSI_CURSOR_POSITION + " Press SPACE to activate or deactivate the entry" + ANSI_CURSOR_POSITION + " Select [Save] to complete, ESC/CTRL+C to quit" + ANSI_CURSOR_POSITION ANSI_CLEAR_LINE, + 1, 1, efi_menu->count + 5, 1, efi_menu->count + 6, 1, + efi_menu->count + 7, 1, efi_menu->count + 8, 1); + + /* draw boot option list */ + list_for_each_safe(pos, n, &efi_menu->list) { + entry = list_entry(pos, struct eficonfig_boot_order, list); + reverse = (entry->num == efi_menu->active); + + printf(ANSI_CURSOR_POSITION, entry->num + 4, 7); + + if (reverse) + puts(ANSI_COLOR_REVERSE); + + if (entry->num < efi_menu->count - 2) { + if (entry->active) + printf("[*] "); + else + printf("[ ] "); + } + + printf("%ls", entry->description); + + if (reverse) + puts(ANSI_COLOR_RESET); + } +} + +/** + * eficonfig_choice_change_boot_order() - handle the BootOrder update + * + * @efi_menu: pointer to the efimenu structure + * Return: status code + */ +static efi_status_t eficonfig_choice_change_boot_order(struct efimenu *efi_menu) +{ + int esc = 0; + struct list_head *pos, *n; + struct eficonfig_boot_order *tmp; + enum bootmenu_key key = KEY_NONE; + struct eficonfig_boot_order *entry; + + while (1) { + bootmenu_loop(NULL, &key, &esc); + + switch (key) { + case KEY_PLUS: + if (efi_menu->active > 0) { + list_for_each_safe(pos, n, &efi_menu->list) { + entry = list_entry(pos, struct eficonfig_boot_order, list); + if (entry->num == efi_menu->active) + break; + } + tmp = list_entry(pos->prev, struct eficonfig_boot_order, list); + ent
Re: [PATCH v11 1/9] eficonfig: menu-driven addition of UEFI boot option
On 8/17/22 11:36, Masahisa Kojima wrote: This commit add the "eficonfig" command. The "eficonfig" command implements the menu-driven UEFI boot option maintenance feature. This commit implements the addition of new boot option. User can select the block device volume having efi_simple_file_system_protocol and select the file corresponding to the Boot variable. User can also enter the description and optional_data of the BOOT variable in utf8. This commit adds "include/efi_config.h", it contains the common definition to be used from other menus such as UEFI Secure Boot key management. Signed-off-by: Masahisa Kojima --- Changes in v11: - refactor menu entry construction, directly use eficonfig_entry structure - remove reading directory info to calculate the number of entry - fix invalid efi_free_pool() in ill_file_info() - use ANSI_CURSOR_POSITION and ANSI_CLEAR_LINE instead of printf("\n") since current eficonfig implementation does not handle console size correctly. printf("\n") at the outside of console size breaks the console output. Changes in v10: - add initrd file selection - do refactoring - eficonfig_process_common() use list structure - remove u'/' before copying file_path into current_path - fix typos - check snprintf error Changes in v9: - move "efi_guid_bootmenu_auto_generated definition" into efi_bootmgr.c to address build error when CMD_EFICONFIG is disabled - fix typos and comment - remove file system information from error message - remove unreachable code in eficonfig_choice_entry() - single printf() call as much as possible - call only getchar() in eficonfig_print_msg() - filter out '.' entry from file selection - update the efi_disk_get_device_name() implementation - add function comment Changes in v8: - command name is change from "efimenu" to "eficonfig" - function and struct prefixes is changed to "eficonfig" - fix menu header string Changes in v7: - add "efimenu" command and uefi variable maintenance code moved into cmd/efimenu.c - create include/efimenu.h to define the common definition for the other menu such as UEFI Secure Boot key management - update boot option edit UI, user can select description, file, and optional_data to edit in the same menu like following. ** Edit Boot Option ** Description: debian File: virtio 0:1/EFI\debian\grubaa64.efi Optional Data: test Save Quit - remove exit parameter from efimenu_process_common() - menu title type is changed from u16 to char - efimenu_process_common() add menu title string - reduce printf/puts function call for displaying the menu - efi_console_get_u16_string() accept 0 length to allow optional_data is empty - efi_console_get_u16_string() the "size" parameter name is changes to "count" - efimenu is now designed to maintain the UEFI variables, remove autoboot related code - remove one empty line before "Quit" entry - efimenu_init() processes only the first time Changes in v6: - fix typos - modify volume name to match U-Boot syntax - compile in CONFIG_EFI_LOADER=n and CONFIG_CMD_BOOTEFI_BOOTMGR=n - simplify u16_strncmp() usage - support "a\b.efi" file path, use link list to handle filepath - modify length check condition - UEFI related menu items only appears with CONFIG_AUTOBOOT_MENU_SHOW=y Changes in v5: - remove forward declarations - add const qualifier for menu items - fix the possible unaligned access for directory info access - split into three commit 1)add boot option 2) delete boot option 3)change boot order This commit is 1)add boot option. - fix file name buffer allocation size, it should be EFI_BOOTMENU_FILE_PATH_MAX * sizeof(u16) - fix wrong size checking for file selection Chanes in v4: - UEFI boot option maintenance menu is integrated into bootmenu - display the simplified volume name(e.g. usb0:1, nvme1:2) for the volume selection - instead of extending lib/efi_loader/efi_bootmgr.c, newly create lib/efi_loader/efi_bootmenu_maintenance.c and implement boot variable maintenance into it. Changes in RFC v3: not included in v3 series Changes in RFC v2: - enable utf8 user input for boot option name - create lib/efi_loader/efi_console.c::efi_console_get_u16_string() for utf8 user input handling - use u16_strlcat instead of u16_strcat - remove the EFI_CALLs, and newly create or expose the following xxx_int() functions. efi_locate_handle_buffer_int(), efi_open_volume_int(), efi_file_open_int(), efi_file_close_int(), efi_file_read_int() and efi_file_setpos_int(). Note that EFI_CALLs still exist for EFI_DEVICE_PATH_TO_TEXT_PROTOCOL and EFI_SIMPLE_TEXT_INPUT/OUTPUT_PROTOCOL - use efi_search_protocol() instead of calling locate_protocol() to get the device_path_to_text_protocol interface. - remove unnecessary puts(ANSI_CLEAR_LINE), this patch is still depends on puts(ANSI_CLEAR_CONSOLE) - skip SetVariable() if the bootorder is not changed cmd/Kconfig |7 + cmd/Makefile
Re: [PATCH v11 1/9] eficonfig: menu-driven addition of UEFI boot option
On 8/17/22 11:36, Masahisa Kojima wrote: This commit add the "eficonfig" command. The "eficonfig" command implements the menu-driven UEFI boot option maintenance feature. This commit implements the addition of new boot option. User can select the block device volume having efi_simple_file_system_protocol and select the file corresponding to the Boot variable. User can also enter the description and optional_data of the BOOT variable in utf8. This commit adds "include/efi_config.h", it contains the common definition to be used from other menus such as UEFI Secure Boot key management. Signed-off-by: Masahisa Kojima --- Changes in v11: - refactor menu entry construction, directly use eficonfig_entry structure - remove reading directory info to calculate the number of entry - fix invalid efi_free_pool() in ill_file_info() - use ANSI_CURSOR_POSITION and ANSI_CLEAR_LINE instead of printf("\n") since current eficonfig implementation does not handle console size correctly. printf("\n") at the outside of console size breaks the console output. Changes in v10: - add initrd file selection - do refactoring - eficonfig_process_common() use list structure - remove u'/' before copying file_path into current_path - fix typos - check snprintf error Changes in v9: - move "efi_guid_bootmenu_auto_generated definition" into efi_bootmgr.c to address build error when CMD_EFICONFIG is disabled - fix typos and comment - remove file system information from error message - remove unreachable code in eficonfig_choice_entry() - single printf() call as much as possible - call only getchar() in eficonfig_print_msg() - filter out '.' entry from file selection - update the efi_disk_get_device_name() implementation - add function comment Changes in v8: - command name is change from "efimenu" to "eficonfig" - function and struct prefixes is changed to "eficonfig" - fix menu header string Changes in v7: - add "efimenu" command and uefi variable maintenance code moved into cmd/efimenu.c - create include/efimenu.h to define the common definition for the other menu such as UEFI Secure Boot key management - update boot option edit UI, user can select description, file, and optional_data to edit in the same menu like following. ** Edit Boot Option ** Description: debian File: virtio 0:1/EFI\debian\grubaa64.efi Optional Data: test Save Quit - remove exit parameter from efimenu_process_common() - menu title type is changed from u16 to char - efimenu_process_common() add menu title string - reduce printf/puts function call for displaying the menu - efi_console_get_u16_string() accept 0 length to allow optional_data is empty - efi_console_get_u16_string() the "size" parameter name is changes to "count" - efimenu is now designed to maintain the UEFI variables, remove autoboot related code - remove one empty line before "Quit" entry - efimenu_init() processes only the first time Changes in v6: - fix typos - modify volume name to match U-Boot syntax - compile in CONFIG_EFI_LOADER=n and CONFIG_CMD_BOOTEFI_BOOTMGR=n - simplify u16_strncmp() usage - support "a\b.efi" file path, use link list to handle filepath - modify length check condition - UEFI related menu items only appears with CONFIG_AUTOBOOT_MENU_SHOW=y Changes in v5: - remove forward declarations - add const qualifier for menu items - fix the possible unaligned access for directory info access - split into three commit 1)add boot option 2) delete boot option 3)change boot order This commit is 1)add boot option. - fix file name buffer allocation size, it should be EFI_BOOTMENU_FILE_PATH_MAX * sizeof(u16) - fix wrong size checking for file selection Chanes in v4: - UEFI boot option maintenance menu is integrated into bootmenu - display the simplified volume name(e.g. usb0:1, nvme1:2) for the volume selection - instead of extending lib/efi_loader/efi_bootmgr.c, newly create lib/efi_loader/efi_bootmenu_maintenance.c and implement boot variable maintenance into it. Changes in RFC v3: not included in v3 series Changes in RFC v2: - enable utf8 user input for boot option name - create lib/efi_loader/efi_console.c::efi_console_get_u16_string() for utf8 user input handling - use u16_strlcat instead of u16_strcat - remove the EFI_CALLs, and newly create or expose the following xxx_int() functions. efi_locate_handle_buffer_int(), efi_open_volume_int(), efi_file_open_int(), efi_file_close_int(), efi_file_read_int() and efi_file_setpos_int(). Note that EFI_CALLs still exist for EFI_DEVICE_PATH_TO_TEXT_PROTOCOL and EFI_SIMPLE_TEXT_INPUT/OUTPUT_PROTOCOL - use efi_search_protocol() instead of calling locate_protocol() to get the device_path_to_text_protocol interface. - remove unnecessary puts(ANSI_CLEAR_LINE), this patch is still depends on puts(ANSI_CLEAR_CONSOLE) - skip SetVariable() if the bootorder is not changed cmd/Kconfig |7 + cmd/Makefile
Re: [PATCH v11 4/9] eficonfig: add "Change Boot Order" menu entry
On 8/17/22 11:36, Masahisa Kojima wrote: This commit adds the menu entry to update UEFI BootOrder variable. User moves the entry with UP/DOWN key, changes the order with PLUS/MINUS key, press SPACE to activate or deactivate the entry, then finalizes the order by ENTER key. If the entry is activated, the boot index is added into the BootOrder variable in the order of the list. The U-Boot menu framework is well designed for static menu, this commit implements the own menu display and key handling for dynamically change the order of menu entry. Signed-off-by: Masahisa Kojima Hello Masahisa, not all boot option will necessarily be in the boot order. It must be possible to add an existing boot option to the boot order. It must be possible to delete a boot option from the boot order without deleting the boot option. I can't see how to do this inside the eficonfig command with the patch series applied Best regards Heinrich --- Changes in v11: - remove BootOrder variable dependency - use ANSI_CURSOR_POSITION and ANSI_CLEAR_LINE instead of printf("\n") since current eficonfig implementation does not handle console size correctly. printf("\n") at the outside of console size breaks the console output. - add KEY_SPACE to toggle the boot option active status No update since v9 Changes in v9: - add function comment Changes in v8: - add "Save" and "Quit" entries Changes in v7: - use UP/DOWN and PLUS/MINUS key to change to order no update in v6: cmd/eficonfig.c | 346 1 file changed, 346 insertions(+) diff --git a/cmd/eficonfig.c b/cmd/eficonfig.c index 938d46374e..f6152495c8 100644 --- a/cmd/eficonfig.c +++ b/cmd/eficonfig.c @@ -91,6 +91,23 @@ struct eficonfig_boot_selection_data { int *selected; }; +/** + * struct eficonfig_boot_order - structure to be used to update BootOrder variable + * + * @num: index in the menu entry + * @description: pointer to the description string + * @boot_index:boot option index + * @active:flag to include the boot option into BootOrder variable + * @list: list structure + */ +struct eficonfig_boot_order { + u32 num; + u16 *description; + u32 boot_index; + bool active; + struct list_head list; +}; + /** * eficonfig_print_msg() - print message * @@ -1665,6 +1682,334 @@ out: return ret; } +/** + * eficonfig_display_change_boot_order() - display the BootOrder list + * + * @efi_menu: pointer to the efimenu structure + * Return: status code + */ +static void eficonfig_display_change_boot_order(struct efimenu *efi_menu) +{ + bool reverse; + struct list_head *pos, *n; + struct eficonfig_boot_order *entry; + + printf(ANSI_CLEAR_CONSOLE ANSI_CURSOR_POSITION + "\n ** Change Boot Order **\n" + ANSI_CURSOR_POSITION + " Press UP/DOWN to move, +/- to change order" + ANSI_CURSOR_POSITION + " Press SPACE to activate or deactivate the entry" + ANSI_CURSOR_POSITION + " Select [Save] to complete, ESC/CTRL+C to quit" + ANSI_CURSOR_POSITION ANSI_CLEAR_LINE, + 1, 1, efi_menu->count + 5, 1, efi_menu->count + 6, 1, + efi_menu->count + 7, 1, efi_menu->count + 8, 1); + + /* draw boot option list */ + list_for_each_safe(pos, n, &efi_menu->list) { + entry = list_entry(pos, struct eficonfig_boot_order, list); + reverse = (entry->num == efi_menu->active); + + printf(ANSI_CURSOR_POSITION, entry->num + 4, 7); + + if (reverse) + puts(ANSI_COLOR_REVERSE); + + if (entry->num < efi_menu->count - 2) { + if (entry->active) + printf("[*] "); + else + printf("[ ] "); + } + + printf("%ls", entry->description); + + if (reverse) + puts(ANSI_COLOR_RESET); + } +} + +/** + * eficonfig_choice_change_boot_order() - handle the BootOrder update + * + * @efi_menu: pointer to the efimenu structure + * Return: status code + */ +static efi_status_t eficonfig_choice_change_boot_order(struct efimenu *efi_menu) +{ + int esc = 0; + struct list_head *pos, *n; + struct eficonfig_boot_order *tmp; + enum bootmenu_key key = KEY_NONE; + struct eficonfig_boot_order *entry; + + while (1) { + bootmenu_loop(NULL, &key, &esc); + + switch (key) { + case KEY_PLUS: + if (efi_menu->active > 0) { + list_for_each_safe(pos, n, &efi_menu->list) { + entry = list_entry(pos, struct eficonfig_boot_order, list); + if (entry->num
[PATCH] nvmem: u-boot-env: fix crc32 casting type
From: Rafał Miłecki This fixes: drivers/nvmem/u-boot-env.c:141:17: sparse: sparse: cast to restricted __le32 Reported-by: kernel test robot Fixes: f955dc1445069 ("nvmem: add driver handling U-Boot environment variables") Signed-off-by: Rafał Miłecki --- drivers/nvmem/u-boot-env.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/nvmem/u-boot-env.c b/drivers/nvmem/u-boot-env.c index 9b9abfb8f187..fb993ef4249f 100644 --- a/drivers/nvmem/u-boot-env.c +++ b/drivers/nvmem/u-boot-env.c @@ -138,7 +138,7 @@ static int u_boot_env_parse(struct u_boot_env *priv) data_offset = offsetof(struct u_boot_env_image_redundant, data); break; } - crc32 = le32_to_cpu(*(uint32_t *)(buf + crc32_offset)); + crc32 = le32_to_cpu(*(__le32 *)(buf + crc32_offset)); crc32_data_len = priv->mtd->size - crc32_data_offset; data_len = priv->mtd->size - data_offset; -- 2.34.1
Re: [PATCH v8 10/13] FWU: cmd: Add a command to read FWU metadata
Hi Sugosh, On Wed, 17 Aug 2022 at 06:44, Sughosh Ganu wrote: > > Add a command to read the metadata as specified in the FWU > specification and print the fields of the metadata. > > Signed-off-by: Sughosh Ganu > Reviewed-by: Ilias Apalodimas > --- > Changes since V7: None > > cmd/Kconfig | 7 + > cmd/Makefile| 1 + > cmd/fwu_mdata.c | 80 + > 3 files changed, 88 insertions(+) > create mode 100644 cmd/fwu_mdata.c This needs docs and a test. BTW I forgot to mention that the uclass needs a simple test of some sort. https://u-boot.readthedocs.io/en/latest/develop/tests_writing.html Regards, SImon
Re: [PATCH v8 13/13] FWU: doc: Add documentation for the FWU feature
On Wed, 17 Aug 2022 at 06:44, Sughosh Ganu wrote: > > Add documentattion for the FWU Multi Bank Update feature. The document spelling > describes the steps needed for setting up the platform for the > feature, as well as steps for enabling the feature on the platform. > > Signed-off-by: Sughosh Ganu > --- > Changes since V7: > * Handle the various review comments from Heinrich. > > doc/develop/uefi/fwu_updates.rst | 165 +++ > doc/develop/uefi/index.rst | 1 + > doc/develop/uefi/uefi.rst| 2 + > 3 files changed, 168 insertions(+) > create mode 100644 doc/develop/uefi/fwu_updates.rst Reviewed-by: Simon Glass
Re: [PATCH v8 03/13] FWU: Add FWU metadata access driver for GPT partitioned block devices
Hi Sughosh, On Wed, 17 Aug 2022 at 06:44, Sughosh Ganu wrote: > > In the FWU Multi Bank Update feature, the information about the > updatable images is stored as part of the metadata, on a separate > partition. Add a driver for reading from and writing to the metadata > when the updatable images and the metadata are stored on a block > device which is formated with GPT based partition scheme. > > Signed-off-by: Sughosh Ganu > Reviewed-by: Patrick Delaunay > --- > Changes since V7: None > > drivers/fwu-mdata/Kconfig | 9 + > drivers/fwu-mdata/Makefile| 1 + > drivers/fwu-mdata/fwu_mdata_gpt_blk.c | 410 ++ > include/fwu.h | 5 + > 4 files changed, 425 insertions(+) > create mode 100644 drivers/fwu-mdata/fwu_mdata_gpt_blk.c > > diff --git a/drivers/fwu-mdata/Kconfig b/drivers/fwu-mdata/Kconfig > index d6a21c8e19..d5edef19d6 100644 > --- a/drivers/fwu-mdata/Kconfig > +++ b/drivers/fwu-mdata/Kconfig > @@ -5,3 +5,12 @@ config DM_FWU_MDATA > Enable support for accessing FWU Metadata partitions. The > FWU Metadata partitions reside on the same storage device > which contains the other FWU updatable firmware images. Can we link to the docs here, or will it be easy for people to find in the U-Boot docs? > + > +config FWU_MDATA_GPT_BLK > + bool "FWU Metadata access for GPT partitioned Block devices" > + select PARTITION_TYPE_GUID > + select PARTITION_UUIDS > + depends on DM && HAVE_BLOCK_DEVICE && EFI_PARTITION > + help > + Enable support for accessing FWU Metadata on GPT partitioned > + block devices. GPT-partitioned (I think) > diff --git a/drivers/fwu-mdata/Makefile b/drivers/fwu-mdata/Makefile > index e53a8c9983..313049f67a 100644 > --- a/drivers/fwu-mdata/Makefile > +++ b/drivers/fwu-mdata/Makefile > @@ -4,3 +4,4 @@ > # > > obj-$(CONFIG_DM_FWU_MDATA) += fwu-mdata-uclass.o > +obj-$(CONFIG_FWU_MDATA_GPT_BLK) += fwu_mdata_gpt_blk.o > diff --git a/drivers/fwu-mdata/fwu_mdata_gpt_blk.c > b/drivers/fwu-mdata/fwu_mdata_gpt_blk.c Perhaps just call it gpt_blk.c since it is in this directory > new file mode 100644 > index 00..f694c4369b > --- /dev/null > +++ b/drivers/fwu-mdata/fwu_mdata_gpt_blk.c > @@ -0,0 +1,410 @@ > +// SPDX-License-Identifier: GPL-2.0-or-later > +/* > + * Copyright (c) 2022, Linaro Limited > + */ > + > +#define LOG_CATEGORY UCLASS_FWU_MDATA > + > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > + > +#include > +#include > +#include > +#include > + > +#define PRIMARY_PART BIT(0) > +#define SECONDARY_PART BIT(1) > +#define BOTH_PARTS (PRIMARY_PART | SECONDARY_PART) > + > +#define MDATA_READ BIT(0) > +#define MDATA_WRITEBIT(1) > + comment? > +static int gpt_get_mdata_partitions(struct blk_desc *desc, > + u16 *primary_mpart, > + u16 *secondary_mpart) Should use uint, no need to select a 16-bit var so far as I can get > +{ > + int i, ret; > + u32 mdata_parts; > + efi_guid_t part_type_guid; > + struct disk_partition info; > + const efi_guid_t fwu_mdata_guid = FWU_MDATA_GUID; > + > + mdata_parts = 0; > + for (i = 1; i < MAX_SEARCH_PARTITIONS; i++) { > + if (part_get_info(desc, i, &info)) > + continue; > + uuid_str_to_bin(info.type_guid, part_type_guid.b, > + UUID_STR_FORMAT_GUID); > + > + if (!guidcmp(&fwu_mdata_guid, &part_type_guid)) { > + ++mdata_parts; > + if (!*primary_mpart) > + *primary_mpart = i; > + else > + *secondary_mpart = i; > + } > + } > + > + if (mdata_parts != 2) { > + log_err("Expect two copies of the FWU metadata instead of > %d\n", > + mdata_parts); > + ret = -EINVAL; > + } else { > + ret = 0; > + } > + > + return ret; > +} > + > +static int gpt_get_mdata_disk_part(struct blk_desc *desc, > + struct disk_partition *info, > + u32 part_num) > +{ > + int ret; > + char *mdata_guid_str = "8a7a84a0-8387-40f6-ab41-a8b9a5a60d23"; This is fine, but I wonder if it should that go in a header with all the other GUIDs? Or does it go hear because it is a string? > + > + ret = part_get_info(desc, part_num, info); > + if (ret < 0) { > + log_err("Unable to get the partition info for the FWU > metadata part %d", > + part_num); > + return -1; > + } > + > + /* Check that it is indeed the FWU metadata partition *
Re: [PATCH v8 08/13] FWU: Add boot time checks as highlighted by the FWU specification
Hi Sughosh, On Wed, 17 Aug 2022 at 06:44, 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. > > Add these checks in the board initialisation sequence, invoked after > relocation. > > Signed-off-by: Sughosh Ganu > --- > Changes since V7: > * Introduce trial_counter_update() to increment and delete the > TrialStateCtr variable. > * Introduce in_trial_state() to check if the platform is booting in > Trial State. > > common/board_r.c | 5 ++ > include/fwu.h | 3 + > lib/fwu_updates/fwu.c | 175 ++ > 3 files changed, 183 insertions(+) We should use the event system instead of adding another hook. We are trying to get rid of them! Also, please separate out the fwu change from touching common code (although you may not need to touch comment code with events). Regards, SImon
[PATCH v3] cmd: Add pause command
This command is being introduced with the goal of allowing user-friendly "generic use case" U-Boot builds to pause until user input under some situations. The main use case would be when a boot failure happens, to pause until the user has had time to acknowledge the current state. Tested using: make && ./u-boot -v -T -c 'ut lib lib_test_hush_pause' Signed-off-by: Samuel Dionne-Riel --- Hi, I hit a snag when sending v2, and lines ended-up wrapped. In addition I also forgot to include the changelog. It seems the patch on patchwork was also broken in a way it was not on my end. I do not know why the lines ended-up mis-ordered. Please tell if I should have used RESEND v2, since technically the content of the patch are unchanged. Changes for v3 - No functional change in patch - Sent with lines unwrapped - Added changelog Changes for v2 - Added test, as requested by Tom - Made CMD_PAUSE default n --- cmd/Kconfig | 7 + cmd/Makefile| 1 + cmd/pause.c | 35 + configs/sandbox64_defconfig | 1 + configs/sandbox_defconfig | 1 + test/cmd/Makefile | 3 ++ test/cmd/test_pause.c | 62 + 7 files changed, 110 insertions(+) create mode 100644 cmd/pause.c create mode 100644 test/cmd/test_pause.c diff --git a/cmd/Kconfig b/cmd/Kconfig index 3625ff2a50b..e774670a35c 100644 --- a/cmd/Kconfig +++ b/cmd/Kconfig @@ -1961,6 +1961,13 @@ config CMD_GETTIME milliseconds. See also the 'bootstage' command which provides more flexibility for boot timing. +config CMD_PAUSE + bool "pause command" + default n + help + Delay execution waiting for any user input. + Useful to allow the user to read a failure log. + config CMD_RNG bool "rng command" depends on DM_RNG diff --git a/cmd/Makefile b/cmd/Makefile index 5e43a1e022e..98a6224bdc1 100644 --- a/cmd/Makefile +++ b/cmd/Makefile @@ -102,6 +102,7 @@ obj-$(CONFIG_CMD_MFSL) += mfsl.o obj-$(CONFIG_CMD_MII) += mii.o obj-$(CONFIG_CMD_MISC) += misc.o obj-$(CONFIG_CMD_MDIO) += mdio.o +obj-$(CONFIG_CMD_PAUSE) += pause.o obj-$(CONFIG_CMD_SLEEP) += sleep.o obj-$(CONFIG_CMD_MMC) += mmc.o obj-$(CONFIG_CMD_OPTEE_RPMB) += optee_rpmb.o diff --git a/cmd/pause.c b/cmd/pause.c new file mode 100644 index 000..07bf346f3d1 --- /dev/null +++ b/cmd/pause.c @@ -0,0 +1,35 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * (C) Copyright 2021 + * Samuel Dionne-Riel + */ + +#include +#include + +static int do_pause(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) +{ + char *message = "Press any key to continue..."; + + if (argc > 2) + return CMD_RET_USAGE; + + if (argc == 2) + message = argv[1]; + + /* No newline, so it sticks to the bottom of the screen */ + printf("%s", message); + + /* Wait on "any" key... */ + (void) getchar(); + + /* Since there was no newline, we need it now. */ + printf("\n"); + + return CMD_RET_SUCCESS; +} + +U_BOOT_CMD(pause, 2, 1, do_pause, + "delay until user input", + "pause [prompt] - Wait until users presses any key. [prompt] can be used to customize the message.\n" +); diff --git a/configs/sandbox64_defconfig b/configs/sandbox64_defconfig index 6553568e768..0af582d642d 100644 --- a/configs/sandbox64_defconfig +++ b/configs/sandbox64_defconfig @@ -67,6 +67,7 @@ CONFIG_CMD_BMP=y CONFIG_CMD_EFIDEBUG=y CONFIG_CMD_RTC=y CONFIG_CMD_TIME=y +CONFIG_CMD_PAUSE=y CONFIG_CMD_TIMER=y CONFIG_CMD_SOUND=y CONFIG_CMD_QFW=y diff --git a/configs/sandbox_defconfig b/configs/sandbox_defconfig index eba7bcbb483..d856d9b0942 100644 --- a/configs/sandbox_defconfig +++ b/configs/sandbox_defconfig @@ -96,6 +96,7 @@ CONFIG_CMD_BOOTCOUNT=y CONFIG_CMD_EFIDEBUG=y CONFIG_CMD_RTC=y CONFIG_CMD_TIME=y +CONFIG_CMD_PAUSE=y CONFIG_CMD_TIMER=y CONFIG_CMD_SOUND=y CONFIG_CMD_QFW=y diff --git a/test/cmd/Makefile b/test/cmd/Makefile index c331757425e..1bb02d93a23 100644 --- a/test/cmd/Makefile +++ b/test/cmd/Makefile @@ -5,6 +5,9 @@ ifdef CONFIG_HUSH_PARSER obj-$(CONFIG_CONSOLE_RECORD) += test_echo.o endif +ifdef CONFIG_CONSOLE_RECORD +obj-$(CONFIG_CMD_PAUSE) += test_pause.o +endif obj-y += mem.o obj-$(CONFIG_CMD_ADDRMAP) += addrmap.o obj-$(CONFIG_CMD_FDT) += fdt.o diff --git a/test/cmd/test_pause.c b/test/cmd/test_pause.c new file mode 100644 index 000..9c55c6302bc --- /dev/null +++ b/test/cmd/test_pause.c @@ -0,0 +1,62 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * Tests for pause command + * + * Copyright 2022, Samuel Dionne-Riel + * + * Based on tests for echo: + * Copyright 2020, Heinrich Schuchadt + */ + +#include +#include +#include +#include +#include +#include +#include + +DECLARE_GLOBAL_DATA_PTR; + +struct test_data { + char *cmd; + char *expected; + int expected_ret; +}; + +static struct test_data pause_dat
[PATCH v2] cmd: Add pause command
This command is being introduced with the goal of allowing user-friendly "generic use case" U-Boot builds to pause until user input under some situations. The main use case would be when a boot failure happens, to pause until the user has had time to acknowledge the current state. Tested with sandbox using: make && ./u-boot -v -T -c 'ut lib lib_test_hush_pause' Signed-off-by: Samuel Dionne-Riel --- cmd/Kconfig | 7 + cmd/Makefile| 1 + cmd/pause.c | 35 + configs/sandbox64_defconfig | 1 + configs/sandbox_defconfig | 1 + test/cmd/Makefile | 3 ++ test/cmd/test_pause.c | 62 + 7 files changed, 110 insertions(+) create mode 100644 cmd/pause.c create mode 100644 test/cmd/test_pause.c diff --git a/cmd/Kconfig b/cmd/Kconfig index 3625ff2a50b..e774670a35c 100644 --- a/cmd/Kconfig +++ b/cmd/Kconfig @@ -1961,6 +1961,13 @@ config CMD_GETTIME milliseconds. See also the 'bootstage' command which provides more flexibility for boot timing. +config CMD_PAUSE + bool "pause command" + default n + help + Delay execution waiting for any user input. + Useful to allow the user to read a failure log. + config CMD_RNG bool "rng command" depends on DM_RNG diff --git a/cmd/Makefile b/cmd/Makefile index 5e43a1e022e..98a6224bdc1 100644 --- a/cmd/Makefile +++ b/cmd/Makefile @@ -102,6 +102,7 @@ obj-$(CONFIG_CMD_MFSL) += mfsl.o obj-$(CONFIG_CMD_MII) += mii.o obj-$(CONFIG_CMD_MISC) += misc.o obj-$(CONFIG_CMD_MDIO) += mdio.o +obj-$(CONFIG_CMD_PAUSE) += pause.o obj-$(CONFIG_CMD_SLEEP) += sleep.o obj-$(CONFIG_CMD_MMC) += mmc.o obj-$(CONFIG_CMD_OPTEE_RPMB) += optee_rpmb.o diff --git a/cmd/pause.c b/cmd/pause.c new file mode 100644 index 000..07bf346f3d1 --- /dev/null +++ b/cmd/pause.c @@ -0,0 +1,35 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * (C) Copyright 2021 + * Samuel Dionne-Riel + */ + +#include +#include + +static int do_pause(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) +{ + char *message = "Press any key to continue..."; + + if (argc > 2) + return CMD_RET_USAGE; + + if (argc == 2) + message = argv[1]; + + /* No newline, so it sticks to the bottom of the screen */ + printf("%s", message); + + /* Wait on "any" key... */ + (void) getchar(); + + /* Since there was no newline, we need it now. */ + printf("\n"); + + return CMD_RET_SUCCESS; +} + +U_BOOT_CMD(pause, 2, 1, do_pause, + "delay until user input", + "pause [prompt] - Wait until users presses any key. [prompt] can be used to customize the message.\n" +); diff --git a/configs/sandbox64_defconfig b/configs/sandbox64_defconfig index 6553568e768..0af582d642d 100644 --- a/configs/sandbox64_defconfig +++ b/configs/sandbox64_defconfig @@ -67,6 +67,7 @@ CONFIG_CMD_BMP=y CONFIG_CMD_EFIDEBUG=y CONFIG_CMD_RTC=y CONFIG_CMD_TIME=y +CONFIG_CMD_PAUSE=y CONFIG_CMD_TIMER=y CONFIG_CMD_SOUND=y CONFIG_CMD_QFW=y diff --git a/configs/sandbox_defconfig b/configs/sandbox_defconfig index eba7bcbb483..d856d9b0942 100644 --- a/configs/sandbox_defconfig +++ b/configs/sandbox_defconfig @@ -96,6 +96,7 @@ CONFIG_CMD_BOOTCOUNT=y CONFIG_CMD_EFIDEBUG=y CONFIG_CMD_RTC=y CONFIG_CMD_TIME=y +CONFIG_CMD_PAUSE=y CONFIG_CMD_TIMER=y CONFIG_CMD_SOUND=y CONFIG_CMD_QFW=y diff --git a/test/cmd/Makefile b/test/cmd/Makefile index c331757425e..1bb02d93a23 100644 --- a/test/cmd/Makefile +++ b/test/cmd/Makefile @@ -5,6 +5,9 @@ ifdef CONFIG_HUSH_PARSER obj-$(CONFIG_CONSOLE_RECORD) += test_echo.o endif +ifdef CONFIG_CONSOLE_RECORD +obj-$(CONFIG_CMD_PAUSE) += test_pause.o +endif obj-y += mem.o obj-$(CONFIG_CMD_ADDRMAP) += addrmap.o obj-$(CONFIG_CMD_FDT) += fdt.o diff --git a/test/cmd/test_pause.c b/test/cmd/test_pause.c new file mode 100644 index 000..9c55c6302bc --- /dev/null +++ b/test/cmd/test_pause.c @@ -0,0 +1,62 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * Tests for pause command + * + * Copyright 2022, Samuel Dionne-Riel + * + * Based on tests for echo: + * Copyright 2020, Heinrich Schuchadt + */ + +#include +#include +#include +#include +#include +#include +#include + +DECLARE_GLOBAL_DATA_PTR; + +struct test_data { + char *cmd; + char *expected; + int expected_ret; +}; + +static struct test_data pause_data[] = { + /* Test default message */ + {"pause", +"Press any key to continue...", +0}, + /* Test provided message */ + {"pause 'Prompt for pause...'", +"Prompt for pause...", +0}, + /* Test providing more than one params */ + {"pause a b", +"pause - delay until user input", /* start of help message */ +1}, +}; + +static int lib_test_hush_pause(struct unit_test_state *uts) +{ + int i; + + for (i = 0; i < ARRAY_SIZE(pause_data); ++i) {
Re: [PATCH v8 02/13] FWU: Add FWU metadata structure and driver for accessing metadata
Hi Sughosh, On Wed, 17 Aug 2022 at 06:44, Sughosh Ganu wrote: > > In the FWU Multi Bank Update feature, the information about the > updatable images is stored as part of the metadata, which is stored on > a dedicated partition. Add the metadata structure, and a driver model > uclass which provides functions to access the metadata. These are > generic API's, and implementations can be added based on parameters > like how the metadata partition is accessed and what type of storage > device houses the metadata. > > Signed-off-by: Sughosh Ganu > Reviewed-by: Patrick Delaunay > --- > Changes since V7: > * Rephrased the error message in fwu_update_active_index as per > suggestion from Ilias. > * Reworked the logic in fwu_get_image_alt_num() as per the suggestion > from Ilias. > > drivers/Kconfig | 2 + > drivers/Makefile | 1 + > drivers/fwu-mdata/Kconfig| 7 + > drivers/fwu-mdata/Makefile | 6 + > drivers/fwu-mdata/fwu-mdata-uclass.c | 463 +++ > include/dm/uclass-id.h | 1 + > include/fwu.h| 49 +++ > include/fwu_mdata.h | 67 > 8 files changed, 596 insertions(+) > create mode 100644 drivers/fwu-mdata/Kconfig > create mode 100644 drivers/fwu-mdata/Makefile > create mode 100644 drivers/fwu-mdata/fwu-mdata-uclass.c > create mode 100644 include/fwu.h > create mode 100644 include/fwu_mdata.h > > diff --git a/drivers/Kconfig b/drivers/Kconfig > index 8b6fead351..75ac149d31 100644 > --- a/drivers/Kconfig > +++ b/drivers/Kconfig > @@ -44,6 +44,8 @@ source "drivers/fuzz/Kconfig" > > source "drivers/fpga/Kconfig" > > +source "drivers/fwu-mdata/Kconfig" > + > source "drivers/gpio/Kconfig" > > source "drivers/hwspinlock/Kconfig" > diff --git a/drivers/Makefile b/drivers/Makefile > index eba9940231..70bbc2f5e0 100644 > --- a/drivers/Makefile > +++ b/drivers/Makefile > @@ -84,6 +84,7 @@ obj-y += cache/ > obj-$(CONFIG_CPU) += cpu/ > obj-y += crypto/ > obj-$(CONFIG_FASTBOOT) += fastboot/ > +obj-$(CONFIG_DM_FWU_MDATA) += fwu-mdata/ > obj-y += misc/ > obj-$(CONFIG_MMC) += mmc/ > obj-$(CONFIG_NVME) += nvme/ > diff --git a/drivers/fwu-mdata/Kconfig b/drivers/fwu-mdata/Kconfig > new file mode 100644 > index 00..d6a21c8e19 > --- /dev/null > +++ b/drivers/fwu-mdata/Kconfig > @@ -0,0 +1,7 @@ > +config DM_FWU_MDATA Please drop DM_ as there is no non-DM version > + bool "Driver support for accessing FWU Metadata" > + depends on DM > + help > + Enable support for accessing FWU Metadata partitions. The > + FWU Metadata partitions reside on the same storage device > + which contains the other FWU updatable firmware images. > diff --git a/drivers/fwu-mdata/Makefile b/drivers/fwu-mdata/Makefile > new file mode 100644 > index 00..e53a8c9983 > --- /dev/null > +++ b/drivers/fwu-mdata/Makefile > @@ -0,0 +1,6 @@ > +# SPDX-License-Identifier: GPL-2.0-or-later > +# > +# Copyright (c) 2022, Linaro Limited > +# > + > +obj-$(CONFIG_DM_FWU_MDATA) += fwu-mdata-uclass.o > diff --git a/drivers/fwu-mdata/fwu-mdata-uclass.c > b/drivers/fwu-mdata/fwu-mdata-uclass.c > new file mode 100644 > index 00..6bf7fa1b03 > --- /dev/null > +++ b/drivers/fwu-mdata/fwu-mdata-uclass.c > @@ -0,0 +1,463 @@ > +// SPDX-License-Identifier: GPL-2.0-or-later > +/* > + * Copyright (c) 2022, Linaro Limited > + */ > + > +#define LOG_CATEGORY UCLASS_FWU_MDATA > + > +#include > +#include > +#include > +#include > +#include > +#include > +#include > + > +#include > +#include > +#include > + > +#define IMAGE_ACCEPT_SET BIT(0) > +#define IMAGE_ACCEPT_CLEAR BIT(1) > + > +static int fwu_get_dev_ops(struct udevice **dev, > + const struct fwu_mdata_ops **ops) > +{ > + int ret; > + > + ret = uclass_get_device(UCLASS_FWU_MDATA, 0, dev); uclass_first_device() if there is only one > + if (ret) { > + log_debug("Cannot find fwu device\n"); > + return ret; > + } > + > + if ((*ops = device_get_ops(*dev)) == NULL) { > + log_debug("Cannot get fwu device ops\n"); > + return -ENOSYS; > + } This is actually a bug, so drop this. It is OK to have an assert() if you want one. > + > + return 0; > +} > + > +/** > + * fwu_verify_mdata() - Verify the FWU metadata > + * @mdata: FWU metadata structure > + * @pri_part: FWU metadata partition is primary or secondary > + * > + * Verify the FWU metadata by computing the CRC32 for the metadata > + * structure and comparing it against the CRC32 value stored as part > + * of the structure. > + * > + * Return: 0 if OK, -ve on error > + * > + */ > +int fwu_verify_mdata(struct fwu_mdata *mdata, bool pri_part) > +{ > + u32 calc_crc32; > + void *buf; > + > + buf = &mdata->version; > + calc_crc32 = crc32(0, buf, sizeof(*mdata) - sizeof(u32)); > + > + if
Re: [PATCH] Makefile: Unify condition for mpc85xx reset vector
On Wed, 3 Aug 2022 at 15:57, Pali Rohár wrote: > > Use 'CONFIG_MPC85XX_HAVE_RESET_VECTOR && CONFIG_OF_SEPARATE' pattern > instead of 'CONFIG_MPC85XX_HAVE_RESET_VECTOR && !CONFIG_OF_EMBED' also in > OBJCOPYFLAGS_u-boot-nodtb.bin as this pattern is used in rest of Makefile. > > Signed-off-by: Pali Rohár > --- > Makefile | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) Reviewed-by: Simon Glass Let's make a plan to move this to binman at some point. > > diff --git a/Makefile b/Makefile > index d659c8118cba..23bf0c8b1e62 100644 > --- a/Makefile > +++ b/Makefile > @@ -1267,7 +1267,7 @@ spl/u-boot-spl.srec: spl/u-boot-spl FORCE > > OBJCOPYFLAGS_u-boot-nodtb.bin := -O binary \ > $(if $(CONFIG_X86_16BIT_INIT),-R .start16 -R .resetvec) \ > - $(if $(CONFIG_MPC85XX_HAVE_RESET_VECTOR),$(if > $(CONFIG_OF_EMBED),,-R .bootpg -R .resetvec)) > + $(if $(CONFIG_MPC85XX_HAVE_RESET_VECTOR),$(if > $(CONFIG_OF_SEPARATE),-R .bootpg -R .resetvec)) > > binary_size_check: u-boot-nodtb.bin FORCE > @file_size=$(shell wc -c u-boot-nodtb.bin | awk '{print $$1}') ; \ > -- > 2.20.1 >
Re: [GIT PULL] please pull fsl-qoriq-2022-8-17
On 8/18/2022 6:40 AM, Tom Rini wrote: On Wed, Aug 17, 2022 at 02:26:32AM +, Peng Fan (OSS) wrote: Hi Tom, Please pull fsl-qoriq-2022-8-17 CI: https://source.denx.de/u-boot/custodians/u-boot-fsl-qoriq/-/pipelines/13155 First, applied to u-boot/master, thanks! Second, do you have any comment on the various layerscape platforms patches that have been posted of late? I plan to for example apply the ones to disable ethernet on some layerscape platforms soon. I am ok. Please directly apply those patches for now. I'll find someone to enable DM_ETH for LS platform later and enable ethernet then. Thanks, Peng.
[PATCH 3/3] arm: bcmbca: make bcm6753 driver depending on CONFIG_BCM6855
As CONFIG_ARCH_BCM6753 is replaced with CONFIG_BCM6855, update the driver Kconfig to use the new config symbol. Signed-off-by: William Zhang --- drivers/gpio/Kconfig | 2 +- drivers/led/Kconfig | 2 +- drivers/mtd/nand/raw/Kconfig | 2 +- drivers/watchdog/Kconfig | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/gpio/Kconfig b/drivers/gpio/Kconfig index 929f3fb9eacb..d8020de969ef 100644 --- a/drivers/gpio/Kconfig +++ b/drivers/gpio/Kconfig @@ -111,7 +111,7 @@ config BCM2835_GPIO config BCM6345_GPIO bool "BCM6345 GPIO driver" depends on DM_GPIO && (ARCH_BMIPS || BCM6856 || \ - BCM6858 || BCM63158 || ARCH_BCM6753) + BCM6858 || BCM63158 || BCM6855) help This driver supports the GPIO banks on BCM6345 SoCs. diff --git a/drivers/led/Kconfig b/drivers/led/Kconfig index 98f015a07f97..996b757e6d00 100644 --- a/drivers/led/Kconfig +++ b/drivers/led/Kconfig @@ -30,7 +30,7 @@ config LED_BCM6358 config LED_BCM6753 bool "LED Support for BCM6753" - depends on LED && ARCH_BCM6753 + depends on LED && BCM6855 help This option enables support for LEDs connected to the BCM6753 HW has blinking and fading capabilities and up to 32 LEDs can be controlled. diff --git a/drivers/mtd/nand/raw/Kconfig b/drivers/mtd/nand/raw/Kconfig index f8445e09633c..d6e3eeb3c093 100644 --- a/drivers/mtd/nand/raw/Kconfig +++ b/drivers/mtd/nand/raw/Kconfig @@ -97,7 +97,7 @@ config NAND_BRCMNAND_6368 config NAND_BRCMNAND_6753 bool "Support Broadcom NAND controller on bcm6753" - depends on NAND_BRCMNAND && ARCH_BCM6753 + depends on NAND_BRCMNAND && BCM6855 help Enable support for broadcom nand driver on bcm6753. diff --git a/drivers/watchdog/Kconfig b/drivers/watchdog/Kconfig index 84a4034fe87c..65f2d0821c60 100644 --- a/drivers/watchdog/Kconfig +++ b/drivers/watchdog/Kconfig @@ -129,7 +129,7 @@ config WDT_AT91 config WDT_BCM6345 bool "BCM6345 watchdog timer support" depends on WDT && (ARCH_BMIPS || BCM6856 || \ - BCM6858 || BCM63158 || ARCH_BCM6753) + BCM6858 || BCM63158 || BCM6855) help Select this to enable watchdog timer for BCM6345 SoCs. The watchdog timer is stopped when initialized. -- 2.37.1 smime.p7s Description: S/MIME Cryptographic Signature
[PATCH 2/3] arm: bcmbca: remove bcm6753 support under CONFIG_ARCH_BCM6753
BCM6753 is essentially same as the main chip BCM6855 but with different SKU number. Now that BCM6855 is supported under CONFIG_ARCH_BCMBCA and CONFIG_BCM6855, remove the original ARCH_BCM6753 support and migrate its configuration and dts settings. This includes: - Remove the bcm96753ref board folder. It is replaced by the generic bcmbca board folder. - Merge the 6753.dtsi setting to the new 6855.dtsi file. Update 96753ref board dts with the new compatible string. - Delete broadcom_bcm96763ref.h and merge its setting to the new bcm96855.h file. - Delete bcm96753ref_ram_defconfig and use a basic config version of bcm96855_defconfig Signed-off-by: William Zhang --- arch/arm/Kconfig | 8 - arch/arm/dts/Makefile| 6 +- arch/arm/dts/bcm6753.dtsi| 208 --- arch/arm/dts/bcm6855.dtsi| 137 +++ arch/arm/dts/bcm96753ref.dts | 6 +- board/broadcom/bcm96753ref/Kconfig | 16 -- board/broadcom/bcm96753ref/MAINTAINERS | 6 - board/broadcom/bcm96753ref/Makefile | 3 - board/broadcom/bcm96753ref/bcm96753ref.c | 40 - configs/bcm96753ref_ram_defconfig| 87 -- include/configs/bcm96855.h | 4 + include/configs/broadcom_bcm96753ref.h | 32 12 files changed, 146 insertions(+), 407 deletions(-) delete mode 100644 arch/arm/dts/bcm6753.dtsi delete mode 100644 board/broadcom/bcm96753ref/Kconfig delete mode 100644 board/broadcom/bcm96753ref/MAINTAINERS delete mode 100644 board/broadcom/bcm96753ref/Makefile delete mode 100644 board/broadcom/bcm96753ref/bcm96753ref.c delete mode 100644 configs/bcm96753ref_ram_defconfig delete mode 100644 include/configs/broadcom_bcm96753ref.h diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index 063616ff8d0b..c1f195e9d106 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig @@ -665,13 +665,6 @@ config ARCH_BCM283X imply CMD_DM imply FAT_WRITE -config ARCH_BCM6753 - bool "Broadcom BCM6753 family" - select CPU_V7A - select DM - select OF_CONTROL - imply CMD_DM - config ARCH_BCMSTB bool "Broadcom BCM7XXX family" select CPU_V7A @@ -2267,7 +2260,6 @@ source "board/Marvell/octeontx2/Kconfig" source "board/armltd/vexpress/Kconfig" source "board/armltd/vexpress64/Kconfig" source "board/cortina/presidio-asic/Kconfig" -source "board/broadcom/bcm96753ref/Kconfig" source "board/broadcom/bcmns3/Kconfig" source "board/cavium/thunderx/Kconfig" source "board/eets/pdu001/Kconfig" diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile index 5fd38cc63b63..8fba735cc8ab 100644 --- a/arch/arm/dts/Makefile +++ b/arch/arm/dts/Makefile @@ -1147,9 +1147,6 @@ dtb-$(CONFIG_ARCH_BCM283X) += \ bcm2837-rpi-cm3-io3.dtb \ bcm2711-rpi-4-b.dtb -dtb-$(CONFIG_ARCH_BCM6753) += \ - bcm96753ref.dtb - dtb-$(CONFIG_TARGET_BCMNS3) += ns3-board.dtb dtb-$(CONFIG_ARCH_BCMSTB) += bcm7xxx.dtb @@ -1177,7 +1174,8 @@ dtb-$(CONFIG_BCM6813) += \ dtb-$(CONFIG_BCM6846) += \ bcm96846.dtb dtb-$(CONFIG_BCM6855) += \ - bcm96855.dtb + bcm96855.dtb \ + bcm96753ref.dtb dtb-$(CONFIG_BCM6856) += \ bcm96856.dtb \ bcm968360bg.dtb diff --git a/arch/arm/dts/bcm6753.dtsi b/arch/arm/dts/bcm6753.dtsi deleted file mode 100644 index e88ab095c290.. --- a/arch/arm/dts/bcm6753.dtsi +++ /dev/null @@ -1,208 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0+ -/* - * Copyright (C) 2022 Philippe Reynes - */ - -#include "skeleton.dtsi" - -/ { - compatible = "brcm,bcm6753"; - #address-cells = <1>; - #size-cells = <1>; - - cpus { - #address-cells = <1>; - #size-cells = <0>; - u-boot,dm-pre-reloc; - - cpu0: cpu@0 { - compatible = "arm,cortex-a7"; - device_type = "cpu"; - reg = <0x0>; - next-level-cache = <&l2>; - u-boot,dm-pre-reloc; - }; - - cpu1: cpu@1 { - compatible = "arm,cortex-a7"; - device_type = "cpu"; - reg = <0x1>; - next-level-cache = <&l2>; - u-boot,dm-pre-reloc; - }; - - cpu2: cpu@2 { - compatible = "arm,cortex-a7"; - device_type = "cpu"; - reg = <0x2>; - next-level-cache = <&l2>; - u-boot,dm-pre-reloc; - }; - - l2: l2-cache0 { - compatible = "cache"; - u-boot,dm-pre-reloc; - }; - }; - - clocks { - compatible = "simple-bus"; - #address-cells = <1>; - #size-cells = <1>; - ranges; - u-boot,dm-pre-relo
[PATCH 1/3] arm: bcmbca: add bcm6855 SoC support under CONFIG_ARCH_BCMBCA
BCM6855 is a Broadcom ARM A7 based PON Gateway SoC. It is part of the BCA (Broadband Carrier Access origin) chipset family. Like other broadband SoC, this patch adds it under CONFIG_BCM6855 chip config and CONFIG_ARCH_BCMBCA platform config. This initial support includes a bare-bone implementation and dts with CPU subsystem, memory and ARM PL101 uart. This SoC is supported in the linux-next git repository so the dts and dtsi files are copied from linux. The u-boot image can be loaded from flash or network to the entry point address in the memory and boot from there to the console. Signed-off-by: William Zhang --- MAINTAINERS | 1 + arch/arm/dts/Makefile | 2 + arch/arm/dts/bcm6855.dtsi | 120 ++ arch/arm/dts/bcm96855.dts | 30 +++ arch/arm/mach-bcmbca/Kconfig | 8 ++ arch/arm/mach-bcmbca/Makefile | 1 + arch/arm/mach-bcmbca/bcm6855/Kconfig | 17 arch/arm/mach-bcmbca/bcm6855/Makefile | 5 ++ board/broadcom/bcmbca/Kconfig | 7 ++ configs/bcm96855_defconfig| 23 + include/configs/bcm96855.h| 11 +++ 11 files changed, 225 insertions(+) create mode 100644 arch/arm/dts/bcm6855.dtsi create mode 100644 arch/arm/dts/bcm96855.dts create mode 100644 arch/arm/mach-bcmbca/bcm6855/Kconfig create mode 100644 arch/arm/mach-bcmbca/bcm6855/Makefile create mode 100644 configs/bcm96855_defconfig create mode 100644 include/configs/bcm96855.h diff --git a/MAINTAINERS b/MAINTAINERS index 819fa5b87824..371e84de1bc1 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -230,6 +230,7 @@ N: bcm[9]?63178 N: bcm[9]?6756 N: bcm[9]?6813 N: bcm[9]?6846 +N: bcm[9]?6855 N: bcm[9]?6856 N: bcm[9]?6858 N: bcm[9]?6878 diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile index 07e6130042f5..5fd38cc63b63 100644 --- a/arch/arm/dts/Makefile +++ b/arch/arm/dts/Makefile @@ -1176,6 +1176,8 @@ dtb-$(CONFIG_BCM6813) += \ bcm96813.dtb dtb-$(CONFIG_BCM6846) += \ bcm96846.dtb +dtb-$(CONFIG_BCM6855) += \ + bcm96855.dtb dtb-$(CONFIG_BCM6856) += \ bcm96856.dtb \ bcm968360bg.dtb diff --git a/arch/arm/dts/bcm6855.dtsi b/arch/arm/dts/bcm6855.dtsi new file mode 100644 index ..620f51aee1a2 --- /dev/null +++ b/arch/arm/dts/bcm6855.dtsi @@ -0,0 +1,120 @@ +// SPDX-License-Identifier: (GPL-2.0+ OR MIT) +/* + * Copyright 2022 Broadcom Ltd. + */ + +#include +#include + +/ { + compatible = "brcm,bcm6855", "brcm,bcmbca"; + #address-cells = <1>; + #size-cells = <1>; + + interrupt-parent = <&gic>; + + cpus { + #address-cells = <1>; + #size-cells = <0>; + + CA7_0: cpu@0 { + device_type = "cpu"; + compatible = "arm,cortex-a7"; + reg = <0x0>; + next-level-cache = <&L2_0>; + enable-method = "psci"; + }; + + CA7_1: cpu@1 { + device_type = "cpu"; + compatible = "arm,cortex-a7"; + reg = <0x1>; + next-level-cache = <&L2_0>; + enable-method = "psci"; + }; + + CA7_2: cpu@2 { + device_type = "cpu"; + compatible = "arm,cortex-a7"; + reg = <0x2>; + next-level-cache = <&L2_0>; + enable-method = "psci"; + }; + + L2_0: l2-cache0 { + compatible = "cache"; + }; + }; + + timer { + compatible = "arm,armv7-timer"; + interrupts = , + , + , + ; + arm,cpu-registers-not-fw-configured; + }; + + pmu: pmu { + compatible = "arm,cortex-a7-pmu"; + interrupts = , + , + ; + interrupt-affinity = <&CA7_0>, <&CA7_1>, <&CA7_2>; + }; + + clocks: clocks { + periph_clk: periph-clk { + compatible = "fixed-clock"; + #clock-cells = <0>; + clock-frequency = <2>; + }; + + uart_clk: uart-clk { + compatible = "fixed-factor-clock"; + #clock-cells = <0>; + clocks = <&periph_clk>; + clock-div = <4>; + clock-mult = <1>; + }; + }; + + psci { + compatible = "arm,psci-0.2"; + method = "smc"; + }; + + axi@8100 { + compatible = "simple-bus"; + #address-cells = <1>; + #size-cells = <1>; +
[PATCH 0/3] arm: bcmbca: move bcm6753 support under CONFIG_ARCH_BCMBCA
BCM6753 is essentially same as the main chip BCM6855 with different SKU number. It is part of the Broadcom BCA (Broadband Carrier Access origin) chipset family. BCM6753 was originally added by Philippe before Broadcom started to upstream the support for BCMBCA SoCs. The ARM based broadband SoC family is now supported under the unified ARCH_BCMBCA config. This patch series migrate the BCM6753 support under the config of ARCH_BCMBCA and BCM6855. This patch series need to apply on top of my previous patch series [1]. This concludes the addition of BCA SoC support to u-boot at least for now. [1]: https://lists.denx.de/pipermail/u-boot/2022-August/492082.html William Zhang (3): arm: bcmbca: add bcm6855 SoC support under CONFIG_ARCH_BCMBCA arm: bcmbca: remove bcm6753 support under CONFIG_ARCH_BCM6753 arm: bcmbca: make bcm6753 driver depending on CONFIG_BCM6855 MAINTAINERS | 1 + arch/arm/Kconfig | 8 - arch/arm/dts/Makefile| 6 +- arch/arm/dts/bcm6753.dtsi| 208 -- arch/arm/dts/bcm6855.dtsi| 257 +++ arch/arm/dts/bcm96753ref.dts | 6 +- arch/arm/dts/bcm96855.dts| 30 +++ arch/arm/mach-bcmbca/Kconfig | 8 + arch/arm/mach-bcmbca/Makefile| 1 + arch/arm/mach-bcmbca/bcm6855/Kconfig | 17 ++ arch/arm/mach-bcmbca/bcm6855/Makefile| 5 + board/broadcom/bcm96753ref/Kconfig | 16 -- board/broadcom/bcm96753ref/MAINTAINERS | 6 - board/broadcom/bcm96753ref/Makefile | 3 - board/broadcom/bcm96753ref/bcm96753ref.c | 40 board/broadcom/bcmbca/Kconfig| 7 + configs/bcm96753ref_ram_defconfig| 87 configs/bcm96855_defconfig | 23 ++ drivers/gpio/Kconfig | 2 +- drivers/led/Kconfig | 2 +- drivers/mtd/nand/raw/Kconfig | 2 +- drivers/watchdog/Kconfig | 2 +- include/configs/bcm96855.h | 15 ++ include/configs/broadcom_bcm96753ref.h | 32 --- 24 files changed, 374 insertions(+), 410 deletions(-) delete mode 100644 arch/arm/dts/bcm6753.dtsi create mode 100644 arch/arm/dts/bcm6855.dtsi create mode 100644 arch/arm/dts/bcm96855.dts create mode 100644 arch/arm/mach-bcmbca/bcm6855/Kconfig create mode 100644 arch/arm/mach-bcmbca/bcm6855/Makefile delete mode 100644 board/broadcom/bcm96753ref/Kconfig delete mode 100644 board/broadcom/bcm96753ref/MAINTAINERS delete mode 100644 board/broadcom/bcm96753ref/Makefile delete mode 100644 board/broadcom/bcm96753ref/bcm96753ref.c delete mode 100644 configs/bcm96753ref_ram_defconfig create mode 100644 configs/bcm96855_defconfig create mode 100644 include/configs/bcm96855.h delete mode 100644 include/configs/broadcom_bcm96753ref.h -- 2.37.1 smime.p7s Description: S/MIME Cryptographic Signature
[PATCH 3/3] arm: bcmbca: make bcm6858 driver depending on CONFIG_BCM6858
As CONFIG_ARCH_BCM6858 is replaced with CONFIG_BCM6858, update the driver Kconfig to use the new config symbol. Signed-off-by: William Zhang --- drivers/gpio/Kconfig | 3 +-- drivers/led/Kconfig | 2 +- drivers/mtd/nand/raw/Kconfig | 2 +- drivers/spi/Kconfig | 3 +-- drivers/watchdog/Kconfig | 3 +-- 5 files changed, 5 insertions(+), 8 deletions(-) diff --git a/drivers/gpio/Kconfig b/drivers/gpio/Kconfig index 9e00b48234ab..929f3fb9eacb 100644 --- a/drivers/gpio/Kconfig +++ b/drivers/gpio/Kconfig @@ -111,8 +111,7 @@ config BCM2835_GPIO config BCM6345_GPIO bool "BCM6345 GPIO driver" depends on DM_GPIO && (ARCH_BMIPS || BCM6856 || \ - ARCH_BCM6858 || BCM63158 || \ - ARCH_BCM6753) + BCM6858 || BCM63158 || ARCH_BCM6753) help This driver supports the GPIO banks on BCM6345 SoCs. diff --git a/drivers/led/Kconfig b/drivers/led/Kconfig index bd8f23fd9631..98f015a07f97 100644 --- a/drivers/led/Kconfig +++ b/drivers/led/Kconfig @@ -37,7 +37,7 @@ config LED_BCM6753 config LED_BCM6858 bool "LED Support for BCM6858" - depends on LED && (BCM6856 || ARCH_BCM6858 || BCM63158) + depends on LED && (BCM6856 || BCM6858 || BCM63158) help This option enables support for LEDs connected to the BCM6858 HW has blinking capabilities and up to 32 LEDs can be controlled. diff --git a/drivers/mtd/nand/raw/Kconfig b/drivers/mtd/nand/raw/Kconfig index 5d006ca1ea07..f8445e09633c 100644 --- a/drivers/mtd/nand/raw/Kconfig +++ b/drivers/mtd/nand/raw/Kconfig @@ -115,7 +115,7 @@ config NAND_BRCMNAND_6838 config NAND_BRCMNAND_6858 bool "Support Broadcom NAND controller on bcm6858" - depends on NAND_BRCMNAND && ARCH_BCM6858 + depends on NAND_BRCMNAND && BCM6858 help Enable support for broadcom nand driver on bcm6858. diff --git a/drivers/spi/Kconfig b/drivers/spi/Kconfig index 978e5c86a420..e815a715f9b2 100644 --- a/drivers/spi/Kconfig +++ b/drivers/spi/Kconfig @@ -91,8 +91,7 @@ config ATMEL_SPI config BCM63XX_HSSPI bool "BCM63XX HSSPI driver" - depends on (ARCH_BMIPS || BCM6856 || \ - ARCH_BCM6858 || BCM63158) + depends on (ARCH_BMIPS || BCM6856 || BCM6858 || BCM63158) help Enable the BCM6328 HSSPI driver. This driver can be used to access the SPI NOR flash on platforms embedding this Broadcom diff --git a/drivers/watchdog/Kconfig b/drivers/watchdog/Kconfig index 6d559515b78b..84a4034fe87c 100644 --- a/drivers/watchdog/Kconfig +++ b/drivers/watchdog/Kconfig @@ -129,8 +129,7 @@ config WDT_AT91 config WDT_BCM6345 bool "BCM6345 watchdog timer support" depends on WDT && (ARCH_BMIPS || BCM6856 || \ - ARCH_BCM6858 || BCM63158 || \ - ARCH_BCM6753) + BCM6858 || BCM63158 || ARCH_BCM6753) help Select this to enable watchdog timer for BCM6345 SoCs. The watchdog timer is stopped when initialized. -- 2.37.1 smime.p7s Description: S/MIME Cryptographic Signature
[PATCH 2/3] arm: bcmbca: remove bcm6858 support under CONFIG_ARCH_BCM6858
Now that BCM6858 is supported under CONFIG_ARCH_BCMBCA and CONFIG_BCM6858, remove the original ARCH_BCM6858 support and migrate its configuration and dts settings. This includes: - Remove the bcm968580xref board folder. It is replaced by the generic bcmbca board folder. - Update bcm968580xref board dts with the new compatible string. - Delete broadcom_bcm968580xref.h and merge its setting to the new bcm96858.h file. - Remove bcm968580xref_ram_defconfig as a basic config version of bcm96858_defconfig is now added. Signed-off-by: William Zhang --- arch/arm/Kconfig | 7 --- arch/arm/dts/Makefile| 6 +- arch/arm/dts/bcm968580xref.dts | 4 +- board/broadcom/bcm968580xref/Kconfig | 17 -- board/broadcom/bcm968580xref/MAINTAINERS | 6 -- board/broadcom/bcm968580xref/Makefile| 3 - board/broadcom/bcm968580xref/bcm968580xref.c | 62 --- configs/bcm968580xref_ram_defconfig | 64 include/configs/bcm96858.h | 4 ++ include/configs/broadcom_bcm968580xref.h | 32 -- 10 files changed, 8 insertions(+), 197 deletions(-) delete mode 100644 board/broadcom/bcm968580xref/Kconfig delete mode 100644 board/broadcom/bcm968580xref/MAINTAINERS delete mode 100644 board/broadcom/bcm968580xref/Makefile delete mode 100644 board/broadcom/bcm968580xref/bcm968580xref.c delete mode 100644 configs/bcm968580xref_ram_defconfig delete mode 100644 include/configs/broadcom_bcm968580xref.h diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index 3f124ab0ce85..063616ff8d0b 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig @@ -672,12 +672,6 @@ config ARCH_BCM6753 select OF_CONTROL imply CMD_DM -config ARCH_BCM6858 - bool "Broadcom BCM6858 family" - select DM - select OF_CONTROL - imply CMD_DM - config ARCH_BCMSTB bool "Broadcom BCM7XXX family" select CPU_V7A @@ -2274,7 +2268,6 @@ source "board/armltd/vexpress/Kconfig" source "board/armltd/vexpress64/Kconfig" source "board/cortina/presidio-asic/Kconfig" source "board/broadcom/bcm96753ref/Kconfig" -source "board/broadcom/bcm968580xref/Kconfig" source "board/broadcom/bcmns3/Kconfig" source "board/cavium/thunderx/Kconfig" source "board/eets/pdu001/Kconfig" diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile index ee3475b97a40..07e6130042f5 100644 --- a/arch/arm/dts/Makefile +++ b/arch/arm/dts/Makefile @@ -1150,9 +1150,6 @@ dtb-$(CONFIG_ARCH_BCM283X) += \ dtb-$(CONFIG_ARCH_BCM6753) += \ bcm96753ref.dtb -dtb-$(CONFIG_ARCH_BCM6858) += \ - bcm968580xref.dtb - dtb-$(CONFIG_TARGET_BCMNS3) += ns3-board.dtb dtb-$(CONFIG_ARCH_BCMSTB) += bcm7xxx.dtb @@ -1183,7 +1180,8 @@ dtb-$(CONFIG_BCM6856) += \ bcm96856.dtb \ bcm968360bg.dtb dtb-$(CONFIG_BCM6858) += \ - bcm96858.dtb + bcm96858.dtb \ + bcm968580xref.dtb dtb-$(CONFIG_BCM6878) += \ bcm96878.dtb diff --git a/arch/arm/dts/bcm968580xref.dts b/arch/arm/dts/bcm968580xref.dts index a034e38318bd..6d787bd011b8 100644 --- a/arch/arm/dts/bcm968580xref.dts +++ b/arch/arm/dts/bcm968580xref.dts @@ -8,8 +8,8 @@ #include "bcm6858.dtsi" / { - model = "Broadcom bcm68580xref"; - compatible = "broadcom,bcm68580xref", "brcm,bcm6858"; + model = "Broadcom BCM968580xref Reference Board"; + compatible = "brcm,bcm968580xref", "brcm,bcm6858", "brcm,bcmbca"; aliases { serial0 = &uart0; diff --git a/board/broadcom/bcm968580xref/Kconfig b/board/broadcom/bcm968580xref/Kconfig deleted file mode 100644 index b5730367a2d2.. --- a/board/broadcom/bcm968580xref/Kconfig +++ /dev/null @@ -1,17 +0,0 @@ -if ARCH_BCM6858 - -config SYS_VENDOR - default "broadcom" - -config SYS_BOARD - default "bcm968580xref" - -config SYS_CONFIG_NAME - default "broadcom_bcm968580xref" - -endif - -config TARGET_BCM968580XREF - bool "Support Broadcom bcm968580xref" - depends on ARCH_BCM6858 - select ARM64 diff --git a/board/broadcom/bcm968580xref/MAINTAINERS b/board/broadcom/bcm968580xref/MAINTAINERS deleted file mode 100644 index 5ee0c4dd4e42.. --- a/board/broadcom/bcm968580xref/MAINTAINERS +++ /dev/null @@ -1,6 +0,0 @@ -BCM968580XREF BOARD -M: Philippe Reynes -S: Maintained -F: board/broadcom/bcm968580xref/ -F: include/configs/broadcom_bcm968580xref.h -F: configs/bcm968580xref_ram_defconfig diff --git a/board/broadcom/bcm968580xref/Makefile b/board/broadcom/bcm968580xref/Makefile deleted file mode 100644 index 5cd393b19629.. --- a/board/broadcom/bcm968580xref/Makefile +++ /dev/null @@ -1,3 +0,0 @@ -# SPDX-License-Identifier: GPL-2.0+ - -obj-y += bcm968580xref.o diff --git a/board/broadcom/bcm968580xref/bcm968580xref.c b/board/broadcom/bcm968580xref/bcm968580xref.c deleted file mode 100644 index 1bd723d49edd.. --- a/board/broadcom/bcm968580xref
[PATCH 1/3] arm: bcmbca: add bcm6858 SoC support under CONFIG_ARCH_BCMBCA
BCM6858 is a Broadcom B53 based PON Gateway SoC. It is part of the BCA (Broadband Carrier Access origin) chipset family. Like other broadband SoC, this patch adds it under CONFIG_BCM6858 chip config and CONFIG_ARCH_BCMBCA platform config. This initial support includes a bare-bone implementation and the original dts is updated with the one from linux next git repository. The u-boot image can be loaded from flash or network to the entry point address in the memory and boot from there to the console. Signed-off-by: William Zhang --- MAINTAINERS | 1 + arch/arm/dts/Makefile| 2 + arch/arm/dts/bcm6858.dtsi| 197 ++- arch/arm/dts/bcm96858.dts| 30 arch/arm/mach-bcmbca/Kconfig | 8 + arch/arm/mach-bcmbca/Makefile| 1 + arch/arm/mach-bcmbca/bcm6858/Kconfig | 17 ++ arch/arm/mach-bcmbca/bcm6858/Makefile| 5 + arch/arm/mach-bcmbca/bcm6858/mmu_table.c | 32 board/broadcom/bcmbca/Kconfig| 7 + configs/bcm96858_defconfig | 23 +++ include/configs/bcm96858.h | 11 ++ 12 files changed, 255 insertions(+), 79 deletions(-) create mode 100644 arch/arm/dts/bcm96858.dts create mode 100644 arch/arm/mach-bcmbca/bcm6858/Kconfig create mode 100644 arch/arm/mach-bcmbca/bcm6858/Makefile create mode 100644 arch/arm/mach-bcmbca/bcm6858/mmu_table.c create mode 100644 configs/bcm96858_defconfig create mode 100644 include/configs/bcm96858.h diff --git a/MAINTAINERS b/MAINTAINERS index 1f50dad583ce..819fa5b87824 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -231,6 +231,7 @@ N: bcm[9]?6756 N: bcm[9]?6813 N: bcm[9]?6846 N: bcm[9]?6856 +N: bcm[9]?6858 N: bcm[9]?6878 ARM BROADCOM BCMSTB diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile index a0ea9fa6029d..ee3475b97a40 100644 --- a/arch/arm/dts/Makefile +++ b/arch/arm/dts/Makefile @@ -1182,6 +1182,8 @@ dtb-$(CONFIG_BCM6846) += \ dtb-$(CONFIG_BCM6856) += \ bcm96856.dtb \ bcm968360bg.dtb +dtb-$(CONFIG_BCM6858) += \ + bcm96858.dtb dtb-$(CONFIG_BCM6878) += \ bcm96878.dtb diff --git a/arch/arm/dts/bcm6858.dtsi b/arch/arm/dts/bcm6858.dtsi index 02225621710b..19c4dd6fa7e4 100644 --- a/arch/arm/dts/bcm6858.dtsi +++ b/arch/arm/dts/bcm6858.dtsi @@ -1,122 +1,161 @@ // SPDX-License-Identifier: GPL-2.0+ /* * Copyright (C) 2018 Philippe Reynes + * Copyright 2022 Broadcom Ltd. */ -#include "skeleton64.dtsi" +#include +#include / { - compatible = "brcm,bcm6858"; + compatible = "brcm,bcm6858", "brcm,bcmbca"; #address-cells = <2>; #size-cells = <2>; - aliases { - spi0 = &hsspi; - }; + interrupt-parent = <&gic>; cpus { #address-cells = <2>; #size-cells = <0>; - u-boot,dm-pre-reloc; - cpu0: cpu@0 { - compatible = "arm,cortex-a53", "arm,armv8"; + B53_0: cpu@0 { + compatible = "brcm,brahma-b53"; device_type = "cpu"; reg = <0x0 0x0>; - next-level-cache = <&l2>; - u-boot,dm-pre-reloc; + next-level-cache = <&L2_0>; + enable-method = "psci"; }; - cpu1: cpu@1 { - compatible = "arm,cortex-a53", "arm,armv8"; + B53_1: cpu@1 { + compatible = "brcm,brahma-b53"; device_type = "cpu"; reg = <0x0 0x1>; - next-level-cache = <&l2>; - u-boot,dm-pre-reloc; + next-level-cache = <&L2_0>; + enable-method = "psci"; }; - cpu2: cpu@2 { - compatible = "arm,cortex-a53", "arm,armv8"; + B53_2: cpu@2 { + compatible = "brcm,brahma-b53"; device_type = "cpu"; reg = <0x0 0x2>; - next-level-cache = <&l2>; - u-boot,dm-pre-reloc; + next-level-cache = <&L2_0>; + enable-method = "psci"; }; - cpu3: cpu@3 { - compatible = "arm,cortex-a53", "arm,armv8"; + B53_3: cpu@3 { + compatible = "brcm,brahma-b53"; device_type = "cpu"; reg = <0x0 0x3>; - next-level-cache = <&l2>; - u-boot,dm-pre-reloc; + next-level-cache = <&L2_0>; + enable-method = "psci"; }; - l2: l2-cache0 { + L2_0: l2-cache0 { compatible = "cache";
[PATCH 0/3] arm: bcmbca: move bcm6858 support under CONFIG_ARCH_BCMBCA BCM6858 is
part of the Broadcom BCA (Broadband Carrier Access origin) chipset family. BCM6858 was originally added by Philippe before Broadcom started to upstream the support for BCMBCA SoCs. The ARM based Broadband SoC family is now supported under the unified ARCH_BCMBCA config. This patch series migrate the BCM6858 support under the config of ARCH_BCMBCA and BCM6858. This patch series need to apply on top of my previous patch series [1]. [1]: https://lists.denx.de/pipermail/u-boot/2022-August/492078.html William Zhang (3): arm: bcmbca: add bcm6858 SoC support under CONFIG_ARCH_BCMBCA arm: bcmbca: remove bcm6858 support under CONFIG_ARCH_BCM6858 arm: bcmbca: make bcm6858 driver depending on CONFIG_BCM6858 MAINTAINERS | 1 + arch/arm/Kconfig | 7 - arch/arm/dts/Makefile| 6 +- arch/arm/dts/bcm6858.dtsi| 197 +++ arch/arm/dts/bcm96858.dts| 30 +++ arch/arm/dts/bcm968580xref.dts | 4 +- arch/arm/mach-bcmbca/Kconfig | 8 + arch/arm/mach-bcmbca/Makefile| 1 + arch/arm/mach-bcmbca/bcm6858/Kconfig | 17 ++ arch/arm/mach-bcmbca/bcm6858/Makefile| 5 + arch/arm/mach-bcmbca/bcm6858/mmu_table.c | 32 +++ board/broadcom/bcm968580xref/Kconfig | 17 -- board/broadcom/bcm968580xref/MAINTAINERS | 6 - board/broadcom/bcm968580xref/Makefile| 3 - board/broadcom/bcm968580xref/bcm968580xref.c | 62 -- board/broadcom/bcmbca/Kconfig| 7 + configs/bcm968580xref_ram_defconfig | 64 -- configs/bcm96858_defconfig | 23 +++ drivers/gpio/Kconfig | 3 +- drivers/led/Kconfig | 2 +- drivers/mtd/nand/raw/Kconfig | 2 +- drivers/spi/Kconfig | 3 +- drivers/watchdog/Kconfig | 3 +- include/configs/bcm96858.h | 15 ++ include/configs/broadcom_bcm968580xref.h | 32 --- 25 files changed, 267 insertions(+), 283 deletions(-) create mode 100644 arch/arm/dts/bcm96858.dts create mode 100644 arch/arm/mach-bcmbca/bcm6858/Kconfig create mode 100644 arch/arm/mach-bcmbca/bcm6858/Makefile create mode 100644 arch/arm/mach-bcmbca/bcm6858/mmu_table.c delete mode 100644 board/broadcom/bcm968580xref/Kconfig delete mode 100644 board/broadcom/bcm968580xref/MAINTAINERS delete mode 100644 board/broadcom/bcm968580xref/Makefile delete mode 100644 board/broadcom/bcm968580xref/bcm968580xref.c delete mode 100644 configs/bcm968580xref_ram_defconfig create mode 100644 configs/bcm96858_defconfig create mode 100644 include/configs/bcm96858.h delete mode 100644 include/configs/broadcom_bcm968580xref.h -- 2.37.1 smime.p7s Description: S/MIME Cryptographic Signature
[PATCH v3 3/3] arm: bcmbca: make bcm68360 driver depending on CONFIG_BCM6856
As CONFIG_ARCH_BCM68360 is replaced with CONFIG_BCM6856, update the driver Kconfig to use the new config symbol Signed-off-by: William Zhang --- (no changes since v1) drivers/gpio/Kconfig | 2 +- drivers/led/Kconfig | 2 +- drivers/mtd/nand/raw/Kconfig | 2 +- drivers/spi/Kconfig | 2 +- drivers/watchdog/Kconfig | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/gpio/Kconfig b/drivers/gpio/Kconfig index 83f4f5089992..9e00b48234ab 100644 --- a/drivers/gpio/Kconfig +++ b/drivers/gpio/Kconfig @@ -110,7 +110,7 @@ config BCM2835_GPIO config BCM6345_GPIO bool "BCM6345 GPIO driver" - depends on DM_GPIO && (ARCH_BMIPS || ARCH_BCM68360 || \ + depends on DM_GPIO && (ARCH_BMIPS || BCM6856 || \ ARCH_BCM6858 || BCM63158 || \ ARCH_BCM6753) help diff --git a/drivers/led/Kconfig b/drivers/led/Kconfig index d777414dda8d..bd8f23fd9631 100644 --- a/drivers/led/Kconfig +++ b/drivers/led/Kconfig @@ -37,7 +37,7 @@ config LED_BCM6753 config LED_BCM6858 bool "LED Support for BCM6858" - depends on LED && (ARCH_BCM68360 || ARCH_BCM6858 || BCM63158) + depends on LED && (BCM6856 || ARCH_BCM6858 || BCM63158) help This option enables support for LEDs connected to the BCM6858 HW has blinking capabilities and up to 32 LEDs can be controlled. diff --git a/drivers/mtd/nand/raw/Kconfig b/drivers/mtd/nand/raw/Kconfig index 24c27b6ecf7f..5d006ca1ea07 100644 --- a/drivers/mtd/nand/raw/Kconfig +++ b/drivers/mtd/nand/raw/Kconfig @@ -103,7 +103,7 @@ config NAND_BRCMNAND_6753 config NAND_BRCMNAND_68360 bool "Support Broadcom NAND controller on bcm68360" - depends on NAND_BRCMNAND && ARCH_BCM68360 + depends on NAND_BRCMNAND && BCM6856 help Enable support for broadcom nand driver on bcm68360. diff --git a/drivers/spi/Kconfig b/drivers/spi/Kconfig index 0a666eee80e7..978e5c86a420 100644 --- a/drivers/spi/Kconfig +++ b/drivers/spi/Kconfig @@ -91,7 +91,7 @@ config ATMEL_SPI config BCM63XX_HSSPI bool "BCM63XX HSSPI driver" - depends on (ARCH_BMIPS || ARCH_BCM68360 || \ + depends on (ARCH_BMIPS || BCM6856 || \ ARCH_BCM6858 || BCM63158) help Enable the BCM6328 HSSPI driver. This driver can be used to diff --git a/drivers/watchdog/Kconfig b/drivers/watchdog/Kconfig index ff4d1ee530d2..6d559515b78b 100644 --- a/drivers/watchdog/Kconfig +++ b/drivers/watchdog/Kconfig @@ -128,7 +128,7 @@ config WDT_AT91 config WDT_BCM6345 bool "BCM6345 watchdog timer support" - depends on WDT && (ARCH_BMIPS || ARCH_BCM68360 || \ + depends on WDT && (ARCH_BMIPS || BCM6856 || \ ARCH_BCM6858 || BCM63158 || \ ARCH_BCM6753) help -- 2.37.1 smime.p7s Description: S/MIME Cryptographic Signature
[PATCH v3 2/3] arm: bcmbca: remove bcm68360 support under CONFIG_ARCH_BCM68360
BCM68360 is a variant within the BCM6856 chip family. Now that BCM6856 is supported under CONFIG_ARCH_BCMBCA and CONFIG_BCM6856, remove the original ARCH_BCM68360 support and migrate its configuration and dts settings. This includes: - Remove the bcm968360bg board folder. It is replaced by the generic bcmbca board folder. - Merge the 68360.dtsi setting to the new 6856.dtsi file. Update board dts with the new compatible string. - Merge broadcom_bcm968360bg.h setting to the new bcm96856.h file. - Remove bcm968360bg_ram_defconfig as a basic config version of bcm96856_defconfig is now added. Signed-off-by: William Zhang --- Changes in v3: - Remove bcm968360bg_ram_defconfig per discussion with Philippe as a basic config version of bcm96856_defconfig is now added. - Update commit message Changes in v2: - Bring Philippe Reynes copyright tag from 68360 dts to 6856 dts arch/arm/Kconfig | 7 - arch/arm/dts/Makefile| 6 +- arch/arm/dts/bcm68360.dtsi | 217 --- arch/arm/dts/bcm6856.dtsi| 150 arch/arm/dts/bcm968360bg.dts | 6 +- board/broadcom/bcm968360bg/Kconfig | 17 -- board/broadcom/bcm968360bg/MAINTAINERS | 6 - board/broadcom/bcm968360bg/Makefile | 3 - board/broadcom/bcm968360bg/bcm968360bg.c | 62 --- configs/bcm968360bg_ram_defconfig| 63 --- include/configs/bcm96856.h | 4 + include/configs/broadcom_bcm968360bg.h | 32 12 files changed, 159 insertions(+), 414 deletions(-) delete mode 100644 arch/arm/dts/bcm68360.dtsi delete mode 100644 board/broadcom/bcm968360bg/Kconfig delete mode 100644 board/broadcom/bcm968360bg/MAINTAINERS delete mode 100644 board/broadcom/bcm968360bg/Makefile delete mode 100644 board/broadcom/bcm968360bg/bcm968360bg.c delete mode 100644 configs/bcm968360bg_ram_defconfig delete mode 100644 include/configs/broadcom_bcm968360bg.h diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index da4defa08466..3f124ab0ce85 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig @@ -672,12 +672,6 @@ config ARCH_BCM6753 select OF_CONTROL imply CMD_DM -config ARCH_BCM68360 - bool "Broadcom BCM68360 family" - select DM - select OF_CONTROL - imply CMD_DM - config ARCH_BCM6858 bool "Broadcom BCM6858 family" select DM @@ -2280,7 +2274,6 @@ source "board/armltd/vexpress/Kconfig" source "board/armltd/vexpress64/Kconfig" source "board/cortina/presidio-asic/Kconfig" source "board/broadcom/bcm96753ref/Kconfig" -source "board/broadcom/bcm968360bg/Kconfig" source "board/broadcom/bcm968580xref/Kconfig" source "board/broadcom/bcmns3/Kconfig" source "board/cavium/thunderx/Kconfig" diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile index a32bdf8c9f17..a0ea9fa6029d 100644 --- a/arch/arm/dts/Makefile +++ b/arch/arm/dts/Makefile @@ -1147,9 +1147,6 @@ dtb-$(CONFIG_ARCH_BCM283X) += \ bcm2837-rpi-cm3-io3.dtb \ bcm2711-rpi-4-b.dtb -dtb-$(CONFIG_ARCH_BCM68360) += \ - bcm968360bg.dtb - dtb-$(CONFIG_ARCH_BCM6753) += \ bcm96753ref.dtb @@ -1183,7 +1180,8 @@ dtb-$(CONFIG_BCM6813) += \ dtb-$(CONFIG_BCM6846) += \ bcm96846.dtb dtb-$(CONFIG_BCM6856) += \ - bcm96856.dtb + bcm96856.dtb \ + bcm968360bg.dtb dtb-$(CONFIG_BCM6878) += \ bcm96878.dtb diff --git a/arch/arm/dts/bcm68360.dtsi b/arch/arm/dts/bcm68360.dtsi deleted file mode 100644 index 7bbe207794eb.. --- a/arch/arm/dts/bcm68360.dtsi +++ /dev/null @@ -1,217 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0+ -/* - * Copyright (C) 2020 Philippe Reynes - */ - -#include "skeleton64.dtsi" - -/ { - compatible = "brcm,bcm68360"; - #address-cells = <2>; - #size-cells = <2>; - - aliases { - spi0 = &hsspi; - }; - - cpus { - #address-cells = <2>; - #size-cells = <0>; - u-boot,dm-pre-reloc; - - cpu0: cpu@0 { - compatible = "arm,cortex-a53", "arm,armv8"; - device_type = "cpu"; - reg = <0x0 0x0>; - next-level-cache = <&l2>; - u-boot,dm-pre-reloc; - }; - - cpu1: cpu@1 { - compatible = "arm,cortex-a53", "arm,armv8"; - device_type = "cpu"; - reg = <0x0 0x1>; - next-level-cache = <&l2>; - u-boot,dm-pre-reloc; - }; - - l2: l2-cache0 { - compatible = "cache"; - u-boot,dm-pre-reloc; - }; - }; - - clocks { - compatible = "simple-bus"; - #address-cells = <2>; - #size-cells = <2>; - ranges; - u-boot,dm-pre-reloc; - -
[PATCH v3 1/3] arm: bcmbca: add bcm6856 SoC support under CONFIG_ARCH_BCMBCA
BCM6856 is a Broadcom B53 based PON Gateway SoC. It is part of the BCA (Broadband Carrier Access origin) chipset family. Like other Broadband SoC, this patch adds it under CONFIG_BCM6856 chip config and CONFIG_ARCH_BCMBCA platform config. This initial support includes a bare-bone implementation and dts with CPU subsystem, memory and Broadcom uart. This SoC is supported in the linux-next git repository so the dts and dtsi files are copied from linux. The u-boot image can be loaded from flash or network to the entry point address in the memory and boot from there to the console. Signed-off-by: William Zhang --- (no changes since v1) MAINTAINERS | 1 + arch/arm/dts/Makefile| 2 + arch/arm/dts/bcm6856.dtsi| 103 +++ arch/arm/dts/bcm96856.dts| 30 +++ arch/arm/mach-bcmbca/Kconfig | 8 ++ arch/arm/mach-bcmbca/Makefile| 1 + arch/arm/mach-bcmbca/bcm6856/Kconfig | 17 arch/arm/mach-bcmbca/bcm6856/Makefile| 5 ++ arch/arm/mach-bcmbca/bcm6856/mmu_table.c | 32 +++ board/broadcom/bcmbca/Kconfig| 7 ++ configs/bcm96856_defconfig | 23 + include/configs/bcm96856.h | 11 +++ 12 files changed, 240 insertions(+) create mode 100644 arch/arm/dts/bcm6856.dtsi create mode 100644 arch/arm/dts/bcm96856.dts create mode 100644 arch/arm/mach-bcmbca/bcm6856/Kconfig create mode 100644 arch/arm/mach-bcmbca/bcm6856/Makefile create mode 100644 arch/arm/mach-bcmbca/bcm6856/mmu_table.c create mode 100644 configs/bcm96856_defconfig create mode 100644 include/configs/bcm96856.h diff --git a/MAINTAINERS b/MAINTAINERS index d0a5b2352cc8..1f50dad583ce 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -230,6 +230,7 @@ N: bcm[9]?63178 N: bcm[9]?6756 N: bcm[9]?6813 N: bcm[9]?6846 +N: bcm[9]?6856 N: bcm[9]?6878 ARM BROADCOM BCMSTB diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile index c55bc3569662..a32bdf8c9f17 100644 --- a/arch/arm/dts/Makefile +++ b/arch/arm/dts/Makefile @@ -1182,6 +1182,8 @@ dtb-$(CONFIG_BCM6813) += \ bcm96813.dtb dtb-$(CONFIG_BCM6846) += \ bcm96846.dtb +dtb-$(CONFIG_BCM6856) += \ + bcm96856.dtb dtb-$(CONFIG_BCM6878) += \ bcm96878.dtb diff --git a/arch/arm/dts/bcm6856.dtsi b/arch/arm/dts/bcm6856.dtsi new file mode 100644 index ..0bce6497219f --- /dev/null +++ b/arch/arm/dts/bcm6856.dtsi @@ -0,0 +1,103 @@ +// SPDX-License-Identifier: (GPL-2.0+ OR MIT) +/* + * Copyright 2022 Broadcom Ltd. + */ + +#include +#include + +/ { + compatible = "brcm,bcm6856", "brcm,bcmbca"; + #address-cells = <2>; + #size-cells = <2>; + + interrupt-parent = <&gic>; + + cpus { + #address-cells = <2>; + #size-cells = <0>; + + B53_0: cpu@0 { + compatible = "brcm,brahma-b53"; + device_type = "cpu"; + reg = <0x0 0x0>; + next-level-cache = <&L2_0>; + enable-method = "psci"; + }; + + B53_1: cpu@1 { + compatible = "brcm,brahma-b53"; + device_type = "cpu"; + reg = <0x0 0x1>; + next-level-cache = <&L2_0>; + enable-method = "psci"; + }; + + L2_0: l2-cache0 { + compatible = "cache"; + }; + }; + + timer { + compatible = "arm,armv8-timer"; + interrupts = , + , + , + ; + }; + + pmu: pmu { + compatible = "arm,cortex-a53-pmu"; + interrupts = , + ; + interrupt-affinity = <&B53_0>, <&B53_1>; + }; + + clocks: clocks { + periph_clk:periph-clk { + compatible = "fixed-clock"; + #clock-cells = <0>; + clock-frequency = <2>; + }; + }; + + psci { + compatible = "arm,psci-0.2"; + method = "smc"; + }; + + axi@8100 { + compatible = "simple-bus"; + #address-cells = <1>; + #size-cells = <1>; + ranges = <0x0 0x0 0x8100 0x8000>; + + gic: interrupt-controller@1000 { + compatible = "arm,gic-400"; + #interrupt-cells = <3>; + interrupt-controller; + reg = <0x1000 0x1000>, /* GICD */ + <0x2000 0x2000>, /* GICC */ + <0x4000 0x2000>, /* GICH */ + <0x6000 0x2000>; /* GICV */ + interrupts = ; +
[PATCH v3 0/3] arm: bcmbca: move bcm68360 support under CONFIG_ARCH_BCMBCA
BCM68360 is a variant for the main PON chip BCM6856 which is part of the Broadcom BCA (Broadband Carrier Access origin) chipset family. BCM68360 was originally added by Philippe before Broadcom started to upstream the support for BCMBCA SoCs. The ARM based Broadband SoC family is now supported under the unified ARCH_BCMBCA config. This patch series migrate the BCM68360 support under the config of ARCH_BCMBCA and BCM6856. This patch series need to apply on top of my previous patch series [1]. [1]: https://lists.denx.de/pipermail/u-boot/2022-August/492072.html Changes in v3: - Remove bcm968360bg_ram_defconfig per discussion with Philippe as a basic config version of bcm96856_defconfig is now added. - Update commit message Changes in v2: - Bring Philippe Reynes copyright tag from 68360 dts to 6856 dts William Zhang (3): arm: bcmbca: add bcm6856 SoC support under CONFIG_ARCH_BCMBCA arm: bcmbca: remove bcm68360 support under CONFIG_ARCH_BCM68360 arm: bcmbca: make bcm68360 driver depending on CONFIG_BCM6856 MAINTAINERS | 1 + arch/arm/Kconfig | 7 - arch/arm/dts/Makefile| 6 +- arch/arm/dts/bcm68360.dtsi | 217 --- arch/arm/dts/bcm6856.dtsi| 253 +++ arch/arm/dts/bcm968360bg.dts | 6 +- arch/arm/dts/bcm96856.dts| 30 +++ arch/arm/mach-bcmbca/Kconfig | 8 + arch/arm/mach-bcmbca/Makefile| 1 + arch/arm/mach-bcmbca/bcm6856/Kconfig | 17 ++ arch/arm/mach-bcmbca/bcm6856/Makefile| 5 + arch/arm/mach-bcmbca/bcm6856/mmu_table.c | 32 +++ board/broadcom/bcm968360bg/Kconfig | 17 -- board/broadcom/bcm968360bg/MAINTAINERS | 6 - board/broadcom/bcm968360bg/Makefile | 3 - board/broadcom/bcm968360bg/bcm968360bg.c | 62 -- board/broadcom/bcmbca/Kconfig| 7 + configs/bcm968360bg_ram_defconfig| 63 -- configs/bcm96856_defconfig | 23 +++ drivers/gpio/Kconfig | 2 +- drivers/led/Kconfig | 2 +- drivers/mtd/nand/raw/Kconfig | 2 +- drivers/spi/Kconfig | 2 +- drivers/watchdog/Kconfig | 2 +- include/configs/bcm96856.h | 15 ++ include/configs/broadcom_bcm968360bg.h | 32 --- 26 files changed, 403 insertions(+), 418 deletions(-) delete mode 100644 arch/arm/dts/bcm68360.dtsi create mode 100644 arch/arm/dts/bcm6856.dtsi create mode 100644 arch/arm/dts/bcm96856.dts create mode 100644 arch/arm/mach-bcmbca/bcm6856/Kconfig create mode 100644 arch/arm/mach-bcmbca/bcm6856/Makefile create mode 100644 arch/arm/mach-bcmbca/bcm6856/mmu_table.c delete mode 100644 board/broadcom/bcm968360bg/Kconfig delete mode 100644 board/broadcom/bcm968360bg/MAINTAINERS delete mode 100644 board/broadcom/bcm968360bg/Makefile delete mode 100644 board/broadcom/bcm968360bg/bcm968360bg.c delete mode 100644 configs/bcm968360bg_ram_defconfig create mode 100644 configs/bcm96856_defconfig create mode 100644 include/configs/bcm96856.h delete mode 100644 include/configs/broadcom_bcm968360bg.h -- 2.37.1 smime.p7s Description: S/MIME Cryptographic Signature
[PATCH v2 5/5] arm: bcmbca: make reset_cpu function weak
BCM63158 carries the CONFIG_SYSRESET from the original configuration. It provide reset_cpu function already so need to define weak version of the dummy reset_cpu for other BCMBCA SoCs to avoid linking error. Signed-off-by: William Zhang --- (no changes since v1) board/broadcom/bcmbca/board.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/board/broadcom/bcmbca/board.c b/board/broadcom/bcmbca/board.c index 4aa1d659d5c7..811236afae6e 100644 --- a/board/broadcom/bcmbca/board.c +++ b/board/broadcom/bcmbca/board.c @@ -30,6 +30,6 @@ int print_cpuinfo(void) return 0; } -void reset_cpu(ulong addr) +__weak void reset_cpu(ulong addr) { } -- 2.37.1 smime.p7s Description: S/MIME Cryptographic Signature
[PATCH v2 4/5] MAINTAINERS: Add BCM63158 maintainer to BCMBCA entry
Since ARCH_BCM63158 SoC support is merged into ARCH_BCMBCA, add BCM63158 maintainer Philippe to bcmbca maintainer list. Signed-off-by: William Zhang --- (no changes since v1) MAINTAINERS | 1 + 1 file changed, 1 insertion(+) diff --git a/MAINTAINERS b/MAINTAINERS index 5b219d62f6bf..d0a5b2352cc8 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -213,6 +213,7 @@ M: Anand Gore M: William Zhang M: Kursad Oney M: Joel Peshkin +M: Philippe Reynes S: Maintained F: arch/arm/mach-bcmbca/ F: board/broadcom/bcmbca/ -- 2.37.1 smime.p7s Description: S/MIME Cryptographic Signature
[PATCH v2 2/5] arm: bcmbca: remove bcm63158 support under CONFIG_ARCH_BCM63158
Now that BCM63158 is supported under CONFIG_ARCH_BCMBCA and CONFIG_BCM63158, remove the original ARCH_BCM63158 support and migrate configuration settings. Signed-off-by: William Zhang --- Changes in v2: - Remove bcm963158_ram_defconfig per discussion with Philippe as a basic config version of bcm963158_defconfig is now added. arch/arm/Kconfig | 8 +--- arch/arm/dts/Makefile| 3 -- board/broadcom/bcm963158/Kconfig | 17 --- board/broadcom/bcm963158/MAINTAINERS | 6 --- board/broadcom/bcm963158/Makefile| 3 -- board/broadcom/bcm963158/bcm963158.c | 62 - configs/bcm963158_ram_defconfig | 67 include/configs/bcm963158.h | 4 ++ include/configs/broadcom_bcm963158.h | 32 - 9 files changed, 5 insertions(+), 197 deletions(-) delete mode 100644 board/broadcom/bcm963158/Kconfig delete mode 100644 board/broadcom/bcm963158/MAINTAINERS delete mode 100644 board/broadcom/bcm963158/Makefile delete mode 100644 board/broadcom/bcm963158/bcm963158.c delete mode 100644 configs/bcm963158_ram_defconfig delete mode 100644 include/configs/broadcom_bcm963158.h diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index 0d4903a2eb5b..da4defa08466 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig @@ -665,12 +665,6 @@ config ARCH_BCM283X imply CMD_DM imply FAT_WRITE -config ARCH_BCM63158 - bool "Broadcom BCM63158 family" - select DM - select OF_CONTROL - imply CMD_DM - config ARCH_BCM6753 bool "Broadcom BCM6753 family" select CPU_V7A @@ -706,6 +700,7 @@ config ARCH_BCMBCA bool "Broadcom broadband chip family" select DM select OF_CONTROL + imply CMD_DM config TARGET_VEXPRESS_CA9X4 bool "Support vexpress_ca9x4" @@ -2284,7 +2279,6 @@ source "board/Marvell/octeontx2/Kconfig" source "board/armltd/vexpress/Kconfig" source "board/armltd/vexpress64/Kconfig" source "board/cortina/presidio-asic/Kconfig" -source "board/broadcom/bcm963158/Kconfig" source "board/broadcom/bcm96753ref/Kconfig" source "board/broadcom/bcm968360bg/Kconfig" source "board/broadcom/bcm968580xref/Kconfig" diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile index a7fc3d7d7021..c55bc3569662 100644 --- a/arch/arm/dts/Makefile +++ b/arch/arm/dts/Makefile @@ -1147,9 +1147,6 @@ dtb-$(CONFIG_ARCH_BCM283X) += \ bcm2837-rpi-cm3-io3.dtb \ bcm2711-rpi-4-b.dtb -dtb-$(CONFIG_ARCH_BCM63158) += \ - bcm963158.dtb - dtb-$(CONFIG_ARCH_BCM68360) += \ bcm968360bg.dtb diff --git a/board/broadcom/bcm963158/Kconfig b/board/broadcom/bcm963158/Kconfig deleted file mode 100644 index 08a8bc1c14d3.. --- a/board/broadcom/bcm963158/Kconfig +++ /dev/null @@ -1,17 +0,0 @@ -if TARGET_BCM963158 - -config SYS_VENDOR - default "broadcom" - -config SYS_BOARD - default "bcm963158" - -config SYS_CONFIG_NAME - default "broadcom_bcm963158" - -endif - -config TARGET_BCM963158 - bool "Support Broadcom bcm963158" - depends on ARCH_BCM63158 - select ARM64 diff --git a/board/broadcom/bcm963158/MAINTAINERS b/board/broadcom/bcm963158/MAINTAINERS deleted file mode 100644 index d28d971f9d36.. --- a/board/broadcom/bcm963158/MAINTAINERS +++ /dev/null @@ -1,6 +0,0 @@ -BROADCOM BCM963158 -M: Philippe Reynes -S: Maintained -F: board/broadcom/bcm963158/ -F: include/configs/broadcom_bcm963158.h -F: configs/bcm963158_ram_defconfig diff --git a/board/broadcom/bcm963158/Makefile b/board/broadcom/bcm963158/Makefile deleted file mode 100644 index 0a902c9cf618.. --- a/board/broadcom/bcm963158/Makefile +++ /dev/null @@ -1,3 +0,0 @@ -# SPDX-License-Identifier: GPL-2.0+ - -obj-y += bcm963158.o diff --git a/board/broadcom/bcm963158/bcm963158.c b/board/broadcom/bcm963158/bcm963158.c deleted file mode 100644 index 9feaee3c0fc4.. --- a/board/broadcom/bcm963158/bcm963158.c +++ /dev/null @@ -1,62 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0+ -/* - * Copyright (C) 2019 Philippe Reynes - */ - -#include -#include -#include -#include - -#ifdef CONFIG_ARM64 -#include - -static struct mm_region broadcom_bcm963158_mem_map[] = { - { - /* RAM */ - .virt = 0xUL, - .phys = 0xUL, - .size = 8UL * SZ_1G, - .attrs = PTE_BLOCK_MEMTYPE(MT_NORMAL) | -PTE_BLOCK_INNER_SHARE - }, { - /* SoC */ - .virt = 0x8000UL, - .phys = 0x8000UL, - .size = 0xff8000UL, - .attrs = PTE_BLOCK_MEMTYPE(MT_DEVICE_NGNRNE) | -PTE_BLOCK_NON_SHARE | -PTE_BLOCK_PXN | PTE_BLOCK_UXN - }, { - /* List terminator */ - 0, - } -}; - -struct mm_region *mem_map = broadcom_bcm963158_mem_map; -#endif - -int board_
[PATCH v2 3/5] arm: bcmbca: make bcm63158 driver depending on CONFIG_BCM63158
As CONFIG_ARCH_BCM63158 is replaced with CONFIG_BCM63158, update the driver Kconfig to use the new config symbol Signed-off-by: William Zhang --- (no changes since v1) drivers/gpio/Kconfig | 2 +- drivers/led/Kconfig | 2 +- drivers/mtd/nand/raw/Kconfig | 2 +- drivers/spi/Kconfig | 2 +- drivers/watchdog/Kconfig | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/gpio/Kconfig b/drivers/gpio/Kconfig index aaa152fae73b..83f4f5089992 100644 --- a/drivers/gpio/Kconfig +++ b/drivers/gpio/Kconfig @@ -111,7 +111,7 @@ config BCM2835_GPIO config BCM6345_GPIO bool "BCM6345 GPIO driver" depends on DM_GPIO && (ARCH_BMIPS || ARCH_BCM68360 || \ - ARCH_BCM6858 || ARCH_BCM63158 || \ + ARCH_BCM6858 || BCM63158 || \ ARCH_BCM6753) help This driver supports the GPIO banks on BCM6345 SoCs. diff --git a/drivers/led/Kconfig b/drivers/led/Kconfig index ccdd7d7395c8..d777414dda8d 100644 --- a/drivers/led/Kconfig +++ b/drivers/led/Kconfig @@ -37,7 +37,7 @@ config LED_BCM6753 config LED_BCM6858 bool "LED Support for BCM6858" - depends on LED && (ARCH_BCM68360 || ARCH_BCM6858 || ARCH_BCM63158) + depends on LED && (ARCH_BCM68360 || ARCH_BCM6858 || BCM63158) help This option enables support for LEDs connected to the BCM6858 HW has blinking capabilities and up to 32 LEDs can be controlled. diff --git a/drivers/mtd/nand/raw/Kconfig b/drivers/mtd/nand/raw/Kconfig index ce67d1abde25..24c27b6ecf7f 100644 --- a/drivers/mtd/nand/raw/Kconfig +++ b/drivers/mtd/nand/raw/Kconfig @@ -121,7 +121,7 @@ config NAND_BRCMNAND_6858 config NAND_BRCMNAND_63158 bool "Support Broadcom NAND controller on bcm63158" - depends on NAND_BRCMNAND && ARCH_BCM63158 + depends on NAND_BRCMNAND && BCM63158 help Enable support for broadcom nand driver on bcm63158. diff --git a/drivers/spi/Kconfig b/drivers/spi/Kconfig index 75b794548b22..0a666eee80e7 100644 --- a/drivers/spi/Kconfig +++ b/drivers/spi/Kconfig @@ -92,7 +92,7 @@ config ATMEL_SPI config BCM63XX_HSSPI bool "BCM63XX HSSPI driver" depends on (ARCH_BMIPS || ARCH_BCM68360 || \ - ARCH_BCM6858 || ARCH_BCM63158) + ARCH_BCM6858 || BCM63158) help Enable the BCM6328 HSSPI driver. This driver can be used to access the SPI NOR flash on platforms embedding this Broadcom diff --git a/drivers/watchdog/Kconfig b/drivers/watchdog/Kconfig index 50e6a1efba51..ff4d1ee530d2 100644 --- a/drivers/watchdog/Kconfig +++ b/drivers/watchdog/Kconfig @@ -129,7 +129,7 @@ config WDT_AT91 config WDT_BCM6345 bool "BCM6345 watchdog timer support" depends on WDT && (ARCH_BMIPS || ARCH_BCM68360 || \ - ARCH_BCM6858 || ARCH_BCM63158 || \ + ARCH_BCM6858 || BCM63158 || \ ARCH_BCM6753) help Select this to enable watchdog timer for BCM6345 SoCs. -- 2.37.1 smime.p7s Description: S/MIME Cryptographic Signature
[PATCH v2 1/5] arm: bcmbca: add bcm63158 SoC support under CONFIG_ARCH_BCMBCA
BCM63158 is a Broadcom B53 based DSL Gateway SoC. It is part of the BCA (Broadband Carrier Access origin) chipset family. Like other Broadband SoC, this patch adds it under CONFIG_BCM63158 chip config and CONFIG_ARCH_BCMBCA platform config. This initial support includes a bare-bone implementation and dts with CPU subsystem, memory and ARM PL011 uart. This SoC is supported in the linux-next git repository so the dts and dtsi files are copied from linux. The u-boot image can be loaded from flash or network to the entry point address in the memory and boot from there to the console. Signed-off-by: William Zhang --- Changes in v2: - Remove extra nodes from bcm963158.dts and keep it as a generic minimun board support dts following other BCA chip convention. MAINTAINERS | 1 + arch/arm/dts/Makefile | 2 + arch/arm/dts/bcm63158.dtsi| 207 +- arch/arm/dts/bcm963158.dts| 121 + arch/arm/mach-bcmbca/Kconfig | 8 + arch/arm/mach-bcmbca/Makefile | 1 + arch/arm/mach-bcmbca/bcm63158/Kconfig | 17 ++ arch/arm/mach-bcmbca/bcm63158/Makefile| 5 + arch/arm/mach-bcmbca/bcm63158/mmu_table.c | 32 board/broadcom/bcmbca/Kconfig | 7 + configs/bcm963158_defconfig | 23 +++ include/configs/bcm963158.h | 11 ++ 12 files changed, 239 insertions(+), 196 deletions(-) create mode 100644 arch/arm/mach-bcmbca/bcm63158/Kconfig create mode 100644 arch/arm/mach-bcmbca/bcm63158/Makefile create mode 100644 arch/arm/mach-bcmbca/bcm63158/mmu_table.c create mode 100644 configs/bcm963158_defconfig create mode 100644 include/configs/bcm963158.h diff --git a/MAINTAINERS b/MAINTAINERS index 3f250942ced1..5b219d62f6bf 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -224,6 +224,7 @@ N: bcm[9]?4912 N: bcm[9]?63138 N: bcm[9]?63146 N: bcm[9]?63148 +N: bcm[9]?63158 N: bcm[9]?63178 N: bcm[9]?6756 N: bcm[9]?6813 diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile index 9a6582d9c1c8..a7fc3d7d7021 100644 --- a/arch/arm/dts/Makefile +++ b/arch/arm/dts/Makefile @@ -1175,6 +1175,8 @@ dtb-$(CONFIG_BCM63146) += \ bcm963146.dtb dtb-$(CONFIG_BCM63148) += \ bcm963148.dtb +dtb-$(CONFIG_BCM63158) += \ + bcm963158.dtb dtb-$(CONFIG_BCM63178) += \ bcm963178.dtb dtb-$(CONFIG_BCM6756) += \ diff --git a/arch/arm/dts/bcm63158.dtsi b/arch/arm/dts/bcm63158.dtsi index 7dd285843849..8b179ba0fca8 100644 --- a/arch/arm/dts/bcm63158.dtsi +++ b/arch/arm/dts/bcm63158.dtsi @@ -1,122 +1,167 @@ // SPDX-License-Identifier: GPL-2.0+ /* * Copyright (C) 2019 Philippe Reynes + * Copyright 2022 Broadcom Ltd. */ -#include "skeleton64.dtsi" +#include +#include / { - compatible = "brcm,bcm63158"; + compatible = "brcm,bcm63158", "brcm,bcmbca"; #address-cells = <2>; #size-cells = <2>; - aliases { - spi0 = &hsspi; - }; + interrupt-parent = <&gic>; cpus { #address-cells = <2>; #size-cells = <0>; - u-boot,dm-pre-reloc; - cpu0: cpu@0 { - compatible = "arm,cortex-a53", "arm,armv8"; + B53_0: cpu@0 { + compatible = "brcm,brahma-b53"; device_type = "cpu"; reg = <0x0 0x0>; - next-level-cache = <&l2>; - u-boot,dm-pre-reloc; + next-level-cache = <&L2_0>; + enable-method = "psci"; }; - cpu1: cpu@1 { - compatible = "arm,cortex-a53", "arm,armv8"; + B53_1: cpu@1 { + compatible = "brcm,brahma-b53"; device_type = "cpu"; reg = <0x0 0x1>; - next-level-cache = <&l2>; - u-boot,dm-pre-reloc; + next-level-cache = <&L2_0>; + enable-method = "psci"; }; - cpu2: cpu@2 { - compatible = "arm,cortex-a53", "arm,armv8"; + B53_2: cpu@2 { + compatible = "brcm,brahma-b53"; device_type = "cpu"; reg = <0x0 0x2>; - next-level-cache = <&l2>; - u-boot,dm-pre-reloc; + next-level-cache = <&L2_0>; + enable-method = "psci"; }; - cpu3: cpu@3 { - compatible = "arm,cortex-a53", "arm,armv8"; + B53_3: cpu@3 { + compatible = "brcm,brahma-b53"; device_type = "cpu"; reg = <0x0 0x3>; - next-level-cache = <&l2>; -
[PATCH v2 0/5] arm: bcmbca: move bcm63158 support under CONFIG_ARCH_BCMBCA
BCM63158 is one of the Broadcom Broadband origin DSL Gateway router SoC. It was originally added by Philippe before Broadcom started to upstream the support for broadband SoCs. The ARM based Broadcom Broadband SoC family is now supported under the same ARCH_BCMBCA config. This patch series migrate the BCM63158 support to ARCH_BCMBCA. This patch series need to apply on top of my previous patch series [1]. [1]: https://lists.denx.de/pipermail/u-boot/2022-August/491061.html Changes in v2: - Remove extra nodes from bcm963158.dts and keep it as a generic minimun board support dts following other BCA chip convention. - Remove bcm963158_ram_defconfig per discussion with Philippe as a basic config version of bcm963158_defconfig is now added. William Zhang (5): arm: bcmbca: add bcm63158 SoC support under CONFIG_ARCH_BCMBCA arm: bcmbca: remove bcm63158 support under CONFIG_ARCH_BCM63158 arm: bcmbca: make bcm63158 driver depending on CONFIG_BCM63158 MAINTAINERS: Add BCM63158 maintainer to BCMBCA entry arm: bcmbca: make reset_cpu function weak MAINTAINERS | 2 + arch/arm/Kconfig | 8 +- arch/arm/dts/Makefile | 5 +- arch/arm/dts/bcm63158.dtsi| 207 +- arch/arm/dts/bcm963158.dts| 121 + arch/arm/mach-bcmbca/Kconfig | 8 + arch/arm/mach-bcmbca/Makefile | 1 + arch/arm/mach-bcmbca/bcm63158/Kconfig | 17 ++ arch/arm/mach-bcmbca/bcm63158/Makefile| 5 + arch/arm/mach-bcmbca/bcm63158/mmu_table.c | 32 board/broadcom/bcm963158/Kconfig | 17 -- board/broadcom/bcm963158/MAINTAINERS | 6 - board/broadcom/bcm963158/Makefile | 3 - board/broadcom/bcm963158/bcm963158.c | 62 --- board/broadcom/bcmbca/Kconfig | 7 + board/broadcom/bcmbca/board.c | 2 +- configs/bcm963158_defconfig | 23 +++ configs/bcm963158_ram_defconfig | 67 --- drivers/gpio/Kconfig | 2 +- drivers/led/Kconfig | 2 +- drivers/mtd/nand/raw/Kconfig | 2 +- drivers/spi/Kconfig | 2 +- drivers/watchdog/Kconfig | 2 +- include/configs/bcm963158.h | 15 ++ include/configs/broadcom_bcm963158.h | 32 25 files changed, 251 insertions(+), 399 deletions(-) create mode 100644 arch/arm/mach-bcmbca/bcm63158/Kconfig create mode 100644 arch/arm/mach-bcmbca/bcm63158/Makefile create mode 100644 arch/arm/mach-bcmbca/bcm63158/mmu_table.c delete mode 100644 board/broadcom/bcm963158/Kconfig delete mode 100644 board/broadcom/bcm963158/MAINTAINERS delete mode 100644 board/broadcom/bcm963158/Makefile delete mode 100644 board/broadcom/bcm963158/bcm963158.c create mode 100644 configs/bcm963158_defconfig delete mode 100644 configs/bcm963158_ram_defconfig create mode 100644 include/configs/bcm963158.h delete mode 100644 include/configs/broadcom_bcm963158.h -- 2.37.1 smime.p7s Description: S/MIME Cryptographic Signature
Re: [PATCH 2/2] Makefile: Build final mpc85xx non-SPL image in standard file u-boot.bin
Hi, On Wed, 17 Aug 2022 at 15:07, Pali Rohár wrote: > > On Wednesday 03 August 2022 13:28:01 Pali Rohár wrote: > > On Monday 01 August 2022 19:15:46 Tom Rini wrote: > > > On Mon, Aug 01, 2022 at 09:39:00PM +0200, Pali Rohár wrote: > > > > On Monday 01 August 2022 13:13:22 Simon Glass wrote: > > > > > Hi Pali, > > > > > > > > > > On Mon, 1 Aug 2022 at 09:43, Pali Rohár wrote: > > > > > > > > > > > > Currently Makefile produces final mpc85xx image when SPL is not > > > > > > used in > > > > > > custom file u-boot-with-dtb.bin. It is quite confusing name as build > > > > > > process produce also intermediate file standard file u-boot-dtb.bin > > > > > > (which > > > > > > is just intermediate and not bootable). Other platforms use > > > > > > u-boot.bin > > > > > > (UBOOT_BIN) as standard name for final bootable raw image. > > > > > > > > > > > > So change Makefile rules and binman to produce final bootable file > > > > > > for > > > > > > mpc85xx also into file u-boot.bin. There is just need for mpc85xx > > > > > > to not > > > > > > define default rule for u-boot.bin then instruct binman (via DTS > > > > > > file) to > > > > > > store final image into u-boot.bin (instead of u-boot-with-dtb.bin) > > > > > > and > > > > > > finally rename target u-boot-with-dtb.bin to u-boot.bin. > > > > > > > > > > > > With this change are also removed custom Makefile hacks for mpc85xx > > > > > > that it > > > > > > produced non-standard output file. And also updated documentation. > > > > > > > > > > > > Signed-off-by: Pali Rohár > > > > > > --- > > > > > > Makefile | 19 +-- > > > > > > arch/powerpc/dts/kmcent2-u-boot.dtsi | 2 +- > > > > > > arch/powerpc/dts/u-boot.dtsi | 2 +- > > > > > > board/freescale/p1_p2_rdb_pc/README | 2 +- > > > > > > board/freescale/p2041rdb/README | 3 --- > > > > > > board/freescale/t102xrdb/README | 2 +- > > > > > > board/freescale/t104xrdb/README | 2 +- > > > > > > board/freescale/t208xqds/README | 2 +- > > > > > > board/freescale/t208xrdb/README | 2 +- > > > > > > 9 files changed, 12 insertions(+), 24 deletions(-) > > > > > > > > > > At present u-boot.bin has a very standard meaning - it is U-Boot with > > > > > the DT. > > > > > > > > > > Boards which need something more than that can/should use binman to > > > > > create a separate file. > > > > > > > > > > I certainly agree that u-boot-with-dtb.bin is a terrible name, though. > > > > > Something more descriptive would be better. > > > > > > > > > > But is it possible to drop these SoC-specific rules in the Makefile > > > > > and just build everything needed in the standard binman rule in the > > > > > Makefile? > > > > > > > > > > Regards, > > > > > Simon > > > > > > > > I do not know what is binman doing and how to use it. I just do not see > > > > reason why it is needed to use such additional tool for building final > > > > binary for powerpc/mpc85xx as other arm boards do not use it at all. > > > > > > > > Ad your comment "At present u-boot.bin has a very standard meaning - it > > > > is U-Boot with the DT." - This is exactly what binman for mpc85xx > > > > produces. > > > > > > > > So I see there could be improvements, but as a first step this my patch > > > > should be enough? > > > > > > So, one of the issues with PowerPC stuff is that much of it is so far > > > behind the rest of U-Boot in terms of frameworks. So yes, let us start > > > by fixing the functional problem you're describing here and then see > > > what appetite exists for further work here. > > > > > > -- > > > Tom > > > > Ok, so these two patches in this patch series is a starting point. > > > > Now I send another patch which does another cleanup in this area: > > https://patchwork.ozlabs.org/project/uboot/patch/20220803112442.4735-1-p...@kernel.org/ > > PING? I'm not sure what to say here and will leave it to Tom. - Simon
Re: Fwd: [PATCH] [RFC] cmd: i2c: fix default address len for DM_I2C
Hi Nicolas, On Wed, 17 Aug 2022 at 13:50, Nicolas IOOSS wrote: > > Hello all, > > On Tue, Aug 16, 2022 at 1:47 PM Simon Glass wrote: > > > > Hi Tim, > > > > On Tue, 16 Aug 2022 at 13:50, Tim Harvey wrote: > > > > > > On Mon, Aug 15, 2022 at 3:16 PM Simon Glass wrote: > > > > > > > > Hi Tim, > > > > > > > > On Mon, 15 Aug 2022 at 11:48, Tim Harvey wrote: > > > > > > > > > > On Sat, Aug 13, 2022 at 7:59 AM Simon Glass wrote: > > > > > > > > > > > > Hi Tim, > > > > > > > > > > > > On Thu, 11 Aug 2022 at 11:57, Tim Harvey > > > > > > wrote: > > > > > > > > > > > > > > According to the comment block "The default {addr} parameter is > > > > > > > one byte > > > > > > > (.1) which works well for memories and registers with 8 bits of > > > > > > > address > > > > > > > space." > > > > > > > > > > > > > > While this is true for legacy I2C a default length of -1 is being > > > > > > > passed > > > > > > > for DM_I2C which results in a usage error. > > > > > > > > > > > > > > Restore the documented behavior by always using a default alen of > > > > > > > 1. > > > > > > > > > > > > > > Signed-off-by: Tim Harvey > > > > > > > > > > > > > > This is an RFC as I'm unclear if we want to restore the legacy > > > > > > > usage or > > > > > > > enforce a new usage (in which case the comment block should be > > > > > > > updated) > > > > > > > and I'm not clear if this is documented in other places. If the > > > > > > > decision > > > > > > > is to enforce a new usage then it is unclear to me how to > > > > > > > specifiy the > > > > > > > default alen as there is no command for that (i2c alen [len]?). > > > > > > > --- > > > > > > > cmd/i2c.c | 10 -- > > > > > > > 1 file changed, 10 deletions(-) > > > > > > > > > > > > > > > > > > > Can you dig into this a little more on your board? DEFAULT_ADDR_LEN > > > > > > is > > > > > > set to -1 so that by default it does not get set by the command, and > > > > > > the existing alen is used. > > > > > > > > > > > > This is necessary for driver model, since the alen can be set by the > > > > > > peripheral device and we don't want to overwrite it: > > > > > > > > > > > > if (!ret && alen != -1) > > > > > > ret = i2c_set_chip_offset_len(dev, alen); > > > > > > > > > > > > > > > > Simon, > > > > > > > > > > Here's some annotated debug prints added where chip_offset is > > > > > passed/set: > > > > > Model: Gateworks Venice GW73xx-0x i.MX8MM Development Kit > > > > > DRAM: 1 GiB > > > > > i2c_chip_of_to_plat gsc@20 offset_len=1 > > > > > i2c_chip_of_to_plat pmic@69 offset_len=1 > > > > > i2c_get_chip i2c@30a2 0x51 offset_len=1 > > > > > i2c_bind_driver i2c@30a2 offset_len=1 > > > > > i2c_set_chip_offset_len generic_51 offset_len=1 > > > > > dm_i2c_read generic_51 offset=0 offset_len=1 > > > > > i2c_setup_offset 0x51 offset=0 offset_len=1 > > > > > Core: 209 devices, 27 uclasses, devicetree: separate > > > > > ... > > > > > u-boot=> i2c dev 0 && i2c md 0x51 0 50 > > > > > Setting bus to 0 > > > > > i2c - I2C sub-system > > > > > > > > > > Usage: > > > > > i2c bus [muxtype:muxaddr:muxchannel] - show I2C bus info > > > > > ... > > > > > > > > > > So the chip I noticed this issue with is 0x51 which an atmel,24c02 > > > > > compatible eeprom which imx8mm-venice-gw700x.dtsi defines 4 of > > > > > (i2c1-0x50, i2c1-0x51, i2c1-0x52, i2c1-0x53). You can see above > > > > > i2c1-0x51 (i2c1=i2c@30a2) is accessed early as it holds the board > > > > > model information and at that point in time it's accessed with alen=1 > > > > > (which I specify in board/gateworks/venice/eeprom.c:eeprom_read()) but > > > > > by the time the 'i2c md 0x51 0 50' comes around > > > > > i2c_get_chip_offset_len() returns 0 for this device. The other eeprom > > > > > devices on i2c1 are never accessed by a driver so they would never > > > > > have a 'default' alen set. > > > > > > > > OK I see, > > > > > > > > > > > > > > Where is the initial setting of alen supposed to have come? > > > > > > > > The "u-boot,i2c-offset-len" property in the device tree. > > > > > > > > > > Simon, > > > > > > I see what happened here. The issue is caused by commit 8f8c04bf1ebbd > > > ("i2c: fix stack buffer overflow vulnerability in i2c md command") > > > which changed alen from int to uint (yet its still getting set to > > > DEFAULT_ADDR_LEN which is -1) thus the 'if (alen > 3)' now returns > > > CMD_RET_USAGE. > > > > > > I'm not sure what the best fix is at this point - revert all or part > > > of 8f8c04bf1ebbd > > > > > > Nicolas, what is your opinion? To summarize commit 8f8c04bf1ebbd broke > > > the ability to pass a -1 default address length to do_i2c_* such that > > > something as common as 'i2c md 0x50 0 50' fails with a usage error. > > > > Ah, ok. Well first we should add a test to dm/test/i2c.c to cover they > > failure you are seeing. > > > > Yes, revert part of it and then add checks for -ve values? > > > > Regards, > > Simon > > I missed that -1 was a valid value for alen, as the checks "if
Re: [GIT PULL] please pull fsl-qoriq-2022-8-17
On Wed, Aug 17, 2022 at 02:26:32AM +, Peng Fan (OSS) wrote: > Hi Tom, > > Please pull fsl-qoriq-2022-8-17 > > CI: > https://source.denx.de/u-boot/custodians/u-boot-fsl-qoriq/-/pipelines/13155 First, applied to u-boot/master, thanks! Second, do you have any comment on the various layerscape platforms patches that have been posted of late? I plan to for example apply the ones to disable ethernet on some layerscape platforms soon. -- Tom signature.asc Description: PGP signature
[PATCH] arm: kirkwood: Add CONFIG_SUPPORT_PASSING_ATAGS
Add CONFIG_SUPPORT_PASSING_ATAGS and friends to support legacy image method of booting. Debian and OpenWrt installer use uImage with appended DTB for these Kirkwood boards. Signed-off-by: Tony Dinh --- configs/dockstar_defconfig | 3 +++ configs/dreamplug_defconfig | 3 +++ configs/goflexhome_defconfig | 3 +++ configs/iconnect_defconfig | 3 +++ configs/pogo_e02_defconfig | 3 +++ configs/sheevaplug_defconfig | 3 +++ 6 files changed, 18 insertions(+) diff --git a/configs/dockstar_defconfig b/configs/dockstar_defconfig index 6f99cdd44b..82eb81e4de 100644 --- a/configs/dockstar_defconfig +++ b/configs/dockstar_defconfig @@ -4,6 +4,9 @@ CONFIG_SYS_DCACHE_OFF=y CONFIG_ARCH_CPU_INIT=y CONFIG_SYS_THUMB_BUILD=y CONFIG_ARCH_KIRKWOOD=y +CONFIG_SUPPORT_PASSING_ATAGS=y +CONFIG_CMDLINE_TAG=y +CONFIG_INITRD_TAG=y CONFIG_SYS_KWD_CONFIG="board/Seagate/dockstar/kwbimage.cfg" CONFIG_SYS_TEXT_BASE=0x60 CONFIG_NR_DRAM_BANKS=2 diff --git a/configs/dreamplug_defconfig b/configs/dreamplug_defconfig index d6b55636ba..ccc9ee38de 100644 --- a/configs/dreamplug_defconfig +++ b/configs/dreamplug_defconfig @@ -3,6 +3,9 @@ CONFIG_SKIP_LOWLEVEL_INIT=y CONFIG_SYS_DCACHE_OFF=y CONFIG_ARCH_CPU_INIT=y CONFIG_ARCH_KIRKWOOD=y +CONFIG_SUPPORT_PASSING_ATAGS=y +CONFIG_CMDLINE_TAG=y +CONFIG_INITRD_TAG=y CONFIG_SYS_KWD_CONFIG="board/Marvell/dreamplug/kwbimage.cfg" CONFIG_SYS_TEXT_BASE=0x60 CONFIG_NR_DRAM_BANKS=2 diff --git a/configs/goflexhome_defconfig b/configs/goflexhome_defconfig index 1ef4d6c881..3cfbe7d558 100644 --- a/configs/goflexhome_defconfig +++ b/configs/goflexhome_defconfig @@ -4,6 +4,9 @@ CONFIG_SYS_DCACHE_OFF=y CONFIG_ARCH_CPU_INIT=y CONFIG_SYS_THUMB_BUILD=y CONFIG_ARCH_KIRKWOOD=y +CONFIG_SUPPORT_PASSING_ATAGS=y +CONFIG_CMDLINE_TAG=y +CONFIG_INITRD_TAG=y CONFIG_SYS_KWD_CONFIG="board/Seagate/goflexhome/kwbimage.cfg" CONFIG_SYS_TEXT_BASE=0x60 CONFIG_NR_DRAM_BANKS=2 diff --git a/configs/iconnect_defconfig b/configs/iconnect_defconfig index 7adf76d777..fc5928b9df 100644 --- a/configs/iconnect_defconfig +++ b/configs/iconnect_defconfig @@ -4,6 +4,9 @@ CONFIG_SYS_DCACHE_OFF=y CONFIG_ARCH_CPU_INIT=y CONFIG_SYS_THUMB_BUILD=y CONFIG_ARCH_KIRKWOOD=y +CONFIG_SUPPORT_PASSING_ATAGS=y +CONFIG_CMDLINE_TAG=y +CONFIG_INITRD_TAG=y CONFIG_SYS_KWD_CONFIG="board/iomega/iconnect/kwbimage.cfg" CONFIG_SYS_TEXT_BASE=0x60 CONFIG_NR_DRAM_BANKS=2 diff --git a/configs/pogo_e02_defconfig b/configs/pogo_e02_defconfig index e1a2517eb6..0b647e8af9 100644 --- a/configs/pogo_e02_defconfig +++ b/configs/pogo_e02_defconfig @@ -4,6 +4,9 @@ CONFIG_SYS_DCACHE_OFF=y CONFIG_ARCH_CPU_INIT=y CONFIG_SYS_THUMB_BUILD=y CONFIG_ARCH_KIRKWOOD=y +CONFIG_SUPPORT_PASSING_ATAGS=y +CONFIG_CMDLINE_TAG=y +CONFIG_INITRD_TAG=y CONFIG_SYS_KWD_CONFIG="board/cloudengines/pogo_e02/kwbimage.cfg" CONFIG_SYS_TEXT_BASE=0x60 CONFIG_NR_DRAM_BANKS=2 diff --git a/configs/sheevaplug_defconfig b/configs/sheevaplug_defconfig index fa1e7bd2c0..cc9cd7d9c9 100644 --- a/configs/sheevaplug_defconfig +++ b/configs/sheevaplug_defconfig @@ -4,6 +4,9 @@ CONFIG_SYS_DCACHE_OFF=y CONFIG_ARCH_CPU_INIT=y CONFIG_SYS_THUMB_BUILD=y CONFIG_ARCH_KIRKWOOD=y +CONFIG_SUPPORT_PASSING_ATAGS=y +CONFIG_CMDLINE_TAG=y +CONFIG_INITRD_TAG=y CONFIG_SYS_KWD_CONFIG="board/Marvell/sheevaplug/kwbimage.cfg" CONFIG_SYS_TEXT_BASE=0x60 CONFIG_NR_DRAM_BANKS=2 -- 2.30.2
Re: [PATCH] pci: Add checks to prevent config space overflow
On Monday 04 July 2022 08:00:23 Stefan Roese wrote: > On 03.07.22 12:48, Pali Rohár wrote: > > PCIe config space has address range 0-4095. So do not allow reading from > > addresses outside of this range. Lot of U-Boot drivers do not expect that > > passed value is not in this range. PCI DM read function is exetended to > > s/exetended/extended Should I send a new patch version? > > fill read value to all ones or zeros when it fails as U-Boot callers > > ignores return value. > > > > Calling U-Boot command 'pci display.b 0.0.0 0 0x2000' now stops printing > > config space at the end (before 0x1000 address). > > > > Signed-off-by: Pali Rohár > > --- > > cmd/pci.c| 16 ++-- > > drivers/pci/pci-uclass.c | 10 +- > > 2 files changed, 23 insertions(+), 3 deletions(-) > > > > diff --git a/cmd/pci.c b/cmd/pci.c > > index a99e8f8ad6e0..6258699fec81 100644 > > --- a/cmd/pci.c > > +++ b/cmd/pci.c > > @@ -358,6 +358,9 @@ static int pci_cfg_display(struct udevice *dev, ulong > > addr, > > if (length == 0) > > length = 0x40 / byte_size; /* Standard PCI config space */ > > + if (addr >= 4096) > > + return 1; > > + > > /* Print the lines. > > * once, and all accesses are with the specified bus width. > > */ > > @@ -378,7 +381,10 @@ static int pci_cfg_display(struct udevice *dev, ulong > > addr, > > rc = 1; > > break; > > } > > - } while (nbytes > 0); > > + } while (nbytes > 0 && addr < 4096); > > + > > + if (rc == 0 && nbytes > 0) > > + return 1; > > return (rc); > > } > > @@ -390,6 +396,9 @@ static int pci_cfg_modify(struct udevice *dev, ulong > > addr, ulong size, > > int nbytes; > > ulong val; > > + if (addr >= 4096) > > + return 1; > > + > > /* Print the address, followed by value. Then accept input for > > * the next value. A non-converted value exits. > > */ > > @@ -427,7 +436,10 @@ static int pci_cfg_modify(struct udevice *dev, ulong > > addr, ulong size, > > addr += size; > > } > > } > > - } while (nbytes); > > + } while (nbytes && addr < 4096); > > + > > + if (nbytes) > > + return 1; > > return 0; > > } > > diff --git a/drivers/pci/pci-uclass.c b/drivers/pci/pci-uclass.c > > index 89245a271e16..7402079471c8 100644 > > --- a/drivers/pci/pci-uclass.c > > +++ b/drivers/pci/pci-uclass.c > > @@ -288,6 +288,8 @@ int pci_bus_write_config(struct udevice *bus, pci_dev_t > > bdf, int offset, > > ops = pci_get_ops(bus); > > if (!ops->write_config) > > return -ENOSYS; > > + if (offset < 0 || offset >= 4096) > > + return -EINVAL; > > return ops->write_config(bus, bdf, offset, value, size); > > } > > @@ -366,8 +368,14 @@ int pci_bus_read_config(const struct udevice *bus, > > pci_dev_t bdf, int offset, > > struct dm_pci_ops *ops; > > ops = pci_get_ops(bus); > > - if (!ops->read_config) > > + if (!ops->read_config) { > > + *valuep = pci_conv_32_to_size(~0, offset, size); > > return -ENOSYS; > > + } > > + if (offset < 0 || offset >= 4096) { > > + *valuep = pci_conv_32_to_size(0, offset, size); > > + return -EINVAL; > > + } > > How about introducing a macro for this 4096 max value instead? > > Other than this: > > Reviewed-by: Stefan Roese > > Thanks, > Stefan
Re: [PATCH] Makefile: Unify condition for mpc85xx reset vector
PING? On Wednesday 03 August 2022 23:56:55 Pali Rohár wrote: > Use 'CONFIG_MPC85XX_HAVE_RESET_VECTOR && CONFIG_OF_SEPARATE' pattern > instead of 'CONFIG_MPC85XX_HAVE_RESET_VECTOR && !CONFIG_OF_EMBED' also in > OBJCOPYFLAGS_u-boot-nodtb.bin as this pattern is used in rest of Makefile. > > Signed-off-by: Pali Rohár > --- > Makefile | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/Makefile b/Makefile > index d659c8118cba..23bf0c8b1e62 100644 > --- a/Makefile > +++ b/Makefile > @@ -1267,7 +1267,7 @@ spl/u-boot-spl.srec: spl/u-boot-spl FORCE > > OBJCOPYFLAGS_u-boot-nodtb.bin := -O binary \ > $(if $(CONFIG_X86_16BIT_INIT),-R .start16 -R .resetvec) \ > - $(if $(CONFIG_MPC85XX_HAVE_RESET_VECTOR),$(if > $(CONFIG_OF_EMBED),,-R .bootpg -R .resetvec)) > + $(if $(CONFIG_MPC85XX_HAVE_RESET_VECTOR),$(if > $(CONFIG_OF_SEPARATE),-R .bootpg -R .resetvec)) > > binary_size_check: u-boot-nodtb.bin FORCE > @file_size=$(shell wc -c u-boot-nodtb.bin | awk '{print $$1}') ; \ > -- > 2.20.1 >
Re: [PATCH 2/2] Makefile: Build final mpc85xx non-SPL image in standard file u-boot.bin
On Wednesday 03 August 2022 13:28:01 Pali Rohár wrote: > On Monday 01 August 2022 19:15:46 Tom Rini wrote: > > On Mon, Aug 01, 2022 at 09:39:00PM +0200, Pali Rohár wrote: > > > On Monday 01 August 2022 13:13:22 Simon Glass wrote: > > > > Hi Pali, > > > > > > > > On Mon, 1 Aug 2022 at 09:43, Pali Rohár wrote: > > > > > > > > > > Currently Makefile produces final mpc85xx image when SPL is not used > > > > > in > > > > > custom file u-boot-with-dtb.bin. It is quite confusing name as build > > > > > process produce also intermediate file standard file u-boot-dtb.bin > > > > > (which > > > > > is just intermediate and not bootable). Other platforms use u-boot.bin > > > > > (UBOOT_BIN) as standard name for final bootable raw image. > > > > > > > > > > So change Makefile rules and binman to produce final bootable file for > > > > > mpc85xx also into file u-boot.bin. There is just need for mpc85xx to > > > > > not > > > > > define default rule for u-boot.bin then instruct binman (via DTS > > > > > file) to > > > > > store final image into u-boot.bin (instead of u-boot-with-dtb.bin) and > > > > > finally rename target u-boot-with-dtb.bin to u-boot.bin. > > > > > > > > > > With this change are also removed custom Makefile hacks for mpc85xx > > > > > that it > > > > > produced non-standard output file. And also updated documentation. > > > > > > > > > > Signed-off-by: Pali Rohár > > > > > --- > > > > > Makefile | 19 +-- > > > > > arch/powerpc/dts/kmcent2-u-boot.dtsi | 2 +- > > > > > arch/powerpc/dts/u-boot.dtsi | 2 +- > > > > > board/freescale/p1_p2_rdb_pc/README | 2 +- > > > > > board/freescale/p2041rdb/README | 3 --- > > > > > board/freescale/t102xrdb/README | 2 +- > > > > > board/freescale/t104xrdb/README | 2 +- > > > > > board/freescale/t208xqds/README | 2 +- > > > > > board/freescale/t208xrdb/README | 2 +- > > > > > 9 files changed, 12 insertions(+), 24 deletions(-) > > > > > > > > At present u-boot.bin has a very standard meaning - it is U-Boot with > > > > the DT. > > > > > > > > Boards which need something more than that can/should use binman to > > > > create a separate file. > > > > > > > > I certainly agree that u-boot-with-dtb.bin is a terrible name, though. > > > > Something more descriptive would be better. > > > > > > > > But is it possible to drop these SoC-specific rules in the Makefile > > > > and just build everything needed in the standard binman rule in the > > > > Makefile? > > > > > > > > Regards, > > > > Simon > > > > > > I do not know what is binman doing and how to use it. I just do not see > > > reason why it is needed to use such additional tool for building final > > > binary for powerpc/mpc85xx as other arm boards do not use it at all. > > > > > > Ad your comment "At present u-boot.bin has a very standard meaning - it > > > is U-Boot with the DT." - This is exactly what binman for mpc85xx > > > produces. > > > > > > So I see there could be improvements, but as a first step this my patch > > > should be enough? > > > > So, one of the issues with PowerPC stuff is that much of it is so far > > behind the rest of U-Boot in terms of frameworks. So yes, let us start > > by fixing the functional problem you're describing here and then see > > what appetite exists for further work here. > > > > -- > > Tom > > Ok, so these two patches in this patch series is a starting point. > > Now I send another patch which does another cleanup in this area: > https://patchwork.ozlabs.org/project/uboot/patch/20220803112442.4735-1-p...@kernel.org/ PING?
Re: [PATCH] board: freescale: p1_p2_rdb_pc: Delete watchdog max6370 node in load_default mode
PING? (This change applies also for Turris 1.x boards; which use same CPLD firmware code) On Monday 01 August 2022 15:35:43 Pali Rohár wrote: > CPLD in load_default mode ignores watchdog reset signal. It does not reset > board when watchdog triggers reset signal. > > Detect load_default mode by GPIO7 - LOAD_DEFAULT_N and delete watchdog > max6370 node from device to prevent registering driver for non-working > watchdog. > > Signed-off-by: Pali Rohár > --- > board/freescale/p1_p2_rdb_pc/p1_p2_rdb_pc.c | 28 + > 1 file changed, 28 insertions(+) > > diff --git a/board/freescale/p1_p2_rdb_pc/p1_p2_rdb_pc.c > b/board/freescale/p1_p2_rdb_pc/p1_p2_rdb_pc.c > index a71952dcf399..06cab729e4ab 100644 > --- a/board/freescale/p1_p2_rdb_pc/p1_p2_rdb_pc.c > +++ b/board/freescale/p1_p2_rdb_pc/p1_p2_rdb_pc.c > @@ -368,6 +368,24 @@ int board_eth_init(struct bd_info *bis) > } > #endif > > +#if defined(CONFIG_OF_BOARD_SETUP) || defined(CONFIG_OF_BOARD_FIXUP) > +static void fix_max6370_watchdog(void *blob) > +{ > + int off = fdt_node_offset_by_compatible(blob, -1, "maxim,max6370"); > + ccsr_gpio_t *pgpio = (void *)(CONFIG_SYS_MPC85xx_GPIO_ADDR); > + u32 gpioval = in_be32(&pgpio->gpdat); > + > + /* > + * Delete watchdog max6370 node in load_default mode (detected by > + * GPIO7 - LOAD_DEFAULT_N) because CPLD in load_default mode ignores > + * watchdog reset signal. CPLD in load_default mode does not reset > + * board when watchdog triggers reset signal. > + */ > + if (!(gpioval & BIT(31-7)) && off >= 0) > + fdt_del_node(blob, off); > +} > +#endif > + > #ifdef CONFIG_OF_BOARD_SETUP > int ft_board_setup(void *blob, struct bd_info *bd) > { > @@ -393,6 +411,8 @@ int ft_board_setup(void *blob, struct bd_info *bd) > sizeof("okay"), 0); > #endif > > + fix_max6370_watchdog(blob); > + > #if defined(CONFIG_HAS_FSL_DR_USB) > fsl_fdt_fixup_dr_usb(blob, bd); > #endif > @@ -444,3 +464,11 @@ int ft_board_setup(void *blob, struct bd_info *bd) > return 0; > } > #endif > + > +#ifdef CONFIG_OF_BOARD_FIXUP > +int board_fix_fdt(void *blob) > +{ > + fix_max6370_watchdog(blob); > + return 0; > +} > +#endif > -- > 2.20.1 >
Re: [PATCH v2 1/4] board: freescale: p1_p2_rdb_pc: Add workaround for board reset reboot loop
PING? On Monday 01 August 2022 15:31:43 Pali Rohár wrote: > CPLD's system reset register on P1/P2 RDB boards is not autocleared after > flipping it. If this register is set to one in 100ms after reset starts > then CPLD triggers another CPU reset. > > This means that trying to reset board via CPLD system reset register cause > reboot loop. To prevent this reboot loop, the only workaround is to try to > clear CPLD's system reset register as early as possible. U-Boot is already > doing it in its board_early_init_f() function, which seems to be enough as > register is cleared prior CPLD triggers another reset. > > But board_early_init_f() is not called from SPL and therefore usage of SPL > can cause reboot loop. > > To prevent reboot loop when using SPL, call board_early_init_f() function > in SPL too. For accessing CPLD memory space it is needed to have CPLD entry > in TLB. > > With this change it is possible to trigger board reset via CPLD's system > reset register on P2020 RDB board. > > Signed-off-by: Pali Rohár > --- > Changes in v2: > * Resend patch > * Update comment about watchdog > --- > board/freescale/p1_p2_rdb_pc/p1_p2_rdb_pc.c | 13 + > board/freescale/p1_p2_rdb_pc/spl.c | 6 ++ > board/freescale/p1_p2_rdb_pc/tlb.c | 2 +- > 3 files changed, 20 insertions(+), 1 deletion(-) > > diff --git a/board/freescale/p1_p2_rdb_pc/p1_p2_rdb_pc.c > b/board/freescale/p1_p2_rdb_pc/p1_p2_rdb_pc.c > index 343059c09c36..84e1d65cdb1f 100644 > --- a/board/freescale/p1_p2_rdb_pc/p1_p2_rdb_pc.c > +++ b/board/freescale/p1_p2_rdb_pc/p1_p2_rdb_pc.c > @@ -97,6 +97,19 @@ void board_cpld_init(void) > out_8(&cpld_data->status_led, CPLD_STATUS_LED); > out_8(&cpld_data->fxo_led, CPLD_FXO_LED); > out_8(&cpld_data->fxs_led, CPLD_FXS_LED); > + > + /* > + * CPLD's system reset register on P1/P2 RDB boards is not autocleared > + * after flipping it. If this register is set to one then CPLD triggers > + * reset of CPU in few ms. > + * > + * CPLD does not trigger reset of CPU for 100ms after the last reset. > + * > + * This means that trying to reset board via CPLD system reset register > + * cause reboot loop. To prevent this reboot loop, the only workaround > + * is to try to clear CPLD's system reset register as early as possible > + * and it has to be done in 100ms since the last start of reset. > + */ > out_8(&cpld_data->system_rst, CPLD_SYS_RST); > } > > diff --git a/board/freescale/p1_p2_rdb_pc/spl.c > b/board/freescale/p1_p2_rdb_pc/spl.c > index 22156f2824ec..def28665960d 100644 > --- a/board/freescale/p1_p2_rdb_pc/spl.c > +++ b/board/freescale/p1_p2_rdb_pc/spl.c > @@ -31,6 +31,12 @@ void board_init_f(ulong bootflag) > u32 plat_ratio, bus_clk; > ccsr_gur_t *gur = (void *)CONFIG_SYS_MPC85xx_GUTS_ADDR; > > + /* > + * Call board_early_init_f() as early as possible as it workarounds > + * reboot loop due to broken CPLD state machine for reset line. > + */ > + board_early_init_f(); > + > console_init_f(); > > /* Set pmuxcr to allow both i2c1 and i2c2 */ > diff --git a/board/freescale/p1_p2_rdb_pc/tlb.c > b/board/freescale/p1_p2_rdb_pc/tlb.c > index 13f3a1edf68d..2d431d6d0d90 100644 > --- a/board/freescale/p1_p2_rdb_pc/tlb.c > +++ b/board/freescale/p1_p2_rdb_pc/tlb.c > @@ -61,11 +61,11 @@ struct fsl_e_tlb_entry tlb_table[] = { > MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G, > 0, 5, BOOKE_PAGESZ_1M, 1), > #endif > +#endif /* not SPL */ > > SET_TLB_ENTRY(1, CONFIG_SYS_CPLD_BASE, CONFIG_SYS_CPLD_BASE_PHYS, > MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G, > 0, 6, BOOKE_PAGESZ_1M, 1), > -#endif /* not SPL */ > > #ifdef CONFIG_SYS_NAND_BASE > /* *I*G - NAND */ > -- > 2.20.1 >
Re: [PATCH v2] board: freescale: p1_p2_rdb_pc: Calculate offsets for eSDHC boot sector
On Monday 01 August 2022 14:50:12 Pali Rohár wrote: > Correctly calculate offsets between SPL and proper U-Boot when new config > option CONFIG_FSL_PREPBL_ESDHC_BOOT_SECTOR for generating eSDHC boot sector > is enabled. Otherwise SPL would not be able to boot proper U-Boot. > > Signed-off-by: Pali Rohár > --- > Changes in v2: > * rebase on top of master branch, commit > 85eb5ac6efee878f3c2ab3269286250e187ca10c PING? Are we going to wait until this patch does not apply anymore again?? > --- > include/configs/p1_p2_rdb_pc.h | 4 > 1 file changed, 4 insertions(+) > > diff --git a/include/configs/p1_p2_rdb_pc.h b/include/configs/p1_p2_rdb_pc.h > index ba04029df8d8..d2787136681b 100644 > --- a/include/configs/p1_p2_rdb_pc.h > +++ b/include/configs/p1_p2_rdb_pc.h > @@ -80,7 +80,11 @@ > #define CONFIG_SYS_MMC_U_BOOT_SIZE (768 << 10) > #define CONFIG_SYS_MMC_U_BOOT_DSTCONFIG_SYS_TEXT_BASE > #define CONFIG_SYS_MMC_U_BOOT_START CONFIG_SYS_TEXT_BASE > +#ifdef CONFIG_FSL_PREPBL_ESDHC_BOOT_SECTOR > +#define CONFIG_SYS_MMC_U_BOOT_OFFS (CONFIG_SPL_PAD_TO - > CONFIG_FSL_PREPBL_ESDHC_BOOT_SECTOR_DATA*512) > +#else > #define CONFIG_SYS_MMC_U_BOOT_OFFS CONFIG_SPL_PAD_TO > +#endif > #elif defined(CONFIG_SPIFLASH) > #define CONFIG_SYS_SPI_FLASH_U_BOOT_SIZE (768 << 10) > #define CONFIG_SYS_SPI_FLASH_U_BOOT_DST CONFIG_SYS_TEXT_BASE > -- > 2.20.1 >
Re: [PATCH RFC] Makefile: Rename u-boot-spl.kwb to u-boot-with-spl.kwb
On Wednesday 17 August 2022 12:05:20 Stefan Roese wrote: > On 17.08.22 11:59, Pali Rohár wrote: > > File name with pattern u-boot-spl* is used on all places except in kwb > > image for binary with SPL-only code. Combined binary with both SPL and > > proper U-Boot in other places has file name pattern u-boot-with-spl*. > > > > Make it consistent also for kwb image and rename u-boot-spl.kwb to > > u-boot-with-spl.kwb as this image contains both SPL and proper U-Boot code. > > > > Signed-off-by: Pali Rohár > > --- > > This is just RFC patch, please let me know what do you think. > > Frankly, I wondered a few days ago if this image only includes the > SPL image. So this change makes total sense to me. It might break > some out-of-tree building scripts, but I think we should go forward > this way: > > Reviewed-by: Stefan Roese Ok! If you like it, feel free to take it. First time I was also confused and having consistent naming could help other people too... > Thanks, > Stefan > > > --- > > Kconfig | 2 +- > > Makefile | 4 ++-- > > 2 files changed, 3 insertions(+), 3 deletions(-) > > > > diff --git a/Kconfig b/Kconfig > > index 991b260182e8..5c64ca843eed 100644 > > --- a/Kconfig > > +++ b/Kconfig > > @@ -455,7 +455,7 @@ config BUILD_TARGET > > string "Build target special images" > > default "u-boot-with-spl.sfp" if TARGET_SOCFPGA_ARRIA10 > > default "u-boot-with-spl.sfp" if TARGET_SOCFPGA_GEN5 > > - default "u-boot-spl.kwb" if ARCH_MVEBU && SPL > > + default "u-boot-with-spl.kwb" if ARCH_MVEBU && SPL > > default "u-boot-elf.srec" if RCAR_GEN3 > > default "u-boot.itb" if !BINMAN && SPL_LOAD_FIT && (ARCH_ROCKCHIP || \ > > ARCH_SUNXI || RISCV || ARCH_ZYNQMP) > > diff --git a/Makefile b/Makefile > > index 1a66f69a4b14..b1fbdbe7d726 100644 > > --- a/Makefile > > +++ b/Makefile > > @@ -1432,7 +1432,7 @@ KWD_CONFIG_FILE = $(shell \ > > MKIMAGEFLAGS_u-boot.kwb = -n $(KWD_CONFIG_FILE) \ > > -T kwbimage -a $(CONFIG_SYS_TEXT_BASE) -e $(CONFIG_SYS_TEXT_BASE) > > -MKIMAGEFLAGS_u-boot-spl.kwb = -n $(KWD_CONFIG_FILE) \ > > +MKIMAGEFLAGS_u-boot-with-spl.kwb = -n $(KWD_CONFIG_FILE) \ > > -T kwbimage -a $(CONFIG_SYS_TEXT_BASE) -e $(CONFIG_SYS_TEXT_BASE) \ > > $(if $(KEYDIR),-k $(KEYDIR)) > > @@ -1477,7 +1477,7 @@ u-boot.itb: u-boot-nodtb.bin \ > > $(BOARD_SIZE_CHECK) > > endif > > -u-boot-spl.kwb: u-boot.bin spl/u-boot-spl.bin FORCE > > +u-boot-with-spl.kwb: u-boot.bin spl/u-boot-spl.bin FORCE > > $(call if_changed,mkimage) > > u-boot.sha1: u-boot.bin > > Viele Grüße, > Stefan Roese > > -- > DENX Software Engineering GmbH, Managing Director: Wolfgang Denk > HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany > Phone: (+49)-8142-66989-51 Fax: (+49)-8142-66989-80 Email: s...@denx.de
[PATCH v2] powerpc: Add support for CZ.NIC Turris 1.x routers
CZ.NIC Turris 1.0 and 1.1 are open source routers, they have dual-core PowerPC Freescale P2020 CPU and are based on Freescale P2020RDB-PC-A board. Hardware design is fully open source, all firmware and hardware design files are available at Turris project website: https://docs.turris.cz/hw/turris-1x/turris-1x/ https://project.turris.cz/en/hardware.html This patch adds full U-Boot support for CZ.NIC Turris 1.x routers. P2020 BootROM can load U-Boot either from NOR flash or from SD card. So there is defconfig file turris_1x_nor_defconfig which builds NOR version and defconfig file turris_1x_sdcard_defconfig which builds SD card version. Design of CZ.NIC Turris 1.x routers is based on Freescale P2020RDB-PC-A board, so common board code from boards/freescale/p1_p2_rdb_pc directory is shared and linked also into Turris 1.x U-Boot board code. Turris 1.x code in this patch uses modern distroboot and can boot Linux kernel from various locations, including NAND, SD card, USB flash disks, NVMe disks or SATA disks (connected to extra SATA/SCSI PCIe controllers). Signed-off-by: Pali Rohár --- Changes in v2: * Fix ubifs distroboot (add two boot options with different UBI offset) * Fix $loadaddr variable * Fix tlb and ccsrbar comments * Fix order of DTS nodes * Add syscon-reboot DTS node * Set CONFIG_ETHPRIME to DT alias * Automatically start watchdog * Disable watchdog in rescue mode * Mount rescue rootfs in ro mode * Reset leds on startup * Add support for custom user rescue targets * Fix LBC prelim values * Add all entries into MAINTAINERS * Enable OF_BOARD_FIXUP * Disable CONFIG_BINMAN_FDT for nor * Disable CONFIG_DM_WARN for nor * Disable CONFIG_DM_DEVICE_REMOVE for nor * Enable CONFIG_OPTIMIZE_INLINING for nor * Enable CONFIG_UBIFS_SILENCE_DEBUG_DUMP for nor * Enable CONFIG_AUTO_COMPLETE for nor * Enable CONFIG_CMD_GPIO for nor * Enable CONFIG_CMD_TFTPPUT for nor * Enable CONFIG_CMD_HASH for nor --- arch/powerpc/cpu/mpc85xx/Kconfig | 6 + arch/powerpc/dts/Makefile | 1 + arch/powerpc/dts/turris1x-u-boot.dtsi | 13 + arch/powerpc/dts/turris1x.dts | 483 ++ board/CZ.NIC/turris_1x/Kconfig| 170 + board/CZ.NIC/turris_1x/MAINTAINERS| 13 + board/CZ.NIC/turris_1x/Makefile | 14 + board/CZ.NIC/turris_1x/ddr.c | 27 ++ board/CZ.NIC/turris_1x/law.c | 13 + board/CZ.NIC/turris_1x/tlb.c | 142 board/CZ.NIC/turris_1x/turris_1x.c| 156 + configs/turris_1x_nor_defconfig | 57 +++ configs/turris_1x_sdcard_defconfig| 63 include/configs/turris_1x.h | 390 + 14 files changed, 1548 insertions(+) create mode 100644 arch/powerpc/dts/turris1x-u-boot.dtsi create mode 100644 arch/powerpc/dts/turris1x.dts create mode 100644 board/CZ.NIC/turris_1x/Kconfig create mode 100644 board/CZ.NIC/turris_1x/MAINTAINERS create mode 100644 board/CZ.NIC/turris_1x/Makefile create mode 100644 board/CZ.NIC/turris_1x/ddr.c create mode 100644 board/CZ.NIC/turris_1x/law.c create mode 100644 board/CZ.NIC/turris_1x/tlb.c create mode 100644 board/CZ.NIC/turris_1x/turris_1x.c create mode 100644 configs/turris_1x_nor_defconfig create mode 100644 configs/turris_1x_sdcard_defconfig create mode 100644 include/configs/turris_1x.h diff --git a/arch/powerpc/cpu/mpc85xx/Kconfig b/arch/powerpc/cpu/mpc85xx/Kconfig index 6f8b7593d250..28f69e7c73d2 100644 --- a/arch/powerpc/cpu/mpc85xx/Kconfig +++ b/arch/powerpc/cpu/mpc85xx/Kconfig @@ -150,6 +150,11 @@ config TARGET_P2020RDB imply CMD_SATA imply SATA_SIL +config TARGET_TURRIS_1X + bool "Support Turris 1.x" + select SUPPORT_SPL + select ARCH_P2020 + config TARGET_P2041RDB bool "Support P2041RDB" select ARCH_P2041 @@ -1201,6 +1206,7 @@ config SYS_FSL_LBC_CLK_DIV config FSL_VIA bool +source "board/CZ.NIC/turris_1x/Kconfig" source "board/emulation/qemu-ppce500/Kconfig" source "board/freescale/corenet_ds/Kconfig" source "board/freescale/mpc8548cds/Kconfig" diff --git a/arch/powerpc/dts/Makefile b/arch/powerpc/dts/Makefile index a4b0d7ddc4ff..d6462101211e 100644 --- a/arch/powerpc/dts/Makefile +++ b/arch/powerpc/dts/Makefile @@ -26,6 +26,7 @@ dtb-$(CONFIG_TARGET_T2080QDS) += t2080qds.dtb dtb-$(CONFIG_TARGET_T2080RDB) += t2080rdb.dtb dtb-$(CONFIG_TARGET_T4240RDB) += t4240rdb.dtb dtb-$(CONFIG_TARGET_TUGE1) += kmtuge1.dtb +dtb-$(CONFIG_TARGET_TURRIS_1X) += turris1x.dtb dtb-$(CONFIG_TARGET_TUXX1) += kmtuxa1.dtb dtb-$(CONFIG_TARGET_MCR3000) += mcr3000.dtb dtb-$(CONFIG_TARGET_GAZERBEAM) += gazerbeam.dtb diff --git a/arch/powerpc/dts/turris1x-u-boot.dtsi b/arch/powerpc/dts/turris1x-u-boot.dtsi new file mode 100644 index ..aa758818d564 --- /dev/null +++ b/arch/powerpc/dts/turris1x-u-boot.dtsi @@ -0,0 +1,13 @@ +// SPDX-License-Identifier: GPL-2.0+ + +&soc { + i2c@3000 { + u-boot,dm-pre-reloc; + + crypto@64 { +
Re: [PATCH 04/22] timer: add orion-timer support
On Wednesday 17 August 2022 21:37:51 Michael Walle wrote: > Add timer support for Kirkwood and MVEBU devices. > > Cc: Pali Rohár > Signed-off-by: Michael Walle Acked-by: Pali Rohár > --- > drivers/timer/Kconfig | 6 > drivers/timer/Makefile | 1 + > drivers/timer/orion-timer.c | 63 + > 3 files changed, 70 insertions(+) > create mode 100644 drivers/timer/orion-timer.c > > diff --git a/drivers/timer/Kconfig b/drivers/timer/Kconfig > index 20b5af7e26..4049290148 100644 > --- a/drivers/timer/Kconfig > +++ b/drivers/timer/Kconfig > @@ -194,6 +194,12 @@ config OMAP_TIMER > help > Select this to enable an timer for Omap devices. > > +config ORION_TIMER > + bool "Orion timer support" > + depends on TIMER > + help > + Select this to enable an timer for Orion devices. > + > config RISCV_TIMER > bool "RISC-V timer support" > depends on TIMER && RISCV > diff --git a/drivers/timer/Makefile b/drivers/timer/Makefile > index d9822a5370..560e2d27e1 100644 > --- a/drivers/timer/Makefile > +++ b/drivers/timer/Makefile > @@ -17,6 +17,7 @@ obj-$(CONFIG_MPC83XX_TIMER) += mpc83xx_timer.o > obj-$(CONFIG_NOMADIK_MTU_TIMER) += nomadik-mtu-timer.o > obj-$(CONFIG_NPCM_TIMER)+= npcm-timer.o > obj-$(CONFIG_OMAP_TIMER) += omap-timer.o > +obj-$(CONFIG_ORION_TIMER)+= orion-timer.o > obj-$(CONFIG_RENESAS_OSTM_TIMER) += ostm_timer.o > obj-$(CONFIG_RISCV_TIMER) += riscv_timer.o > obj-$(CONFIG_ROCKCHIP_TIMER) += rockchip_timer.o > diff --git a/drivers/timer/orion-timer.c b/drivers/timer/orion-timer.c > new file mode 100644 > index 00..fd30e1bf03 > --- /dev/null > +++ b/drivers/timer/orion-timer.c > @@ -0,0 +1,63 @@ > +// SPDX-License-Identifier: GPL-2.0+ > +#include > +#include > +#include > +#include > +#include > + > +#define TIMER_CTRL 0x00 > +#define TIMER0_ENBIT(0) > +#define TIMER0_RELOAD_EN BIT(1) > +#define TIMER0_RELOAD0x10 > +#define TIMER0_VAL 0x14 > + > +struct orion_timer_priv { > + void *base; > +}; > + > +static uint64_t orion_timer_get_count(struct udevice *dev) > +{ > + struct orion_timer_priv *priv = dev_get_priv(dev); > + > + return ~readl(priv->base + TIMER0_VAL); > +} > + > +static int orion_timer_probe(struct udevice *dev) > +{ > + struct timer_dev_priv *uc_priv = dev_get_uclass_priv(dev); > + struct orion_timer_priv *priv = dev_get_priv(dev); > + > + priv->base = devfdt_remap_addr_index(dev, 0); > + if (!priv->base) { > + debug("unable to map registers\n"); > + return -ENOMEM; > + } > + > + uc_priv->clock_rate = CONFIG_SYS_TCLK; > + > + writel(~0, priv->base + TIMER0_VAL); > + writel(~0, priv->base + TIMER0_RELOAD); > + > + /* enable timer */ > + setbits_le32(priv->base + TIMER_CTRL, TIMER0_EN | TIMER0_RELOAD_EN); > + > + return 0; > +} > + > +static const struct timer_ops orion_timer_ops = { > + .get_count = orion_timer_get_count, > +}; > + > +static const struct udevice_id orion_timer_ids[] = { > + { .compatible = "marvell,orion-timer" }, > + {} > +}; > + > +U_BOOT_DRIVER(orion_timer) = { > + .name = "orion_timer", > + .id = UCLASS_TIMER, > + .of_match = orion_timer_ids, > + .probe = orion_timer_probe, > + .ops= &orion_timer_ops, > + .priv_auto = sizeof(struct orion_timer_priv), > +}; > -- > 2.30.2 >
Re: [PATCH 03/22] arm: kirkwood: make it CONFIG_TIMER aware
On Wednesday 17 August 2022 21:37:50 Michael Walle wrote: > If we switch to CONFIG_TIMER, we don't need the legacy timer macros and > functions anymore. Add the proper guards to exclude them from compiling. > > Cc: Pali Rohár > Signed-off-by: Michael Walle Reviewed-by: Pali Rohár > --- > arch/arm/mach-kirkwood/include/mach/config.h | 2 ++ > arch/arm/mach-mvebu/Makefile | 3 +++ > 2 files changed, 5 insertions(+) > > diff --git a/arch/arm/mach-kirkwood/include/mach/config.h > b/arch/arm/mach-kirkwood/include/mach/config.h > index 90e86ab99b..d877be119f 100644 > --- a/arch/arm/mach-kirkwood/include/mach/config.h > +++ b/arch/arm/mach-kirkwood/include/mach/config.h > @@ -51,8 +51,10 @@ > #endif /* CONFIG_IDE */ > > /* Use common timer */ > +#ifndef CONFIG_TIMER > #define CONFIG_SYS_TIMER_COUNTS_DOWN > #define CONFIG_SYS_TIMER_COUNTER (MVEBU_TIMER_BASE + 0x14) > #define CONFIG_SYS_TIMER_RATECONFIG_SYS_TCLK > +#endif > > #endif /* _KW_CONFIG_H */ > diff --git a/arch/arm/mach-mvebu/Makefile b/arch/arm/mach-mvebu/Makefile > index 61eeb9c8c1..103e64cf20 100644 > --- a/arch/arm/mach-mvebu/Makefile > +++ b/arch/arm/mach-mvebu/Makefile > @@ -15,7 +15,10 @@ ifdef CONFIG_ARCH_KIRKWOOD > obj-y= dram.o > obj-y+= gpio.o > obj-y+= mbus.o > + > +ifndef CONFIG_TIMER > obj-y+= timer.o > +endif > > else # CONFIG_ARCH_KIRKWOOD > > -- > 2.30.2 >
Re: [PATCH 01/22] time: move the CONFIG_SYS_TIMER_RATE handling to the compiler
On Wednesday 17 August 2022 21:37:48 Michael Walle wrote: > CONFIG_SYS_TIMER_RATE might be a dynamic value, i.e. a function call > instead of a static value, thus it has to be evaluated at runtime. If it > is a static value, the compiler should be able to optimize the unused > branches out. > > This will be needed for kirkwoods dynamic CONFIG_SYS_TCLK setting. > > Cc: Pali Rohár > Signed-off-by: Michael Walle Reviewed-by: Pali Rohár > --- > lib/time.c | 15 +-- > 1 file changed, 9 insertions(+), 6 deletions(-) > > diff --git a/lib/time.c b/lib/time.c > index 96074b84af..bbf191f673 100644 > --- a/lib/time.c > +++ b/lib/time.c > @@ -47,12 +47,15 @@ ulong timer_get_boot_us(void) > { > ulong count = timer_read_counter(); > > -#if CONFIG_SYS_TIMER_RATE == 100 > - return count; > -#elif CONFIG_SYS_TIMER_RATE > 100 > - return lldiv(count, CONFIG_SYS_TIMER_RATE / 100); > -#elif defined(CONFIG_SYS_TIMER_RATE) > - return (unsigned long long)count * 100 / CONFIG_SYS_TIMER_RATE; > +#ifdef CONFIG_SYS_TIMER_RATE > + const ulong timer_rate = CONFIG_SYS_TIMER_RATE; > + > + if (timer_rate == 100) > + return count; > + else if (timer_rate > 100) > + return lldiv(count, timer_rate / 100); > + else > + return (unsigned long long)count * 100 / timer_rate; > #else > /* Assume the counter is in microseconds */ > return count; > -- > 2.30.2 >
[PATCH 14/22] board: lsxl: use proper *_r variables
Use the common kernel_addr_r, ramdisk_addr_r and fdt_addr_r variable names. Signed-off-by: Michael Walle --- include/configs/lsxl.h | 42 +- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/include/configs/lsxl.h b/include/configs/lsxl.h index 7c2c0e22ad..162f07790f 100644 --- a/include/configs/lsxl.h +++ b/include/configs/lsxl.h @@ -25,31 +25,31 @@ #define CONFIG_EXTRA_ENV_SETTINGS \ "bootsource=legacy\0" \ "hdpart=0:1\0" \ - "kernel_addr=0x0080\0" \ - "ramdisk_addr=0x0100\0" \ - "fdt_addr=0x00ff\0" \ + "kernel_addr_r=0x0080\0"\ + "ramdisk_addr_r=0x0100\0" \ + "fdt_addr_r=0x00ff\0" \ "fdtfile=" CONFIG_DEFAULT_FDT_FILE "\0" \ "bootcmd_legacy=sata init " \ - "&& load sata ${hdpart} ${kernel_addr} /uImage.buffalo "\ - "&& load sata ${hdpart} ${ramdisk_addr} /initrd.buffalo "\ - "&& bootm ${kernel_addr} ${ramdisk_addr}\0" \ - "bootcmd_net=bootp ${kernel_addr} vmlinuz " \ - "&& tftpboot ${fdt_addr} ${fdtfile} " \ - "&& tftpboot ${ramdisk_addr} initrd.img " \ - "&& bootz ${kernel_addr} " \ - "${ramdisk_addr}:${filesize} ${fdt_addr}\0" \ + "&& load sata ${hdpart} ${kernel_addr_r} /uImage.buffalo "\ + "&& load sata ${hdpart} ${ramdisk_addr_r} /initrd.buffalo "\ + "&& bootm ${kernel_addr_r} ${ramdisk_addr_r}\0" \ + "bootcmd_net=bootp ${kernel_addr_r} vmlinuz " \ + "&& tftpboot ${fdt_addr_r} ${fdtfile} " \ + "&& tftpboot ${ramdisk_addr_r} initrd.img " \ + "&& bootz ${kernel_addr_r} "\ + "${ramdisk_addr_r}:${filesize} ${fdt_addr_r}\0" \ "bootcmd_hdd=sata init "\ - "&& load sata ${hdpart} ${kernel_addr} /vmlinuz " \ - "&& load sata ${hdpart} ${fdt_addr} /dtb " \ - "&& load sata ${hdpart} ${ramdisk_addr} /initrd.img " \ - "&& bootz ${kernel_addr} " \ - "${ramdisk_addr}:${filesize} ${fdt_addr}\0" \ + "&& load sata ${hdpart} ${kernel_addr_r} /vmlinuz " \ + "&& load sata ${hdpart} ${fdt_addr_r} /dtb "\ + "&& load sata ${hdpart} ${ramdisk_addr_r} /initrd.img " \ + "&& bootz ${kernel_addr_r} "\ + "${ramdisk_addr_r}:${filesize} ${fdt_addr_r}\0" \ "bootcmd_usb=usb start "\ - "&& load usb 0:1 ${kernel_addr} /vmlinuz " \ - "&& load usb 0:1 ${fdt_addr} ${fdtfile} " \ - "&& load usb 0:1 ${ramdisk_addr} /initrd.img " \ - "&& bootz ${kernel_addr} " \ - "${ramdisk_addr}:${filesize} ${fdt_addr}\0" \ + "&& load usb 0:1 ${kernel_addr_r} /vmlinuz "\ + "&& load usb 0:1 ${fdt_addr_r} ${fdtfile} " \ + "&& load usb 0:1 ${ramdisk_addr_r} /initrd.img "\ + "&& bootz ${kernel_addr_r} "\ + "${ramdisk_addr_r}:${filesize} ${fdt_addr_r}\0" \ "bootcmd_rescue=run config_nc_dhcp; run nc\0" \ "config_nc_dhcp=setenv autoload_old ${autoload}; " \ "setenv autoload no " \ -- 2.30.2
[PATCH 18/22] board: lsxl: convert to DM_ETH
Just enabling the Kconfig option for DM_ETH and DM_MDIO is enough. Additionally, we can remove the old hardcoded config. Signed-off-by: Michael Walle --- configs/lschlv2_defconfig | 2 ++ configs/lsxhl_defconfig | 2 ++ include/configs/lsxl.h| 8 3 files changed, 4 insertions(+), 8 deletions(-) diff --git a/configs/lschlv2_defconfig b/configs/lschlv2_defconfig index 2146a33276..4e356fb150 100644 --- a/configs/lschlv2_defconfig +++ b/configs/lschlv2_defconfig @@ -61,6 +61,8 @@ CONFIG_MTD=y CONFIG_DM_SPI_FLASH=y CONFIG_SF_DEFAULT_SPEED=2500 CONFIG_SPI_FLASH_STMICRO=y +CONFIG_DM_ETH=y +CONFIG_DM_MDIO=y CONFIG_MVGBE=y CONFIG_MII=y CONFIG_DM_REGULATOR=y diff --git a/configs/lsxhl_defconfig b/configs/lsxhl_defconfig index d8953128e0..6de0322bfa 100644 --- a/configs/lsxhl_defconfig +++ b/configs/lsxhl_defconfig @@ -62,6 +62,8 @@ CONFIG_MTD=y CONFIG_DM_SPI_FLASH=y CONFIG_SF_DEFAULT_SPEED=2500 CONFIG_SPI_FLASH_STMICRO=y +CONFIG_DM_ETH=y +CONFIG_DM_MDIO=y CONFIG_MVGBE=y CONFIG_MII=y CONFIG_DM_REGULATOR=y diff --git a/include/configs/lsxl.h b/include/configs/lsxl.h index 4d5908d236..c82eb8b04b 100644 --- a/include/configs/lsxl.h +++ b/include/configs/lsxl.h @@ -59,12 +59,4 @@ "setenv autoload_old\0" \ "nc=setenv stdin nc; setenv stdout nc; setenv stderr nc\0" \ -/* - * Ethernet Driver configuration - */ -#ifdef CONFIG_CMD_NET -#define CONFIG_MVGBE_PORTS {0, 1} /* enable port 1 only */ -#define CONFIG_PHY_BASE_ADR7 -#endif /* CONFIG_CMD_NET */ - #endif /* _CONFIG_LSXL_H */ -- 2.30.2
[PATCH 17/22] board: lsxl: convert to DM_GPIO
Use the new mvebu GPIO driver and convert all the function calls to the former kirkwood GPIO driver. This means that we are now using the LED uclass and the regulator uclass. Unfortunately, the GPIO LED doesn't offer a blinking method. Thus we are now stuck with solid on and off states, which makes debugging a bit harder. Also, there is no GPIO fan driver for now. Signed-off-by: Michael Walle --- arch/arm/dts/kirkwood-lschlv2-u-boot.dtsi | 9 ++ arch/arm/dts/kirkwood-lsxhl-u-boot.dtsi | 9 ++ board/buffalo/lsxl/lsxl.c | 140 +- configs/lschlv2_defconfig | 11 +- configs/lsxhl_defconfig | 11 +- 5 files changed, 124 insertions(+), 56 deletions(-) create mode 100644 arch/arm/dts/kirkwood-lschlv2-u-boot.dtsi create mode 100644 arch/arm/dts/kirkwood-lsxhl-u-boot.dtsi diff --git a/arch/arm/dts/kirkwood-lschlv2-u-boot.dtsi b/arch/arm/dts/kirkwood-lschlv2-u-boot.dtsi new file mode 100644 index 00..208b02c9da --- /dev/null +++ b/arch/arm/dts/kirkwood-lschlv2-u-boot.dtsi @@ -0,0 +1,9 @@ +// SPDX-License-Identifier: GPL-2.0+ + +&hdd_power { + /delete-property/ regulator-always-on; +}; + +&usb_power { + /delete-property/ regulator-always-on; +}; diff --git a/arch/arm/dts/kirkwood-lsxhl-u-boot.dtsi b/arch/arm/dts/kirkwood-lsxhl-u-boot.dtsi new file mode 100644 index 00..208b02c9da --- /dev/null +++ b/arch/arm/dts/kirkwood-lsxhl-u-boot.dtsi @@ -0,0 +1,9 @@ +// SPDX-License-Identifier: GPL-2.0+ + +&hdd_power { + /delete-property/ regulator-always-on; +}; + +&usb_power { + /delete-property/ regulator-always-on; +}; diff --git a/board/buffalo/lsxl/lsxl.c b/board/buffalo/lsxl/lsxl.c index 7fab5fbe44..6a866b5470 100644 --- a/board/buffalo/lsxl/lsxl.c +++ b/board/buffalo/lsxl/lsxl.c @@ -9,16 +9,18 @@ #include #include +#include #include #include #include +#include +#include #include #include -#include #include #include -#include #include +#include #include #include "lsxl.h" @@ -118,48 +120,43 @@ int board_early_init_f(void) return 0; } -#define LED_OFF 0 -#define LED_ALARM_ON1 -#define LED_ALARM_BLINKING 2 -#define LED_POWER_ON3 -#define LED_POWER_BLINKING 4 -#define LED_INFO_ON 5 -#define LED_INFO_BLINKING 6 +enum { + LSXL_LED_OFF, + LSXL_LED_ALARM, + LSXL_LED_POWER, + LSXL_LED_INFO, +}; -static void __set_led(int blink_alarm, int blink_info, int blink_power, - int value_alarm, int value_info, int value_power) +static void __set_led(int alarm, int info, int power) { - kw_gpio_set_blink(GPIO_ALARM_LED, blink_alarm); - kw_gpio_set_blink(GPIO_INFO_LED, blink_info); - kw_gpio_set_blink(GPIO_POWER_LED, blink_power); - kw_gpio_set_value(GPIO_ALARM_LED, value_alarm); - kw_gpio_set_value(GPIO_INFO_LED, value_info); - kw_gpio_set_value(GPIO_POWER_LED, value_power); + struct udevice *led; + int ret; + + ret = led_get_by_label("lsxl:red:alarm", &led); + if (!ret) + led_set_state(led, alarm); + ret = led_get_by_label("lsxl:amber:info", &led); + if (!ret) + led_set_state(led, info); + ret = led_get_by_label("lsxl:blue:power", &led); + if (!ret) + led_set_state(led, power); } static void set_led(int state) { switch (state) { - case LED_OFF: - __set_led(0, 0, 0, 1, 1, 1); + case LSXL_LED_OFF: + __set_led(0, 0, 0); break; - case LED_ALARM_ON: - __set_led(0, 0, 0, 0, 1, 1); + case LSXL_LED_ALARM: + __set_led(1, 0, 0); break; - case LED_ALARM_BLINKING: - __set_led(1, 0, 0, 1, 1, 1); + case LSXL_LED_INFO: + __set_led(0, 1, 0); break; - case LED_INFO_ON: - __set_led(0, 0, 0, 1, 0, 1); - break; - case LED_INFO_BLINKING: - __set_led(0, 1, 0, 1, 1, 1); - break; - case LED_POWER_ON: - __set_led(0, 0, 0, 1, 1, 0); - break; - case LED_POWER_BLINKING: - __set_led(0, 0, 1, 1, 1, 1); + case LSXL_LED_POWER: + __set_led(0, 0, 1); break; } } @@ -169,32 +166,56 @@ int board_init(void) /* address of boot parameters */ gd->bd->bi_boot_params = mvebu_sdram_bar(0) + 0x100; - set_led(LED_POWER_BLINKING); + set_led(LSXL_LED_POWER); return 0; } static void check_power_switch(void) { - if (kw_gpio_get_value(GPIO_POWER_SWITCH)) { - /* turn off fan, HDD and USB power */ - kw_gpio_set_value(GPIO_HDD_POWER, 0); - kw_gpio_set_value(GPIO_USB_VBUS, 0); - kw_gpio_set_value(GPIO_FAN_HIGH, 1); - kw_gpio_set_value(GPIO_FAN_LOW, 1); -
[PATCH 16/22] board: lsxl: make last resort recovery more reliable
If something is wrong with the environment, we cannot rely on a proper u-boot operation anymore. In fact, it is possible, that we never reach misc_init_r() with a broken environment. Also don't enable the netconsole by environment settings. This way the user don't have to reconfigure the environment. Instead the network console is only enabled when the push button is pressed during boot. Signed-off-by: Michael Walle --- arch/arm/mach-kirkwood/Kconfig | 1 + board/buffalo/lsxl/lsxl.c | 14 -- configs/lschlv2_defconfig | 1 - configs/lsxhl_defconfig| 1 - include/configs/lsxl.h | 10 -- 5 files changed, 13 insertions(+), 14 deletions(-) diff --git a/arch/arm/mach-kirkwood/Kconfig b/arch/arm/mach-kirkwood/Kconfig index f5460f3bd3..c8a193dd4c 100644 --- a/arch/arm/mach-kirkwood/Kconfig +++ b/arch/arm/mach-kirkwood/Kconfig @@ -45,6 +45,7 @@ config TARGET_LSXL bool "lsxl Board" select FEROCEON_88FR131 select KW88F6281 + select BOARD_EARLY_INIT_R select MISC_INIT_R config TARGET_POGO_E02 diff --git a/board/buffalo/lsxl/lsxl.c b/board/buffalo/lsxl/lsxl.c index eca7da2f6d..7fab5fbe44 100644 --- a/board/buffalo/lsxl/lsxl.c +++ b/board/buffalo/lsxl/lsxl.c @@ -42,6 +42,8 @@ DECLARE_GLOBAL_DATA_PTR; +static bool force_rescue_mode; + int board_early_init_f(void) { /* @@ -247,14 +249,22 @@ static void check_push_button(void) if (i >= 100) erase_environment(); else if (i >= 10) - rescue_mode(); + force_rescue_mode = true; +} + +int board_early_init_r(void) +{ + check_push_button(); + + return 0; } int misc_init_r(void) { check_power_switch(); check_enetaddr(); - check_push_button(); + if (force_rescue_mode) + rescue_mode(); return 0; } diff --git a/configs/lschlv2_defconfig b/configs/lschlv2_defconfig index f4ffb9c6a2..b3ad20c4db 100644 --- a/configs/lschlv2_defconfig +++ b/configs/lschlv2_defconfig @@ -29,7 +29,6 @@ CONFIG_USE_BOOTARGS=y CONFIG_BOOTARGS="console=ttyS0,115200 root=/dev/sda2" CONFIG_BOOTCOMMAND="run bootcmd_${bootsource}" CONFIG_DEFAULT_FDT_FILE="kirkwood-lschlv2.dtb" -CONFIG_SYS_CONSOLE_IS_IN_ENV=y CONFIG_SYS_CONSOLE_INFO_QUIET=y # CONFIG_DISPLAY_BOARDINFO is not set CONFIG_SYS_MAXARGS=32 diff --git a/configs/lsxhl_defconfig b/configs/lsxhl_defconfig index e8fb87ddda..747a224999 100644 --- a/configs/lsxhl_defconfig +++ b/configs/lsxhl_defconfig @@ -30,7 +30,6 @@ CONFIG_USE_BOOTARGS=y CONFIG_BOOTARGS="console=ttyS0,115200 root=/dev/sda2" CONFIG_BOOTCOMMAND="run bootcmd_${bootsource}" CONFIG_DEFAULT_FDT_FILE="kirkwood-lsxhl.dtb" -CONFIG_SYS_CONSOLE_IS_IN_ENV=y CONFIG_SYS_CONSOLE_INFO_QUIET=y # CONFIG_DISPLAY_BOARDINFO is not set CONFIG_SYS_MAXARGS=32 diff --git a/include/configs/lsxl.h b/include/configs/lsxl.h index 162f07790f..4d5908d236 100644 --- a/include/configs/lsxl.h +++ b/include/configs/lsxl.h @@ -57,17 +57,7 @@ "&& setenv ncip " \ "&& setenv autoload ${autoload_old}; " \ "setenv autoload_old\0" \ - "standard_env=setenv ipaddr; setenv netmask; setenv serverip; " \ - "setenv ncip; setenv gatewayip; setenv ethact; "\ - "setenv bootfile; setenv dnsip; " \ - "setenv bootsource legacy; run ser\0" \ - "restore_env=run standard_env; saveenv; reset\0"\ - "ser=setenv stdin serial; setenv stdout serial; " \ - "setenv stderr serial\0"\ "nc=setenv stdin nc; setenv stdout nc; setenv stderr nc\0" \ - "stdin=serial\0"\ - "stdout=serial\0" \ - "stderr=serial\0" /* * Ethernet Driver configuration -- 2.30.2
[PATCH 15/22] board: lsxl: enable ATAGS support
We still need to be able to boot legacy images. Esp. the debian installer will have a kernel with an appended DTB. Signed-off-by: Michael Walle --- configs/lschlv2_defconfig | 3 +++ configs/lsxhl_defconfig | 3 +++ 2 files changed, 6 insertions(+) diff --git a/configs/lschlv2_defconfig b/configs/lschlv2_defconfig index d5cd0d5575..f4ffb9c6a2 100644 --- a/configs/lschlv2_defconfig +++ b/configs/lschlv2_defconfig @@ -3,6 +3,9 @@ CONFIG_SKIP_LOWLEVEL_INIT=y CONFIG_SYS_DCACHE_OFF=y CONFIG_ARCH_CPU_INIT=y CONFIG_ARCH_KIRKWOOD=y +CONFIG_SUPPORT_PASSING_ATAGS=y +CONFIG_CMDLINE_TAG=y +CONFIG_INITRD_TAG=y CONFIG_SYS_KWD_CONFIG="board/buffalo/lsxl/kwbimage-lschl.cfg" CONFIG_SYS_TEXT_BASE=0x60 CONFIG_SYS_MALLOC_F_LEN=0x400 diff --git a/configs/lsxhl_defconfig b/configs/lsxhl_defconfig index 8f0672b189..e8fb87ddda 100644 --- a/configs/lsxhl_defconfig +++ b/configs/lsxhl_defconfig @@ -3,6 +3,9 @@ CONFIG_SKIP_LOWLEVEL_INIT=y CONFIG_SYS_DCACHE_OFF=y CONFIG_ARCH_CPU_INIT=y CONFIG_ARCH_KIRKWOOD=y +CONFIG_SUPPORT_PASSING_ATAGS=y +CONFIG_CMDLINE_TAG=y +CONFIG_INITRD_TAG=y CONFIG_SYS_KWD_CONFIG="board/buffalo/lsxl/kwbimage-lsxhl.cfg" CONFIG_SYS_TEXT_BASE=0x60 CONFIG_SYS_MALLOC_F_LEN=0x400 -- 2.30.2
[PATCH 22/22] board: lsxl: update the README
Update the board's README to reflect all the recent changes. Signed-off-by: Michael Walle --- board/buffalo/lsxl/README | 32 +--- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/board/buffalo/lsxl/README b/board/buffalo/lsxl/README index fffb1ce8ec..dd9e943380 100644 --- a/board/buffalo/lsxl/README +++ b/board/buffalo/lsxl/README @@ -31,8 +31,8 @@ generated if no valid address could be loaded from the environment variable 'ethaddr' and a DHCP request is sent. After a successful DHCP response is received, the network settings are configured and the ncip is unset. Thus all netconsole packets are broadcasted and you can use the netconsole to -access board from any host within the network segment. To determine the IP -address assigned to the board, you either have to sniff the traffic or +access the board from any host within the network segment. To determine the +IP address assigned to the board, you either have to sniff the traffic or check the logs/leases of your DHCP server. The resuce mode is selected by holding the push button for at least one @@ -42,41 +42,43 @@ the resuce mode is enabled, thus providing a visual feedback. Pressing the same button for at least 10 seconds on power-up will erase the environment and reset the board. In this case the visual indication will be: -- blinking blue, for about one second -- solid amber, for about nine seconds -- blinking amber, until you release the button +- blue, for about one second +- amber, for about nine seconds +- red, until you release the button This ensures, that you still can recover a device with a broken environment by first erasing the environment and then entering the rescue mode. Once the rescue mode is started, use the ncb binary from the tools/ -directory to access your board. There is a helper script named -'restore_env' to save your changes. It unsets all the network variables -which were set by the rescue mode, saves your changes and then resets the -board. +directory to access your board. The common use case for this is setting a MAC address. Let us assume you -have an empty environment, the board comes up with the amber LED blinking. +have an empty environment, the board comes up with the amber LED turned on. Then you enter the rescue mode, connect to the board with the ncb tool and use the following commands to set your MAC address: - setenv ethaddr 00:00:00:00:00:00 - run restore_env + setenv -f ethaddr 00:00:00:00:00:00 + saveenv + reset Of course you need to replace the 00:00:00:00:00:00 with your valid MAC address, which can be found on a sticker on the bottom of your box. +You cannot store the network console setting in the environment. On reset +it is automatically restored to serial. Therefore, you have to use the +push-button to enter resuce mode again. + Status LED -- -blinking blue +blue Bootloader is running normally. -blinking amber +amber No ethaddr set. Use the `Rescue Mode` to set one. -blinking red +red Something bad happend during loading the operating system. The default behavior of the linux kernel is to turn on the blue LED. So if -- 2.30.2
[PATCH 21/22] board: lsxl: disable eth0
The board has only one network interface. The linux kernel will gracefully skip a the ethernet interface if no connected PHY could be probed. u-boot on the other hand will throw an error message. The kernel device tree is about to be fixed. For now, just disable the ethernet interface in our -u-boot.dtsi. Signed-off-by: Michael Walle --- arch/arm/dts/kirkwood-lschlv2-u-boot.dtsi | 4 arch/arm/dts/kirkwood-lsxhl-u-boot.dtsi | 4 2 files changed, 8 insertions(+) diff --git a/arch/arm/dts/kirkwood-lschlv2-u-boot.dtsi b/arch/arm/dts/kirkwood-lschlv2-u-boot.dtsi index 208b02c9da..7fc2d7d3b4 100644 --- a/arch/arm/dts/kirkwood-lschlv2-u-boot.dtsi +++ b/arch/arm/dts/kirkwood-lschlv2-u-boot.dtsi @@ -1,5 +1,9 @@ // SPDX-License-Identifier: GPL-2.0+ +ð0 { + status = "disabled"; +}; + &hdd_power { /delete-property/ regulator-always-on; }; diff --git a/arch/arm/dts/kirkwood-lsxhl-u-boot.dtsi b/arch/arm/dts/kirkwood-lsxhl-u-boot.dtsi index 208b02c9da..7fc2d7d3b4 100644 --- a/arch/arm/dts/kirkwood-lsxhl-u-boot.dtsi +++ b/arch/arm/dts/kirkwood-lsxhl-u-boot.dtsi @@ -1,5 +1,9 @@ // SPDX-License-Identifier: GPL-2.0+ +ð0 { + status = "disabled"; +}; + &hdd_power { /delete-property/ regulator-always-on; }; -- 2.30.2
[PATCH 20/22] board: lsxl: convert to CONFIG_TIMER
Enable the orion timer driver and we are good. Signed-off-by: Michael Walle --- configs/lschlv2_defconfig | 2 ++ configs/lsxhl_defconfig | 2 ++ 2 files changed, 4 insertions(+) diff --git a/configs/lschlv2_defconfig b/configs/lschlv2_defconfig index 57e54130d2..e9cc632696 100644 --- a/configs/lschlv2_defconfig +++ b/configs/lschlv2_defconfig @@ -71,5 +71,7 @@ CONFIG_SYS_NS16550=y CONFIG_SPI=y CONFIG_DM_SPI=y CONFIG_KIRKWOOD_SPI=y +CONFIG_TIMER=y +CONFIG_ORION_TIMER=y CONFIG_USB=y CONFIG_USB_EHCI_HCD=y diff --git a/configs/lsxhl_defconfig b/configs/lsxhl_defconfig index fc87424a6f..b83a072b04 100644 --- a/configs/lsxhl_defconfig +++ b/configs/lsxhl_defconfig @@ -72,5 +72,7 @@ CONFIG_SYS_NS16550=y CONFIG_SPI=y CONFIG_DM_SPI=y CONFIG_KIRKWOOD_SPI=y +CONFIG_TIMER=y +CONFIG_ORION_TIMER=y CONFIG_USB=y CONFIG_USB_EHCI_HCD=y -- 2.30.2
[PATCH 19/22] board: lsxl: convert to DM_SERIAL
DM_SERIAL needs early malloc. The on-chip RAM is pretty tight, it's only 2kiB, with DM_SERIAL enabled, this doesn't work anymore. Fortunately for us, we don't need the on-chip RAM because the DRAM is already initialized before u-boot starts. Just put the early malloc area there and use the default early malloc size. Signed-off-by: Michael Walle --- configs/lschlv2_defconfig | 4 ++-- configs/lsxhl_defconfig | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/configs/lschlv2_defconfig b/configs/lschlv2_defconfig index 4e356fb150..57e54130d2 100644 --- a/configs/lschlv2_defconfig +++ b/configs/lschlv2_defconfig @@ -8,7 +8,6 @@ CONFIG_CMDLINE_TAG=y CONFIG_INITRD_TAG=y CONFIG_SYS_KWD_CONFIG="board/buffalo/lsxl/kwbimage-lschl.cfg" CONFIG_SYS_TEXT_BASE=0x60 -CONFIG_SYS_MALLOC_F_LEN=0x400 CONFIG_NR_DRAM_BANKS=2 CONFIG_TARGET_LSXL=y CONFIG_ENV_SIZE=0x1 @@ -20,7 +19,7 @@ CONFIG_IDENT_STRING=" LS-CHLv2" CONFIG_SYS_LOAD_ADDR=0x80 CONFIG_DISTRO_DEFAULTS=y CONFIG_HAS_CUSTOM_SYS_INIT_SP_ADDR=y -CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0xc8012000 +CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0x5ff000 CONFIG_HAS_BOARD_SIZE_LIMIT=y CONFIG_BOARD_SIZE_LIMIT=393216 # CONFIG_BOOTSTD is not set @@ -67,6 +66,7 @@ CONFIG_MVGBE=y CONFIG_MII=y CONFIG_DM_REGULATOR=y CONFIG_DM_REGULATOR_FIXED=y +CONFIG_DM_SERIAL=y CONFIG_SYS_NS16550=y CONFIG_SPI=y CONFIG_DM_SPI=y diff --git a/configs/lsxhl_defconfig b/configs/lsxhl_defconfig index 6de0322bfa..fc87424a6f 100644 --- a/configs/lsxhl_defconfig +++ b/configs/lsxhl_defconfig @@ -8,7 +8,6 @@ CONFIG_CMDLINE_TAG=y CONFIG_INITRD_TAG=y CONFIG_SYS_KWD_CONFIG="board/buffalo/lsxl/kwbimage-lsxhl.cfg" CONFIG_SYS_TEXT_BASE=0x60 -CONFIG_SYS_MALLOC_F_LEN=0x400 CONFIG_NR_DRAM_BANKS=2 CONFIG_TARGET_LSXL=y CONFIG_LSXHL=y @@ -21,7 +20,7 @@ CONFIG_IDENT_STRING=" LS-XHL" CONFIG_SYS_LOAD_ADDR=0x80 CONFIG_DISTRO_DEFAULTS=y CONFIG_HAS_CUSTOM_SYS_INIT_SP_ADDR=y -CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0xc8012000 +CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0x5ff000 CONFIG_HAS_BOARD_SIZE_LIMIT=y CONFIG_BOARD_SIZE_LIMIT=393216 # CONFIG_BOOTSTD is not set @@ -68,6 +67,7 @@ CONFIG_MVGBE=y CONFIG_MII=y CONFIG_DM_REGULATOR=y CONFIG_DM_REGULATOR_FIXED=y +CONFIG_DM_SERIAL=y CONFIG_SYS_NS16550=y CONFIG_SPI=y CONFIG_DM_SPI=y -- 2.30.2
[PATCH 13/22] board: lsxl: reorder image loading and remove ramdisk_len
We can load the ramdisk as the last step. This way we don't have to set the intermediate variable 'ramdisk_len' and can remove it. Signed-off-by: Michael Walle --- include/configs/lsxl.h | 15 ++- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/include/configs/lsxl.h b/include/configs/lsxl.h index fb9a8c5032..7c2c0e22ad 100644 --- a/include/configs/lsxl.h +++ b/include/configs/lsxl.h @@ -34,25 +34,22 @@ "&& load sata ${hdpart} ${ramdisk_addr} /initrd.buffalo "\ "&& bootm ${kernel_addr} ${ramdisk_addr}\0" \ "bootcmd_net=bootp ${kernel_addr} vmlinuz " \ - "&& tftpboot ${ramdisk_addr} initrd.img " \ - "&& setenv ramdisk_len ${filesize} "\ "&& tftpboot ${fdt_addr} ${fdtfile} " \ + "&& tftpboot ${ramdisk_addr} initrd.img " \ "&& bootz ${kernel_addr} " \ - "${ramdisk_addr}:${ramdisk_len} ${fdt_addr}\0" \ + "${ramdisk_addr}:${filesize} ${fdt_addr}\0" \ "bootcmd_hdd=sata init "\ "&& load sata ${hdpart} ${kernel_addr} /vmlinuz " \ - "&& load sata ${hdpart} ${ramdisk_addr} /initrd.img " \ - "&& setenv ramdisk_len ${filesize} "\ "&& load sata ${hdpart} ${fdt_addr} /dtb " \ + "&& load sata ${hdpart} ${ramdisk_addr} /initrd.img " \ "&& bootz ${kernel_addr} " \ - "${ramdisk_addr}:${ramdisk_len} ${fdt_addr}\0" \ + "${ramdisk_addr}:${filesize} ${fdt_addr}\0" \ "bootcmd_usb=usb start "\ "&& load usb 0:1 ${kernel_addr} /vmlinuz " \ - "&& load usb 0:1 ${ramdisk_addr} /initrd.img " \ - "&& setenv ramdisk_len ${filesize} "\ "&& load usb 0:1 ${fdt_addr} ${fdtfile} " \ + "&& load usb 0:1 ${ramdisk_addr} /initrd.img " \ "&& bootz ${kernel_addr} " \ - "${ramdisk_addr}:${ramdisk_len} ${fdt_addr}\0" \ + "${ramdisk_addr}:${filesize} ${fdt_addr}\0" \ "bootcmd_rescue=run config_nc_dhcp; run nc\0" \ "config_nc_dhcp=setenv autoload_old ${autoload}; " \ "setenv autoload no " \ -- 2.30.2
[PATCH 12/22] board: lsxl: use CONFIG_DEFAULT_FDT_FILE
Drop our own CONFIG_FDTFILE handling in favor of the generic CONFIG_DEFAULT_FDT_FILE one. Signed-off-by: Michael Walle --- configs/lschlv2_defconfig | 1 + configs/lsxhl_defconfig | 1 + include/configs/lsxl.h| 14 +++--- 3 files changed, 5 insertions(+), 11 deletions(-) diff --git a/configs/lschlv2_defconfig b/configs/lschlv2_defconfig index 081a2448fc..d5cd0d5575 100644 --- a/configs/lschlv2_defconfig +++ b/configs/lschlv2_defconfig @@ -25,6 +25,7 @@ CONFIG_BOOTDELAY=3 CONFIG_USE_BOOTARGS=y CONFIG_BOOTARGS="console=ttyS0,115200 root=/dev/sda2" CONFIG_BOOTCOMMAND="run bootcmd_${bootsource}" +CONFIG_DEFAULT_FDT_FILE="kirkwood-lschlv2.dtb" CONFIG_SYS_CONSOLE_IS_IN_ENV=y CONFIG_SYS_CONSOLE_INFO_QUIET=y # CONFIG_DISPLAY_BOARDINFO is not set diff --git a/configs/lsxhl_defconfig b/configs/lsxhl_defconfig index 33bec60147..8f0672b189 100644 --- a/configs/lsxhl_defconfig +++ b/configs/lsxhl_defconfig @@ -26,6 +26,7 @@ CONFIG_BOOTDELAY=3 CONFIG_USE_BOOTARGS=y CONFIG_BOOTARGS="console=ttyS0,115200 root=/dev/sda2" CONFIG_BOOTCOMMAND="run bootcmd_${bootsource}" +CONFIG_DEFAULT_FDT_FILE="kirkwood-lsxhl.dtb" CONFIG_SYS_CONSOLE_IS_IN_ENV=y CONFIG_SYS_CONSOLE_INFO_QUIET=y # CONFIG_DISPLAY_BOARDINFO is not set diff --git a/include/configs/lsxl.h b/include/configs/lsxl.h index db5f7a93f9..fb9a8c5032 100644 --- a/include/configs/lsxl.h +++ b/include/configs/lsxl.h @@ -22,21 +22,13 @@ /* * Default environment variables */ - -#if defined(CONFIG_LSXHL) -#define CONFIG_FDTFILE "kirkwood-lsxhl.dtb" -#elif defined(CONFIG_LSCHLV2) -#define CONFIG_FDTFILE "kirkwood-lschlv2.dtb" -#else -#error "Unsupported board" -#endif - #define CONFIG_EXTRA_ENV_SETTINGS \ "bootsource=legacy\0" \ "hdpart=0:1\0" \ "kernel_addr=0x0080\0" \ "ramdisk_addr=0x0100\0" \ "fdt_addr=0x00ff\0" \ + "fdtfile=" CONFIG_DEFAULT_FDT_FILE "\0" \ "bootcmd_legacy=sata init " \ "&& load sata ${hdpart} ${kernel_addr} /uImage.buffalo "\ "&& load sata ${hdpart} ${ramdisk_addr} /initrd.buffalo "\ @@ -44,7 +36,7 @@ "bootcmd_net=bootp ${kernel_addr} vmlinuz " \ "&& tftpboot ${ramdisk_addr} initrd.img " \ "&& setenv ramdisk_len ${filesize} "\ - "&& tftpboot ${fdt_addr} " CONFIG_FDTFILE " " \ + "&& tftpboot ${fdt_addr} ${fdtfile} " \ "&& bootz ${kernel_addr} " \ "${ramdisk_addr}:${ramdisk_len} ${fdt_addr}\0" \ "bootcmd_hdd=sata init "\ @@ -58,7 +50,7 @@ "&& load usb 0:1 ${kernel_addr} /vmlinuz " \ "&& load usb 0:1 ${ramdisk_addr} /initrd.img " \ "&& setenv ramdisk_len ${filesize} "\ - "&& load usb 0:1 ${fdt_addr} " CONFIG_FDTFILE " " \ + "&& load usb 0:1 ${fdt_addr} ${fdtfile} " \ "&& bootz ${kernel_addr} " \ "${ramdisk_addr}:${ramdisk_len} ${fdt_addr}\0" \ "bootcmd_rescue=run config_nc_dhcp; run nc\0" \ -- 2.30.2
[PATCH 11/22] board: lsxl: automatically select CONFIG_MISC_INIT_R
The board code needs this to be set. Otherwise, the recovery mechanism doesn't work. Therefore, select this option automatically with the board. Signed-off-by: Michael Walle --- arch/arm/mach-kirkwood/Kconfig | 1 + board/buffalo/lsxl/lsxl.c | 2 -- configs/lschlv2_defconfig | 1 - configs/lsxhl_defconfig| 1 - 4 files changed, 1 insertion(+), 4 deletions(-) diff --git a/arch/arm/mach-kirkwood/Kconfig b/arch/arm/mach-kirkwood/Kconfig index 98bb10c2de..f5460f3bd3 100644 --- a/arch/arm/mach-kirkwood/Kconfig +++ b/arch/arm/mach-kirkwood/Kconfig @@ -45,6 +45,7 @@ config TARGET_LSXL bool "lsxl Board" select FEROCEON_88FR131 select KW88F6281 + select MISC_INIT_R config TARGET_POGO_E02 bool "pogo_e02 Board" diff --git a/board/buffalo/lsxl/lsxl.c b/board/buffalo/lsxl/lsxl.c index 42221eef3a..eca7da2f6d 100644 --- a/board/buffalo/lsxl/lsxl.c +++ b/board/buffalo/lsxl/lsxl.c @@ -172,7 +172,6 @@ int board_init(void) return 0; } -#ifdef CONFIG_MISC_INIT_R static void check_power_switch(void) { if (kw_gpio_get_value(GPIO_POWER_SWITCH)) { @@ -259,7 +258,6 @@ int misc_init_r(void) return 0; } -#endif #if CONFIG_IS_ENABLED(BOOTSTAGE) void show_boot_progress(int progress) diff --git a/configs/lschlv2_defconfig b/configs/lschlv2_defconfig index 87dc1be61b..081a2448fc 100644 --- a/configs/lschlv2_defconfig +++ b/configs/lschlv2_defconfig @@ -28,7 +28,6 @@ CONFIG_BOOTCOMMAND="run bootcmd_${bootsource}" CONFIG_SYS_CONSOLE_IS_IN_ENV=y CONFIG_SYS_CONSOLE_INFO_QUIET=y # CONFIG_DISPLAY_BOARDINFO is not set -CONFIG_MISC_INIT_R=y CONFIG_SYS_MAXARGS=32 # CONFIG_CMD_FLASH is not set CONFIG_CMD_SATA=y diff --git a/configs/lsxhl_defconfig b/configs/lsxhl_defconfig index 35e414f059..33bec60147 100644 --- a/configs/lsxhl_defconfig +++ b/configs/lsxhl_defconfig @@ -29,7 +29,6 @@ CONFIG_BOOTCOMMAND="run bootcmd_${bootsource}" CONFIG_SYS_CONSOLE_IS_IN_ENV=y CONFIG_SYS_CONSOLE_INFO_QUIET=y # CONFIG_DISPLAY_BOARDINFO is not set -CONFIG_MISC_INIT_R=y CONFIG_SYS_MAXARGS=32 # CONFIG_CMD_FLASH is not set CONFIG_CMD_SATA=y -- 2.30.2
[PATCH 10/22] board: lsxl: remove unused header files
Cleanup the included header files in the board code. These are all leftovers from earlier days. Signed-off-by: Michael Walle --- board/buffalo/lsxl/lsxl.c | 5 - 1 file changed, 5 deletions(-) diff --git a/board/buffalo/lsxl/lsxl.c b/board/buffalo/lsxl/lsxl.c index 106d46d436..42221eef3a 100644 --- a/board/buffalo/lsxl/lsxl.c +++ b/board/buffalo/lsxl/lsxl.c @@ -11,12 +11,7 @@ #include #include #include -#include #include -#include -#include -#include -#include #include #include #include -- 2.30.2
[PATCH 09/22] board: lsxl: remove CONFIG_ENV_OVERWRITE
This is not needed. The user can force setting the variables with "setenv -f". Signed-off-by: Michael Walle --- board/buffalo/lsxl/lsxl.c | 4 configs/lschlv2_defconfig | 1 - configs/lsxhl_defconfig | 1 - 3 files changed, 6 deletions(-) diff --git a/board/buffalo/lsxl/lsxl.c b/board/buffalo/lsxl/lsxl.c index 31d532b752..106d46d436 100644 --- a/board/buffalo/lsxl/lsxl.c +++ b/board/buffalo/lsxl/lsxl.c @@ -45,10 +45,6 @@ * Additionally, the bootsource is set to 'rescue'. */ -#ifndef CONFIG_ENV_OVERWRITE -# error "You need to set CONFIG_ENV_OVERWRITE" -#endif - DECLARE_GLOBAL_DATA_PTR; int board_early_init_f(void) diff --git a/configs/lschlv2_defconfig b/configs/lschlv2_defconfig index aa8e523784..87dc1be61b 100644 --- a/configs/lschlv2_defconfig +++ b/configs/lschlv2_defconfig @@ -36,7 +36,6 @@ CONFIG_CMD_SPI=y CONFIG_CMD_USB=y # CONFIG_CMD_SETEXPR is not set CONFIG_OF_CONTROL=y -CONFIG_ENV_OVERWRITE=y CONFIG_ENV_IS_IN_SPI_FLASH=y CONFIG_SYS_RELOC_GD_ENV_ADDR=y CONFIG_NET_RANDOM_ETHADDR=y diff --git a/configs/lsxhl_defconfig b/configs/lsxhl_defconfig index f56743a578..35e414f059 100644 --- a/configs/lsxhl_defconfig +++ b/configs/lsxhl_defconfig @@ -37,7 +37,6 @@ CONFIG_CMD_SPI=y CONFIG_CMD_USB=y # CONFIG_CMD_SETEXPR is not set CONFIG_OF_CONTROL=y -CONFIG_ENV_OVERWRITE=y CONFIG_ENV_IS_IN_SPI_FLASH=y CONFIG_SYS_RELOC_GD_ENV_ADDR=y CONFIG_NET_RANDOM_ETHADDR=y -- 2.30.2
[PATCH 07/22] board: lsxl: remove unused features
Make the binary smaller by removing unused features. Signed-off-by: Michael Walle --- configs/lschlv2_defconfig | 3 +-- configs/lsxhl_defconfig | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/configs/lschlv2_defconfig b/configs/lschlv2_defconfig index cabedeb460..aa8e523784 100644 --- a/configs/lschlv2_defconfig +++ b/configs/lschlv2_defconfig @@ -17,15 +17,14 @@ CONFIG_SYS_LOAD_ADDR=0x80 CONFIG_DISTRO_DEFAULTS=y CONFIG_HAS_CUSTOM_SYS_INIT_SP_ADDR=y CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0xc8012000 -CONFIG_API=y CONFIG_HAS_BOARD_SIZE_LIMIT=y CONFIG_BOARD_SIZE_LIMIT=393216 +# CONFIG_BOOTSTD is not set CONFIG_SHOW_BOOT_PROGRESS=y CONFIG_BOOTDELAY=3 CONFIG_USE_BOOTARGS=y CONFIG_BOOTARGS="console=ttyS0,115200 root=/dev/sda2" CONFIG_BOOTCOMMAND="run bootcmd_${bootsource}" -CONFIG_USE_PREBOOT=y CONFIG_SYS_CONSOLE_IS_IN_ENV=y CONFIG_SYS_CONSOLE_INFO_QUIET=y # CONFIG_DISPLAY_BOARDINFO is not set diff --git a/configs/lsxhl_defconfig b/configs/lsxhl_defconfig index 3003f0abcb..f56743a578 100644 --- a/configs/lsxhl_defconfig +++ b/configs/lsxhl_defconfig @@ -18,15 +18,14 @@ CONFIG_SYS_LOAD_ADDR=0x80 CONFIG_DISTRO_DEFAULTS=y CONFIG_HAS_CUSTOM_SYS_INIT_SP_ADDR=y CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0xc8012000 -CONFIG_API=y CONFIG_HAS_BOARD_SIZE_LIMIT=y CONFIG_BOARD_SIZE_LIMIT=393216 +# CONFIG_BOOTSTD is not set CONFIG_SHOW_BOOT_PROGRESS=y CONFIG_BOOTDELAY=3 CONFIG_USE_BOOTARGS=y CONFIG_BOOTARGS="console=ttyS0,115200 root=/dev/sda2" CONFIG_BOOTCOMMAND="run bootcmd_${bootsource}" -CONFIG_USE_PREBOOT=y CONFIG_SYS_CONSOLE_IS_IN_ENV=y CONFIG_SYS_CONSOLE_INFO_QUIET=y # CONFIG_DISPLAY_BOARDINFO is not set -- 2.30.2
[PATCH 08/22] board: lsxl: remove eraseenv script
This is not needed. The user can do a "env default -f -a". Signed-off-by: Michael Walle --- include/configs/lsxl.h | 3 --- 1 file changed, 3 deletions(-) diff --git a/include/configs/lsxl.h b/include/configs/lsxl.h index e1108619f2..db5f7a93f9 100644 --- a/include/configs/lsxl.h +++ b/include/configs/lsxl.h @@ -62,9 +62,6 @@ "&& bootz ${kernel_addr} " \ "${ramdisk_addr}:${ramdisk_len} ${fdt_addr}\0" \ "bootcmd_rescue=run config_nc_dhcp; run nc\0" \ - "eraseenv=sf probe 0 " \ - "&& sf erase " __stringify(CONFIG_ENV_OFFSET) \ - " +" __stringify(CONFIG_ENV_SIZE) "\0" \ "config_nc_dhcp=setenv autoload_old ${autoload}; " \ "setenv autoload no " \ "&& bootp " \ -- 2.30.2
[PATCH 06/22] board: lsxl: limit size to 384kiB
The board only has a 4Mbit flash and two sectors are reserved for the u-boot environment and the device tree. Signed-off-by: Michael Walle --- configs/lschlv2_defconfig | 2 ++ configs/lsxhl_defconfig | 2 ++ 2 files changed, 4 insertions(+) diff --git a/configs/lschlv2_defconfig b/configs/lschlv2_defconfig index 0da058302c..cabedeb460 100644 --- a/configs/lschlv2_defconfig +++ b/configs/lschlv2_defconfig @@ -18,6 +18,8 @@ CONFIG_DISTRO_DEFAULTS=y CONFIG_HAS_CUSTOM_SYS_INIT_SP_ADDR=y CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0xc8012000 CONFIG_API=y +CONFIG_HAS_BOARD_SIZE_LIMIT=y +CONFIG_BOARD_SIZE_LIMIT=393216 CONFIG_SHOW_BOOT_PROGRESS=y CONFIG_BOOTDELAY=3 CONFIG_USE_BOOTARGS=y diff --git a/configs/lsxhl_defconfig b/configs/lsxhl_defconfig index d847255d5e..3003f0abcb 100644 --- a/configs/lsxhl_defconfig +++ b/configs/lsxhl_defconfig @@ -19,6 +19,8 @@ CONFIG_DISTRO_DEFAULTS=y CONFIG_HAS_CUSTOM_SYS_INIT_SP_ADDR=y CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0xc8012000 CONFIG_API=y +CONFIG_HAS_BOARD_SIZE_LIMIT=y +CONFIG_BOARD_SIZE_LIMIT=393216 CONFIG_SHOW_BOOT_PROGRESS=y CONFIG_BOOTDELAY=3 CONFIG_USE_BOOTARGS=y -- 2.30.2
[PATCH 05/22] button: gpio: add DM_GPIO dependency
The gpio-button driver depends on DM_GPIO, add it to Kconfig to avoid build errors. Signed-off-by: Michael Walle --- drivers/button/Kconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/button/Kconfig b/drivers/button/Kconfig index 6db3c5e93a..8ce2de37d6 100644 --- a/drivers/button/Kconfig +++ b/drivers/button/Kconfig @@ -20,6 +20,7 @@ config BUTTON_ADC config BUTTON_GPIO bool "Button gpio" depends on BUTTON + depends on DM_GPIO help Enable support for buttons which are connected to GPIO lines. These GPIOs may be on the SoC or some other device which provides GPIOs. -- 2.30.2
[PATCH 04/22] timer: add orion-timer support
Add timer support for Kirkwood and MVEBU devices. Cc: Pali Rohár Signed-off-by: Michael Walle --- drivers/timer/Kconfig | 6 drivers/timer/Makefile | 1 + drivers/timer/orion-timer.c | 63 + 3 files changed, 70 insertions(+) create mode 100644 drivers/timer/orion-timer.c diff --git a/drivers/timer/Kconfig b/drivers/timer/Kconfig index 20b5af7e26..4049290148 100644 --- a/drivers/timer/Kconfig +++ b/drivers/timer/Kconfig @@ -194,6 +194,12 @@ config OMAP_TIMER help Select this to enable an timer for Omap devices. +config ORION_TIMER + bool "Orion timer support" + depends on TIMER + help + Select this to enable an timer for Orion devices. + config RISCV_TIMER bool "RISC-V timer support" depends on TIMER && RISCV diff --git a/drivers/timer/Makefile b/drivers/timer/Makefile index d9822a5370..560e2d27e1 100644 --- a/drivers/timer/Makefile +++ b/drivers/timer/Makefile @@ -17,6 +17,7 @@ obj-$(CONFIG_MPC83XX_TIMER) += mpc83xx_timer.o obj-$(CONFIG_NOMADIK_MTU_TIMER)+= nomadik-mtu-timer.o obj-$(CONFIG_NPCM_TIMER)+= npcm-timer.o obj-$(CONFIG_OMAP_TIMER) += omap-timer.o +obj-$(CONFIG_ORION_TIMER) += orion-timer.o obj-$(CONFIG_RENESAS_OSTM_TIMER) += ostm_timer.o obj-$(CONFIG_RISCV_TIMER) += riscv_timer.o obj-$(CONFIG_ROCKCHIP_TIMER) += rockchip_timer.o diff --git a/drivers/timer/orion-timer.c b/drivers/timer/orion-timer.c new file mode 100644 index 00..fd30e1bf03 --- /dev/null +++ b/drivers/timer/orion-timer.c @@ -0,0 +1,63 @@ +// SPDX-License-Identifier: GPL-2.0+ +#include +#include +#include +#include +#include + +#define TIMER_CTRL 0x00 +#define TIMER0_EN BIT(0) +#define TIMER0_RELOAD_EN BIT(1) +#define TIMER0_RELOAD 0x10 +#define TIMER0_VAL 0x14 + +struct orion_timer_priv { + void *base; +}; + +static uint64_t orion_timer_get_count(struct udevice *dev) +{ + struct orion_timer_priv *priv = dev_get_priv(dev); + + return ~readl(priv->base + TIMER0_VAL); +} + +static int orion_timer_probe(struct udevice *dev) +{ + struct timer_dev_priv *uc_priv = dev_get_uclass_priv(dev); + struct orion_timer_priv *priv = dev_get_priv(dev); + + priv->base = devfdt_remap_addr_index(dev, 0); + if (!priv->base) { + debug("unable to map registers\n"); + return -ENOMEM; + } + + uc_priv->clock_rate = CONFIG_SYS_TCLK; + + writel(~0, priv->base + TIMER0_VAL); + writel(~0, priv->base + TIMER0_RELOAD); + + /* enable timer */ + setbits_le32(priv->base + TIMER_CTRL, TIMER0_EN | TIMER0_RELOAD_EN); + + return 0; +} + +static const struct timer_ops orion_timer_ops = { + .get_count = orion_timer_get_count, +}; + +static const struct udevice_id orion_timer_ids[] = { + { .compatible = "marvell,orion-timer" }, + {} +}; + +U_BOOT_DRIVER(orion_timer) = { + .name = "orion_timer", + .id = UCLASS_TIMER, + .of_match = orion_timer_ids, + .probe = orion_timer_probe, + .ops= &orion_timer_ops, + .priv_auto = sizeof(struct orion_timer_priv), +}; -- 2.30.2
[PATCH 02/22] arm: kirkwood: 88f6281: Detect CONFIG_SYS_TCLK from SAR register
From: Pali Rohár Bit 21 in SAR register specifies if TCLK is running at 166 MHz or 200 MHz. This information is undocumented in public Marvell Kirkwood Functional Specifications [2], but is available in Linux v3.15 kirkwood code [1]. Commit 8ac303d49f89 ("arm: kirkwood: Do not overwrite CONFIG_SYS_TCLK") broke support for Marvell 88F6281 SoCs because it was expected that all those SoCs have TCLK running at 200 MHz as specified in Marvell 88F6281 Hardware Specifications [3]. Fix broken support for 88F6281 by detecting CONFIG_SYS_TCLK from SAR register, like it was doing Linux v3.15. [1] - https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/tree/arch/arm/mach-kirkwood/common.c?h=v3.15#n542 [2] - https://web.archive.org/web/20130730091033/http://www.marvell.com/embedded-processors/kirkwood/assets/FS_88F6180_9x_6281_OpenSource.pdf [3] - https://web.archive.org/web/20120620073511/http://www.marvell.com/embedded-processors/kirkwood/assets/HW_88F6281_OpenSource.pdf Fixes: 8ac303d49f89 ("arm: kirkwood: Do not overwrite CONFIG_SYS_TCLK") Signed-off-by: Pali Rohár --- arch/arm/mach-kirkwood/include/mach/kw88f6281.h | 3 ++- arch/arm/mach-kirkwood/include/mach/soc.h | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/arch/arm/mach-kirkwood/include/mach/kw88f6281.h b/arch/arm/mach-kirkwood/include/mach/kw88f6281.h index 87406081cf..f86cd0bb60 100644 --- a/arch/arm/mach-kirkwood/include/mach/kw88f6281.h +++ b/arch/arm/mach-kirkwood/include/mach/kw88f6281.h @@ -15,6 +15,7 @@ #define KW_REGS_PHY_BASE KW88F6281_REGS_PHYS_BASE /* TCLK Core Clock definition */ -#define CONFIG_SYS_TCLK2 /* 200MHz */ +#define CONFIG_SYS_TCLK((readl(CONFIG_SAR_REG) & BIT(21)) ? \ + 16667 : 2) #endif /* _ASM_ARCH_KW88F6281_H */ diff --git a/arch/arm/mach-kirkwood/include/mach/soc.h b/arch/arm/mach-kirkwood/include/mach/soc.h index 1d7f2828cd..5f545c6f43 100644 --- a/arch/arm/mach-kirkwood/include/mach/soc.h +++ b/arch/arm/mach-kirkwood/include/mach/soc.h @@ -62,6 +62,8 @@ #define MVCPU_WIN_ENABLE KWCPU_WIN_ENABLE #define MVCPU_WIN_DISABLE KWCPU_WIN_DISABLE +#define CONFIG_SAR_REG (KW_MPP_BASE + 0x0030) + #if defined (CONFIG_KW88F6281) #include #elif defined (CONFIG_KW88F6192) -- 2.30.2
[PATCH 01/22] time: move the CONFIG_SYS_TIMER_RATE handling to the compiler
CONFIG_SYS_TIMER_RATE might be a dynamic value, i.e. a function call instead of a static value, thus it has to be evaluated at runtime. If it is a static value, the compiler should be able to optimize the unused branches out. This will be needed for kirkwoods dynamic CONFIG_SYS_TCLK setting. Cc: Pali Rohár Signed-off-by: Michael Walle --- lib/time.c | 15 +-- 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/lib/time.c b/lib/time.c index 96074b84af..bbf191f673 100644 --- a/lib/time.c +++ b/lib/time.c @@ -47,12 +47,15 @@ ulong timer_get_boot_us(void) { ulong count = timer_read_counter(); -#if CONFIG_SYS_TIMER_RATE == 100 - return count; -#elif CONFIG_SYS_TIMER_RATE > 100 - return lldiv(count, CONFIG_SYS_TIMER_RATE / 100); -#elif defined(CONFIG_SYS_TIMER_RATE) - return (unsigned long long)count * 100 / CONFIG_SYS_TIMER_RATE; +#ifdef CONFIG_SYS_TIMER_RATE + const ulong timer_rate = CONFIG_SYS_TIMER_RATE; + + if (timer_rate == 100) + return count; + else if (timer_rate > 100) + return lldiv(count, timer_rate / 100); + else + return (unsigned long long)count * 100 / timer_rate; #else /* Assume the counter is in microseconds */ return count; -- 2.30.2
[PATCH 03/22] arm: kirkwood: make it CONFIG_TIMER aware
If we switch to CONFIG_TIMER, we don't need the legacy timer macros and functions anymore. Add the proper guards to exclude them from compiling. Cc: Pali Rohár Signed-off-by: Michael Walle --- arch/arm/mach-kirkwood/include/mach/config.h | 2 ++ arch/arm/mach-mvebu/Makefile | 3 +++ 2 files changed, 5 insertions(+) diff --git a/arch/arm/mach-kirkwood/include/mach/config.h b/arch/arm/mach-kirkwood/include/mach/config.h index 90e86ab99b..d877be119f 100644 --- a/arch/arm/mach-kirkwood/include/mach/config.h +++ b/arch/arm/mach-kirkwood/include/mach/config.h @@ -51,8 +51,10 @@ #endif /* CONFIG_IDE */ /* Use common timer */ +#ifndef CONFIG_TIMER #define CONFIG_SYS_TIMER_COUNTS_DOWN #define CONFIG_SYS_TIMER_COUNTER (MVEBU_TIMER_BASE + 0x14) #define CONFIG_SYS_TIMER_RATE CONFIG_SYS_TCLK +#endif #endif /* _KW_CONFIG_H */ diff --git a/arch/arm/mach-mvebu/Makefile b/arch/arm/mach-mvebu/Makefile index 61eeb9c8c1..103e64cf20 100644 --- a/arch/arm/mach-mvebu/Makefile +++ b/arch/arm/mach-mvebu/Makefile @@ -15,7 +15,10 @@ ifdef CONFIG_ARCH_KIRKWOOD obj-y = dram.o obj-y += gpio.o obj-y += mbus.o + +ifndef CONFIG_TIMER obj-y += timer.o +endif else # CONFIG_ARCH_KIRKWOOD -- 2.30.2
[PATCH 00/22] board: lsxl: major update and DM conversion
Convert the Buffalo Linkstation LS-CHLv2 and XHL boards to DM_GPIO, DM_ETH, DM_SERIAL and CONFIG_TIMER. Patches 01-02 fix TCLK handling on the kirkwood SoC if the clock is 166MHz. Patches 03-04 add CONFIG_TIMER support for kirkwood/mvebu. Patches 05-21 will then update the lsxl board Michael Walle (21): time: move the CONFIG_SYS_TIMER_RATE handling to the compiler arm: kirkwood: make it CONFIG_TIMER aware timer: add orion-timer support button: gpio: add DM_GPIO dependency board: lsxl: limit size to 384kiB board: lsxl: remove unused features board: lsxl: remove eraseenv script board: lsxl: remove CONFIG_ENV_OVERWRITE board: lsxl: remove unused header files board: lsxl: automatically select CONFIG_MISC_INIT_R board: lsxl: use CONFIG_DEFAULT_FDT_FILE board: lsxl: reorder image loading and remove ramdisk_len board: lsxl: use proper *_r variables board: lsxl: enable ATAGS support board: lsxl: make last resort recovery more reliable board: lsxl: convert to DM_GPIO board: lsxl: convert to DM_ETH board: lsxl: convert to DM_SERIAL board: lsxl: convert to CONFIG_TIMER board: lsxl: disable eth0 board: lsxl: update the README Pali Rohár (1): arm: kirkwood: 88f6281: Detect CONFIG_SYS_TCLK from SAR register arch/arm/dts/kirkwood-lschlv2-u-boot.dtsi | 13 ++ arch/arm/dts/kirkwood-lsxhl-u-boot.dtsi | 13 ++ arch/arm/mach-kirkwood/Kconfig| 2 + arch/arm/mach-kirkwood/include/mach/config.h | 2 + .../mach-kirkwood/include/mach/kw88f6281.h| 3 +- arch/arm/mach-kirkwood/include/mach/soc.h | 2 + arch/arm/mach-mvebu/Makefile | 3 + board/buffalo/lsxl/README | 32 ++-- board/buffalo/lsxl/lsxl.c | 165 +++--- configs/lschlv2_defconfig | 31 +++- configs/lsxhl_defconfig | 31 +++- drivers/button/Kconfig| 1 + drivers/timer/Kconfig | 6 + drivers/timer/Makefile| 1 + drivers/timer/orion-timer.c | 63 +++ include/configs/lsxl.h| 76 +++- lib/time.c| 15 +- 17 files changed, 300 insertions(+), 159 deletions(-) create mode 100644 arch/arm/dts/kirkwood-lschlv2-u-boot.dtsi create mode 100644 arch/arm/dts/kirkwood-lsxhl-u-boot.dtsi create mode 100644 drivers/timer/orion-timer.c -- 2.30.2
Re: [PATCH v7] board: purism: add the Purism Librem5 phone
On 2022-08-13 07:53, Fabio Estevam wrote: Hi Angus, On Sun, Aug 7, 2022 at 1:02 PM Angus Ainslie wrote: Initial commit of Librem5 u-boot and SPL All of the pre-requisite patches for this board are now upstream. Changes since v6: Move migrated symbols Rebase onto latest u-boot-imx Changes since v5: Proper handling of the Display Port firmware for CI builds Update the DP section of the docs Changes since v4: Include imx8mq-u-boot.dtsi instead of adding a new copy Changes since v3: Dropped unused MMCROOT Rebased on u-boot-imx Changes since v2: Cleanup Kconfig symbols used in librem5.h Cleanup various checkpatch issues Drop some un-used functions Changes since v1: Merged patches into a monolithic board patch Using DM drivers for devices in u-boot Added USB storage support for uSD rootfs Dropped many SPL_BUILD guarded define's Fixed documentation index Signed-off-by: Angus Ainslie Co-developed-by: Sebastian Krzyszkowiak Signed-off-by: Sebastian Krzyszkowiak Patch looks good: Reviewed-by: Fabio Estevam I would suggest removing the changes history from the commit log and put this information below the --- line. Thanks for the review Fabio. I'll try and resend it early next week with that fixed. Does anyone know if the CI is passing with this patch ?
Re: [PATCH v2 6/7] tpm: Implement state command for Cr50
Hi Ilias, On Tue, 16 Aug 2022 at 06:43, Ilias Apalodimas wrote: > > Hi Simon, > > I know little of this device and the whole patch seems fine apart from > the definitions and declarations of the state functions. > > > On Sat, 13 Aug 2022 at 22:56, Simon Glass wrote: > > > > > > > drivers/tpm/cr50_i2c.c | 117 + > > include/tpm-v2.h | 54 +++ > > lib/tpm-v2.c | 24 + > > [...] > > > diff --git a/include/tpm-v2.h b/include/tpm-v2.h > > index e79c90b9395..8e90a616220 100644 > > --- a/include/tpm-v2.h > > +++ b/include/tpm-v2.h > > @@ -419,6 +419,50 @@ enum { > > HR_NV_INDEX = TPM_HT_NV_INDEX << HR_SHIFT, > > }; > > > > +/* > > + * Operations specific to the Cr50 TPM used on Chromium OS and Android > > devices > > + * > > + * FIXME: below is not enough to differentiate between vendors commands > > + * of numerous devices. However, the current tpm2 APIs aren't very amenable > > + * to extending generically because the marshaling code is assuming all > > + * knowledge of all commands. > > + */ > > +#define TPM2_CC_VENDOR_BIT_MASK0x2000 > > + > > +#define TPM2_CR50_VENDOR_COMMAND (TPM2_CC_VENDOR_BIT_MASK | > > 0) > > +#define TPM2_CR50_SUB_CMD_IMMEDIATE_RESET 19 > > +#define TPM2_CR50_SUB_CMD_NVMEM_ENABLE_COMMITS 21 > > +#define TPM2_CR50_SUB_CMD_REPORT_TPM_STATE 23 > > +#define TPM2_CR50_SUB_CMD_TURN_UPDATE_ON 24 > > +#define TPM2_CR50_SUB_CMD_GET_REC_BTN 29 > > +#define TPM2_CR50_SUB_CMD_TPM_MODE 40 > > +#define TPM2_CR50_SUB_CMD_GET_BOOT_MODE52 > > +#define TPM2_CR50_SUB_CMD_RESET_EC 53 > > + > > +/* Cr50 vendor-specific error codes. */ > > +#define VENDOR_RC_ERR 0x0500 > > +enum cr50_vendor_rc { > > + VENDOR_RC_INTERNAL_ERROR= (VENDOR_RC_ERR | 6), > > + VENDOR_RC_NO_SUCH_SUBCOMMAND= (VENDOR_RC_ERR | 8), > > + VENDOR_RC_NO_SUCH_COMMAND = (VENDOR_RC_ERR | 127), > > +}; > > + > > +enum cr50_tpm_mode { > > + /* > > +* Default state: TPM is enabled, and may be set to either > > +* TPM_MODE_ENABLED or TPM_MODE_DISABLED. > > +*/ > > + TPM_MODE_ENABLED_TENTATIVE = 0, > > + > > + /* TPM is enabled, and mode may not be changed. */ > > + TPM_MODE_ENABLED = 1, > > + > > + /* TPM is disabled, and mode may not be changed. */ > > + TPM_MODE_DISABLED = 2, > > + > > + TPM_MODE_INVALID, > > +}; > > + > > /** > > * Issue a TPM2_Startup command. > > * > > @@ -658,4 +702,14 @@ u32 tpm2_disable_platform_hierarchy(struct udevice > > *dev); > > u32 tpm2_submit_command(struct udevice *dev, const u8 *sendbuf, > > u8 *recvbuf, size_t *recv_size); > > > > +/** > > + * tpm_cr50_report_state() - Report the Cr50 internal state > > + * > > + * @dev: TPM device > > + * @recvbuf: Buffer to save the response to > > + * @recv_size: Pointer to the size of the response buffer > > + * Return: result of the operation > > + */ > > +u32 tpm2_cr50_report_state(struct udevice *dev, u8 *recvbuf, size_t > > *recv_size); > > + > > I think we should keep the generic include files clean for hardware > specific details. > > > #endif /* __TPM_V2_H */ > > diff --git a/lib/tpm-v2.c b/lib/tpm-v2.c > > index 3e240bb4c67..3de4841974a 100644 > > --- a/lib/tpm-v2.c > > +++ b/lib/tpm-v2.c > > @@ -679,3 +679,27 @@ u32 tpm2_submit_command(struct udevice *dev, const u8 > > *sendbuf, > > { > > return tpm_sendrecv_command(dev, sendbuf, recvbuf, recv_size); > > } > > + > > +u32 tpm2_cr50_report_state(struct udevice *dev, u8 *recvbuf, size_t > > *recv_size) > > +{ > > + u8 command_v2[COMMAND_BUFFER_SIZE] = { > > + /* header 10 bytes */ > > + tpm_u16(TPM2_ST_NO_SESSIONS), /* TAG */ > > + tpm_u32(10 + 2),/* Length */ > > + tpm_u32(TPM2_CR50_VENDOR_COMMAND), /* Command code */ > > + > > + tpm_u16(TPM2_CR50_SUB_CMD_REPORT_TPM_STATE), > > + }; > > + int ret; > > + > > + ret = tpm_sendrecv_command(dev, command_v2, recvbuf, recv_size); > > + log_debug("ret=%s, %x\n", dev->name, ret); > > + if (ret) > > + return ret; > > + if (*recv_size < 12) > > + return -ENODATA; > > + *recv_size -= 12; > > + memcpy(recvbuf, recvbuf + 12, *recv_size); > > + > > + return 0; > > +} > > Same here, this functions seems ok but shouldn't land in the generic TPM API So shall I create a new tpm_cr50.h header file? What about the C file? > > Thanks > /Ilias > > -- > > 2.37.1.595.g718a3a8f04-goog > > Regards, Simon
Re: [PATCH v2 2/7] tpm: Correct the permissions command in TPMv1
Hi Ilias, On Tue, 16 Aug 2022 at 07:59, Ilias Apalodimas wrote: > > Hi Simon > > On Sat, 13 Aug 2022 at 22:56, Simon Glass wrote: > > > > The offset here is incorrect. Fix it. > > Since we got it wrong the first time, any chance you can give me a > link to the spec describing these offsets (both for this and the > subsequent patch) Yes I have been using this document: TPM Main Part 3 Commands Specification Version 1.2 Level 2 Revision 116 1 March 2011 TCG Published (TPM_ORD_GetCapability) Regards, Simon > > Thanks > /Ilias > > > > Signed-off-by: Simon Glass > > --- > > > > (no changes since v1) > > > > lib/tpm-v1.c | 5 +++-- > > 1 file changed, 3 insertions(+), 2 deletions(-) > > > > diff --git a/lib/tpm-v1.c b/lib/tpm-v1.c > > index 22a769c5874..d0e3ab1b21d 100644 > > --- a/lib/tpm-v1.c > > +++ b/lib/tpm-v1.c > > @@ -456,12 +456,13 @@ u32 tpm1_get_permissions(struct udevice *dev, u32 > > index, u32 *perm) > > 0x0, 0x0, 0x0, 0x4, > > }; > > const size_t index_offset = 18; > > - const size_t perm_offset = 60; > > + const size_t perm_offset = 74; > > u8 buf[COMMAND_BUFFER_SIZE], response[COMMAND_BUFFER_SIZE]; > > size_t response_length = sizeof(response); > > u32 err; > > > > - if (pack_byte_string(buf, sizeof(buf), "d", 0, command, > > sizeof(command), > > + if (pack_byte_string(buf, sizeof(buf), "sd", > > +0, command, sizeof(command), > > index_offset, index)) > > return TPM_LIB_ERROR; > > err = tpm_sendrecv_command(dev, buf, response, &response_length); > > -- > > 2.37.1.595.g718a3a8f04-goog > >
Re: [PATCH 2/4] regulator: bd718x7: Only bind children when PMIC_CHILDREN is enabled
On Wed, 17 Aug 2022 at 05:24, Adam Ford wrote: > > If the bd718x7 is required, but PMIC_CHILDREN is disabled, this > driver throws a compile error. Fix this by putting the function > to bind children into an if-statement checking for PMIC_CHILDREN. > > Allowing PMIC_CHILDREN to be disabled in SPL saves some space and > still permits some read/write functions to access the PMIC in > early startup. > > Signed-off-by: Adam Ford Reviewed-by: Simon Glass
Re: [PATCH v4 07/13] binman: Add BintoolPacker class to bintool
On Tue, 16 Aug 2022 at 02:42, Stefan Herbrechtsmeier wrote: > > From: Stefan Herbrechtsmeier > > Add a bintools base class for packers which compression / decompression > entry contents. > > Signed-off-by: Stefan Herbrechtsmeier > > --- > > (no changes since v3) > > Changes in v3: > - Document class properties > > Changes in v2: > - Added > > tools/binman/bintool.py | 107 > 1 file changed, 107 insertions(+) Reviewed-by: Simon Glass
Re: [PATCH] cmd: tpm-v2: add get_random
Hi Ilias, On Wed, 17 Aug 2022 at 06:13, Ilias Apalodimas wrote: > > Hi Oleksandr > > On Wed, Aug 17, 2022 at 01:27:16PM +0300, Oleksandr Suvorov wrote: > > From: Jorge Ramirez-Ortiz > > > > Enable getting randomness from the tpm command line. > > Does it have to be the tpm command lime? > As of 87ab234c1cf ("cmd: rng: Add support for selecting RNG device") you can > explicitly select the device on the default rng command. That series also > plugs in the TPM RNG into the DM and allows wider usage (e.g from the > EFI_RNG_PROTOCOL) > > So the rng command should be good enough? I like the idea of this command, as it is a direct way of using TPM functionality. But can we use this oopty to add something to doc/usage/cmd/tpm.rst and also a sandbox test? Regards, Simon > > Thanks > /Ilias > > > > Signed-off-by: Jorge Ramirez-Ortiz > > Co-developed-by: Oleksandr Suvorov > > Signed-off-by: Oleksandr Suvorov > > --- > > > > cmd/tpm-v2.c | 36 > > 1 file changed, 36 insertions(+) > > > > diff --git a/cmd/tpm-v2.c b/cmd/tpm-v2.c > > index 4ea5f9f094f..5b53953e207 100644 > > --- a/cmd/tpm-v2.c > > +++ b/cmd/tpm-v2.c > > @@ -6,8 +6,10 @@ > > > > #include > > #include > > +#include > > #include > > #include > > +#include > > #include > > #include > > #include > > @@ -206,6 +208,37 @@ unmap_data: > > return report_return_code(rc); > > } > > > > +static int do_tpm2_get_random(struct cmd_tbl *cmdtp, int flag, int argc, > > + char *const argv[]) > > +{ > > + struct udevice *dev; > > + char *buffer; > > + u32 len; > > + int ret; > > + > > + ret = get_tpm(&dev); > > + if (ret) { > > + printf("Can't get tpm\n"); > > + return ret; > > + } > > + > > + if (argc != 2) > > + return CMD_RET_USAGE; > > + > > + len = simple_strtoul(argv[1], NULL, 10); > > + buffer = calloc(1, len); > > + if (!buffer) > > + return -ENOMEM; > > + > > + ret = tpm2_get_random(dev, buffer, len); > > + if (!ret) > > + print_buffer(0, buffer, 1, len, 0); > > + > > + free(buffer); > > + > > + return report_return_code(ret); > > +} > > + > > static int do_tpm_dam_reset(struct cmd_tbl *cmdtp, int flag, int argc, > > char *const argv[]) > > { > > @@ -366,6 +399,7 @@ static struct cmd_tbl tpm2_commands[] = { > > U_BOOT_CMD_MKENT(pcr_extend, 0, 1, do_tpm2_pcr_extend, "", ""), > > U_BOOT_CMD_MKENT(pcr_read, 0, 1, do_tpm_pcr_read, "", ""), > > U_BOOT_CMD_MKENT(get_capability, 0, 1, do_tpm_get_capability, "", ""), > > + U_BOOT_CMD_MKENT(get_random, 0, 1, do_tpm2_get_random, "", ""), > > U_BOOT_CMD_MKENT(dam_reset, 0, 1, do_tpm_dam_reset, "", ""), > > U_BOOT_CMD_MKENT(dam_parameters, 0, 1, do_tpm_dam_parameters, "", ""), > > U_BOOT_CMD_MKENT(change_auth, 0, 1, do_tpm_change_auth, "", ""), > > @@ -421,6 +455,8 @@ U_BOOT_CMD(tpm2, CONFIG_SYS_MAXARGS, 1, do_tpm, "Issue > > a TPMv2.x command", > > ": property\n" > > ": address to store entries of 4 bytes\n" > > ": number of entries to retrieve\n" > > +"get_random \n" > > +"Get random bytes.\n" > > "dam_reset []\n" > > "If the TPM is not in a LOCKOUT state, reset the internal error > > counter.\n" > > ": optional password\n" > > -- > > 2.37.2 > >
[PATCH 2/2] patman: Tidy up unnecessary blank lines and numbers
Quite a few blank lines are not needed here. Drop these and use the # mechanism to number paragraphs. Signed-off-by: Simon Glass --- tools/patman/patman.rst | 45 ++--- 1 file changed, 15 insertions(+), 30 deletions(-) diff --git a/tools/patman/patman.rst b/tools/patman/patman.rst index f2e6d7636fd..8c5c9cc2ccc 100644 --- a/tools/patman/patman.rst +++ b/tools/patman/patman.rst @@ -11,21 +11,15 @@ Patman patch manager This tool is a Python script which: - Creates patch directly from your branch - - Cleans them up by removing unwanted tags - - Inserts a cover letter with change lists - - Runs the patches through checkpatch.pl and its own checks - - Optionally emails them out to selected people It also has some Patchwork features: - shows review tags from Patchwork so you can update your local patches - - pulls these down into a new branch on request - - lists comments received on a series It is intended to automate patch creation and make it a less @@ -53,15 +47,12 @@ This tool requires a certain way of working: - Maintain a number of branches, one for each patch series you are working on - - Add tags into the commits within each branch to indicate where the series should be sent, cover letter, version, etc. Most of these are normally in the top commit so it is easy to change them with 'git commit --amend' - - Each branch tracks the upstream branch, so that this script can automatically determine the number of commits in it (optional) - - Check out a branch, and run this script to create and send out your patches. Weeks later, change the patches and repeat, knowing that you will get a consistent result each time. @@ -623,41 +614,35 @@ and it will create and send the version 2 series. General points -- -1. When you change back to the us-cmd branch days or weeks later all your +#. When you change back to the us-cmd branch days or weeks later all your information is still there, safely stored in the commits. You don't need to remember what version you are up to, who you sent the last lot of patches to, or anything about the change logs. - -2. If you put tags in the subject, patman will Cc the maintainers +#. If you put tags in the subject, patman will Cc the maintainers automatically in many cases. - -3. If you want to keep the commits from each series you sent so that you can +#. If you want to keep the commits from each series you sent so that you can compare change and see what you did, you can either create a new branch for each version, or just tag the branch before you start changing it: -.. code-block:: bash + .. code-block:: bash git tag sent/us-cmd-rfc # ...later... git tag sent/us-cmd-v2 -4. If you want to modify the patches a little before sending, you can do +#. If you want to modify the patches a little before sending, you can do this in your editor, but be careful! - -5. If you want to run git send-email yourself, use the -n flag which will +#. If you want to run git send-email yourself, use the -n flag which will print out the command line patman would have used. - -6. It is a good idea to add the change log info as you change the commit, +#. It is a good idea to add the change log info as you change the commit, not later when you can't remember which patch you changed. You can always go back and change or remove logs from commits. - -7. Some mailing lists have size limits and when we add binary contents to +#. Some mailing lists have size limits and when we add binary contents to our patches it's easy to exceed the size limits. Use "--no-binary" to generate patches without any binary contents. You are supposed to include a link to a git repository in your "Commit-notes", "Series-notes" or "Cover-letter" for maintainers to fetch the original commit. - -8. Patches will have no changelog entries for revisions where they did not +#. Patches will have no changelog entries for revisions where they did not change. For clarity, if there are no changes for this patch in the most recent revision of the series, a note will be added. For example, a patch with the following tags in the commit:: @@ -669,15 +654,15 @@ General points Series-changes: 4 - Another change -would have a changelog of::: + would have a changelog of::: -(no changes since v4) +(no changes since v4) -Changes in v4: -- Another change +Changes in v4: +- Another change -Changes in v2: -- Some change +Changes in v2: +- Some change Other thoughts -- 2.37.1.595.g718a3a8f04-goog
[PATCH 1/2] patman: Fix version table
One of the changes to the version table was made by mistake. Fix it. Signed-off-by: Simon Glass --- tools/patman/patman.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/patman/patman.rst b/tools/patman/patman.rst index 9226b66f840..f2e6d7636fd 100644 --- a/tools/patman/patman.rst +++ b/tools/patman/patman.rst @@ -3,7 +3,7 @@ .. Simon Glass .. v1, v2, 19-Oct-11 .. revised v3 24-Nov-11 -.. revised v4 04-Jul-2020, with Patchwork integration +.. revised v4 Independence Day 2020, with Patchwork integration Patman patch manager -- 2.37.1.595.g718a3a8f04-goog
Re: [PATCH v8 06/13] FWU: Add helper functions for accessing FWU metadata
On Wed, 17 Aug 2022 at 22:30, Jassi Brar wrote: > > On Wed, 17 Aug 2022 at 07:44, Sughosh Ganu wrote: > . > > diff --git a/lib/fwu_updates/fwu.c b/lib/fwu_updates/fwu.c > > new file mode 100644 > > index 00..9808036eec > > --- /dev/null > > +++ b/lib/fwu_updates/fwu.c > > @@ -0,0 +1,22 @@ > > +// SPDX-License-Identifier: GPL-2.0-or-later > > +/* > > + * Copyright (c) 2022, Linaro Limited > > + */ > > + > > +#include > > +#include > > + > > +__weak int fwu_plat_get_update_index(u32 *update_idx) > > +{ > > + int ret; > > + u32 active_idx; > > + > > + ret = fwu_get_active_index(&active_idx); > > + > > + if (ret < 0) > > + return -1; > > + > > + *update_idx = active_idx ^= 0x1; > > + > It shoud be > *update_idx = (active_idx + 1) % CONFIG_FWU_NUM_BANKS; As mentioned in the commit message, this is a weak function for the case where CONFIG_FWU_NUM_BANKS = 2, where the above logic works since the fwu_get_active_index() function checks that a sane value is being returned for the active_index. However, with the logic that you suggest, this function can be extended for platforms with the number of banks more than 2. I will incorporate this in the next version. Thanks. -sughosh > > cheers.
Re: [PATCH v8 06/13] FWU: Add helper functions for accessing FWU metadata
On Wed, 17 Aug 2022 at 07:44, Sughosh Ganu wrote: . > diff --git a/lib/fwu_updates/fwu.c b/lib/fwu_updates/fwu.c > new file mode 100644 > index 00..9808036eec > --- /dev/null > +++ b/lib/fwu_updates/fwu.c > @@ -0,0 +1,22 @@ > +// SPDX-License-Identifier: GPL-2.0-or-later > +/* > + * Copyright (c) 2022, Linaro Limited > + */ > + > +#include > +#include > + > +__weak int fwu_plat_get_update_index(u32 *update_idx) > +{ > + int ret; > + u32 active_idx; > + > + ret = fwu_get_active_index(&active_idx); > + > + if (ret < 0) > + return -1; > + > + *update_idx = active_idx ^= 0x1; > + It shoud be *update_idx = (active_idx + 1) % CONFIG_FWU_NUM_BANKS; cheers.
[PATCH v6 3/3] ARM: imx6: dh-imx6: Enable d-cache early in SPL
From: Marek Vasut Enable d-cache early in SPL right after DRAM is started up. This reduces U-Boot proper load time by 650ms when loaded from SPI NOR. Signed-off-by: Marek Vasut Signed-off-by: Philip Oberfichtner --- Changes in v6: - Once more improve the dcache_disable() comment Changes in v5: - Clarify dcache_disable() comment Changes in v4: - Elaborate on dcache_disable() comment Changes in v3: - Use newly introduced Kconfig symbol for dh_imx6_defconfig Changes in v2: - Add comment to explain the relevance of dcache_disable() board/dhelectronics/dh_imx6/dh_imx6_spl.c | 41 +++ configs/dh_imx6_defconfig | 1 + 2 files changed, 42 insertions(+) diff --git a/board/dhelectronics/dh_imx6/dh_imx6_spl.c b/board/dhelectronics/dh_imx6/dh_imx6_spl.c index e49e97724a..20a330cce6 100644 --- a/board/dhelectronics/dh_imx6/dh_imx6_spl.c +++ b/board/dhelectronics/dh_imx6/dh_imx6_spl.c @@ -6,6 +6,7 @@ */ #include +#include #include #include #include @@ -14,11 +15,13 @@ #include #include #include +#include #include #include #include #include #include +#include #include #include #include @@ -610,6 +613,20 @@ static void dhcom_spl_dram_init(void) } } +void dram_bank_mmu_setup(int bank) +{ + int i; + + set_section_dcache(ROMCP_ARB_BASE_ADDR >> MMU_SECTION_SHIFT, DCACHE_DEFAULT_OPTION); + set_section_dcache(IRAM_BASE_ADDR >> MMU_SECTION_SHIFT, DCACHE_DEFAULT_OPTION); + + for (i = MMDC0_ARB_BASE_ADDR >> MMU_SECTION_SHIFT; + i < ((MMDC0_ARB_BASE_ADDR >> MMU_SECTION_SHIFT) + + (SZ_1G >> MMU_SECTION_SHIFT)); + i++) + set_section_dcache(i, DCACHE_DEFAULT_OPTION); +} + void board_init_f(ulong dummy) { /* setup AIPS and disable watchdog */ @@ -636,9 +653,33 @@ void board_init_f(ulong dummy) /* DDR3 initialization */ dhcom_spl_dram_init(); + /* Set up early MMU tables at the beginning of DRAM and start d-cache */ + gd->arch.tlb_addr = MMDC0_ARB_BASE_ADDR + SZ_32M; + gd->arch.tlb_size = PGTABLE_SIZE; + enable_caches(); + /* Clear the BSS. */ memset(__bss_start, 0, __bss_end - __bss_start); /* load/boot image from boot device */ board_init_r(NULL, 0); } + +void spl_board_prepare_for_boot(void) +{ + /* +* Flush and disable dcache. Without it, the following bootstage might fail randomly because +* dirty cache lines may not have been written back to DRAM. +* +* If dcache_disable() would be omitted, the following scenario may occur: +* +* The SPL enables dcache and cachelines get populated with data. Then dcache gets disabled +* in U-Boot proper, but still contains dirty data, i.e. the corresponding DRAM locations +* have not yet been updated. When U-Boot reads these locations, it sees an (incorrect) old +* state of the content. +* +* Furthermore, the DRAM contents have likely been modified by U-Boot while dcache was +* disabled. Thus, U-Boot flushing dcache would corrupt DRAM with stale data. +*/ + dcache_disable(); /* implies flush_dcache_all() */ +} diff --git a/configs/dh_imx6_defconfig b/configs/dh_imx6_defconfig index 051816f719..1be6ae62ce 100644 --- a/configs/dh_imx6_defconfig +++ b/configs/dh_imx6_defconfig @@ -1,4 +1,5 @@ CONFIG_ARM=y +CONFIG_SPL_SYS_L2_PL310=y CONFIG_ARCH_MX6=y CONFIG_SYS_TEXT_BASE=0x1780 CONFIG_SYS_MALLOC_F_LEN=0x1000 -- 2.37.1
[PATCH v6 2/3] ARM: cache: Allow SPL to build cache-pl310.c
Introduce the new Kconfig symbol CONFIG_SPL_SYS_L2_PL310 to allow the SPL to build cache-pl310.c. Before this commit, the SPL could enable the PL310 L2 cache [1], but the cache maintenance functions from cache-pl310.c were only useable for non-SPL builds. After enabling the cache one must be able to flush it, too. Thus this commit allows cache-pl310.c to be included in the SPL build. [1] See for example arch/arm/mach-imx/cache.c: v7_outer_cache_enable() Signed-off-by: Philip Oberfichtner --- (no changes since v3) Changes in v3: - Introduce CONFIG_SPL_SYS_L2_PL310 arch/arm/Kconfig | 5 + arch/arm/lib/Makefile | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index b094d2d51f..318e5e82ea 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig @@ -493,6 +493,11 @@ config SYS_L2_PL310 help Enable support for ARM PL310 L2 cache controller in U-Boot +config SPL_SYS_L2_PL310 + bool "ARM PL310 L2 cache controller in SPL" + help + Enable support for ARM PL310 L2 cache controller in SPL + config SYS_L2CACHE_OFF bool "L2cache off" help diff --git a/arch/arm/lib/Makefile b/arch/arm/lib/Makefile index c603fe61bc..d137b4bf0f 100644 --- a/arch/arm/lib/Makefile +++ b/arch/arm/lib/Makefile @@ -33,7 +33,6 @@ obj-$(CONFIG_OF_LIBFDT) += bootm-fdt.o obj-$(CONFIG_CMD_BOOTI) += bootm.o image.o obj-$(CONFIG_CMD_BOOTM) += bootm.o obj-$(CONFIG_CMD_BOOTZ) += bootm.o zimage.o -obj-$(CONFIG_SYS_L2_PL310) += cache-pl310.o else obj-$(CONFIG_$(SPL_TPL_)FRAMEWORK) += spl.o obj-$(CONFIG_SPL_FRAMEWORK) += zimage.o @@ -46,6 +45,7 @@ else obj-$(CONFIG_$(SPL_TPL_)USE_ARCH_MEMSET) += memset.o obj-$(CONFIG_$(SPL_TPL_)USE_ARCH_MEMCPY) += memcpy.o endif +obj-$(CONFIG_$(SPL_TPL_)SYS_L2_PL310) += cache-pl310.o obj-$(CONFIG_$(SPL_TPL_)SEMIHOSTING) += semihosting.o ifneq ($(filter y,$(CONFIG_SAVE_PREV_BL_INITRAMFS_START_ADDR) $(CONFIG_SAVE_PREV_BL_FDT_ADDR)),) -- 2.37.1
[PATCH v6 1/3] Convert CONFIG_SYS_L2_PL310 to Kconfig
This converts CONFIG_SYS_L2_PL310 to Kconfig. For omap2 and mvebu the 'select SYS_L2_PL310' locations were determined using ./tools/moveconfig -i CONFIG_SYS_L2_PL310. For mx6 I manually chose ARCH_MX6 as 'select' location. The correctness has been verified using $ ./tools/moveconfig.py -f ARCH_MX6 ~SYS_L2_PL310 ~SYS_L2CACHE_OFF 0 matches That means whenever an ARCH_MX6 board had SYS_L2_PL310 disabled, this was correctly reflected in SYS_L2CACHE_OFF. Thus it's safe to insert the 'select' statement under ARCH_MX6. Signed-off-by: Philip Oberfichtner --- I wonder if we could further reduce the diffstat by using 'select' for all the socfpga boards. I did not find an appropriate way - I'm open for suggestions, though. (no changes since v4) Changes in v4: - Reduce diffstat by using 'select' statements for omap2, mvebu and mx6 based boards Changes in v3: new README| 2 -- arch/arm/Kconfig | 5 + arch/arm/mach-mvebu/Kconfig | 1 + arch/arm/mach-mvebu/include/mach/config.h | 2 -- arch/arm/mach-omap2/Kconfig | 1 + configs/omap4_panda_defconfig | 1 + configs/omap4_sdp4430_defconfig | 1 + configs/poleg_evb_defconfig | 1 + configs/socfpga_arria10_defconfig | 1 + configs/socfpga_arria5_defconfig | 1 + configs/socfpga_chameleonv3_defconfig | 1 + configs/socfpga_cyclone5_defconfig| 1 + configs/socfpga_dbm_soc1_defconfig| 1 + configs/socfpga_de0_nano_soc_defconfig| 1 + configs/socfpga_de10_nano_defconfig | 1 + configs/socfpga_de10_standard_defconfig | 1 + configs/socfpga_de1_soc_defconfig | 1 + configs/socfpga_is1_defconfig | 1 + configs/socfpga_mcvevk_defconfig | 1 + configs/socfpga_secu1_defconfig | 1 + configs/socfpga_sockit_defconfig | 1 + configs/socfpga_socrates_defconfig| 1 + configs/socfpga_sr1500_defconfig | 1 + configs/socfpga_vining_fpga_defconfig | 1 + configs/stemmy_defconfig | 1 + include/configs/am43xx_evm.h | 1 - include/configs/brppt2.h | 1 - include/configs/cm_t43.h | 1 - include/configs/mx6_common.h | 1 - include/configs/odroid.h | 1 - include/configs/poleg.h | 1 - include/configs/socfpga_common.h | 1 - include/configs/stemmy.h | 1 - include/configs/ti_omap4_common.h | 1 - include/configs/trats.h | 1 - include/configs/trats2.h | 1 - include/configs/zynq-common.h | 1 - scripts/config_whitelist.txt | 1 - 38 files changed, 27 insertions(+), 17 deletions(-) diff --git a/README b/README index 6b6f722733..595f007aaf 100644 --- a/README +++ b/README @@ -496,8 +496,6 @@ The following options need to be configured: the defaults discussed just above. - Cache Configuration for ARM: - CONFIG_SYS_L2_PL310 - Enable support for ARM PL310 L2 cache - controller CONFIG_SYS_PL310_BASE - Physical base address of PL310 controller register space diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index 949ebb46ba..b094d2d51f 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig @@ -488,6 +488,10 @@ config TPL_SYS_THUMB_BUILD density. For ARM architectures that support Thumb2 this flag will result in Thumb2 code generated by GCC. +config SYS_L2_PL310 + bool "ARM PL310 L2 cache controller" + help + Enable support for ARM PL310 L2 cache controller in U-Boot config SYS_L2CACHE_OFF bool "L2cache off" @@ -989,6 +993,7 @@ config ARCH_MX6 select SYS_FSL_HAS_SEC select SYS_FSL_SEC_COMPAT_4 select SYS_FSL_SEC_LE + select SYS_L2_PL310 if !SYS_L2CACHE_OFF imply MXC_GPIO imply SYS_THUMB_BUILD imply SPL_SEPARATE_BSS diff --git a/arch/arm/mach-mvebu/Kconfig b/arch/arm/mach-mvebu/Kconfig index a81b8e2b0d..2ebe341ed1 100644 --- a/arch/arm/mach-mvebu/Kconfig +++ b/arch/arm/mach-mvebu/Kconfig @@ -14,6 +14,7 @@ config ARMADA_32BIT select SPL_SKIP_LOWLEVEL_INIT if SPL select SPL_SIMPLE_BUS if SPL select SUPPORT_SPL + select SYS_L2_PL310 if !SYS_L2CACHE_OFF select TRANSLATION_OFFSET select SPL_SYS_NO_VECTOR_TABLE if SPL select ARCH_VERY_EARLY_INIT diff --git a/arch/arm/mach-mvebu/include/mach/config.h b/arch/arm/mach-mvebu/include/mach/config.h index 4add0d9e10..0bba0a4cf9 100644 --- a/arch/arm/mach-mvebu/include/mach/config.h +++ b/arch/arm/mach-mvebu/include/mach/config.h @@ -25,8 +25,6 @@ #define MV88F78X60 /* for the DDR training bin_hdr code */ #endif -#define CONFIG_SYS_L2_PL310 - #define MV_UART_CONSOLE_BASE MVEBU
[PATCH v8 13/13] FWU: doc: Add documentation for the FWU feature
Add documentattion for the FWU Multi Bank Update feature. The document describes the steps needed for setting up the platform for the feature, as well as steps for enabling the feature on the platform. Signed-off-by: Sughosh Ganu --- Changes since V7: * Handle the various review comments from Heinrich. doc/develop/uefi/fwu_updates.rst | 165 +++ doc/develop/uefi/index.rst | 1 + doc/develop/uefi/uefi.rst| 2 + 3 files changed, 168 insertions(+) create mode 100644 doc/develop/uefi/fwu_updates.rst diff --git a/doc/develop/uefi/fwu_updates.rst b/doc/develop/uefi/fwu_updates.rst new file mode 100644 index 00..fad3fbb3a8 --- /dev/null +++ b/doc/develop/uefi/fwu_updates.rst @@ -0,0 +1,165 @@ +.. SPDX-License-Identifier: GPL-2.0+ +.. Copyright (c) 2022 Linaro Limited + +FWU Multi Bank Updates in U-Boot + + +The FWU Multi Bank Update feature implements the firmware update +mechanism described in the PSA Firmware Update for A-profile Arm +Architecture specification [1]. Certain aspects of the Dependable +Boot specification [2] are also implemented. The feature provides a +mechanism to have multiple banks of updatable firmware images and for +updating the firmware images on the non-booted bank. On a successful +update, the platform boots from the updated bank on subsequent +boot. The UEFI capsule-on-disk update feature is used for performing +the actual updates of the updatable firmware images. + +The bookkeeping of the updatable images is done through a structure +called metadata. Currently, the FWU metadata supports identification +of images based on image GUIDs stored on a GPT partitioned storage +media. There are plans to extend the metadata structure for non GPT +partitioned devices as well. + +Accessing the FWU metadata is done through generic API's which are +defined in a driver which complies with the U-Boot's driver model. A +new uclass UCLASS_FWU_MDATA has been added for accessing the FWU +metadata. Individual drivers can be added based on the type of storage +media, and it's partitioning method. Details of the storage device +containing the FWU metadata partitions are specified through a U-Boot +specific device tree property `fwu-mdata-store`. Please refer to +U-Boot `doc `__ +for the device tree bindings. + +Enabling the FWU Multi Bank Update feature +-- + +The feature can be enabled by specifying the following configs:: + +CONFIG_EFI_CAPSULE_ON_DISK=y +CONFIG_EFI_CAPSULE_FIRMWARE_MANAGEMENT=y +CONFIG_EFI_CAPSULE_FIRMWARE=y +CONFIG_EFI_CAPSULE_FIRMWARE_RAW=y + +CONFIG_FWU_MULTI_BANK_UPDATE=y +CONFIG_CMD_FWU_METADATA=y +CONFIG_DM_FWU_MDATA=y +CONFIG_FWU_MDATA_GPT_BLK=y +CONFIG_FWU_NUM_BANKS= +CONFIG_FWU_NUM_IMAGES_PER_BANK= + +in the .config file + +The first group of configuration settings enable the UEFI +capsule-on-disk update functionality. The second group of configs +enable the FWU Multi Bank Update functionality. Please refer to the +section :ref:`uefi_capsule_update_ref` for more details on generation +of the UEFI capsule. + +Setting up the device for GPT partitioned storage +- + +Before enabling the functionality in U-Boot, a GPT partitioned storage +device is required. Assuming a GPT partitioned storage device, the +storage media needs to be partitioned with the correct number of +partitions, given the number of banks and number of images per bank +that the platform is going to support. Each updatable firmware image +will be stored on an separate partition. In addition, the two copies +of the FWU metadata will be stored on two separate partitions. + +As an example, a platform supporting two banks with each bank +containing three images would need to have 2 * 3 = 6 partitions plus +the two metadata partitions, or 8 partitions. In addition the storage +media can have additional partitions of non-updatable images, like the +EFI System Partition(ESP), a partition for the root file system +etc. An example list of images on the storage medium would be + +* FWU metadata 1 +* U-Boot 1 +* OP-TEE 1 +* FWU metadata 2 +* OP-TEE 2 +* U-Boot 2 +* ESP +* rootfs + +When generating the partitions, a few aspects need to be taken care +of. Each GPT partition entry in the GPT header has two GUIDs:: + +* PartitionTypeGUID +* UniquePartitionGUID + +The PartitionTypeGUID value should correspond to the +``image_type_uuid`` field of the FWU metadata. This field is used to +identify a given type of updatable firmware image, e.g. U-Boot, +OP-TEE, FIP etc. This GUID should also be used for specifying the +`--guid` parameter when generating the capsule. + +The UniquePartitionGUID value should correspond to the ``image_uuid`` +field in the FWU metadata. This GUID is used to identify images of a +given image type in different banks. + +Similarly, the FWU specifications defines the GUID value to be used +for th
[PATCH v8 12/13] mkeficapsule: Add support for setting OEM flags in capsule header
Add support for setting OEM flags in the capsule header. As per the UEFI specification, bits 0-15 of the flags member of the capsule header can be defined per capsule GUID. The oemflags will be used for the FWU Multi Bank update feature, as specified by the Dependable Boot specification[1]. Bit 15 of the flags member will be used to determine if the acceptance/rejection of the updated images is to be done by the firmware or an external component like the OS. [1] - https://git.codelinaro.org/linaro/dependable-boot/mbfw/uploads/6f7ddfe3be24e18d4319e108a758d02e/mbfw.pdf Signed-off-by: Sughosh Ganu Reviewed-by: Ilias Apalodimas --- Changes since V7: None doc/mkeficapsule.1 | 4 tools/mkeficapsule.c | 17 ++--- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/doc/mkeficapsule.1 b/doc/mkeficapsule.1 index 77ca061efd..6fb2dd0810 100644 --- a/doc/mkeficapsule.1 +++ b/doc/mkeficapsule.1 @@ -72,6 +72,10 @@ Generate a firmware acceptance empty capsule .BI "-R\fR,\fB --fw-revert " Generate a firmware revert empty capsule +.TP +.BI "-o\fR,\fB --capoemflag " +Capsule OEM flag, value between 0x to 0x + .TP .BR -h ", " --help Print a help message diff --git a/tools/mkeficapsule.c b/tools/mkeficapsule.c index 25bfb39e5b..b24f873b48 100644 --- a/tools/mkeficapsule.c +++ b/tools/mkeficapsule.c @@ -29,7 +29,7 @@ static const char *tool_name = "mkeficapsule"; efi_guid_t efi_guid_fm_capsule = EFI_FIRMWARE_MANAGEMENT_CAPSULE_ID_GUID; efi_guid_t efi_guid_cert_type_pkcs7 = EFI_CERT_TYPE_PKCS7_GUID; -static const char *opts_short = "g:i:I:v:p:c:m:dhAR"; +static const char *opts_short = "g:i:I:v:p:c:m:o:dhAR"; enum { CAPSULE_NORMAL_BLOB = 0, @@ -47,6 +47,7 @@ static struct option options[] = { {"dump-sig", no_argument, NULL, 'd'}, {"fw-accept", no_argument, NULL, 'A'}, {"fw-revert", no_argument, NULL, 'R'}, + {"capoemflag", required_argument, NULL, 'o'}, {"help", no_argument, NULL, 'h'}, {NULL, 0, NULL, 0}, }; @@ -65,6 +66,7 @@ static void print_usage(void) "\t-d, --dump_sig dump signature (*.p7)\n" "\t-A, --fw-accept firmware accept capsule, requires GUID, no image blob\n" "\t-R, --fw-revert firmware revert capsule, takes no GUID, no image blob\n" + "\t-o, --capoemflag Capsule OEM Flag, an integer between 0x and 0x\n" "\t-h, --help print a help message\n", tool_name); } @@ -387,6 +389,7 @@ static void free_sig_data(struct auth_context *ctx) * @mcount:Monotonic count in authentication information * @private_file: Path to a private key file * @cert_file: Path to a certificate file + * @oemflags: Capsule OEM Flags, bits 0-15 * * This function actually does the job of creating an uefi capsule file. * All the arguments must be supplied. @@ -399,7 +402,8 @@ static void free_sig_data(struct auth_context *ctx) */ static int create_fwbin(char *path, char *bin, efi_guid_t *guid, unsigned long index, unsigned long instance, - uint64_t mcount, char *privkey_file, char *cert_file) + uint64_t mcount, char *privkey_file, char *cert_file, + uint16_t oemflags) { struct efi_capsule_header header; struct efi_firmware_management_capsule_header capsule; @@ -464,6 +468,8 @@ static int create_fwbin(char *path, char *bin, efi_guid_t *guid, header.header_size = sizeof(header); /* TODO: The current implementation ignores flags */ header.flags = CAPSULE_FLAGS_PERSIST_ACROSS_RESET; + if (oemflags) + header.flags |= oemflags; header.capsule_image_size = sizeof(header) + sizeof(capsule) + sizeof(uint64_t) + sizeof(image) @@ -635,6 +641,7 @@ int main(int argc, char **argv) unsigned char uuid_buf[16]; unsigned long index, instance; uint64_t mcount; + uint16_t oemflags; char *privkey_file, *cert_file; int c, idx; @@ -646,6 +653,7 @@ int main(int argc, char **argv) cert_file = NULL; dump_sig = 0; capsule_type = CAPSULE_NORMAL_BLOB; + oemflags = 0; for (;;) { c = getopt_long(argc, argv, opts_short, options, &idx); if (c == -1) @@ -709,6 +717,9 @@ int main(int argc, char **argv) } capsule_type = CAPSULE_REVERT; break; + case 'o': + oemflags = strtoul(optarg, NULL, 0); + break; default: print_usage(); exit(EXIT_SUCCESS); @@ -736,7 +747,7 @@ int main(int argc, char **argv) } } else if (create_fwbin(argv[argc - 1], argv[argc -
[PATCH v8 11/13] mkeficapsule: Add support for generating empty capsules
The Dependable Boot specification[1] describes the structure of the firmware accept and revert capsules. These are empty capsules which are used for signalling the acceptance or rejection of the updated firmware by the OS. Add support for generating these empty capsules. [1] - https://git.codelinaro.org/linaro/dependable-boot/mbfw/uploads/6f7ddfe3be24e18d4319e108a758d02e/mbfw.pdf Signed-off-by: Sughosh Ganu --- Changes since V7: * Modify the logic to check the setting of both -A and -R options being passed to the tool, as suggested by Ilias. doc/mkeficapsule.1 | 29 + tools/eficapsule.h | 8 tools/mkeficapsule.c | 96 3 files changed, 119 insertions(+), 14 deletions(-) diff --git a/doc/mkeficapsule.1 b/doc/mkeficapsule.1 index 09bdc24295..77ca061efd 100644 --- a/doc/mkeficapsule.1 +++ b/doc/mkeficapsule.1 @@ -8,7 +8,7 @@ mkeficapsule \- Generate EFI capsule file for U-Boot .SH SYNOPSIS .B mkeficapsule -.RI [ options "] " image-blob " " capsule-file +.RI [ options ] " " [ image-blob ] " " capsule-file .SH "DESCRIPTION" .B mkeficapsule @@ -23,8 +23,13 @@ Optionally, a capsule file can be signed with a given private key. In this case, the update will be authenticated by verifying the signature before applying. +Additionally, an empty capsule file can be generated for acceptance or +rejection of firmware images by a governing component like an Operating +System. The empty capsules do not require an image-blob input file. + + .B mkeficapsule -takes any type of image files, including: +takes any type of image files when generating non empty capsules, including: .TP .I raw image format is a single binary blob of any type of firmware. @@ -36,18 +41,16 @@ multiple binary blobs in a single capsule file. This type of image file can be generated by .BR mkimage . -.PP -If you want to use other types than above two, you should explicitly -specify a guid for the FMP driver. - .SH "OPTIONS" + .TP .BI "-g\fR,\fB --guid " guid-string Specify guid for image blob type. The format is: ---- The first three elements are in little endian, while the rest -is in big endian. +is in big endian. The option must be specified for all non empty and +image acceptance capsules .TP .BI "-i\fR,\fB --index " index @@ -57,6 +60,18 @@ Specify an image index .BI "-I\fR,\fB --instance " instance Specify a hardware instance +.PP +For generation of firmware accept empty capsule +.BR --guid +is mandatory +.TP +.BI "-A\fR,\fB --fw-accept " +Generate a firmware acceptance empty capsule + +.TP +.BI "-R\fR,\fB --fw-revert " +Generate a firmware revert empty capsule + .TP .BR -h ", " --help Print a help message diff --git a/tools/eficapsule.h b/tools/eficapsule.h index d63b831443..072a4b5598 100644 --- a/tools/eficapsule.h +++ b/tools/eficapsule.h @@ -41,6 +41,14 @@ typedef struct { EFI_GUID(0x4aafd29d, 0x68df, 0x49ee, 0x8a, 0xa9, \ 0x34, 0x7d, 0x37, 0x56, 0x65, 0xa7) +#define FW_ACCEPT_OS_GUID \ + EFI_GUID(0x0c996046, 0xbcc0, 0x4d04, 0x85, 0xec, \ +0xe1, 0xfc, 0xed, 0xf1, 0xc6, 0xf8) + +#define FW_REVERT_OS_GUID \ + EFI_GUID(0xacd58b4b, 0xc0e8, 0x475f, 0x99, 0xb5, \ +0x6b, 0x3f, 0x7e, 0x07, 0xaa, 0xf0) + /* flags */ #define CAPSULE_FLAGS_PERSIST_ACROSS_RESET 0x0001 diff --git a/tools/mkeficapsule.c b/tools/mkeficapsule.c index 5f74d23b9e..25bfb39e5b 100644 --- a/tools/mkeficapsule.c +++ b/tools/mkeficapsule.c @@ -29,7 +29,13 @@ static const char *tool_name = "mkeficapsule"; efi_guid_t efi_guid_fm_capsule = EFI_FIRMWARE_MANAGEMENT_CAPSULE_ID_GUID; efi_guid_t efi_guid_cert_type_pkcs7 = EFI_CERT_TYPE_PKCS7_GUID; -static const char *opts_short = "g:i:I:v:p:c:m:dh"; +static const char *opts_short = "g:i:I:v:p:c:m:dhAR"; + +enum { + CAPSULE_NORMAL_BLOB = 0, + CAPSULE_ACCEPT, + CAPSULE_REVERT, +} capsule_type; static struct option options[] = { {"guid", required_argument, NULL, 'g'}, @@ -39,6 +45,8 @@ static struct option options[] = { {"certificate", required_argument, NULL, 'c'}, {"monotonic-count", required_argument, NULL, 'm'}, {"dump-sig", no_argument, NULL, 'd'}, + {"fw-accept", no_argument, NULL, 'A'}, + {"fw-revert", no_argument, NULL, 'R'}, {"help", no_argument, NULL, 'h'}, {NULL, 0, NULL, 0}, }; @@ -55,6 +63,8 @@ static void print_usage(void) "\t-c, --certificate signer's certificate file\n" "\t-m, --monotonic-count monotonic count\n" "\t-d, --dump_sig dump signature (*.p7)\n" + "\t-A, --fw-accept firmware accept capsule, requires GUID, no image blob\n" + "\t-R, --fw-revert firmware revert capsule, takes no GUID, no image blob\n" "\t-h, --help print a help message\n", tool_name); } @
[PATCH v8 10/13] FWU: cmd: Add a command to read FWU metadata
Add a command to read the metadata as specified in the FWU specification and print the fields of the metadata. Signed-off-by: Sughosh Ganu Reviewed-by: Ilias Apalodimas --- Changes since V7: None cmd/Kconfig | 7 + cmd/Makefile| 1 + cmd/fwu_mdata.c | 80 + 3 files changed, 88 insertions(+) create mode 100644 cmd/fwu_mdata.c diff --git a/cmd/Kconfig b/cmd/Kconfig index 211ebe9c87..95e762d21c 100644 --- a/cmd/Kconfig +++ b/cmd/Kconfig @@ -161,6 +161,13 @@ config CMD_CPU internal name) and clock frequency. Other information may be available depending on the CPU driver. +config CMD_FWU_METADATA + bool "fwu metadata read" + depends on FWU_MULTI_BANK_UPDATE + default y + help + Command to read the metadata and dump it's contents + config CMD_LICENSE bool "license" select BUILD_BIN2C diff --git a/cmd/Makefile b/cmd/Makefile index 6e87522b62..ff6e160f4a 100644 --- a/cmd/Makefile +++ b/cmd/Makefile @@ -76,6 +76,7 @@ obj-$(CONFIG_CMD_FPGA) += fpga.o obj-$(CONFIG_CMD_FPGAD) += fpgad.o obj-$(CONFIG_CMD_FS_GENERIC) += fs.o obj-$(CONFIG_CMD_FUSE) += fuse.o +obj-$(CONFIG_CMD_FWU_METADATA) += fwu_mdata.o obj-$(CONFIG_CMD_GETTIME) += gettime.o obj-$(CONFIG_CMD_GPIO) += gpio.o obj-$(CONFIG_CMD_HVC) += smccc.o diff --git a/cmd/fwu_mdata.c b/cmd/fwu_mdata.c new file mode 100644 index 00..ee9d035374 --- /dev/null +++ b/cmd/fwu_mdata.c @@ -0,0 +1,80 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ +/* + * Copyright (c) 2022, Linaro Limited + */ + +#include +#include +#include +#include +#include +#include +#include + +#include + +static void print_mdata(struct fwu_mdata *mdata) +{ + int i, j; + struct fwu_image_entry *img_entry; + struct fwu_image_bank_info *img_info; + + printf("\tFWU Metadata\n"); + printf("crc32: %#x\n", mdata->crc32); + printf("version: %#x\n", mdata->version); + printf("active_index: %#x\n", mdata->active_index); + printf("previous_active_index: %#x\n", mdata->previous_active_index); + + printf("\tImage Info\n"); + for (i = 0; i < CONFIG_FWU_NUM_IMAGES_PER_BANK; i++) { + img_entry = &mdata->img_entry[i]; + printf("\nImage Type Guid: %pUL\n", + &img_entry->image_type_uuid); + printf("Location Guid: %pUL\n", &img_entry->location_uuid); + for (j = 0; j < CONFIG_FWU_NUM_BANKS; j++) { + img_info = &img_entry->img_bank_info[j]; + printf("Image Guid: %pUL\n", &img_info->image_uuid); + printf("Image Acceptance: %s\n", + img_info->accepted == 0x1 ? "yes" : "no"); + } + } +} + +int do_fwu_mdata_read(struct cmd_tbl *cmdtp, int flag, +int argc, char * const argv[]) +{ + struct udevice *dev; + int ret = CMD_RET_SUCCESS, res; + struct fwu_mdata *mdata = NULL; + + if (uclass_get_device(UCLASS_FWU_MDATA, 0, &dev) || !dev) { + log_err("Unable to get FWU metadata device\n"); + return CMD_RET_FAILURE; + } + + res = fwu_mdata_check(); + if (res < 0) { + log_err("FWU Metadata check failed\n"); + ret = CMD_RET_FAILURE; + goto out; + } + + res = fwu_get_mdata(&mdata); + if (res < 0) { + log_err("Unable to get valid FWU metadata\n"); + ret = CMD_RET_FAILURE; + goto out; + } + + print_mdata(mdata); + +out: + free(mdata); + return ret; +} + +U_BOOT_CMD( + fwu_mdata_read, 1, 1, do_fwu_mdata_read, + "Read and print FWU metadata", + "" +); -- 2.34.1
[PATCH v8 09/13] FWU: Add support for the FWU Multi Bank Update feature
The FWU Multi Bank Update feature supports updation of firmware images to one of multiple sets(also called banks) of images. The firmware images are clubbed together in banks, with the system booting images from the active bank. Information on the images such as which bank they belong to is stored as part of the metadata structure, which is stored on the same storage media as the firmware images on a dedicated partition. At the time of update, the metadata is read to identify the bank to which the images need to be flashed(update bank). On a successful update, the metadata is modified to set the updated bank as active bank to subsequently boot from. Signed-off-by: Sughosh Ganu --- Changes since V7: * Introduce a new function fwu_to_efi_error() and check for all errors returned by the fwu API's through this function, as suggested by Ilias. * Call fwu_trial_state_ctr_start() only when the OS is supposed to accept/reject the updated images. include/fwu.h| 10 ++ lib/Kconfig | 6 + lib/Makefile | 1 + lib/efi_loader/efi_capsule.c | 213 ++- lib/efi_loader/efi_setup.c | 3 +- lib/fwu_updates/Kconfig | 31 + lib/fwu_updates/fwu.c| 13 +++ 7 files changed, 271 insertions(+), 6 deletions(-) create mode 100644 lib/fwu_updates/Kconfig diff --git a/include/fwu.h b/include/fwu.h index d863b23a5a..a42fb31bd1 100644 --- a/include/fwu.h +++ b/include/fwu.h @@ -32,13 +32,23 @@ struct fwu_mdata_ops { }; #define FWU_MDATA_VERSION 0x1 +#define FWU_IMAGE_ACCEPTED 0x1 #define FWU_MDATA_GUID \ EFI_GUID(0x8a7a84a0, 0x8387, 0x40f6, 0xab, 0x41, \ 0xa8, 0xb9, 0xa5, 0xa6, 0x0d, 0x23) +#define FWU_OS_REQUEST_FW_REVERT_GUID \ + EFI_GUID(0xacd58b4b, 0xc0e8, 0x475f, 0x99, 0xb5, \ +0x6b, 0x3f, 0x7e, 0x07, 0xaa, 0xf0) + +#define FWU_OS_REQUEST_FW_ACCEPT_GUID \ + EFI_GUID(0x0c996046, 0xbcc0, 0x4d04, 0x85, 0xec, \ +0xe1, 0xfc, 0xed, 0xf1, 0xc6, 0xf8) + u8 fwu_update_checks_pass(void); int fwu_boottime_checks(void); +int fwu_trial_state_ctr_start(void); int fwu_get_mdata(struct fwu_mdata **mdata); int fwu_update_mdata(struct fwu_mdata *mdata); diff --git a/lib/Kconfig b/lib/Kconfig index 6121c80dc8..6abe1d0a86 100644 --- a/lib/Kconfig +++ b/lib/Kconfig @@ -978,3 +978,9 @@ config LMB_RESERVED_REGIONS memory blocks. endmenu + +menu "FWU Multi Bank Updates" + +source lib/fwu_updates/Kconfig + +endmenu diff --git a/lib/Makefile b/lib/Makefile index e3deb15287..f2cfd1e428 100644 --- a/lib/Makefile +++ b/lib/Makefile @@ -9,6 +9,7 @@ obj-$(CONFIG_EFI) += efi/ obj-$(CONFIG_EFI_LOADER) += efi_driver/ obj-$(CONFIG_EFI_LOADER) += efi_loader/ obj-$(CONFIG_CMD_BOOTEFI_SELFTEST) += efi_selftest/ +obj-$(CONFIG_FWU_MULTI_BANK_UPDATE) += fwu_updates/ obj-$(CONFIG_LZMA) += lzma/ obj-$(CONFIG_BZIP2) += bzip2/ obj-$(CONFIG_FIT) += libfdt/ diff --git a/lib/efi_loader/efi_capsule.c b/lib/efi_loader/efi_capsule.c index a6b98f066a..44c56443dc 100644 --- a/lib/efi_loader/efi_capsule.c +++ b/lib/efi_loader/efi_capsule.c @@ -14,6 +14,7 @@ #include #include #include +#include #include #include #include @@ -32,6 +33,17 @@ static const efi_guid_t efi_guid_firmware_management_capsule_id = EFI_FIRMWARE_MANAGEMENT_CAPSULE_ID_GUID; const efi_guid_t efi_guid_firmware_management_protocol = EFI_FIRMWARE_MANAGEMENT_PROTOCOL_GUID; +const efi_guid_t fwu_guid_os_request_fw_revert = + FWU_OS_REQUEST_FW_REVERT_GUID; +const efi_guid_t fwu_guid_os_request_fw_accept = + FWU_OS_REQUEST_FW_ACCEPT_GUID; + +#define FW_ACCEPT_OS (u32)0x8000 + +__maybe_unused static u32 update_index; +__maybe_unused static bool capsule_update; +__maybe_unused static bool fw_accept_os; +static bool image_index_check = true; #ifdef CONFIG_EFI_CAPSULE_ON_DISK /* for file system access */ @@ -205,7 +217,8 @@ efi_fmp_find(efi_guid_t *image_type, u8 image_index, u64 instance, log_debug("+++ desc[%d] index: %d, name: %ls\n", j, desc->image_index, desc->image_id_name); if (!guidcmp(&desc->image_type_id, image_type) && - (desc->image_index == image_index) && + (!image_index_check || +desc->image_index == image_index) && (!instance || !desc->hardware_instance || desc->hardware_instance == instance)) @@ -388,6 +401,83 @@ efi_status_t efi_capsule_authenticate(const void *capsule, efi_uintn_t capsule_s } #endif /* CONFIG_EFI_CAPSULE_AUTHENTICATE */ +static bool fwu_empty_capsule(struct efi_capsule_header *capsule) +{ + return !guidcmp(&capsule->capsule_guid, + &fwu_guid_os_request_fw_revert) || + !guidcmp(&capsule->capsul
[PATCH v8 08/13] FWU: Add boot time checks as highlighted by the FWU specification
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. Add these checks in the board initialisation sequence, invoked after relocation. Signed-off-by: Sughosh Ganu --- Changes since V7: * Introduce trial_counter_update() to increment and delete the TrialStateCtr variable. * Introduce in_trial_state() to check if the platform is booting in Trial State. common/board_r.c | 5 ++ include/fwu.h | 3 + lib/fwu_updates/fwu.c | 175 ++ 3 files changed, 183 insertions(+) diff --git a/common/board_r.c b/common/board_r.c index 56eb60fa27..425644dda7 100644 --- a/common/board_r.c +++ b/common/board_r.c @@ -18,6 +18,7 @@ #ifdef CONFIG_MTD_NOR_FLASH #include #endif +#include #include #include #include @@ -788,6 +789,10 @@ static init_fnc_t init_sequence_r[] = { #if defined(CONFIG_PRAM) initr_mem, #endif + +#ifdef CONFIG_FWU_MULTI_BANK_UPDATE + fwu_boottime_checks, +#endif run_main_loop, }; diff --git a/include/fwu.h b/include/fwu.h index cfc9aafc7d..d863b23a5a 100644 --- a/include/fwu.h +++ b/include/fwu.h @@ -37,6 +37,9 @@ struct fwu_mdata_ops { EFI_GUID(0x8a7a84a0, 0x8387, 0x40f6, 0xab, 0x41, \ 0xa8, 0xb9, 0xa5, 0xa6, 0x0d, 0x23) +u8 fwu_update_checks_pass(void); +int fwu_boottime_checks(void); + int fwu_get_mdata(struct fwu_mdata **mdata); int fwu_update_mdata(struct fwu_mdata *mdata); int fwu_get_active_index(u32 *active_idx); diff --git a/lib/fwu_updates/fwu.c b/lib/fwu_updates/fwu.c index 9808036eec..4871e0ccd6 100644 --- a/lib/fwu_updates/fwu.c +++ b/lib/fwu_updates/fwu.c @@ -3,8 +3,20 @@ * Copyright (c) 2022, Linaro Limited */ + +#include +#include +#include +#include #include #include +#include + +#include +#include + +static u8 trial_state; +static u8 boottime_check; __weak int fwu_plat_get_update_index(u32 *update_idx) { @@ -20,3 +32,166 @@ __weak int fwu_plat_get_update_index(u32 *update_idx) 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; + } + } + + return 0; +} + +static int fwu_trial_state_check(void) +{ + int ret; + efi_status_t status; + efi_uintn_t var_size; + u16 trial_state_ctr; + u32 var_attributes, active_idx; + struct fwu_mdata *mdata = NULL; + + ret = fwu_get_mdata(&mdata); + if (ret) + return ret; + + if ((trial_state = in_trial_state(mdata))) { + var_size = (efi_uintn_t)sizeof(trial_state_ctr); + log_info("System booting in Trial State\n"); + var_attributes = EFI_VARIABLE_NON_VOLATILE | + EFI_VARIABLE_BOOTSERVICE_ACCESS; + status = efi_get_variable_int(u"TrialStateCtr", + &efi_global_variable_guid, + &var_attributes, + &var_size, &trial_state_ctr, +
[PATCH v8 07/13] FWU: STM32MP1: Add support to read boot index from backup register
The FWU Multi Bank Update feature allows the platform to boot the firmware images from one of the partitions(banks). The first stage bootloader(fsbl) passes the value of the boot index, i.e. the bank from which the firmware images were booted from to U-Boot. On the STM32MP157C-DK2 board, this value is passed through one of the SoC's backup register. Add a function to read the boot index value from the backup register. Signed-off-by: Sughosh Ganu Reviewed-by: Patrick Delaunay Acked-by: Ilias Apalodimas --- Changes since V7: None arch/arm/mach-stm32mp/include/mach/stm32.h | 5 + board/st/stm32mp1/stm32mp1.c | 13 + include/fwu.h | 1 + 3 files changed, 19 insertions(+) diff --git a/arch/arm/mach-stm32mp/include/mach/stm32.h b/arch/arm/mach-stm32mp/include/mach/stm32.h index c70375a723..c85ae6a34e 100644 --- a/arch/arm/mach-stm32mp/include/mach/stm32.h +++ b/arch/arm/mach-stm32mp/include/mach/stm32.h @@ -112,11 +112,16 @@ enum boot_device { #ifdef CONFIG_STM32MP15x #define TAMP_BACKUP_MAGIC_NUMBER TAMP_BACKUP_REGISTER(4) #define TAMP_BACKUP_BRANCH_ADDRESS TAMP_BACKUP_REGISTER(5) +#define TAMP_FWU_BOOT_INFO_REG TAMP_BACKUP_REGISTER(10) #define TAMP_COPRO_RSC_TBL_ADDRESS TAMP_BACKUP_REGISTER(17) #define TAMP_COPRO_STATE TAMP_BACKUP_REGISTER(18) #define TAMP_BOOT_CONTEXT TAMP_BACKUP_REGISTER(20) #define TAMP_BOOTCOUNT TAMP_BACKUP_REGISTER(21) +#define TAMP_FWU_BOOT_IDX_MASK GENMASK(3, 0) + +#define TAMP_FWU_BOOT_IDX_OFFSET 0 + #define TAMP_COPRO_STATE_OFF 0 #define TAMP_COPRO_STATE_INIT 1 #define TAMP_COPRO_STATE_CRUN 2 diff --git a/board/st/stm32mp1/stm32mp1.c b/board/st/stm32mp1/stm32mp1.c index 0fda8f150d..0a63703312 100644 --- a/board/st/stm32mp1/stm32mp1.c +++ b/board/st/stm32mp1/stm32mp1.c @@ -966,3 +966,16 @@ static void board_copro_image_process(ulong fw_image, size_t fw_size) } U_BOOT_FIT_LOADABLE_HANDLER(IH_TYPE_COPRO, board_copro_image_process); + +#if defined(CONFIG_FWU_MULTI_BANK_UPDATE) + +#include + +void fwu_plat_get_bootidx(void *boot_idx) +{ + u32 *bootidx = boot_idx; + + *bootidx = (readl(TAMP_FWU_BOOT_INFO_REG) >> + TAMP_FWU_BOOT_IDX_OFFSET) & TAMP_FWU_BOOT_IDX_MASK; +} +#endif /* CONFIG_FWU_MULTI_BANK_UPDATE */ diff --git a/include/fwu.h b/include/fwu.h index f14175cc9a..cfc9aafc7d 100644 --- a/include/fwu.h +++ b/include/fwu.h @@ -49,6 +49,7 @@ int fwu_revert_boot_index(void); int fwu_accept_image(efi_guid_t *img_type_id, u32 bank); int fwu_clear_accept_image(efi_guid_t *img_type_id, u32 bank); +void fwu_plat_get_bootidx(void *boot_idx); int fwu_plat_get_alt_num(struct udevice *dev, efi_guid_t *image_guid, int *alt_num); int fwu_plat_get_update_index(u32 *update_idx); -- 2.34.1
[PATCH v8 06/13] FWU: Add helper functions for accessing FWU metadata
Add weak functions for getting the update index value and dfu alternate number needed for FWU Multi Bank update functionality. The current implementation for getting the update index value is for platforms with 2 banks. If a platform supports more than 2 banks, it can implement it's own function. The function to get the dfu alternate number has been added for platforms with GPT partitioned storage devices. Platforms with other storage partition scheme need to implement their own function. Signed-off-by: Sughosh Ganu Reviewed-by: Patrick Delaunay --- Changes since V7: * Moved the API's fwu_plat_get_update_index() and fwu_plat_get_alt_num() as weak functions in common code as suggested by Ilias. include/fwu.h | 1 + lib/fwu_updates/Makefile | 7 +++ lib/fwu_updates/fwu.c | 22 lib/fwu_updates/fwu_gpt.c | 104 ++ 4 files changed, 134 insertions(+) create mode 100644 lib/fwu_updates/Makefile create mode 100644 lib/fwu_updates/fwu.c create mode 100644 lib/fwu_updates/fwu_gpt.c diff --git a/include/fwu.h b/include/fwu.h index 8259c75d12..f14175cc9a 100644 --- a/include/fwu.h +++ b/include/fwu.h @@ -51,4 +51,5 @@ int fwu_clear_accept_image(efi_guid_t *img_type_id, u32 bank); int fwu_plat_get_alt_num(struct udevice *dev, efi_guid_t *image_guid, int *alt_num); +int fwu_plat_get_update_index(u32 *update_idx); #endif /* _FWU_H_ */ diff --git a/lib/fwu_updates/Makefile b/lib/fwu_updates/Makefile new file mode 100644 index 00..1993088e5b --- /dev/null +++ b/lib/fwu_updates/Makefile @@ -0,0 +1,7 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# +# Copyright (c) 2022, Linaro Limited +# + +obj-$(CONFIG_FWU_MULTI_BANK_UPDATE) += fwu.o +obj-$(CONFIG_FWU_MDATA_GPT_BLK) += fwu_gpt.o diff --git a/lib/fwu_updates/fwu.c b/lib/fwu_updates/fwu.c new file mode 100644 index 00..9808036eec --- /dev/null +++ b/lib/fwu_updates/fwu.c @@ -0,0 +1,22 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* + * Copyright (c) 2022, Linaro Limited + */ + +#include +#include + +__weak int fwu_plat_get_update_index(u32 *update_idx) +{ + int ret; + u32 active_idx; + + ret = fwu_get_active_index(&active_idx); + + if (ret < 0) + return -1; + + *update_idx = active_idx ^= 0x1; + + return ret; +} diff --git a/lib/fwu_updates/fwu_gpt.c b/lib/fwu_updates/fwu_gpt.c new file mode 100644 index 00..b7ccca3645 --- /dev/null +++ b/lib/fwu_updates/fwu_gpt.c @@ -0,0 +1,104 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* + * Copyright (c) 2022, Linaro Limited + */ + +#include +#include +#include +#include +#include +#include +#include + +#include + +static int get_gpt_dfu_identifier(struct blk_desc *desc, efi_guid_t *image_guid) +{ + int i; + struct disk_partition info; + efi_guid_t unique_part_guid; + + for (i = 1; i < MAX_SEARCH_PARTITIONS; i++) { + if (part_get_info(desc, i, &info)) + continue; + uuid_str_to_bin(info.uuid, unique_part_guid.b, + UUID_STR_FORMAT_GUID); + + if (!guidcmp(&unique_part_guid, image_guid)) + return i; + } + + log_err("No partition found with image_guid %pUs\n", image_guid); + return -ENOENT; +} + +static int fwu_gpt_get_alt_num(struct blk_desc *desc, efi_guid_t *image_guid, + int *alt_num, unsigned char dfu_dev) +{ + int ret = -1; + int i, part, dev_num; + int nalt; + struct dfu_entity *dfu; + + dev_num = desc->devnum; + part = get_gpt_dfu_identifier(desc, image_guid); + if (part < 0) + return -ENOENT; + + dfu_init_env_entities(NULL, NULL); + + nalt = 0; + list_for_each_entry(dfu, &dfu_list, list) { + nalt++; + } + + if (!nalt) { + log_warning("No entities in dfu_alt_info\n"); + dfu_free_entities(); + return -ENOENT; + } + + for (i = 0; i < nalt; i++) { + dfu = dfu_get_entity(i); + + if (!dfu) + continue; + + /* +* Currently, Multi Bank update +* feature is being supported +* only on GPT partitioned +* MMC/SD devices. +*/ + if (dfu->dev_type != dfu_dev) + continue; + + if (dfu->layout == DFU_RAW_ADDR && + dfu->data.mmc.dev_num == dev_num && + dfu->data.mmc.part == part) { + *alt_num = dfu->alt; + ret = 0; + break; + } + } + + dfu_free_entities(); + + return ret; +} + +__weak int fwu_plat_get_alt_num(struct udevice *dev, efi_guid_t *image_guid, + int *al
[PATCH v8 05/13] stm32mp1: dk2: Add image information for capsule updates
Enabling capsule update functionality on the platform requires populating information on the images that are to be updated using the functionality. Do so for the DK2 board. Signed-off-by: Sughosh Ganu Reviewed-by: Patrick Delaunay Reviewed-by: Ilias Apalodimas --- Changes since V7: None board/st/stm32mp1/stm32mp1.c | 23 +++ include/configs/stm32mp15_common.h | 4 2 files changed, 27 insertions(+) diff --git a/board/st/stm32mp1/stm32mp1.c b/board/st/stm32mp1/stm32mp1.c index 9496890d16..0fda8f150d 100644 --- a/board/st/stm32mp1/stm32mp1.c +++ b/board/st/stm32mp1/stm32mp1.c @@ -11,6 +11,7 @@ #include #include #include +#include #include #include #include @@ -87,6 +88,16 @@ #define USB_START_LOW_THRESHOLD_UV 123 #define USB_START_HIGH_THRESHOLD_UV215 +#if CONFIG_IS_ENABLED(EFI_HAVE_CAPSULE_SUPPORT) +struct efi_fw_image fw_images[1]; + +struct efi_capsule_update_info update_info = { + .images = fw_images, +}; + +u8 num_image_type_guids = ARRAY_SIZE(fw_images); +#endif /* EFI_HAVE_CAPSULE_SUPPORT */ + int board_early_init_f(void) { /* nothing to do, only used in SPL */ @@ -670,6 +681,18 @@ int board_init(void) setup_led(LEDST_ON); +#if CONFIG_IS_ENABLED(EFI_HAVE_CAPSULE_SUPPORT) + if (board_is_stm32mp15x_dk2()) { + efi_guid_t image_type_guid = STM32MP15_DK2_FIP_IMAGE_GUID; + guidcpy(&fw_images[0].image_type_id, &image_type_guid); + fw_images[0].fw_name = u"STM32MP15-DK2-FIP"; + /* +* For FWU multi bank update, the image +* index will be computed at runtime +*/ + fw_images[0].image_index = 0; + } +#endif return 0; } diff --git a/include/configs/stm32mp15_common.h b/include/configs/stm32mp15_common.h index c5412ffeb3..6ab10d8ce5 100644 --- a/include/configs/stm32mp15_common.h +++ b/include/configs/stm32mp15_common.h @@ -34,6 +34,10 @@ #define CONFIG_SERVERIP 192.168.1.1 #endif +#define STM32MP15_DK2_FIP_IMAGE_GUID \ + EFI_GUID(0x19d5df83, 0x11b0, 0x457b, 0xbe, 0x2c, \ +0x75, 0x59, 0xc1, 0x31, 0x42, 0xa5) + /*/ #ifdef CONFIG_DISTRO_DEFAULTS /*/ -- 2.34.1
[PATCH v8 04/13] stm32mp1: dk2: Add a node for the FWU metadata device
The FWU metadata structure is accessed through the driver model interface. On the stm32mp157c-dk2 board, the FWU metadata is stored on the uSD card. Add the fwu-mdata node on the u-boot specifc dtsi file for accessing the metadata structure. Signed-off-by: Sughosh Ganu Reviewed-by: Patrick Delaunay Acked-by: Ilias Apalodimas --- Changes since V7: None arch/arm/dts/stm32mp157c-dk2-u-boot.dtsi | 7 +++ 1 file changed, 7 insertions(+) diff --git a/arch/arm/dts/stm32mp157c-dk2-u-boot.dtsi b/arch/arm/dts/stm32mp157c-dk2-u-boot.dtsi index 06ef3a4095..24f86209db 100644 --- a/arch/arm/dts/stm32mp157c-dk2-u-boot.dtsi +++ b/arch/arm/dts/stm32mp157c-dk2-u-boot.dtsi @@ -4,3 +4,10 @@ */ #include "stm32mp157a-dk1-u-boot.dtsi" + +/ { + fwu-mdata { + compatible = "u-boot,fwu-mdata-gpt"; + fwu-mdata-store = <&sdmmc1>; + }; +}; -- 2.34.1
[PATCH v8 03/13] FWU: Add FWU metadata access driver for GPT partitioned block devices
In the FWU Multi Bank Update feature, the information about the updatable images is stored as part of the metadata, on a separate partition. Add a driver for reading from and writing to the metadata when the updatable images and the metadata are stored on a block device which is formated with GPT based partition scheme. Signed-off-by: Sughosh Ganu Reviewed-by: Patrick Delaunay --- Changes since V7: None drivers/fwu-mdata/Kconfig | 9 + drivers/fwu-mdata/Makefile| 1 + drivers/fwu-mdata/fwu_mdata_gpt_blk.c | 410 ++ include/fwu.h | 5 + 4 files changed, 425 insertions(+) create mode 100644 drivers/fwu-mdata/fwu_mdata_gpt_blk.c diff --git a/drivers/fwu-mdata/Kconfig b/drivers/fwu-mdata/Kconfig index d6a21c8e19..d5edef19d6 100644 --- a/drivers/fwu-mdata/Kconfig +++ b/drivers/fwu-mdata/Kconfig @@ -5,3 +5,12 @@ config DM_FWU_MDATA Enable support for accessing FWU Metadata partitions. The FWU Metadata partitions reside on the same storage device which contains the other FWU updatable firmware images. + +config FWU_MDATA_GPT_BLK + bool "FWU Metadata access for GPT partitioned Block devices" + select PARTITION_TYPE_GUID + select PARTITION_UUIDS + depends on DM && HAVE_BLOCK_DEVICE && EFI_PARTITION + help + Enable support for accessing FWU Metadata on GPT partitioned + block devices. diff --git a/drivers/fwu-mdata/Makefile b/drivers/fwu-mdata/Makefile index e53a8c9983..313049f67a 100644 --- a/drivers/fwu-mdata/Makefile +++ b/drivers/fwu-mdata/Makefile @@ -4,3 +4,4 @@ # obj-$(CONFIG_DM_FWU_MDATA) += fwu-mdata-uclass.o +obj-$(CONFIG_FWU_MDATA_GPT_BLK) += fwu_mdata_gpt_blk.o diff --git a/drivers/fwu-mdata/fwu_mdata_gpt_blk.c b/drivers/fwu-mdata/fwu_mdata_gpt_blk.c new file mode 100644 index 00..f694c4369b --- /dev/null +++ b/drivers/fwu-mdata/fwu_mdata_gpt_blk.c @@ -0,0 +1,410 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* + * Copyright (c) 2022, Linaro Limited + */ + +#define LOG_CATEGORY UCLASS_FWU_MDATA + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +#define PRIMARY_PART BIT(0) +#define SECONDARY_PART BIT(1) +#define BOTH_PARTS (PRIMARY_PART | SECONDARY_PART) + +#define MDATA_READ BIT(0) +#define MDATA_WRITEBIT(1) + +static int gpt_get_mdata_partitions(struct blk_desc *desc, + u16 *primary_mpart, + u16 *secondary_mpart) +{ + int i, ret; + u32 mdata_parts; + efi_guid_t part_type_guid; + struct disk_partition info; + const efi_guid_t fwu_mdata_guid = FWU_MDATA_GUID; + + mdata_parts = 0; + for (i = 1; i < MAX_SEARCH_PARTITIONS; i++) { + if (part_get_info(desc, i, &info)) + continue; + uuid_str_to_bin(info.type_guid, part_type_guid.b, + UUID_STR_FORMAT_GUID); + + if (!guidcmp(&fwu_mdata_guid, &part_type_guid)) { + ++mdata_parts; + if (!*primary_mpart) + *primary_mpart = i; + else + *secondary_mpart = i; + } + } + + if (mdata_parts != 2) { + log_err("Expect two copies of the FWU metadata instead of %d\n", + mdata_parts); + ret = -EINVAL; + } else { + ret = 0; + } + + return ret; +} + +static int gpt_get_mdata_disk_part(struct blk_desc *desc, + struct disk_partition *info, + u32 part_num) +{ + int ret; + char *mdata_guid_str = "8a7a84a0-8387-40f6-ab41-a8b9a5a60d23"; + + ret = part_get_info(desc, part_num, info); + if (ret < 0) { + log_err("Unable to get the partition info for the FWU metadata part %d", + part_num); + return -1; + } + + /* Check that it is indeed the FWU metadata partition */ + if (!strncmp(info->type_guid, mdata_guid_str, UUID_STR_LEN)) { + /* Found the FWU metadata partition */ + return 0; + } + + return -1; +} + +static int gpt_read_write_mdata(struct blk_desc *desc, + struct fwu_mdata *mdata, + u8 access, u32 part_num) +{ + int ret; + u32 len, blk_start, blkcnt; + struct disk_partition info; + + ALLOC_CACHE_ALIGN_BUFFER_PAD(struct fwu_mdata, mdata_aligned, 1, +desc->blksz); + + ret = gpt_get_mdata_disk_part(desc, &info, part_num); + if (ret < 0) { + printf("Unable to get the FWU metadata parti
[PATCH v8 02/13] FWU: Add FWU metadata structure and driver for accessing metadata
In the FWU Multi Bank Update feature, the information about the updatable images is stored as part of the metadata, which is stored on a dedicated partition. Add the metadata structure, and a driver model uclass which provides functions to access the metadata. These are generic API's, and implementations can be added based on parameters like how the metadata partition is accessed and what type of storage device houses the metadata. Signed-off-by: Sughosh Ganu Reviewed-by: Patrick Delaunay --- Changes since V7: * Rephrased the error message in fwu_update_active_index as per suggestion from Ilias. * Reworked the logic in fwu_get_image_alt_num() as per the suggestion from Ilias. drivers/Kconfig | 2 + drivers/Makefile | 1 + drivers/fwu-mdata/Kconfig| 7 + drivers/fwu-mdata/Makefile | 6 + drivers/fwu-mdata/fwu-mdata-uclass.c | 463 +++ include/dm/uclass-id.h | 1 + include/fwu.h| 49 +++ include/fwu_mdata.h | 67 8 files changed, 596 insertions(+) create mode 100644 drivers/fwu-mdata/Kconfig create mode 100644 drivers/fwu-mdata/Makefile create mode 100644 drivers/fwu-mdata/fwu-mdata-uclass.c create mode 100644 include/fwu.h create mode 100644 include/fwu_mdata.h diff --git a/drivers/Kconfig b/drivers/Kconfig index 8b6fead351..75ac149d31 100644 --- a/drivers/Kconfig +++ b/drivers/Kconfig @@ -44,6 +44,8 @@ source "drivers/fuzz/Kconfig" source "drivers/fpga/Kconfig" +source "drivers/fwu-mdata/Kconfig" + source "drivers/gpio/Kconfig" source "drivers/hwspinlock/Kconfig" diff --git a/drivers/Makefile b/drivers/Makefile index eba9940231..70bbc2f5e0 100644 --- a/drivers/Makefile +++ b/drivers/Makefile @@ -84,6 +84,7 @@ obj-y += cache/ obj-$(CONFIG_CPU) += cpu/ obj-y += crypto/ obj-$(CONFIG_FASTBOOT) += fastboot/ +obj-$(CONFIG_DM_FWU_MDATA) += fwu-mdata/ obj-y += misc/ obj-$(CONFIG_MMC) += mmc/ obj-$(CONFIG_NVME) += nvme/ diff --git a/drivers/fwu-mdata/Kconfig b/drivers/fwu-mdata/Kconfig new file mode 100644 index 00..d6a21c8e19 --- /dev/null +++ b/drivers/fwu-mdata/Kconfig @@ -0,0 +1,7 @@ +config DM_FWU_MDATA + bool "Driver support for accessing FWU Metadata" + depends on DM + help + Enable support for accessing FWU Metadata partitions. The + FWU Metadata partitions reside on the same storage device + which contains the other FWU updatable firmware images. diff --git a/drivers/fwu-mdata/Makefile b/drivers/fwu-mdata/Makefile new file mode 100644 index 00..e53a8c9983 --- /dev/null +++ b/drivers/fwu-mdata/Makefile @@ -0,0 +1,6 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# +# Copyright (c) 2022, Linaro Limited +# + +obj-$(CONFIG_DM_FWU_MDATA) += fwu-mdata-uclass.o diff --git a/drivers/fwu-mdata/fwu-mdata-uclass.c b/drivers/fwu-mdata/fwu-mdata-uclass.c new file mode 100644 index 00..6bf7fa1b03 --- /dev/null +++ b/drivers/fwu-mdata/fwu-mdata-uclass.c @@ -0,0 +1,463 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* + * Copyright (c) 2022, Linaro Limited + */ + +#define LOG_CATEGORY UCLASS_FWU_MDATA + +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#define IMAGE_ACCEPT_SET BIT(0) +#define IMAGE_ACCEPT_CLEAR BIT(1) + +static int fwu_get_dev_ops(struct udevice **dev, + const struct fwu_mdata_ops **ops) +{ + int ret; + + ret = uclass_get_device(UCLASS_FWU_MDATA, 0, dev); + if (ret) { + log_debug("Cannot find fwu device\n"); + return ret; + } + + if ((*ops = device_get_ops(*dev)) == NULL) { + log_debug("Cannot get fwu device ops\n"); + return -ENOSYS; + } + + return 0; +} + +/** + * fwu_verify_mdata() - Verify the FWU metadata + * @mdata: FWU metadata structure + * @pri_part: FWU metadata partition is primary or secondary + * + * Verify the FWU metadata by computing the CRC32 for the metadata + * structure and comparing it against the CRC32 value stored as part + * of the structure. + * + * Return: 0 if OK, -ve on error + * + */ +int fwu_verify_mdata(struct fwu_mdata *mdata, bool pri_part) +{ + u32 calc_crc32; + void *buf; + + buf = &mdata->version; + calc_crc32 = crc32(0, buf, sizeof(*mdata) - sizeof(u32)); + + if (calc_crc32 != mdata->crc32) { + log_err("crc32 check failed for %s FWU metadata partition\n", + pri_part ? "primary" : "secondary"); + return -1; + } + + return 0; +} + +/** + * 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_ge
[PATCH v8 01/13] dt/bindings: Add bindings for GPT based FWU Metadata storage device
Add bindings needed for accessing the FWU metadata partitions. These include the compatible string which point to the access method and the actual device which stores the FWU metadata. The current patch adds basic bindings needed for accessing the metadata structure on GPT partitioned block devices. Signed-off-by: Sughosh Ganu Reviewed-by: Heinrich Schuchardt --- Changes since V7: None .../firmware/fwu-mdata-gpt.yaml | 32 +++ 1 file changed, 32 insertions(+) create mode 100644 doc/device-tree-bindings/firmware/fwu-mdata-gpt.yaml diff --git a/doc/device-tree-bindings/firmware/fwu-mdata-gpt.yaml b/doc/device-tree-bindings/firmware/fwu-mdata-gpt.yaml new file mode 100644 index 00..0735191ff1 --- /dev/null +++ b/doc/device-tree-bindings/firmware/fwu-mdata-gpt.yaml @@ -0,0 +1,32 @@ +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/firmware/fwu-mdata-gpt.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: FWU metadata on device with GPT partitioned layout + +maintainers: + - Sughosh Ganu + +properties: + compatible: +items: + - const: u-boot,fwu-mdata-gpt + + fwu-mdata-store: +maxItems: 1 +description: Phandle of the device which contains the FWU medatata partition. + +required: + - compatible + - fwu-mdata-store + +additionalProperties: false + +examples: + - | +fwu-mdata { +compatible = "u-boot,fwu-mdata-gpt"; +fwu-mdata-store = <&sdmmc1>; +}; -- 2.34.1
[PATCH v8 00/13] FWU: Add FWU Multi Bank Update feature support
The patchset adds support for the FWU Multi Bank Update[1] feature. Certain aspects of the Dependable Boot[2] specification have also been implemented. The FWU multi bank update feature is used for supporting multiple sets(also called banks) of firmware image(s), allowing the platform to boot from a different bank, in case it fails to boot from the active bank. This functionality is supported by keeping the relevant information in a structure called metadata, which provides information on the images. Among other parameters, the metadata structure contains information on the currect active bank that is being used to boot image(s). Functionality is being added to work with the UEFI capsule driver in u-boot. The metadata is read to gather information on the update bank, which is the bank to which the firmware images would be flashed to. On a successful completion of the update of all components, the active bank field in the metadata is updated, to reflect the bank from which the platform will boot on the subsequent boots. Currently, the feature is being enabled on the STM32MP157C-DK2 and Synquacer boards. The DK2 board boots a FIP image from a uSD card partitioned with the GPT partioning scheme, while the Synquacer board boots a FIP image from a MTD partitioned SPI NOR flash device. This feature also requires changes in a previous stage of bootloader, which parses the metadata and selects the bank to boot the image(s) from. Support has being added in tf-a(BL2 stage) for the STM32MP157C-DK2 board to boot the active bank images. These changes have been merged to the upstream tf-a repository. The patch for adding a python test for the feature has been developed, and was sent in the version 5 of the patches[3]. However, the test script depends on adding support for the feature on MTD SPI NOR devices, and that is being done as part of the Synquacer patches. Hence these set of patches do not have the test script for the feature. That will be added through the patches for adding support for the feauture on Synquacer platform. [1] - https://developer.arm.com/documentation/den0118/a [2] - https://git.codelinaro.org/linaro/dependable-boot/mbfw/uploads/6f7ddfe3be24e18d4319e108a758d02e/mbfw.pdf [3] - https://lists.denx.de/pipermail/u-boot/2022-June/485992.html Changes since V7: * Rephrased the error message in fwu_update_active_index as per suggestion from Ilias. * Reworked the logic in fwu_get_image_alt_num() as per the suggestion from Ilias. * Moved the API's fwu_plat_get_update_index() and fwu_plat_get_alt_num() as weak functions in common code as suggested by Ilias. * Introduce trial_counter_update() to increment and delete the TrialStateCtr variable. * Introduce in_trial_state() to check if the platform is booting in Trial State. * Introduce a new function fwu_to_efi_error() and check for all errors returned by the fwu API's through this function, as suggested by Ilias. * Call fwu_trial_state_ctr_start() only when the OS is supposed to accept/reject the updated images. * Modify the logic to check the setting of both -A and -R options being passed to the tool, as suggested by Ilias. * Handle the various review comments from Heinrich. Sughosh Ganu (13): dt/bindings: Add bindings for GPT based FWU Metadata storage device FWU: Add FWU metadata structure and driver for accessing metadata FWU: Add FWU metadata access driver for GPT partitioned block devices stm32mp1: dk2: Add a node for the FWU metadata device stm32mp1: dk2: Add image information for capsule updates FWU: Add helper functions for accessing FWU metadata FWU: STM32MP1: Add support to read boot index from backup register FWU: Add boot time checks as highlighted by the FWU specification FWU: Add support for the FWU Multi Bank Update feature FWU: cmd: Add a command to read FWU metadata mkeficapsule: Add support for generating empty capsules mkeficapsule: Add support for setting OEM flags in capsule header FWU: doc: Add documentation for the FWU feature arch/arm/dts/stm32mp157c-dk2-u-boot.dtsi | 7 + arch/arm/mach-stm32mp/include/mach/stm32.h| 5 + board/st/stm32mp1/stm32mp1.c | 36 ++ cmd/Kconfig | 7 + cmd/Makefile | 1 + cmd/fwu_mdata.c | 80 +++ common/board_r.c | 5 + doc/develop/uefi/fwu_updates.rst | 165 +++ doc/develop/uefi/index.rst| 1 + doc/develop/uefi/uefi.rst | 2 + .../firmware/fwu-mdata-gpt.yaml | 32 ++ doc/mkeficapsule.1| 33 +- drivers/Kconfig | 2 + drivers/Makefile | 1 + drivers/fwu-mdata/Kconfig | 16 + drivers/fwu-mdata/Makefile| 7 + drivers/fwu-mdata/fwu-mdata-uclass.c | 463 ++ drive
Re: [PATCH] cmd: tpm-v2: add get_random
Hi Oleksandr On Wed, Aug 17, 2022 at 01:27:16PM +0300, Oleksandr Suvorov wrote: > From: Jorge Ramirez-Ortiz > > Enable getting randomness from the tpm command line. Does it have to be the tpm command lime? As of 87ab234c1cf ("cmd: rng: Add support for selecting RNG device") you can explicitly select the device on the default rng command. That series also plugs in the TPM RNG into the DM and allows wider usage (e.g from the EFI_RNG_PROTOCOL) So the rng command should be good enough? Thanks /Ilias > > Signed-off-by: Jorge Ramirez-Ortiz > Co-developed-by: Oleksandr Suvorov > Signed-off-by: Oleksandr Suvorov > --- > > cmd/tpm-v2.c | 36 > 1 file changed, 36 insertions(+) > > diff --git a/cmd/tpm-v2.c b/cmd/tpm-v2.c > index 4ea5f9f094f..5b53953e207 100644 > --- a/cmd/tpm-v2.c > +++ b/cmd/tpm-v2.c > @@ -6,8 +6,10 @@ > > #include > #include > +#include > #include > #include > +#include > #include > #include > #include > @@ -206,6 +208,37 @@ unmap_data: > return report_return_code(rc); > } > > +static int do_tpm2_get_random(struct cmd_tbl *cmdtp, int flag, int argc, > + char *const argv[]) > +{ > + struct udevice *dev; > + char *buffer; > + u32 len; > + int ret; > + > + ret = get_tpm(&dev); > + if (ret) { > + printf("Can't get tpm\n"); > + return ret; > + } > + > + if (argc != 2) > + return CMD_RET_USAGE; > + > + len = simple_strtoul(argv[1], NULL, 10); > + buffer = calloc(1, len); > + if (!buffer) > + return -ENOMEM; > + > + ret = tpm2_get_random(dev, buffer, len); > + if (!ret) > + print_buffer(0, buffer, 1, len, 0); > + > + free(buffer); > + > + return report_return_code(ret); > +} > + > static int do_tpm_dam_reset(struct cmd_tbl *cmdtp, int flag, int argc, > char *const argv[]) > { > @@ -366,6 +399,7 @@ static struct cmd_tbl tpm2_commands[] = { > U_BOOT_CMD_MKENT(pcr_extend, 0, 1, do_tpm2_pcr_extend, "", ""), > U_BOOT_CMD_MKENT(pcr_read, 0, 1, do_tpm_pcr_read, "", ""), > U_BOOT_CMD_MKENT(get_capability, 0, 1, do_tpm_get_capability, "", ""), > + U_BOOT_CMD_MKENT(get_random, 0, 1, do_tpm2_get_random, "", ""), > U_BOOT_CMD_MKENT(dam_reset, 0, 1, do_tpm_dam_reset, "", ""), > U_BOOT_CMD_MKENT(dam_parameters, 0, 1, do_tpm_dam_parameters, "", ""), > U_BOOT_CMD_MKENT(change_auth, 0, 1, do_tpm_change_auth, "", ""), > @@ -421,6 +455,8 @@ U_BOOT_CMD(tpm2, CONFIG_SYS_MAXARGS, 1, do_tpm, "Issue a > TPMv2.x command", > ": property\n" > ": address to store entries of 4 bytes\n" > ": number of entries to retrieve\n" > +"get_random \n" > +"Get random bytes.\n" > "dam_reset []\n" > "If the TPM is not in a LOCKOUT state, reset the internal error > counter.\n" > ": optional password\n" > -- > 2.37.2 >
[PATCH v5 0/3] ARM: imx6: dh-imx6: Enable d-cache early in SPL
This patch series enables d-cache in SPL for i.MX6 based boards from DH in order to improve boot time. This can only be achieved after migrating the corresponding symbols to Kconfig, which is done in patch 1/3 and 2/3. Changes in v5: - Clarify dcache_disable() comment Changes in v4: - Reduce diffstat by using 'select' statements for omap2, mvebu and mx6 based boards - Elaborate on dcache_disable() comment Changes in v3: - Introduce CONFIG_SPL_SYS_L2_PL310 - Convert CONFIG_SYS_L2_PL310 to Kconfig - Use newly introduced Kconfig symbol for dh_imx6_defconfig Changes in v2: - Add comment to explain the relevance of dcache_disable() Marek Vasut (1): ARM: imx6: dh-imx6: Enable d-cache early in SPL Philip Oberfichtner (2): Convert CONFIG_SYS_L2_PL310 to Kconfig ARM: cache: Allow SPL to build cache-pl310.c README| 2 -- arch/arm/Kconfig | 10 +++ arch/arm/lib/Makefile | 2 +- arch/arm/mach-mvebu/Kconfig | 1 + arch/arm/mach-mvebu/include/mach/config.h | 2 -- arch/arm/mach-omap2/Kconfig | 1 + board/dhelectronics/dh_imx6/dh_imx6_spl.c | 34 +++ configs/dh_imx6_defconfig | 1 + configs/omap4_panda_defconfig | 1 + configs/omap4_sdp4430_defconfig | 1 + configs/poleg_evb_defconfig | 1 + configs/socfpga_arria10_defconfig | 1 + configs/socfpga_arria5_defconfig | 1 + configs/socfpga_chameleonv3_defconfig | 1 + configs/socfpga_cyclone5_defconfig| 1 + configs/socfpga_dbm_soc1_defconfig| 1 + configs/socfpga_de0_nano_soc_defconfig| 1 + configs/socfpga_de10_nano_defconfig | 1 + configs/socfpga_de10_standard_defconfig | 1 + configs/socfpga_de1_soc_defconfig | 1 + configs/socfpga_is1_defconfig | 1 + configs/socfpga_mcvevk_defconfig | 1 + configs/socfpga_secu1_defconfig | 1 + configs/socfpga_sockit_defconfig | 1 + configs/socfpga_socrates_defconfig| 1 + configs/socfpga_sr1500_defconfig | 1 + configs/socfpga_vining_fpga_defconfig | 1 + configs/stemmy_defconfig | 1 + include/configs/am43xx_evm.h | 1 - include/configs/brppt2.h | 1 - include/configs/cm_t43.h | 1 - include/configs/mx6_common.h | 1 - include/configs/odroid.h | 1 - include/configs/poleg.h | 1 - include/configs/socfpga_common.h | 1 - include/configs/stemmy.h | 1 - include/configs/ti_omap4_common.h | 1 - include/configs/trats.h | 1 - include/configs/trats2.h | 1 - include/configs/zynq-common.h | 1 - scripts/config_whitelist.txt | 1 - 41 files changed, 68 insertions(+), 18 deletions(-) -- 2.37.1
[PATCH v4 0/3] ARM: imx6: dh-imx6: Enable d-cache early in SPL
This patch series enables d-cache in SPL for i.MX6 based boards from DH in order to improve boot time. This can only be achieved after migrating the corresponding symbols to Kconfig, which is done in patch 1/3 and 2/3. Changes in v4: - Reduce diffstat by using 'select' statements for omap2, mvebu and mx6 based boards - Elaborate on dcache_disable() comment Changes in v3: - Introduce CONFIG_SPL_SYS_L2_PL310 - Convert CONFIG_SYS_L2_PL310 to Kconfig - Use newly introduced Kconfig symbol for dh_imx6_defconfig Changes in v2: - Add comment to explain the relevance of dcache_disable() Marek Vasut (1): ARM: imx6: dh-imx6: Enable d-cache early in SPL Philip Oberfichtner (2): Convert CONFIG_SYS_L2_PL310 to Kconfig ARM: cache: Allow SPL to build cache-pl310.c README| 2 -- arch/arm/Kconfig | 10 +++ arch/arm/lib/Makefile | 2 +- arch/arm/mach-mvebu/Kconfig | 1 + arch/arm/mach-mvebu/include/mach/config.h | 2 -- arch/arm/mach-omap2/Kconfig | 1 + board/dhelectronics/dh_imx6/dh_imx6_spl.c | 32 +++ configs/dh_imx6_defconfig | 1 + configs/omap4_panda_defconfig | 1 + configs/omap4_sdp4430_defconfig | 1 + configs/poleg_evb_defconfig | 1 + configs/socfpga_arria10_defconfig | 1 + configs/socfpga_arria5_defconfig | 1 + configs/socfpga_chameleonv3_defconfig | 1 + configs/socfpga_cyclone5_defconfig| 1 + configs/socfpga_dbm_soc1_defconfig| 1 + configs/socfpga_de0_nano_soc_defconfig| 1 + configs/socfpga_de10_nano_defconfig | 1 + configs/socfpga_de10_standard_defconfig | 1 + configs/socfpga_de1_soc_defconfig | 1 + configs/socfpga_is1_defconfig | 1 + configs/socfpga_mcvevk_defconfig | 1 + configs/socfpga_secu1_defconfig | 1 + configs/socfpga_sockit_defconfig | 1 + configs/socfpga_socrates_defconfig| 1 + configs/socfpga_sr1500_defconfig | 1 + configs/socfpga_vining_fpga_defconfig | 1 + configs/stemmy_defconfig | 1 + include/configs/am43xx_evm.h | 1 - include/configs/brppt2.h | 1 - include/configs/cm_t43.h | 1 - include/configs/mx6_common.h | 1 - include/configs/odroid.h | 1 - include/configs/poleg.h | 1 - include/configs/socfpga_common.h | 1 - include/configs/stemmy.h | 1 - include/configs/ti_omap4_common.h | 1 - include/configs/trats.h | 1 - include/configs/trats2.h | 1 - include/configs/zynq-common.h | 1 - scripts/config_whitelist.txt | 1 - 41 files changed, 66 insertions(+), 18 deletions(-) -- 2.37.1