Re: [PATCH 09/25] stm32f429-discovery: Migrate CONFIG_*_LED out of CONFIG namespace
Hi Tom On 3/31/22 00:07, Tom Rini wrote: > These values are only used in one file, reference them more directly. > > Cc: Kamil Lulko > Cc: Patrick Delaunay > Cc: Patrice Chotard > Cc: uboot-st...@st-md-mailman.stormreply.com > Signed-off-by: Tom Rini > --- > board/st/stm32f429-discovery/led.c| 19 +++ > include/configs/stm32f429-discovery.h | 3 --- > 2 files changed, 11 insertions(+), 11 deletions(-) > > diff --git a/board/st/stm32f429-discovery/led.c > b/board/st/stm32f429-discovery/led.c > index 539c139bb5dd..8dda6a97bd1c 100644 > --- a/board/st/stm32f429-discovery/led.c > +++ b/board/st/stm32f429-discovery/led.c > @@ -8,30 +8,33 @@ > #include > #include > > +#define RED_LED 110 > +#define GREEN_LED109 > + > void coloured_LED_init(void) > { > - gpio_request(CONFIG_RED_LED, "red led"); > - gpio_direction_output(CONFIG_RED_LED, 0); > - gpio_request(CONFIG_GREEN_LED, "green led"); > - gpio_direction_output(CONFIG_GREEN_LED, 0); > + gpio_request(RED_LED, "red led"); > + gpio_direction_output(RED_LED, 0); > + gpio_request(GREEN_LED, "green led"); > + gpio_direction_output(GREEN_LED, 0); > } > > void red_led_off(void) > { > - gpio_set_value(CONFIG_RED_LED, 0); > + gpio_set_value(RED_LED, 0); > } > > void green_led_off(void) > { > - gpio_set_value(CONFIG_GREEN_LED, 0); > + gpio_set_value(GREEN_LED, 0); > } > > void red_led_on(void) > { > - gpio_set_value(CONFIG_RED_LED, 1); > + gpio_set_value(RED_LED, 1); > } > > void green_led_on(void) > { > - gpio_set_value(CONFIG_GREEN_LED, 1); > + gpio_set_value(GREEN_LED, 1); > } > diff --git a/include/configs/stm32f429-discovery.h > b/include/configs/stm32f429-discovery.h > index c9649a085ef1..21bab5aafd54 100644 > --- a/include/configs/stm32f429-discovery.h > +++ b/include/configs/stm32f429-discovery.h > @@ -17,9 +17,6 @@ > > #define CONFIG_SYS_MAX_FLASH_SECT12 > > -#define CONFIG_RED_LED 110 > -#define CONFIG_GREEN_LED 109 > - > #define CONFIG_SYS_HZ_CLOCK 100 /* Timer is clocked at 1MHz */ > > #define CONFIG_SYS_CBSIZE1024 Reviewed-by: Patrice Chotard Thanks Patrice
Re: [PATCH v3 4/9] board: Define set_dfu_alt_info() for boards with UEFI capsule update enabled
hi Masami, On Thu, 31 Mar 2022 at 08:15, Masami Hiramatsu wrote: > > Hi Sughosh, > > If you remove the DEFAULT_DFU_ALT_INFO definition but introduce > set_dfu_alt_info(), this also must the CONFIG_SET_DFU_ALT_INFO for > each platform configuration too. > Unless that, some platform will not lose the dfu_alt_info until next > patch ([5/9]) is applied. I believe all the platforms are setting dfu_alt_info in the environment primarily for the capsule update. So I will squash this patch with patch 5/9. If you or any other board maintainer gives feedback for adding CONFIG_SET_DFU_ALT_INFO in the board's defconfig file, I will make that change in my next version. Thanks. -sughosh > > Thank you, > > 2022年3月30日(水) 23:51 Sughosh Ganu : > > > > Currently, there are a bunch of boards which enable the UEFI capsule > > update feature. The actual update of the firmware images is done > > through the dfu framework which uses the dfu_alt_info environment > > variable for getting information on the update, like device, partition > > number/address etc. Currently, these boards define the dfu_alt_info > > variable in the board config header, as an environment variable. With > > this, the variable can be modified from the u-boot command line and > > this can cause an incorrect update. > > > > To prevent this from happening, define the set_dfu_alt_info function > > in the board file, and use the function for populating the > > variable. With the function defined, the dfu framework populates the > > dfu_alt_info variable through the board file, instead of fetching the > > variable from the environment, thus making the update more robust. > > > > Signed-off-by: Sughosh Ganu > > --- > > > > Changes since V2: New Patch > > > > > > .../imx8mp_rsb3720a1/imx8mp_rsb3720a1.c | 24 + > > .../imx8mm-cl-iot-gate/imx8mm-cl-iot-gate.c | 24 + > > board/emulation/common/qemu_dfu.c | 6 ++--- > > board/kontron/pitx_imx8m/pitx_imx8m.c | 24 + > > board/kontron/sl-mx8mm/sl-mx8mm.c | 24 + > > board/kontron/sl28/sl28.c | 25 ++ > > board/sandbox/sandbox.c | 26 +++ > > board/socionext/developerbox/developerbox.c | 26 +++ > > board/xilinx/zynq/board.c | 5 ++-- > > board/xilinx/zynqmp/zynqmp.c | 5 ++-- > > include/configs/imx8mm-cl-iot-gate.h | 1 - > > include/configs/imx8mp_rsb3720.h | 1 - > > include/configs/kontron-sl-mx8mm.h| 1 - > > include/configs/kontron_pitx_imx8m.h | 1 - > > include/configs/kontron_sl28.h| 2 -- > > include/configs/synquacer.h | 6 - > > 16 files changed, 182 insertions(+), 19 deletions(-) > > > > diff --git a/board/advantech/imx8mp_rsb3720a1/imx8mp_rsb3720a1.c > > b/board/advantech/imx8mp_rsb3720a1/imx8mp_rsb3720a1.c > > index 1c953ba195..41154ca9f3 100644 > > --- a/board/advantech/imx8mp_rsb3720a1/imx8mp_rsb3720a1.c > > +++ b/board/advantech/imx8mp_rsb3720a1/imx8mp_rsb3720a1.c > > @@ -5,10 +5,12 @@ > > */ > > > > #include > > +#include > > #include > > #include > > #include > > #include > > +#include > > #include > > #include > > #include > > @@ -24,6 +26,7 @@ > > #include > > #include > > #include > > +#include > > #include > > > > DECLARE_GLOBAL_DATA_PTR; > > @@ -231,3 +234,24 @@ unsigned long spl_mmc_get_uboot_raw_sector(struct mmc > > *mmc) > > } > > } > > #endif /* CONFIG_SPL_MMC_SUPPORT */ > > + > > +#if defined(CONFIG_SET_DFU_ALT_INFO) > > + > > +#define DFU_ALT_BUF_LENSZ_1K > > + > > +void set_dfu_alt_info(char *interface, char *devstr) > > +{ > > + ALLOC_CACHE_ALIGN_BUFFER(char, buf, DFU_ALT_BUF_LEN); > > + > > + if (!CONFIG_IS_ENABLED(EFI_HAVE_CAPSULE_SUPPORT) && > > + env_get("dfu_alt_info")) > > + return; > > + > > + memset(buf, 0, DFU_ALT_BUF_LEN); > > + > > + snprintf(buf, DFU_ALT_BUF_LEN, > > +"mmc 2=flash-bin raw 0 0x1B00 mmcpart 1"); > > + > > + env_set("dfu_alt_info", buf); > > +} > > +#endif /* CONFIG_SET_DFU_ALT_INFO */ > > diff --git a/board/compulab/imx8mm-cl-iot-gate/imx8mm-cl-iot-gate.c > > b/board/compulab/imx8mm-cl-iot-gate/imx8mm-cl-iot-gate.c > > index f5b89a5ddc..1880dd9c55 100644 > > --- a/board/compulab/imx8mm-cl-iot-gate/imx8mm-cl-iot-gate.c > > +++ b/board/compulab/imx8mm-cl-iot-gate/imx8mm-cl-iot-gate.c > > @@ -5,6 +5,7 @@ > > */ > > > > #include > > +#include > > #include > > #include > > #include > > @@ -12,6 +13,7 @@ > > #include > > #include > > #include > > +#include > > #include > > #include > > > > @@ -24,6 +26,7 @@ > > #include > > #include > > #include > > +#include > > > > #include "ddr/ddr.h" > > > > @@ -446,3 +449,24 @@ int board_late_init(void) > > > > return 0; > > } > > + > > +
Re: [PATCH v3 5/9] capsule: kconfig: Select SET_DFU_ALT_INFO config symbol for capsule update
hi Masami, On Thu, 31 Mar 2022 at 08:18, Masami Hiramatsu wrote: > > Hi, > > Even with this patch, if the platform configuration doesn't select > EFI_CAPSULE_FIRMWARE_* (or user will disable it when use it), the > platform will lose raw DFU availability. I will have to rely on feedback from board maintainers for that. Like I commented in another email, I think that these platforms are setting dfu_alt_info primarily for capsule updates. But if some board maintainer asks, I will enable CONFIG_SET_DFU_ALT_INFO the board's defconfig. Thanks. -sughosh > > Thank you, > > 2022年3月30日(水) 23:51 Sughosh Ganu : > > > > The capsule update code uses the dfu_alt_info variable for the actual > > update of the firmware component. The dfu_alt_info variable gives > > information needed to perform the update, like the device on which the > > update is to be made, the partition, type of partition etc. Since the > > dfu_alt_info is a environmental variable, it can be modified from the > > u-boot command line. An incorrect update of the variable will result > > in the update being done incorrectly. > > > > Prevent this scenario by forcing an update of the dfu_alt_info > > variable from the information obtained through the board file when > > UEFI capsule update functionality is enabled. > > > > Signed-off-by: Sughosh Ganu > > --- > > > > Changes since V2: New Patch > > > > lib/efi_loader/Kconfig | 2 ++ > > 1 file changed, 2 insertions(+) > > > > diff --git a/lib/efi_loader/Kconfig b/lib/efi_loader/Kconfig > > index e5e35fe51f..09fb8cbe75 100644 > > --- a/lib/efi_loader/Kconfig > > +++ b/lib/efi_loader/Kconfig > > @@ -174,6 +174,7 @@ config EFI_CAPSULE_FIRMWARE_FIT > > depends on EFI_CAPSULE_FIRMWARE_MANAGEMENT > > select UPDATE_FIT > > select DFU > > + select SET_DFU_ALT_INFO > > select EFI_CAPSULE_FIRMWARE > > help > > Select this option if you want to enable firmware management > > protocol > > @@ -185,6 +186,7 @@ config EFI_CAPSULE_FIRMWARE_RAW > > depends on SANDBOX || (!SANDBOX && !EFI_CAPSULE_FIRMWARE_FIT) > > select DFU_WRITE_ALT > > select DFU > > + select SET_DFU_ALT_INFO > > select EFI_CAPSULE_FIRMWARE > > help > > Select this option if you want to enable firmware management > > protocol > > -- > > 2.25.1 > > > > > -- > Masami Hiramatsu
Re: [PATCH v7 4/4] configs: sama5d2: enable option CONFIG_ATMEL_TCB_TIMER
Le Thu, 31 Mar 2022 05:59:02 +, a écrit : > On 3/30/22 6:49 PM, Clément Léger wrote: > > Le Tue, 22 Mar 2022 13:35:08 +0100, > > Clément Léger a écrit : > > > >> Le Tue, 22 Mar 2022 11:18:39 +, > >> a écrit : > >> > > > > [...] > > > >>> > >>> Could not initialize timer (err -22) > >>> > >>> ... > >>> > >>> > >>> > >>> Could you investigate this please ? > >> > >> Hi Eugen, > >> > >> Ok, I'll try to debug that ! > > > > Hi Eugen, while debugging it, I found that there was actually one major > > flaw. The clock that I used was the GLCK. If only this clock is > > enabled, the TCB can not work, the tcb0_clk must also be enabled for the > > TCB to start counting. It worked on my side because I forgot that I had > > a quirk in OP-TEE that was enabling the clocks before starting U-Boot. > > Without that, it actually could not work. > > > > Since the tcb0_clk is needed, I switched the driver to use this one > > only and it works well on a "bare" setup (ie without OP-TEE). I even > > think it could not work with the tcb0_gclk since this one does not > > correctly handles the case when the parent clock is the slow_clk (which > > might be the case after booting) and in this case, will return 0 as > > rate (this is by the way supported in your CCF branch). > > > > Anyway, I fixed the driver to use the tcb0_clk and thus it should work > > much better. I will send a V8 and it should work with U-Boot and the > > SPL. > > > > By the way, do you have any documentation which explains how to use > > U-Boot SPL on sama5d2_xplained (or other) board ? > > Hi Clement, > > I don't have any documentation at hand, but what I can say in a few > words is that once you build the SPL, you should have a file > spl/boot.bin and this binary should replace our stage2 at91 bootloader > at91bootstrap. > > Unlike at91bootstrap, the SPL has all the drivers inside and can boot > from all supported media, however, SPL will read a dedicated CPU > register where the stage1 has written some bits representing the index > of the NVM *used to copy the boot.bin from* . The SPL will then attempt > to read the u-boot.bin from the same media. (you can alter the file name > in defconfig ). Ok, I successfully booted a SPL < 64k from SD card by disabling MMC support after fixing the TCB driver: ;4��K3K{�KOp�C�0� U-Boot SPL 2022.04-rc3-00023-gf9da67b41a-dirty (Mar 31 2022 - 09:23:48 +0200) SPL: Unsupported Boot Device! SPL: failed to boot from all boot devices ### ERROR ### Please RESET the board ### However, as soon as the size is greater than 64K, it does not boot anymore. Looks like you already had the same problem. Do you have any more documentation which would allow me to boot a u-boot.bin file from this SPL easily ? By the way, since u-boot,dm-pre-reloc is needed in the device-tree to be used with the SPL, I will probably add them to my series (property which by the way is missing for the PIT timer device-tree node). Thanks, Clément -- Clément Léger, Embedded Linux and Kernel engineer at Bootlin https://bootlin.com
Re: [PATCH v4 09/11] efi_loader: add menu-driven UEFI Boot Variable maintenance
Hi Kojima-san, On Thu, Mar 24, 2022 at 10:54:41PM +0900, Masahisa Kojima wrote: > + I haven't been able to get the patch working yet. I'll send more feedback once I do. Here's a few comments I have [...] > +struct efi_bootmenu_file_entry_data { > + struct efi_bootmenu_boot_option *bo; > + struct efi_file_info *f; > +}; > + > +static efi_status_t efi_bootmenu_process_boot_selected(void *data, bool > *exit); > +static efi_status_t efi_bootmenu_process_add_boot_option(void *data, bool > *exit); > +static efi_status_t efi_bootmenu_process_delete_boot_option(void *data, bool > *exit); > +static efi_status_t efi_bootmenu_process_change_boot_order(void *data, bool > *exit); I think you can re-arrange some of the functions and get rid of the forward declarations > + > +static struct efi_bootmenu_item maintenance_menu_items[] = { const ? > + {u"Add Boot Option", efi_bootmenu_process_add_boot_option}, > + {u"Delete Boot Option", efi_bootmenu_process_delete_boot_option}, > + {u"Change Boot Order", efi_bootmenu_process_change_boot_order}, > + {u"Quit", NULL}, > +}; > + > +static void efi_bootmenu_print_entry(void *data) > +{ > + struct efi_bootmenu_entry *entry = data; [...] > + new_len = u16_strlen(info->bo->current_path) + > + /* TODO: show error notification to user */ > + log_err("file path is too long\n"); > + return EFI_INVALID_PARAMETER; Can we just check for new_len + 1 here and get rid of the follow up check ? > + } > + u16_strlcat(info->bo->current_path, info->f->file_name, > EFI_BOOTMENU_FILE_PATH_MAX); > + if (info->f->attribute & EFI_FILE_DIRECTORY) { > + if (new_len + 1 >= EFI_BOOTMENU_FILE_PATH_MAX) { > + log_err("file path is too long\n"); > + return EFI_INVALID_PARAMETER; > + } > + u16_strlcat(info->bo->current_path, u"\\", > EFI_BOOTMENU_FILE_PATH_MAX); > + } else { > + info->bo->file_selected = true; > + } [...] > + menu_item = calloc(count + 1, sizeof(struct efi_bootmenu_item)); > + if (!menu_item) { > + efi_file_close_int(f); > + free(dir_buf); > + ret = EFI_OUT_OF_RESOURCES; > + goto out; > + } > + > + /* read directory and construct menu structure */ > + efi_file_setpos_int(f, 0); > + iter = menu_item; > + ptr = (struct efi_file_info *)dir_buf; This will cause an unaligned access later on when you access ptr->attribute. Any reason we can't allocate ptr directly? > + for (i = 0; i < count; i++) { > + int name_len; > + u16 *name; > + struct efi_bootmenu_file_entry_data *info; > + > + len = size; > + ret = efi_file_read_int(f, &len, ptr); > + if (ret != EFI_SUCCESS || len == 0) > + goto err; > + > + if (ptr->attribute & EFI_FILE_DIRECTORY) { > + /* append u'/' at the end of directory name */ > + name_len = u16_strsize(ptr->file_name) + > sizeof(u16); > + name = calloc(1, name_len); > + if (!name) { > + ret = EFI_OUT_OF_RESOURCES; > + goto err; > + } > + u16_strcpy(name, ptr->file_name); > + name[u16_strlen(ptr->file_name)] = u'/'; > + } else { > + name_len = u16_strsize(ptr->file_name); > + name = calloc(1, name_len); > + if (!name) { > + ret = EFI_OUT_OF_RESOURCES; > + goto err; > + } > + u16_strcpy(name, ptr->file_name); > + } > + > + info = calloc(1, sizeof(struct > efi_bootmenu_file_entry_data)); > + if (!info) { > + ret = EFI_OUT_OF_RESOURCES; > + goto err; > + } > + info->f = ptr; > + info->bo = bo; > + iter->title = name; > + iter->func = efi_bootmenu_file_selected; > + iter->data = info; > + iter++; > + > + size -= len; > + ptr = (struct efi_file_info *)((char *)ptr + len); ditto > + } > + > + /* add "Quit" entry */ > +
Re: [PATCH v3 1/9] capsule: Add Image GUIDs and image index for platforms using capsule updates
On 3/30/22 16:50, Sughosh Ganu wrote: Currently, all platforms that enable capsule updates do so using either EFI_FIRMWARE_IMAGE_TYPE_UBOOT_RAW_GUID or EFI_FIRMWARE_IMAGE_TYPE_UBOOT_FIT_GUID. This is based on the Firmware Management Protocol(FMP) instance used on the platform. However, this means that all platforms that enable a particular FMP instance have the same GUID value for all the updatable images, either the FIT image GUID or the raw image GUID, and that an image for some platform can be updated on any other platform which uses the same FMP instance. Another issue with this implementation is that the ESRT table shows the same GUID value for all images on the platform and also across platforms, which is not in compliance with the UEFI specification. Fix this by defining image GUID values and firmware names for individual images per platform. The GetImageInfo FMP hook would then populate these values in the image descriptor array. Also add the image index value associated with a particular image. This is the value that should match with the image_index value that is part of the capsule header. The capsule update code will check if the two values match, and the update will only proceed on a match. Signed-off-by: Sughosh Ganu --- Changes since V2: * Add a new member image_index to the struct efi_fw_images to allow the platforms to define the values for images. * Address review comments from Michal Simek for the xilinx boards. * Fix double inclusion of efi_loader.h as was pointed out by Heiko Thiery. .../imx8mp_rsb3720a1/imx8mp_rsb3720a1.c | 20 + .../imx8mm-cl-iot-gate/imx8mm-cl-iot-gate.c | 19 + board/emulation/qemu-arm/qemu-arm.c | 20 + board/kontron/pitx_imx8m/pitx_imx8m.c | 16 ++- board/kontron/sl-mx8mm/sl-mx8mm.c | 15 ++ board/kontron/sl28/sl28.c | 15 ++ board/sandbox/sandbox.c | 28 +++ board/socionext/developerbox/developerbox.c | 26 + board/xilinx/common/board.c | 24 include/configs/imx8mm-cl-iot-gate.h | 10 +++ include/configs/imx8mp_rsb3720.h | 10 +++ include/configs/kontron-sl-mx8mm.h| 6 include/configs/kontron_pitx_imx8m.h | 6 include/configs/kontron_sl28.h| 6 include/configs/qemu-arm.h| 10 +++ include/configs/sandbox.h | 14 ++ include/configs/synquacer.h | 14 ++ include/configs/xilinx_versal.h | 6 include/configs/xilinx_zynqmp.h | 10 +++ include/configs/zynq-common.h | 10 +++ include/efi_loader.h | 18 21 files changed, 302 insertions(+), 1 deletion(-) diff --git a/board/advantech/imx8mp_rsb3720a1/imx8mp_rsb3720a1.c b/board/advantech/imx8mp_rsb3720a1/imx8mp_rsb3720a1.c index 16566092bd..1c953ba195 100644 --- a/board/advantech/imx8mp_rsb3720a1/imx8mp_rsb3720a1.c +++ b/board/advantech/imx8mp_rsb3720a1/imx8mp_rsb3720a1.c @@ -6,6 +6,8 @@ #include #include +#include +#include #include #include #include @@ -21,6 +23,7 @@ #include #include #include +#include #include DECLARE_GLOBAL_DATA_PTR; @@ -44,6 +47,23 @@ static void setup_gpmi_nand(void) } #endif +#if CONFIG_IS_ENABLED(EFI_HAVE_CAPSULE_SUPPORT) +struct efi_fw_images fw_images[] = { + { +#if defined(CONFIG_TARGET_IMX8MP_RSB3720A1_4G) + .image_type_id = IMX8MP_RSB3720A1_4G_FIT_IMAGE_GUID, +#elif defined(CONFIG_TARGET_IMX8MP_RSB3720A1_6G) + .image_type_id = IMX8MP_RSB3720A1_6G_FIT_IMAGE_GUID, +#endif + .fw_name = u"IMX8MP-RSB3720-FIT", + .image_index = 1 + }, +}; + +u8 num_image_type_guids = ARRAY_SIZE(fw_images); +#endif /* EFI_HAVE_CAPSULE_SUPPORT */ + + int board_early_init_f(void) { struct wdog_regs *wdog = (struct wdog_regs *)WDOG1_BASE_ADDR; diff --git a/board/compulab/imx8mm-cl-iot-gate/imx8mm-cl-iot-gate.c b/board/compulab/imx8mm-cl-iot-gate/imx8mm-cl-iot-gate.c index 7e2d88f449..f5b89a5ddc 100644 --- a/board/compulab/imx8mm-cl-iot-gate/imx8mm-cl-iot-gate.c +++ b/board/compulab/imx8mm-cl-iot-gate/imx8mm-cl-iot-gate.c @@ -5,6 +5,8 @@ */ #include +#include +#include #include #include #include @@ -21,11 +23,28 @@ #include #include #include +#include #include "ddr/ddr.h" DECLARE_GLOBAL_DATA_PTR; +#if CONFIG_IS_ENABLED(EFI_HAVE_CAPSULE_SUPPORT) +struct efi_fw_images fw_images[] = { + { +#if defined(CONFIG_TARGET_IMX8MM_CL_IOT_GATE) + .image_type_id = IMX8MM_CL_IOT_GATE_FIT_IMAGE_GUID, +#elif defined(CONFIG_TARGET_IMX8MM_CL_IOT_GATE_OPTEE) + .image_type_id = IMX8MM_CL_IOT_GATE_OPTEE_FIT_IMAGE_GUID, +#endif +
Re: [PATCH v3 5/9] capsule: kconfig: Select SET_DFU_ALT_INFO config symbol for capsule update
hi Masami, On Thu, 31 Mar 2022 at 13:11, Sughosh Ganu wrote: > > hi Masami, > > On Thu, 31 Mar 2022 at 08:18, Masami Hiramatsu > wrote: > > > > Hi, > > > > Even with this patch, if the platform configuration doesn't select > > EFI_CAPSULE_FIRMWARE_* (or user will disable it when use it), the > > platform will lose raw DFU availability. > > I will have to rely on feedback from board maintainers for that. Like > I commented in another email, I think that these platforms are setting > dfu_alt_info primarily for capsule updates. But if some board > maintainer asks, I will enable CONFIG_SET_DFU_ALT_INFO the board's > defconfig. Thanks. Another alternative is that we keep the dfu_alt_info settings in the board config headers. With the capsule update, the CONFIG_SET_DFU_ALT_INFO will be set, and the variable will be populated from the board file. For the non capsule update scenario, the platform can then use the variable set in the board headers. Will that be fine with you. Let me know. Thanks. -sughosh > > -sughosh > > > > > Thank you, > > > > 2022年3月30日(水) 23:51 Sughosh Ganu : > > > > > > The capsule update code uses the dfu_alt_info variable for the actual > > > update of the firmware component. The dfu_alt_info variable gives > > > information needed to perform the update, like the device on which the > > > update is to be made, the partition, type of partition etc. Since the > > > dfu_alt_info is a environmental variable, it can be modified from the > > > u-boot command line. An incorrect update of the variable will result > > > in the update being done incorrectly. > > > > > > Prevent this scenario by forcing an update of the dfu_alt_info > > > variable from the information obtained through the board file when > > > UEFI capsule update functionality is enabled. > > > > > > Signed-off-by: Sughosh Ganu > > > --- > > > > > > Changes since V2: New Patch > > > > > > lib/efi_loader/Kconfig | 2 ++ > > > 1 file changed, 2 insertions(+) > > > > > > diff --git a/lib/efi_loader/Kconfig b/lib/efi_loader/Kconfig > > > index e5e35fe51f..09fb8cbe75 100644 > > > --- a/lib/efi_loader/Kconfig > > > +++ b/lib/efi_loader/Kconfig > > > @@ -174,6 +174,7 @@ config EFI_CAPSULE_FIRMWARE_FIT > > > depends on EFI_CAPSULE_FIRMWARE_MANAGEMENT > > > select UPDATE_FIT > > > select DFU > > > + select SET_DFU_ALT_INFO > > > select EFI_CAPSULE_FIRMWARE > > > help > > > Select this option if you want to enable firmware management > > > protocol > > > @@ -185,6 +186,7 @@ config EFI_CAPSULE_FIRMWARE_RAW > > > depends on SANDBOX || (!SANDBOX && !EFI_CAPSULE_FIRMWARE_FIT) > > > select DFU_WRITE_ALT > > > select DFU > > > + select SET_DFU_ALT_INFO > > > select EFI_CAPSULE_FIRMWARE > > > help > > > Select this option if you want to enable firmware management > > > protocol > > > -- > > > 2.25.1 > > > > > > > > > -- > > Masami Hiramatsu
[PATCH v1 2/2] cmd: lcdputs: Escape special characters
From: qianfan Zhao Add support \\, \r, \n, \t and \b. eg: => lcdputs "hello\nworld" Signed-off-by: qianfan Zhao --- drivers/video/vidconsole-uclass.c | 34 +-- 1 file changed, 32 insertions(+), 2 deletions(-) diff --git a/drivers/video/vidconsole-uclass.c b/drivers/video/vidconsole-uclass.c index f42db40d4c..d2554fd3f7 100644 --- a/drivers/video/vidconsole-uclass.c +++ b/drivers/video/vidconsole-uclass.c @@ -709,15 +709,45 @@ static int do_video_puts(struct cmd_tbl *cmdtp, int flag, int argc, { struct udevice *dev; const char *s; + char c; if (argc != 2) return CMD_RET_USAGE; if (uclass_first_device_err(UCLASS_VIDEO_CONSOLE, &dev)) return CMD_RET_FAILURE; - for (s = argv[1]; *s; s++) - vidconsole_put_char(dev, *s); + for (s = argv[1]; (c = *s); s++) { + if (c == '\\') { + s++; + + switch (*s) { + case '\0': + goto sync; + case '\\': + c = '\\'; + break; + case 'r': + c = '\r'; + break; + case 'n': + c = '\n'; + break; + case 't': + c = '\t'; + break; + case 'b': + c = '\b'; + break; + default: + continue; + } + } + + vidconsole_put_char(dev, c); + } + +sync: return video_sync(dev->parent, false); } -- 2.17.1
[PATCH v1 1/2] video: Add VIDEO_FONT_4x6 to Kconfig add fix compile waring
From: qianfan Zhao CONFIG_VIDEO_FONT_4x6 is referenced in include/video_font.h, but doesn't has a Kconfig configuration. Add it. Signed-off-by: qianfan Zhao --- drivers/video/Kconfig| 8 include/video_font_4x6.h | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/drivers/video/Kconfig b/drivers/video/Kconfig index e2cf1e752f..7b2efdfd8a 100644 --- a/drivers/video/Kconfig +++ b/drivers/video/Kconfig @@ -138,6 +138,14 @@ config CONSOLE_NORMAL CONFIG_CONSOLE_ROTATION for that). A built-in 8x16 font is used for the display. +config VIDEO_FONT_4X6 + bool "Minuscule 4x6 font" + depends on CONSOLE_NORMAL + default n + help + Use Minuscule 4x6 font for code page 437, 8x16 bitmap font is used + by default if this options is not selected. + config CONSOLE_ROTATION bool "Support rotated displays" depends on DM_VIDEO diff --git a/include/video_font_4x6.h b/include/video_font_4x6.h index c7e6351b64..65dd5e8c1d 100644 --- a/include/video_font_4x6.h +++ b/include/video_font_4x6.h @@ -46,7 +46,7 @@ __END__; #define VIDEO_FONT_HEIGHT 6 #define VIDEO_FONT_SIZE(VIDEO_FONT_CHARS * VIDEO_FONT_HEIGHT) -static unsigned char video_fontdata[VIDEO_FONT_SIZE] = { +static unsigned char __maybe_unused video_fontdata[VIDEO_FONT_SIZE] = { /*{*/ /* Char 0: ' ' */ -- 2.17.1
Re: [PATCH v4 10/11] bootmenu: add removable media entries
On Thu, Mar 24, 2022 at 10:54:42PM +0900, Masahisa Kojima wrote: > UEFI specification requires booting from removal media using > a architecture-specific default image name such as BOOTAA64.EFI. > This commit adds the removable media entries into bootmenu, > so that user can select the removable media and boot with > default image. > > The bootmenu automatically enumerates the possible bootable > media devices supporting EFI_SIMPLE_FILE_SYSTEM_PROTOCOL, > add it as new UEFI boot option(BOOT) and update BootOrder > variable. Depending on the system hardware setup, some devices > may not exist at a later system boot, so invalid BOOT variable > must be deleted. > > Signed-off-by: Masahisa Kojima > --- > Newly created in v4 > > cmd/bootmenu.c| 78 + > include/efi_loader.h | 22 > lib/efi_loader/efi_bootmenu_maintenance.c | 128 ++ > 3 files changed, 228 insertions(+) > > diff --git a/cmd/bootmenu.c b/cmd/bootmenu.c > index 458eb90b63..7357cfeae5 100644 > --- a/cmd/bootmenu.c > +++ b/cmd/bootmenu.c > @@ -304,6 +304,74 @@ static int prepare_uefi_bootorder_entry(struct > bootmenu_data *menu, > return 1; > } > > +static efi_status_t prepare_media_device_entry(void) > +{ > + u32 i; > + efi_status_t ret; > + efi_uintn_t count; > + efi_handle_t *volume_handles = NULL; > + struct efi_bootmenu_media_boot_option *opt = NULL; > + > + ret = efi_locate_handle_buffer_int(BY_PROTOCOL, > &efi_simple_file_system_protocol_guid, > +NULL, &count, (efi_handle_t > **)&volume_handles); > + if (ret != EFI_SUCCESS) > + return ret; > + > + opt = calloc(count, sizeof(struct efi_bootmenu_media_boot_option)); > + if (!opt) > + goto out; > + > + /* enumerate all devices supporting EFI_SIMPLE_FILE_SYSTEM_PROTOCOL */ > + ret = efi_bootmenu_enumerate_boot_option(opt, volume_handles, count); > + if (ret != EFI_SUCCESS) > + goto out; > + > + /* > + * System hardware configuration may vary depending on the user setup. > + * The boot option is automatically added by the bootmenu. > + * If the device is not attached to the system, the boot option needs > + * to be deleted. > + */ > + ret = efi_bootmenu_delete_invalid_boot_option(opt, count); Won't that fail on first boot if the BootOrder is undefined? efi_bootmenu_delete_invalid_boot_option() should return EFI_SUCCESS if it doesn't have a boot order maybe? > + if (ret != EFI_SUCCESS) > + goto out; > + > + /* add non-existent boot option */ > + for (i = 0; i < count; i++) { > + u32 boot_index; > + u16 var_name[9]; > + > + if (!opt[i].exist) { > + ret = efi_bootmenu_get_unused_bootoption(var_name, > sizeof(var_name), > + &boot_index); > + if (ret != EFI_SUCCESS) > + goto out; > + > + ret = efi_set_variable_int(var_name, > &efi_global_variable_guid, > +EFI_VARIABLE_NON_VOLATILE | > + > EFI_VARIABLE_BOOTSERVICE_ACCESS | > +EFI_VARIABLE_RUNTIME_ACCESS, > +opt[i].size, opt[i].lo, > false); > + if (ret != EFI_SUCCESS) > + goto out; > + > + ret = efi_bootmenu_append_bootorder(boot_index); > + if (ret != EFI_SUCCESS) > + goto out; > + } > + } > + > +out: > + if (opt) { > + for (i = 0; i < count; i++) > + free(opt[i].lo); > + } > + free(opt); > + efi_free_pool(volume_handles); > + > + return ret; > +} > + > static int prepare_distro_boot_entry(struct bootmenu_data *menu, >struct bootmenu_entry **current, >unsigned short int *index) > @@ -408,6 +476,16 @@ static struct bootmenu_data *bootmenu_create(int delay) > goto cleanup; > > if (IS_ENABLED(CONFIG_CMD_BOOTEFI_BOOTMGR)) { > + if (i < MAX_DYNAMIC_ENTRY) { > + /* > + * UEFI specification requires booting from removal > media using > + * a architecture-specific default image name such as > BOOTAA64.EFI. > + */ > + ret = prepare_media_device_entry(); > + if (ret != EFI_SUCCESS) > + goto cleanup; > + } > + > if (i < MAX_DYNAMIC_ENTRY) { > ret = prepare_uefi_bootorder_entry(menu, &iter, &i); >
[PATCH v8 1/5] timer: atmel_tcb_timer: add atmel_tcb driver
Add a driver for the timer counter block that can be found on sama5d2. This driver will be used when booting under OP-TEE since the pit timer which is part of the SYSC is secured. Channel 1 & 2 are configured to be chained together which allows to have a 64bits counter. Reviewed-by: Claudiu Beznea Signed-off-by: Clément Léger --- MAINTAINERS | 1 + arch/arm/mach-at91/armv7/Makefile | 2 + drivers/timer/Kconfig | 8 ++ drivers/timer/Makefile| 1 + drivers/timer/atmel_tcb_timer.c | 161 ++ 5 files changed, 173 insertions(+) create mode 100644 drivers/timer/atmel_tcb_timer.c diff --git a/MAINTAINERS b/MAINTAINERS index 0f39bc6bc9..e30389dc3e 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -352,6 +352,7 @@ F: arch/arm/mach-at91/ F: board/atmel/ F: drivers/cpu/at91_cpu.c F: drivers/misc/microchip_flexcom.c +F: drivers/timer/atmel_tcb_timer.c F: include/dt-bindings/mfd/atmel-flexcom.h F: drivers/timer/mchp-pit64b-timer.c diff --git a/arch/arm/mach-at91/armv7/Makefile b/arch/arm/mach-at91/armv7/Makefile index 246050b67b..f395b55c3d 100644 --- a/arch/arm/mach-at91/armv7/Makefile +++ b/arch/arm/mach-at91/armv7/Makefile @@ -14,9 +14,11 @@ obj-y += cpu.o ifndef CONFIG_$(SPL_TPL_)SYSRESET obj-y += reset.o endif +ifneq ($(CONFIG_ATMEL_TCB_TIMER),y) ifneq ($(CONFIG_ATMEL_PIT_TIMER),y) ifneq ($(CONFIG_MCHP_PIT64B_TIMER),y) # old non-DM timer driver obj-y += timer.o endif endif +endif diff --git a/drivers/timer/Kconfig b/drivers/timer/Kconfig index 8913142654..8fad59b81a 100644 --- a/drivers/timer/Kconfig +++ b/drivers/timer/Kconfig @@ -96,6 +96,14 @@ config ATMEL_PIT_TIMER it is designed to offer maximum accuracy and efficient management, even for systems with long response time. +config ATMEL_TCB_TIMER + bool "Atmel timer counter support" + depends on TIMER + depends on ARCH_AT91 + help + Select this to enable the use of the timer counter as a monotonic + counter. + config CADENCE_TTC_TIMER bool "Cadence TTC (Triple Timer Counter)" depends on TIMER diff --git a/drivers/timer/Makefile b/drivers/timer/Makefile index e2bd530eb0..58da6c1e84 100644 --- a/drivers/timer/Makefile +++ b/drivers/timer/Makefile @@ -10,6 +10,7 @@ obj-$(CONFIG_ARC_TIMER) += arc_timer.o obj-$(CONFIG_AST_TIMER)+= ast_timer.o obj-$(CONFIG_ATCPIT100_TIMER) += atcpit100_timer.o obj-$(CONFIG_ATMEL_PIT_TIMER) += atmel_pit_timer.o +obj-$(CONFIG_ATMEL_TCB_TIMER) += atmel_tcb_timer.o obj-$(CONFIG_CADENCE_TTC_TIMER)+= cadence-ttc.o obj-$(CONFIG_DESIGNWARE_APB_TIMER) += dw-apb-timer.o obj-$(CONFIG_MPC83XX_TIMER) += mpc83xx_timer.o diff --git a/drivers/timer/atmel_tcb_timer.c b/drivers/timer/atmel_tcb_timer.c new file mode 100644 index 00..8c17987c7d --- /dev/null +++ b/drivers/timer/atmel_tcb_timer.c @@ -0,0 +1,161 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * Copyright (C) 2022 Microchip Corporation + * + * Author: Clément Léger + */ + +#include +#include +#include +#include +#include +#include + +#define TCB_CHAN(chan) ((chan) * 0x40) + +#define TCB_CCR(chan) (0x0 + TCB_CHAN(chan)) +#define TCB_CCR_CLKEN (1 << 0) + +#define TCB_CMR(chan) (0x4 + TCB_CHAN(chan)) +#define TCB_CMR_WAVE (1 << 15) +#define TCB_CMR_TIMER_CLOCK2 1 +#define TCB_CMR_XC1 6 +#define TCB_CMR_ACPA_SET (1 << 16) +#define TCB_CMR_ACPC_CLEAR(2 << 18) + +#define TCB_CV(chan) (0x10 + TCB_CHAN(chan)) + +#define TCB_RA(chan) (0x14 + TCB_CHAN(chan)) +#define TCB_RC(chan) (0x1c + TCB_CHAN(chan)) + +#define TCB_IDR(chan) (0x28 + TCB_CHAN(chan)) + +#define TCB_BCR0xc0 +#define TCB_BCR_SYNC (1 << 0) + +#define TCB_BMR0xc4 +#define TCB_BMR_TC1XC1S_TIOA0 (2 << 2) + +#define TCB_WPMR 0xe4 +#define TCB_WPMR_WAKEY0x54494d + +#define TCB_CLK_DIVISOR8 +struct atmel_tcb_plat { + void __iomem *base; +}; + +static u64 atmel_tcb_get_count(struct udevice *dev) +{ + struct atmel_tcb_plat *plat = dev_get_plat(dev); + u64 cv0 = 0; + u64 cv1 = 0; + + do { + cv1 = readl(plat->base + TCB_CV(1)); + cv0 = readl(plat->base + TCB_CV(0)); + } while (readl(plat->base + TCB_CV(1)) != cv1); + + cv0 |= cv1 << 32; + + return cv0; +} + +static void atmel_tcb_configure(void __iomem *base) +{ + /* Disable write protection */ + writel(TCB_WPMR_WAKEY, base + TCB_WPMR); + + /* Disable all irqs for both channel 0 & 1 */ + writel(0xff, base + TCB_IDR(0)); + writel(0xff, base + TCB_IDR(1)); + + /* +* In order to avoid wrapping, use a 64 bit counter by chaining +* two channels. +* Channel 0 is configured to generate a clock on TIOA0 which i
[PATCH v8 0/5] add TCB driver for sama5d2
When booting under OP-TEE, the SYSC is secured which means the PIT is also not accessible by non-secure world. The TCB 0 however is always available for non-secure world and thus can be used. This series add a TCB driver and enables it in sama5d2 configs. --- Changes in v8: - Switch clock to use t0_clk, generated clk does not works if parent clock is slow_ck. Moreover, tcb0_clk needs to be enabled for the TCB to operate correctly - Change driver to use TCB_CMR_TIMER_CLOCK2 (tcb0_clk / 8) - Add potential missing clk_enable() - Add u-boot,dm-pre-reloc properties to TCB nodes and to its dependencies in order to be used in SPL Changes in v7: - Keep the exact same Linux aic node definition - Fixed a few constant definition to use (1 << x) Changes in V6: - Fix node ordering in device tree - Disable CONFIG_PIT_TIMER in sama5d2 configuration file - Fixed mach-at91/armv7/Makefile to allow building with TCB Changes in v5: - Fixed missing include in .dts file for IRQ defines - Add aic interrupt controller node to avoid DTC warnings Changes in v4: - Add missing interrupts property to tcb node Changes in v3: - Remove useless defines - Add printf in case of unsupported timers specified in device-tree - Add "syscon" compatible to tcb node Changes in v2: - Reworked driver to use existing Linux bindings Clément Léger (5): timer: atmel_tcb_timer: add atmel_tcb driver ARM: dts: at91: sama5d2: add AIC node ARM: dts: at91: sama5d2: add TCB node ARM: dts: at91: sama5d2: add u-boot,dm-pre-reloc property for TCB configs: sama5d2: enable option CONFIG_ATMEL_TCB_TIMER MAINTAINERS | 1 + arch/arm/dts/sama5d2.dtsi| 28 arch/arm/mach-at91/armv7/Makefile| 2 + configs/sama5d2_icp_mmc_defconfig| 2 +- configs/sama5d2_ptc_ek_mmc_defconfig | 2 +- configs/sama5d2_ptc_ek_nandflash_defconfig | 2 +- configs/sama5d2_xplained_emmc_defconfig | 2 +- configs/sama5d2_xplained_mmc_defconfig | 2 +- configs/sama5d2_xplained_qspiflash_defconfig | 2 +- configs/sama5d2_xplained_spiflash_defconfig | 2 +- drivers/timer/Kconfig| 8 + drivers/timer/Makefile | 1 + drivers/timer/atmel_tcb_timer.c | 161 +++ 13 files changed, 208 insertions(+), 7 deletions(-) create mode 100644 drivers/timer/atmel_tcb_timer.c -- 2.34.1
[PATCH v8 5/5] configs: sama5d2: enable option CONFIG_ATMEL_TCB_TIMER
Enable CONFIG_ATMEL_TCB_TIMER and disable CONFIG_ATMEL_PIT_TIMER. This will allow using the TCB timer instead of the PIT one when running under OP-TEE. Reviewed-by: Claudiu Beznea Signed-off-by: Clément Léger --- configs/sama5d2_icp_mmc_defconfig| 2 +- configs/sama5d2_ptc_ek_mmc_defconfig | 2 +- configs/sama5d2_ptc_ek_nandflash_defconfig | 2 +- configs/sama5d2_xplained_emmc_defconfig | 2 +- configs/sama5d2_xplained_mmc_defconfig | 2 +- configs/sama5d2_xplained_qspiflash_defconfig | 2 +- configs/sama5d2_xplained_spiflash_defconfig | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/configs/sama5d2_icp_mmc_defconfig b/configs/sama5d2_icp_mmc_defconfig index 7761a57e0c..c035d7aad8 100644 --- a/configs/sama5d2_icp_mmc_defconfig +++ b/configs/sama5d2_icp_mmc_defconfig @@ -82,6 +82,6 @@ CONFIG_DEBUG_UART_ANNOUNCE=y CONFIG_ATMEL_USART=y CONFIG_TIMER=y CONFIG_SPL_TIMER=y -CONFIG_ATMEL_PIT_TIMER=y +CONFIG_ATMEL_TCB_TIMER=y CONFIG_OF_LIBFDT_OVERLAY=y # CONFIG_EFI_LOADER_HII is not set diff --git a/configs/sama5d2_ptc_ek_mmc_defconfig b/configs/sama5d2_ptc_ek_mmc_defconfig index 9f458e100b..7cb5ba37f6 100644 --- a/configs/sama5d2_ptc_ek_mmc_defconfig +++ b/configs/sama5d2_ptc_ek_mmc_defconfig @@ -71,7 +71,7 @@ CONFIG_DM_SERIAL=y CONFIG_DEBUG_UART_ANNOUNCE=y CONFIG_ATMEL_USART=y CONFIG_TIMER=y -CONFIG_ATMEL_PIT_TIMER=y +CONFIG_ATMEL_TCB_TIMER=y CONFIG_USB=y CONFIG_USB_EHCI_HCD=y CONFIG_USB_STORAGE=y diff --git a/configs/sama5d2_ptc_ek_nandflash_defconfig b/configs/sama5d2_ptc_ek_nandflash_defconfig index 6460ff3dad..667a10e93f 100644 --- a/configs/sama5d2_ptc_ek_nandflash_defconfig +++ b/configs/sama5d2_ptc_ek_nandflash_defconfig @@ -71,7 +71,7 @@ CONFIG_DM_SERIAL=y CONFIG_DEBUG_UART_ANNOUNCE=y CONFIG_ATMEL_USART=y CONFIG_TIMER=y -CONFIG_ATMEL_PIT_TIMER=y +CONFIG_ATMEL_TCB_TIMER=y CONFIG_USB=y CONFIG_USB_EHCI_HCD=y CONFIG_USB_STORAGE=y diff --git a/configs/sama5d2_xplained_emmc_defconfig b/configs/sama5d2_xplained_emmc_defconfig index 844a9cde64..72544b65bb 100644 --- a/configs/sama5d2_xplained_emmc_defconfig +++ b/configs/sama5d2_xplained_emmc_defconfig @@ -90,7 +90,7 @@ CONFIG_DM_SPI=y CONFIG_ATMEL_QSPI=y CONFIG_TIMER=y CONFIG_SPL_TIMER=y -CONFIG_ATMEL_PIT_TIMER=y +CONFIG_ATMEL_TCB_TIMER=y CONFIG_USB=y CONFIG_USB_EHCI_HCD=y CONFIG_USB_STORAGE=y diff --git a/configs/sama5d2_xplained_mmc_defconfig b/configs/sama5d2_xplained_mmc_defconfig index 0de0636587..bcdb84ce2c 100644 --- a/configs/sama5d2_xplained_mmc_defconfig +++ b/configs/sama5d2_xplained_mmc_defconfig @@ -92,7 +92,7 @@ CONFIG_DM_SPI=y CONFIG_ATMEL_QSPI=y CONFIG_TIMER=y CONFIG_SPL_TIMER=y -CONFIG_ATMEL_PIT_TIMER=y +CONFIG_ATMEL_TCB_TIMER=y CONFIG_USB=y CONFIG_USB_EHCI_HCD=y CONFIG_USB_STORAGE=y diff --git a/configs/sama5d2_xplained_qspiflash_defconfig b/configs/sama5d2_xplained_qspiflash_defconfig index a6e002e59e..c30a90a3e1 100644 --- a/configs/sama5d2_xplained_qspiflash_defconfig +++ b/configs/sama5d2_xplained_qspiflash_defconfig @@ -91,7 +91,7 @@ CONFIG_DM_SPI=y CONFIG_ATMEL_QSPI=y CONFIG_TIMER=y CONFIG_SPL_TIMER=y -CONFIG_ATMEL_PIT_TIMER=y +CONFIG_ATMEL_TCB_TIMER=y CONFIG_USB=y CONFIG_USB_EHCI_HCD=y CONFIG_USB_STORAGE=y diff --git a/configs/sama5d2_xplained_spiflash_defconfig b/configs/sama5d2_xplained_spiflash_defconfig index 676385fe55..eae54469f8 100644 --- a/configs/sama5d2_xplained_spiflash_defconfig +++ b/configs/sama5d2_xplained_spiflash_defconfig @@ -95,7 +95,7 @@ CONFIG_DM_SPI=y CONFIG_ATMEL_QSPI=y CONFIG_TIMER=y CONFIG_SPL_TIMER=y -CONFIG_ATMEL_PIT_TIMER=y +CONFIG_ATMEL_TCB_TIMER=y CONFIG_USB=y CONFIG_USB_EHCI_HCD=y CONFIG_USB_STORAGE=y -- 2.34.1
[PATCH v8 3/5] ARM: dts: at91: sama5d2: add TCB node
Add the device-tree node to describe the TCB timer. Signed-off-by: Clément Léger --- arch/arm/dts/sama5d2.dtsi | 16 1 file changed, 16 insertions(+) diff --git a/arch/arm/dts/sama5d2.dtsi b/arch/arm/dts/sama5d2.dtsi index 7de58e4a1f..058009adca 100644 --- a/arch/arm/dts/sama5d2.dtsi +++ b/arch/arm/dts/sama5d2.dtsi @@ -1,4 +1,5 @@ #include "skeleton.dtsi" +#include / { model = "Atmel SAMA5D2 family SoC"; @@ -639,6 +640,21 @@ status = "disabled"; }; + tcb0: timer@f800c000 { + compatible = "atmel,sama5d2-tcb", "simple-mfd", "syscon"; + reg = <0xf800c000 0x100>; + interrupts = <35 IRQ_TYPE_LEVEL_HIGH 0>; + clocks = <&tcb0_clk>, <&tcb0_gclk>, <&clk32k>; + clock-names = "t0_clk", "gclk", "slow_clk"; + #address-cells = <1>; + #size-cells = <0>; + + timer0: timer@0 { + compatible = "atmel,tcb-timer"; + reg = <0>, <1>; + }; + }; + uart0: serial@f801c000 { compatible = "atmel,at91sam9260-usart"; reg = <0xf801c000 0x100>; -- 2.34.1
[PATCH v8 2/5] ARM: dts: at91: sama5d2: add AIC node
When using interrupts property, a global interrupt controller needs to be added to avoid warnings when compiling device-tree: arch/arm/dts/at91-sama5d2_xplained.dtb: Warning (interrupts_property): /ahb/apb/timer@f800c000: Missing interrupt-parent Add AIC node as the sama5d2 global interrupt controller. Signed-off-by: Clément Léger --- arch/arm/dts/sama5d2.dtsi | 9 + 1 file changed, 9 insertions(+) diff --git a/arch/arm/dts/sama5d2.dtsi b/arch/arm/dts/sama5d2.dtsi index 038cd73c03..7de58e4a1f 100644 --- a/arch/arm/dts/sama5d2.dtsi +++ b/arch/arm/dts/sama5d2.dtsi @@ -3,6 +3,7 @@ / { model = "Atmel SAMA5D2 family SoC"; compatible = "atmel,sama5d2"; + interrupt-parent = <&aic>; aliases { spi0 = &spi0; @@ -762,6 +763,14 @@ status = "disabled"; }; + aic: interrupt-controller@fc02 { + #interrupt-cells = <3>; + compatible = "atmel,sama5d2-aic"; + interrupt-controller; + reg = <0xfc02 0x200>; + atmel,external-irqs = <49>; + }; + i2c1: i2c@fc028000 { compatible = "atmel,sama5d2-i2c"; reg = <0xfc028000 0x100>; -- 2.34.1
Re: [PATCH 02/25] mvebu: Move BOOTROM_ERR_REG out of CONFIG namespace
On 3/31/22 00:07, Tom Rini wrote: This register is referenced in one location and does not seem configurable, so remove it from CONFIG namespace. Cc: Stefan Roese Signed-off-by: Tom Rini Reviewed-by: Stefan Roese Thanks, Stefan --- arch/arm/mach-mvebu/cpu.c | 2 +- arch/arm/mach-mvebu/include/mach/soc.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/arm/mach-mvebu/cpu.c b/arch/arm/mach-mvebu/cpu.c index 0272dd7352d8..1e893777b292 100644 --- a/arch/arm/mach-mvebu/cpu.c +++ b/arch/arm/mach-mvebu/cpu.c @@ -91,7 +91,7 @@ u32 get_boot_device(void) * be done, via the bootrom error register. Here the * MSB marks if the UART mode is active. */ - val = readl(CONFIG_BOOTROM_ERR_REG); + val = readl(BOOTROM_ERR_REG); boot_device = (val & BOOTROM_ERR_MODE_MASK) >> BOOTROM_ERR_MODE_OFFS; debug("BOOTROM_REG=0x%08x boot_device=0x%x\n", val, boot_device); if (boot_device == BOOTROM_ERR_MODE_UART) diff --git a/arch/arm/mach-mvebu/include/mach/soc.h b/arch/arm/mach-mvebu/include/mach/soc.h index aab61f7c15cf..3b9618852c6d 100644 --- a/arch/arm/mach-mvebu/include/mach/soc.h +++ b/arch/arm/mach-mvebu/include/mach/soc.h @@ -125,7 +125,7 @@ #define COMPHY_REFCLK_ALIGNMENT (MVEBU_REGISTER(0x182f8)) /* BootROM error register (also includes some status infos) */ -#define CONFIG_BOOTROM_ERR_REG (MVEBU_REGISTER(0x182d0)) +#define BOOTROM_ERR_REG(MVEBU_REGISTER(0x182d0)) #define BOOTROM_ERR_MODE_OFFS 28 #define BOOTROM_ERR_MODE_MASK (0xf << BOOTROM_ERR_MODE_OFFS) #define BOOTROM_ERR_MODE_UART 0x6 Viele Grüße, Stefan Roese -- DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-51 Fax: (+49)-8142-66989-80 Email: s...@denx.de
Re: [PATCH 14/25] controlcenterdc: Migrate CUSTOMER_BOARD_SUPPORT to Kconfig
On 3/31/22 00:07, Tom Rini wrote: This symbol is only possibly useful on some mvebu platforms, so move the symbol there and select it for the only current user. Cc: Mario Six Cc: Stefan Roese Signed-off-by: Tom Rini Reviewed-by: Stefan Roese Thanks, Stefan --- arch/arm/mach-mvebu/Kconfig | 4 include/configs/controlcenterdc.h | 5 - 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/arch/arm/mach-mvebu/Kconfig b/arch/arm/mach-mvebu/Kconfig index e17a55a44261..21d9db2638d6 100644 --- a/arch/arm/mach-mvebu/Kconfig +++ b/arch/arm/mach-mvebu/Kconfig @@ -90,6 +90,9 @@ config 88F6820 bool select ARMADA_38X +config CUSTOMER_BOARD_SUPPORT + bool + choice prompt "Armada XP/375/38x/3700/7K/8K board select" optional @@ -173,6 +176,7 @@ config TARGET_THEADORABLE config TARGET_CONTROLCENTERDC bool "Support CONTROLCENTERDC" select 88F6820 + select CUSTOMER_BOARD_SUPPORT config TARGET_X530 bool "Support Allied Telesis x530" diff --git a/include/configs/controlcenterdc.h b/include/configs/controlcenterdc.h index a7d922c3a237..b499d7085fd4 100644 --- a/include/configs/controlcenterdc.h +++ b/include/configs/controlcenterdc.h @@ -7,11 +7,6 @@ #ifndef _CONFIG_CONTROLCENTERDC_H #define _CONFIG_CONTROLCENTERDC_H -/* - * High Level Configuration Options (easy to change) - */ -#define CONFIG_CUSTOMER_BOARD_SUPPORT - /* * TEXT_BASE needs to be below 16MiB, since this area is scrubbed * for DDR ECC byte filling in the SPL before loading the main Viele Grüße, Stefan Roese -- DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-51 Fax: (+49)-8142-66989-80 Email: s...@denx.de
Re: [PATCH v3 5/9] capsule: kconfig: Select SET_DFU_ALT_INFO config symbol for capsule update
Hi Sughosh, 2022年3月31日(木) 17:38 Sughosh Ganu : > > hi Masami, > > On Thu, 31 Mar 2022 at 13:11, Sughosh Ganu wrote: > > > > hi Masami, > > > > On Thu, 31 Mar 2022 at 08:18, Masami Hiramatsu > > wrote: > > > > > > Hi, > > > > > > Even with this patch, if the platform configuration doesn't select > > > EFI_CAPSULE_FIRMWARE_* (or user will disable it when use it), the > > > platform will lose raw DFU availability. > > > > I will have to rely on feedback from board maintainers for that. Like > > I commented in another email, I think that these platforms are setting > > dfu_alt_info primarily for capsule updates. But if some board > > maintainer asks, I will enable CONFIG_SET_DFU_ALT_INFO the board's > > defconfig. Thanks. > > Another alternative is that we keep the dfu_alt_info settings in the > board config headers. With the capsule update, the > CONFIG_SET_DFU_ALT_INFO will be set, and the variable will be > populated from the board file. For the non capsule update scenario, > the platform can then use the variable set in the board headers. Will > that be fine with you. Let me know. Thanks. Yeah, that is good for me :) Thank you, > > -sughosh > > > > > -sughosh > > > > > > > > Thank you, > > > > > > 2022年3月30日(水) 23:51 Sughosh Ganu : > > > > > > > > The capsule update code uses the dfu_alt_info variable for the actual > > > > update of the firmware component. The dfu_alt_info variable gives > > > > information needed to perform the update, like the device on which the > > > > update is to be made, the partition, type of partition etc. Since the > > > > dfu_alt_info is a environmental variable, it can be modified from the > > > > u-boot command line. An incorrect update of the variable will result > > > > in the update being done incorrectly. > > > > > > > > Prevent this scenario by forcing an update of the dfu_alt_info > > > > variable from the information obtained through the board file when > > > > UEFI capsule update functionality is enabled. > > > > > > > > Signed-off-by: Sughosh Ganu > > > > --- > > > > > > > > Changes since V2: New Patch > > > > > > > > lib/efi_loader/Kconfig | 2 ++ > > > > 1 file changed, 2 insertions(+) > > > > > > > > diff --git a/lib/efi_loader/Kconfig b/lib/efi_loader/Kconfig > > > > index e5e35fe51f..09fb8cbe75 100644 > > > > --- a/lib/efi_loader/Kconfig > > > > +++ b/lib/efi_loader/Kconfig > > > > @@ -174,6 +174,7 @@ config EFI_CAPSULE_FIRMWARE_FIT > > > > depends on EFI_CAPSULE_FIRMWARE_MANAGEMENT > > > > select UPDATE_FIT > > > > select DFU > > > > + select SET_DFU_ALT_INFO > > > > select EFI_CAPSULE_FIRMWARE > > > > help > > > > Select this option if you want to enable firmware management > > > > protocol > > > > @@ -185,6 +186,7 @@ config EFI_CAPSULE_FIRMWARE_RAW > > > > depends on SANDBOX || (!SANDBOX && !EFI_CAPSULE_FIRMWARE_FIT) > > > > select DFU_WRITE_ALT > > > > select DFU > > > > + select SET_DFU_ALT_INFO > > > > select EFI_CAPSULE_FIRMWARE > > > > help > > > > Select this option if you want to enable firmware management > > > > protocol > > > > -- > > > > 2.25.1 > > > > > > > > > > > > > -- > > > Masami Hiramatsu -- Masami Hiramatsu
[PATCH v2 1/2] net: phy: marvell: Support reg config via "marvell, reg-init" DT property
This patch adds support for the "marvell,reg-init" DT property, which is used to describe board specific Marvell PHY register configurations in the board dts file. This DT property is supported in the Linux Kernel since a longer time. Adding it to U-Boot now, enables the boards which describe the register settings in their DT files here as well. I've included calling this marvell_of_reg_init() to all foo_config() functions in this patch as well. If CONFIG_DM_ETH is not set, there is no ofnode, or no "marvell,reg-init" property, the PHY initialization is unchanged. The function marvell_of_reg_init() is a port of the Linux version. Please note that I explicitly did not add error checking and handling to the U-Boot version, as this is basically not done for phy_read/write in this Marvell PHY code. This will be used by the upcoming ethernet support on the MIPS Octeon EBB 7304 board. Signed-off-by: Stefan Roese Cc: Ramon Fried Cc: Joe Hershberger Cc: Aaron Williams Cc: Chandrakala Chavva Cc: Marek Behún --- v2: - Move marvell_read/write_page into "#if IS_ENABLED()', to avoid compilation errors for platfoms which don't have CONFIG_DM_ETH enabled drivers/net/phy/marvell.c | 100 ++ 1 file changed, 100 insertions(+) diff --git a/drivers/net/phy/marvell.c b/drivers/net/phy/marvell.c index a62c695c5c84..1dcb79db2429 100644 --- a/drivers/net/phy/marvell.c +++ b/drivers/net/phy/marvell.c @@ -104,6 +104,88 @@ #define MIIM_88E151x_MODE_SGMII1 #define MIIM_88E151x_RESET_OFFS15 +#if IS_ENABLED(CONFIG_DM_ETH) +static int marvell_read_page(struct phy_device *phydev) +{ + return phy_read(phydev, MDIO_DEVAD_NONE, MII_MARVELL_PHY_PAGE); +} + +static int marvell_write_page(struct phy_device *phydev, int page) +{ + return phy_write(phydev, MDIO_DEVAD_NONE, MII_MARVELL_PHY_PAGE, page); +} + +/* Set and/or override some configuration registers based on the + * marvell,reg-init property stored in the of_node for the phydev. + * + * marvell,reg-init = ,...; + * + * There may be one or more sets of : + * + * reg-page: which register bank to use. + * reg: the register. + * mask: if non-zero, ANDed with existing register value. + * value: ORed with the masked value and written to the regiser. + * + */ +static int marvell_of_reg_init(struct phy_device *phydev) +{ + const __be32 *prop; + int len, i, saved_page, current_page, ret = 0; + + if (!ofnode_valid(phydev->node)) + return 0; + + prop = ofnode_get_property(phydev->node, "marvell,reg-init", &len); + if (!prop) + return 0; + + saved_page = marvell_read_page(phydev); + if (saved_page < 0) + goto err; + current_page = saved_page; + + len /= sizeof(*prop); + for (i = 0; i < len - 3; i += 4) { + u16 page = be32_to_cpup(prop + i); + u16 reg = be32_to_cpup(prop + i + 1); + u16 mask = be32_to_cpup(prop + i + 2); + u16 val_bits = be32_to_cpup(prop + i + 3); + int val; + + if (page != current_page) { + current_page = page; + ret = marvell_write_page(phydev, page); + if (ret < 0) + goto err; + } + + val = 0; + if (mask) { + val = phy_read(phydev, MDIO_DEVAD_NONE, reg); + if (val < 0) { + ret = val; + goto err; + } + val &= mask; + } + val |= val_bits; + + ret = phy_write(phydev, MDIO_DEVAD_NONE, reg, val); + if (ret < 0) + goto err; + } + +err: + return marvell_write_page(phydev, saved_page); +} +#else +static int marvell_of_reg_init(struct phy_device *phydev) +{ + return 0; +} +#endif /* CONFIG_DM_ETH */ + static int m88e1xxx_phy_extread(struct phy_device *phydev, int addr, int devaddr, int regnum) { @@ -143,6 +225,8 @@ static int m88e1011s_config(struct phy_device *phydev) phy_write(phydev, MDIO_DEVAD_NONE, MII_BMCR, BMCR_RESET); + marvell_of_reg_init(phydev); + genphy_config_aneg(phydev); return 0; @@ -298,6 +382,8 @@ static int m88es_config(struct phy_device *phydev) /* soft reset */ phy_reset(phydev); + marvell_of_reg_init(phydev); + genphy_config_aneg(phydev); genphy_restart_aneg(phydev); @@ -397,6 +483,8 @@ static int m88e151x_config(struct phy_device *phydev) /* soft reset */ phy_reset(phydev); + marvell_of_reg_init(phydev); + genphy_config_aneg(phydev); genphy_restart_aneg(phydev); @@ -417,6 +505,8 @@ static int m88e1118_config(struct phy_device *phydev) /* Change Pag
[PATCH v2 2/2] net: phy: marvell: Add support for 88E1240 PHY
This patch adds basic support for the Marvell 88E1240 PHY. This will be used by the upcoming ethernet support addition for the Marvell MIPS Octeon EBB7304 platform. Signed-off-by: Stefan Roese Cc: Ramon Fried Cc: Joe Hershberger Cc: Aaron Williams Cc: Chandrakala Chavva --- v2: - No change drivers/net/phy/marvell.c | 21 + 1 file changed, 21 insertions(+) diff --git a/drivers/net/phy/marvell.c b/drivers/net/phy/marvell.c index 1dcb79db2429..212a861596f6 100644 --- a/drivers/net/phy/marvell.c +++ b/drivers/net/phy/marvell.c @@ -614,6 +614,16 @@ static int m88e1149_config(struct phy_device *phydev) return 0; } +/* Marvell 88E1240 */ +static int m88e1240_config(struct phy_device *phydev) +{ + marvell_of_reg_init(phydev); + + genphy_config_aneg(phydev); + + return 0; +} + /* Marvell 88E1310 */ static int m88e1310_config(struct phy_device *phydev) { @@ -760,6 +770,16 @@ static struct phy_driver M88E1149S_driver = { .shutdown = &genphy_shutdown, }; +static struct phy_driver M88E1240_driver = { + .name = "Marvell 88E1240", + .uid = 0x1410e30, + .mask = 0xff0, + .features = PHY_GBIT_FEATURES, + .config = &m88e1240_config, + .startup = &m88e1011s_startup, + .shutdown = &genphy_shutdown, +}; + static struct phy_driver M88E151x_driver = { .name = "Marvell 88E151x", .uid = 0x1410dd0, @@ -802,6 +822,7 @@ int phy_marvell_init(void) phy_register(&M88E1118R_driver); phy_register(&M88ES_driver); phy_register(&M88E1011S_driver); + phy_register(&M88E1240_driver); phy_register(&M88E151x_driver); phy_register(&M88E1680_driver); -- 2.35.1
[PATCH v2 2/3] cmd: lcdputs: Escape special characters
From: qianfan Zhao Add support \\, \r, \n, \t and \b. eg: => lcdputs "hello\nworld" Signed-off-by: qianfan Zhao --- drivers/video/vidconsole-uclass.c | 34 +-- 1 file changed, 32 insertions(+), 2 deletions(-) diff --git a/drivers/video/vidconsole-uclass.c b/drivers/video/vidconsole-uclass.c index f42db40d4c..d2554fd3f7 100644 --- a/drivers/video/vidconsole-uclass.c +++ b/drivers/video/vidconsole-uclass.c @@ -709,15 +709,45 @@ static int do_video_puts(struct cmd_tbl *cmdtp, int flag, int argc, { struct udevice *dev; const char *s; + char c; if (argc != 2) return CMD_RET_USAGE; if (uclass_first_device_err(UCLASS_VIDEO_CONSOLE, &dev)) return CMD_RET_FAILURE; - for (s = argv[1]; *s; s++) - vidconsole_put_char(dev, *s); + for (s = argv[1]; (c = *s); s++) { + if (c == '\\') { + s++; + + switch (*s) { + case '\0': + goto sync; + case '\\': + c = '\\'; + break; + case 'r': + c = '\r'; + break; + case 'n': + c = '\n'; + break; + case 't': + c = '\t'; + break; + case 'b': + c = '\b'; + break; + default: + continue; + } + } + + vidconsole_put_char(dev, c); + } + +sync: return video_sync(dev->parent, false); } -- 2.17.1
[PATCH v2 1/3] video: Add VIDEO_FONT_4x6 to Kconfig add fix compile waring
From: qianfan Zhao CONFIG_VIDEO_FONT_4x6 is referenced in include/video_font.h, but doesn't has a Kconfig configuration. Add it. Signed-off-by: qianfan Zhao --- drivers/video/Kconfig| 15 +++ include/video_font_4x6.h | 2 +- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/drivers/video/Kconfig b/drivers/video/Kconfig index e2cf1e752f..adc620682e 100644 --- a/drivers/video/Kconfig +++ b/drivers/video/Kconfig @@ -138,6 +138,21 @@ config CONSOLE_NORMAL CONFIG_CONSOLE_ROTATION for that). A built-in 8x16 font is used for the display. +choice + prompt "bitmap video font" + default VIDEO_FONT_8X16 + depends on CONSOLE_NORMAL + help + Select the default bitmap font. + +config VIDEO_FONT_4X6 + bool "4x6" + +config VIDEO_FONT_8X16 + bool "8x16" + +endchoice + config CONSOLE_ROTATION bool "Support rotated displays" depends on DM_VIDEO diff --git a/include/video_font_4x6.h b/include/video_font_4x6.h index c7e6351b64..65dd5e8c1d 100644 --- a/include/video_font_4x6.h +++ b/include/video_font_4x6.h @@ -46,7 +46,7 @@ __END__; #define VIDEO_FONT_HEIGHT 6 #define VIDEO_FONT_SIZE(VIDEO_FONT_CHARS * VIDEO_FONT_HEIGHT) -static unsigned char video_fontdata[VIDEO_FONT_SIZE] = { +static unsigned char __maybe_unused video_fontdata[VIDEO_FONT_SIZE] = { /*{*/ /* Char 0: ' ' */ -- 2.17.1
[PATCH v2 3/3] driver: video: font: Introduce 6x8 bitmap font
From: qianfan Zhao 6x8 bitmap font has better display effect on smaller lcd screen. Signed-off-by: qianfan Zhao --- drivers/video/Kconfig|3 + include/video_font.h |4 +- include/video_font_6x8.h | 2580 ++ 3 files changed, 2586 insertions(+), 1 deletion(-) create mode 100644 include/video_font_6x8.h diff --git a/drivers/video/Kconfig b/drivers/video/Kconfig index adc620682e..0526a88ee3 100644 --- a/drivers/video/Kconfig +++ b/drivers/video/Kconfig @@ -148,6 +148,9 @@ choice config VIDEO_FONT_4X6 bool "4x6" +config VIDEO_FONT_6X8 + bool "6x8" + config VIDEO_FONT_8X16 bool "8x16" diff --git a/include/video_font.h b/include/video_font.h index 5e23f70f85..4eac37a0f0 100644 --- a/include/video_font.h +++ b/include/video_font.h @@ -7,8 +7,10 @@ #ifndef _VIDEO_FONT_ #define _VIDEO_FONT_ -#ifdef CONFIG_VIDEO_FONT_4X6 +#if defined(CONFIG_VIDEO_FONT_4X6) #include +#elif defined(CONFIG_VIDEO_FONT_6X8) +#include #else #include #endif diff --git a/include/video_font_6x8.h b/include/video_font_6x8.h new file mode 100644 index 00..e090372c02 --- /dev/null +++ b/include/video_font_6x8.h @@ -0,0 +1,2580 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ +/* + * (C) Copyright 2022 + * qianfan Zhao + * + * This file contains an 6x8 bitmap font for code page 437. + */ + +#ifndef _VIDEO_FONT_DATA_ +#define _VIDEO_FONT_DATA_ + +#define VIDEO_FONT_CHARS 256 +#define VIDEO_FONT_WIDTH 6 +#define VIDEO_FONT_HEIGHT 8 +#define VIDEO_FONT_SIZE(VIDEO_FONT_CHARS * VIDEO_FONT_HEIGHT) + +static unsigned char __maybe_unused video_fontdata[VIDEO_FONT_SIZE] = { + /* 0 0x00 */ + 0x00, /* */ + 0x00, /* */ + 0x00, /* */ + 0x00, /* */ + 0x00, /* */ + 0x00, /* */ + 0x00, /* */ + 0x00, /* */ + + /* 1 0x01 */ + 0x38, /* ****/ + 0x44, /* * * */ + 0x6c, /* ** ** */ + 0x44, /* * * */ + 0x54, /* * * * */ + 0x44, /* * * */ + 0x38, /* ****/ + 0x00, /* */ + + /* 2 0x02 */ + 0x38, /* ****/ + 0x7c, /* * */ + 0x54, /* * * * */ + 0x7c, /* * */ + 0x44, /* * * */ + 0x7c, /* * */ + 0x38, /* ****/ + 0x00, /* */ + + /* 3 0x03 */ + 0x00, /* */ + 0x28, /* * **/ + 0x7c, /* * */ + 0x7c, /* * */ + 0x7c, /* * */ + 0x38, /* ****/ + 0x10, /** */ + 0x00, /* */ + + /* 4 0x04 */ + 0x00, /* */ + 0x10, /** */ + 0x38, /* ****/ + 0x7c, /* * */ + 0x7c, /* * */ + 0x38, /* ****/ + 0x10, /** */ + 0x00, /* */ + + /* 5 0x05 */ + 0x10, /** */ + 0x38, /* ****/ + 0x38, /* ****/ + 0x10, /** */ + 0x7c, /* * */ + 0x7c, /* * */ + 0x10, /** */ + 0x00, /* */ + + /* 6 0x06 */ + 0x00, /* */ + 0x10, /** */ + 0x38, /* ****/ + 0x7c, /* * */ + 0x7c, /* * */ + 0x10, /** */ + 0x38, /* ****/ + 0x00, /* */ + + /* 7 0x07 */ + 0x00, /* */ + 0x00, /* */ + 0x00, /* */ + 0x00, /* */ + 0x00, /* */ + 0x00, /* */ + 0x00, /* */ + 0x00, /* */ + + /* 8 0x08 */ + 0x00, /* */ + 0x00, /* */ + 0x00, /* */ + 0x00, /* */ + 0x00, /* */ + 0x00, /* */ + 0x00, /* */ + 0x00, /* */ + + /* 9 0x09 */ + 0x00, /* */ + 0x00, /* */ + 0x00, /* */ + 0x00, /* */ + 0x00, /* */ + 0x00, /* */ + 0x00, /* */ + 0x00, /* */ + + /* 10 0x0a */ + 0x00, /* */ + 0x00, /* */ + 0x00, /* */ + 0x00, /* */ + 0x00, /* */ + 0x00, /* */ + 0x00, /* */ + 0x00, /* */ + + /* 11 0x0b */ + 0x00, /* */ + 0x1c, /**** */ + 0x0c, /* ** */ + 0x34, /* ** * */ + 0x48, /* * **/ + 0x48, /* * **/ + 0x30, /* ** */ + 0x00, /* */ + + /* 12 0x0c */ + 0x38, /* ****/ + 0x44, /* * * */ + 0x44, /* * * */ + 0x38, /* ****/ + 0x10, /** */ + 0x38, /* ****/ + 0x10, /** */ + 0x00, /*
[PATCH 03/11] virtio_ring: Maintain a shadow copy of descriptors
The shared descriptors should only be written by the guest driver, however, the device is still able to overwrite and corrupt them. Maintain a private shadow copy of the descriptors for the driver to use for state tracking, removing the need to read from the shared descriptors. Signed-off-by: Andrew Scull --- drivers/virtio/virtio_ring.c | 49 include/virtio_ring.h| 10 2 files changed, 43 insertions(+), 16 deletions(-) diff --git a/drivers/virtio/virtio_ring.c b/drivers/virtio/virtio_ring.c index 8e0cb3d666..69fd8c6aa0 100644 --- a/drivers/virtio/virtio_ring.c +++ b/drivers/virtio/virtio_ring.c @@ -19,13 +19,21 @@ static unsigned int virtqueue_attach_desc(struct virtqueue *vq, unsigned int i, struct virtio_sg *sg, u16 flags) { + struct vring_desc_shadow *desc_shadow = &vq->vring_desc_shadow[i]; struct vring_desc *desc = &vq->vring.desc[i]; - desc->addr = cpu_to_virtio64(vq->vdev, (u64)(uintptr_t)sg->addr); - desc->len = cpu_to_virtio32(vq->vdev, sg->length); - desc->flags = cpu_to_virtio16(vq->vdev, flags); + /* Update the shadow descriptor. */ + desc_shadow->addr = (u64)(uintptr_t)sg->addr; + desc_shadow->len = sg->length; + desc_shadow->flags = flags; - return virtio16_to_cpu(vq->vdev, desc->next); + /* Update the shared descriptor to match the shadow. */ + desc->addr = cpu_to_virtio64(vq->vdev, desc_shadow->addr); + desc->len = cpu_to_virtio32(vq->vdev, desc_shadow->len); + desc->flags = cpu_to_virtio16(vq->vdev, desc_shadow->flags); + desc->next = cpu_to_virtio16(vq->vdev, desc_shadow->next); + + return desc_shadow->next; } int virtqueue_add(struct virtqueue *vq, struct virtio_sg *sgs[], @@ -67,7 +75,8 @@ int virtqueue_add(struct virtqueue *vq, struct virtio_sg *sgs[], i = virtqueue_attach_desc(vq, i, sgs[n], flags); } /* Last one doesn't continue */ - desc[prev].flags &= cpu_to_virtio16(vq->vdev, ~VRING_DESC_F_NEXT); + vq->vring_desc_shadow[prev].flags &= ~VRING_DESC_F_NEXT; + desc[prev].flags = cpu_to_virtio16(vq->vdev, vq->vring_desc_shadow[prev].flags); /* We're using some buffers from the free list. */ vq->num_free -= descs_used; @@ -136,17 +145,16 @@ void virtqueue_kick(struct virtqueue *vq) static void detach_buf(struct virtqueue *vq, unsigned int head) { unsigned int i; - __virtio16 nextflag = cpu_to_virtio16(vq->vdev, VRING_DESC_F_NEXT); /* Put back on free list: unmap first-level descriptors and find end */ i = head; - while (vq->vring.desc[i].flags & nextflag) { - i = virtio16_to_cpu(vq->vdev, vq->vring.desc[i].next); + while (vq->vring_desc_shadow[i].flags & VRING_DESC_F_NEXT) { + i = vq->vring_desc_shadow[i].next; vq->num_free++; } - vq->vring.desc[i].next = cpu_to_virtio16(vq->vdev, vq->free_head); + vq->vring_desc_shadow[i].next = vq->free_head; vq->free_head = head; /* Plus final descriptor */ @@ -199,8 +207,7 @@ void *virtqueue_get_buf(struct virtqueue *vq, unsigned int *len) virtio_store_mb(&vring_used_event(&vq->vring), cpu_to_virtio16(vq->vdev, vq->last_used_idx)); - return (void *)(uintptr_t)virtio64_to_cpu(vq->vdev, - vq->vring.desc[i].addr); + return (void *)(uintptr_t)vq->vring_desc_shadow[i].addr; } static struct virtqueue *__vring_new_virtqueue(unsigned int index, @@ -209,6 +216,7 @@ static struct virtqueue *__vring_new_virtqueue(unsigned int index, { unsigned int i; struct virtqueue *vq; + struct vring_desc_shadow *vring_desc_shadow; struct virtio_dev_priv *uc_priv = dev_get_uclass_priv(udev); struct udevice *vdev = uc_priv->vdev; @@ -216,10 +224,17 @@ static struct virtqueue *__vring_new_virtqueue(unsigned int index, if (!vq) return NULL; + vring_desc_shadow = calloc(vring.num, sizeof(struct vring_desc_shadow)); + if (!vring_desc_shadow) { + free(vq); + return NULL; + } + vq->vdev = vdev; vq->index = index; vq->num_free = vring.num; vq->vring = vring; + vq->vring_desc_shadow = vring_desc_shadow; vq->last_used_idx = 0; vq->avail_flags_shadow = 0; vq->avail_idx_shadow = 0; @@ -237,7 +252,7 @@ static struct virtqueue *__vring_new_virtqueue(unsigned int index, /* Put everything in free lists */ vq->free_head = 0; for (i = 0; i < vring.num - 1; i++) - vq->vring.desc[i].next = cpu_to_virtio16(vdev, i + 1); + vq->vring_desc_shadow[i].next = i + 1; return vq; } @@ -290,6 +305,7 @@ struct virtqueue *vring_create_virtqueue(unsigned
[PATCH 01/11] virtio_ring: Merge identical variables
The variables `total_sg` and `descs_used` have the same value. Replace the few uses of `total_sg` with `descs_used` to simplify the situation. Signed-off-by: Andrew Scull --- drivers/virtio/virtio_ring.c | 7 +++ 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/drivers/virtio/virtio_ring.c b/drivers/virtio/virtio_ring.c index 7f1cbc5932..a6922ce1b8 100644 --- a/drivers/virtio/virtio_ring.c +++ b/drivers/virtio/virtio_ring.c @@ -20,17 +20,16 @@ int virtqueue_add(struct virtqueue *vq, struct virtio_sg *sgs[], unsigned int out_sgs, unsigned int in_sgs) { struct vring_desc *desc; - unsigned int total_sg = out_sgs + in_sgs; - unsigned int i, n, avail, descs_used, uninitialized_var(prev); + unsigned int descs_used = out_sgs + in_sgs; + unsigned int i, n, avail, uninitialized_var(prev); int head; - WARN_ON(total_sg == 0); + WARN_ON(descs_used == 0); head = vq->free_head; desc = vq->vring.desc; i = head; - descs_used = total_sg; if (vq->num_free < descs_used) { debug("Can't add buf len %i - avail = %i\n", -- 2.35.1.1094.g7c7d902a7c-goog
[PATCH 04/11] virtio_ring: Check used descriptors are chain heads
When the device returns used buffers, it should refer to the descriptor that is the head of the descriptor chain for that buffer. Confirm this to be the case by tracking the head of descriptor chains that have been made available to the device. Signed-off-by: Andrew Scull --- drivers/virtio/virtio_ring.c | 12 include/virtio_ring.h| 2 ++ 2 files changed, 14 insertions(+) diff --git a/drivers/virtio/virtio_ring.c b/drivers/virtio/virtio_ring.c index 69fd8c6aa0..383d574cb0 100644 --- a/drivers/virtio/virtio_ring.c +++ b/drivers/virtio/virtio_ring.c @@ -84,6 +84,9 @@ int virtqueue_add(struct virtqueue *vq, struct virtio_sg *sgs[], /* Update free pointer */ vq->free_head = i; + /* Mark the descriptor as the head of a chain. */ + vq->vring_desc_shadow[head].chain_head = true; + /* * Put entry in available array (but don't update avail->idx * until they do sync). @@ -146,6 +149,9 @@ static void detach_buf(struct virtqueue *vq, unsigned int head) { unsigned int i; + /* Unmark the descriptor as the head of a chain. */ + vq->vring_desc_shadow[head].chain_head = false; + /* Put back on free list: unmap first-level descriptors and find end */ i = head; @@ -196,6 +202,12 @@ void *virtqueue_get_buf(struct virtqueue *vq, unsigned int *len) return NULL; } + if (unlikely(!vq->vring_desc_shadow[i].chain_head)) { + printf("(%s.%d): id %u is not a head\n", + vq->vdev->name, vq->index, i); + return NULL; + } + detach_buf(vq, i); vq->last_used_idx++; /* diff --git a/include/virtio_ring.h b/include/virtio_ring.h index 52cbe77c0a..c77c212cff 100644 --- a/include/virtio_ring.h +++ b/include/virtio_ring.h @@ -61,6 +61,8 @@ struct vring_desc_shadow { u32 len; u16 flags; u16 next; + /* Metadata about the descriptor. */ + bool chain_head; }; struct vring_avail { -- 2.35.1.1094.g7c7d902a7c-goog
Re: [PATCH v4 10/11] bootmenu: add removable media entries
On Thu, 31 Mar 2022 at 17:48, Ilias Apalodimas wrote: > > On Thu, Mar 24, 2022 at 10:54:42PM +0900, Masahisa Kojima wrote: > > UEFI specification requires booting from removal media using > > a architecture-specific default image name such as BOOTAA64.EFI. > > This commit adds the removable media entries into bootmenu, > > so that user can select the removable media and boot with > > default image. > > > > The bootmenu automatically enumerates the possible bootable > > media devices supporting EFI_SIMPLE_FILE_SYSTEM_PROTOCOL, > > add it as new UEFI boot option(BOOT) and update BootOrder > > variable. Depending on the system hardware setup, some devices > > may not exist at a later system boot, so invalid BOOT variable > > must be deleted. > > > > Signed-off-by: Masahisa Kojima > > --- > > Newly created in v4 > > > > cmd/bootmenu.c| 78 + > > include/efi_loader.h | 22 > > lib/efi_loader/efi_bootmenu_maintenance.c | 128 ++ > > 3 files changed, 228 insertions(+) > > > > diff --git a/cmd/bootmenu.c b/cmd/bootmenu.c > > index 458eb90b63..7357cfeae5 100644 > > --- a/cmd/bootmenu.c > > +++ b/cmd/bootmenu.c > > @@ -304,6 +304,74 @@ static int prepare_uefi_bootorder_entry(struct > > bootmenu_data *menu, > > return 1; > > } > > > > +static efi_status_t prepare_media_device_entry(void) > > +{ > > + u32 i; > > + efi_status_t ret; > > + efi_uintn_t count; > > + efi_handle_t *volume_handles = NULL; > > + struct efi_bootmenu_media_boot_option *opt = NULL; > > + > > + ret = efi_locate_handle_buffer_int(BY_PROTOCOL, > > &efi_simple_file_system_protocol_guid, > > +NULL, &count, (efi_handle_t > > **)&volume_handles); > > + if (ret != EFI_SUCCESS) > > + return ret; > > + > > + opt = calloc(count, sizeof(struct efi_bootmenu_media_boot_option)); > > + if (!opt) > > + goto out; > > + > > + /* enumerate all devices supporting EFI_SIMPLE_FILE_SYSTEM_PROTOCOL */ > > + ret = efi_bootmenu_enumerate_boot_option(opt, volume_handles, count); > > + if (ret != EFI_SUCCESS) > > + goto out; > > + > > + /* > > + * System hardware configuration may vary depending on the user setup. > > + * The boot option is automatically added by the bootmenu. > > + * If the device is not attached to the system, the boot option needs > > + * to be deleted. > > + */ > > + ret = efi_bootmenu_delete_invalid_boot_option(opt, count); > > Won't that fail on first boot if the BootOrder is undefined? > efi_bootmenu_delete_invalid_boot_option() should return EFI_SUCCESS if it > doesn't have a boot order maybe? You are correct. Returning EFI_SUCCESS if there is no BootOrder defined will resolve your issue. > > > + if (ret != EFI_SUCCESS) > > + goto out; > > + > > + /* add non-existent boot option */ > > + for (i = 0; i < count; i++) { > > + u32 boot_index; > > + u16 var_name[9]; > > + > > + if (!opt[i].exist) { > > + ret = efi_bootmenu_get_unused_bootoption(var_name, > > sizeof(var_name), > > + &boot_index); > > + if (ret != EFI_SUCCESS) > > + goto out; > > + > > + ret = efi_set_variable_int(var_name, > > &efi_global_variable_guid, > > +EFI_VARIABLE_NON_VOLATILE | > > + > > EFI_VARIABLE_BOOTSERVICE_ACCESS | > > + > > EFI_VARIABLE_RUNTIME_ACCESS, > > +opt[i].size, opt[i].lo, > > false); > > + if (ret != EFI_SUCCESS) > > + goto out; > > + > > + ret = efi_bootmenu_append_bootorder(boot_index); > > + if (ret != EFI_SUCCESS) > > + goto out; > > + } > > + } > > + > > +out: > > + if (opt) { > > + for (i = 0; i < count; i++) > > + free(opt[i].lo); > > + } > > + free(opt); > > + efi_free_pool(volume_handles); > > + > > + return ret; > > +} > > + > > static int prepare_distro_boot_entry(struct bootmenu_data *menu, > >struct bootmenu_entry **current, > >unsigned short int *index) > > @@ -408,6 +476,16 @@ static struct bootmenu_data *bootmenu_create(int delay) > > goto cleanup; > > > > if (IS_ENABLED(CONFIG_CMD_BOOTEFI_BOOTMGR)) { > > + if (i < MAX_DYNAMIC_ENTRY) { > > + /* > > + * UEFI specification requires booting from removal > > media using > > + * a architecture-speci
Re: [PATCH v2 1/2] net: phy: marvell: Support reg config via "marvell,reg-init" DT property
On Thu, 31 Mar 2022 11:43:06 +0200 Stefan Roese wrote: > This patch adds support for the "marvell,reg-init" DT property, which > is used to describe board specific Marvell PHY register configurations > in the board dts file. This DT property is supported in the Linux Kernel > since a longer time. Adding it to U-Boot now, enables the boards which > describe the register settings in their DT files here as well. > > I've included calling this marvell_of_reg_init() to all foo_config() > functions in this patch as well. If CONFIG_DM_ETH is not set, there is > no ofnode, or no "marvell,reg-init" property, the PHY initialization is > unchanged. > > The function marvell_of_reg_init() is a port of the Linux version. > Please note that I explicitly did not add error checking and handling > to the U-Boot version, as this is basically not done for phy_read/write > in this Marvell PHY code. > > This will be used by the upcoming ethernet support on the MIPS > Octeon EBB 7304 board. > > Signed-off-by: Stefan Roese > Cc: Ramon Fried > Cc: Joe Hershberger > Cc: Aaron Williams > Cc: Chandrakala Chavva > Cc: Marek Behún I think fdt32_to_cpu() would be better than be32_to_cpup(), but that is just a nitpick. Reviewed-by: Marek Behún
Re: [PATCH v2 2/2] net: phy: marvell: Add support for 88E1240 PHY
On Thu, 31 Mar 2022 11:43:07 +0200 Stefan Roese wrote: > This patch adds basic support for the Marvell 88E1240 PHY. > > This will be used by the upcoming ethernet support addition for the > Marvell MIPS Octeon EBB7304 platform. > > Signed-off-by: Stefan Roese > Cc: Ramon Fried > Cc: Joe Hershberger > Cc: Aaron Williams > Cc: Chandrakala Chavva Reviewed-by: Marek Behún
Re: [PATCH 01/10] Makefile: v2 Allow LTO to be disabled for a build
On Sun, 27 Mar 2022 at 21:27, Simon Glass wrote: > > LTO (Link-Time Optimisation) is an very useful feature which can > significantly reduce the size of U-Boot binaries. So far it has been > made available for selected ARM boards and sandbox. > > However, incremental builds are much slower when LTO is used. For example, > an incremental build of sandbox takes 2.1 seconds on my machine, but 6.7 > seconds with LTO enabled. This is something that has been bothering me too. I'd resorted to adding `# CONFIG_LTO is not set` to sandbox_defconfig because I couldn't work out how to stop .config being regenerated each build. But then the diff gets in the way and is difficult to manage. > Add a LTO_BUILD=n parameter to the build, so it can be disabled during > development if needed, for faster builds. If you go the build parameter route rather than config route to address this, could the flag be consistent e.g. with NO_SDL=1, which would mean NO_LTO=1? > Add some documentation about LTO while we are here. > > Signed-off-by: Simon Glass > --- > > Makefile | 18 +- > arch/arm/config.mk | 4 ++-- > arch/arm/include/asm/global_data.h | 2 +- > doc/build/gcc.rst | 17 + > scripts/Makefile.spl | 2 +- > 5 files changed, 34 insertions(+), 9 deletions(-) > > diff --git a/Makefile b/Makefile > index 06572ac07ee..c9585ddebfc 100644 > --- a/Makefile > +++ b/Makefile > @@ -434,6 +434,9 @@ KBUILD_CFLAGS += -fshort-wchar -fno-strict-aliasing > KBUILD_AFLAGS := -D__ASSEMBLY__ > KBUILD_LDFLAGS := > > +# Set this to "n" use of LTO for this build, e.g. LTO_BUILD=n > +LTO_BUILD ?= y > + > ifeq ($(cc-name),clang) > ifneq ($(CROSS_COMPILE),) > CLANG_TARGET := --target=$(notdir $(CROSS_COMPILE:%-=%)) > @@ -643,6 +646,11 @@ export CFLAGS_EFI # Compiler flags to add when building > EFI app > export CFLAGS_NON_EFI # Compiler flags to remove when building EFI app > export EFI_TARGET # binutils target if EFI is natively supported > > +export LTO_ENABLE > + > +# This is y if LTO is enabled for this build > +LTO_ENABLE=$(if $(CONFIG_LTO),$(LTO_BUILD),) > + > # If board code explicitly specified LDSCRIPT or CONFIG_SYS_LDSCRIPT, use > # that (or fail if absent). Otherwise, search for a linker script in a > # standard location. > @@ -690,16 +698,16 @@ endif > LTO_CFLAGS := > LTO_FINAL_LDFLAGS := > export LTO_CFLAGS LTO_FINAL_LDFLAGS > -ifdef CONFIG_LTO > +ifeq ($(LTO_ENABLE),y) > ifeq ($(cc-name),clang) > - LTO_CFLAGS += -flto > + LTO_CFLAGS += -DLTO_ENABLE -flto > LTO_FINAL_LDFLAGS += -flto > > AR = $(shell $(CC) > -print-prog-name=llvm-ar) > NM = $(shell $(CC) > -print-prog-name=llvm-nm) > else > NPROC := $(shell nproc 2>/dev/null || echo > 1) > - LTO_CFLAGS += -flto=$(NPROC) > + LTO_CFLAGS += -DLTO_ENABLE -flto=$(NPROC) > LTO_FINAL_LDFLAGS += -fuse-linker-plugin -flto=$(NPROC) > > # use plugin aware tools > @@ -1740,7 +1748,7 @@ ARCH_POSTLINK := $(wildcard > $(srctree)/arch/$(ARCH)/Makefile.postlink) > > # Generate linker list symbols references to force compiler to not optimize > # them away when compiling with LTO > -ifdef CONFIG_LTO > +ifeq ($(LTO_ENABLE),y) > u-boot-keep-syms-lto := keep-syms-lto.o > u-boot-keep-syms-lto_c := $(patsubst %.o,%.c,$(u-boot-keep-syms-lto)) > > @@ -1762,7 +1770,7 @@ endif > > # Rule to link u-boot > # May be overridden by arch/$(ARCH)/config.mk > -ifdef CONFIG_LTO > +ifeq ($(LTO_ENABLE),y) > quiet_cmd_u-boot__ ?= LTO $@ >cmd_u-boot__ ?= > \ > $(CC) -nostdlib -nostartfiles > \ > diff --git a/arch/arm/config.mk b/arch/arm/config.mk > index b107b1af27a..065dbec4064 100644 > --- a/arch/arm/config.mk > +++ b/arch/arm/config.mk > @@ -15,11 +15,11 @@ CFLAGS_NON_EFI := -fno-pic -ffixed-r9 -ffunction-sections > -fdata-sections \ > -fstack-protector-strong > CFLAGS_EFI := -fpic -fshort-wchar > > -ifneq ($(CONFIG_LTO)$(CONFIG_USE_PRIVATE_LIBGCC),yy) > +ifneq ($(LTO_ENABLE)$(CONFIG_USE_PRIVATE_LIBGCC),yy) > LDFLAGS_FINAL += --gc-sections > endif > > -ifndef CONFIG_LTO > +ifneq ($(LTO_ENABLE),y) > PLATFORM_RELFLAGS += -ffunction-sections -fdata-sections > endif > > diff --git a/arch/arm/include/asm/global_data.h > b/arch/arm/include/asm/global_data.h > index 085e12b5d4d..b255b195aa0 100644 > --- a/arch/arm/include/asm/global_data.h > +++ b/arch/arm/include/asm/global_data.h > @@ -98,7 +98,7 @@ struct arch_global_data { > > #include > > -#if defined(__clang__) || defined(CONFIG_LTO) > +#if defined(__clang__) || defined(LTO_ENABLE) > >
Re: [PATCH 5/6] net: add MV88E61xx DSA driver
On Wed, 30 Mar 2022 08:46:06 -0700 Tim Harvey wrote: > On Tue, Mar 29, 2022 at 4:22 PM Marek Behún wrote: > > > > On Tue, 29 Mar 2022 15:52:39 -0700 > > Tim Harvey wrote: > > > > > Add a DSA driver for the MV88E61xx compatible GbE Ethernet switches. > > > > > > Signed-off-by: Tim Harvey > > > > Marek, > > Thanks for looking at this. > > > Is this final version that should be accepted? > > This is the first submission of the new driver. > > > > > The drivers seems to support not only 61xx, but 6xxx (6096, 6250, 6352, > > ...). > > It should also support all the same devices that the non dsa driver it > was derived from (drivers/net/phy/mv88e61xx.c) but I only have a board > with 88E6176 to test with. > > It is not completely clear to me what devices are supported in the > original driver per Kconfig but from looking over the code I would say > the following appear to be supported: > mv88e6096 > mv88e6097 > mv88e6020 > mv88e6070 > mv88e6071 > mv88e6172 > mv88e6176 > mv88e6220 > mv88e6240 > mv88e6250 > mv88e6352 > > > > > Also there are some commented lines, for example > > > > > +// u16 port_stat_link_mask;/* Bitmask for port link status bits */ > > > +// u16 port_stat_dup_mask; /* Bitmask for port duplex status bits */ > > > +// u8 port_stat_speed_width;/* Width of speed status bitfield */ > > > > What is their purpose? > > > > oops... that was a mistake. I'm surprised checkpatch didn't catch > those. Those were in the non-dsa driver and not used here so will be > removed. > > > Why is mv88e61xx_dsa_xmit() no-op? > > For DSA dsa-uclass calls the switch master eth device send function > after calling the dsa_ops->xmit function so that a dsa driver can add > any header/footer if needed. The function is required but in my case I > don't care about header/footer tagging or vlan as only 1 port is > active at a time in U-Boot so I just return success. So if I make one port active, the other are completely disabled? They won't even switch? Is that how DSA uclass is supposed to work in U-Boot? I would think that it should be somehow configurable instead. Marek
[PATCH] imx8ulp: clock: Fix lcd clock algo
The div loop uses reassign and reuse parent_rate, which causes the parent rate reference to be wrong after the first loop, the resulting clock becomes incorrect for div != 1. Fixes: 829e06bf4175 ("imx8ulp: clock: Add MIPI DSI clock and DCNano clock") Signed-off-by: Loic Poulain --- arch/arm/mach-imx/imx8ulp/clock.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/arch/arm/mach-imx/imx8ulp/clock.c b/arch/arm/mach-imx/imx8ulp/clock.c index 91580b2..dbe0f78 100644 --- a/arch/arm/mach-imx/imx8ulp/clock.c +++ b/arch/arm/mach-imx/imx8ulp/clock.c @@ -381,10 +381,9 @@ void mxs_set_lcdclk(u32 base_addr, u32 freq_in_khz) debug("PLL4 rate %ukhz\n", pll4_rate); for (pfd = 12; pfd <= 35; pfd++) { - parent_rate = pll4_rate; - parent_rate = parent_rate * 18 / pfd; - for (div = 1; div <= 64; div++) { + parent_rate = pll4_rate; + parent_rate = parent_rate * 18 / pfd; parent_rate = parent_rate / div; for (pcd = 0; pcd < 8; pcd++) { -- 2.7.4
[PATCH] fdt: Add -q option to fdt addr for distro_bootcmd
From: Peter Hoyes distro_bootcmd uses this construct a few times to test $fdt_addr_r, and fall back on $fdtcontroladdr if not set/invalid: if fdt addr ${fdt_addr_r}; then ... else ... fi If the `fdt addr` test fails, it prints the following message on the console, suggesting there is an error when there is not: libfdt fdt_check_header(): FDT_ERR_BADMAGIC To remove this potentially confusing error message, this patch adds -q as a 'quiet' option for fdt addr, and uses this flag in config_distro_bootcmd.h Signed-off-by: Peter Hoyes --- cmd/fdt.c | 30 +++--- include/config_distro_bootcmd.h | 6 +++--- 2 files changed, 26 insertions(+), 10 deletions(-) diff --git a/cmd/fdt.c b/cmd/fdt.c index 2a207bf2b5..fc2fddfb3c 100644 --- a/cmd/fdt.c +++ b/cmd/fdt.c @@ -119,13 +119,27 @@ static int do_fdt(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) if (strncmp(argv[1], "ad", 2) == 0) { unsigned long addr; int control = 0; + int quiet = 0; struct fdt_header *blob; /* Set the address [and length] of the fdt */ argc -= 2; argv += 2; - if (argc && !strcmp(*argv, "-c")) { - control = 1; + while (argc > 0 && **argv == '-') { + char *arg = *argv; + + while (*++arg) { + switch (*arg) { + case 'c': + control = 1; + break; + case 'q': + quiet = 1; + break; + default: + return CMD_RET_USAGE; + } + } argc--; argv++; } @@ -145,7 +159,8 @@ static int do_fdt(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) addr = hextoul(argv[0], NULL); blob = map_sysmem(addr, 0); - if (!fdt_valid(&blob)) + if ((quiet && fdt_check_header(blob)) || + (!quiet && !fdt_valid(&blob))) return 1; if (control) gd->fdt_blob = blob; @@ -159,12 +174,13 @@ static int do_fdt(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) /* Optional new length */ len = hextoul(argv[1], NULL); if (len < fdt_totalsize(blob)) { - printf("New length %d < existing length %d, ignoring\n", - len, fdt_totalsize(blob)); + if (!quiet) + printf("New length %d < existing length %d, ignoring\n", + len, fdt_totalsize(blob)); } else { /* Open in place with a new length */ err = fdt_open_into(blob, blob, len); - if (err != 0) { + if (!quiet && err != 0) { printf("libfdt fdt_open_into(): %s\n", fdt_strerror(err)); } @@ -1055,7 +1071,7 @@ static int fdt_print(const char *pathp, char *prop, int depth) // #ifdef CONFIG_SYS_LONGHELP static char fdt_help_text[] = - "addr [-c] [] - Set the [control] fdt location to \n" + "addr [-cq] [] - Set the [control] fdt location to \n" #ifdef CONFIG_OF_LIBFDT_OVERLAY "fdt apply - Apply overlay to the DT\n" #endif diff --git a/include/config_distro_bootcmd.h b/include/config_distro_bootcmd.h index 2f90929178..c55023889c 100644 --- a/include/config_distro_bootcmd.h +++ b/include/config_distro_bootcmd.h @@ -126,7 +126,7 @@ #ifdef CONFIG_CMD_BOOTEFI_BOOTMGR #define BOOTENV_EFI_BOOTMGR \ "boot_efi_bootmgr=" \ - "if fdt addr ${fdt_addr_r}; then "\ + "if fdt addr -q ${fdt_addr_r}; then " \ "bootefi bootmgr ${fdt_addr_r};" \ "else " \ "bootefi bootmgr;"\ @@ -141,7 +141,7 @@ "boot_efi_binary="\ "load ${devtype} ${devnum}:${distro_boot
[PATCH] net: tftp: fix tftp server initialization
Some globals where not properly initialized causing timeouts as data packets where not immediately acknowledged. Signed-off-by: Arjan Minzinga Zijlstra --- net/tftp.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/net/tftp.c b/net/tftp.c index 62a9648474..9d5fe2f2d9 100644 --- a/net/tftp.c +++ b/net/tftp.c @@ -912,6 +912,8 @@ void tftp_start_server(void) tftp_block_size = TFTP_BLOCK_SIZE; tftp_cur_block = 0; tftp_our_port = WELL_KNOWN_PORT; + tftp_windowsize = 1; + tftp_next_ack = tftp_windowsize; #ifdef CONFIG_TFTP_TSIZE tftp_tsize = 0; -- 2.25.1
Re: [PATCH] IOMUX: Fix access past end of console_devices
On Wed, Mar 30, 2022 at 01:25:59PM -0400, Sean Anderson wrote: > On 3/30/22 1:13 PM, Andy Shevchenko wrote: > > On Wed, Mar 30, 2022 at 7:49 PM Sean Anderson wrote: > > > > Also I don't like to have workarounds for the broken tools. > > But if you still want to have something, what about rather this > > > > > #define for_each_console_dev(i, file, dev) \ > > > - for (i = 0, dev = console_devices[file][i]; \ > > > -i < cd_count[file];\ > > > -i++, dev = console_devices[file][i]) > > > + for (i = 0; i < cd_count[file] && \ > > > + (dev = console_devices[file][i]); i++) > > > > for (i = 0, dev = console_devices[file][0]; \ > > i < cd_count[file];\ > > i++, dev = console_devices[file][i]) > > > > ? > > > > Or if it's still complains > > > > for (i = 0, dev = cd_count[file] ? console_devices[file][0] : NULL; > > \ > > i < cd_count[file];\ > > i++, dev = console_devices[file][i]) > > > > ? > > The problem is not the first assignment but the last. Consider the case when > cd_count[file] = 1 Following that logic the first one is also problematic when cd_count[file] == 0. > i = 0, dev = console_devices[file][0]; // OK > i < cd_count[file] // 0 < 1 > // loop body > i++, dev = console_devices[file][1] // Oops, past the end > i < cd_count[file] // 1 < 1, loop exit I don't see good solution. :-( Maybe moving to dev as a loop variable and having NULL terminated arrays should fix that. For now probably your solution is a good compromise. But, please rewrite it to have all three more visible in a for-loop: for (i = 0; \ i < cd_count[file] && (dev = console_devices[file][i]);\ i++) -- With Best Regards, Andy Shevchenko
[PATCH v4 0/8] efi: capsule: Capsule Update fixes and enhancements
This series is cleaning up the usage of the image GUIDs that are used in capsule update and the EFI System Resource Table(ESRT). There are some other enhancements being made to the capsule update code to make it more robust. Firstly, an overview of the fixes being made. Currently, there are two instances of the Firmware Management Protocol(FMP), one defined for updating the FIT images, and the other for updating raw images. The FMP code defines two GUID values, one for all FIT images, and one for raw images. Depending on the FMP instance used on a platform, the platform needs to use the corresponding image GUID value for all images on the platform, and also across platforms. A few issues are being fixed through the patch series. One, that an image for a different platform can be flashed on another platform if both the platforms are using the same FMP instance. So, for e.g. a capsule generated for the Socionext DeveloperBox platform can be flashed on the ZynqMP platform, since both the platforms use the CONFIG_EFI_CAPSULE_FIRMWARE_RAW instance of the FMP. This can be corrected if each firmware image that can be updated through the capsule update mechanism has it's own unique image GUID. The second issue that this patch series fixes is the value of FwClass in the ESRT. With the current logic, all firmware image entries in the ESRT display the same GUID value -- either the FIT GUID or the raw GUID. This is not in compliance with the UEFI specification, as the specification requires all entries to have unique GUID values. The third issue being fixed is the population of the EFI_FIRMWARE_IMAGE_DESCRIPTOR array. The current code uses the dfu framework for populating the image descriptor array. However, there might be other images that are not to be updated through the capsule update mechanism also registered with the dfu framework. As a result of this, the ESRT will show up entries of images that are not to be targeted by the capsule update mechanism. These issues are being fixed by defining a structure, efi_fw_images. A platform can then define image related information like the image GUID and image name. Every platform that uses capsule update mechanism needs to define fw_images array. This array will then be used to populate the image descriptor array, and also in determining if a particular capsule's payload can be used for updating an image on the platform. The other part of the patches are some enhancements being made to the capsule update code to make it more robust. The first enhancement being made is to have a check for the image index being passed through the capsule header. The capsule update code uses the image index value as the dfu alt number, which points to the partition to which the update must be made. The platform is supposed to define the image index value for the updatable firmare images as part of the fw_images array. This value must correspond to the dfu alt num for the corresponding image, and can be obtained by checking the output of the 'dfu list' u-boot command. At the time of update, the image index being passed through the capsule is checked against the image index value obtained from the platform. The second enhancement made is the retrieval of the dfu_alt_info variable from the set_dfu_alt_info function defined in the board file. The dfu framework checks for the existence of this function, and if the function is not defined, gets the value from the environment. This can cause in an incorrect update if the environment variable value is incorrect. By mandating all the platforms which enable the capsule update feature to define set_dfu_alt_info function, the variable is then obtained from the board file rather than the environment. The first patch adds the structure efi_fw_images and defines an array fw_images on all platforms which enable capsule update feature The second patch populates the image descriptor array in the GetImageInfo function with the values from the fw_images array The third patch adds a check for the image index value from the capsule header against the value obtained from the fw_images array for the corresponding image The fourth patch defines the function set_dfu_alt_info for all the platforms which enable capsule update feature and selects SET_DFU_ALT_INFO config symbol for all platforms that enable capsule update feature. The fifth patch splits the capsule update test script into two, one for FMP for raw images, and one for FMP for FIT images. The test for FIT images is being enabled on the sandbox_flattree variant. The sixth patch removes the now unused FIT and raw image GUID values from the FMP module. The seventh patch removes the --raw and --fit command line parameters in the mkeficapsule utility. The eighth patch makes corresponding changes in the capsule update related documentation. Changes since V3: - * Do not remove the existing dfu_alt_info definitions made by platforms in the config files, as discussed with Ma
[PATCH v4 3/8] capsule: Put a check for image index before the update
The current capsule update code compares the image GUID value in the capsule header with the image GUID value obtained from the GetImageInfo function of the Firmware Management Protocol(FMP). This comparison is done to ascertain if the FMP's SetImage function can be called for the update. Make this checking more robust by comparing the image_index value passed through the capsule with that returned by the FMP's GetImageInfo function. This protects against the scenario of the firmware being updated in a wrong partition/location on the storage device if an incorrect value has been passed through the capsule, since the image_index is used to determine the location of the update on the storage device. Signed-off-by: Sughosh Ganu Reviewed-by: Masami Hiramatsu --- Changes since V3: None lib/efi_loader/efi_capsule.c | 8 +--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/efi_loader/efi_capsule.c b/lib/efi_loader/efi_capsule.c index f00440163d..f03f4c9044 100644 --- a/lib/efi_loader/efi_capsule.c +++ b/lib/efi_loader/efi_capsule.c @@ -128,6 +128,7 @@ void set_capsule_result(int index, struct efi_capsule_header *capsule, /** * efi_fmp_find - search for Firmware Management Protocol drivers * @image_type:Image type guid + * @image_index: Image Index * @instance: Instance number * @handles: Handles of FMP drivers * @no_handles:Number of handles @@ -141,8 +142,8 @@ void set_capsule_result(int index, struct efi_capsule_header *capsule, * * NULL - on failure */ static struct efi_firmware_management_protocol * -efi_fmp_find(efi_guid_t *image_type, u64 instance, efi_handle_t *handles, -efi_uintn_t no_handles) +efi_fmp_find(efi_guid_t *image_type, u8 image_index, u64 instance, +efi_handle_t *handles, efi_uintn_t no_handles) { efi_handle_t *handle; struct efi_firmware_management_protocol *fmp; @@ -203,6 +204,7 @@ efi_fmp_find(efi_guid_t *image_type, u64 instance, efi_handle_t *handles, 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) && (!instance || !desc->hardware_instance || desc->hardware_instance == instance)) @@ -449,8 +451,8 @@ static efi_status_t efi_capsule_update_firmware( } /* find a device for update firmware */ - /* TODO: should we pass index as well, or nothing but type? */ fmp = efi_fmp_find(&image->update_image_type_id, + image->update_image_index, image->update_hardware_instance, handles, no_handles); if (!fmp) { -- 2.25.1
[PATCH v4 2/8] capsule: FMP: Populate the image descriptor array from platform data
Currently, the image descriptor array that has been passed to the GetImageInfo function of the Firmware Management Protocol(FMP) gets populated through the data stored with the dfu framework. The dfu data is not restricted to contain information only of the images updatable through the capsule update mechanism, but it also contains information on other images. The image descriptor array is also parsed by the ESRT generation code, and thus the ESRT table contains entries for other images that are not being handled by the FMP for the capsule updates. The other issue fixed is assignment of a separate GUID for all images in the image descriptor array. The UEFI specification mandates that all entries in the ESRT table should have a unique GUID value as part of the FwClass member of the EFI_SYSTEM_RESOURCE_ENTRY. Currently, all images are assigned a single GUID value, either an FIT GUID or a raw image GUID. This is fixed by obtaining the GUID values from the efi_fw_images array defined per platform. Signed-off-by: Sughosh Ganu Reviewed-by: Masami Hiramatsu --- Changes since V3: None include/efi_loader.h | 3 ++ lib/efi_loader/efi_firmware.c | 91 +++ 2 files changed, 30 insertions(+), 64 deletions(-) diff --git a/include/efi_loader.h b/include/efi_loader.h index 284d64547b..9704397bd7 100644 --- a/include/efi_loader.h +++ b/include/efi_loader.h @@ -997,6 +997,9 @@ struct efi_fw_images { u8 image_index; }; +extern struct efi_fw_images fw_images[]; +extern u8 num_image_type_guids; + /** * Install the ESRT system table. * diff --git a/lib/efi_loader/efi_firmware.c b/lib/efi_loader/efi_firmware.c index a5ff32f121..169f3a29bb 100644 --- a/lib/efi_loader/efi_firmware.c +++ b/lib/efi_loader/efi_firmware.c @@ -97,91 +97,60 @@ efi_status_t EFIAPI efi_firmware_set_package_info_unsupported( } /** - * efi_get_dfu_info - return information about the current firmware image + * efi_fill_image_desc_array - populate image descriptor array * @this: Protocol instance * @image_info_size: Size of @image_info * @image_info:Image information * @descriptor_version:Pointer to version number - * @descriptor_count: Pointer to number of descriptors + * @descriptor_count: Image count * @descriptor_size: Pointer to descriptor size - * package_version:Package version - * package_version_name: Package version's name - * image_type: Image type GUID + * @package_version: Package version + * @package_version_name: Package version's name * * Return information bout the current firmware image in @image_info. * @image_info will consist of a number of descriptors. - * Each descriptor will be created based on "dfu_alt_info" variable. + * Each descriptor will be created based on "efi_fw_images" variable. * * Return status code */ -static efi_status_t efi_get_dfu_info( +static efi_status_t efi_fill_image_desc_array( efi_uintn_t *image_info_size, struct efi_firmware_image_descriptor *image_info, u32 *descriptor_version, u8 *descriptor_count, efi_uintn_t *descriptor_size, u32 *package_version, - u16 **package_version_name, - const efi_guid_t *image_type) + u16 **package_version_name) { - struct dfu_entity *dfu; size_t names_len, total_size; - int dfu_num, i; - u16 *name, *next; - int ret; - - ret = dfu_init_env_entities(NULL, NULL); - if (ret) - return EFI_SUCCESS; + struct efi_fw_images *fw_array; + u8 image_count; + int i; + fw_array = &fw_images[0]; + *descriptor_count = image_count = num_image_type_guids; names_len = 0; - dfu_num = 0; - list_for_each_entry(dfu, &dfu_list, list) { - names_len += (utf8_utf16_strlen(dfu->name) + 1) * 2; - dfu_num++; - } - if (!dfu_num) { - log_warning("No entities in dfu_alt_info\n"); - *image_info_size = 0; - dfu_free_entities(); - return EFI_SUCCESS; - } + total_size = sizeof(*image_info) * image_count; - total_size = sizeof(*image_info) * dfu_num + names_len; - /* -* we will assume that sizeof(*image_info) * dfu_name -* is, at least, a multiple of 2. So the start address for -* image_id_name would be aligned with 2 bytes. -*/ if (*image_info_size < total_size) { *image_info_size = total_size; - dfu_free_entities(); return EFI_BUFFER_TOO_SMALL; } *image_info_size = total_size; *descriptor_version = EFI_FIRMWARE_IMAGE_DESCRIPTOR_VERSION; - *descriptor_count = dfu_num; *descriptor_size = sizeof(*image_info); *package_version = 0x; /*
[PATCH v4 1/8] capsule: Add Image GUIDs and image index for platforms using capsule updates
Currently, all platforms that enable capsule updates do so using either EFI_FIRMWARE_IMAGE_TYPE_UBOOT_RAW_GUID or EFI_FIRMWARE_IMAGE_TYPE_UBOOT_FIT_GUID. This is based on the Firmware Management Protocol(FMP) instance used on the platform. However, this means that all platforms that enable a particular FMP instance have the same GUID value for all the updatable images, either the FIT image GUID or the raw image GUID, and that an image for some platform can be updated on any other platform which uses the same FMP instance. Another issue with this implementation is that the ESRT table shows the same GUID value for all images on the platform and also across platforms, which is not in compliance with the UEFI specification. Fix this by defining image GUID values and firmware names for individual images per platform. The GetImageInfo FMP hook would then populate these values in the image descriptor array. Also add the image index value associated with a particular image. This is the value that should match with the image_index value that is part of the capsule header. The capsule update code will check if the two values match, and the update will only proceed on a match. Signed-off-by: Sughosh Ganu Reviewed-by: Masami Hiramatsu Acked-by: Michal Simek --- Changes since V3: None .../imx8mp_rsb3720a1/imx8mp_rsb3720a1.c | 20 + .../imx8mm-cl-iot-gate/imx8mm-cl-iot-gate.c | 19 + board/emulation/qemu-arm/qemu-arm.c | 20 + board/kontron/pitx_imx8m/pitx_imx8m.c | 16 ++- board/kontron/sl-mx8mm/sl-mx8mm.c | 15 ++ board/kontron/sl28/sl28.c | 15 ++ board/sandbox/sandbox.c | 28 +++ board/socionext/developerbox/developerbox.c | 26 + board/xilinx/common/board.c | 24 include/configs/imx8mm-cl-iot-gate.h | 10 +++ include/configs/imx8mp_rsb3720.h | 10 +++ include/configs/kontron-sl-mx8mm.h| 6 include/configs/kontron_pitx_imx8m.h | 6 include/configs/kontron_sl28.h| 6 include/configs/qemu-arm.h| 10 +++ include/configs/sandbox.h | 14 ++ include/configs/synquacer.h | 14 ++ include/configs/xilinx_versal.h | 6 include/configs/xilinx_zynqmp.h | 10 +++ include/configs/zynq-common.h | 10 +++ include/efi_loader.h | 18 21 files changed, 302 insertions(+), 1 deletion(-) diff --git a/board/advantech/imx8mp_rsb3720a1/imx8mp_rsb3720a1.c b/board/advantech/imx8mp_rsb3720a1/imx8mp_rsb3720a1.c index 16566092bd..1c953ba195 100644 --- a/board/advantech/imx8mp_rsb3720a1/imx8mp_rsb3720a1.c +++ b/board/advantech/imx8mp_rsb3720a1/imx8mp_rsb3720a1.c @@ -6,6 +6,8 @@ #include #include +#include +#include #include #include #include @@ -21,6 +23,7 @@ #include #include #include +#include #include DECLARE_GLOBAL_DATA_PTR; @@ -44,6 +47,23 @@ static void setup_gpmi_nand(void) } #endif +#if CONFIG_IS_ENABLED(EFI_HAVE_CAPSULE_SUPPORT) +struct efi_fw_images fw_images[] = { + { +#if defined(CONFIG_TARGET_IMX8MP_RSB3720A1_4G) + .image_type_id = IMX8MP_RSB3720A1_4G_FIT_IMAGE_GUID, +#elif defined(CONFIG_TARGET_IMX8MP_RSB3720A1_6G) + .image_type_id = IMX8MP_RSB3720A1_6G_FIT_IMAGE_GUID, +#endif + .fw_name = u"IMX8MP-RSB3720-FIT", + .image_index = 1 + }, +}; + +u8 num_image_type_guids = ARRAY_SIZE(fw_images); +#endif /* EFI_HAVE_CAPSULE_SUPPORT */ + + int board_early_init_f(void) { struct wdog_regs *wdog = (struct wdog_regs *)WDOG1_BASE_ADDR; diff --git a/board/compulab/imx8mm-cl-iot-gate/imx8mm-cl-iot-gate.c b/board/compulab/imx8mm-cl-iot-gate/imx8mm-cl-iot-gate.c index 7e2d88f449..f5b89a5ddc 100644 --- a/board/compulab/imx8mm-cl-iot-gate/imx8mm-cl-iot-gate.c +++ b/board/compulab/imx8mm-cl-iot-gate/imx8mm-cl-iot-gate.c @@ -5,6 +5,8 @@ */ #include +#include +#include #include #include #include @@ -21,11 +23,28 @@ #include #include #include +#include #include "ddr/ddr.h" DECLARE_GLOBAL_DATA_PTR; +#if CONFIG_IS_ENABLED(EFI_HAVE_CAPSULE_SUPPORT) +struct efi_fw_images fw_images[] = { + { +#if defined(CONFIG_TARGET_IMX8MM_CL_IOT_GATE) + .image_type_id = IMX8MM_CL_IOT_GATE_FIT_IMAGE_GUID, +#elif defined(CONFIG_TARGET_IMX8MM_CL_IOT_GATE_OPTEE) + .image_type_id = IMX8MM_CL_IOT_GATE_OPTEE_FIT_IMAGE_GUID, +#endif + .fw_name = u"IMX8MM-CL-IOT-GATE-FIT", + .image_index = 1 + }, +}; + +u8 num_image_type_guids = ARRAY_SIZE(fw_images); +#endif /* EFI_HAVE_CAPSULE_SUPPORT */ + int board_phys_sdram_size(phys_size_t *size) { struct lpddr4_tcm_desc *lpddr4_tcm_desc = diff --git a/board/emu
[PATCH v4 6/8] FMP: Remove GUIDs for FIT and raw images
The capsule update code has been modified for getting the image GUID values from the platform code. With this, each image now has a unique GUID value. With this change, there is no longer a need for defining GUIDs for FIT and raw images. Remove these GUID values. Signed-off-by: Sughosh Ganu --- Changes since V3: None include/efi_api.h | 8 lib/efi_loader/efi_firmware.c | 4 2 files changed, 12 deletions(-) diff --git a/include/efi_api.h b/include/efi_api.h index 982c200172..c7f7873b5d 100644 --- a/include/efi_api.h +++ b/include/efi_api.h @@ -1967,14 +1967,6 @@ struct efi_signature_list { EFI_GUID(0x86c77a67, 0x0b97, 0x4633, 0xa1, 0x87, \ 0x49, 0x10, 0x4d, 0x06, 0x85, 0xc7) -#define EFI_FIRMWARE_IMAGE_TYPE_UBOOT_FIT_GUID \ - EFI_GUID(0xae13ff2d, 0x9ad4, 0x4e25, 0x9a, 0xc8, \ -0x6d, 0x80, 0xb3, 0xb2, 0x21, 0x47) - -#define EFI_FIRMWARE_IMAGE_TYPE_UBOOT_RAW_GUID \ - EFI_GUID(0xe2bb9c06, 0x70e9, 0x4b14, 0x97, 0xa3, \ -0x5a, 0x79, 0x13, 0x17, 0x6e, 0x3f) - #define IMAGE_ATTRIBUTE_IMAGE_UPDATABLE0x0001 #define IMAGE_ATTRIBUTE_RESET_REQUIRED 0x0002 #define IMAGE_ATTRIBUTE_AUTHENTICATION_REQUIRED0x0004 diff --git a/lib/efi_loader/efi_firmware.c b/lib/efi_loader/efi_firmware.c index 169f3a29bb..7734d9f353 100644 --- a/lib/efi_loader/efi_firmware.c +++ b/lib/efi_loader/efi_firmware.c @@ -185,8 +185,6 @@ static efi_status_t efi_fill_image_desc_array( * - versioning of firmware image * - package information */ -const efi_guid_t efi_firmware_image_type_uboot_fit = - EFI_FIRMWARE_IMAGE_TYPE_UBOOT_FIT_GUID; /** * efi_firmware_fit_get_image_info - return information about the current @@ -293,8 +291,6 @@ const struct efi_firmware_management_protocol efi_fmp_fit = { * This FIRMWARE_MANAGEMENT_PROTOCOL driver provides a firmware update * method with raw data. */ -const efi_guid_t efi_firmware_image_type_uboot_raw = - EFI_FIRMWARE_IMAGE_TYPE_UBOOT_RAW_GUID; /** * efi_firmware_raw_get_image_info - return information about the current -- 2.25.1
[PATCH v4 4/8] board: Define set_dfu_alt_info() for boards with UEFI capsule update enabled
Currently, there are a bunch of boards which enable the UEFI capsule update feature. The actual update of the firmware images is done through the dfu framework which uses the dfu_alt_info environment variable for getting information on the update, like device, partition number/address etc. Currently, these boards define the dfu_alt_info variable in the board config header, as an environment variable. With this, the variable can be modified from the u-boot command line and this can cause an incorrect update. To prevent this from happening, define the set_dfu_alt_info function in the board file, and select SET_DFU_ALT_INFO for all platforms which enable the capsule update feature. With the function defined, the dfu framework populates the dfu_alt_info variable through the board file, instead of fetching the variable from the environment, thus making the update more robust. Signed-off-by: Sughosh Ganu --- Changes since V3: * Do not remove the existing dfu_alt_info definitions made by platforms in the config files, as discussed with Masami. * Squash the selection of the SET_DFU_ALT_INFO config symbol for capsule update feature as part of this patch. .../imx8mp_rsb3720a1/imx8mp_rsb3720a1.c | 24 + .../imx8mm-cl-iot-gate/imx8mm-cl-iot-gate.c | 24 + board/emulation/common/qemu_dfu.c | 6 ++--- board/kontron/pitx_imx8m/pitx_imx8m.c | 24 + board/kontron/sl-mx8mm/sl-mx8mm.c | 24 + board/kontron/sl28/sl28.c | 25 ++ board/sandbox/sandbox.c | 26 +++ board/socionext/developerbox/developerbox.c | 26 +++ board/xilinx/zynq/board.c | 5 ++-- board/xilinx/zynqmp/zynqmp.c | 5 ++-- lib/efi_loader/Kconfig| 2 ++ 11 files changed, 184 insertions(+), 7 deletions(-) diff --git a/board/advantech/imx8mp_rsb3720a1/imx8mp_rsb3720a1.c b/board/advantech/imx8mp_rsb3720a1/imx8mp_rsb3720a1.c index 1c953ba195..41154ca9f3 100644 --- a/board/advantech/imx8mp_rsb3720a1/imx8mp_rsb3720a1.c +++ b/board/advantech/imx8mp_rsb3720a1/imx8mp_rsb3720a1.c @@ -5,10 +5,12 @@ */ #include +#include #include #include #include #include +#include #include #include #include @@ -24,6 +26,7 @@ #include #include #include +#include #include DECLARE_GLOBAL_DATA_PTR; @@ -231,3 +234,24 @@ unsigned long spl_mmc_get_uboot_raw_sector(struct mmc *mmc) } } #endif /* CONFIG_SPL_MMC_SUPPORT */ + +#if defined(CONFIG_SET_DFU_ALT_INFO) + +#define DFU_ALT_BUF_LENSZ_1K + +void set_dfu_alt_info(char *interface, char *devstr) +{ + ALLOC_CACHE_ALIGN_BUFFER(char, buf, DFU_ALT_BUF_LEN); + + if (!CONFIG_IS_ENABLED(EFI_HAVE_CAPSULE_SUPPORT) && + env_get("dfu_alt_info")) + return; + + memset(buf, 0, DFU_ALT_BUF_LEN); + + snprintf(buf, DFU_ALT_BUF_LEN, +"mmc 2=flash-bin raw 0 0x1B00 mmcpart 1"); + + env_set("dfu_alt_info", buf); +} +#endif /* CONFIG_SET_DFU_ALT_INFO */ diff --git a/board/compulab/imx8mm-cl-iot-gate/imx8mm-cl-iot-gate.c b/board/compulab/imx8mm-cl-iot-gate/imx8mm-cl-iot-gate.c index f5b89a5ddc..1880dd9c55 100644 --- a/board/compulab/imx8mm-cl-iot-gate/imx8mm-cl-iot-gate.c +++ b/board/compulab/imx8mm-cl-iot-gate/imx8mm-cl-iot-gate.c @@ -5,6 +5,7 @@ */ #include +#include #include #include #include @@ -12,6 +13,7 @@ #include #include #include +#include #include #include @@ -24,6 +26,7 @@ #include #include #include +#include #include "ddr/ddr.h" @@ -446,3 +449,24 @@ int board_late_init(void) return 0; } + +#if defined(CONFIG_SET_DFU_ALT_INFO) + +#define DFU_ALT_BUF_LENSZ_1K + +void set_dfu_alt_info(char *interface, char *devstr) +{ + ALLOC_CACHE_ALIGN_BUFFER(char, buf, DFU_ALT_BUF_LEN); + + if (!CONFIG_IS_ENABLED(EFI_HAVE_CAPSULE_SUPPORT) && + env_get("dfu_alt_info")) + return; + + memset(buf, 0, DFU_ALT_BUF_LEN); + + snprintf(buf, DFU_ALT_BUF_LEN, +"mmc 2=flash-bin raw 0x42 0x1D00 mmcpart 1"); + + env_set("dfu_alt_info", buf); +} +#endif /* CONFIG_SET_DFU_ALT_INFO */ diff --git a/board/emulation/common/qemu_dfu.c b/board/emulation/common/qemu_dfu.c index 62234a7647..85dff4373b 100644 --- a/board/emulation/common/qemu_dfu.c +++ b/board/emulation/common/qemu_dfu.c @@ -44,10 +44,11 @@ void set_dfu_alt_info(char *interface, char *devstr) ALLOC_CACHE_ALIGN_BUFFER(char, buf, DFU_ALT_BUF_LEN); - if (env_get("dfu_alt_info")) + if (!CONFIG_IS_ENABLED(EFI_HAVE_CAPSULE_SUPPORT) && + env_get("dfu_alt_info")) return; - memset(buf, 0, sizeof(buf)); + memset(buf, 0, DFU_ALT_BUF_LEN); /* * Currently dfu_alt_info is needed on Qemu ARM64 for @@ -64,5 +65,4 @@ void set_dfu_alt_
[PATCH v4 7/8] mkeficapsule: Remove raw and FIT GUID types
While building a capsule, the GUID value of that specific image is to be passed through the --guid command option to the mkeficapsule tool. This renders the EFI_FIRMWARE_IMAGE_TYPE_UBOOT_FIT_GUID and EFI_FIRMWARE_IMAGE_TYPE_UBOOT_RAW_GUID values superfluous. Remove the --raw and --fit command line options as well. Signed-off-by: Sughosh Ganu --- Changes since V3: None tools/eficapsule.h | 8 tools/mkeficapsule.c | 26 +- 2 files changed, 1 insertion(+), 33 deletions(-) diff --git a/tools/eficapsule.h b/tools/eficapsule.h index 69c9c58c2f..d63b831443 100644 --- a/tools/eficapsule.h +++ b/tools/eficapsule.h @@ -37,14 +37,6 @@ typedef struct { EFI_GUID(0x6dcbd5ed, 0xe82d, 0x4c44, 0xbd, 0xa1, \ 0x71, 0x94, 0x19, 0x9a, 0xd9, 0x2a) -#define EFI_FIRMWARE_IMAGE_TYPE_UBOOT_FIT_GUID \ - EFI_GUID(0xae13ff2d, 0x9ad4, 0x4e25, 0x9a, 0xc8, \ -0x6d, 0x80, 0xb3, 0xb2, 0x21, 0x47) - -#define EFI_FIRMWARE_IMAGE_TYPE_UBOOT_RAW_GUID \ - EFI_GUID(0xe2bb9c06, 0x70e9, 0x4b14, 0x97, 0xa3, \ -0x5a, 0x79, 0x13, 0x17, 0x6e, 0x3f) - #define EFI_CERT_TYPE_PKCS7_GUID \ EFI_GUID(0x4aafd29d, 0x68df, 0x49ee, 0x8a, 0xa9, \ 0x34, 0x7d, 0x37, 0x56, 0x65, 0xa7) diff --git a/tools/mkeficapsule.c b/tools/mkeficapsule.c index c118335b93..5f74d23b9e 100644 --- a/tools/mkeficapsule.c +++ b/tools/mkeficapsule.c @@ -27,17 +27,11 @@ static const char *tool_name = "mkeficapsule"; efi_guid_t efi_guid_fm_capsule = EFI_FIRMWARE_MANAGEMENT_CAPSULE_ID_GUID; -efi_guid_t efi_guid_image_type_uboot_fit = - EFI_FIRMWARE_IMAGE_TYPE_UBOOT_FIT_GUID; -efi_guid_t efi_guid_image_type_uboot_raw = - EFI_FIRMWARE_IMAGE_TYPE_UBOOT_RAW_GUID; efi_guid_t efi_guid_cert_type_pkcs7 = EFI_CERT_TYPE_PKCS7_GUID; -static const char *opts_short = "frg:i:I:v:p:c:m:dh"; +static const char *opts_short = "g:i:I:v:p:c:m:dh"; static struct option options[] = { - {"fit", no_argument, NULL, 'f'}, - {"raw", no_argument, NULL, 'r'}, {"guid", required_argument, NULL, 'g'}, {"index", required_argument, NULL, 'i'}, {"instance", required_argument, NULL, 'I'}, @@ -54,8 +48,6 @@ static void print_usage(void) fprintf(stderr, "Usage: %s [options] \n" "Options:\n" - "\t-f, --fit FIT image type\n" - "\t-r, --raw raw image type\n" "\t-g, --guid guid for image blob type\n" "\t-i, --index update image index\n" "\t-I, --instanceupdate hardware instance\n" @@ -606,22 +598,6 @@ int main(int argc, char **argv) break; switch (c) { - case 'f': - if (guid) { - fprintf(stderr, - "Image type already specified\n"); - exit(EXIT_FAILURE); - } - guid = &efi_guid_image_type_uboot_fit; - break; - case 'r': - if (guid) { - fprintf(stderr, - "Image type already specified\n"); - exit(EXIT_FAILURE); - } - guid = &efi_guid_image_type_uboot_raw; - break; case 'g': if (guid) { fprintf(stderr, -- 2.25.1
[PATCH v4 5/8] test: capsule: Modify the capsule tests to use GUID values for sandbox
The current UEFI capsule updation code uses two GUID values, one for FIT images, and one for raw images across platforms. This logic is being changed to have GUID values per image, per platform. Change the tests for the capsule update code to reflect this change. The GUID values now used are the ones specific to the sandbox platform -- one for the u-boot image, and another for the u-boot environment image. The UEFI specification does not allow installation of multiple Firmware Management Protocols(FMP) at the same time. Install the FMP instance for raw images on the sandbox variant for testing the capsule update code. Install the FMP instance for the FIT images on the sandbox64 and sandbox_flattree variant for testing capsule update for FIT images. This is being done by splitting the capsule update script for FIT and raw images. Signed-off-by: Sughosh Ganu --- Changes since V3: None configs/sandbox64_defconfig | 1 - configs/sandbox_defconfig | 1 - configs/sandbox_flattree_defconfig| 5 + test/py/tests/test_efi_capsule/conftest.py| 21 +- .../test_capsule_firmware_fit.py | 186 ++ ...rmware.py => test_capsule_firmware_raw.py} | 159 +-- 6 files changed, 258 insertions(+), 115 deletions(-) create mode 100644 test/py/tests/test_efi_capsule/test_capsule_firmware_fit.py rename test/py/tests/test_efi_capsule/{test_capsule_firmware.py => test_capsule_firmware_raw.py} (75%) diff --git a/configs/sandbox64_defconfig b/configs/sandbox64_defconfig index 7c157a23d0..1a0142795a 100644 --- a/configs/sandbox64_defconfig +++ b/configs/sandbox64_defconfig @@ -247,7 +247,6 @@ CONFIG_ERRNO_STR=y CONFIG_EFI_RUNTIME_UPDATE_CAPSULE=y CONFIG_EFI_CAPSULE_ON_DISK=y CONFIG_EFI_CAPSULE_FIRMWARE_FIT=y -CONFIG_EFI_CAPSULE_FIRMWARE_RAW=y CONFIG_EFI_SECURE_BOOT=y CONFIG_TEST_FDTDEC=y CONFIG_UNIT_TEST=y diff --git a/configs/sandbox_defconfig b/configs/sandbox_defconfig index ab0e2defee..de2526df09 100644 --- a/configs/sandbox_defconfig +++ b/configs/sandbox_defconfig @@ -318,7 +318,6 @@ CONFIG_LZ4=y CONFIG_ERRNO_STR=y CONFIG_EFI_RUNTIME_UPDATE_CAPSULE=y CONFIG_EFI_CAPSULE_ON_DISK=y -CONFIG_EFI_CAPSULE_FIRMWARE_FIT=y CONFIG_EFI_CAPSULE_FIRMWARE_RAW=y CONFIG_EFI_SECURE_BOOT=y CONFIG_TEST_FDTDEC=y diff --git a/configs/sandbox_flattree_defconfig b/configs/sandbox_flattree_defconfig index 217b0647bb..bbcf435ac6 100644 --- a/configs/sandbox_flattree_defconfig +++ b/configs/sandbox_flattree_defconfig @@ -29,6 +29,7 @@ CONFIG_CMD_BOOTEFI_HELLO=y CONFIG_CMD_ASKENV=y CONFIG_CMD_GREPENV=y CONFIG_CMD_ERASEENV=y +CONFIG_CMD_NVEDIT_EFI=y CONFIG_CMD_NVEDIT_INFO=y CONFIG_CMD_NVEDIT_LOAD=y CONFIG_CMD_NVEDIT_SELECT=y @@ -210,3 +211,7 @@ CONFIG_HEXDUMP=y CONFIG_UNIT_TEST=y CONFIG_UT_TIME=y CONFIG_UT_DM=y +CONFIG_EFI_RUNTIME_UPDATE_CAPSULE=y +CONFIG_EFI_CAPSULE_ON_DISK=y +CONFIG_EFI_CAPSULE_FIRMWARE_FIT=y +CONFIG_DFU_SF=y diff --git a/test/py/tests/test_efi_capsule/conftest.py b/test/py/tests/test_efi_capsule/conftest.py index 9076087a12..d757415c88 100644 --- a/test/py/tests/test_efi_capsule/conftest.py +++ b/test/py/tests/test_efi_capsule/conftest.py @@ -72,7 +72,7 @@ def efi_capsule_data(request, u_boot_config): # Create capsule files # two regions: one for u-boot.bin and the other for u-boot.env -check_call('cd %s; echo -n u-boot:Old > u-boot.bin.old; echo -n u-boot:New > u-boot.bin.new; echo -n u-boot-env:Old -> u-boot.env.old; echo -n u-boot-env:New > u-boot.env.new' % data_dir, +check_call('cd %s; echo -n u-boot:Old > u-boot.bin.old; echo -n u-boot:New > u-boot.bin.new; echo -n u-boot-env:Old > u-boot.env.old; echo -n u-boot-env:New > u-boot.env.new' % data_dir, shell=True) check_call('sed -e \"s?BINFILE1?u-boot.bin.new?\" -e \"s?BINFILE2?u-boot.env.new?\" %s/test/py/tests/test_efi_capsule/uboot_bin_env.its > %s/uboot_bin_env.its' % (u_boot_config.source_dir, data_dir), @@ -80,21 +80,29 @@ def efi_capsule_data(request, u_boot_config): check_call('cd %s; %s/tools/mkimage -f uboot_bin_env.its uboot_bin_env.itb' % (data_dir, u_boot_config.build_dir), shell=True) -check_call('cd %s; %s/tools/mkeficapsule --index 1 --fit uboot_bin_env.itb Test01' % +check_call('cd %s; %s/tools/mkeficapsule --index 1 --guid 09D7CF52-0720-4710-91D1-08469B7FE9C8 u-boot.bin.new Test01' % (data_dir, u_boot_config.build_dir), shell=True) -check_call('cd %s; %s/tools/mkeficapsule --index 1 --raw u-boot.bin.new Test02' % +check_call('cd %s; %s/tools/mkeficapsule --index 2 --guid 5A7021F5-FEF2-48B4-AABA-832E777418C0 u-boot.env.new Test02' % (data_dir, u_boot_config.build_dir), shell=True) -check_call('cd %s; %s/tools/mkeficapsule --index 1 --guid E2BB9C06-70E9-4B14-97A3-5A7913176E3F u-b
[PATCH v4 8/8] doc: uefi: Update the capsule update related documentation
Update the capsule update functionality related documentation to refect the additional definitions that need to be made per platform for supporting the capsule update feature. Signed-off-by: Sughosh Ganu --- Changes since V3: * Rephrase the commit message to indicate that the doc changes are not just limited to adding the GUID values, but other info as well. * Elaborate with an example on the relation between the dfu alt number and the image index doc/develop/uefi/uefi.rst | 24 ++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/doc/develop/uefi/uefi.rst b/doc/develop/uefi/uefi.rst index fe337c88bd..d886635cc3 100644 --- a/doc/develop/uefi/uefi.rst +++ b/doc/develop/uefi/uefi.rst @@ -312,8 +312,8 @@ Run the following command .. code-block:: console $ mkeficapsule \ - --index 1 --instance 0 \ - [--fit | --raw ] \ + --index --instance 0 \ + --guid \ Performing the update @@ -333,6 +333,26 @@ won't be taken over across the reboot. If this is the case, you can skip this feature check with the Kconfig option (CONFIG_EFI_IGNORE_OSINDICATIONS) set. +A few things need to be defined in the board file for performing the +capsule upadte. The first is defining the function set_dfu_alt_info in +the board file. This function sets the environment variable +dfu_alt_info. Instead of taking the variable from the environment, the +capsule update feature requires that the variable be set through the +board function, since that is more robust. Secondly, define GUID +values and image index of the images that are to be updated through +the capsule update feature in the board file. Both the values are to +be defined as part of the fw_images array. These GUID values would be +used by the Firmware Management Protocol(FMP) to populate the image +descriptor array and also displayed as part of the ESRT table. The +image index values defined in the array should be one greater than the +dfu alt number that corresponds to the firmware image. So, if the dfu +alt number for an image is 2, the value of image index in the +fw_images array for that image should be 3. The dfu alt number can be +obtained by running the following command:: + +dfu list + + Finally, the capsule update can be initiated by rebooting the board. Enabling Capsule Authentication -- 2.25.1
Re: [PATCH] board: gw_ventana: gsc: fix GSC read/write functions
On Thu, Mar 24, 2022 at 08:32:00AM -0700, Tim Harvey wrote: > commit 7c84319af9c7 ("dm: gpio: Correct use of -ENODEV in drivers") > changed the return code for an I2C NAK from -ENODEV to -EREMOTEIO. > > Update the gsc_i2c_read and gsc_i2c_write functions for this change > to properly retry the transaction on a NAK meaning the GSC is busy. > > Fixes: 7c84319af9c7 ("dm: gpio: Correct use of -ENODEV in drivers") > Signed-off-by: Tim Harvey > Reviewed-by: Fabio Estevam Applied to u-boot/master, thanks! -- Tom signature.asc Description: PGP signature
Re: [PATCH v2] board: gateworks: venice: determine dram size at runtime
On Wed, Mar 30, 2022 at 01:39:02PM -0700, Tim Harvey wrote: > The SPL does not update the memory node with the dram size from EEPROM > but instead we can use get_ram_size which does a simple memory test > to determine the available RAM. Update PHYS_SDRAM_SIZE to 4GiB as that > is the max used on the Venice boards. > > Signed-off-by: Tim Harvey > Reviewed-by: Fabio Estevam Applied to u-boot/master, thanks! -- Tom signature.asc Description: PGP signature
Re: [PATCH v1 1/1] Revert "x86: Move FACP table into separate functions"
On Wed, Mar 30, 2022 at 06:49:18PM +0300, Andy Shevchenko wrote: > Before the culprit patch (see BugLink for the details): > > => acpi list > Name Base Size Detail > - -- > RSDP 000e4500 24 v02 U-BOOT > RSDT 000e4530 38 v01 U-BOOT U-BOOTBL 20220401 INTL 0 > XSDT 000e45e0 4c v01 U-BOOT U-BOOTBL 20220401 INTL 0 > CSRT 000e5490 58 v00 U-BOOT U-BOOTBL 20220401 INTL 0 > FACP 000e54f0114 v06 U-BOOT U-BOOTBL 20220401 INTL 0 > DSDT 000e4780c06 v02 U-BOOT U-BOOTBL 1 INTL 20200925 > FACS 000e4740 40 > MCFG 000e5610 3c v01 U-BOOT U-BOOTBL 20220401 INTL 0 > SPCR 000e5650 50 v02 U-BOOT U-BOOTBL 20220401 INTL 0 > APIC 000e56a0 48 v02 U-BOOT U-BOOTBL 20220401 INTL 0 > > After the culprit patch: > > => acpi list > Name Base Size Detail > - -- > RSDP 000e4500 24 v02 U-BOOT > RSDT 000e4530 34 v01 U-BOOT U-BOOTBL 20220401 INTL 0 > XSDT 000e45e0 44 v01 U-BOOT U-BOOTBL 20220401 INTL 0 > CSRT 000e53a0 58 v00 U-BOOT U-BOOTBL 20220401 INTL 0 > MCFG 000e5520 3c v01 U-BOOT U-BOOTBL 20220401 INTL 0 > SPCR 000e5560 50 v02 U-BOOT U-BOOTBL 20220401 INTL 0 > APIC 000e55b0 48 v02 U-BOOT U-BOOTBL 20220401 INTL 0 > > As a result Linux kernel can't find mandatory tables and fails > to boot. > > Hence, revert it for good. > > This reverts commit 379d3c1fd6aa490b1ad5697525cfc89b615cf25a. > > BugLink: https://lore.kernel.org/all/20220131225930.GJ7515@bill-the-cat/ > Signed-off-by: Andy Shevchenko Applied to u-boot/master, thanks! -- Tom signature.asc Description: PGP signature
Re: [PATCH] video: Do not show splash and U-Boot logo simultaneously
On Mon, Mar 28, 2022 at 04:40:36PM -0300, Fabio Estevam wrote: > From: Fabio Estevam > > Currently, on imx6sabresd and gwventana boards, the company logo > and U-Boot logo are shown. > > The correct behavior is to show only the company logo, if available, > and not both logos. > > Reported-by: Tim Harvey > Signed-off-by: Fabio Estevam > Tested-by: Tim Harvey #gw_ventana Applied to u-boot/master, thanks! -- Tom signature.asc Description: PGP signature
Re: [PATCH 1/1] Makefile: make clean should delete include/generated/env.in
On Wed, Mar 30, 2022 at 12:11:00PM +0200, Heinrich Schuchardt wrote: > 'make sifive_unamtched_defconfig; make clean; make' fails if file > include/generated/env.in exists. 'make clean' should remove all files that > stop building. > > Add file include/generated/env.in to the clean target. > > Signed-off-by: Heinrich Schuchardt > Reviewed-by: Marek Behún Applied to u-boot/master, thanks! -- Tom signature.asc Description: PGP signature
Re: [PATCH] powerpc: Fix incorrect SYS_IMMR migration values
On Wed, Mar 30, 2022 at 09:30:15AM -0400, Tom Rini wrote: > When migrating SYS_IMMR, I didn't allow for boards to provide > non-default values here. This lead to an incorrect migration on the > platforms where CONFIG_SYS_IMMR is set to CONFIG_SYS_CCSRBAR and > CONFIG_SYS_CSSRBAR is NOT the same as CONFIG_SYS_CCSRBAR_DEFAULT. Add > text to the prompt so that non-default values can be used and re-migrate > the platforms that have CONFIG_SYS_IMMR=CONFIG_SYS_CSSRBAR where > CONFIG_SYS_CSSRBAR != CONFIG_SYS_CCSRBAR_DEFAULT. > > Fixes: be7dbb60c5bf ("Convert CONFIG_SYS_IMMR to Kconfig") > Reported-by: Pali Rohár > Signed-off-by: Tom Rini > Tested-by: Pali Rohár Applied to u-boot/master, thanks! -- Tom signature.asc Description: PGP signature
Re: [PATCH v4 1/8] capsule: Add Image GUIDs and image index for platforms using capsule updates
On Thu, Mar 31, 2022 at 06:57:43PM +0530, Sughosh Ganu wrote: > Currently, all platforms that enable capsule updates do so using > either EFI_FIRMWARE_IMAGE_TYPE_UBOOT_RAW_GUID or > EFI_FIRMWARE_IMAGE_TYPE_UBOOT_FIT_GUID. This is based on the Firmware > Management Protocol(FMP) instance used on the platform. However, this > means that all platforms that enable a particular FMP instance have > the same GUID value for all the updatable images, either the FIT image > GUID or the raw image GUID, and that an image for some platform can be > updated on any other platform which uses the same FMP instance. Another > issue with this implementation is that the ESRT table shows the same > GUID value for all images on the platform and also across platforms, > which is not in compliance with the UEFI specification. > > Fix this by defining image GUID values and firmware names for > individual images per platform. The GetImageInfo FMP hook would then > populate these values in the image descriptor array. > > Also add the image index value associated with a particular > image. This is the value that should match with the image_index value > that is part of the capsule header. The capsule update code will check > if the two values match, and the update will only proceed on a match. > > Signed-off-by: Sughosh Ganu > Reviewed-by: Masami Hiramatsu > Acked-by: Michal Simek > --- > > Changes since V3: None > > .../imx8mp_rsb3720a1/imx8mp_rsb3720a1.c | 20 + > .../imx8mm-cl-iot-gate/imx8mm-cl-iot-gate.c | 19 + > board/emulation/qemu-arm/qemu-arm.c | 20 + > board/kontron/pitx_imx8m/pitx_imx8m.c | 16 ++- > board/kontron/sl-mx8mm/sl-mx8mm.c | 15 ++ > board/kontron/sl28/sl28.c | 15 ++ > board/sandbox/sandbox.c | 28 +++ > board/socionext/developerbox/developerbox.c | 26 + > board/xilinx/common/board.c | 24 > include/configs/imx8mm-cl-iot-gate.h | 10 +++ > include/configs/imx8mp_rsb3720.h | 10 +++ > include/configs/kontron-sl-mx8mm.h| 6 > include/configs/kontron_pitx_imx8m.h | 6 > include/configs/kontron_sl28.h| 6 > include/configs/qemu-arm.h| 10 +++ > include/configs/sandbox.h | 14 ++ > include/configs/synquacer.h | 14 ++ > include/configs/xilinx_versal.h | 6 > include/configs/xilinx_zynqmp.h | 10 +++ > include/configs/zynq-common.h | 10 +++ > include/efi_loader.h | 18 > 21 files changed, 302 insertions(+), 1 deletion(-) > > diff --git a/board/advantech/imx8mp_rsb3720a1/imx8mp_rsb3720a1.c > b/board/advantech/imx8mp_rsb3720a1/imx8mp_rsb3720a1.c > index 16566092bd..1c953ba195 100644 > --- a/board/advantech/imx8mp_rsb3720a1/imx8mp_rsb3720a1.c > +++ b/board/advantech/imx8mp_rsb3720a1/imx8mp_rsb3720a1.c > @@ -6,6 +6,8 @@ > > #include > #include > +#include > +#include > #include > #include > #include > @@ -21,6 +23,7 @@ > #include > #include > #include > +#include > #include > > DECLARE_GLOBAL_DATA_PTR; > @@ -44,6 +47,23 @@ static void setup_gpmi_nand(void) > } > #endif > > +#if CONFIG_IS_ENABLED(EFI_HAVE_CAPSULE_SUPPORT) > +struct efi_fw_images fw_images[] = { > + { > +#if defined(CONFIG_TARGET_IMX8MP_RSB3720A1_4G) > + .image_type_id = IMX8MP_RSB3720A1_4G_FIT_IMAGE_GUID, > +#elif defined(CONFIG_TARGET_IMX8MP_RSB3720A1_6G) > + .image_type_id = IMX8MP_RSB3720A1_6G_FIT_IMAGE_GUID, > +#endif > + .fw_name = u"IMX8MP-RSB3720-FIT", > + .image_index = 1 > + }, > +}; > + > +u8 num_image_type_guids = ARRAY_SIZE(fw_images); > +#endif /* EFI_HAVE_CAPSULE_SUPPORT */ > + > + > int board_early_init_f(void) > { > struct wdog_regs *wdog = (struct wdog_regs *)WDOG1_BASE_ADDR; > diff --git a/board/compulab/imx8mm-cl-iot-gate/imx8mm-cl-iot-gate.c > b/board/compulab/imx8mm-cl-iot-gate/imx8mm-cl-iot-gate.c > index 7e2d88f449..f5b89a5ddc 100644 > --- a/board/compulab/imx8mm-cl-iot-gate/imx8mm-cl-iot-gate.c > +++ b/board/compulab/imx8mm-cl-iot-gate/imx8mm-cl-iot-gate.c > @@ -5,6 +5,8 @@ > */ > > #include > +#include > +#include > #include > #include > #include > @@ -21,11 +23,28 @@ > #include > #include > #include > +#include > > #include "ddr/ddr.h" > > DECLARE_GLOBAL_DATA_PTR; > > +#if CONFIG_IS_ENABLED(EFI_HAVE_CAPSULE_SUPPORT) > +struct efi_fw_images fw_images[] = { > + { > +#if defined(CONFIG_TARGET_IMX8MM_CL_IOT_GATE) > + .image_type_id = IMX8MM_CL_IOT_GATE_FIT_IMAGE_GUID, > +#elif defined(CONFIG_TARGET_IMX8MM_CL_IOT_GATE_OPTEE) > + .image_type_id = IMX8MM_CL_IOT_GATE_OPTEE_FIT_IMAGE_GUID, > +#endif > +
Re: [PATCH v4 4/8] board: Define set_dfu_alt_info() for boards with UEFI capsule update enabled
Hi Sughosh, OK, this looks good to me. Acked-by: Masami Hiramatsu for DeveloperBox part. Thank you, 2022年3月31日(木) 22:28 Sughosh Ganu : > > Currently, there are a bunch of boards which enable the UEFI capsule > update feature. The actual update of the firmware images is done > through the dfu framework which uses the dfu_alt_info environment > variable for getting information on the update, like device, partition > number/address etc. Currently, these boards define the dfu_alt_info > variable in the board config header, as an environment variable. With > this, the variable can be modified from the u-boot command line and > this can cause an incorrect update. > > To prevent this from happening, define the set_dfu_alt_info function > in the board file, and select SET_DFU_ALT_INFO for all platforms which > enable the capsule update feature. With the function defined, the dfu > framework populates the dfu_alt_info variable through the board file, > instead of fetching the variable from the environment, thus making the > update more robust. > > Signed-off-by: Sughosh Ganu > --- > > Changes since V3: > * Do not remove the existing dfu_alt_info definitions made by > platforms in the config files, as discussed with Masami. > * Squash the selection of the SET_DFU_ALT_INFO config symbol for > capsule update feature as part of this patch. > > > .../imx8mp_rsb3720a1/imx8mp_rsb3720a1.c | 24 + > .../imx8mm-cl-iot-gate/imx8mm-cl-iot-gate.c | 24 + > board/emulation/common/qemu_dfu.c | 6 ++--- > board/kontron/pitx_imx8m/pitx_imx8m.c | 24 + > board/kontron/sl-mx8mm/sl-mx8mm.c | 24 + > board/kontron/sl28/sl28.c | 25 ++ > board/sandbox/sandbox.c | 26 +++ > board/socionext/developerbox/developerbox.c | 26 +++ > board/xilinx/zynq/board.c | 5 ++-- > board/xilinx/zynqmp/zynqmp.c | 5 ++-- > lib/efi_loader/Kconfig| 2 ++ > 11 files changed, 184 insertions(+), 7 deletions(-) > > diff --git a/board/advantech/imx8mp_rsb3720a1/imx8mp_rsb3720a1.c > b/board/advantech/imx8mp_rsb3720a1/imx8mp_rsb3720a1.c > index 1c953ba195..41154ca9f3 100644 > --- a/board/advantech/imx8mp_rsb3720a1/imx8mp_rsb3720a1.c > +++ b/board/advantech/imx8mp_rsb3720a1/imx8mp_rsb3720a1.c > @@ -5,10 +5,12 @@ > */ > > #include > +#include > #include > #include > #include > #include > +#include > #include > #include > #include > @@ -24,6 +26,7 @@ > #include > #include > #include > +#include > #include > > DECLARE_GLOBAL_DATA_PTR; > @@ -231,3 +234,24 @@ unsigned long spl_mmc_get_uboot_raw_sector(struct mmc > *mmc) > } > } > #endif /* CONFIG_SPL_MMC_SUPPORT */ > + > +#if defined(CONFIG_SET_DFU_ALT_INFO) > + > +#define DFU_ALT_BUF_LENSZ_1K > + > +void set_dfu_alt_info(char *interface, char *devstr) > +{ > + ALLOC_CACHE_ALIGN_BUFFER(char, buf, DFU_ALT_BUF_LEN); > + > + if (!CONFIG_IS_ENABLED(EFI_HAVE_CAPSULE_SUPPORT) && > + env_get("dfu_alt_info")) > + return; > + > + memset(buf, 0, DFU_ALT_BUF_LEN); > + > + snprintf(buf, DFU_ALT_BUF_LEN, > +"mmc 2=flash-bin raw 0 0x1B00 mmcpart 1"); > + > + env_set("dfu_alt_info", buf); > +} > +#endif /* CONFIG_SET_DFU_ALT_INFO */ > diff --git a/board/compulab/imx8mm-cl-iot-gate/imx8mm-cl-iot-gate.c > b/board/compulab/imx8mm-cl-iot-gate/imx8mm-cl-iot-gate.c > index f5b89a5ddc..1880dd9c55 100644 > --- a/board/compulab/imx8mm-cl-iot-gate/imx8mm-cl-iot-gate.c > +++ b/board/compulab/imx8mm-cl-iot-gate/imx8mm-cl-iot-gate.c > @@ -5,6 +5,7 @@ > */ > > #include > +#include > #include > #include > #include > @@ -12,6 +13,7 @@ > #include > #include > #include > +#include > #include > #include > > @@ -24,6 +26,7 @@ > #include > #include > #include > +#include > > #include "ddr/ddr.h" > > @@ -446,3 +449,24 @@ int board_late_init(void) > > return 0; > } > + > +#if defined(CONFIG_SET_DFU_ALT_INFO) > + > +#define DFU_ALT_BUF_LENSZ_1K > + > +void set_dfu_alt_info(char *interface, char *devstr) > +{ > + ALLOC_CACHE_ALIGN_BUFFER(char, buf, DFU_ALT_BUF_LEN); > + > + if (!CONFIG_IS_ENABLED(EFI_HAVE_CAPSULE_SUPPORT) && > + env_get("dfu_alt_info")) > + return; > + > + memset(buf, 0, DFU_ALT_BUF_LEN); > + > + snprintf(buf, DFU_ALT_BUF_LEN, > +"mmc 2=flash-bin raw 0x42 0x1D00 mmcpart 1"); > + > + env_set("dfu_alt_info", buf); > +} > +#endif /* CONFIG_SET_DFU_ALT_INFO */ > diff --git a/board/emulation/common/qemu_dfu.c > b/board/emulation/common/qemu_dfu.c > index 62234a7647..85dff4373b 100644 > --- a/board/emulation/common/qemu_dfu.c > +++ b/board/emulation/common/qemu_dfu.c > @@ -44,10 +44,11 @@ void set_dfu_alt_info(char *interface, cha
Re: [PATCH v4 2/8] capsule: FMP: Populate the image descriptor array from platform data
Hi Sughosh, On Thu, Mar 31, 2022 at 06:57:44PM +0530, Sughosh Ganu wrote: > Currently, the image descriptor array that has been passed to the > GetImageInfo function of the Firmware Management Protocol(FMP) gets > populated through the data stored with the dfu framework. The > dfu data is not restricted to contain information only of the images > updatable through the capsule update mechanism, but it also contains > information on other images. > > The image descriptor array is also parsed by the ESRT generation code, > and thus the ESRT table contains entries for other images that are not > being handled by the FMP for the capsule updates. > > The other issue fixed is assignment of a separate GUID for all images > in the image descriptor array. The UEFI specification mandates that > all entries in the ESRT table should have a unique GUID value as part > of the FwClass member of the EFI_SYSTEM_RESOURCE_ENTRY. Currently, all > images are assigned a single GUID value, either an FIT GUID or a raw > image GUID. This is fixed by obtaining the GUID values from the > efi_fw_images array defined per platform. > > Signed-off-by: Sughosh Ganu > Reviewed-by: Masami Hiramatsu > --- > > Changes since V3: None > > include/efi_loader.h | 3 ++ > lib/efi_loader/efi_firmware.c | 91 +++ > 2 files changed, 30 insertions(+), 64 deletions(-) > > diff --git a/include/efi_loader.h b/include/efi_loader.h > index 284d64547b..9704397bd7 100644 > --- a/include/efi_loader.h > +++ b/include/efi_loader.h > @@ -997,6 +997,9 @@ struct efi_fw_images { > u8 image_index; > }; > > +extern struct efi_fw_images fw_images[]; > +extern u8 num_image_type_guids; > + > /** > * Install the ESRT system table. > * > diff --git a/lib/efi_loader/efi_firmware.c b/lib/efi_loader/efi_firmware.c > index a5ff32f121..169f3a29bb 100644 > --- a/lib/efi_loader/efi_firmware.c > +++ b/lib/efi_loader/efi_firmware.c > @@ -97,91 +97,60 @@ efi_status_t EFIAPI > efi_firmware_set_package_info_unsupported( > } > > /** > - * efi_get_dfu_info - return information about the current firmware image > + * efi_fill_image_desc_array - populate image descriptor array > * @this:Protocol instance > * @image_info_size: Size of @image_info > * @image_info: Image information > * @descriptor_version: Pointer to version number > - * @descriptor_count:Pointer to number of descriptors > + * @descriptor_count:Image count > * @descriptor_size: Pointer to descriptor size > - * package_version: Package version > - * package_version_name: Package version's name > - * image_type: Image type GUID > + * @package_version: Package version > + * @package_version_name:Package version's name > * > * Return information bout the current firmware image in @image_info. > * @image_info will consist of a number of descriptors. > - * Each descriptor will be created based on "dfu_alt_info" variable. > + * Each descriptor will be created based on "efi_fw_images" variable. > * > * Returnstatus code > */ > -static efi_status_t efi_get_dfu_info( > +static efi_status_t efi_fill_image_desc_array( > efi_uintn_t *image_info_size, > struct efi_firmware_image_descriptor *image_info, > u32 *descriptor_version, > u8 *descriptor_count, > efi_uintn_t *descriptor_size, > u32 *package_version, > - u16 **package_version_name, > - const efi_guid_t *image_type) > + u16 **package_version_name) > { > - struct dfu_entity *dfu; > size_t names_len, total_size; > - int dfu_num, i; > - u16 *name, *next; > - int ret; > - > - ret = dfu_init_env_entities(NULL, NULL); > - if (ret) > - return EFI_SUCCESS; > + struct efi_fw_images *fw_array; > + u8 image_count; > + int i; > > + fw_array = &fw_images[0]; nit, but fw_array = fw_images looks better > + *descriptor_count = image_count = num_image_type_guids; We could get rid of image_count here > names_len = 0; > - dfu_num = 0; > - list_for_each_entry(dfu, &dfu_list, list) { > - names_len += (utf8_utf16_strlen(dfu->name) + 1) * 2; > - dfu_num++; > - } > - if (!dfu_num) { > - log_warning("No entities in dfu_alt_info\n"); > - *image_info_size = 0; > - dfu_free_entities(); > > - return EFI_SUCCESS; > - } > + total_size = sizeof(*image_info) * image_count; > > - total_size = sizeof(*image_info) * dfu_num + names_len; > - /* > - * we will assume that sizeof(*image_info) * dfu_name > - * is, at least, a multiple of 2. So the start address for > - * image_id_name would be aligned with 2 bytes. > - */ > if (*image_info_size < total_size) { > *image_info_size = total_size; > -
Re: [EXT] [PATCH] ARM: imx: romapi: Repair FlexSPI NOR boot offset
On Mon, Mar 28, 2022 at 7:55 AM Marek Vasut wrote: > > On 3/28/22 08:54, Ye Li wrote: > > Hi Marek, > > Hi, > > [...] > > >>> 2. Update the u-boot.itb offset in imx8mp-u-boot.dtsi, set the > >>> offset > >>> to 0x5f000. The previous offset 0x58000 is for SD, calculated by > >>> 0x6 - 0x8000 (32KB image offset). > >>> > >>>uboot: blob-ext@2 { > >>>filename = "u-boot.itb"; > >>>offset = <0x5f000>; > >>>}; > >> But that breaks booting from SD card for me ? > > > > Do you want to use one flash.bin for both SD and flexspi? > > Yes, the board I use can boot from SD/eMMC/FlexSPI. I don't want to > build multiple confusing "flash.bin" files, one for each boot media. > > > When first introduced 8m support by imx8mimage.c, we expected the u- > > boot.itb at same device offset (0x6) on SD/emmc and flexspi. The > > imx8mimage will calculate the offset inside the flash.bin automatically > > according to different IVT offset. The ROMAPI driver also works > > correspondingly. > > After using binman, the u-boot.itb offset inside the flash.bin has to > > be manually set in this DTS node. To follow the original design, this > > offset should be different. That's why I asked to update this dts node > > for flexspi. > > This does imply that there are currently no users that boot from flexspi > in upstream U-Boot, because such users would have to manually modify > both arch/arm/dts/imx8m?-u-boot.dtsi and board/*/imximage.cfg to > generate suitable flash.bin which can be started from FlexSPI. > > Also, git grep confirms that there are no users: > > u-boot$ git grep BOOT_FROM.*fspi > doc/imx/mkimage/imx8image.txt:BOOT_FROM > [sd|emmc_fastboot|fspi|nand_4k|nand_8k|nand_16k] [sector_size] > > > If you change the ROM API driver, that will break our design. You can > > try to overwrite spl_romapi_get_uboot_base for your board only. > > Since there are no users which boot from flexspi upstream, this design > can still be fixed such that it does not require different flash.bin for > different boot media, but rather one flash.bin works on all boot media. > I think that is much better. > Marek, I'm also a fan of single U-Boot binaries supporting multiple boards and configurations. How are you handling env for the various boot devices? I haven't looked in a while... can multiple env support co-exist now between MMC/SPI and be selected at runtime? Best Regards, Tim
Re: [EXT] [PATCH] ARM: imx: romapi: Repair FlexSPI NOR boot offset
On 3/31/22 17:09, Tim Harvey wrote: On Mon, Mar 28, 2022 at 7:55 AM Marek Vasut wrote: On 3/28/22 08:54, Ye Li wrote: Hi Marek, Hi, [...] 2. Update the u-boot.itb offset in imx8mp-u-boot.dtsi, set the offset to 0x5f000. The previous offset 0x58000 is for SD, calculated by 0x6 - 0x8000 (32KB image offset). uboot: blob-ext@2 { filename = "u-boot.itb"; offset = <0x5f000>; }; But that breaks booting from SD card for me ? Do you want to use one flash.bin for both SD and flexspi? Yes, the board I use can boot from SD/eMMC/FlexSPI. I don't want to build multiple confusing "flash.bin" files, one for each boot media. When first introduced 8m support by imx8mimage.c, we expected the u- boot.itb at same device offset (0x6) on SD/emmc and flexspi. The imx8mimage will calculate the offset inside the flash.bin automatically according to different IVT offset. The ROMAPI driver also works correspondingly. After using binman, the u-boot.itb offset inside the flash.bin has to be manually set in this DTS node. To follow the original design, this offset should be different. That's why I asked to update this dts node for flexspi. This does imply that there are currently no users that boot from flexspi in upstream U-Boot, because such users would have to manually modify both arch/arm/dts/imx8m?-u-boot.dtsi and board/*/imximage.cfg to generate suitable flash.bin which can be started from FlexSPI. Also, git grep confirms that there are no users: u-boot$ git grep BOOT_FROM.*fspi doc/imx/mkimage/imx8image.txt:BOOT_FROM [sd|emmc_fastboot|fspi|nand_4k|nand_8k|nand_16k] [sector_size] If you change the ROM API driver, that will break our design. You can try to overwrite spl_romapi_get_uboot_base for your board only. Since there are no users which boot from flexspi upstream, this design can still be fixed such that it does not require different flash.bin for different boot media, but rather one flash.bin works on all boot media. I think that is much better. Marek, I'm also a fan of single U-Boot binaries supporting multiple boards and configurations. How are you handling env for the various boot devices? I haven't looked in a while... can multiple env support co-exist now between MMC/SPI and be selected at runtime? Do '$ git grep env_get_location' , you will find board-level examples where this function is implemented and it returns ENVL_* based on various hardware-specific conditions. I _think_ there is even imx arch specific implementation for this env_get_location() which automatically picks SD/eMMC/FlexSPI for you right now.
Re: [EXT] [PATCH] ARM: imx: romapi: Repair FlexSPI NOR boot offset
On Thu, Mar 31, 2022 at 8:26 AM Marek Vasut wrote: > > On 3/31/22 17:09, Tim Harvey wrote: > > On Mon, Mar 28, 2022 at 7:55 AM Marek Vasut wrote: > >> > >> On 3/28/22 08:54, Ye Li wrote: > >>> Hi Marek, > >> > >> Hi, > >> > >> [...] > >> > > 2. Update the u-boot.itb offset in imx8mp-u-boot.dtsi, set the > > offset > > to 0x5f000. The previous offset 0x58000 is for SD, calculated by > > 0x6 - 0x8000 (32KB image offset). > > > > uboot: blob-ext@2 { > > filename = "u-boot.itb"; > > offset = <0x5f000>; > > }; > But that breaks booting from SD card for me ? > >>> > >>> Do you want to use one flash.bin for both SD and flexspi? > >> > >> Yes, the board I use can boot from SD/eMMC/FlexSPI. I don't want to > >> build multiple confusing "flash.bin" files, one for each boot media. > >> > >>> When first introduced 8m support by imx8mimage.c, we expected the u- > >>> boot.itb at same device offset (0x6) on SD/emmc and flexspi. The > >>> imx8mimage will calculate the offset inside the flash.bin automatically > >>> according to different IVT offset. The ROMAPI driver also works > >>> correspondingly. > >>> After using binman, the u-boot.itb offset inside the flash.bin has to > >>> be manually set in this DTS node. To follow the original design, this > >>> offset should be different. That's why I asked to update this dts node > >>> for flexspi. > >> > >> This does imply that there are currently no users that boot from flexspi > >> in upstream U-Boot, because such users would have to manually modify > >> both arch/arm/dts/imx8m?-u-boot.dtsi and board/*/imximage.cfg to > >> generate suitable flash.bin which can be started from FlexSPI. > >> > >> Also, git grep confirms that there are no users: > >> > >> u-boot$ git grep BOOT_FROM.*fspi > >> doc/imx/mkimage/imx8image.txt:BOOT_FROM > >> [sd|emmc_fastboot|fspi|nand_4k|nand_8k|nand_16k] [sector_size] > >> > >>> If you change the ROM API driver, that will break our design. You can > >>> try to overwrite spl_romapi_get_uboot_base for your board only. > >> > >> Since there are no users which boot from flexspi upstream, this design > >> can still be fixed such that it does not require different flash.bin for > >> different boot media, but rather one flash.bin works on all boot media. > >> I think that is much better. > >> > > > > Marek, > > > > I'm also a fan of single U-Boot binaries supporting multiple boards > > and configurations. > > > > How are you handling env for the various boot devices? I haven't > > looked in a while... can multiple env support co-exist now between > > MMC/SPI and be selected at runtime? > > Do '$ git grep env_get_location' , you will find board-level examples > where this function is implemented and it returns ENVL_* based on > various hardware-specific conditions. > > I _think_ there is even imx arch specific implementation for this > env_get_location() which automatically picks SD/eMMC/FlexSPI for you > right now. Marek, I guess where I keep getting hung up is how to configure the ENV for multiple env drivers as there is only one CONFIG_ENV_OFFSET Kconfig which means for all devices your going to have the same offset/redund configuration which is likely not appropriate for mmc/nand/spi for example. I don't see any way currently to configure those separately. Unless I'm missing something obvious I suppose get_env_location() could be augmented to be able to return board-specific env location config as well. Best regards, Tim
Re: [PATCH v4 2/8] capsule: FMP: Populate the image descriptor array from platform data
hi Ilias, On Thu, 31 Mar 2022 at 20:38, Ilias Apalodimas wrote: > > Hi Sughosh, > > On Thu, Mar 31, 2022 at 06:57:44PM +0530, Sughosh Ganu wrote: > > Currently, the image descriptor array that has been passed to the > > GetImageInfo function of the Firmware Management Protocol(FMP) gets > > populated through the data stored with the dfu framework. The > > dfu data is not restricted to contain information only of the images > > updatable through the capsule update mechanism, but it also contains > > information on other images. > > > > The image descriptor array is also parsed by the ESRT generation code, > > and thus the ESRT table contains entries for other images that are not > > being handled by the FMP for the capsule updates. > > > > The other issue fixed is assignment of a separate GUID for all images > > in the image descriptor array. The UEFI specification mandates that > > all entries in the ESRT table should have a unique GUID value as part > > of the FwClass member of the EFI_SYSTEM_RESOURCE_ENTRY. Currently, all > > images are assigned a single GUID value, either an FIT GUID or a raw > > image GUID. This is fixed by obtaining the GUID values from the > > efi_fw_images array defined per platform. > > > > Signed-off-by: Sughosh Ganu > > Reviewed-by: Masami Hiramatsu > > --- > > > > Changes since V3: None > > > > include/efi_loader.h | 3 ++ > > lib/efi_loader/efi_firmware.c | 91 +++ > > 2 files changed, 30 insertions(+), 64 deletions(-) > > > > diff --git a/include/efi_loader.h b/include/efi_loader.h > > index 284d64547b..9704397bd7 100644 > > --- a/include/efi_loader.h > > +++ b/include/efi_loader.h > > @@ -997,6 +997,9 @@ struct efi_fw_images { > > u8 image_index; > > }; > > > > +extern struct efi_fw_images fw_images[]; > > +extern u8 num_image_type_guids; > > + > > /** > > * Install the ESRT system table. > > * > > diff --git a/lib/efi_loader/efi_firmware.c b/lib/efi_loader/efi_firmware.c > > index a5ff32f121..169f3a29bb 100644 > > --- a/lib/efi_loader/efi_firmware.c > > +++ b/lib/efi_loader/efi_firmware.c > > @@ -97,91 +97,60 @@ efi_status_t EFIAPI > > efi_firmware_set_package_info_unsupported( > > } > > > > /** > > - * efi_get_dfu_info - return information about the current firmware image > > + * efi_fill_image_desc_array - populate image descriptor array > > * @this:Protocol instance > > * @image_info_size: Size of @image_info > > * @image_info: Image information > > * @descriptor_version: Pointer to version number > > - * @descriptor_count:Pointer to number of descriptors > > + * @descriptor_count:Image count > > * @descriptor_size: Pointer to descriptor size > > - * package_version: Package version > > - * package_version_name: Package version's name > > - * image_type: Image type GUID > > + * @package_version: Package version > > + * @package_version_name:Package version's name > > * > > * Return information bout the current firmware image in @image_info. > > * @image_info will consist of a number of descriptors. > > - * Each descriptor will be created based on "dfu_alt_info" variable. > > + * Each descriptor will be created based on "efi_fw_images" variable. > > * > > * Returnstatus code > > */ > > -static efi_status_t efi_get_dfu_info( > > +static efi_status_t efi_fill_image_desc_array( > > efi_uintn_t *image_info_size, > > struct efi_firmware_image_descriptor *image_info, > > u32 *descriptor_version, > > u8 *descriptor_count, > > efi_uintn_t *descriptor_size, > > u32 *package_version, > > - u16 **package_version_name, > > - const efi_guid_t *image_type) > > + u16 **package_version_name) > > { > > - struct dfu_entity *dfu; > > size_t names_len, total_size; > > - int dfu_num, i; > > - u16 *name, *next; > > - int ret; > > - > > - ret = dfu_init_env_entities(NULL, NULL); > > - if (ret) > > - return EFI_SUCCESS; > > + struct efi_fw_images *fw_array; > > + u8 image_count; > > + int i; > > > > + fw_array = &fw_images[0]; > > nit, but fw_array = fw_images looks better Okay. Will change. > > > + *descriptor_count = image_count = num_image_type_guids; > > We could get rid of image_count here Will remove. > > > names_len = 0; > > - dfu_num = 0; > > - list_for_each_entry(dfu, &dfu_list, list) { > > - names_len += (utf8_utf16_strlen(dfu->name) + 1) * 2; > > - dfu_num++; > > - } > > - if (!dfu_num) { > > - log_warning("No entities in dfu_alt_info\n"); > > - *image_info_size = 0; > > - dfu_free_entities(); > > > > - return EFI_SUCCESS; > > - } > > + total_size = sizeof(*image_info) * image_count; > > > > - total_size = sizeof(*image_info) *
Re: [PATCH 13/25] spi: cadence_qspi: Migrate CONFIG_CQSPI_REF_CLK to Kconfig
+Vignesh Hi Tom, On 30/03/22 06:07PM, Tom Rini wrote: > This is a little tricky since SoCFPGA has code to determine this as > runtime. Introduce a guard variable for platforms to select if they > have a static value to use. Then for ARCH_SOCFPGA, call > cm_get_qspi_controller_clk_hz() and otherwise continue the previous > behavior. > > Cc: Jagan Teki > Signed-off-by: Tom Rini > --- > arch/arm/mach-socfpga/misc_soc64.c | 1 + > configs/j7200_evm_a72_defconfig| 2 ++ > configs/j7200_evm_r5_defconfig | 2 ++ > configs/j721e_evm_a72_defconfig| 2 ++ > configs/j721e_evm_r5_defconfig | 2 ++ > configs/j721e_hs_evm_a72_defconfig | 2 ++ > configs/j721e_hs_evm_r5_defconfig | 2 ++ > configs/j721s2_evm_a72_defconfig | 2 ++ > configs/j721s2_evm_r5_defconfig| 2 ++ > configs/k2g_evm_defconfig | 2 ++ > configs/k2g_hs_evm_defconfig | 2 ++ > configs/stv0991_defconfig | 2 ++ > drivers/spi/Kconfig| 8 > drivers/spi/cadence_qspi.c | 4 +++- > drivers/spi/cadence_qspi.h | 1 + > include/configs/j721e_evm.h| 1 - > include/configs/j721s2_evm.h | 1 - > include/configs/k2g_evm.h | 4 > include/configs/socfpga_common.h | 9 - > include/configs/socfpga_soc64_common.h | 5 - > include/configs/stv0991.h | 8 > 21 files changed, 35 insertions(+), 29 deletions(-) > > diff --git a/arch/arm/mach-socfpga/misc_soc64.c > b/arch/arm/mach-socfpga/misc_soc64.c > index 7b973a79e807..2acdfad07b35 100644 > --- a/arch/arm/mach-socfpga/misc_soc64.c > +++ b/arch/arm/mach-socfpga/misc_soc64.c > @@ -16,6 +16,7 @@ > #include > #include > #include > +#include > > DECLARE_GLOBAL_DATA_PTR; > > diff --git a/configs/j7200_evm_a72_defconfig b/configs/j7200_evm_a72_defconfig > index eb1d7d46b82a..3d0d1977ff99 100644 > --- a/configs/j7200_evm_a72_defconfig > +++ b/configs/j7200_evm_a72_defconfig > @@ -173,6 +173,8 @@ CONFIG_SOC_TI=y > CONFIG_SPI=y > CONFIG_DM_SPI=y > CONFIG_CADENCE_QSPI=y > +CONFIG_HAS_CQSPI_REF_CLK=y > +CONFIG_CQSPI_REF_CLK=1 > CONFIG_SYSRESET=y > CONFIG_SPL_SYSRESET=y > CONFIG_SYSRESET_TI_SCI=y > diff --git a/configs/j7200_evm_r5_defconfig b/configs/j7200_evm_r5_defconfig > index e500a27bb692..0f4b006b80b5 100644 > --- a/configs/j7200_evm_r5_defconfig > +++ b/configs/j7200_evm_r5_defconfig > @@ -134,6 +134,8 @@ CONFIG_SOC_TI=y > CONFIG_SPI=y > CONFIG_DM_SPI=y > CONFIG_CADENCE_QSPI=y > +CONFIG_HAS_CQSPI_REF_CLK=y > +CONFIG_CQSPI_REF_CLK=1 This clock is configured to 166 MHz via device tree. I would prefer TI platforms to use device tree and not set CONFIG_HAS_CQSPI_REF_CLK at all. The clock _is_ 133 MHz by default but I think it is better if we just return an error when clk_get fails. > CONFIG_SYSRESET=y > CONFIG_SPL_SYSRESET=y > CONFIG_SYSRESET_TI_SCI=y [...] > diff --git a/drivers/spi/cadence_qspi.c b/drivers/spi/cadence_qspi.c > index db680618ee9b..7209bb43a776 100644 > --- a/drivers/spi/cadence_qspi.c > +++ b/drivers/spi/cadence_qspi.c > @@ -188,8 +188,10 @@ static int cadence_spi_probe(struct udevice *bus) > if (plat->ref_clk_hz == 0) { > ret = clk_get_by_index(bus, 0, &clk); > if (ret) { > -#ifdef CONFIG_CQSPI_REF_CLK > +#ifdef CONFIG_HAS_CQSPI_REF_CLK > plat->ref_clk_hz = CONFIG_CQSPI_REF_CLK; > +#elif defined(CONFIG_ARCH_SOCFPGA) > + plat->ref_clk_hz = cm_get_qspi_controller_clk_hz(); While you are here, please change all this to use if (IS_ENABLED()) instead. > #else > return ret; > #endif [...] -- Regards, Pratyush Yadav Texas Instruments Inc.
Re: [EXT] [PATCH] ARM: imx: romapi: Repair FlexSPI NOR boot offset
On 3/31/22 18:03, Tim Harvey wrote: On Thu, Mar 31, 2022 at 8:26 AM Marek Vasut wrote: On 3/31/22 17:09, Tim Harvey wrote: On Mon, Mar 28, 2022 at 7:55 AM Marek Vasut wrote: On 3/28/22 08:54, Ye Li wrote: Hi Marek, Hi, [...] 2. Update the u-boot.itb offset in imx8mp-u-boot.dtsi, set the offset to 0x5f000. The previous offset 0x58000 is for SD, calculated by 0x6 - 0x8000 (32KB image offset). uboot: blob-ext@2 { filename = "u-boot.itb"; offset = <0x5f000>; }; But that breaks booting from SD card for me ? Do you want to use one flash.bin for both SD and flexspi? Yes, the board I use can boot from SD/eMMC/FlexSPI. I don't want to build multiple confusing "flash.bin" files, one for each boot media. When first introduced 8m support by imx8mimage.c, we expected the u- boot.itb at same device offset (0x6) on SD/emmc and flexspi. The imx8mimage will calculate the offset inside the flash.bin automatically according to different IVT offset. The ROMAPI driver also works correspondingly. After using binman, the u-boot.itb offset inside the flash.bin has to be manually set in this DTS node. To follow the original design, this offset should be different. That's why I asked to update this dts node for flexspi. This does imply that there are currently no users that boot from flexspi in upstream U-Boot, because such users would have to manually modify both arch/arm/dts/imx8m?-u-boot.dtsi and board/*/imximage.cfg to generate suitable flash.bin which can be started from FlexSPI. Also, git grep confirms that there are no users: u-boot$ git grep BOOT_FROM.*fspi doc/imx/mkimage/imx8image.txt:BOOT_FROM [sd|emmc_fastboot|fspi|nand_4k|nand_8k|nand_16k] [sector_size] If you change the ROM API driver, that will break our design. You can try to overwrite spl_romapi_get_uboot_base for your board only. Since there are no users which boot from flexspi upstream, this design can still be fixed such that it does not require different flash.bin for different boot media, but rather one flash.bin works on all boot media. I think that is much better. Marek, I'm also a fan of single U-Boot binaries supporting multiple boards and configurations. How are you handling env for the various boot devices? I haven't looked in a while... can multiple env support co-exist now between MMC/SPI and be selected at runtime? Do '$ git grep env_get_location' , you will find board-level examples where this function is implemented and it returns ENVL_* based on various hardware-specific conditions. I _think_ there is even imx arch specific implementation for this env_get_location() which automatically picks SD/eMMC/FlexSPI for you right now. Marek, I guess where I keep getting hung up is how to configure the ENV for multiple env drivers as there is only one CONFIG_ENV_OFFSET Kconfig which means for all devices your going to have the same offset/redund configuration which is likely not appropriate for mmc/nand/spi for example. I don't see any way currently to configure those separately. Unless I'm missing something obvious I suppose get_env_location() could be augmented to be able to return board-specific env location config as well. e.g. env/mmc.c has the following: 78 } dt_prop = { 79 .offset_redund = "u-boot,mmc-env-offset-redundant", 80 .partition = "u-boot,mmc-env-partition", 81 .offset = "u-boot,mmc-env-offset", 82 }; So use that to specify per-env-driver offset. Indeed, the CONFIG_ENV*OFFSET is shared by all env driver.
Re: [PATCH 4/6] net: fec: add support for DM_MDIO
On Tue, Mar 29, 2022 at 03:52:38PM -0700, Tim Harvey wrote: > Add support for DM_MDIO by registering a UCLASS_MDIO driver and > attempting to use it. This is necessary if wanting to use a DSA > driver for example hanging off of the FEC MAC. > > Care is taken to fallback to non DM_MDIO as several boards define > DM_MDIO without having the proper device-tree configuration necessary > such as an mdio subnode, a phy-mode prop, and either a valid phy-handle > prop or fixed-phy subnode. > > Signed-off-by: Tim Harvey > --- > drivers/net/fec_mxc.c | 113 ++ > drivers/net/fec_mxc.h | 1 + > 2 files changed, 104 insertions(+), 10 deletions(-) > > diff --git a/drivers/net/fec_mxc.c b/drivers/net/fec_mxc.c > index e8ebef09032a..374ef9d67d5e 100644 > --- a/drivers/net/fec_mxc.c > +++ b/drivers/net/fec_mxc.c > @@ -30,6 +30,8 @@ > #include > #include > #include > +#include > +#include > > #include "fec_mxc.h" > #include > @@ -1025,6 +1027,80 @@ struct mii_dev *fec_get_miibus(ulong base_addr, int > dev_id) > return bus; > } > > +#ifdef CONFIG_DM_MDIO > +struct dm_fec_mdio_priv { > + struct ethernet_regs *regs; > +}; > + > +static int dm_fec_mdio_read(struct udevice *dev, int addr, int devad, int > reg) > +{ > + struct dm_fec_mdio_priv *priv = dev_get_priv(dev); > + > + return fec_mdio_read(priv->regs, addr, reg); > +} > + > +static int dm_fec_mdio_write(struct udevice *dev, int addr, int devad, int > reg, u16 data) > +{ > + struct dm_fec_mdio_priv *priv = dev_get_priv(dev); > + > + return fec_mdio_write(priv->regs, addr, reg, data); > +} > + > +static const struct mdio_ops dm_fec_mdio_ops = { > + .read = dm_fec_mdio_read, > + .write = dm_fec_mdio_write, > +}; > + > +static int dm_fec_mdio_probe(struct udevice *dev) > +{ > + struct dm_fec_mdio_priv *priv = dev_get_priv(dev); > + > + priv->regs = (struct ethernet_regs > *)ofnode_get_addr(dev_ofnode(dev->parent)); > + > + return 0; > +} > + > +U_BOOT_DRIVER(fec_mdio) = { > + .name = "fec_mdio", > + .id = UCLASS_MDIO, > + .probe = dm_fec_mdio_probe, > + .ops= &dm_fec_mdio_ops, > + .priv_auto = sizeof(struct dm_fec_mdio_priv), > +}; > + > +static int dm_fec_bind_mdio(struct udevice *dev) > +{ > + struct udevice *mdiodev; > + const char *name; > + ofnode mdio; > + int ret; > + > + /* for a UCLASS_MDIO driver we need to bind and probe manually > + * for an internal MDIO bus that has no dt compatible of its own > + */ > + ofnode_for_each_subnode(mdio, dev_ofnode(dev)) { > + name = ofnode_get_name(mdio); > + > + if (strcmp(name, "mdio")) > + continue; > + > + ret = device_bind_driver_to_node(dev, "fec_mdio", > + name, mdio, &mdiodev); > + if (ret) > + return ret; > + > + /* need to probe it as there is no compatible to do so */ > + ret = uclass_get_device_by_ofnode(UCLASS_MDIO, mdio, &mdiodev); > + if (!ret) > + return 0; > + > + break; > + } > + > + return ret; > +} > +#endif > + On which branch does this apply? The context above fecmxc_read_rom_hwaddr() is different in the branches I've checked: https://source.denx.de/u-boot/u-boot/-/blob/master/drivers/net/fec_mxc.c#L1276 https://source.denx.de/u-boot/custodians/u-boot-net/-/blob/next/drivers/net/fec_mxc.c#L1276 > static int fecmxc_read_rom_hwaddr(struct udevice *dev) > { > struct fec_priv *priv = dev_get_priv(dev); > @@ -1088,7 +1164,7 @@ static int device_get_phy_addr(struct fec_priv *priv, > struct udevice *dev) > > static int fec_phy_init(struct fec_priv *priv, struct udevice *dev) > { > - struct phy_device *phydev; > + struct phy_device *phydev = NULL; > int addr; > > addr = device_get_phy_addr(priv, dev); > @@ -1096,7 +1172,12 @@ static int fec_phy_init(struct fec_priv *priv, struct > udevice *dev) > addr = CONFIG_FEC_MXC_PHYADDR; > #endif > > - phydev = phy_connect(priv->bus, addr, dev, priv->interface); > +#ifdef CONFIG_DM_MDIO > + if (priv->dm_mdio) > + phydev = dm_eth_phy_connect(dev); > +#endif > + if (!phydev) > + phydev = phy_connect(priv->bus, addr, dev, priv->interface); > if (!phydev) > return -ENODEV; > > @@ -1227,11 +1308,19 @@ static int fecmxc_probe(struct udevice *dev) > > priv->dev_id = dev_seq(dev); > > +#ifdef CONFIG_DM_MDIO > + ret = dm_fec_bind_mdio(dev); > + if (!ret) { > + ret = fec_phy_init(priv, dev); > + if (!ret) > + priv->dm_mdio = true; > + } > +#endif > #ifdef CONFIG_DM_ETH_PHY > bus = eth_phy_get_mdio_bus(dev); > #endif > > - if (!bus) { > + if (!bus && !priv->dm_mdio) { > dm_m
Re: [PATCH 13/25] spi: cadence_qspi: Migrate CONFIG_CQSPI_REF_CLK to Kconfig
On Thu, Mar 31, 2022 at 10:00:52PM +0530, Pratyush Yadav wrote: > +Vignesh > > Hi Tom, > > On 30/03/22 06:07PM, Tom Rini wrote: > > This is a little tricky since SoCFPGA has code to determine this as > > runtime. Introduce a guard variable for platforms to select if they > > have a static value to use. Then for ARCH_SOCFPGA, call > > cm_get_qspi_controller_clk_hz() and otherwise continue the previous > > behavior. > > > > Cc: Jagan Teki > > Signed-off-by: Tom Rini > > --- > > arch/arm/mach-socfpga/misc_soc64.c | 1 + > > configs/j7200_evm_a72_defconfig| 2 ++ > > configs/j7200_evm_r5_defconfig | 2 ++ > > configs/j721e_evm_a72_defconfig| 2 ++ > > configs/j721e_evm_r5_defconfig | 2 ++ > > configs/j721e_hs_evm_a72_defconfig | 2 ++ > > configs/j721e_hs_evm_r5_defconfig | 2 ++ > > configs/j721s2_evm_a72_defconfig | 2 ++ > > configs/j721s2_evm_r5_defconfig| 2 ++ > > configs/k2g_evm_defconfig | 2 ++ > > configs/k2g_hs_evm_defconfig | 2 ++ > > configs/stv0991_defconfig | 2 ++ > > drivers/spi/Kconfig| 8 > > drivers/spi/cadence_qspi.c | 4 +++- > > drivers/spi/cadence_qspi.h | 1 + > > include/configs/j721e_evm.h| 1 - > > include/configs/j721s2_evm.h | 1 - > > include/configs/k2g_evm.h | 4 > > include/configs/socfpga_common.h | 9 - > > include/configs/socfpga_soc64_common.h | 5 - > > include/configs/stv0991.h | 8 > > 21 files changed, 35 insertions(+), 29 deletions(-) > > > > diff --git a/arch/arm/mach-socfpga/misc_soc64.c > > b/arch/arm/mach-socfpga/misc_soc64.c > > index 7b973a79e807..2acdfad07b35 100644 > > --- a/arch/arm/mach-socfpga/misc_soc64.c > > +++ b/arch/arm/mach-socfpga/misc_soc64.c > > @@ -16,6 +16,7 @@ > > #include > > #include > > #include > > +#include > > > > DECLARE_GLOBAL_DATA_PTR; > > > > diff --git a/configs/j7200_evm_a72_defconfig > > b/configs/j7200_evm_a72_defconfig > > index eb1d7d46b82a..3d0d1977ff99 100644 > > --- a/configs/j7200_evm_a72_defconfig > > +++ b/configs/j7200_evm_a72_defconfig > > @@ -173,6 +173,8 @@ CONFIG_SOC_TI=y > > CONFIG_SPI=y > > CONFIG_DM_SPI=y > > CONFIG_CADENCE_QSPI=y > > +CONFIG_HAS_CQSPI_REF_CLK=y > > +CONFIG_CQSPI_REF_CLK=1 > > CONFIG_SYSRESET=y > > CONFIG_SPL_SYSRESET=y > > CONFIG_SYSRESET_TI_SCI=y > > diff --git a/configs/j7200_evm_r5_defconfig b/configs/j7200_evm_r5_defconfig > > index e500a27bb692..0f4b006b80b5 100644 > > --- a/configs/j7200_evm_r5_defconfig > > +++ b/configs/j7200_evm_r5_defconfig > > @@ -134,6 +134,8 @@ CONFIG_SOC_TI=y > > CONFIG_SPI=y > > CONFIG_DM_SPI=y > > CONFIG_CADENCE_QSPI=y > > +CONFIG_HAS_CQSPI_REF_CLK=y > > +CONFIG_CQSPI_REF_CLK=1 > > This clock is configured to 166 MHz via device tree. I would prefer TI > platforms to use device tree and not set CONFIG_HAS_CQSPI_REF_CLK at > all. The clock _is_ 133 MHz by default but I think it is better if we > just return an error when clk_get fails. For these migration patches, it's important to not include functional changes as the same time in case there's problems later on (see for example the SYS_IMMR fix I merged today). So please send a follow-up to this patch or something vs master to disable the current behavior on the TI platforms. > > CONFIG_SYSRESET=y > > CONFIG_SPL_SYSRESET=y > > CONFIG_SYSRESET_TI_SCI=y > [...] > > diff --git a/drivers/spi/cadence_qspi.c b/drivers/spi/cadence_qspi.c > > index db680618ee9b..7209bb43a776 100644 > > --- a/drivers/spi/cadence_qspi.c > > +++ b/drivers/spi/cadence_qspi.c > > @@ -188,8 +188,10 @@ static int cadence_spi_probe(struct udevice *bus) > > if (plat->ref_clk_hz == 0) { > > ret = clk_get_by_index(bus, 0, &clk); > > if (ret) { > > -#ifdef CONFIG_CQSPI_REF_CLK > > +#ifdef CONFIG_HAS_CQSPI_REF_CLK > > plat->ref_clk_hz = CONFIG_CQSPI_REF_CLK; > > +#elif defined(CONFIG_ARCH_SOCFPGA) > > + plat->ref_clk_hz = cm_get_qspi_controller_clk_hz(); > > While you are here, please change all this to use if (IS_ENABLED()) > instead. In this case IS_ENABLED() does not increase readibity of the code nor increase static code coverage testing. -- Tom signature.asc Description: PGP signature
[PATCH 01/10] net: Remove armada100_fec driver
This driver is not enabled by any board and not converted to DM_ETH. Remove. Signed-off-by: Tom Rini --- drivers/net/Makefile| 1 - drivers/net/armada100_fec.c | 739 drivers/net/armada100_fec.h | 208 -- 3 files changed, 948 deletions(-) delete mode 100644 drivers/net/armada100_fec.c delete mode 100644 drivers/net/armada100_fec.h diff --git a/drivers/net/Makefile b/drivers/net/Makefile index a6d0c23f02d3..b57149b33994 100644 --- a/drivers/net/Makefile +++ b/drivers/net/Makefile @@ -6,7 +6,6 @@ obj-$(CONFIG_AG7XXX) += ag7xxx.o obj-$(CONFIG_ALTERA_TSE) += altera_tse.o -obj-$(CONFIG_ARMADA100_FEC) += armada100_fec.o obj-$(CONFIG_ASPEED_MDIO) += aspeed_mdio.o obj-$(CONFIG_BCM6348_ETH) += bcm6348-eth.o obj-$(CONFIG_BCM6368_ETH) += bcm6368-eth.o diff --git a/drivers/net/armada100_fec.c b/drivers/net/armada100_fec.c deleted file mode 100644 index 5d4b90c6ba72.. --- a/drivers/net/armada100_fec.c +++ /dev/null @@ -1,739 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0+ -/* - * (C) Copyright 2011 - * eInfochips Ltd. - * Written-by: Ajay Bhargav - * - * (C) Copyright 2010 - * Marvell Semiconductor - * Contributor: Mahavir Jain - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "armada100_fec.h" - -#define PHY_ADR_REQ 0xFF /* Magic number to read/write PHY address */ - -#ifdef DEBUG -static int eth_dump_regs(struct eth_device *dev) -{ - struct armdfec_device *darmdfec = to_darmdfec(dev); - struct armdfec_reg *regs = darmdfec->regs; - unsigned int i = 0; - - printf("\noffset: phy_adr, value: 0x%x\n", readl(®s->phyadr)); - printf("offset: smi, value: 0x%x\n", readl(®s->smi)); - for (i = 0x400; i <= 0x4e4; i += 4) - printf("offset: 0x%x, value: 0x%x\n", - i, readl(ARMD1_FEC_BASE + i)); - return 0; -} -#endif - -static int armdfec_phy_timeout(u32 *reg, u32 flag, int cond) -{ - u32 timeout = PHY_WAIT_ITERATIONS; - u32 reg_val; - - while (--timeout) { - reg_val = readl(reg); - if (cond && (reg_val & flag)) - break; - else if (!cond && !(reg_val & flag)) - break; - udelay(PHY_WAIT_MICRO_SECONDS); - } - return !timeout; -} - -static int smi_reg_read(struct mii_dev *bus, int phy_addr, int devad, - int phy_reg) -{ - u16 value = 0; - struct eth_device *dev = eth_get_dev_by_name(bus->name); - struct armdfec_device *darmdfec = to_darmdfec(dev); - struct armdfec_reg *regs = darmdfec->regs; - u32 val; - - if (phy_addr == PHY_ADR_REQ && phy_reg == PHY_ADR_REQ) { - val = readl(®s->phyadr); - value = val & 0x1f; - return value; - } - - /* check parameters */ - if (phy_addr > PHY_MASK) { - printf("ARMD100 FEC: (%s) Invalid phy address: 0x%X\n", - __func__, phy_addr); - return -EINVAL; - } - if (phy_reg > PHY_MASK) { - printf("ARMD100 FEC: (%s) Invalid register offset: 0x%X\n", - __func__, phy_reg); - return -EINVAL; - } - - /* wait for the SMI register to become available */ - if (armdfec_phy_timeout(®s->smi, SMI_BUSY, false)) { - printf("ARMD100 FEC: (%s) PHY busy timeout\n", __func__); - return -1; - } - - writel((phy_addr << 16) | (phy_reg << 21) | SMI_OP_R, ®s->smi); - - /* now wait for the data to be valid */ - if (armdfec_phy_timeout(®s->smi, SMI_R_VALID, true)) { - val = readl(®s->smi); - printf("ARMD100 FEC: (%s) PHY Read timeout, val=0x%x\n", - __func__, val); - return -1; - } - val = readl(®s->smi); - value = val & 0x; - - return value; -} - -static int smi_reg_write(struct mii_dev *bus, int phy_addr, int devad, -int phy_reg, u16 value) -{ - struct eth_device *dev = eth_get_dev_by_name(bus->name); - struct armdfec_device *darmdfec = to_darmdfec(dev); - struct armdfec_reg *regs = darmdfec->regs; - - if (phy_addr == PHY_ADR_REQ && phy_reg == PHY_ADR_REQ) { - clrsetbits_le32(®s->phyadr, 0x1f, value & 0x1f); - return 0; - } - - /* check parameters */ - if (phy_addr > PHY_MASK) { - printf("ARMD100 FEC: (%s) Invalid phy address\n", __func__); - return -EINVAL; - } - if (phy_reg > PHY_MASK) { - printf("ARMD100 FEC: (%s) Invalid register offset\n", __func__); - return -EINVAL; - } - - /* wait for the SMI register to become available */ - if (armdfec_phy
[PATCH 03/10] net: Remove cs8900 driver
This driver is not enabled by any board and not converted to DM_ETH. Remove. Signed-off-by: Tom Rini --- drivers/net/Makefile | 1 - drivers/net/cs8900.c | 320 --- drivers/net/cs8900.h | 248 - 3 files changed, 569 deletions(-) delete mode 100644 drivers/net/cs8900.c delete mode 100644 drivers/net/cs8900.h diff --git a/drivers/net/Makefile b/drivers/net/Makefile index 1d753bb7c202..967f82c5157e 100644 --- a/drivers/net/Makefile +++ b/drivers/net/Makefile @@ -15,7 +15,6 @@ obj-$(CONFIG_BCM_SF2_ETH_GMAC) += bcm-sf2-eth-gmac.o obj-$(CONFIG_BNXT_ETH) += bnxt/ obj-$(CONFIG_CALXEDA_XGMAC) += calxedaxgmac.o obj-$(CONFIG_CORTINA_NI_ENET) += cortina_ni.o -obj-$(CONFIG_CS8900) += cs8900.o obj-$(CONFIG_DM_ETH_PHY) += eth-phy-uclass.o obj-$(CONFIG_DNET) += dnet.o obj-$(CONFIG_DRIVER_DM9000) += dm9000x.o diff --git a/drivers/net/cs8900.c b/drivers/net/cs8900.c deleted file mode 100644 index 9440a91882f9.. --- a/drivers/net/cs8900.c +++ /dev/null @@ -1,320 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0+ -/* - * Cirrus Logic CS8900A Ethernet - * - * (C) 2009 Ben Warren , biggerbadder...@gmail.com - * Converted to use CONFIG_NET_MULTI API - * - * (C) 2003 Wolfgang Denk, w...@denx.de - * Extension to synchronize ethaddr environment variable - * against value in EEPROM - * - * (C) Copyright 2002 - * Sysgo Real-Time Solutions, GmbH - * Marius Groeger - * - * Copyright (C) 1999 Ben Williamson - * - * This program is loaded into SRAM in bootstrap mode, where it waits - * for commands on UART1 to read and write memory, jump to code etc. - * A design goal for this program is to be entirely independent of the - * target board. Anything with a CL-PS7111 or EP7211 should be able to run - * this code in bootstrap mode. All the board specifics can be handled on - * the host. - */ - -#include -#include -#include -#include -#include -#include -#include -#include "cs8900.h" - -#undef DEBUG - -/* packet page register access functions */ - -#ifdef CONFIG_CS8900_BUS32 - -#define REG_WRITE(v, a) writel((v),(a)) -#define REG_READ(a) readl((a)) - -/* we don't need 16 bit initialisation on 32 bit bus */ -#define get_reg_init_bus(r,d) get_reg((r),(d)) - -#else - -#define REG_WRITE(v, a) writew((v),(a)) -#define REG_READ(a) readw((a)) - -static u16 get_reg_init_bus(struct eth_device *dev, int regno) -{ - /* force 16 bit busmode */ - struct cs8900_priv *priv = (struct cs8900_priv *)(dev->priv); - uint8_t volatile * const iob = (uint8_t volatile * const)dev->iobase; - - readb(iob); - readb(iob + 1); - readb(iob); - readb(iob + 1); - readb(iob); - - REG_WRITE(regno, &priv->regs->pptr); - return REG_READ(&priv->regs->pdata); -} -#endif - -static u16 get_reg(struct eth_device *dev, int regno) -{ - struct cs8900_priv *priv = (struct cs8900_priv *)(dev->priv); - REG_WRITE(regno, &priv->regs->pptr); - return REG_READ(&priv->regs->pdata); -} - - -static void put_reg(struct eth_device *dev, int regno, u16 val) -{ - struct cs8900_priv *priv = (struct cs8900_priv *)(dev->priv); - REG_WRITE(regno, &priv->regs->pptr); - REG_WRITE(val, &priv->regs->pdata); -} - -static void cs8900_reset(struct eth_device *dev) -{ - int tmo; - u16 us; - - /* reset NIC */ - put_reg(dev, PP_SelfCTL, get_reg(dev, PP_SelfCTL) | PP_SelfCTL_Reset); - - /* wait for 200ms */ - udelay(20); - /* Wait until the chip is reset */ - - tmo = get_timer(0) + 1 * CONFIG_SYS_HZ; - while us = get_reg_init_bus(dev, PP_SelfSTAT)) & - PP_SelfSTAT_InitD) == 0) && tmo < get_timer(0)) - /*NOP*/; -} - -static void cs8900_reginit(struct eth_device *dev) -{ - /* receive only error free packets addressed to this card */ - put_reg(dev, PP_RxCTL, - PP_RxCTL_IA | PP_RxCTL_Broadcast | PP_RxCTL_RxOK); - /* do not generate any interrupts on receive operations */ - put_reg(dev, PP_RxCFG, 0); - /* do not generate any interrupts on transmit operations */ - put_reg(dev, PP_TxCFG, 0); - /* do not generate any interrupts on buffer operations */ - put_reg(dev, PP_BufCFG, 0); - /* enable transmitter/receiver mode */ - put_reg(dev, PP_LineCTL, PP_LineCTL_Rx | PP_LineCTL_Tx); -} - -void cs8900_get_enetaddr(struct eth_device *dev) -{ - int i; - - /* verify chip id */ - if (get_reg_init_bus(dev, PP_ChipID) != 0x630e) - return; - cs8900_reset(dev); - if ((get_reg(dev, PP_SelfSTAT) & - (PP_SelfSTAT_EEPROM | PP_SelfSTAT_EEPROM_OK)) == - (PP_SelfSTAT_EEPROM | PP_SelfSTAT_EEPROM_OK)) { - - /* Load the MAC from EEPROM */ - for (i = 0; i < 3; i++) { - u32 Addr; - - Addr = get_reg(dev, PP_IA + i * 2); -
[PATCH 05/10] net: Remove ftmac110 driver
This driver is not enabled by any board and not converted to DM_ETH. Remove. Signed-off-by: Tom Rini --- drivers/net/Makefile | 1 - drivers/net/ftmac110.c | 491 - drivers/net/ftmac110.h | 175 --- 3 files changed, 667 deletions(-) delete mode 100644 drivers/net/ftmac110.c delete mode 100644 drivers/net/ftmac110.h diff --git a/drivers/net/Makefile b/drivers/net/Makefile index 1fcd1b2d0b8d..4c4fe9b0b396 100644 --- a/drivers/net/Makefile +++ b/drivers/net/Makefile @@ -43,7 +43,6 @@ obj-$(CONFIG_FSL_MEMAC) += fm/memac_phy.o obj-$(CONFIG_FSL_PFE) += pfe_eth/ obj-$(CONFIG_FTGMAC100) += ftgmac100.o obj-$(CONFIG_FTMAC100) += ftmac100.o -obj-$(CONFIG_FTMAC110) += ftmac110.o obj-$(CONFIG_GMAC_ROCKCHIP) += gmac_rockchip.o obj-$(CONFIG_HIGMACV300_ETH) += higmacv300.o obj-$(CONFIG_KS8851_MLL) += ks8851_mll.o diff --git a/drivers/net/ftmac110.c b/drivers/net/ftmac110.c deleted file mode 100644 index 7e54d4642ddf.. --- a/drivers/net/ftmac110.c +++ /dev/null @@ -1,491 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0+ -/* - * Faraday 10/100Mbps Ethernet Controller - * - * (C) Copyright 2013 Faraday Technology - * Dante Su - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#if defined(CONFIG_MII) || defined(CONFIG_CMD_MII) -#include -#endif - -#include "ftmac110.h" - -#define CFG_RXDES_NUM 8 -#define CFG_TXDES_NUM 2 -#define CFG_XBUF_SIZE 1536 - -#define CFG_MDIORD_TIMEOUT (CONFIG_SYS_HZ >> 1) /* 500 ms */ -#define CFG_MDIOWR_TIMEOUT (CONFIG_SYS_HZ >> 1) /* 500 ms */ -#define CFG_LINKUP_TIMEOUT (CONFIG_SYS_HZ << 2) /* 4 sec */ - -/* - * FTMAC110 DMA design issue - * - * Its DMA engine has a weird restriction that its Rx DMA engine - * accepts only 16-bits aligned address, 32-bits aligned is not - * acceptable. However this restriction does not apply to Tx DMA. - * - * Conclusion: - * (1) Tx DMA Buffer Address: - * 1 bytes aligned: Invalid - * 2 bytes aligned: O.K - * 4 bytes aligned: O.K (-> u-boot ZeroCopy is possible) - * (2) Rx DMA Buffer Address: - * 1 bytes aligned: Invalid - * 2 bytes aligned: O.K - * 4 bytes aligned: Invalid - */ - -struct ftmac110_chip { - void __iomem *regs; - uint32_t imr; - uint32_t maccr; - uint32_t lnkup; - uint32_t phy_addr; - - struct ftmac110_desc *rxd; - ulongrxd_dma; - uint32_t rxd_idx; - - struct ftmac110_desc *txd; - ulongtxd_dma; - uint32_t txd_idx; -}; - -static int ftmac110_reset(struct eth_device *dev); - -static uint16_t mdio_read(struct eth_device *dev, - uint8_t phyaddr, uint8_t phyreg) -{ - struct ftmac110_chip *chip = dev->priv; - struct ftmac110_regs *regs = chip->regs; - uint32_t tmp, ts; - uint16_t ret = 0x; - - tmp = PHYCR_READ - | (phyaddr << PHYCR_ADDR_SHIFT) - | (phyreg << PHYCR_REG_SHIFT); - - writel(tmp, ®s->phycr); - - for (ts = get_timer(0); get_timer(ts) < CFG_MDIORD_TIMEOUT; ) { - tmp = readl(®s->phycr); - if (tmp & PHYCR_READ) - continue; - break; - } - - if (tmp & PHYCR_READ) - printf("ftmac110: mdio read timeout\n"); - else - ret = (uint16_t)(tmp & 0x); - - return ret; -} - -static void mdio_write(struct eth_device *dev, - uint8_t phyaddr, uint8_t phyreg, uint16_t phydata) -{ - struct ftmac110_chip *chip = dev->priv; - struct ftmac110_regs *regs = chip->regs; - uint32_t tmp, ts; - - tmp = PHYCR_WRITE - | (phyaddr << PHYCR_ADDR_SHIFT) - | (phyreg << PHYCR_REG_SHIFT); - - writel(phydata, ®s->phydr); - writel(tmp, ®s->phycr); - - for (ts = get_timer(0); get_timer(ts) < CFG_MDIOWR_TIMEOUT; ) { - if (readl(®s->phycr) & PHYCR_WRITE) - continue; - break; - } - - if (readl(®s->phycr) & PHYCR_WRITE) - printf("ftmac110: mdio write timeout\n"); -} - -static uint32_t ftmac110_phyqry(struct eth_device *dev) -{ - ulong ts; - uint32_t maccr; - uint16_t pa, tmp, bmsr, bmcr; - struct ftmac110_chip *chip = dev->priv; - - /* Default = 100Mbps Full */ - maccr = MACCR_100M | MACCR_FD; - - /* 1. find the phy device */ - for (pa = 0; pa < 32; ++pa) { - tmp = mdio_read(dev, pa, MII_PHYSID1); - if (tmp == 0x || tmp == 0x) - continue; - chip->phy_addr = pa; - break; - } - if (pa >= 32) { - puts("ftmac110: phy device not found!\n"); - goto exit; - } - - /* 2. wait until link-up & auto-negotiation complete */ - chip->lnkup = 0; - bmcr = mdio_read(dev, chip->phy
[PATCH 02/10] net: Remove ax88180 driver
This driver is not enabled by any board and not converted to DM_ETH. Remove. Signed-off-by: Tom Rini --- drivers/net/Makefile | 1 - drivers/net/ax88180.c | 755 -- drivers/net/ax88180.h | 396 -- 3 files changed, 1152 deletions(-) delete mode 100644 drivers/net/ax88180.c delete mode 100644 drivers/net/ax88180.h diff --git a/drivers/net/Makefile b/drivers/net/Makefile index b57149b33994..1d753bb7c202 100644 --- a/drivers/net/Makefile +++ b/drivers/net/Makefile @@ -18,7 +18,6 @@ obj-$(CONFIG_CORTINA_NI_ENET) += cortina_ni.o obj-$(CONFIG_CS8900) += cs8900.o obj-$(CONFIG_DM_ETH_PHY) += eth-phy-uclass.o obj-$(CONFIG_DNET) += dnet.o -obj-$(CONFIG_DRIVER_AX88180) += ax88180.o obj-$(CONFIG_DRIVER_DM9000) += dm9000x.o obj-$(CONFIG_DSA_SANDBOX) += dsa_sandbox.o obj-$(CONFIG_DWC_ETH_QOS) += dwc_eth_qos.o diff --git a/drivers/net/ax88180.c b/drivers/net/ax88180.c deleted file mode 100644 index 402bcdb63ed7.. --- a/drivers/net/ax88180.c +++ /dev/null @@ -1,755 +0,0 @@ -/* - * ax88180: ASIX AX88180 Non-PCI Gigabit Ethernet u-boot driver - * - * This program is free software; you can distribute it and/or modify - * it under the terms of the GNU General Public License (Version 2) as - * published by the Free Software Foundation. - * This program is distributed in the hope it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * See the GNU General Public License for more details. - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston MA 02111-1307, - * USA. - */ - -/* - * - * ASIX AX88180 Non-PCI 16/32-bit Gigabit Ethernet Linux Driver - * - * The AX88180 Ethernet controller is a high performance and highly - * integrated local CPU bus Ethernet controller with embedded 40K bytes - * SRAM and supports both 16-bit and 32-bit SRAM-Like interfaces for any - * embedded systems. - * The AX88180 is a single chip 10/100/1000Mbps Gigabit Ethernet - * controller that supports both MII and RGMII interfaces and is - * compliant to IEEE 802.3, IEEE 802.3u and IEEE 802.3z standards. - * - * Please visit ASIX's web site (http://www.asix.com.tw) for more - * details. - * - * Module Name : ax88180.c - * Date: 2008-07-07 - * History - * 09/06/2006 : New release for AX88180 US2 chip. - * 07/07/2008 : Fix up the coding style and using inline functions - * instead of macros - * - */ -#include -#include -#include -#include -#include -#include -#include -#include "ax88180.h" - -/* - * === - * Local SubProgram Declaration - * === - */ -static void ax88180_rx_handler (struct eth_device *dev); -static int ax88180_phy_initial (struct eth_device *dev); -static void ax88180_media_config (struct eth_device *dev); -static unsigned long get_CicadaPHY_media_mode (struct eth_device *dev); -static unsigned long get_MarvellPHY_media_mode (struct eth_device *dev); -static unsigned short ax88180_mdio_read (struct eth_device *dev, -unsigned long regaddr); -static void ax88180_mdio_write (struct eth_device *dev, - unsigned long regaddr, unsigned short regdata); - -/* - * === - * Local SubProgram Bodies - * === - */ -static int ax88180_mdio_check_complete (struct eth_device *dev) -{ - int us_cnt = 1; - unsigned short tmpval; - - /* MDIO read/write should not take more than 10 ms */ - while (--us_cnt) { - tmpval = INW (dev, MDIOCTRL); - if (((tmpval & READ_PHY) == 0) && ((tmpval & WRITE_PHY) == 0)) - break; - } - - return us_cnt; -} - -static unsigned short -ax88180_mdio_read (struct eth_device *dev, unsigned long regaddr) -{ - struct ax88180_private *priv = (struct ax88180_private *)dev->priv; - unsigned long tmpval = 0; - - OUTW (dev, (READ_PHY | (regaddr << 8) | priv->PhyAddr), MDIOCTRL); - - if (ax88180_mdio_check_complete (dev)) - tmpval = INW (dev, MDIODP); - else - printf ("Failed to read PHY register!\n"); - - return (unsigned short)(tmpval & 0x); -} - -static void -ax88180_mdio_write (struct eth_device *dev, unsigned long regaddr, - unsigned short regdata) -{ - struct ax88180_private *priv = (struct ax88180_private *)dev->priv; - -
[PATCH 07/10] net: Remove natsemi driver
This driver is not enabled by any board and not converted to DM_ETH. Remove. Signed-off-by: Tom Rini --- drivers/net/Makefile | 1 - drivers/net/natsemi.c | 883 -- 2 files changed, 884 deletions(-) delete mode 100644 drivers/net/natsemi.c diff --git a/drivers/net/Makefile b/drivers/net/Makefile index be3264e04133..f902f0d06c26 100644 --- a/drivers/net/Makefile +++ b/drivers/net/Makefile @@ -64,7 +64,6 @@ obj-$(CONFIG_MVGBE) += mvgbe.o obj-$(CONFIG_MVMDIO) += mvmdio.o obj-$(CONFIG_MVNETA) += mvneta.o obj-$(CONFIG_MVPP2) += mvpp2.o -obj-$(CONFIG_NATSEMI) += natsemi.o obj-$(CONFIG_NETCONSOLE) += netconsole.o obj-$(CONFIG_NET_OCTEONTX) += octeontx/ obj-$(CONFIG_NET_OCTEONTX2) += octeontx2/ diff --git a/drivers/net/natsemi.c b/drivers/net/natsemi.c deleted file mode 100644 index bfd8cc396b98.. --- a/drivers/net/natsemi.c +++ /dev/null @@ -1,883 +0,0 @@ -/* - natsemi.c: A U-Boot driver for the NatSemi DP8381x series. - Author: Mark A. Rakes (mark_ra...@vivato.net) - - Adapted from an Etherboot driver written by: - - Copyright (C) 2001 Entity Cyber, Inc. - - This development of this Etherboot driver was funded by - - Sicom Systems: http://www.sicompos.com/ - - Author: Marty Connor (m...@thinguin.org) - Adapted from a Linux driver which was written by Donald Becker - - This software may be used and distributed according to the terms - of the GNU Public License (GPL), incorporated herein by reference. - - Original Copyright Notice: - - Written/copyright 1999-2001 by Donald Becker. - - This software may be used and distributed according to the terms of - the GNU General Public License (GPL), incorporated herein by reference. - Drivers based on or derived from this code fall under the GPL and must - retain the authorship, copyright and license notice. This file is not - a complete program and may only be used when the entire operating - system is licensed under the GPL. License for under other terms may be - available. Contact the original author for details. - - The original author may be reached as bec...@scyld.com, or at - Scyld Computing Corporation - 410 Severn Ave., Suite 210 - Annapolis MD 21403 - - Support information and updates available at - http://www.scyld.com/network/netsemi.html - - References: - http://www.scyld.com/expert/100mbps.html - http://www.scyld.com/expert/NWay.html - Datasheet is available from: - http://www.national.com/pf/DP/DP83815.html -*/ - -/* Revision History - * October 2002 mar1.0 - * Initial U-Boot Release. Tested with Netgear FA311 board - * and dp83815 chipset on custom board -*/ - -/* Includes */ -#include -#include -#include -#include -#include -#include -#include - -/* defines */ -#define EEPROM_SIZE 0xb /*12 16-bit chunks, or 24 bytes*/ - -#define DSIZE 0x0FFF -#define CRC_SIZE 4 -#define TOUT_LOOP 50 -#define TX_BUF_SIZE1536 -#define RX_BUF_SIZE1536 -#define NUM_RX_DESC4 /* Number of Rx descriptor registers. */ - -/* Offsets to the device registers. - Unlike software-only systems, device drivers interact with complex hardware. - It's not useful to define symbolic names for every register bit in the - device. */ -enum register_offsets { - ChipCmd = 0x00, - ChipConfig = 0x04, - EECtrl = 0x08, - IntrMask= 0x14, - IntrEnable = 0x18, - TxRingPtr = 0x20, - TxConfig= 0x24, - RxRingPtr = 0x30, - RxConfig= 0x34, - ClkRun = 0x3C, - RxFilterAddr= 0x48, - RxFilterData= 0x4C, - SiliconRev = 0x58, - PCIPM = 0x44, - BasicControl= 0x80, - BasicStatus = 0x84, - /* These are from the spec, around page 78... on a separate table. */ - PGSEL = 0xCC, - PMDCSR = 0xE4, - TSTDAT = 0xFC, - DSPCFG = 0xF4, - SDCFG = 0x8C -}; - -/* Bit in ChipCmd. */ -enum ChipCmdBits { - ChipReset = 0x100, - RxReset = 0x20, - TxReset = 0x10, - RxOff = 0x08, - RxOn= 0x04, - TxOff = 0x02, - TxOn= 0x01 -}; - -enum ChipConfigBits { - LinkSts = 0x8000, - HundSpeed = 0x4000, - FullDuplex = 0x2000, - TenPolarity = 0x1000, - AnegDone= 0x0800, - AnegEnBothBoth = 0xE000, - AnegDis100Full = 0xC000, - AnegEn100Both = 0xA000, - AnegDis100Half = 0x8000, - AnegEnBothHalf = 0x6000, - AnegDis10Full = 0x4000, - AnegEn10Both= 0x2000, - DuplexMask = 0x8000, - SpeedMask = 0x4000, - AnegMask= 0x2000, - AnegDis10Half = 0x, - ExtPhy = 0x00
[PATCH 08/10] net: Remove ns8382x driver
This driver is not enabled by any board and not converted to DM_ETH. Remove. Signed-off-by: Tom Rini --- drivers/net/Makefile | 1 - drivers/net/ns8382x.c | 854 -- 2 files changed, 855 deletions(-) delete mode 100644 drivers/net/ns8382x.c diff --git a/drivers/net/Makefile b/drivers/net/Makefile index f902f0d06c26..02b36582ce46 100644 --- a/drivers/net/Makefile +++ b/drivers/net/Makefile @@ -67,7 +67,6 @@ obj-$(CONFIG_MVPP2) += mvpp2.o obj-$(CONFIG_NETCONSOLE) += netconsole.o obj-$(CONFIG_NET_OCTEONTX) += octeontx/ obj-$(CONFIG_NET_OCTEONTX2) += octeontx2/ -obj-$(CONFIG_NS8382X) += ns8382x.o obj-$(CONFIG_OCTEONTX2_CGX_INTF) += octeontx2/cgx_intf.o obj-$(CONFIG_OCTEONTX_SMI) += octeontx/smi.o obj-$(CONFIG_PCH_GBE) += pch_gbe.o diff --git a/drivers/net/ns8382x.c b/drivers/net/ns8382x.c deleted file mode 100644 index d79872af0936.. --- a/drivers/net/ns8382x.c +++ /dev/null @@ -1,854 +0,0 @@ -/* - ns8382x.c: A U-Boot driver for the NatSemi DP8382[01]. - ported by: Mark A. Rakes (mark_ra...@vivato.net) - - Adapted from: - 1. an Etherboot driver for DP8381[56] written by: - Copyright (C) 2001 Entity Cyber, Inc. - - This development of this Etherboot driver was funded by - Sicom Systems: http://www.sicompos.com/ - - Author: Marty Connor (m...@thinguin.org) - Adapted from a Linux driver which was written by Donald Becker - - This software may be used and distributed according to the terms - of the GNU Public License (GPL), incorporated herein by reference. - - 2. A Linux driver by Donald Becker, ns820.c: - Written/copyright 1999-2002 by Donald Becker. - - This software may be used and distributed according to the terms of - the GNU General Public License (GPL), incorporated herein by reference. - Drivers based on or derived from this code fall under the GPL and must - retain the authorship, copyright and license notice. This file is not - a complete program and may only be used when the entire operating - system is licensed under the GPL. License for under other terms may be - available. Contact the original author for details. - - The original author may be reached as bec...@scyld.com, or at - Scyld Computing Corporation - 410 Severn Ave., Suite 210 - Annapolis MD 21403 - - Support information and updates available at - http://www.scyld.com/network/netsemi.html - - Datasheets available from: - http://www.national.com/pf/DP/DP83820.html - http://www.national.com/pf/DP/DP83821.html -*/ - -/* Revision History - * October 2002 mar1.0 - * Initial U-Boot Release. - * Tested with Netgear GA622T (83820) - * and SMC9452TX (83821) - * NOTE: custom boards with these chips may (likely) require - * a programmed EEPROM device (if present) in order to work - * correctly. -*/ - -/* Includes */ -#include -#include -#include -#include -#include -#include -#include -#include - -/* defines */ -#define DSIZE 0x0FFF -#define CRC_SIZE 4 -#define TOUT_LOOP 50 -#define TX_BUF_SIZE1536 -#define RX_BUF_SIZE1536 -#define NUM_RX_DESC4 /* Number of Rx descriptor registers. */ - -enum register_offsets { - ChipCmd = 0x00, - ChipConfig = 0x04, - EECtrl = 0x08, - IntrMask = 0x14, - IntrEnable = 0x18, - TxRingPtr = 0x20, - TxRingPtrHi = 0x24, - TxConfig = 0x28, - RxRingPtr = 0x30, - RxRingPtrHi = 0x34, - RxConfig = 0x38, - PriQueue = 0x3C, - RxFilterAddr = 0x48, - RxFilterData = 0x4C, - ClkRun = 0xCC, - PCIPM = 0x44, -}; - -enum ChipCmdBits { - ChipReset = 0x100, - RxReset = 0x20, - TxReset = 0x10, - RxOff = 0x08, - RxOn = 0x04, - TxOff = 0x02, - TxOn = 0x01 -}; - -enum ChipConfigBits { - LinkSts = 0x8000, - GigSpeed = 0x4000, - HundSpeed = 0x2000, - FullDuplex = 0x1000, - TBIEn = 0x0100, - Mode1000 = 0x0040, - T64En = 0x4000, - D64En = 0x1000, - M64En = 0x0800, - PhyRst = 0x0400, - PhyDis = 0x0200, - ExtStEn = 0x0100, - BEMode = 0x0001, -}; -#define SpeedStatus_Polarity ( GigSpeed | HundSpeed | FullDuplex) - -enum TxConfig_bits { - TxDrthMask = 0x00ff, - TxFlthMask = 0xff00, - TxMxdmaMask = 0x0070, - TxMxdma_8 = 0x0010, - TxMxdma_16 = 0x0020, - TxMxdma_32 = 0x0030, - TxMxdma_64 = 0x0040, - TxMxdma_128 = 0x0050, - TxMxdma_256 = 0x0060, - TxMxdma_512 = 0x0070, - TxMxdma_1024= 0x, - TxCollRetry = 0x
[PATCH 09/10] net: Remove uli526x driver
This driver is not enabled by any board and not converted to DM_ETH. Remove. Signed-off-by: Tom Rini --- drivers/net/Makefile | 1 - drivers/net/uli526x.c | 996 -- 2 files changed, 997 deletions(-) delete mode 100644 drivers/net/uli526x.c diff --git a/drivers/net/Makefile b/drivers/net/Makefile index 02b36582ce46..69570bebb447 100644 --- a/drivers/net/Makefile +++ b/drivers/net/Makefile @@ -85,7 +85,6 @@ obj-$(CONFIG_SUN4I_EMAC) += sunxi_emac.o obj-$(CONFIG_SUN8I_EMAC) += sun8i_emac.o obj-$(CONFIG_TSEC_ENET) += tsec.o fsl_mdio.o obj-$(CONFIG_TULIP) += dc2114x.o -obj-$(CONFIG_ULI526X) += uli526x.o obj-$(CONFIG_VSC7385_ENET) += vsc7385.o obj-$(CONFIG_VSC9953) += vsc9953.o obj-$(CONFIG_XILINX_AXIEMAC) += xilinx_axi_emac.o diff --git a/drivers/net/uli526x.c b/drivers/net/uli526x.c deleted file mode 100644 index 3191868cae5a.. --- a/drivers/net/uli526x.c +++ /dev/null @@ -1,996 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0+ -/* - * Copyright 2007, 2010 Freescale Semiconductor, Inc. - * - * Author: Roy Zang , Sep, 2007 - * - * Description: - * ULI 526x Ethernet port driver. - * Based on the Linux driver: drivers/net/tulip/uli526x.c - */ - -#include -#include -#include -#include -#include -#include -#include -#include - -/* some kernel function compatible define */ - -#undef DEBUG - -/* Board/System/Debug information/definition */ -#define ULI_VENDOR_ID 0x10B9 -#define ULI5261_DEVICE_ID 0x5261 -#define ULI5263_DEVICE_ID 0x5263 -/* ULi M5261 ID*/ -#define PCI_ULI5261_ID (ULI5261_DEVICE_ID << 16 | ULI_VENDOR_ID) -/* ULi M5263 ID*/ -#define PCI_ULI5263_ID (ULI5263_DEVICE_ID << 16 | ULI_VENDOR_ID) - -#define ULI526X_IO_SIZE0x100 -#define TX_DESC_CNT0x10/* Allocated Tx descriptors */ -#define RX_DESC_CNTPKTBUFSRX /* Allocated Rx descriptors */ -#define TX_FREE_DESC_CNT (TX_DESC_CNT - 2) /* Max TX packet count */ -#define TX_WAKE_DESC_CNT (TX_DESC_CNT - 3) /* TX wakeup count */ -#define DESC_ALL_CNT (TX_DESC_CNT + RX_DESC_CNT) -#define TX_BUF_ALLOC 0x300 -#define RX_ALLOC_SIZE PKTSIZE -#define ULI526X_RESET 1 -#define CR0_DEFAULT0 -#define CR6_DEFAULT0x2220 -#define CR7_DEFAULT0x180c1 -#define CR15_DEFAULT 0x06/* TxJabber RxWatchdog */ -#define TDES0_ERR_MASK 0x4302 /* TXJT, LC, EC, FUE */ -#define MAX_PACKET_SIZE1514 -#define ULI5261_MAX_MULTICAST 14 -#define RX_COPY_SIZE 100 -#define MAX_CHECK_PACKET 0x8000 - -#define ULI526X_10MHF 0 -#define ULI526X_100MHF 1 -#define ULI526X_10MFD 4 -#define ULI526X_100MFD 5 -#define ULI526X_AUTO 8 - -#define ULI526X_TXTH_720x40/* TX TH 72 byte */ -#define ULI526X_TXTH_960x404000/* TX TH 96 byte */ -#define ULI526X_TXTH_128 0x /* TX TH 128 byte */ -#define ULI526X_TXTH_256 0x4000 /* TX TH 256 byte */ -#define ULI526X_TXTH_512 0x8000 /* TX TH 512 byte */ -#define ULI526X_TXTH_1K0xC000 /* TX TH 1K byte */ - -/* CR9 definition: SROM/MII */ -#define CR9_SROM_READ 0x4800 -#define CR9_SRCS 0x1 -#define CR9_SRCLK 0x2 -#define CR9_CRDOUT 0x8 -#define SROM_DATA_00x0 -#define SROM_DATA_10x4 -#define PHY_DATA_1 0x2 -#define PHY_DATA_0 0x0 -#define MDCLKH 0x1 - -#define PHY_POWER_DOWN 0x800 - -#define SROM_V41_CODE 0x14 - -#define SROM_CLK_WRITE(data, ioaddr) do { \ - outl(data|CR9_SROM_READ|CR9_SRCS, ioaddr); \ - udelay(5); \ - outl(data|CR9_SROM_READ|CR9_SRCS|CR9_SRCLK, ioaddr);\ - udelay(5); \ - outl(data|CR9_SROM_READ|CR9_SRCS, ioaddr); \ - udelay(5); \ - } while (0) - -/* Structure/enum declaration */ - -struct tx_desc { - u32 tdes0, tdes1, tdes2, tdes3; /* Data for the card */ - char *tx_buf_ptr; /* Data for us */ - struct tx_desc *next_tx_desc; -}; - -struct rx_desc { - u32 rdes0, rdes1, rdes2, rdes3; /* Data for the card */ - char *rx_buf_ptr; /* Data for us */ - struct rx_desc *next_rx_desc; -}; - -struct uli526x_board_info { - u32 chip_id;/* Chip vendor/Device ID */ - pci_dev_t pdev; - - long ioaddr;/* I/O base address */ - u32 cr0_data; - u32 cr5_data; - u32 cr6_data; - u32 cr7_data; - u32 cr15_data; - - /* pointer for memory physical address */ - dma_addr_t buf_pool_dma_ptr;/* Tx buffer pool memory */ - dma
[PATCH 06/10] net: Remove lan91c96 driver
This driver is not enabled by any board and not converted to DM_ETH. Remove. Signed-off-by: Tom Rini --- drivers/net/Makefile | 1 - drivers/net/lan91c96.c | 799 - drivers/net/lan91c96.h | 616 --- 3 files changed, 1416 deletions(-) delete mode 100644 drivers/net/lan91c96.c delete mode 100644 drivers/net/lan91c96.h diff --git a/drivers/net/Makefile b/drivers/net/Makefile index 4c4fe9b0b396..be3264e04133 100644 --- a/drivers/net/Makefile +++ b/drivers/net/Makefile @@ -47,7 +47,6 @@ obj-$(CONFIG_GMAC_ROCKCHIP) += gmac_rockchip.o obj-$(CONFIG_HIGMACV300_ETH) += higmacv300.o obj-$(CONFIG_KS8851_MLL) += ks8851_mll.o obj-$(CONFIG_KSZ9477) += ksz9477.o -obj-$(CONFIG_LAN91C96) += lan91c96.o obj-$(CONFIG_LPC32XX_ETH) += lpc32xx_eth.o obj-$(CONFIG_MACB) += macb.o obj-$(CONFIG_MCFFEC) += mcffec.o mcfmii.o diff --git a/drivers/net/lan91c96.c b/drivers/net/lan91c96.c deleted file mode 100644 index c2f611144db6.. --- a/drivers/net/lan91c96.c +++ /dev/null @@ -1,799 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0+ -/* - * lan91c96.c - * This is a driver for SMSC's LAN91C96 single-chip Ethernet device, based - * on the SMC9 driver from U-Boot. - * - * (C) Copyright 2002 - * Sysgo Real-Time Solutions, GmbH - * Rolf Offermanns - * - * Copyright (C) 2001 Standard Microsystems Corporation (SMSC) - * Developed by Simple Network Magic Corporation (SNMC) - * Copyright (C) 1996 by Erik Stahlman (ES) - * - * Information contained in this file was obtained from the LAN91C96 - * manual from SMC. To get a copy, if you really want one, you can find - * information under www.smsc.com. - * - * "Features" of the SMC chip: - * 6144 byte packet memory. ( for the 91C96 ) - * EEPROM for configuration - * AUI/TP selection ( mine has 10Base2/10BaseT select ) - * - * Arguments: - * io = for the base address - * irq = for the IRQ - * - * author: - * Erik Stahlman ( e...@vt.edu ) - * Daris A Nevil ( dne...@snmc.com ) - * - * - * Hardware multicast code from Peter Cammaert ( p...@denkart.be ) - * - * Sources: - *o SMSC LAN91C96 databook (www.smsc.com) - *o smc9.c (u-boot driver) - *o smc9194.c (linux kernel driver) - *o lan91c96.c (Intel Diagnostic Manager driver) - * - * History: - * 04/30/03 Mathijs Haarman Modified smc9.c (u-boot version) - * for lan91c96 - *--- - */ - -#include -#include -#include -#include -#include -#include "lan91c96.h" -#include -#include - -/* - * - * Configuration options, for the experienced user to change. - * - -*/ - -/* Use power-down feature of the chip */ -#define POWER_DOWN 0 - -/* - * Wait time for memory to be free. This probably shouldn't be - * tuned that much, as waiting for this means nothing else happens - * in the system -*/ -#define MEMORY_WAIT_TIME 16 - -#define SMC_DEBUG 0 - -#if (SMC_DEBUG > 2 ) -#define PRINTK3(args...) printf(args) -#else -#define PRINTK3(args...) -#endif - -#if SMC_DEBUG > 1 -#define PRINTK2(args...) printf(args) -#else -#define PRINTK2(args...) -#endif - -#ifdef SMC_DEBUG -#define PRINTK(args...) printf(args) -#else -#define PRINTK(args...) -#endif - - -/* - * - * The internal workings of the driver. If you are changing anything - * here with the SMC stuff, you should have the datasheet and know - * what you are doing. - * - * - */ -#define DRIVER_NAME "LAN91C96" -#define SMC_ALLOC_MAX_TRY 5 -#define SMC_TX_TIMEOUT 30 - -#define ETH_ZLEN 60 - -#ifdef CONFIG_LAN91C96_USE_32_BIT -#define USE_32_BIT 1 -#else -#undef USE_32_BIT -#endif - -/* See if a MAC address is defined in the current environment. If so use it. If not - . print a warning and set the environment and other globals with the default. - . If an EEPROM is present it really should be consulted. -*/ -static int smc_get_ethaddr(struct bd_info *bd, struct eth_device *dev); -static int get_rom_mac(struct eth_device *dev, unsigned char *v_rom_mac); - -/* - * Internal routines - * - */ - -static unsigned char smc_mac_addr[] = { 0xc0, 0x00, 0x00, 0x1b, 0x62, 0x9c }; - -/* - * This function must be called before smc_open() if you want to override - * the default mac address. - */ - -static void smc_set_mac_addr(const unsigned char *addr) -{ - int i; - - for (i = 0; i < sizeof (smc_mac_addr); i++
[PATCH 04/10] net: Remove dnet driver
This driver is not enabled by any board and not converted to DM_ETH. Remove. Signed-off-by: Tom Rini --- drivers/net/Makefile | 1 - drivers/net/dnet.c | 395 --- drivers/net/dnet.h | 166 -- 3 files changed, 562 deletions(-) delete mode 100644 drivers/net/dnet.c delete mode 100644 drivers/net/dnet.h diff --git a/drivers/net/Makefile b/drivers/net/Makefile index 967f82c5157e..1fcd1b2d0b8d 100644 --- a/drivers/net/Makefile +++ b/drivers/net/Makefile @@ -16,7 +16,6 @@ obj-$(CONFIG_BNXT_ETH) += bnxt/ obj-$(CONFIG_CALXEDA_XGMAC) += calxedaxgmac.o obj-$(CONFIG_CORTINA_NI_ENET) += cortina_ni.o obj-$(CONFIG_DM_ETH_PHY) += eth-phy-uclass.o -obj-$(CONFIG_DNET) += dnet.o obj-$(CONFIG_DRIVER_DM9000) += dm9000x.o obj-$(CONFIG_DSA_SANDBOX) += dsa_sandbox.o obj-$(CONFIG_DWC_ETH_QOS) += dwc_eth_qos.o diff --git a/drivers/net/dnet.c b/drivers/net/dnet.c deleted file mode 100644 index fbcf15f26801.. --- a/drivers/net/dnet.c +++ /dev/null @@ -1,395 +0,0 @@ -/* - * Dave Ethernet Controller driver - * - * Copyright (C) 2008 Dave S.r.l. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - */ - -#include -#include -#include - -#ifndef CONFIG_DNET_AUTONEG_TIMEOUT -#define CONFIG_DNET_AUTONEG_TIMEOUT500 /* default value */ -#endif - -#include -#include -#include - -#include -#include -#include - -#include "dnet.h" - -struct dnet_device { - struct dnet_registers *regs; - const struct device *dev; - struct eth_device netdev; - unsigned short phy_addr; -}; - -/* get struct dnet_device from given struct netdev */ -#define to_dnet(_nd) container_of(_nd, struct dnet_device, netdev) - -/* function for reading internal MAC register */ -u16 dnet_readw_mac(struct dnet_device *dnet, u16 reg) -{ - u16 data_read; - - /* issue a read */ - writel(reg, &dnet->regs->MACREG_ADDR); - - /* since a read/write op to the MAC is very slow, -* we must wait before reading the data */ - udelay(1); - - /* read data read from the MAC register */ - data_read = readl(&dnet->regs->MACREG_DATA); - - /* all done */ - return data_read; -} - -/* function for writing internal MAC register */ -void dnet_writew_mac(struct dnet_device *dnet, u16 reg, u16 val) -{ - /* load data to write */ - writel(val, &dnet->regs->MACREG_DATA); - - /* issue a write */ - writel(reg | DNET_INTERNAL_WRITE, &dnet->regs->MACREG_ADDR); - - /* since a read/write op to the MAC is very slow, -* we must wait before exiting */ - udelay(1); -} - -static void dnet_mdio_write(struct dnet_device *dnet, u8 reg, u16 value) -{ - u16 tmp; - - debug(DRIVERNAME "dnet_mdio_write %02x:%02x <- %04x\n", - dnet->phy_addr, reg, value); - - while (!(dnet_readw_mac(dnet, DNET_INTERNAL_GMII_MNG_CTL_REG) & - DNET_INTERNAL_GMII_MNG_CMD_FIN)) - ; - - /* prepare for a write operation */ - tmp = (1 << 13); - - /* only 5 bits allowed for register offset */ - reg &= 0x1f; - - /* prepare reg_value for a write */ - tmp |= (dnet->phy_addr << 8); - tmp |= reg; - - /* write data to write first */ - dnet_writew_mac(dnet, DNET_INTERNAL_GMII_MNG_DAT_REG, value); - - /* write control word */ - dnet_writew_mac(dnet, DNET_INTERNAL_GMII_MNG_CTL_REG, tmp); - - while (!(dnet_readw_mac(dnet, DNET_INTERNAL_GMII_MNG_CTL_REG) & - DNET_INTERNAL_GMII_MNG_CMD_FIN)) - ; -} - -static u16 dnet_mdio_read(struct dnet_device *dnet, u8 reg) -{ - u16 value; - - while (!(dnet_readw_mac(dnet, DNET_INTERNAL_GMII_MNG_CTL_REG) & - DNET_INTERNAL_GMII_MNG_CMD_FIN)) - ; - - /* only 5 bits allowed for register offset*/ - reg &= 0x1f; - - /* prepare reg_value for a read */ - value = (dnet->phy_addr << 8); - value |= reg; - - /* write control word */ - dnet_writew_mac(dnet, DNET_INTERNAL_GMII_MNG_CTL_REG, value); - - /* wait for end of transfer */ - while (!(dnet_readw_mac(dnet, DNET_INTERNAL_GMII_MNG_CTL_REG) & - DNET_INTERNAL_GMII_MNG_CMD_FIN)) - ; - - value = dnet_readw_mac(dnet, DNET_INTERNAL_GMII_MNG_DAT_REG); - - debug(DRIVERNAME "dnet_mdio_read %02x:%02x <- %04x\n", - dnet->phy_addr, reg, value); - - return value; -} - -static int dnet_send(struct eth_device *netdev, void *packet, int length) -{ - struct dnet_device *dnet = to_dnet(netdev); - int i, wrsz; - unsigned int *bufp; - unsigned int tx_cmd; - - debug(DRIVERNAME "[%s] Sending %u bytes\n", __func__
[PATCH 10/10] arm: Remove unused ep93xx code
There are no platforms for this architecture anymore, remove unused code. Signed-off-by: Tom Rini --- arch/arm/cpu/arm920t/Makefile | 1 - arch/arm/cpu/arm920t/ep93xx/Makefile| 19 - arch/arm/cpu/arm920t/ep93xx/cpu.c | 37 -- arch/arm/cpu/arm920t/ep93xx/led.c | 85 --- arch/arm/cpu/arm920t/ep93xx/lowlevel_init.S | 457 -- arch/arm/cpu/arm920t/ep93xx/speed.c | 96 --- arch/arm/cpu/arm920t/ep93xx/timer.c | 117 arch/arm/include/asm/arch-ep93xx/ep93xx.h | 666 drivers/net/Makefile| 1 - drivers/net/ep93xx_eth.c| 654 --- drivers/net/ep93xx_eth.h| 126 drivers/usb/host/Makefile | 1 - drivers/usb/host/ohci-ep93xx.c | 37 -- 13 files changed, 2297 deletions(-) delete mode 100644 arch/arm/cpu/arm920t/ep93xx/Makefile delete mode 100644 arch/arm/cpu/arm920t/ep93xx/cpu.c delete mode 100644 arch/arm/cpu/arm920t/ep93xx/led.c delete mode 100644 arch/arm/cpu/arm920t/ep93xx/lowlevel_init.S delete mode 100644 arch/arm/cpu/arm920t/ep93xx/speed.c delete mode 100644 arch/arm/cpu/arm920t/ep93xx/timer.c delete mode 100644 arch/arm/include/asm/arch-ep93xx/ep93xx.h delete mode 100644 drivers/net/ep93xx_eth.c delete mode 100644 drivers/net/ep93xx_eth.h delete mode 100644 drivers/usb/host/ohci-ep93xx.c diff --git a/arch/arm/cpu/arm920t/Makefile b/arch/arm/cpu/arm920t/Makefile index c63f578f1a95..b70822c67ab9 100644 --- a/arch/arm/cpu/arm920t/Makefile +++ b/arch/arm/cpu/arm920t/Makefile @@ -7,7 +7,6 @@ extra-y = start.o obj-y += cpu.o -obj-$(CONFIG_EP93XX) += ep93xx/ obj-$(CONFIG_IMX) += imx/ # some files can only build in ARM mode diff --git a/arch/arm/cpu/arm920t/ep93xx/Makefile b/arch/arm/cpu/arm920t/ep93xx/Makefile deleted file mode 100644 index 152b5e7c5a2e.. --- a/arch/arm/cpu/arm920t/ep93xx/Makefile +++ /dev/null @@ -1,19 +0,0 @@ -# SPDX-License-Identifier: GPL-2.0+ -# -# Cirrus Logic EP93xx CPU-specific Makefile -# -# Copyright (C) 2009 Matthias Kaehlcke -# -# Copyright (C) 2004, 2005 -# Cory T. Tusar, Videon Central, Inc., -# -# Copyright (C) 2006 -# Dominic Rath -# -# Based on an original Makefile, which is -# -# (C) Copyright 2000, 2001, 2002 -# Wolfgang Denk, DENX Software Engineering, w...@denx.de. - -obj-y = cpu.o led.o speed.o timer.o -obj-y += lowlevel_init.o diff --git a/arch/arm/cpu/arm920t/ep93xx/cpu.c b/arch/arm/cpu/arm920t/ep93xx/cpu.c deleted file mode 100644 index 3435bdc748a2.. --- a/arch/arm/cpu/arm920t/ep93xx/cpu.c +++ /dev/null @@ -1,37 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0+ -/* - * Cirrus Logic EP93xx CPU-specific support. - * - * Copyright (C) 2009 Matthias Kaehlcke - * - * Copyright (C) 2004, 2005 - * Cory T. Tusar, Videon Central, Inc., - */ - -#include -#include -#include -#include - -/* We reset the CPU by generating a 1-->0 transition on DeviceCfg bit 31. */ -extern void reset_cpu(void) -{ - struct syscon_regs *syscon = (struct syscon_regs *)SYSCON_BASE; - uint32_t value; - - /* Unlock DeviceCfg and set SWRST */ - writel(0xAA, &syscon->sysswlock); - value = readl(&syscon->devicecfg); - value |= SYSCON_DEVICECFG_SWRST; - writel(value, &syscon->devicecfg); - - /* Unlock DeviceCfg and clear SWRST */ - writel(0xAA, &syscon->sysswlock); - value = readl(&syscon->devicecfg); - value &= ~SYSCON_DEVICECFG_SWRST; - writel(value, &syscon->devicecfg); - - /* Dying... */ - while (1) - ; /* noop */ -} diff --git a/arch/arm/cpu/arm920t/ep93xx/led.c b/arch/arm/cpu/arm920t/ep93xx/led.c deleted file mode 100644 index 862663acbab5.. --- a/arch/arm/cpu/arm920t/ep93xx/led.c +++ /dev/null @@ -1,85 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0+ -/* - * Copyright (C) 2010, 2009 Matthias Kaehlcke - */ - -#include -#include -#include -#include - -static uint8_t saved_state[2] = {CONFIG_LED_STATUS_OFF, CONFIG_LED_STATUS_OFF}; -static uint32_t gpio_pin[2] = {1 << CONFIG_LED_STATUS_GREEN, - 1 << CONFIG_LED_STATUS_RED}; - -static inline void switch_LED_on(uint8_t led) -{ - register struct gpio_regs *gpio = (struct gpio_regs *)GPIO_BASE; - - writel(readl(&gpio->pedr) | gpio_pin[led], &gpio->pedr); - saved_state[led] = CONFIG_LED_STATUS_ON; -} - -static inline void switch_LED_off(uint8_t led) -{ - register struct gpio_regs *gpio = (struct gpio_regs *)GPIO_BASE; - - writel(readl(&gpio->pedr) & ~gpio_pin[led], &gpio->pedr); - saved_state[led] = CONFIG_LED_STATUS_OFF; -} - -void red_led_on(void) -{ - switch_LED_on(CONFIG_LED_STATUS_RED); -} - -void red_led_off(void) -{ - switch_LED_off(CONFIG_LED_STATUS_RED); -} - -void green_led_on(void) -{ - switch_LED_on(CONFIG_LED_STATUS_GREEN); -} - -void green_led_off(void) -{ - switch_LED_off(CONFIG_LE
Re: [PATCH 4/6] net: fec: add support for DM_MDIO
On Thu, Mar 31, 2022 at 10:01 AM Vladimir Oltean wrote: > > On Tue, Mar 29, 2022 at 03:52:38PM -0700, Tim Harvey wrote: > > Add support for DM_MDIO by registering a UCLASS_MDIO driver and > > attempting to use it. This is necessary if wanting to use a DSA > > driver for example hanging off of the FEC MAC. > > > > Care is taken to fallback to non DM_MDIO as several boards define > > DM_MDIO without having the proper device-tree configuration necessary > > such as an mdio subnode, a phy-mode prop, and either a valid phy-handle > > prop or fixed-phy subnode. > > > > Signed-off-by: Tim Harvey > > --- > > drivers/net/fec_mxc.c | 113 ++ > > drivers/net/fec_mxc.h | 1 + > > 2 files changed, 104 insertions(+), 10 deletions(-) > > > > diff --git a/drivers/net/fec_mxc.c b/drivers/net/fec_mxc.c > > index e8ebef09032a..374ef9d67d5e 100644 > > --- a/drivers/net/fec_mxc.c > > +++ b/drivers/net/fec_mxc.c > > @@ -30,6 +30,8 @@ > > #include > > #include > > #include > > +#include > > +#include > > > > #include "fec_mxc.h" > > #include > > @@ -1025,6 +1027,80 @@ struct mii_dev *fec_get_miibus(ulong base_addr, int > > dev_id) > > return bus; > > } > > > > +#ifdef CONFIG_DM_MDIO > > +struct dm_fec_mdio_priv { > > + struct ethernet_regs *regs; > > +}; > > + > > +static int dm_fec_mdio_read(struct udevice *dev, int addr, int devad, int > > reg) > > +{ > > + struct dm_fec_mdio_priv *priv = dev_get_priv(dev); > > + > > + return fec_mdio_read(priv->regs, addr, reg); > > +} > > + > > +static int dm_fec_mdio_write(struct udevice *dev, int addr, int devad, int > > reg, u16 data) > > +{ > > + struct dm_fec_mdio_priv *priv = dev_get_priv(dev); > > + > > + return fec_mdio_write(priv->regs, addr, reg, data); > > +} > > + > > +static const struct mdio_ops dm_fec_mdio_ops = { > > + .read = dm_fec_mdio_read, > > + .write = dm_fec_mdio_write, > > +}; > > + > > +static int dm_fec_mdio_probe(struct udevice *dev) > > +{ > > + struct dm_fec_mdio_priv *priv = dev_get_priv(dev); > > + > > + priv->regs = (struct ethernet_regs > > *)ofnode_get_addr(dev_ofnode(dev->parent)); > > + > > + return 0; > > +} > > + > > +U_BOOT_DRIVER(fec_mdio) = { > > + .name = "fec_mdio", > > + .id = UCLASS_MDIO, > > + .probe = dm_fec_mdio_probe, > > + .ops= &dm_fec_mdio_ops, > > + .priv_auto = sizeof(struct dm_fec_mdio_priv), > > +}; > > + > > +static int dm_fec_bind_mdio(struct udevice *dev) > > +{ > > + struct udevice *mdiodev; > > + const char *name; > > + ofnode mdio; > > + int ret; > > + > > + /* for a UCLASS_MDIO driver we need to bind and probe manually > > + * for an internal MDIO bus that has no dt compatible of its own > > + */ > > + ofnode_for_each_subnode(mdio, dev_ofnode(dev)) { > > + name = ofnode_get_name(mdio); > > + > > + if (strcmp(name, "mdio")) > > + continue; > > + > > + ret = device_bind_driver_to_node(dev, "fec_mdio", > > + name, mdio, &mdiodev); > > + if (ret) > > + return ret; > > + > > + /* need to probe it as there is no compatible to do so */ > > + ret = uclass_get_device_by_ofnode(UCLASS_MDIO, mdio, > > &mdiodev); > > + if (!ret) > > + return 0; > > + > > + break; > > + } > > + > > + return ret; > > +} > > +#endif > > + > > On which branch does this apply? The context above fecmxc_read_rom_hwaddr() > is different in the branches I've checked: > https://source.denx.de/u-boot/u-boot/-/blob/master/drivers/net/fec_mxc.c#L1276 > https://source.denx.de/u-boot/custodians/u-boot-net/-/blob/next/drivers/net/fec_mxc.c#L1276 > Sorry, I should have specified in my cover letter that this is on top of next which removes the non dm-eth support from the driver which is quite the cleanup. Also, after more testing I believe the dm-mdio driver code 'above' is correct but the business of trying to use it and fallback 'below' is wrong and needs work. It doesn't break current users of fec_mxc from what I can tell but it also doesn't properly connect the dm_mdio driver. > > static int fecmxc_read_rom_hwaddr(struct udevice *dev) > > { > > struct fec_priv *priv = dev_get_priv(dev); > > @@ -1088,7 +1164,7 @@ static int device_get_phy_addr(struct fec_priv *priv, > > struct udevice *dev) > > > > static int fec_phy_init(struct fec_priv *priv, struct udevice *dev) > > { > > - struct phy_device *phydev; > > + struct phy_device *phydev = NULL; > > int addr; > > > > addr = device_get_phy_addr(priv, dev); > > @@ -1096,7 +1172,12 @@ static int fec_phy_init(struct fec_priv *priv, > > struct udevice *dev) > > addr = CONFIG_FEC_MXC_PHYADDR; > > #endif > > > > - phydev = phy_connect(priv->bus, addr, dev, priv->interface); >
Re: [EXT] [PATCH] ARM: imx: romapi: Repair FlexSPI NOR boot offset
On Thu, Mar 31, 2022 at 9:41 AM Marek Vasut wrote: > > On 3/31/22 18:03, Tim Harvey wrote: > > On Thu, Mar 31, 2022 at 8:26 AM Marek Vasut wrote: > >> > >> On 3/31/22 17:09, Tim Harvey wrote: > >>> On Mon, Mar 28, 2022 at 7:55 AM Marek Vasut wrote: > > On 3/28/22 08:54, Ye Li wrote: > > Hi Marek, > > Hi, > > [...] > > >>> 2. Update the u-boot.itb offset in imx8mp-u-boot.dtsi, set the > >>> offset > >>> to 0x5f000. The previous offset 0x58000 is for SD, calculated by > >>> 0x6 - 0x8000 (32KB image offset). > >>> > >>> uboot: blob-ext@2 { > >>> filename = "u-boot.itb"; > >>> offset = <0x5f000>; > >>> }; > >> But that breaks booting from SD card for me ? > > > > Do you want to use one flash.bin for both SD and flexspi? > > Yes, the board I use can boot from SD/eMMC/FlexSPI. I don't want to > build multiple confusing "flash.bin" files, one for each boot media. > > > When first introduced 8m support by imx8mimage.c, we expected the u- > > boot.itb at same device offset (0x6) on SD/emmc and flexspi. The > > imx8mimage will calculate the offset inside the flash.bin automatically > > according to different IVT offset. The ROMAPI driver also works > > correspondingly. > > After using binman, the u-boot.itb offset inside the flash.bin has to > > be manually set in this DTS node. To follow the original design, this > > offset should be different. That's why I asked to update this dts node > > for flexspi. > > This does imply that there are currently no users that boot from flexspi > in upstream U-Boot, because such users would have to manually modify > both arch/arm/dts/imx8m?-u-boot.dtsi and board/*/imximage.cfg to > generate suitable flash.bin which can be started from FlexSPI. > > Also, git grep confirms that there are no users: > > u-boot$ git grep BOOT_FROM.*fspi > doc/imx/mkimage/imx8image.txt:BOOT_FROM > [sd|emmc_fastboot|fspi|nand_4k|nand_8k|nand_16k] [sector_size] > > > If you change the ROM API driver, that will break our design. You can > > try to overwrite spl_romapi_get_uboot_base for your board only. > > Since there are no users which boot from flexspi upstream, this design > can still be fixed such that it does not require different flash.bin for > different boot media, but rather one flash.bin works on all boot media. > I think that is much better. > > >>> > >>> Marek, > >>> > >>> I'm also a fan of single U-Boot binaries supporting multiple boards > >>> and configurations. > >>> > >>> How are you handling env for the various boot devices? I haven't > >>> looked in a while... can multiple env support co-exist now between > >>> MMC/SPI and be selected at runtime? > >> > >> Do '$ git grep env_get_location' , you will find board-level examples > >> where this function is implemented and it returns ENVL_* based on > >> various hardware-specific conditions. > >> > >> I _think_ there is even imx arch specific implementation for this > >> env_get_location() which automatically picks SD/eMMC/FlexSPI for you > >> right now. > > > > Marek, > > > > I guess where I keep getting hung up is how to configure the ENV for > > multiple env drivers as there is only one CONFIG_ENV_OFFSET Kconfig > > which means for all devices your going to have the same offset/redund > > configuration which is likely not appropriate for mmc/nand/spi for > > example. I don't see any way currently to configure those separately. > > Unless I'm missing something obvious I suppose get_env_location() > > could be augmented to be able to return board-specific env location > > config as well. > > e.g. env/mmc.c has the following: > > 78 } dt_prop = { > 79 .offset_redund = "u-boot,mmc-env-offset-redundant", > 80 .partition = "u-boot,mmc-env-partition", > 81 .offset = "u-boot,mmc-env-offset", > 82 }; > > So use that to specify per-env-driver offset. Indeed, the > CONFIG_ENV*OFFSET is shared by all env driver. Right... but I think the dt overrides there only exist for MMC (I don't see then in env/nand.c for example)... but I can add that. I've always wanted to have a single binary for IMX6 nand vs emmc boards and this has been the ony hangup. Thanks! Tim
Re: [EXT] [PATCH] ARM: imx: romapi: Repair FlexSPI NOR boot offset
On 3/31/22 20:02, Tim Harvey wrote: On Thu, Mar 31, 2022 at 9:41 AM Marek Vasut wrote: On 3/31/22 18:03, Tim Harvey wrote: On Thu, Mar 31, 2022 at 8:26 AM Marek Vasut wrote: On 3/31/22 17:09, Tim Harvey wrote: On Mon, Mar 28, 2022 at 7:55 AM Marek Vasut wrote: On 3/28/22 08:54, Ye Li wrote: Hi Marek, Hi, [...] 2. Update the u-boot.itb offset in imx8mp-u-boot.dtsi, set the offset to 0x5f000. The previous offset 0x58000 is for SD, calculated by 0x6 - 0x8000 (32KB image offset). uboot: blob-ext@2 { filename = "u-boot.itb"; offset = <0x5f000>; }; But that breaks booting from SD card for me ? Do you want to use one flash.bin for both SD and flexspi? Yes, the board I use can boot from SD/eMMC/FlexSPI. I don't want to build multiple confusing "flash.bin" files, one for each boot media. When first introduced 8m support by imx8mimage.c, we expected the u- boot.itb at same device offset (0x6) on SD/emmc and flexspi. The imx8mimage will calculate the offset inside the flash.bin automatically according to different IVT offset. The ROMAPI driver also works correspondingly. After using binman, the u-boot.itb offset inside the flash.bin has to be manually set in this DTS node. To follow the original design, this offset should be different. That's why I asked to update this dts node for flexspi. This does imply that there are currently no users that boot from flexspi in upstream U-Boot, because such users would have to manually modify both arch/arm/dts/imx8m?-u-boot.dtsi and board/*/imximage.cfg to generate suitable flash.bin which can be started from FlexSPI. Also, git grep confirms that there are no users: u-boot$ git grep BOOT_FROM.*fspi doc/imx/mkimage/imx8image.txt:BOOT_FROM [sd|emmc_fastboot|fspi|nand_4k|nand_8k|nand_16k] [sector_size] If you change the ROM API driver, that will break our design. You can try to overwrite spl_romapi_get_uboot_base for your board only. Since there are no users which boot from flexspi upstream, this design can still be fixed such that it does not require different flash.bin for different boot media, but rather one flash.bin works on all boot media. I think that is much better. Marek, I'm also a fan of single U-Boot binaries supporting multiple boards and configurations. How are you handling env for the various boot devices? I haven't looked in a while... can multiple env support co-exist now between MMC/SPI and be selected at runtime? Do '$ git grep env_get_location' , you will find board-level examples where this function is implemented and it returns ENVL_* based on various hardware-specific conditions. I _think_ there is even imx arch specific implementation for this env_get_location() which automatically picks SD/eMMC/FlexSPI for you right now. Marek, I guess where I keep getting hung up is how to configure the ENV for multiple env drivers as there is only one CONFIG_ENV_OFFSET Kconfig which means for all devices your going to have the same offset/redund configuration which is likely not appropriate for mmc/nand/spi for example. I don't see any way currently to configure those separately. Unless I'm missing something obvious I suppose get_env_location() could be augmented to be able to return board-specific env location config as well. e.g. env/mmc.c has the following: 78 } dt_prop = { 79 .offset_redund = "u-boot,mmc-env-offset-redundant", 80 .partition = "u-boot,mmc-env-partition", 81 .offset = "u-boot,mmc-env-offset", 82 }; So use that to specify per-env-driver offset. Indeed, the CONFIG_ENV*OFFSET is shared by all env driver. Right... but I think the dt overrides there only exist for MMC (I don't see then in env/nand.c for example)... but I can add that. I've always wanted to have a single binary for IMX6 nand vs emmc boards and this has been the ony hangup. Then I think, send a patch for env SF. The DT overrides seem to be the right approach, it is certainly better than hard-coded Kconfigs.
Re: [PATCH v4 6/8] FMP: Remove GUIDs for FIT and raw images
On Thu, Mar 31, 2022 at 06:57:48PM +0530, Sughosh Ganu wrote: > The capsule update code has been modified for getting the image GUID > values from the platform code. With this, each image now has a unique > GUID value. With this change, there is no longer a need for defining > GUIDs for FIT and raw images. Remove these GUID values. > > Signed-off-by: Sughosh Ganu > --- > > Changes since V3: None > > include/efi_api.h | 8 > lib/efi_loader/efi_firmware.c | 4 > 2 files changed, 12 deletions(-) > > diff --git a/include/efi_api.h b/include/efi_api.h > index 982c200172..c7f7873b5d 100644 > --- a/include/efi_api.h > +++ b/include/efi_api.h > @@ -1967,14 +1967,6 @@ struct efi_signature_list { > EFI_GUID(0x86c77a67, 0x0b97, 0x4633, 0xa1, 0x87, \ >0x49, 0x10, 0x4d, 0x06, 0x85, 0xc7) > > -#define EFI_FIRMWARE_IMAGE_TYPE_UBOOT_FIT_GUID \ > - EFI_GUID(0xae13ff2d, 0x9ad4, 0x4e25, 0x9a, 0xc8, \ > - 0x6d, 0x80, 0xb3, 0xb2, 0x21, 0x47) > - > -#define EFI_FIRMWARE_IMAGE_TYPE_UBOOT_RAW_GUID \ > - EFI_GUID(0xe2bb9c06, 0x70e9, 0x4b14, 0x97, 0xa3, \ > - 0x5a, 0x79, 0x13, 0x17, 0x6e, 0x3f) > - > #define IMAGE_ATTRIBUTE_IMAGE_UPDATABLE 0x0001 > #define IMAGE_ATTRIBUTE_RESET_REQUIRED 0x0002 > #define IMAGE_ATTRIBUTE_AUTHENTICATION_REQUIRED 0x0004 > diff --git a/lib/efi_loader/efi_firmware.c b/lib/efi_loader/efi_firmware.c > index 169f3a29bb..7734d9f353 100644 > --- a/lib/efi_loader/efi_firmware.c > +++ b/lib/efi_loader/efi_firmware.c > @@ -185,8 +185,6 @@ static efi_status_t efi_fill_image_desc_array( > * - versioning of firmware image > * - package information > */ > -const efi_guid_t efi_firmware_image_type_uboot_fit = > - EFI_FIRMWARE_IMAGE_TYPE_UBOOT_FIT_GUID; > > /** > * efi_firmware_fit_get_image_info - return information about the current > @@ -293,8 +291,6 @@ const struct efi_firmware_management_protocol efi_fmp_fit > = { > * This FIRMWARE_MANAGEMENT_PROTOCOL driver provides a firmware update > * method with raw data. > */ > -const efi_guid_t efi_firmware_image_type_uboot_raw = > - EFI_FIRMWARE_IMAGE_TYPE_UBOOT_RAW_GUID; > > /** > * efi_firmware_raw_get_image_info - return information about the current > -- > 2.25.1 > Reviewed-by: Ilias Apalodimas
Re: [PATCH v4 7/8] mkeficapsule: Remove raw and FIT GUID types
On Thu, Mar 31, 2022 at 06:57:49PM +0530, Sughosh Ganu wrote: > While building a capsule, the GUID value of that specific image is to > be passed through the --guid command option to the mkeficapsule > tool. This renders the EFI_FIRMWARE_IMAGE_TYPE_UBOOT_FIT_GUID and > EFI_FIRMWARE_IMAGE_TYPE_UBOOT_RAW_GUID values superfluous. Remove the > --raw and --fit command line options as well. > > Signed-off-by: Sughosh Ganu > --- > > Changes since V3: None > > tools/eficapsule.h | 8 > tools/mkeficapsule.c | 26 +- > 2 files changed, 1 insertion(+), 33 deletions(-) > > diff --git a/tools/eficapsule.h b/tools/eficapsule.h > index 69c9c58c2f..d63b831443 100644 > --- a/tools/eficapsule.h > +++ b/tools/eficapsule.h > @@ -37,14 +37,6 @@ typedef struct { > EFI_GUID(0x6dcbd5ed, 0xe82d, 0x4c44, 0xbd, 0xa1, \ >0x71, 0x94, 0x19, 0x9a, 0xd9, 0x2a) > > -#define EFI_FIRMWARE_IMAGE_TYPE_UBOOT_FIT_GUID \ > - EFI_GUID(0xae13ff2d, 0x9ad4, 0x4e25, 0x9a, 0xc8, \ > - 0x6d, 0x80, 0xb3, 0xb2, 0x21, 0x47) > - > -#define EFI_FIRMWARE_IMAGE_TYPE_UBOOT_RAW_GUID \ > - EFI_GUID(0xe2bb9c06, 0x70e9, 0x4b14, 0x97, 0xa3, \ > - 0x5a, 0x79, 0x13, 0x17, 0x6e, 0x3f) > - > #define EFI_CERT_TYPE_PKCS7_GUID \ > EFI_GUID(0x4aafd29d, 0x68df, 0x49ee, 0x8a, 0xa9, \ >0x34, 0x7d, 0x37, 0x56, 0x65, 0xa7) > diff --git a/tools/mkeficapsule.c b/tools/mkeficapsule.c > index c118335b93..5f74d23b9e 100644 > --- a/tools/mkeficapsule.c > +++ b/tools/mkeficapsule.c > @@ -27,17 +27,11 @@ > static const char *tool_name = "mkeficapsule"; > > efi_guid_t efi_guid_fm_capsule = EFI_FIRMWARE_MANAGEMENT_CAPSULE_ID_GUID; > -efi_guid_t efi_guid_image_type_uboot_fit = > - EFI_FIRMWARE_IMAGE_TYPE_UBOOT_FIT_GUID; > -efi_guid_t efi_guid_image_type_uboot_raw = > - EFI_FIRMWARE_IMAGE_TYPE_UBOOT_RAW_GUID; > efi_guid_t efi_guid_cert_type_pkcs7 = EFI_CERT_TYPE_PKCS7_GUID; > > -static const char *opts_short = "frg:i:I:v:p:c:m:dh"; > +static const char *opts_short = "g:i:I:v:p:c:m:dh"; > > static struct option options[] = { > - {"fit", no_argument, NULL, 'f'}, > - {"raw", no_argument, NULL, 'r'}, > {"guid", required_argument, NULL, 'g'}, > {"index", required_argument, NULL, 'i'}, > {"instance", required_argument, NULL, 'I'}, > @@ -54,8 +48,6 @@ static void print_usage(void) > fprintf(stderr, "Usage: %s [options] \n" > "Options:\n" > > - "\t-f, --fit FIT image type\n" > - "\t-r, --raw raw image type\n" > "\t-g, --guid guid for image blob type\n" > "\t-i, --index update image index\n" > "\t-I, --instanceupdate hardware instance\n" > @@ -606,22 +598,6 @@ int main(int argc, char **argv) > break; > > switch (c) { > - case 'f': > - if (guid) { > - fprintf(stderr, > - "Image type already specified\n"); > - exit(EXIT_FAILURE); > - } > - guid = &efi_guid_image_type_uboot_fit; > - break; > - case 'r': > - if (guid) { > - fprintf(stderr, > - "Image type already specified\n"); > - exit(EXIT_FAILURE); > - } > - guid = &efi_guid_image_type_uboot_raw; > - break; > case 'g': > if (guid) { > fprintf(stderr, > -- > 2.25.1 > Acked-by: Ilias Apalodimas
Re: [PATCH v4 8/8] doc: uefi: Update the capsule update related documentation
On Thu, Mar 31, 2022 at 06:57:50PM +0530, Sughosh Ganu wrote: > Update the capsule update functionality related documentation to > refect the additional definitions that need to be made per platform > for supporting the capsule update feature. > > Signed-off-by: Sughosh Ganu > --- > > Changes since V3: > * Rephrase the commit message to indicate that the doc changes are not > just limited to adding the GUID values, but other info as well. > * Elaborate with an example on the relation between the dfu alt number > and the image index > > doc/develop/uefi/uefi.rst | 24 ++-- > 1 file changed, 22 insertions(+), 2 deletions(-) > > diff --git a/doc/develop/uefi/uefi.rst b/doc/develop/uefi/uefi.rst > index fe337c88bd..d886635cc3 100644 > --- a/doc/develop/uefi/uefi.rst > +++ b/doc/develop/uefi/uefi.rst > @@ -312,8 +312,8 @@ Run the following command > .. code-block:: console > > $ mkeficapsule \ > - --index 1 --instance 0 \ > - [--fit | --raw ] \ > + --index --instance 0 \ > + --guid \ > > > Performing the update > @@ -333,6 +333,26 @@ won't be taken over across the reboot. If this is the > case, you can skip > this feature check with the Kconfig option (CONFIG_EFI_IGNORE_OSINDICATIONS) > set. > > +A few things need to be defined in the board file for performing the > +capsule upadte. The first is defining the function set_dfu_alt_info in s/upadte/update/ > +the board file. This function sets the environment variable > +dfu_alt_info. Instead of taking the variable from the environment, the > +capsule update feature requires that the variable be set through the I think we should also mention that allowing a user to change the location of the firmware updates in flash is not a good security practice. Having that baked in the firmware (as long as a prior stage boot loader verifies it) is a better approach. Thanks /Ilias > +board function, since that is more robust. Secondly, define GUID > +values and image index of the images that are to be updated through > +the capsule update feature in the board file. Both the values are to > +be defined as part of the fw_images array. These GUID values would be > +used by the Firmware Management Protocol(FMP) to populate the image > +descriptor array and also displayed as part of the ESRT table. The > +image index values defined in the array should be one greater than the > +dfu alt number that corresponds to the firmware image. So, if the dfu > +alt number for an image is 2, the value of image index in the > +fw_images array for that image should be 3. The dfu alt number can be > +obtained by running the following command:: > + > +dfu list > + > + > Finally, the capsule update can be initiated by rebooting the board. > > Enabling Capsule Authentication > -- > 2.25.1 >
Re: [PATCH v4 3/8] capsule: Put a check for image index before the update
On Thu, Mar 31, 2022 at 06:57:45PM +0530, Sughosh Ganu wrote: > The current capsule update code compares the image GUID value in the > capsule header with the image GUID value obtained from the > GetImageInfo function of the Firmware Management Protocol(FMP). This > comparison is done to ascertain if the FMP's SetImage function can be > called for the update. Make this checking more robust by comparing the > image_index value passed through the capsule with that returned by the > FMP's GetImageInfo function. This protects against the scenario of the > firmware being updated in a wrong partition/location on the storage > device if an incorrect value has been passed through the capsule, > since the image_index is used to determine the location of the update > on the storage device. > > Signed-off-by: Sughosh Ganu > Reviewed-by: Masami Hiramatsu > --- > > Changes since V3: None > > lib/efi_loader/efi_capsule.c | 8 +--- > 1 file changed, 5 insertions(+), 3 deletions(-) > > diff --git a/lib/efi_loader/efi_capsule.c b/lib/efi_loader/efi_capsule.c > index f00440163d..f03f4c9044 100644 > --- a/lib/efi_loader/efi_capsule.c > +++ b/lib/efi_loader/efi_capsule.c > @@ -128,6 +128,7 @@ void set_capsule_result(int index, struct > efi_capsule_header *capsule, > /** > * efi_fmp_find - search for Firmware Management Protocol drivers > * @image_type: Image type guid > + * @image_index: Image Index > * @instance:Instance number > * @handles: Handles of FMP drivers > * @no_handles: Number of handles > @@ -141,8 +142,8 @@ void set_capsule_result(int index, struct > efi_capsule_header *capsule, > * * NULL- on failure > */ > static struct efi_firmware_management_protocol * > -efi_fmp_find(efi_guid_t *image_type, u64 instance, efi_handle_t *handles, > - efi_uintn_t no_handles) > +efi_fmp_find(efi_guid_t *image_type, u8 image_index, u64 instance, > + efi_handle_t *handles, efi_uintn_t no_handles) > { > efi_handle_t *handle; > struct efi_firmware_management_protocol *fmp; > @@ -203,6 +204,7 @@ efi_fmp_find(efi_guid_t *image_type, u64 instance, > efi_handle_t *handles, > 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) && > (!instance || >!desc->hardware_instance || > desc->hardware_instance == instance)) > @@ -449,8 +451,8 @@ static efi_status_t efi_capsule_update_firmware( > } > > /* find a device for update firmware */ > - /* TODO: should we pass index as well, or nothing but type? */ > fmp = efi_fmp_find(&image->update_image_type_id, > +image->update_image_index, > image->update_hardware_instance, > handles, no_handles); > if (!fmp) { > -- > 2.25.1 > Reviewed-by: Ilias Apalodimas
Re: [PATCH 13/25] spi: cadence_qspi: Migrate CONFIG_CQSPI_REF_CLK to Kconfig
On 31/03/22 01:41PM, Tom Rini wrote: > On Thu, Mar 31, 2022 at 10:00:52PM +0530, Pratyush Yadav wrote: > > +Vignesh > > > > Hi Tom, > > > > On 30/03/22 06:07PM, Tom Rini wrote: > > > This is a little tricky since SoCFPGA has code to determine this as > > > runtime. Introduce a guard variable for platforms to select if they > > > have a static value to use. Then for ARCH_SOCFPGA, call > > > cm_get_qspi_controller_clk_hz() and otherwise continue the previous > > > behavior. > > > > > > Cc: Jagan Teki > > > Signed-off-by: Tom Rini > > > --- > > > arch/arm/mach-socfpga/misc_soc64.c | 1 + > > > configs/j7200_evm_a72_defconfig| 2 ++ > > > configs/j7200_evm_r5_defconfig | 2 ++ > > > configs/j721e_evm_a72_defconfig| 2 ++ > > > configs/j721e_evm_r5_defconfig | 2 ++ > > > configs/j721e_hs_evm_a72_defconfig | 2 ++ > > > configs/j721e_hs_evm_r5_defconfig | 2 ++ > > > configs/j721s2_evm_a72_defconfig | 2 ++ > > > configs/j721s2_evm_r5_defconfig| 2 ++ > > > configs/k2g_evm_defconfig | 2 ++ > > > configs/k2g_hs_evm_defconfig | 2 ++ > > > configs/stv0991_defconfig | 2 ++ > > > drivers/spi/Kconfig| 8 > > > drivers/spi/cadence_qspi.c | 4 +++- > > > drivers/spi/cadence_qspi.h | 1 + > > > include/configs/j721e_evm.h| 1 - > > > include/configs/j721s2_evm.h | 1 - > > > include/configs/k2g_evm.h | 4 > > > include/configs/socfpga_common.h | 9 - > > > include/configs/socfpga_soc64_common.h | 5 - > > > include/configs/stv0991.h | 8 > > > 21 files changed, 35 insertions(+), 29 deletions(-) > > > > > > diff --git a/arch/arm/mach-socfpga/misc_soc64.c > > > b/arch/arm/mach-socfpga/misc_soc64.c > > > index 7b973a79e807..2acdfad07b35 100644 > > > --- a/arch/arm/mach-socfpga/misc_soc64.c > > > +++ b/arch/arm/mach-socfpga/misc_soc64.c > > > @@ -16,6 +16,7 @@ > > > #include > > > #include > > > #include > > > +#include > > > > > > DECLARE_GLOBAL_DATA_PTR; > > > > > > diff --git a/configs/j7200_evm_a72_defconfig > > > b/configs/j7200_evm_a72_defconfig > > > index eb1d7d46b82a..3d0d1977ff99 100644 > > > --- a/configs/j7200_evm_a72_defconfig > > > +++ b/configs/j7200_evm_a72_defconfig > > > @@ -173,6 +173,8 @@ CONFIG_SOC_TI=y > > > CONFIG_SPI=y > > > CONFIG_DM_SPI=y > > > CONFIG_CADENCE_QSPI=y > > > +CONFIG_HAS_CQSPI_REF_CLK=y > > > +CONFIG_CQSPI_REF_CLK=1 > > > CONFIG_SYSRESET=y > > > CONFIG_SPL_SYSRESET=y > > > CONFIG_SYSRESET_TI_SCI=y > > > diff --git a/configs/j7200_evm_r5_defconfig > > > b/configs/j7200_evm_r5_defconfig > > > index e500a27bb692..0f4b006b80b5 100644 > > > --- a/configs/j7200_evm_r5_defconfig > > > +++ b/configs/j7200_evm_r5_defconfig > > > @@ -134,6 +134,8 @@ CONFIG_SOC_TI=y > > > CONFIG_SPI=y > > > CONFIG_DM_SPI=y > > > CONFIG_CADENCE_QSPI=y > > > +CONFIG_HAS_CQSPI_REF_CLK=y > > > +CONFIG_CQSPI_REF_CLK=1 > > > > This clock is configured to 166 MHz via device tree. I would prefer TI > > platforms to use device tree and not set CONFIG_HAS_CQSPI_REF_CLK at > > all. The clock _is_ 133 MHz by default but I think it is better if we > > just return an error when clk_get fails. > > For these migration patches, it's important to not include functional > changes as the same time in case there's problems later on (see for > example the SYS_IMMR fix I merged today). So please send a follow-up to > this patch or something vs master to disable the current behavior on the > TI platforms. Okay. Makes sense. > > > > CONFIG_SYSRESET=y > > > CONFIG_SPL_SYSRESET=y > > > CONFIG_SYSRESET_TI_SCI=y > > [...] > > > diff --git a/drivers/spi/cadence_qspi.c b/drivers/spi/cadence_qspi.c > > > index db680618ee9b..7209bb43a776 100644 > > > --- a/drivers/spi/cadence_qspi.c > > > +++ b/drivers/spi/cadence_qspi.c > > > @@ -188,8 +188,10 @@ static int cadence_spi_probe(struct udevice *bus) > > > if (plat->ref_clk_hz == 0) { > > > ret = clk_get_by_index(bus, 0, &clk); > > > if (ret) { > > > -#ifdef CONFIG_CQSPI_REF_CLK > > > +#ifdef CONFIG_HAS_CQSPI_REF_CLK > > > plat->ref_clk_hz = CONFIG_CQSPI_REF_CLK; > > > +#elif defined(CONFIG_ARCH_SOCFPGA) > > > + plat->ref_clk_hz = cm_get_qspi_controller_clk_hz(); > > > > While you are here, please change all this to use if (IS_ENABLED()) > > instead. > > In this case IS_ENABLED() does not increase readibity of the code nor > increase static code coverage testing. I disagree. I think it definitely improves readibity. In general I find IS_ENABLED() is easier to read compared to ifdefs because the if-else flow feels more natural than the ifdef-elif flow, which has weird indentation. -- Regards, Pratyush Yadav Texas Instruments Inc.
[v2 13/25] spi: cadence_qspi: Migrate CONFIG_CQSPI_REF_CLK to Kconfig
This is a little tricky since SoCFPGA has code to determine this as runtime. Introduce a guard variable for platforms to select if they have a static value to use. Then for ARCH_SOCFPGA, call cm_get_qspi_controller_clk_hz() and otherwise continue the previous behavior. Cc: Jagan Teki Signed-off-by: Tom Rini --- Changes in v2: - Use IS_ENABLED(...) per Pratyush --- arch/arm/mach-socfpga/misc_soc64.c | 1 + configs/j7200_evm_a72_defconfig| 2 ++ configs/j7200_evm_r5_defconfig | 2 ++ configs/j721e_evm_a72_defconfig| 2 ++ configs/j721e_evm_r5_defconfig | 2 ++ configs/j721e_hs_evm_a72_defconfig | 2 ++ configs/j721e_hs_evm_r5_defconfig | 2 ++ configs/j721s2_evm_a72_defconfig | 2 ++ configs/j721s2_evm_r5_defconfig| 2 ++ configs/k2g_evm_defconfig | 2 ++ configs/k2g_hs_evm_defconfig | 2 ++ configs/stv0991_defconfig | 2 ++ drivers/spi/Kconfig| 8 drivers/spi/cadence_qspi.c | 11 ++- drivers/spi/cadence_qspi.h | 1 + include/configs/j721e_evm.h| 1 - include/configs/j721s2_evm.h | 1 - include/configs/k2g_evm.h | 4 include/configs/socfpga_common.h | 9 - include/configs/socfpga_soc64_common.h | 5 - include/configs/stv0991.h | 8 21 files changed, 38 insertions(+), 33 deletions(-) diff --git a/arch/arm/mach-socfpga/misc_soc64.c b/arch/arm/mach-socfpga/misc_soc64.c index 7b973a79e807..2acdfad07b35 100644 --- a/arch/arm/mach-socfpga/misc_soc64.c +++ b/arch/arm/mach-socfpga/misc_soc64.c @@ -16,6 +16,7 @@ #include #include #include +#include DECLARE_GLOBAL_DATA_PTR; diff --git a/configs/j7200_evm_a72_defconfig b/configs/j7200_evm_a72_defconfig index eb1d7d46b82a..3d0d1977ff99 100644 --- a/configs/j7200_evm_a72_defconfig +++ b/configs/j7200_evm_a72_defconfig @@ -173,6 +173,8 @@ CONFIG_SOC_TI=y CONFIG_SPI=y CONFIG_DM_SPI=y CONFIG_CADENCE_QSPI=y +CONFIG_HAS_CQSPI_REF_CLK=y +CONFIG_CQSPI_REF_CLK=1 CONFIG_SYSRESET=y CONFIG_SPL_SYSRESET=y CONFIG_SYSRESET_TI_SCI=y diff --git a/configs/j7200_evm_r5_defconfig b/configs/j7200_evm_r5_defconfig index e500a27bb692..0f4b006b80b5 100644 --- a/configs/j7200_evm_r5_defconfig +++ b/configs/j7200_evm_r5_defconfig @@ -134,6 +134,8 @@ CONFIG_SOC_TI=y CONFIG_SPI=y CONFIG_DM_SPI=y CONFIG_CADENCE_QSPI=y +CONFIG_HAS_CQSPI_REF_CLK=y +CONFIG_CQSPI_REF_CLK=1 CONFIG_SYSRESET=y CONFIG_SPL_SYSRESET=y CONFIG_SYSRESET_TI_SCI=y diff --git a/configs/j721e_evm_a72_defconfig b/configs/j721e_evm_a72_defconfig index 447967add2f2..792a9021d773 100644 --- a/configs/j721e_evm_a72_defconfig +++ b/configs/j721e_evm_a72_defconfig @@ -173,6 +173,8 @@ CONFIG_SOC_TI=y CONFIG_SPI=y CONFIG_DM_SPI=y CONFIG_CADENCE_QSPI=y +CONFIG_HAS_CQSPI_REF_CLK=y +CONFIG_CQSPI_REF_CLK=1 CONFIG_SYSRESET=y CONFIG_SPL_SYSRESET=y CONFIG_SYSRESET_TI_SCI=y diff --git a/configs/j721e_evm_r5_defconfig b/configs/j721e_evm_r5_defconfig index e6a5f9950561..6553212de85b 100644 --- a/configs/j721e_evm_r5_defconfig +++ b/configs/j721e_evm_r5_defconfig @@ -127,6 +127,8 @@ CONFIG_SOC_TI=y CONFIG_SPI=y CONFIG_DM_SPI=y CONFIG_CADENCE_QSPI=y +CONFIG_HAS_CQSPI_REF_CLK=y +CONFIG_CQSPI_REF_CLK=1 CONFIG_SYSRESET=y CONFIG_SPL_SYSRESET=y CONFIG_SYSRESET_TI_SCI=y diff --git a/configs/j721e_hs_evm_a72_defconfig b/configs/j721e_hs_evm_a72_defconfig index b468a4438eb5..8146af9732d4 100644 --- a/configs/j721e_hs_evm_a72_defconfig +++ b/configs/j721e_hs_evm_a72_defconfig @@ -145,6 +145,8 @@ CONFIG_SOC_TI=y CONFIG_SPI=y CONFIG_DM_SPI=y CONFIG_CADENCE_QSPI=y +CONFIG_HAS_CQSPI_REF_CLK=y +CONFIG_CQSPI_REF_CLK=1 CONFIG_SYSRESET=y CONFIG_SPL_SYSRESET=y CONFIG_SYSRESET_TI_SCI=y diff --git a/configs/j721e_hs_evm_r5_defconfig b/configs/j721e_hs_evm_r5_defconfig index 1e4a93ff53fe..aaf3c2b5b0b4 100644 --- a/configs/j721e_hs_evm_r5_defconfig +++ b/configs/j721e_hs_evm_r5_defconfig @@ -114,6 +114,8 @@ CONFIG_SOC_TI=y CONFIG_SPI=y CONFIG_DM_SPI=y CONFIG_CADENCE_QSPI=y +CONFIG_HAS_CQSPI_REF_CLK=y +CONFIG_CQSPI_REF_CLK=1 CONFIG_SYSRESET=y CONFIG_SPL_SYSRESET=y CONFIG_SYSRESET_TI_SCI=y diff --git a/configs/j721s2_evm_a72_defconfig b/configs/j721s2_evm_a72_defconfig index 7e2bbc482d1d..e0d124575c4b 100644 --- a/configs/j721s2_evm_a72_defconfig +++ b/configs/j721s2_evm_a72_defconfig @@ -181,6 +181,8 @@ CONFIG_SOC_TI=y CONFIG_SPI=y CONFIG_DM_SPI=y CONFIG_CADENCE_QSPI=y +CONFIG_HAS_CQSPI_REF_CLK=y +CONFIG_CQSPI_REF_CLK=1 CONFIG_SYSRESET=y CONFIG_SPL_SYSRESET=y CONFIG_SYSRESET_TI_SCI=y diff --git a/configs/j721s2_evm_r5_defconfig b/configs/j721s2_evm_r5_defconfig index 996efd4db269..4147b4e26c7b 100644 --- a/configs/j721s2_evm_r5_defconfig +++ b/configs/j721s2_evm_r5_defconfig @@ -138,6 +138,8 @@ CONFIG_SOC_TI=y CONFIG_SPI=y CONFIG_DM_SPI=y CONFIG_CADENCE_QSPI=y +CONFIG_HAS_CQSPI_REF_CLK=y +CONFIG_CQSPI_
Re: [PATCH v4 4/8] board: Define set_dfu_alt_info() for boards with UEFI capsule update enabled
Hi Sughosh, Some nots below On Thu, Mar 31, 2022 at 06:57:46PM +0530, Sughosh Ganu wrote: > Currently, there are a bunch of boards which enable the UEFI capsule > update feature. The actual update of the firmware images is done > through the dfu framework which uses the dfu_alt_info environment > variable for getting information on the update, like device, partition > number/address etc. Currently, these boards define the dfu_alt_info > variable in the board config header, as an environment variable. With > this, the variable can be modified from the u-boot command line and > this can cause an incorrect update. > > To prevent this from happening, define the set_dfu_alt_info function > in the board file, and select SET_DFU_ALT_INFO for all platforms which > enable the capsule update feature. With the function defined, the dfu > framework populates the dfu_alt_info variable through the board file, > instead of fetching the variable from the environment, thus making the > update more robust. > > Signed-off-by: Sughosh Ganu > --- > > Changes since V3: > * Do not remove the existing dfu_alt_info definitions made by > platforms in the config files, as discussed with Masami. > * Squash the selection of the SET_DFU_ALT_INFO config symbol for > capsule update feature as part of this patch. > > > .../imx8mp_rsb3720a1/imx8mp_rsb3720a1.c | 24 + > .../imx8mm-cl-iot-gate/imx8mm-cl-iot-gate.c | 24 + > board/emulation/common/qemu_dfu.c | 6 ++--- > board/kontron/pitx_imx8m/pitx_imx8m.c | 24 + > board/kontron/sl-mx8mm/sl-mx8mm.c | 24 + > board/kontron/sl28/sl28.c | 25 ++ > board/sandbox/sandbox.c | 26 +++ > board/socionext/developerbox/developerbox.c | 26 +++ > board/xilinx/zynq/board.c | 5 ++-- > board/xilinx/zynqmp/zynqmp.c | 5 ++-- > lib/efi_loader/Kconfig| 2 ++ > 11 files changed, 184 insertions(+), 7 deletions(-) > > diff --git a/board/advantech/imx8mp_rsb3720a1/imx8mp_rsb3720a1.c > b/board/advantech/imx8mp_rsb3720a1/imx8mp_rsb3720a1.c > index 1c953ba195..41154ca9f3 100644 > --- a/board/advantech/imx8mp_rsb3720a1/imx8mp_rsb3720a1.c > +++ b/board/advantech/imx8mp_rsb3720a1/imx8mp_rsb3720a1.c > @@ -5,10 +5,12 @@ > */ > > #include > +#include > #include > #include > #include > #include > +#include > #include > #include > #include > @@ -24,6 +26,7 @@ > #include > #include > #include > +#include > #include > > DECLARE_GLOBAL_DATA_PTR; > @@ -231,3 +234,24 @@ unsigned long spl_mmc_get_uboot_raw_sector(struct mmc > *mmc) > } > } > #endif /* CONFIG_SPL_MMC_SUPPORT */ > + > +#if defined(CONFIG_SET_DFU_ALT_INFO) > + > +#define DFU_ALT_BUF_LEN SZ_1K > + > +void set_dfu_alt_info(char *interface, char *devstr) > +{ > + ALLOC_CACHE_ALIGN_BUFFER(char, buf, DFU_ALT_BUF_LEN); > + > + if (!CONFIG_IS_ENABLED(EFI_HAVE_CAPSULE_SUPPORT) && > + env_get("dfu_alt_info")) > + return; Just add a helper function with this since we need to repeat it for every board. Something like 'bool needs_runtime_dfu_alt_info() ' > + > + memset(buf, 0, DFU_ALT_BUF_LEN); I'd prefer sizeof(buf) instead of explicitly calling the length. Otherwise LGTM, but I'd prefer if board maintainer had a look as well Thanks /Ilias > + > + snprintf(buf, DFU_ALT_BUF_LEN, > + "mmc 2=flash-bin raw 0 0x1B00 mmcpart 1"); > + > + env_set("dfu_alt_info", buf); > +} > +#endif /* CONFIG_SET_DFU_ALT_INFO */ [...]
Re: [PATCH 4/6] net: fec: add support for DM_MDIO
On Thu, Mar 31, 2022 at 10:48:55AM -0700, Tim Harvey wrote: > > On which branch does this apply? The context above fecmxc_read_rom_hwaddr() > > is different in the branches I've checked: > > https://source.denx.de/u-boot/u-boot/-/blob/master/drivers/net/fec_mxc.c#L1276 > > https://source.denx.de/u-boot/custodians/u-boot-net/-/blob/next/drivers/net/fec_mxc.c#L1276 > > > > Sorry, I should have specified in my cover letter that this is on top > of next which removes the non dm-eth support from the driver which is > quite the cleanup. Ok, but now the next patch fails to apply to the 'next' branch: Applying: net: dsa: move cpu port probe to dsa_post_probe Applying: net: mdio-uclass: add wrappers for read/write/reset operations Applying: net: fec: add support for DM_MDIO Applying: net: add MV88E61xx DSA driver error: patch failed: drivers/net/Kconfig:428 error: drivers/net/Kconfig: patch does not apply error: patch failed: drivers/net/Makefile:66 error: drivers/net/Makefile: patch does not apply Patch failed at 0005 net: add MV88E61xx DSA driver > Also, after more testing I believe the dm-mdio driver code 'above' is > correct but the business of trying to use it and fallback 'below' is > wrong and needs work. It doesn't break current users of fec_mxc from > what I can tell but it also doesn't properly connect the dm_mdio > driver. Can you spell out what is wrong about the fallback logic? The whole thing with eth_phy_get_mdio_bus()/eth_phy_set_mdio_bus() has me so confused that I am not really following along anymore. > > > static int fecmxc_read_rom_hwaddr(struct udevice *dev) > > > { > > > struct fec_priv *priv = dev_get_priv(dev); > > > @@ -1088,7 +1164,7 @@ static int device_get_phy_addr(struct fec_priv > > > *priv, struct udevice *dev) > > > > > > static int fec_phy_init(struct fec_priv *priv, struct udevice *dev) > > > { > > > - struct phy_device *phydev; > > > + struct phy_device *phydev = NULL; > > > int addr; > > > > > > addr = device_get_phy_addr(priv, dev); > > > @@ -1096,7 +1172,12 @@ static int fec_phy_init(struct fec_priv *priv, > > > struct udevice *dev) > > > addr = CONFIG_FEC_MXC_PHYADDR; > > > #endif > > > > > > - phydev = phy_connect(priv->bus, addr, dev, priv->interface); > > > +#ifdef CONFIG_DM_MDIO > > > + if (priv->dm_mdio) > > > + phydev = dm_eth_phy_connect(dev); > > > +#endif > > > + if (!phydev) > > > + phydev = phy_connect(priv->bus, addr, dev, priv->interface); > > > if (!phydev) > > > return -ENODEV; > > > > > > @@ -1227,11 +1308,19 @@ static int fecmxc_probe(struct udevice *dev) > > > > > > priv->dev_id = dev_seq(dev); > > > > > > +#ifdef CONFIG_DM_MDIO > > > + ret = dm_fec_bind_mdio(dev); > > > + if (!ret) { > > > + ret = fec_phy_init(priv, dev); > > > + if (!ret) > > > + priv->dm_mdio = true; > > > + } > > > +#endif > > > #ifdef CONFIG_DM_ETH_PHY > > > bus = eth_phy_get_mdio_bus(dev); > > > #endif > > > > > > - if (!bus) { > > > + if (!bus && !priv->dm_mdio) { > > > dm_mii_bus = false; > > > #ifdef CONFIG_FEC_MXC_MDIO_BASE > > > bus = fec_get_miibus((ulong)CONFIG_FEC_MXC_MDIO_BASE, > > > @@ -1240,7 +1329,7 @@ static int fecmxc_probe(struct udevice *dev) > > > bus = fec_get_miibus((ulong)priv->eth, dev_seq(dev)); > > > #endif > > > } > > > - if (!bus) { > > > + if (!bus && !priv->dm_mdio) { > > > ret = -ENOMEM; > > > goto err_mii; > > > } > > > @@ -1271,14 +1360,16 @@ static int fecmxc_probe(struct udevice *dev) > > > break; > > > } > > > > > > - ret = fec_phy_init(priv, dev); > > > - if (ret) > > > - goto err_phy; > > > + if (!priv->dm_mdio) { > > > + ret = fec_phy_init(priv, dev); > > > + if (ret) > > > + goto err_phy; > > > + } > > > > > > return 0; > > > > > > err_phy: > > > - if (!dm_mii_bus) { > > > + if (!dm_mii_bus && !priv->dm_mdio) { > > > mdio_unregister(bus); > > > free(bus); > > > } > > > @@ -1294,8 +1385,10 @@ static int fecmxc_remove(struct udevice *dev) > > > > > > free(priv->phydev); > > > fec_free_descs(priv); > > > - mdio_unregister(priv->bus); > > > - mdio_free(priv->bus); > > > + if (priv->bus) { > > > + mdio_unregister(priv->bus); > > > + mdio_free(priv->bus); > > > + } > > > > > > #ifdef CONFIG_DM_REGULATOR > > > if (priv->phy_supply) > > > diff --git a/drivers/net/fec_mxc.h b/drivers/net/fec_mxc.h > > > index 48faa33d66ec..c297880ccc54 100644 > > > --- a/drivers/net/fec_mxc.h > > > +++ b/drivers/net/fec_mxc.h > > > @@ -248,6 +248,7 @@ struct fec_priv { > > > uint8_t *tdb_ptr; > > > int dev_id; > > > struct mii_dev *bus; > > > + bool dm_mdio; > > > #ifdef CONFIG_PHYLIB > >
Re: [v2 13/25] spi: cadence_qspi: Migrate CONFIG_CQSPI_REF_CLK to Kconfig
On 31/03/22 03:35PM, Tom Rini wrote: > This is a little tricky since SoCFPGA has code to determine this as > runtime. Introduce a guard variable for platforms to select if they > have a static value to use. Then for ARCH_SOCFPGA, call > cm_get_qspi_controller_clk_hz() and otherwise continue the previous > behavior. > > Cc: Jagan Teki > Signed-off-by: Tom Rini > --- > Changes in v2: > - Use IS_ENABLED(...) per Pratyush Thanks. For J721E, J7200, J721S2, and cadence_qspi Reviewed-by: Pratyush Yadav [...] -- Regards, Pratyush Yadav Texas Instruments Inc.
Re: [PATCH 0/6] Add MV88E61xx DSA driver and use on gwventana
Hi Tim, On 31/03/22 05:01, Tim Harvey wrote: > On Tue, Mar 29, 2022 at 3:52 PM Tim Harvey wrote: >> This series adds a DSA driver for the MV88E61xx based on >> drivers/net/phy/mv88e61xx and uses in on the gwventana_gw5904_defconfig. >> >> The hope is that the other three boards that use the MV88E61xx driver >> can move to this as well eventually so that we can remove the non-dm >> driver and the 4 Kconfig options it requires. >> >> The MV88E61xx has an MDIO interface this DM_MDIO must be used so support >> for a UCLASS_MDIO driver is added to the fec_mxc ethernet driver in a >> way that allows a fallback to the previous non DM_MDIO case as there are >> many boards out there using this driver that define DM_MDIO but do not >> have the required dt props for a DM_MDIO driver which would cause a >> regression. >> >> Additionally a patch to ensure MDIO children are scanned on post-bind is >> needed. >> >> I'm making use of the dm_mdio_read/dm_mdio_write wrapper from Merak that >> is pending so it is in this series as well. >> >> Best Regards, >> >> Tim >> >> Tim Harvey (6): >>net: mdio-uclass: scan for dm mdio children on post-bind >>net: dsa: move cpu port probe to dsa_post_probe >>net: mdio-uclass: add wrappers for read/write/reset operations >>net: fec: add support for DM_MDIO >>net: add MV88E61xx DSA driver >>board: gw_ventana: enable MV88E61XX DSA support >> >> arch/arm/dts/imx6qdl-gw5904.dtsi| 35 + >> board/gateworks/gw_ventana/gw_ventana.c | 50 +- >> configs/gwventana_gw5904_defconfig | 7 +- >> drivers/net/Kconfig | 7 + >> drivers/net/Makefile| 1 + >> drivers/net/fec_mxc.c | 113 ++- >> drivers/net/fec_mxc.h | 1 + >> drivers/net/mv88e61xx.c | 982 >> include/miiphy.h| 31 + >> net/dsa-uclass.c| 14 +- >> net/mdio-uclass.c | 35 + >> 11 files changed, 1227 insertions(+), 49 deletions(-) >> create mode 100644 drivers/net/mv88e61xx.c >> >> -- >> 2.17.1 >> > Adding Chris and Anotolij to the thread as the maintainers of the only > other boards using drivers/net/phy/mv88e61xx.c. If they can switch to > the DSA driver it would allow us to remove the static Kconfig options > to configure the switch which should be present in the device-tree. I'd be keen to see DSA support for this chip. We are using the Linux DSA drivers on these boards so I'm reasonably sure the ported driver should work. I won't have much time to actually work on these boards (they're a bit of a pain to test remotely). If any of the code is getting in the way I'd be fine with removing it (effectively leaving eth0 as a fixed-link) and when I get some time I can add support for the 88e6097 back. > > Best Regards, > > Tim
Re: [PATCH v8 01/15] arch: Kconfig: imply BINMAN for SANDBOX
On Mon, Mar 28, 2022 at 10:56:53PM +0200, Philippe Reynes wrote: > To be able to use the tool binman on sandbox, > the config SANDBOX should imply BINMAN. > > Reviewed-by: Simon Glass > Signed-off-by: Philippe Reynes Applied to u-boot/next, thanks! -- Tom signature.asc Description: PGP signature
Re: [PATCH v8 02/15] lib: Kconfig: enhance help for ASN1
On Mon, Mar 28, 2022 at 10:56:54PM +0200, Philippe Reynes wrote: > Enhance the help for configs ASN1_COMPILER > and ASN1_decoder. > > Reviewed-by: Simon Glass > Signed-off-by: Philippe Reynes Applied to u-boot/next, thanks! -- Tom signature.asc Description: PGP signature
Re: [PATCH v8 03/15] lib: Kconfig: enhance the help of OID_REGISTRY
On Mon, Mar 28, 2022 at 10:56:55PM +0200, Philippe Reynes wrote: > Enhance the help for the config OID_REGISTRY. > > Reviewed-by: Simon Glass > Signed-off-by: Philippe Reynes Applied to u-boot/next, thanks! -- Tom signature.asc Description: PGP signature
Re: [PATCH v8 04/15] lib: allow to build asn1 decoder and oid registry in SPL
On Mon, Mar 28, 2022 at 10:56:56PM +0200, Philippe Reynes wrote: > This commit adds the options: > - SPL_ASN1_DECODER > - SPL_OID_REGISTRY > > Reviewed-by: Simon Glass > Signed-off-by: Philippe Reynes Applied to u-boot/next, thanks! -- Tom signature.asc Description: PGP signature
Re: [PATCH v8 05/15] lib: crypto: allow to build crypyo in SPL
On Mon, Mar 28, 2022 at 10:56:57PM +0200, Philippe Reynes wrote: > This commit adds the options: > - SPL_ASYMMETRIC_KEY_TYPE > - SPL_ASYMMETRIC_PUBLIC_KEY_SUBTYPE > - SPL_RSA_PUBLIC_KEY_PARSER > > Reviewed-by: Simon Glass > Signed-off-by: Philippe Reynes Applied to u-boot/next, thanks! -- Tom signature.asc Description: PGP signature
Re: [PATCH v8 06/15] lib: rsa: allow rsa verify with pkey in SPL
On Mon, Mar 28, 2022 at 10:56:58PM +0200, Philippe Reynes wrote: > This commit adds the option SPL_RSA_VERIFY_WITH_PKEY. > > Reviewed-by: Simon Glass > Signed-off-by: Philippe Reynes Applied to u-boot/next, thanks! -- Tom signature.asc Description: PGP signature
Re: [PATCH v8 07/15] boot: image: add a stage pre-load
On Mon, Mar 28, 2022 at 10:56:59PM +0200, Philippe Reynes wrote: > Add a stage pre-load that could > check or modify an image. > > For the moment, only a header with a signature is > supported. This header has the following format: > - magic : 4 bytes > - version : 4 bytes > - header size : 4 bytes > - image size : 4 bytes > - offset image signature : 4 bytes > - flags : 4 bytes > - reserved0 : 4 bytes > - reserved1 : 4 bytes > - sha256 of the image signature : 32 bytes > - signature of the first 64 bytes : n bytes > - image signature : n bytes > - padding : up to header size > > The stage uses a node /image/pre-load/sig to > get some informations: > - algo-name (mandatory) : name of the algo used to sign > - padding-name : name of padding used to sign > - signature-size : size of the signature (in the header) > - mandatory : set to yes if this sig is mandatory > - public-key (madatory) : value of the public key > > Before running the image, the stage pre-load checks > the signature provided in the header. > > This is an initial support, later we could add the > support of: > - ciphering > - uncompressing > - ... > > Signed-off-by: Philippe Reynes Applied to u-boot/next, thanks! -- Tom signature.asc Description: PGP signature
Re: [PATCH v8 08/15] cmd: bootm: add a stage pre-load
On Mon, Mar 28, 2022 at 10:57:00PM +0200, Philippe Reynes wrote: > Add a stage pre-load to the command bootm. > Right now, this stage may be used to read a > header and check the signature of the full > image. > > Reviewed-by: Simon Glass > Signed-off-by: Philippe Reynes Applied to u-boot/next, thanks! -- Tom signature.asc Description: PGP signature
Re: [PATCH v8 09/15] common: spl: fit_ram: allow to use image pre load
On Mon, Mar 28, 2022 at 10:57:01PM +0200, Philippe Reynes wrote: > Add the support of image pre load in spl or tpl > when loading an image from ram. > > Reviewed-by: Simon Glass > Signed-off-by: Philippe Reynes Applied to u-boot/next, thanks! -- Tom signature.asc Description: PGP signature
Re: [PATCH v8 10/15] mkimage: add public key for image pre-load stage
On Mon, Mar 28, 2022 at 10:57:02PM +0200, Philippe Reynes wrote: > This commit enhances mkimage to update the node > /image/pre-load/sig with the public key. > > Reviewed-by: Simon Glass > Signed-off-by: Philippe Reynes Applied to u-boot/next, thanks! -- Tom signature.asc Description: PGP signature
Re: [PATCH v8 11/15] Makefile: provide sah-key to binman
On Mon, Mar 28, 2022 at 10:57:03PM +0200, Philippe Reynes wrote: > Set the variable pre-load-key-path with the shell variable > PRE_LOAD_KEY_PATH that contain the keys path (used for signature). > This variable pre-load-key-path is provided to binman. > > Reviewed-by: Simon Glass > Signed-off-by: Philippe Reynes Applied to u-boot/next, thanks! -- Tom signature.asc Description: PGP signature
Re: [PATCH v8 12/15] tools: binman: add support for pre-load header
On Mon, Mar 28, 2022 at 10:57:04PM +0200, Philippe Reynes wrote: > Adds the support of the pre-load header with the image signature > to binman. > > Reviewed-by: Simon Glass > Signed-off-by: Philippe Reynes Applied to u-boot/next, thanks! -- Tom signature.asc Description: PGP signature
Re: [PATCH v8 13/15] configs: sandbox_defconfig: enable stage pre-load in bootm
On Mon, Mar 28, 2022 at 10:57:05PM +0200, Philippe Reynes wrote: > Enable the support of stage pre-load in bootm. > For the moment, this stage allow to verify the > signature of the full image with a header. > > Reviewed-by: Simon Glass > Signed-off-by: Philippe Reynes Applied to u-boot/next, thanks! -- Tom signature.asc Description: PGP signature
Re: [PATCH v8 14/15] test: py: vboot: add test for global image signature
On Mon, Mar 28, 2022 at 10:57:06PM +0200, Philippe Reynes wrote: > Adds test units for the pre-load header signature. > > Signed-off-by: Philippe Reynes Applied to u-boot/next, thanks! -- Tom signature.asc Description: PGP signature
Re: [PATCH v2 17/23] i2c: sun8i_rsb: Only do non-DM pin setup for non-DM I2C
On Thu, 17 Mar 2022 22:54:14 -0500 Samuel Holland wrote: > When the DM_I2C driver is loaded, the pin setup is done automatically > from the device tree by the pinctrl driver. > > Clean up the code in the process: remove #ifdefs and recognize that the > pin configuration is the same for all sun8i/sun50i SoCs, not just those > which select CONFIG_MACH_SUN8I. Indeed, even though the F1C100s uses mux 4, but we don't use the RSB there, and can fix that when we need it. So this means we could enable RSB for the H616 SPL? Regardless this looks alright: Reviewed-by: Andre Przywara Cheers, Andre > > Signed-off-by: Samuel Holland > --- > > (no changes since v1) > > drivers/i2c/sun8i_rsb.c | 46 + > 1 file changed, 19 insertions(+), 27 deletions(-) > > diff --git a/drivers/i2c/sun8i_rsb.c b/drivers/i2c/sun8i_rsb.c > index 716b245a00..0dea8f7a92 100644 > --- a/drivers/i2c/sun8i_rsb.c > +++ b/drivers/i2c/sun8i_rsb.c > @@ -95,27 +95,6 @@ static int sun8i_rsb_set_device_address(struct > sunxi_rsb_reg *base, > return sun8i_rsb_do_trans(base); > } > > -static void sun8i_rsb_cfg_io(void) > -{ > -#ifdef CONFIG_MACH_SUN8I > - sunxi_gpio_set_cfgpin(SUNXI_GPL(0), SUN8I_GPL_R_RSB); > - sunxi_gpio_set_cfgpin(SUNXI_GPL(1), SUN8I_GPL_R_RSB); > - sunxi_gpio_set_pull(SUNXI_GPL(0), 1); > - sunxi_gpio_set_pull(SUNXI_GPL(1), 1); > - sunxi_gpio_set_drv(SUNXI_GPL(0), 2); > - sunxi_gpio_set_drv(SUNXI_GPL(1), 2); > -#elif defined CONFIG_MACH_SUN9I > - sunxi_gpio_set_cfgpin(SUNXI_GPN(0), SUN9I_GPN_R_RSB); > - sunxi_gpio_set_cfgpin(SUNXI_GPN(1), SUN9I_GPN_R_RSB); > - sunxi_gpio_set_pull(SUNXI_GPN(0), 1); > - sunxi_gpio_set_pull(SUNXI_GPN(1), 1); > - sunxi_gpio_set_drv(SUNXI_GPN(0), 2); > - sunxi_gpio_set_drv(SUNXI_GPN(1), 2); > -#else > -#error unsupported MACH_SUNXI > -#endif > -} > - > static void sun8i_rsb_set_clk(struct sunxi_rsb_reg *base) > { > u32 div = 0; > @@ -147,12 +126,6 @@ static int sun8i_rsb_set_device_mode(struct > sunxi_rsb_reg *base) > > static int sun8i_rsb_init(struct sunxi_rsb_reg *base) > { > - /* Enable RSB and PIO clk, and de-assert their resets */ > - prcm_apb0_enable(PRCM_APB0_GATE_PIO | PRCM_APB0_GATE_RSB); > - > - /* Setup external pins */ > - sun8i_rsb_cfg_io(); > - > writel(RSB_CTRL_SOFT_RST, &base->ctrl); > sun8i_rsb_set_clk(base); > > @@ -185,6 +158,25 @@ int rsb_init(void) > { > struct sunxi_rsb_reg *base = (struct sunxi_rsb_reg *)SUNXI_RSB_BASE; > > + /* Enable RSB and PIO clk, and de-assert their resets */ > + prcm_apb0_enable(PRCM_APB0_GATE_PIO | PRCM_APB0_GATE_RSB); > + > + if (IS_ENABLED(CONFIG_MACH_SUN9I)) { > + sunxi_gpio_set_cfgpin(SUNXI_GPN(0), SUN9I_GPN_R_RSB); > + sunxi_gpio_set_cfgpin(SUNXI_GPN(1), SUN9I_GPN_R_RSB); > + sunxi_gpio_set_pull(SUNXI_GPN(0), 1); > + sunxi_gpio_set_pull(SUNXI_GPN(1), 1); > + sunxi_gpio_set_drv(SUNXI_GPN(0), 2); > + sunxi_gpio_set_drv(SUNXI_GPN(1), 2); > + } else { > + sunxi_gpio_set_cfgpin(SUNXI_GPL(0), SUN8I_GPL_R_RSB); > + sunxi_gpio_set_cfgpin(SUNXI_GPL(1), SUN8I_GPL_R_RSB); > + sunxi_gpio_set_pull(SUNXI_GPL(0), 1); > + sunxi_gpio_set_pull(SUNXI_GPL(1), 1); > + sunxi_gpio_set_drv(SUNXI_GPL(0), 2); > + sunxi_gpio_set_drv(SUNXI_GPL(1), 2); > + } > + > return sun8i_rsb_init(base); > } > #endif
Re: [PATCH v2 23/23] spi: sun4i_spi: Remove non-DM pin setup
On Thu, 17 Mar 2022 22:54:20 -0500 Samuel Holland wrote: > This is now handled automatically by the pinctrl driver. > > Signed-off-by: Samuel Holland Again a nice cleanup! Reviewed-by: Andre Przywara Cheers, Andre > --- > > (no changes since v1) > > drivers/spi/spi-sunxi.c | 84 - > 1 file changed, 84 deletions(-) > > diff --git a/drivers/spi/spi-sunxi.c b/drivers/spi/spi-sunxi.c > index d62355ec6f..b6cd7ddafa 100644 > --- a/drivers/spi/spi-sunxi.c > +++ b/drivers/spi/spi-sunxi.c > @@ -32,7 +32,6 @@ > #include > > #include > -#include > #include > > #include > @@ -180,87 +179,6 @@ static void sun4i_spi_set_cs(struct udevice *bus, u8 cs, > bool enable) > writel(reg, SPI_REG(priv, SPI_TCR)); > } > > -static int sun4i_spi_parse_pins(struct udevice *dev) > -{ > - const void *fdt = gd->fdt_blob; > - const char *pin_name; > - const fdt32_t *list; > - u32 phandle; > - int drive, pull = 0, pin, i; > - int offset; > - int size; > - > - list = fdt_getprop(fdt, dev_of_offset(dev), "pinctrl-0", &size); > - if (!list) { > - printf("WARNING: sun4i_spi: cannot find pinctrl-0 node\n"); > - return -EINVAL; > - } > - > - while (size) { > - phandle = fdt32_to_cpu(*list++); > - size -= sizeof(*list); > - > - offset = fdt_node_offset_by_phandle(fdt, phandle); > - if (offset < 0) > - return offset; > - > - drive = fdt_getprop_u32_default_node(fdt, offset, 0, > - "drive-strength", 0); > - if (drive) { > - if (drive <= 10) > - drive = 0; > - else if (drive <= 20) > - drive = 1; > - else if (drive <= 30) > - drive = 2; > - else > - drive = 3; > - } else { > - drive = fdt_getprop_u32_default_node(fdt, offset, 0, > - "allwinner,drive", > - 0); > - drive = min(drive, 3); > - } > - > - if (fdt_get_property(fdt, offset, "bias-disable", NULL)) > - pull = 0; > - else if (fdt_get_property(fdt, offset, "bias-pull-up", NULL)) > - pull = 1; > - else if (fdt_get_property(fdt, offset, "bias-pull-down", NULL)) > - pull = 2; > - else > - pull = fdt_getprop_u32_default_node(fdt, offset, 0, > - "allwinner,pull", > - 0); > - pull = min(pull, 2); > - > - for (i = 0; ; i++) { > - pin_name = fdt_stringlist_get(fdt, offset, > - "pins", i, NULL); > - if (!pin_name) { > - pin_name = fdt_stringlist_get(fdt, offset, > - "allwinner,pins", > -i, NULL); > - if (!pin_name) > - break; > - } > - > - pin = sunxi_name_to_gpio(pin_name); > - if (pin < 0) > - break; > - > - if (IS_ENABLED(CONFIG_MACH_SUN50I) || > - IS_ENABLED(CONFIG_SUN50I_GEN_H6)) > - sunxi_gpio_set_cfgpin(pin, SUN50I_GPC_SPI0); > - else > - sunxi_gpio_set_cfgpin(pin, SUNXI_GPC_SPI0); > - sunxi_gpio_set_drv(pin, drive); > - sunxi_gpio_set_pull(pin, pull); > - } > - } > - return 0; > -} > - > static inline int sun4i_spi_set_clock(struct udevice *dev, bool enable) > { > struct sun4i_spi_priv *priv = dev_get_priv(dev); > @@ -507,8 +425,6 @@ static int sun4i_spi_probe(struct udevice *bus) > return ret; > } > > - sun4i_spi_parse_pins(bus); > - > priv->variant = plat->variant; > priv->base = plat->base; > priv->freq = plat->max_hz;